text
stringlengths
1
927k
""" Mask R-CNN Train on the toy bottle dataset and implement color splash effect. Copyright (c) 2018 Matterport, Inc. Licensed under the MIT License (see LICENSE for details) Written by Waleed Abdulla ------------------------------------------------------------ Usage: import the module (see Jupyter notebooks for exampl...
"""empty message Revision ID: 4dd64e951c80 Revises: Create Date: 2020-09-16 12:37:40.312182 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '4dd64e951c80' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto gene...
import numpy as np from basic.types import vector, matrix from typing import Optional from basic.tests import dt # print(dt) # print(dt.mean(axis=0)) _ptr = np.array([1, 1, 4, 4, 8]) # print(dt - _ptr) def _is_broadcastable(x: matrix, _x: vector) -> Optional[TypeError]: if x.shape[1] != _x.shape[0]: r...
# bug 4 # http://asu-compmethodsphysics-phy494.github.io/ASU-PHY494/2018/02/01/05_Debugging/#activity-fix-as-many-bugs-as-possible # Define the sinc-function sinc(x) = \sin(x)/x: import math def sinc(x): return math.sin(x)/x print(sinc(3.145))
#!/usr/bin/python # Copyright (c) 2010-2013, Regents of the University of California. # All rights reserved. # # Released under the BSD 3-Clause license as published at the link below. # https://openwsn.atlassian.net/wiki/display/OW/License import logging from openvisualizer.SimEngine import SimEngine import o...
import unittest from spotify_api import SpotifyAPI class TestSpotifyAPI(unittest.TestCase): def test_authentication_bad_credentials(self): spotify_api = SpotifyAPI('', '') received_token = spotify_api.authentication() expected_token = '' self.assertEqual(received_token, expected...
# sybase/pyodbc.py # Copyright (C) 2005-2014 the SQLAlchemy authors and contributors <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """ .. dialect:: sybase+pyodbc :name: PyODBC :dbapi: pyodbc :connectstrin...
# -*- coding: utf-8 -*- # # trading-bot documentation build configuration file, created by # sphinx-quickstart. # # 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. # # All configuration values ha...
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="reinvent_models", version="0.0.7", author="PaccMann Team", description="Generative models for Reinvent adapted for PaccMann", long_description=long_description, long_description_conten...
# 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, software # distributed under the...
import copy import datetime import inspect from decimal import Decimal from django.core.exceptions import EmptyResultSet, FieldError from django.db import NotSupportedError, connection from django.db.models import fields from django.db.models.constants import LOOKUP_SEP from django.db.models.query_utils import Q from ...
class PolicyService(object): def __init__(self, client): self.client = client def list_policies(self, headers=None): _data = {} return self.client.perform_query('GET', '/policies/clusters/list', data=_data, headers=headers) @staticmethod def policy_to_full_dict(policy): ...
""" N! = 1 * 2 * 3 * ... * N 0! = 1! = 1 """ N = int(input()) i = 1 result = 1 while i <= N: result *= i i += 1 print(result) """ N = 0 i = 1 result = 1 1 """
# Copyright 2019 The Forte 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 applicable ...
# -------------------------------------------------------- # Tensorflow Faster R-CNN # Licensed under The MIT License [see LICENSE for details] # Written by Jiasen Lu, Jianwei Yang, based on code from Ross Girshick # Modified by Peiliang Li for Stereo RCNN demo # -------------------------------------------------------...
class Graph: def __init__(self): self.adjacency_list = {} def __len__(self): return len(self.adjacency_list) # returns number of keys from list def add_node(self, value): node = Vertex(value) self.adjacency_list[node] = [] return node def add_edge(self, ...
from typing import Any from .config_base import ConfigBase class ConfigDict(ConfigBase): def __init__(self, data): # type: (dict) -> None self.__conf = data def get(self, key): # type: (str) -> Any return self.__conf.get(key)
# Copyright (C) 2019 Alpha Griffin # @%@~LICENSE~@%@ """A vim-like editor in Python. A Python module providing an interactive text-mode editor that (partially) mimics the vim editor. .. module:: ag.vipy :platform: Unix :synopsis: A vim-like editor in Python .. moduleauthor:: Shawn Wilson <lannocc@alphagriffin....
from sympy import Eq, Rational, S, Symbol, symbols, pi, sqrt, oo, Point2D, Segment2D, Abs from sympy.geometry import (Circle, Ellipse, GeometryError, Line, Point, Polygon, Ray, RegularPolygon, Segment, Triangle, intersection) from sympy.testing.pytest import raise...
import string from flask import Flask, render_template, request, flash from flask_migrate import Migrate import models import auth import sources app = Flask(__name__) app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///dev.sqlite" app.config["SECRET_KEY"] = "2137 papiez" app.register_blueprint(auth.blueprint) app.r...
""" Copyright (c) 2014, CloudSigma AG 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 fo...
""" Helper function to safely convert an array to a new data type. """ import numpy as np from aesara.configdefaults import config __docformat__ = "restructuredtext en" def _asarray(a, dtype, order=None): """Convert the input to a Numpy array. This function is almost identical to ``numpy.asarray``, but ...
from .default import * try: from .local import * except ImportError: pass
""" Generate spatial gratings ========================= Stimulus presentation based on gratings of different spatial frequencies for generating ERPs, high frequency oscillations, and alpha reset. Inspired from: > Hermes, Dora, K. J. Miller, B. A. Wandell, and Jonathan Winawer. "Stimulus dependence of gamma oscillati...
from typing import Callable, Dict, List, Tuple import numpy as np import pp from pp.cell import cell from pp.component import Component from pp.components.electrical.tlm import tlm from pp.components.extension import line from pp.components.hline import hline from pp.components.waveguide import waveguide from pp.laye...
""" Django settings for django_falcon project. Generated by 'django-admin startproject' using Django 4.0. For more information on this file, see https://docs.djangoproject.com/en/4.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/4.0/ref/settings/ """ import os...
# coding: utf8 import os import sys import torch import torch.autograd as autograd import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict #sys.path.append( os.environ['RNNTAGGERPATH'] ) from fairseq.globals import * #import utils_classes as Cl # ---------- Decoders from LD-RNN tool...
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython Elabora un programa en Python que estime el tipo de cambio en el futuro. El programa debe solicitar al usuario: el tipo de cambio actual, la tasa de interés local, la tasa de interés extranjero y los días a futuro. La fórmula para estimar el tipo de cambio ...
from vietocr.optim.optim import ScheduledOptim from vietocr.optim.labelsmoothingloss import LabelSmoothingLoss from torch.optim import Adam, SGD, AdamW from torch import nn from vietocr.tool.translate import build_model from vietocr.tool.translate import translate, batch_translate_beam_search from vietocr.tool.utils im...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # NI Modular Instruments Python API documentation build configuration file, created by # sphinx-quickstart on Fri Jul 14 13:04:36 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration value...
# Copyright 2020-2022 OpenDR European Project # # 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 agree...
import extruct import requests import w3lib.html SCHEMA_RATING_URL = "https://schema.org/Rating" SCHEMA_MUSIC_ALBUM_URL = "https://schema.org/MusicAlbum" SCHEMA_MUSIC_GROUP_URL = "https://schema.org/MusicGroup" SCHEMA_REVIEW_URL = "https://schema.org/Review" class AlbumReview: """ Class representing the fetc...
# Copyright 2021 PerfKitBenchmarker 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 appli...
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" def pattern(n): count = 0 for i in range(n): for j in range(n - i - 1): print(' ', end='') flag = count wflag = 1 caser = 1 for k in range(2 * i + 1): print(alpha[flag], end='') if(flag == 2*i): ...
#!/usr/bin/env python # -*- encoding: utf-8 -*- # 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...
"""LCM type definitions This file automatically generated by lcm. DO NOT MODIFY BY HAND!!!! """ try: import cStringIO.StringIO as BytesIO except ImportError: from io import BytesIO import struct class L21DockDetect(object): __slots__ = ["detected"] def __init__(self): self.detected = False ...
""" Downloads the MovieLens dataset and saves it as an artifact """ from __future__ import print_function import requests import tempfile import os import zipfile import pyspark import mlflow import click @click.command(help="Downloads the MovieLens dataset and saves it as an mlflow artifact " ...
# Copyright (c) 2021 The Regents of the University of California # 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 lis...
# Copyright 2019 Ericsson Software Technology # # 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...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 5/15/20 4:49 PM # @File : grover.py # qubit number=5 # total number=37 import cirq import cirq.google as cg from typing import Optional import sys from math import log2 import numpy as np #thatsNoCode from cirq.contrib.svg import SVGCircuit # Symbols for...
""" Example template for defining a system """ import os from argparse import ArgumentParser from collections import OrderedDict import torch import torch.nn as nn import torch.nn.functional as F import torchvision.transforms as transforms from torch import optim from torch.utils.data import DataLoader from torch.util...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from collections import OrderedDict from typing import Any, List, Optional, Union class ConfigBaseMeta(type): def annotations_and_defaults(cls): annotations = OrderedDict() defaults = {} for base ...
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: yandex/cloud/containerregistry/v1/repository_service.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import...
"""\ Generate LaTeX report displaying spectra normalized around the H_alpha line. """ import logging import os import os.path from argparse import ArgumentParser from collections import namedtuple, defaultdict import numpy as np from astropy import constants as const from astropy.convolution import Box1DKernel from a...
#!/usr/bin/env python # # 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 require...
from boa3.builtin import public a = b = c = d = 10 c += 5 @public def get_a() -> int: return a @public def get_c() -> int: return c @public def set_a(value: int): global a a = value @public def set_b(value: int): global b b = value
""" Cisco Intersight Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan...
# this class is used to generate and send OTP to email and update OTP in the Database. import math import random import smtplib def generateOTP(): digits = "0123456789" OTP = "" for i in range(6): OTP += digits[math.floor(random.random() * 10)] return OTP def sendMail(myDB, myCursor, phone,...
from __future__ import division import mmtbx.refinement.minimization_ncs_constraints from libtbx.test_utils import approx_equal import mmtbx.refinement.adp_refinement from scitbx.array_family import flex from libtbx import adopt_init_args from libtbx.utils import null_out import mmtbx.ncs.ncs_utils as nu import iotbx.n...
# -*- coding: utf-8 -*- """ This module defines the class Spectra() that contains a spectra and relevant information. """ import numpy as np from scipy.interpolate import interp1d from copy import deepcopy class Spectra(object): """ Contains a spectra and relevant information. """ def __init__(self,...
# Lab 8 #3.1 def count_words(inpu_str): return len(inpu_str.split( )) #3.2 demo_str = 'hi, hello world!' print(count_words(demo_str)) #3.3 def find_min(input_list): min_item = input_list[0] for num in input_list: if type(num) is not str: if min_item >= num: ...
from os import environ if environ.get('OTREE_PRODUCTION') not in {None, '', '0'}: DEBUG = False APPS_DEBUG = False else: DEBUG = True APPS_DEBUG = True # also enables random fill in of forms # if you set a property in SESSION_CONFIG_DEFAULTS, it will be inherited by all configs # in SESSION_CONFIGS...
# Copyright 2020 ASL19 Organization # # 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 wr...
# Generated by Django 3.0.1 on 2019-12-30 13:55 from django.db import migrations def move_to_datacontent(apps, schema_editor): AssignedContent = apps.get_model("spider_base", "AssignedContent") AnchorKey = apps.get_model("spider_keys", "AnchorKey") AnchorServer = apps.get_model("spider_keys", "AnchorServ...
#!/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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
""" aav.utils ~~~~~~~~~ :copyright: (c) 2018 Sander Bollen :copyright: (c) 2018 Leiden University Medical Center :license: MIT """ from typing import Optional def comma_float(val: str) -> float: """ Get float for a string that may contain commas in stead of dots :param val: the value to be casted to floa...
import gzip import json import os import tempfile from enum import Enum from typing import Any, Callable, Iterable, Optional from warnings import warn import torch import torch.autograd.profiler as prof from torch.autograd import kineto_available, ProfilerActivity class ProfilerAction(Enum): """ Profiler act...
"""Constants for ANWS AOAWS Integration.""" from datetime import timedelta from homeassistant.const import ( DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_TEMPERATURE, LENGTH_KILOMETERS, PERCENTAGE, SPEED_MILES_PER_HOUR, TEMP_CELSIUS, UV_INDEX, ) from homeassistant.components.weather import ( ATTR...
import os import glob from collections import defaultdict from colored import fg, bg, attr TEMP_DIR_NAME = 'sample/materialization' EXCLUDE_FILE_NAME = 'meta.md' def display_relations_tree(): target_dir = os.path.dirname(os.path.abspath(__file__)) + "/" + TEMP_DIR_NAME glob_file_list = glob.glob(target_dir ...
class DataTransferFactory(object): type = None def parse(self): pass class ScpDataTransferFactory(DataTransferFactory): type = 'scp' def __init__(self): pass def parse(self, config_file, elem): self.config = {} # TODO: The 'automatic_transfer' setting is for futu...
from .createjobs import createJob import mtlogging def execute( proc, _container=None, _use_cache=True, _skip_failing=None, _force_run=None, _keep_temp_files=None, _label=None, **kwargs ): job = createJob(proc, _container=_container, _use_cache=_use_cache, _skip_failing=_skip_faili...
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #-------------------------------------------------------------------...
# Copyright 2017 The Bazel 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 applicable la...
# solves the 4-color-map game on Mobaxterm # python 3.7 # reads the screen for a game and clicks the game to solve it # author lk00100100 import sys from Graph import ColorNode from GraphReader.ImageReader import ImageReader from GraphReader.ScreenReader import ScreenReader from GraphSolver.FourMapSolver import FourMap...
__all__ = ['ttypes', 'constants', 'tunnel']
# Copyright 2012 Google 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, ...
def compute_list_average(number_list): return sum(number_list) / len(number_list) number_list = [] ask_user_for_numbers = True while ask_user_for_numbers: user_input = float(input("Choose a number: ")) if user_input == 0.0: ask_user_for_numbers = False else: number_list.append(user_in...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division, print_function, unicode_literals __author__ = "Michal Belica" __version__ = "0.8.1"
#!/usr/bin/env python # Copyright 2008-2012 Nokia Siemens Networks Oyj # # 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 req...
# coding:utf-8 from captcha.image import ImageCaptcha # pip install captcha import numpy as np import matplotlib.pyplot as plt from PIL import Image import random import time import sys from constants import number from constants import alphabet from constants import ALPHABET # 验证码一般都无视大小写;验证码长度4个字符 def random_capt...
import random from abc import ABC, abstractmethod import torch import torchvision import torchvision.transforms as transforms import torchvision.transforms.functional as F class Data(ABC): """Data represents an abstract class providing interfaces. Attributes ---------- base_dit str : base directory ...
# # PySNMP MIB module Inverter-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Inverter-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:58:28 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
### clue-thermal-camera v0.6 ### Thermal camera display on CLUE or PyPortal ### This plots an 8833 8x8 thermal infrared sensor on the CLUE ### using ulab to interpolate the image ### Tested with an Adafruit CLUE (Alpha) and CircuitPython and 5.3.0 ### and PyPortal and 5.3.1 ### copy this file to CLUE board as code.py...
# -*- coding: utf-8 -*- from setuptools import setup, find_packages with open('requirements.txt') as f: install_requires = f.read().strip().split('\n') # get version from __version__ variable in highedin/__init__.py from highedin import __version__ as version setup( name='highedin', version=version, description=...
# This file was automatically created by FeynRules $Revision: 623 $ # Mathematica version: 8.0 for Mac OS X x86 (64-bit) (November 6, 2010) # Date: Thu 9 Jun 2011 17:49:34 from object_library import all_orders, CouplingOrder QCD = CouplingOrder(name = 'QCD', hierarchy = 1, exp...
from django.apps import apps from django.contrib.gis.db.models import GeometryField from django.contrib.sitemaps import Sitemap from django.db import models from django.urls import reverse class KMLSitemap(Sitemap): """ A minimal hook to produce KML sitemaps. """ geo_format = "kml" def __init__(...
# DatAnalysis.py # Module containing data analysis functions used for the DDD model import os import re # Regular Expression package import pdb # debugger import numpy as np import matplotlib.pyplot as plt # plotting package #import readh5conc import csv import h5py from scipy import signal from scipy import interpola...
import paddle import paddlehub as hub import ast import argparse from paddlehub.datasets.base_nlp_dataset import SeqLabelingDataset class MyDataset(SeqLabelingDataset): # 数据集存放目录 base_path = 'data/data122751' # 数据集的标签列表 label_list=['B-BANK', 'I-BANK', 'B-PRODUCT', 'I-PRODUCT', 'B-COMMENTS_N', 'I-COMME...
import argparse import os.path import pdb import random from setup_dataset_utils import * def get_ecef_origin(): """Shift the origin to make the value of coordinates in ECEF smaller and increase training stability""" # Warning: this is dataset specific! ori_lon, ori_lat, ori_alt = 6.5668, 46.5191, 390 ...
import numpy as np import pymbar from pymbar.utils_for_testing import eq, suppress_derivative_warnings_for_tests def load_oscillators(n_states, n_samples): name = "%dx%d oscillators" % (n_states, n_samples) O_k = np.linspace(1, 5, n_states) k_k = np.linspace(1, 3, n_states) N_k = (np.ones(n_states) * n...
# Tuples Lists are not the only variable type that can store a collection of multiple elements. Like lists, **tuples** store elements of mixed type in an ordered manner. However, tuples are *immutable*. Once created, their contents can not be mutated or changed. Syntactically, tuples are specified with *parentheses* ...
# -*- coding: utf-8 -*- """ Doc serving from Python. In production there are two modes, * Serving from public symlinks in nginx (readthedocs.org & readthedocs.com) * Serving from private symlinks in Python (readthedocs.com only) In development, we have two modes: * Serving from public symlinks in Python * Serving fro...
import Models.utility as utility import constants as cs from uiModels import DeckDetail import Models.network from uiModels import OpponentFlask class Player: def __init__(self, riot, leaderboard): self.sortedDecksCode = [] self.riot = riot self.summary = {} self.historyFlask = Opp...
""" WSGI config for django_webpack project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANG...
import requests from time import sleep import random from multiprocessing import Process import boto3 import json import sqlalchemy random.seed(100) class AWSDBConnector: def __init__(self): self.HOST = "pinterestdbreadonly.cq2e8zno855e.eu-west-1.rds.amazonaws.com" self.USER = 'project_user' ...
import os.path as osp from setuptools import setup, Extension import numpy as np from Cython.Build import cythonize from Cython.Distutils import build_ext from torch.utils.cpp_extension import BuildExtension, CUDAExtension ext_args = dict( include_dirs=[np.get_include()], language='c++', extra_compile_arg...
# 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 ...
""" It is for Epipolar geometry """ import numpy as np import cv2 from matplotlib import pyplot as plt def Epipolar_geometry(leftpath, rightpath): """ :param leftpath: The path of left images :param rightpath: The path of right images :return: """ # objP = np.zeros((6 * 7, 3), np.float32) ...
import sys import traceback import json import time import asyncio import logging import pprint import ssl import pathlib import functools import websockets import threading import random logger = logging.getLogger(__name__) async def hello(websocket, path, q): while True: try: message_str...
from tkinter import * from tkinter.ttk import * class Stats: def __init__(self, gui) -> None: self.gui = gui self.bars, self.labels = [None] * 10, [None] * 10 def init(self) -> None: for i in range(10): self.labels[i] = LabelFrame(self.gui, text=str(i)) self.b...
import matplotlib matplotlib.use('WebAgg') from matplotlib import pyplot as plt def sip_calculator (sip_amount, years, IntrestRate): current_amount = sip_amount current_amount = sip_amount + (current_amount * IntrestRate) / 100 print(f"first month return {current_amount}") for n in range(0, years - ...
#!/usr/bin/env python # # pymeteofr documentation build configuration file, created by # sphinx-quickstart on Fri Jun 9 13:47:02 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. # # A...
import logging import numpy as np import PIL import openpifpaf from openpifpaf.transforms.scale import _scale LOG = logging.getLogger(__name__) class ScaleMix(openpifpaf.transforms.Preprocess): def __init__(self, scale_threshold, *, upscale_factor=2.0, downscale_factor=0.5, ...
# users.models # Contains additional User profile data but no authentication # # Author: Benjamin Bengfort <bbengfort@districtdatalabs.com> # Created: Thu Jan 15 16:50:01 2015 -0500 # # Copyright (C) 2016 District Data Labs # For license information, see LICENSE.txt # # ID: models.py [70aac9d] benjamin@bengfort.com ...
def edit_distance(s1, s2): if __name__ = "__main__":
# Copyright 2021 Google Research. 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 unittest from datetime import timedelta from whisper_automatic_test.suggestion import Suggestion from whisper_automatic_test.suggestions_response import SuggestionsResponse class TestSuggestionsResponse(unittest.TestCase): def test_getters(self): suggestions = [ Suggestion('link', 'som...
#import numpy as np import matplotlib #matplotlib.rcParams['text.usetex'] = True import matplotlib.pyplot as plt plt.plot([1.35, 1.42, 1.45, 1.52], [35, 50, 40, 45], 'ro') plt.plot([1.68, 1.70, 1.73, 1.73], [65, 70, 60, 80], 'bo') plt.axis([1.3, 1.8, 30, 90]) plt.xlabel("height (m)") plt.ylabel("weight (kg)") plt...
# Copyright 2018 The TensorFlow Probability 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 o...
from django.db import models # Create your models here. class UserDetails(models.Model): class Meta: verbose_name_plural = "User Details" first_name = models.CharField(max_length=100,blank=True,null=True,default=None) last_name = models.CharField(max_length=100,blank=True,null=True,default=None) ...