content
stringlengths
5
1.05M
import fiftyone.zoo as foz import what.utils.logger as log import torch from torch.utils.data import DataLoader from what.models.detection.datasets.fiftyone import FiftyOneDataset from what.models.detection.datasets.voc import VOCDataset from what.models.detection.ssd.ssd.ssd import MatchPrior from what.models.detec...
from conans import ConanFile, CMake, tools import os required_conan_version = ">=1.43.0" class GhcFilesystemRecipe(ConanFile): name = "ghc-filesystem" description = "A header-only single-file std::filesystem compatible helper library" topics = ("ghc-filesystem", "header-only", "filesystem") homepage ...
import os import png from PIL import Image class Printer(object): def __init__(self): self.on = True def __call__(self, message, *stuff): if self.on: print(message.format(*stuff)) return stuff[0] ################################## # IO THPS Scene Image Correction # #####...
import subprocess CMD = "heroku config:get DATABASE_URL -a benzak" RESULT = subprocess.run(CMD.split(" "), capture_output=True) DATABASE_URL = RESULT.stdout.decode().strip() import dj_database_url P = dj_database_url.parse(DATABASE_URL) print(f"\n\n<><><><><><><><>\n{P['PASSWORD']}\n<><><><><><><><>\n\n") print(...
# Copyright 2015 Geoscience Australia # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, BooleanField from wtforms.validators import InputRequired, Email, Length class LoginForm(FlaskForm): username = StringField('username', validators=[InputRequired(), Length(min=4, max=80)],render_kw={"type":"email", "class":"form-contr...
from django.test import TestCase from django.db import models from app.tests.factories.todos import TodoFactory class TodoModelTest(TestCase): """ This class defines the test suite for the todo model. """ todo = None @classmethod def setUpTestData(cls): # Set up non-modified objects...
# Generated by Django 3.0.6 on 2020-06-23 12:54 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('My_Account', '0024_auto_...
import backtrader as bt import numpy as np from scipy.stats import linregress diff_her = 90 class TestStrategy(bt.Strategy): def log(self, txt, dt=None): ''' Logging function fot this strategy''' dt = dt or self.datas[0].datetime.date(0) print('%s, %s' % (dt.isoformat(), txt)) def __...
def <caret>f(x, y): """ Summary. Returns: """
#!/usr/bin/python3 ## -*- coding: utf-8 -*- import learn_math AppData = { 'TITLE': 'Learning-Python, Python Samples and Templates', 'DESC': 'A simple python project template sample.', 'AUTHOR': 'naturestone', 'VERSION': '1.0.1' } #######################################################################...
from functools import partial from PySide import QtGui, QtCore from jukeboxcore.gui.widgets.reftrackwidget_ui import Ui_ReftrackWidget from jukeboxcore.gui.widgets.optionselector_ui import Ui_OptionSelector from jukeboxcore.gui.widgets.browser import ComboBoxBrowser from jukeboxcore.gui.widgetdelegate import WidgetDe...
__version__ = "0.1.0b3"
# Copyright (c) Niall Asher 2022 # disabling PyUnresolvedReferences for the import. # noinspection PyUnresolvedReferences from socialserver.util.test import ( create_comment_with_request, create_user_with_request, server_address, test_db, create_post_with_request, ) from socialserver.constants imp...
#!/usr/bin/python # -*- coding: utf-8 -*- """ Simple tool to convert Time Zones boundaries defined in multipolygon tz_world shapefile (see http://efele.net/maps/tz/world/) to a SQLite database for quicker Location->Time Zone mapping. Database contains a single table which may be merged to existing database. """ import...
from sqlalchemy import MetaData, Table, Column, UnicodeText from sqlalchemy.sql.schema import CheckConstraint, ForeignKey meta = MetaData() def upgrade(migrate_engine): meta.bind = migrate_engine s = Table("service", meta, autoload=True) instroduction = Column("introduction", UnicodeText) instroduct...
# -*- coding: utf-8 -*- import os from django.db import models from django.contrib.auth.models import User from django.db.utils import Error from django.db.models.signals import post_delete from django.dispatch import receiver from django.utils.functional import cached_property import json # Create your models here. ...
try: from queue import Queue except ImportError: from Queue import Queue from mirobot.socket_handler import SocketHandler import time import string import random import sys import json try: import urllib.request as request except ImportError: import urllib2 as request _sentinel = object() class Mirobot: def...
import json import pytest from eth_account.messages import encode_defunct import ape from ape import convert from ape.exceptions import AccountsError, ContractLogicError, SignatureError, TransactionError ALIAS = "__FUNCTIONAL_TESTS_ALIAS__" @pytest.fixture(autouse=True, scope="module") def connected(eth_tester_pro...
from PIL import Image import numpy as np import os INPUT_DIR_IMAGE = "images" OUTPUT_DIR_IMAGE = os.path.join("images", "output") def in_path(filename): return os.path.join(INPUT_DIR_IMAGE, filename) def getImage(filename): image = Image.open(in_path(filename)) return image def saveImage(file, filename): di...
import os import pprint import sys from logging import Filter, Handler, Logger from typing import Iterable from slack import WebClient from slack.errors import SlackApiError class SlackHandler(Handler): def __init__(self, token, channel_id): Handler.__init__(self) self.client = WebClient(token) ...
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ wlanpi_webui.app ~~~~~~~~~~~~~~~~ the main flask app """ import logging from flask import Flask, abort, redirect, request, send_from_directory from wlanpi_webui.config import Config def create_app(config_class=Config): app = Flask(__name__) app.config.from_o...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Feb 14 10:53:41 2020 @author: Alejandro Villada Balbuena """ #%% from __future__ import division, unicode_literals, print_function # for compatibility with Python 2 and 3 from pims import ND2Reader_SDK from tifffile import imsave import os workdir = ...
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved. # This is licensed software from AccelByte Inc, for limitations # and restrictions contact your company contract manager. # # Code generated. DO NOT EDIT! # template file: justice_py_sdk_codegen/__main__.py # justice-platform-service (4.10.0) # pylint: disabl...
NAMES = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'] NAMES_LENGTH = [len(name) for name in NAMES] NAMES_TENS = ['', 'ten', 'twenty', 'thirty', 'forty', 'fifty'...
# Copyright 2020 Xilinx Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
from event.models import Worker from django.http import JsonResponse from django.shortcuts import render # Create your views here. def Worker_List(request,event_id, name): result = {} if name is not None: query = Worker.objects.filter(last_name__icontains=name, working_at=event_id) for count, w...
from os.path import join from pydantic import BaseSettings import appdirs APP_NAME = "iscc-registry" APP_DIR = appdirs.user_data_dir(appname=APP_NAME) ENV_PATH = join(APP_DIR, ".env") __version__ = "0.1.0" # Ledger-ID Ethereum LEDGER_ID_ETH = 0b01000000 .to_bytes(1, "big") class Settings(BaseSettings): ipfs_a...
# coding=utf-8 # Creation date: 19 окт. 2020 # Creation time: 10:22 # Creator: SteamPeKa import warnings from typing import TypeVar, Generic, Iterable, Union import numpy VT = TypeVar("VT") class AbstractMetric(Generic[VT], object): def __init__(self, *args, **kwargs): return def __call__(self, va...
import requests import random import string amount = int(input("Amount To Generate: ")) for i in range(amount): randomNumbers = random.randint(1, 999999) randomLetters = ('').join(random.choices( string.ascii_letters, k=25)) bypass = requests.Session() generatePayload = { "...
""" Update task priority. Initial delay: rand(1 minute) Periodic delay: 5 minutes """ import logging import random import time import asyncio from collections import defaultdict from tornado.ioloop import IOLoop from iceprod.server import GlobalID from iceprod.server.priority import Priority logger = logging.getLo...
import os from notebook.utils import ( url_path_join, url_escape ) from notebook.base.handlers import ( IPythonHandler, FilesRedirectHandler ) from tornado import web from biokbase.narrative.common.kblogging import ( get_logger, log_event ) from biokbase.narrative.common.util import kbase_env import urllib ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jan 20 10:48:38 2021 @author: rgonzalez """ import qiskit.aqua.components.optimizers as aqoptim import sys import numpy as np optimizer_avail = ['cg', 'slsqp', 'l-bfgs-b', 'cobyla', ...
import logging import warnings from abc import ABCMeta, abstractmethod from collections import OrderedDict from functools import reduce from operator import mul import lab as B import numpy as np import wbml.out from lab.shape import Shape from plum import Dispatcher from .util import lazy_jnp as jnp from .util impor...
""" #!/usr/bin/python3 # This file attempts to listen in on the communications of the MIL Bus and log activity in a .json file # This file is a WORK IN PROGRESS # TODO: Replace example event with actual code that gets an event from the simulator CORRECTLY import socket import threading import json import time import ...
import time from mpi4py import MPI import numpy as np import pickle import os t_init = time.perf_counter() # for Beskow comm = MPI.COMM_WORLD size = comm.Get_size()# make sure nx is divisible by size rank = comm.Get_rank() # # for personal laptop # rank = 0 # size = 1 nsteps = 10 len_T_rank = 2+nsteps*2 T_rank = np...
from django.db import models import string, random, datetime from profiles.models import UserProfile, Location, Surcharges, User from decimal import * from menu.models import Product, Entree, Pizza, PizzaTopping, Side from localflavor.us.models import PhoneNumberField, USStateField, USZipCodeField #modify this to che...
hexa = { '0': '0000', '1': '0001', '2': '0010', '3': '0011', '4': '0100', '5': '0101', '6': '0110', '7': '0111', '8': '1000', '9': '1001', 'A': '1010', 'B': '1011', 'C': '1100', 'D': '1101', 'E': '1110', 'F': '1111' } def hexToBin(hex_number): return...
#!/usr/bin/env python import time import uuid import argparse import hivemind def get_public_ip(): from whatsmyip.ip import get_ip from whatsmyip.providers import GoogleDnsProvider return get_ip(GoogleDnsProvider) if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argumen...
from __future__ import absolute_import import six import warnings from civis._version import __version__ from civis.civis import APIClient, find, find_one from civis import io, ml, parallel, utils if six.PY2: warnings.warn("Support for Python 2 is deprecated will be " "removed in the next versi...
#This class loads all config files and tests some issue before the game begins. import json import pygame from utils.io_supporter import decrypt_file #from configString import config_string as configuration # CONSTANTS ## CONSTANTS UP = "UP" DOWN = "DOWN" LEFT = "LEFT" RIGHT = "RIGHT" UP_LEFT = "UP_LEFT" UP_RIGHT...
''' Running instructions: python find_outliers.py CHICAGO_CRIME_DATA.csv NUM_DATA_POINTS_AFTER STOP_AFTER ''' import cPickle as pickle import lib import numpy as np import sys import sklearn.ensemble num_after = int(sys.argv[2]) stop_after = int(sys.argv[3]) classifier = pickle.load(open('classifier.pickle')) ...
import os, sys; sys.path.append(os.path.join("..", "..", "..")) from pattern.table import Table from pattern.table import uid, pprint # The main purpose of the pattern module is to facilitate automated processes # for (text) data acquisition and (linguistical) data mining. # Often, this involves a tangle of messy tex...
## Constructing batches from the stream of data read BATCH_SIZE = 64 def read_batch(stream, batch_size=BATCH_SIZE): batch = [] for element in stream: batch.append(element) if len(batch) == batch_size: yield batch batch = [] yield batch
import os def process(split="dev"): file = os.path.join("/home/data_ti6_c/wangdq/ST/Librispeech/" + split) src_file = file + '_asr.tsv' head = ['id', 'audio', 'n_frames', 'tgt_text', 'speaker'] content = [] with open(src_file) as fsrc: for index, src in enumerate(fsrc.readlines()): ...
# -*- coding: utf-8 -*- from zope.interface import Interface class ILDAPPlugin(Interface): """Marker Interface for the LDAP Plugin """ class ICacheSettingsRecordProvider(Interface): """cache settings provider, expects to return a record on call In future this may be used more generic. """ VALU...
# Copyright 2017 StreamSets Inc. # # 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 writi...
import unittest import pytest import numpy as np from yaonet.tensor import Tensor from yaonet.functional import * class TestTensorFunstion(unittest.TestCase): def test_sigmoid(self): # 90, 30, 150 t1 = Tensor([1, 2, 6], requires_grad=True) t2 = sigmoid(t1) # assert np....
import pytest from flask_restful import Resource from flask_restful_swagger.swagger import SwaggerEndpoint, operation from .lib.helpers import TestCaseSupport try: from unittest.mock import patch except ImportError: from mock import patch class MockDataType(object): pass tc = TestCaseSupport() tc.maxD...
import pygame from src.constant import WIDTH, HEIGTH class Player: def __init__(self): self.obj = pygame.Rect((WIDTH - 90), (HEIGTH / 2 - 70), 20, 140) self.speed = 0 def control_speed(self, event): if event.type == pygame.KEYDOWN: if event.key == pygame.K_DOWN: ...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import...
from .regening import Regening from .swelling import Swelling
import os import hmac import time import hashlib import requests import numpy as np import pandas as pd from dotenv import load_dotenv from urllib.parse import urlencode from supportLibEasyT.log_manager import LogManager class CredentialsNotFound(BaseException): """Raise this error when the key or the BINANCE_API...
# coding:utf-8 """ module for pixar USD """ __version__ = '0.0.0'
ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s" SERVER_IP_URL = "https://api.weixin.qq.com/cgi-bin/getcallbackip?access_token=%s" APP_ID = "wx3eea165d584f5864" SECRET_ID = "d3c237a1bf28009bb5b7e82291f662f8" REDIS_URL = "127.0.0.1" REDIS_PORT = 6379 REDI...
from itertools import cycle def reversi_row(moves): row = ['.'] * 8 player = cycle('*O') for move in moves: current_player = next(player) invalid = {'.', current_player} row[move] = current_player row_str = ''.join(row) # look left first_left = row_str.rfind...
""" This examples show how to train a Cross-Encoder for the MS Marco dataset (https://github.com/microsoft/MSMARCO-Passage-Ranking). The query and the passage are passed simoultanously to a Transformer network. The network then returns a score between 0 and 1 how relevant the passage is for a given query. The resulti...
import sys from google_utils import * from ping import ping_pool import configparser from time import sleep def read_config(path): if not os.path.exists(path): retun = 0 config_file = configparser.ConfigParser() config_file.read(path) config = { 'scopes': config_file.get('main', 'scop...
#!usr/bin/python from math import exp from . import types import typing class FungicideEffect(object): def __init__(self, maxEffect: types.Number, curvatureFactor: types.Number) -> None: self.maxEffect = maxEffect self.curvatureFactor = curvatureFactor def effect(self, dose: types.Number) -> ...
import numpy as np class CARTTree: def __init__(self, value=None, trueBranch=None, falseBranch=None, results=None, col=-1, summary=None, data=None): self.value = value self.trueBranch = trueBranch self.falseBranch = falseBranch self.results = results self.col = col ...
""" test gain and noise stability """ import sys import azcam def test_gain_stability(cycles=5): for i in range(cycles): print(f"Testing cycle: {i + 1}/{cycles}") # azcam.db.exposure.set_roi(-1, -1, 1, 500, 1, 1) azcam.db.gain.find() return if __name__ == "__main__": args = s...
#!/usr/bin/env python3 """ Created on 24 Mar 2021 @author: Bruno Beloff (bruno.beloff@southcoastscience.com) """ from scs_host.sys.host import Host # -------------------------------------------------------------------------------------------------------------------- sim = Host.sim() print(sim)
#!/usr/bin/env python # -*- coding: utf8 -*- # ***************************************************************** # ** PTS -- Python Toolkit for working with SKIRT ** # ** © Astronomical Observatory, Ghent University ** # ***************************************************************** ##...
__version__ = '0.8.2' from kson.read.load import load # noqa: F401 from kson.read.load import loads # noqa: F401 from kson.write.writer import dump # noqa: F401 from kson.write.writer import dumps # noqa: F401
# Copyright Pincer 2021-Present # Full MIT License can be found in `LICENSE` at the project root. from __future__ import annotations from dataclasses import dataclass from typing import TYPE_CHECKING from ...utils.api_object import APIObject from ...utils.types import MISSING if TYPE_CHECKING: from ...utils imp...
import math class const: pi=3.14159265358979323846 G = 6.67e-11 c = 3e+8 class Position2D: def __init__(self,x=0,y=0,tuple_=None): self.x = x self.y = y if(tuple_): self.x=tuple_[0] self.y=tuple_[1] def Set(self,x=None,y=None): if(x is not Non...
import logging class BaseAction(): def __init__(self): pass class Event(BaseAction): pass class Offer(BaseAction): pass class Order(BaseAction): pass
import datetime, requests, os, json, urllib.request from io import BytesIO import google_streetview.api from PIL import Image # for signing urls import hashlib, hmac, base64 from urllib3.util import parse_url import gsv_depth_scraper.geom now = datetime.datetime.now() PANO_URL = 'http://maps.google.com/cbk?output=ti...
# -*- coding: utf-8 -*- # pylint: disable=missing-docstring # pylint: disable=redefined-outer-name # pylint: disable=no-self-use # pylint: disable=protected-access ############################################################# # Copyright (c) 2020-2020 Maurice Karrenbrock # # ...
from django.apps import AppConfig class BankConfig(AppConfig): name = 'bank' def ready(self): import bank.signals
# To make this config usable, you need to rename it to config.py as opposed to exampleconfig.py # To make this config usable, you need to rename it to config.py as opposed to exampleconfig.py! # To make this config usable, you need to rename it to config.py as opposed to exampleconfig.py!! token = "Nzk3NTU5MTE2MjcxOTc...
from tkinter import * from ScreenManager.Screen import Screen def DebugPartion (_Partion): print (_Partion.X, _Partion.Y) #print (Partion.Name) print (_Partion) print (f'Width: {_Partion.WidthPixelPositionStart} -> {_Partion.WidthPixelPositionEnd} || Height: {_Partion.HeightPixelPositionStart} -> {_Pa...
''' 删除子文件夹 你是一位系统管理员,手里有一份文件夹列表 folder,你的任务是要删除该列表中的所有 子文件夹,并以 任意顺序 返回剩下的文件夹。 我们这样定义「子文件夹」: 如果文件夹 folder[i] 位于另一个文件夹 folder[j] 下,那么 folder[i] 就是 folder[j] 的子文件夹。 文件夹的「路径」是由一个或多个按以下格式串联形成的字符串: / 后跟一个或者多个小写英文字母。 例如,/leetcode 和 /leetcode/problems 都是有效的路径,而空字符串和 / 不是。   示例 1: 输入:folder = ["/a","/a/b","/c/d","/c/d/e"...
#_*_ coding: utf-8 _*_ L = [1,2,3] print type(L) print len(L) print L[-1] print L+L print L*3 print (L*3)[::-1] l2 = ['a','b'] l2[0]='c' print l2 l3 = range(10) print l3 print l3[::2] print l3[::-1] print 4 in l3 t = (1,2,3) print len(t) print t[0] print t[::-1] t = t[::-1] print t print t*10 print 3 in t t= t[:...
import hgc from hgc.samples_frame import SamplesFrame import pandas as pd import numpy as np from unittest import TestCase, mock from datetime import datetime import pytest # define the fixtures @pytest.fixture(name='test_data_bas_vdg') def fixture_test_bas_vdg(): """ test data as been used by Bas vdG from testing...
import numpy as np from sklearn.isotonic import IsotonicRegression from cvxopt import matrix, solvers solvers.options['show_progress'] = False ####### # Monotone Cone and Positive Monotone Cone ####### def solve_beta_mnt(X, Y, pos=False, learning_rate=0.01, stop_criteria=10**-4): """ Solve the beta for mo...
from django.db.models import Count, Q from django.http import Http404 from django.shortcuts import render, get_object_or_404, redirect from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin from django.contrib.auth.models import User from .forms import AnswerForm, AnonymousCommentForm from .mode...
class Company(object): def __init__(self, employee_list): self.employee = employee_list def __getitem__(self, item): """任意一个类都可以添加魔法函数,返回item位置的值""" return self.employee[item] def __len__(self): return len(self.employee) def __str__(self): """打印时""" ret...
import os import tempfile import unittest from unittest.mock import patch from local_server.common.annotations.local_file_csv import AnnotationsLocalFile from local_server.common.config.app_config import AppConfig from local_server.common.config.base_config import BaseConfig from local_server.test import FIXTURES_ROO...
import operator from functools import reduce from typing import TYPE_CHECKING, Any, Dict, List, Type from fedot.core.optimisers.opt_history import OptHistory if TYPE_CHECKING: from fedot.core.optimisers.gp_comp.individual import Individual from . import any_from_json def _convert_parent_individuals(individuals...
from frappe.website.page_renderers.template_page import TemplatePage class ErrorPage(TemplatePage): def __init__(self, path=None, http_status_code=None, exception=None): path = "error" super().__init__(path=path, http_status_code=http_status_code) self.exception = exception def can_render(self): return Tru...
"""Utility methods to work with file read and write""" import os import gzip import datetime import zipfile # local imports from omigo_core import s3_wrapper from omigo_core import utils # constant NUM_HOURS = 24 # method to read the data def read_filepaths(path, start_date_str, end_date_str, fileprefix, s3_region...
from _csv import Error from contextlib import contextmanager import re from django.forms.fields import ChoiceField, CharField from django import forms from django.forms import FileField import csv from django.forms.forms import Form, DeclarativeFieldsMetaclass, BoundField from django.forms.widgets import Input, HiddenI...
# Generated by Django 2.2.19 on 2021-05-31 00:15 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('bilbyui', '0013_auto_20210321_2322'), ] operations = [ migrations.AddField( model_name='label', name='protected', ...
from easyauth.router import EasyAuthAPIRouter finance_router = EasyAuthAPIRouter.create(prefix="/finance", tags=["finance"]) @finance_router.get("/") async def finance_root(): return "fiance_root" @finance_router.get("/data") async def finance_data(): return "finance_data" print("finance setup")
from multiprocessing import Process import RPi.GPIO as GPIO import time import subprocess import psutil GPIO.setmode(GPIO.BCM) ledPin = 17 buttonPin = 18 GPIO.setup(buttonPin, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(ledPin, GPIO.OUT) GPIO.output(ledPin, GPIO.LOW) def buttonCheck(): while True: input_state...
from NodeBox import NodeBox from socket import * class Node: '''handles all node operations''' def __init__(self): self.nodebox = NodeBox() self.socket = self.setup_socket() self.version = "0.0.1" def setup_socket(self, server_address = "127.0.0.1", server_port = 13337): '''returns socket that will be used...
"""Module for SIA Base Entity.""" from __future__ import annotations from abc import abstractmethod from dataclasses import dataclass import logging from pysiaalarm import SIAEvent from homeassistant.core import CALLBACK_TYPE, State, callback from homeassistant.helpers.dispatcher import async_dispatcher_connect from...
import datetime from django.core.management.base import BaseCommand, CommandError from apps.wallet.utils import check_sync_state, sync_to_blockchain class Command(BaseCommand): help = "Syncs the database with the blockchain" def handle(self, *args, **options): sync_to_blockchain(is_dry_run=False) ...
def sample_list(lst, iter_): return [[lst[i] for i in it] for it in iter_] # Return a list of all pairs of elements in a list, excluding flips. def iter_g_2D(n): assert n >= 2 for i in range(n): for j in range(i + 1, n): yield i, j def iter_gg_3D(n): assert n >= 3 for i in ...
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT """Test your Trellis M4 Express without needing the serial output. Press any button and the rest will light up the same color!""" import time from rainbowio import colorwheel import adafruit_trellism4 trellis = adafruit_trel...
# ABC136d import sys import re import math input = sys.stdin.readline sys.setrecursionlimit(10**6) s = input() l = re.findall("R+L+", s) ans = [] # print(l) for i in l: R = math.ceil((i.count("R")-1)/2) + math.ceil(i.count("L")/2) L = math.ceil(i.count("R")/2) + math.ceil((i.count("L")-1)/2) #print(i, R,...
# ################ Author Details ################ # Name: Kesava Swamy Karedla ; Kiran Vedula # Email: kesava-swamy.karedla@broadcom.com ; kiran-kumar.vedula@broadcom.com # ################################################ # # 1. test_ft_static_nat - Verify static NAT establishes a one-to-one mapping between the inside...
"""This module contains auxiliary functions for the test runs.""" import shlex import matplotlib.pyplot as plt import numpy as np import pandas as pd import copy from trempy.shared.shared_auxiliary import get_random_string from trempy.shared.shared_auxiliary import print_init_dict from trempy.config_trempy import PRE...
import logging _LOGGER = None def get_logger() -> logging.Logger: global _LOGGER if not _LOGGER: logging.info('cache_gs logging init') _LOGGER = logging.getLogger('cache_gs') return _LOGGER
"""Provides utilities for working with FampPlex entities and relations FamPlex is an ontology of protein families and complexes. Individual terms are genes/proteins. There are higher level terms for families and complexes. Terms can be connected by isa or partof relationships. X isa Y expressing that X is a member of...
from .slicer import Slicer, Alias, Obj
from time import gmtime from sys import exit from json import dumps from os import path import json ''' Monty's Debug Library. Please note this software may be licenced differently than the software that uses it. Designed for use as a python import and should not be executed explicitly. Copyright (C) 2018 Nicolas "Mo...
from Day3.Point import Point def get_cell_power_level(pt, serial): rack_id = pt.x + 10 power_level = rack_id * pt.y power_level += serial power_level *= rack_id power_level_string = str(power_level) if len(power_level_string) < 3: power_level = 0 else: power_level = int(p...
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...