content
stringlengths
5
1.05M
#!/usr/bin/env python # -*- coding: utf-8 -*- # # # Copyright 2013 Google LLC. 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/LICEN...
########################################################################## # If not stated otherwise in this file or this component's Licenses.txt # file the following copyright and licenses apply: # # Copyright 2021 RDK Management # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use th...
# Copyright 2018 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 f """Pipeline input for UpdateFlakeAnalysisDataPointPipeline.""" from dto.flake_swarming_task_output import FlakeSwarmingTaskOutput from libs.structured_object impo...
#!/usr/bin/python # -*- coding: utf-8 -*- ''' Author : Nasir Khan (r0ot h3x49) Github : https://github.com/r0oth3x49 License : MIT Copyright (c) 2018 Nasir Khan (r0ot h3x49) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Soft...
import requests # API: https://rapidapi.com/jkosgei/api/free-ip-geolocation querystring = {"api-key":"test"} # take your free api key from ipdata.co if you pass your testing limit headers = { 'x-rapidapi-host': "jkosgei-free-ip-geolocation-v1.p.rapidapi.com", 'x-rapidapi-key': "ENTER YOUR RAPIDAPI KEY" }...
#!/usr/bin/env python from __future__ import with_statement import sys import subprocess try: from setuptools import setup, Command except ImportError: from distutils.core import setup, Command from distutils.errors import CCompilerError, DistutilsExecError, \ DistutilsPlatformError VERSION = '1....
from matplotlib.colors import LogNorm import matplotlib.pyplot as plt import numpy as np np.set_printoptions(threshold=np.inf) font = {'family' : 'normal', 'weight' : 'normal', 'size' : 30} plt.rc('font', **font) plt.figure(num=None, figsize=(13, 10), dpi=100, facecolor='w', edgecolor='k') bonds = ...
# -*- coding: utf-8 -*- # This file is part of Moksha. # Copyright (C) 2008-2010 Red Hat, 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...
from cicada2.runners.sql_runner import runner def test_contains_rows(): expected_rows = [{"foo": "bar", "fizz": "buzz"}, {"foo": "alpha", "fizz": "bravo"}] actual_rows = [{"foo": "bar", "fizz": "buzz"}, {"foo": "alpha", "fizz": "bravo"}] passed, description = runner.contains_rows(expected_rows, actual_r...
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # https://doc.scrapy.org/en/latest/topics/items.html import scrapy class WanfangPeriodicalItem(scrapy.Item): perio_id = scrapy.Field() # 期刊id参数 perio_title = scrapy.Field() # 期刊名称 hostunit_name = scrapy.F...
def insert(root, Key): node=Node(Key) if root==None: return node while(root): if root.data==Key: break if root.data>Key: if root.left: root=root.left else: root.left=node break ...
from DataShip.db_management.db_models import User from DataShip.db_management.db_manager import DB_manager import streamlit as st from datetime import date from sqlite3 import Connection def signup(DB_MAN: DB_manager, DB_CONN: Connection) -> None: """This function represents a view to the signup page. Args: ...
# -*- coding: utf-8 -*- """ ghostly.errors ~~~~~~~~~~~~~~ All local errors that ghostly raises. """ from __future__ import absolute_import, print_function, unicode_literals __all__ = ['GhostlyError', 'DriverDoesNotExistError', 'GhostlyTestFailed'] class GhostlyError(Exception): """ Ghostly err...
""" Runtime: 76 ms, faster than 69.96% of Python3 online submissions for Populating Next Right Pointers in Each Node. Memory Usage: 15.7 MB, less than 49.50% of Python3 online submissions for Populating Next Right Pointers in Each Node. """ from typing import List from typing import Optional class Node: def __init...
#!/usr/bin/env python3 import sys import os import operator import copy import re import datetime from functools import singledispatchmethod from webencodings import ascii_lower import tinycss2, cssselect2 import inflect import dmark # TODO: handle better than just global state? content = matcher = None SORT_KEY = o...
# Copyright (c) <2020> <fboucher@redhat.com> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publi...
# RUN: %PYTHON %s 2>&1 | FileCheck %s # pytype: skip-file import sys, time import os from typing import List from collections import namedtuple from collections.abc import Callable from itertools import chain from typing import Sequence, Optional import numpy as np from mlir.ir import * from mlir.dialects import ari...
from lib.libs import pykodi TVSHOW = 'tvshow' MOVIE = 'movie' EPISODE = 'episode' SEASON = 'season' MOVIESET = 'set' MUSICVIDEO = 'musicvideo' ARTIST = 'artist' ALBUM = 'album' SONG = 'song' audiotypes = (ARTIST, ALBUM, SONG) require_manualid = (MOVIESET, MUSICVIDEO) PREFERRED_SOURCE_SHARED = {'0': None, '1': 'fanart...
import requests import pickle import os import scipy.io.netcdf as netcdf import numpy as np import torch import argparse import sys def from_url(url, name, username = None, password = None): path = url.split("/")[-1] if not os.path.exists(path): r = requests.get(url, auth=(username, password), s...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ tkRAD - tkinter Rapid Application Development library (c) 2013+ Raphaël SEBAN <motus@laposte.net> 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 S...
# unicorn-analytics is a python module.
import glob import os import zipfile import nibabel as nib import numpy as np import traceback def convert_mri_unlabeled(): source_path = "/mnt/projects/ukbiobank/original/imaging/brain_mri/" destination_path = "/mnt/projects/ukbiobank/derived/imaging/brain_mri/" t1_zip_files = sorted(glob.glob(source_pa...
from django.urls import path from .views import index, store, update urlpatterns = [ path('tallas/', index, name='sizes.index'), path('crear-nueva-talla/', store, name='sizes.store'), path('actualizar-talla/<id>/', update, name='sizes.update'), ]
import random nouns = ["дождь",'снег','солнце','туча','облоко','земля','небо','дерево','дорога','звук','свет','ветер',] pril = ['красивый', 'вечерний', 'лазурный', 'морской', 'тёплый', 'нежный', 'суровый', 'сильный' ] timed = "Сегодня Завтра Тогда Всегда Иногда".split() nar = "медленно быстро спокойно яростно небрежно ...
#!/usr/bin/python import xml.dom.minidom import getopt import sys ########################## # Important: This script is to be run from trunk/moon/test # This file converts a Moonlight DRTList.xml to the MS DRTList.txt ########################## class drtTest: def __init__(self,id): self.id = id sel...
#!/usr/bin/python3 import os import json import sys import subprocess from modules.lib.colors import colors def pyrecon_masscan(masscan_directory, output_directory, masscan_rate): target_subnet_file = os.path.join(output_directory, 'subnets.txt') masscan_json = os.path.join(masscan_directory, 'masscan.json') if not...
# -*- encoding: utf-8 -*- ############################# import sys, os from shutil import * # import qdarkstyle from funciones import * ############### import hashlib ################ from PyQt5.QtWidgets import * ############################## from PyQt5.QtGui import * ############################ from PyQt5.QtCore im...
from __future__ import division import collections import mxnet as mx import numpy as np from numpy.linalg import norm import mxnet.ndarray as nd from ..model_zoo import model_zoo from ..utils import face_align __all__ = ['FaceAnalysis', 'Face'] Face = collections.namedtuple('Face', [ 'bbox', 'landmark', 'det_sco...
from . import card_combos from . import card_info_lut_builder from . import game_utility from . import preflop from . import runner
#!/usr/bin/env # -*- coding: utf-8 -*- """ Copyright 2017-2018 Jagoba Pérez-Gómez 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 ...
import torch import torch.nn as nn import numpy as np import matplotlib.pyplot as plt import random # GPU if available device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') class ServerQueue: """ The server queuing task as described in Example 10.2. """ def __init__(self, num_servers...
"""Maintainance Mode Middleware.""" import os from ..response import Response from config import application class MaintenanceModeMiddleware: def __init__(self, response: Response): self.response = response def before(self): down = os.path.exists( os.path.join(application.BASE_DIR...
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Module for factories that create business entities.""" # pylint: disable=too-many-arguments # pylint: disable=invalid-name # pylint: disable=redefined-builtin import random import uuid from lib.constant...
#! /usr/bin/env python3 # # In this script we solve the lid driven cavity problem for stationary Stokes # and Navier-Stokes flow. That is, a unit square domain, with no-slip left, # bottom and right boundaries and a top boundary that is moving at unit # velocity in positive x-direction. import nutils, numpy, matplotli...
import pytest from spytest import st, tgapi, SpyTestDict import apis.routing.ip as ipfeature import apis.switching.vlan as vapi import apis.system.port as papi import apis.system.interface as intapi import apis.routing.ip as ip_obj import apis.switching.portchannel as portchannel_obj import apis.switching.vlan as vla...
from bs4 import BeautifulSoup from mitmproxy import ctx # This class is WIP, but the intention is that we can inject a script into browser-requests for html # that lets us get DOM timings, first paint time, and other metrics. There is less need for customers to have # this ability now that selenium is going to offer m...
import enum from enum import Enum from typing import Union import numba import numpy as np import skimage.restoration from numpy.core.multiarray import ndarray from scipy.signal import convolve2d from skimage import img_as_float64, img_as_ubyte from skimage.color import rgb2gray, rgb2lab from skimage.filters import sc...
from discord.ext.commands import ( Bot, CheckFailure, Command, CommandError, CommandNotFound, Context, Group, HelpCommand, MemberNotFound, MissingRequiredArgument, ) import re from sentry_sdk import Hub, capture_exception import sys import traceback from typing import get_type_hi...
import unittest import os import subprocess import shlex class TestFlake8(unittest.TestCase): def testFlake8(self): pth = os.path.dirname(__file__) pth = os.path.join(pth, "..") pth = os.path.abspath(pth) pth = os.path.join(pth, "lib") print print print ...
import traci import numpy as np import random import timeit import requests # phase codes based on environment.net.xml PHASE_NS_GREEN = 0 # action 0 code 00 PHASE_NS_YELLOW = 1 PHASE_NSL_GREEN = 2 # action 1 code 01 PHASE_NSL_YELLOW = 3 PHASE_EW_GREEN = 4 # action 2 code 10 PHASE_EW_YELLOW = 5 PHASE_EWL_GREEN = 6 ...
#!/usr/bin/env python2 from __future__ import with_statement import os import subprocess import shutil import sys # LLVM commands. # TODO: Factor out to be configurable from ./build. CC = '/home/max/emscripten-workspace/llvm-gcc-install/bin/llvm-gcc' LINK = '/home/max/emscripten-workspace/llvm-build/Release/bin/llvm...
from enum import IntEnum import os import pygame import random import time from cmg import color from cmg import math from cmg.input import * from cmg.graphics import * from cmg.application import * from study_tool.card import * from study_tool.card_set import * from study_tool.entities.menu import Menu from study_tool...
"""Platform for Bestin TCP light integration.""" # async component so that calls can better be done by room instead of by light entity. # # Per the Bestin API, lights all hang off of one room API call, so you gather # status for all of them on every status request (or on/off result). # # Updating a room at a time (see...
import unittest import os import time import subprocess import docker from mininet.net import Containernet from mininet.node import Host, Controller, OVSSwitch, Docker from mininet.link import TCLink from mininet.topo import SingleSwitchTopo, LinearTopo from mininet.log import setLogLevel from mininet.util import quiet...
# Generated by Django 3.2.6 on 2021-08-28 12:30 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('preguntas', '0001_initial'), ] operations = [ migrations.AlterField( model_name='pregunta', name='texto', ...
# The maximum sum subarray problem consists in finding the maximum sum of a # contiguous subsequence in an array or list of integers: # # maxSequence([-2, 1, -3, 4, -1, 2, 1, -5, 4]) # # should be 6: [4, -1, 2, 1] # Easy case is when the list is made up of only positive numbers and the # maximum sum is the sum of the w...
from ._EncoderLinear import * from ._Homography import * from ._Obstacle import * from ._ObstacleArray import * from ._RoadLane import * from ._RoadLine import * from ._TimeCompare import * from ._VehicleEncoder import * from ._mav_RAW_DATA import * from ._mav_cc16_COMMAND import * from ._mav_cc16_CONFIG import * from ...
from django.contrib import admin from .models import * class CompanyAdmin(admin.ModelAdmin): list_display = ("name", "description") class CompanyOrderAdmin(admin.ModelAdmin): list_display = ("name", "id") class OrderAdmin(admin.ModelAdmin): list_display = ("recipe", "id") class RecipeAdmin(admin.ModelA...
import json import requests from datetime import datetime s = requests.Session() squizz_sessions = [] base_url = "http://127.0.0.1:5000/" null = None def test_login(): url = 'api/login' headers = {"Content-Type": "application/json"} data = {"username": "user1", "password": "123456789"} response = s....
# coding=utf-8 import unittest import os from ddt import ddt, data, unpack import copy import elifetools.parseJATS as parser import elifetools.json_rewrite as json_rewrite @ddt class TestJsonRewrite(unittest.TestCase): def setUp(self): pass @unpack @data( ("", None, None, None), ...
import hashlib import os import sys from collections import namedtuple from json import dumps, loads from scopus.utils import download, get_content AUTHOR_SEARCH_DIR = os.path.expanduser('~/.scopus/author_search') if not os.path.exists(AUTHOR_SEARCH_DIR): os.makedirs(AUTHOR_SEARCH_DIR) class AuthorSearch(objec...
# -*- coding: utf-8 -*- import pytest import sys from .test_base_class import TestBaseClass from aerospike import exception as e aerospike = pytest.importorskip("aerospike") try: import aerospike except: print("Please install aerospike python client.") sys.exit(1) class TestUdfList(TestBaseClass): ...
""" Tests of the command-line interface :Author: Jonathan Karr <karr@mssm.edu> :Date: 2021-05-28 :Copyright: 2021, Center for Reproducible Biomedical Modeling :License: MIT """ from biosimulators_pyneuroml import core from biosimulators_pyneuroml.data_model import Simulator, SIMULATOR_ENABLED, KISAO_ALGORITHM_MAP fro...
from torchvision.datasets import CIFAR10 # for test from .img_dirs import ImgDirsDataset
#!/usr/bin/env python import csv import os import sys def get_description(line, parent): cols = line.split('\t') labels = {} for pair in cols[8].split(";"): k, v = pair.split('=') labels[k] = v if (cols[2]) == "CDS" and labels["Parent"] == parent: return labels.get("Note", '-'...
import sys from pyramid.compat import reraise from pyramid.exceptions import PredicateMismatch from pyramid.interfaces import ( IExceptionViewClassifier, IRequest, ) from zope.interface import providedBy from pyramid.view import _call_view def excview_tween_factory(handler, registry): """ A :term:`tw...
from common import * ##############################################################3 # https://github.com/Cadene/pretrained-models.pytorch # https://github.com/Cadene/pretrained-models.pytorch/blob/master/pretrainedmodels/models/dpn.py # 'dpn68b': { # 'imagenet+5k': { # 'url': 'http://data.lip6.fr/...
import numpy as np from scipy.optimize import fsolve, minimize from psoap import constants as C class SB1: ''' Describing a single-line Spectroscopic binary. ''' def __init__(self, K, e, omega, P, T0, gamma, obs_dates=None, **kwargs): self.K = K # [km/s] self.e = e self.omega =...
# -*- coding: utf-8 -*- # # Copyright 2019 Google LLC. 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 requir...
from ecdsa import SigningKey, SECP256k1, VerifyingKey from sha3 import keccak_256 import json import rlp from eth_keys import keys public = '0x2377BB12320F46F0B9E30EBFB941121352716f2C' private = '0x886d5b4ce9465473701bf394b1b0b217548c57576436864fcbc1f554033a0680' trx = '0xF86B80850BA43B7400825208947917bc33eea648809c28...
# -*- coding: utf-8 -*- """ Created on Fri Aug 31 17:04:47 2018 @author: Riza This file provides the classes for 2D contour plotting. """ #%% Modules: import numpy as np shape = np.shape reshape = np.reshape size = np.size import matplotlib.pyplot as plt from UtilityFunc import UF uf = UF() #%% Contour plot cl...
# -*- coding: utf-8 -*- __name = 'smsapi-contacts-python' __version__ = '1.0.5' lib_info = '%s/%s' % (__name, __version__)
def surface_area(l, w, h): return 2*l*w + 2*w*h + 2*h*l + min([l*w, w*h, h*l]) def ribbon_length(l, w, h): return sum([*map(lambda x: x*2, sorted([l,w,h])[:-1])]) + l*w*h if __name__ == "__main__": with open('2015/input/day02.txt') as f: data = f.read().splitlines() print( sum( [*map( l...
from setuptools import find_packages from setuptools import setup setup( name="data_engineer_playground", version="0.1.0", description="A monorepo used to try things.", author="Cristian Webber", author_email="cbwebbers@gmail.com", url="https://github.com/cristianwebber/data_engineer_playground"...
# https://www.codechef.com/problems/AREAPERI l,b=int(input()),int(input()) if(2*(l+b)>l*b): print("Peri\n{}".format(2*(l+b))) elif(2*(l+b)<l*b): print("Area\n{}".format(l*b)) else: print("Eq\n{}".format(l*b))
from .packages.display import * from .packages.exceptions import * from .interface.banner import *
import os import shutil from aitoolbox.experiment.local_save.folder_create import ExperimentFolder as FolderCreator from aitoolbox.utils.file_system import zip_folder from aitoolbox.cloud.AWS.model_save import BaseModelSaver from aitoolbox.cloud.AWS.results_save import BaseResultsSaver from aitoolbox.cloud.GoogleCloud...
from tkinter import * from EMExp import * import time import pygame class EMPage(Frame): MUTE = False INFO = False CHECK = False def __init__(self, parent, controller): Frame.__init__(self, parent) pygame.mixer.init() BackS = pygame.mixer.Sound("EUBack.wav") ...
# Copyright (c) 2019 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # import keyring import mock from sysinv.puppet import puppet from sysinv.tests import keyring_fixture class PuppetTestCaseMixin(object): def setUp(self): super(PuppetTestCaseMixin, self).setUp() self.operator...
import math angulo = float(input('Digite um angulo:')) seno = math.sin(math.radians(angulo)) print('O angulo de {} tem o Seno de {:.2f}'.format(angulo, seno)) cosseno = math.cos(math.radians(angulo)) print('O angulo de {} tem o Cosseno de {:.2f}'.format(angulo, cosseno)) tangente = math.tan(math.radians(angulo)) pr...
from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User from django.forms import ModelForm from foodfficient.models import Profile from django.forms import modelformset_factory, formset_factory from django_summernote.fields import SummernoteTextFormFi...
from django.conf.urls import * from directoalartista.apps.transaction import views as TransactionViews urlpatterns = patterns('', # payment url(r'^paypal/pdt/', 'directoalartista.apps.transaction.views.paypal_pdt'), url(r'^paypal/ipn-xxx/', include('paypal.standard.ipn.urls')) )
""" A setup script to create two executables and demonstrate the use a valid and an invalid icon. """ from cx_Freeze import setup, Executable executables = [ Executable("test_icon.py", icon="icon.ico", target_name="test_1.exe"), Executable("test_icon.py", icon="favicon.png", target_name="test_2.exe"), ] setu...
__version__ = "0.0.3" # only source of version ID __title__ = "dfm" __download_url__ = ( "https://github.com/centre-for-humanities-computing/danish-foundation-models" )
from rllab.core.serializable import Serializable from rllab.spaces.box import Box from rllab.exploration_strategies.base import ExplorationStrategy import numpy as np class SimpleGaussianStrategy(ExplorationStrategy, Serializable): """ This strategy adds a constant Gaussian noise to the action taken by the ...
# Mathias Punkenhofer # code.mpunkenhofer@gmail.com # from abc import ABC, abstractmethod class Variant(ABC): @abstractmethod def __init__(self, board=None): self.board = board @abstractmethod def is_draw(self): """ Returns true if the game is drawn :return boolean ...
from nomad.core.edge import checks from nomad.core.edge.sensors.implementations.camera_rpi import CameraRPi class Camera(object): def __init__(self, resolution): if checks.is_raspberry_pi(): return CameraRPi(resolution) def get_image(self): pass
def bold(s): return '**' + s + '**' def italics(s): return '*' + s + '*' def curry_message(s): return ":curry: " + s def curry_format(s, *args): return curry_message(s.format(*args)) def get_author(message): return str(message.author)[:str(message.author).find('#')]
from django.contrib import admin from .models import BookingAgent # Register your models here. admin.site.register(BookingAgent)
# coding=utf-8 # # catkin_lint # Copyright (c) 2013-2021 Fraunhofer FKIE # # 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 ...
from ethereum.utils import sha3 from web3 import Web3, HTTPProvider import sys, urllib.request, codecs, json def verify(me): try: r = urllib.request.urlopen("https://{0}.keybase.pub/ethereum.json".format(me)) data = json.loads(r.read().decode(r.info().get_param('charset') or 'utf-8')) except: ...
import numpy as np import torch import os import random import argparse import sys def get_args(): parser = argparse.ArgumentParser('Interface for Inductive Dynamic Representation Learning for Link Prediction on Temporal Graphs') # select dataset and training mode parser.add_argument('-d', '--data', type...
# -------------------------------------------------------------------------- # 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 cause incor...
from five import grok from Acquisition import aq_inner from zope.component import getMultiAdapter from plone.app.layout.viewlets.interfaces import IAboveContent from Products.CMFCore.interfaces import IContentish from Products.CMFCore.interfaces import IFolderish from plone.app.layout.navigation.navtree import buildFol...
class Calcu: ft=0 inc=0 def accept(self): print("enter distance in ft & inches") self.ft1=int(input()) self.inc1=int(input()) print("enter distance in ft & inches") self.ft2=int(input()) self.inc2=int(input()) def add(self): ft=self.ft1+self.ft2 inc=self.inc1+self.inc2 while inc>12: ft=ft...
dict_adjective={"अकठिन'" :'JJ' ,"बड़ी":'JJ',"छोटी":'JJ',"लगाया":'JJ',"पिछले":'JJ',"नए":'JJ', "छोटा":'JJ',"इसी":'JJ',"पक्के":'JJ', "अकुशल'" :'JJ' , "अकृतज्ञ" :'JJ' , "अकृत्रिम" :'JJ' , "अक्खड़" :'JJ' , "अक़्लमंद" :'JJ' , "अक़्लमंद" :'JJ' , "अगाध गुप्त" :'JJ' , "अचेत" :'JJ' , "अच्छा" :'JJ', "अच्छी" :'J...
"""Fluke 8588A 8.5 digit DMM""" import testgear.base_classes as base class F8588A(base.meter): def init(self): self.idstr = self.query("*IDN?").strip() self.set_timeout(30) def get_reading(self, channel=None): #self.__select_channel(channel) return float(self.query("READ?")) ...
from typing import Sequence from apispec import APISpec from starlette.routing import BaseRoute, Mount, Route from .operation import setup_route_operations from .utils import convert_path __all__ = ('setup_routes',) def setup_routes(routes: Sequence[BaseRoute], spec: APISpec, version: int = 2, ...
''' ################################################################################ # # SiEPIC-Tools # ################################################################################ Circuit simulations using Lumerical INTERCONNECT and a Compact Model Library - run_INTC: run INTERCONNECT using Python integration...
from collections import defaultdict, deque class Graph(object): # makes the default value for all vertices an empty list def __init__(self): self.nodes = set() self.edges = defaultdict(list) self.distances = {} def add_node(self, value): self.nodes.add(value) def add_...
import torch import numpy as np from models import PointCMLP from utils import score, create_test_set MODEL_PATH = 'pretrained_models/mlgp_clean.tar' # MODEL_PATH = 'pretrained_models/mlgp_pi4_noisy_02.tar' # MODEL_PATH = 'pretrained_models/baseline_pi4_noisy_02.tar' # MODEL_PATH = 'pretrained_models/vanilla_pi4_noi...
"""Utilities for progress tracking and display to the user.""" import importlib import os import sys import threading import time import uuid import warnings from datetime import timedelta from html import escape from shutil import get_terminal_size import numpy as np from ..exceptions import ValidationError from .....
#!/usr/bin/env python from random import randint n = input() l = [] print(n) while len(l) < n: pair = (randint(1, 100), randint(1, 100)) if pair not in l: l.append(pair) for p in l: print("%d %d" % p)
#!/usr/bin/env python # 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 "Lice...
import io import struct class MinecraftIO(io.BytesIO): def read_varint(self, size: int = 5) -> int: result = 0 for i in range(size): data = self.read(1) shift = 7 * i result |= (data[0] & 0x7F) << shift if data[0] >> 7 == 0: return re...
from copy import deepcopy lista1 = [] lista2 = [] for _ in range(int(input())): name = input() score = float(input()) lista1.append(name) lista2.append(score) lista3 = deepcopy(lista2) lista3.sort() lista03 = sorted(set(lista3)) nota01 = [] nota = lista03[1] nota01 = [i for i, item in enumerate(list...
import re def split_selection(input): """ Break up input string with selection delimiters into selection and content. """ # Create a placeholder selection sel = [] # Find all indications for selection while True: # Find the next matching selection # TODO: Robustify with multi-char...
import sys import datetime from django.conf import settings from django.core.management.base import BaseCommand, CommandError from django.contrib.auth.models import User, Group, Permission from tastypie.models import ApiKey from esmond.api.models import Device, OIDSet, DeviceOIDSetMap class Command(BaseCommand): ...
import time from jina.executors.crafters import BaseCrafter from .helper import foo class DummyHubExecutorSlow(BaseCrafter): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) time.sleep(15) foo()
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...