text
stringlengths
1
927k
import pytest from eth_utils import ( decode_hex, ) from eth_keys import keys from trinity.utils.chains import ( get_local_data_dir, get_database_dir, get_nodekey_path, ChainConfig, ) from trinity.utils.filesystem import ( is_same_path, ) def test_chain_config_computed_properties(): dat...
import pandas as pd import subprocess, os import src.utils.loader as loader def create_test_arff(participant, test_df, aux_path): arff_text = "@relation summary_features \n\n" \ "@attribute n_faces numeric\n" \ "@attribute avg_confidence_faces numeric\n" \ "@attribut...
#!/usr/bin/env python3 # Copyright (c) 2015-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 new CounosCoin multisig prefix functionality. # from test_framework.test_framework import Bitco...
#!/usr/bin/env python # encoding: utf-8 """ copyright (c) 2016-2017 Earth Advantage. All rights reserved ..codeauthor::Paul Munday <paul@paulmunday.net> """ # Setup # Constants # Data Structure Definitions # Private Functions # Public Classes and Functions class APIClientError(Exception): """Indicates erro...
# IMPORTATION STANDARD # IMPORTATION THIRDPARTY import pytest # IMPORTATION INTERNAL from openbb_terminal.cryptocurrency.due_diligence import messari_model @pytest.fixture(scope="module") def vcr_config(): return { "filter_headers": [ ("User-Agent", None), ("x-messari-api-key", "...
# (C) Datadog, Inc. 2019-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) # stdlib import os import tempfile import mock import pytest from datadog_checks.kube_apiserver_metrics import KubeAPIServerMetricsCheck from .common import APISERVER_INSTANCE_BEARER_TOKEN customtag =...
#!/usr/bin/env python # -*- coding: utf-8 -*- # $Id: gen-sql-comments.py 69781 2017-11-20 18:41:33Z vboxsync $ """ Converts doxygen style comments in SQL script to COMMENT ON statements. """ __copyright__ = \ """ Copyright (C) 2012-2017 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as...
# -*- coding: utf-8 -*- import pytest from dwim.rules.ln_no_hard_link import match, get_new_command from tests.utils import Command error = "hard link not allowed for directory" @pytest.mark.parametrize('script, stderr', [ ("ln barDir barLink", "ln: ‘barDir’: {}"), ("sudo ln a b", "ln: ‘a’: {}"), ("sudo ...
#!/usr/bin/env python # # gcc.py - Helper for 'gcc' # # October 2016, Glenn F. Matthews # Copyright (c) 2013-2016 the COT project developers. # See the COPYRIGHT.txt file at the top-level directory of this distribution # and at https://github.com/glennmatthews/cot/blob/master/COPYRIGHT.txt. # # This file is part of the...
import unittest import numpy import os import raviewer.image.image as image import raviewer.image.color_format as cf from raviewer.src.core import load_image class TestImageClass(unittest.TestCase): def setUp(self): self.TEST_FILE_BGR = os.path.join(os.path.dirname(__file__), ...
# coding: utf-8 """ Kubernetes No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: v1.18.20 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six f...
from build import * from release import * from fabric.network import ssh from fabric.api import env, put, run, sudo, task from fabric.decorators import runs_once ssh.util.log_to_file("paramiko.log", 10) env.use_ssh_config = True WORKSPACE_DIR = os.path.join(DEPLOYMENT_WORKING_DIR, "templates/workspace/") print("WORKS...
import dataclasses import enum import inspect import json import struct import sys import typing from abc import ABC from base64 import b64decode, b64encode from datetime import datetime, timedelta, timezone from dateutil.parser import isoparse from typing import ( Any, Callable, Dict, Generator, Li...
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# # Lithium-ion base model class # import pybamm class BaseModel(pybamm.BaseBatteryModel): """ Overwrites default parameters from Base Model with default parameters for lithium-ion models **Extends:** :class:`pybamm.BaseBatteryModel` """ def __init__(self, options=None, name="Unnamed lithiu...
# Copyright (C) 2019 Verizon. 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 ...
import string from _collections import defaultdict import csv def get_word_count(input_filename): ''' Takes a text file as input and returns the word count as Python Dictionary ''' with open(input_filename) as f_input: lines = f_input.readlines() word_dict = defaultdict(int) ...
# Copyright 2014 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. DEPS = [ 'recipe_engine/json', 'recipe_engine/raw_io', 'recipe_engine/path', 'recipe_engine/platform', 'recipe_engine/properties', 'recipe_engine...
import tensorflow as tf import sys import numpy as np import time import glob from natsort import natsorted import getopt import importlib as il import matplotlib.pyplot as plt def next_batch(loop, input_dir, batch_size, data_length): f = glob.glob(str(input_dir)+"*") f_srt=natsorted(f) with np.load(str(f_...
""" Basic molecular features. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals __author__ = "Steven Kearnes" __copyright__ = "Copyright 2014, Stanford University" __license__ = "LGPL v2.1+" from rdkit.Chem import Descriptors from deepchem.feat import Fe...
# Copyright (c) 2019-2020 Simons Observatory. # Full license can be found in the top level "LICENSE" file. import numpy as np from toast.timing import function_timer, Timer from toast.tod import AnalyticNoise from toast.utils import Logger import toast.qarray as qa from ...sim_hardware import get_example def add_s...
#!/usr/bin/env python from testcases import gen_random, gen_fake_random from time import time begin = time() RANDOM = True conf_cnt = 7 if RANDOM: test_cases = gen_random(10, conf_cnt) else: test_cases = gen_fake_random() def check_valid(colors: list) -> bool: # check if it's a valid palette fo...
"""Local support for Insteon.""" import logging _LOGGER = logging.getLogger(__name__) def setup(hass, config): """Set up the insteon_local component. This component is deprecated as of release 0.77 and should be removed in release 0.90. """ _LOGGER.warning('The insteon_local component has been r...
from unittest import mock import pytest from rest_framework.exceptions import ValidationError as DRFValidationError from know_me import models from know_me.serializers import subscription_serializers from know_me.subscriptions import ReceiptException, AppleTransaction def test_save(): """ The save method of...
# 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...
#!/usr/bin/python # -*- coding: utf-8 -*- # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This progra...
import unittest from subprocess import call, check_call, check_output import os.path from .fixtures import Fixture @Fixture.inside_container class DepsTest(Fixture, unittest.TestCase): def test_install_deps(self): # Ensure rkt is not installed self.assertEqual(1, call(['which', 'rkt'])) ...
# """ # This is Master's API interface. # You should not implement it, or speculate about its implementation # """ # class Master: # def guess(self, word: str) -> int: class Solution: def findSecretWord(self, wordlist: List[str], master: 'Master') -> None: word = wordlist[0] words = set(wordlis...
class Result(object): def __init__(self, result): self._result = result self._teams = [] self._scores = [] def parse(self): """ Parse a results file entry Result format is Team_Name Score, Team_Name Score Parameters: self.result ...
import ctypes as ct import numpy as np import scipy.io as scio import matplotlib.pyplot as plt # Init ctypes types DOUBLE = ct.c_double PtrDOUBLE = ct.POINTER(DOUBLE) PtrPtrDOUBLE = ct.POINTER(PtrDOUBLE) class TestStruct(ct.Structure): _fields_ = [ ("ScanR", ct.c_double), ("DecFan...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2017-07-06 10:38:13 # @Author : Yan Liu & Zhi Liu (zhiliu.mind@gmail.com) # @Link : http://iridescent.ink # @Version : $1.0$ # import numpy as np import pysparse as pys import matplotlib.pyplot as plt Fs = 2000 Ts = 1 Ns = int(Ts * Fs) f1 = 100 f2 = 200 ...
from __future__ import unicode_literals import datetime import inspect import decimal import collections from importlib import import_module import os import sys import types from django.apps import apps from django.db import models from django.db.migrations.loader import MigrationLoader from django.utils import date...
# ID : 12 # Title : Integer to Roman # Difficulty : MEDIUM # Acceptance_rate : 57.2% # Runtime : 40 ms # Memory : 12.8 MB # Tags : Math , String # Language : python3 # Problem_link : https://leetcode.com/problems/integer-to-roman # Premium : 0 # Notes : - ### def intToRoman(self, num: int) -> str: mapping...
#!/usr/bin/env python2 import os, sys, time from socket import socket, AF_INET, SOCK_STREAM host=(("192.168.56.4",9999)) NOTES = """ ## located the name recv in WS2_32.dll ## POINTS TO: 71AB615A > 8BFF MOV EDI,EDI ## Set a breakpoint on the instruction it points to ## Sent the payload. Breakpoint hit....
from .base import NPModuleBase class ChatRedisTransactions(object): def __init__(self, redis): "docstring" self.redis = redis def add_chat(self, chat_id, chat_title, chat_username): self.redis.hmset(chat_id, {"id": chat_id, "title": chat_title, ...
""" This project demonstrates NESTED LOOPS (i.e., loops within loops) in the context of SEQUENCES OF SUB-SEQUENCES. Authors: David Mutchler, Vibha Alangar, Matt Boutell, Dave Fisher, Mark Hays, Amanda Stouder, Aaron Wilkin, their colleagues, and Jack Franey. """ # DONE: 1. PUT YOUR NAME IN THE ABOVE...
from . import classifier from . import core from . import plot from . import tools __version__ = "0.2.0"
from typing import List from ..defines import SupportedPython from ..step_builder import StepBuilder def docs_steps() -> List[dict]: return [ # If this test is failing because you may have either: # (1) Updated the code that is referenced by a literalinclude in the documentation # (2)...
""" Train a VAE model used to filter and enhance 3d points """ import json from datetime import datetime import matplotlib import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from tqdm import tqdm import cameras import data_utils import viz from top_vae_...
""" Configuration for docs """ # source_link = "https://github.com/[org_name]/foundryapp" # docs_base_url = "https://[org_name].github.io/foundryapp" # headline = "App that does everything" # sub_heading = "Yes, you got that right the first time, everything" def get_context(context): context.brand_html = "FoundryApp...
import torch import torch.nn as nn from torch.distributions import MultivariateNormal from torchdyn.models import NeuralODE from torchdyn import Augmenter from torchdyn.models.cnf import CNF, hutch_trace, autograd_trace def test_cnf_vanilla(): device = torch.device('cpu') net = nn.Sequential( nn.L...
# standard library import logging import unittest # third party imports import numpy as np # local imports from probeye.definition.forward_model import ForwardModelBase from probeye.definition.sensor import Sensor from probeye.definition.inference_problem import InferenceProblem from probeye.definition.noise_model im...
# Copyright 2017 SAP SE # # 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 appl...
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import soft_renderer.functional as srf class Mesh(object): ''' A simple class for creating and manipulating trimesh objects ''' def __init__(self, vertices, faces, textures=None, texture_res=1, texture_type='surface...
# -*- coding: utf-8 -*- """ execnet ------- pure python lib for connecting to local and remote Python Interpreters. (c) 2012, Holger Krekel and others """ from ._version import version as __version__ from .deprecated import PopenGateway from .deprecated import SocketGateway from .deprecated import SshGateway from .ga...
# Copyright 2022 The Sigstore Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
# -*- coding: utf-8 -*- """ Zegami Ltd. Apache 2.0 """ from .collection import Collection class Workspace(): def __init__(self, client, workspace_dict): self._client = client self._data = workspace_dict self._check_data() @property def id(): pass @id.get...
import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), '../tools')) import files import distance def main(argv): lines = files.read_lines(argv[0]) print distance.edit(lines[0], lines[1]) if __name__ == "__main__": main(sys.argv[1:])
from unicodedata import name from setuptools import setup with open("README.md","r") as fh: long_description = fh.read() setup( name = 'dawsonmuse', version = '0.0.1', description= 'A module for running EEG experiments with Psychopy and a Muse device.', py_modules=["dawsonmuse"], author="Tokin...
import logging from homeassistant.components import persistent_notification from homeassistant.helpers.entity import ToggleEntity from . import DOMAIN from .core.gateway3 import Gateway3 from .core.helpers import XiaomiEntity _LOGGER = logging.getLogger(__name__) async def async_setup_entry(hass, config_entry, asy...
# -*- coding: utf-8 -*- """ Profile: http://hl7.org/fhir/StructureDefinition/DeviceMetric Release: STU3 Version: 3.0.2 Revision: 11917 Last updated: 2019-10-24T11:53:00+11:00 """ import sys from . import backboneelement, domainresource class DeviceMetric(domainresource.DomainResource): """ Measurement, calcula...
import pandas as pd def get_value(text): return text.split("_")[0] def load_results(path: str, params): all_parameters = {} file_name = path.split("/")[-1].split(".csv")[0] file_name = file_name.split("=")[1:] for i, f in enumerate(file_name): all_parameters[params[i]] = get_value(f) ...
import logging import time from threading import Event from watchdog.observers import Observer from .OutputEventHandler import OutputEventHandler class FileSystemObserver(object): def __init__(self, test_output_dir): self.test_output_dir = test_output_dir # Start observing output dir s...
# -*- coding: utf-8 -*- # # OpenFAST documentation build configuration file, created by # sphinx-quickstart on Wed Jan 25 13:52:07 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # ...
from tic_tac_toe.Board import Board, GameResult from tic_tac_toe.RandomPlayer import RandomPlayer from tic_tac_toe.MinMaxAgent import MinMaxAgent from tic_tac_toe.RndMinMaxAgent import RndMinMaxAgent from tic_tac_toe.HumanPlayer import HumanPlayer from tic_tac_toe.TQPlayer import TQPlayer from tic_tac_toe.VFPlayer impo...
""" this is to plot graphs based on the db output: db should be like this: task | run | arch | benchmark | settings(fc, wl, sb, ...) | measuremnts(delay, min_cw, area ...) take as input: the user filtered table prompt user input: the overlay axis, and the choice of geometric mean input data from the da...
# Copyright 2020 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. import json import logging import os import re import shlex import sh...
import os import os.path import sys import datetime import webbrowser import argparse import time import traceback import selenium import selenium.webdriver.chrome.options import pathlib # ======== Command args singleton class CommandArgs: def __init__ (self): self.argParser = argparse.ArgumentParser () ...
# Copyright (C) 2020 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Functions to fix data related to ACL""" import sqlalchemy as sa # pylint: disable=too-many-arguments def create_missing_acl(connection, migration_user_id, role_id, table_name, o...
from fastapi_camelcase import CamelModel class ExampleResponse(CamelModel): """ A person, place, or thing to say hello to """ #: Some value of the example response response_value: str
# 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...
"""Provide a class for testing esmvaltool.""" import glob import os import shutil import sys from unittest import SkipTest import numpy as np import yaml # from easytest import EasyTest import esmvaltool def _load_config(filename=None): """Load test configuration""" if filename is None: # look in d...
#Mass Spring Damper system Parameter File import numpy as np import control as cnt import sys sys.path.append('..') #add parent directory import massSpringParam as P Ts = P.Ts beta = P.beta tau_max = P.tau_max m = P.m k = P.k b = P.b #tuning parameters #tr=1.6 #previous homework was done on the basis of tr=1.6 and...
# 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...
#!/usr/bin/env python # Copyright 2020 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 or ...
""" Module with utilities for vizualizing EOExecutor """ import os import inspect import warnings import base64 import copy try: import matplotlib.pyplot as plt except ImportError: import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt import graphviz import pygments import pygments....
""" .. module:: python-etcd :synopsis: A python etcd client. .. moduleauthor:: Jose Plana <jplana@gmail.com> """ import urllib3 import json import ssl import etcd class Client(object): """ Client for etcd, the distributed log service using raft. """ _MGET = 'GET' _MPUT = 'PUT' _MPOST ...
from setuptools import setup with open("README.md", "r") as fh: long_description = fh.read() setup( name="airML", version="0.0.2", author="Lahiru Oshara Hinguruduwa", author_email='oshara.16@cse.mrt.ac.lk', url='https://github.com/AKSW/airML', description="application will allow users to "...
import json import boto3 import json autoscaling = boto3.client('autoscaling') processes_to_suspend = ["AZRebalance", "AlarmNotification", "ScheduledActions", "ReplaceUnhealthy"] def update_autoscaling_group(autoscaling_group, asg_min_size): print("Trying to reset %s to minimal size of %i instances" % (autoscal...
# Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
# -*- coding: utf-8 -*- # # Licensed under the terms of the BSD 3-Clause or the CeCILL-B License # (see codraft/__init__.py for details) """ CodraFT launcher module """ from guidata.configtools import get_image_file_path from qtpy import QtCore as QC from qtpy import QtGui as QG from qtpy import QtWidgets as QW from...
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json import re import web import sys sys.path.append("/home/www/ShortURL/shorturl") from libs.qrcode import QRCode, ErrorCorrectLevel import settings import models debug = web.config.debug = settings.DEBUG render = web.template.render(settings.TEMPLATE_DIR, ...
z = {0:1, 1:2} for key, value in z.items(): print(key, value)
# 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 ...
#!/usr/bin/env python3 # coding:utf-8 import os import cv2 import time import utils import threading import collections import requests from detect_objects import ObjectDetector #from profilehooks import profile # pip install profilehooks class Fps(object): def __init__(self, buffer_size=15): self.las...
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Site' db.create_table('contacts_and_people_site', ( ('id', self.gf('django.db....
import numpy as np ''' Implementation of the continuous Dice Coefficient (https://www.biorxiv.org/content/10.1101/306977v1.full.pdf) "Continuous Dice Coefficient: a Method for Evaluating Probabilistic Segmentations" Reuben R Shamir,Yuval Duchin, Jinyoung Kim, Guillermo Sapiro, and Noam Harel Input: A - ground-truth o...
# (C) Datadog, Inc. 2010-2016 # All rights reserved # Licensed under Simplified BSD License (see LICENSE) # stdlib import logging from time import time # project from checks.metric_types import MetricTypes log = logging.getLogger(__name__) # This is used to ensure that metrics with a timestamp older than # RECENT_...
def test_movie_taglines_if_single_should_be_a_list_of_phrases(ia): movie = ia.get_movie('0109151', info=['taglines']) # Matrix (V) taglines = movie.get('taglines', []) assert taglines == ["If humans don't want me... why'd they create me?"] def test_movie_taglines_if_multiple_should_be_a_list_of_phrases(i...
from ms_deisotope._c.spectrum_graph import ( PathFinder, MassWrapper, PeakGroupNode, PeakNode, NodeBase, Path, SpectrumGraph) amino_acids = [ MassWrapper('G', 57.02146372057), MassWrapper('A', 71.03711378471), MassWrapper('S', 87.03202840427), MassWrapper('P', 97.05276384884...
from win32com.shell import shell, shellcon import win32con def ExplorePIDL(): pidl = shell.SHGetSpecialFolderLocation(0, shellcon.CSIDL_DESKTOP) print "The desktop is at", shell.SHGetPathFromIDList(pidl) shell.ShellExecuteEx(fMask=shellcon.SEE_MASK_NOCLOSEPROCESS, nShow=win32con.SW...
import os from i3pystatus.core.command import run_through_shell from i3pystatus.updates import Backend class AptGet(Backend): """ Gets update count for Debian based distributions. This mimics the Arch Linux `checkupdates` script but with apt-get and written in python. """ @property def ...
from .celery_app import celeryApp import logging import copy import os import json import jsonpickle from a2ml.api.utils.context import Context from a2ml.api.a2ml import A2ML from a2ml.api.a2ml_dataset import A2MLDataset from a2ml.api.a2ml_experiment import A2MLExperiment from a2ml.api.a2ml_model import A2MLModel from...
# -*- encoding: utf-8 -*- # Module iareadurl def iareadurl(url): from StringIO import StringIO import urllib import PIL import adpil file = StringIO(urllib.urlopen(url).read()) img = PIL.Image.open(file) return adpil.pil2array(img)
""" @author: Dilip Jain @title: Image Classifier training file """ import argparse import json import PIL import torch import numpy as np from math import ceil from train import check_gpu from torchvision import models # ------------------------------------------------------------------------------- # # Function Def...
__author__ = 'patras' from domain_chargeableRobot import * from timer import DURATION from state import state DURATION.TIME = { 'put': 2, 'take': 2, 'perceive': 2, 'charge': 2, 'move': 2, 'moveToEmergency': 2, 'moveCharger': 2, 'addressEmergency': 2, 'wait': 2, } DURATION.COUNTER =...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Inky display-type EEPROM tools.""" import datetime import struct EEP_ADDRESS = 0x50 EEP_WP = 12 DISPLAY_VARIANT = [ None, 'Red pHAT (High-Temp)', 'Yellow wHAT', 'Black wHAT', 'Black pHAT', 'Yellow pHAT', 'Red wHAT', 'Red wHAT (High-T...
class TestCase(object): M = 10 rows = [ (3,2), (1,1,3), (1,4), (2,), (3,), (1,3), (4,), (8,), (8,), (6,), ] cols = [ (3,), (3,3), (1,1,3), (2,3), (3,), (3,), (1,3)...
from run_pplm import run_pplm_example if __name__ == '__main__': prefix = ['The orange', 'The spider man', 'my father'] for p in prefix: with open('demos/computer', 'a') as file: file.write( '===================================================================================...
# Generated by Django 3.0.3 on 2020-04-19 12:55 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('student', '0012_auto_20200419_1255'), ('attendance', '0001_initial'), ] operations = [ migrations.A...
import unittest import json from app import create_app from app.models.v2 import Business class DeleteBusinessTestCase(unittest.TestCase): """This class represents the api test case""" def setUp(self): """ Will be called before every test """ self.app = create_app('testing') ...
""" ``scenesim.display.geometry`` ============================= Functions for manipulating graphics geometry. """ import numpy as np def zbuffer_to_z(zb, near, far): """Inputs Z-buffer image and returns each pixel's distance from the camera along the Z-axis. Args: zb (numpy.ndarray, 2D): Z-buffe...
# -*- coding: utf-8 -*- # @Author : Ecohnoch(xcy) # @File : service.py # @Function : TODO import copy import flask_login from app import app, db import configs def get_data_from_page_limit(page, limit): all_requests = db[configs.app_database_request_table].find() results = db[configs.app_database_table...
import datetime import logging import math import voluptuous as vol from esphome import automation import esphome.config_validation as cv from esphome.const import CONF_CRON, CONF_DAYS_OF_MONTH, CONF_DAYS_OF_WEEK, CONF_HOURS, \ CONF_MINUTES, CONF_MONTHS, CONF_ON_TIME, CONF_SECONDS, CONF_TIMEZONE, CONF_TRIGGER_ID ...
# Copyright 2017, 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 or agreed to in writing,...
from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) full_name = models.CharField(max_length=100) email = models.E...
# ! /usr/bin/python # -*- coding: utf-8 -*- # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Licensed under NVIDIA Simple Streamer License from StreamingTools import StreamClient if __name__ == "__main__": client = StreamClient()
class Solution(object): def findKthLargest(self, nums, k): """ :type nums: List[int] :type k: int :rtype: int """ pivot = random.choice(nums); nums1, nums2 = [], [] for num in nums: if num > pivot: nums1.append(num) eli...
# importing module constants from . from . import constants # importing module helper from . from . import helper