content
stringlengths
5
1.05M
__all__ = ['xy<caret>'] def xyzzy(): pass
from devices.devices import Server from tests.fixtures import server_test as server def test_server(server: Server): server.start() assert server.device_status.active server.pause() server.stop()
""" Defines all visual operations, such as producing a graph. """ import networkx as nx import matplotlib.pyplot as plt def save_graph(automaton, name = 'plot.png'): graph = nx.MultiDiGraph() w_spacing = 600 h_spacing = 300 positions = dict() start_x = 50 start_y = 200 items = list(automat...
# -*- coding: utf-8 -*- from pyqtgraph.Qt import QtCore, QtGui import pyqtgraph.opengl as gl import pyqtgraph as pg import numpy as np import sys from ps4thread import PS4Thread from pynput import keyboard from IKEngin import Quadruped class Visualizer(object): def __init__(self): global x, y, z, yaw, pit...
# -*- coding: utf-8 -*- """ Copyright (c) Microsoft Corporation and Dapr Contributors. Licensed under the MIT License. """ import unittest from cloudevents.sdk.event import v1 from dapr.ext.grpc import App, Rule, InvokeMethodRequest, BindingRequest class AppTests(unittest.TestCase): def setUp(self): se...
#!/usr/bin/env python3 """ Copyright (C) 2019 Nicolas Bertrand 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 ...
class Uhr(object): def __init__(self, stunde, minute, sekunde): self.stunde = stunde self.minute = minute self.sekunde = sekunde def naechste_sekunde(self): self.sekunde += 1 if self.sekunde > 59: self.sekunde = 0 self.minute +=1 ...
# Client for fetching arriving commuter trains to a station using # Finnish Transport agency's DigiTraffic API. # https://www.digitraffic.fi/en/railway-traffic/ # https://www.digitraffic.fi/rautatieliikenne/#liikennepaikan-saapuvat-ja-l%C3%A4htev%C3%A4t-junat-lukum%C3%A4%C3%A4r%C3%A4rajoitus import datetime import log...
from django.contrib import admin from .models import * admin.site.register(Calc) admin.site.register(CalcTag) admin.site.register(Comment) admin.site.register(Detail) admin.site.register(Ldstp) admin.site.register(CategoryFurniture) admin.site.register(FurnitureInCalc) @admin.register(Furniture) class FurnitureAdm...
#!/usr/bin/env python3 # # Pi-by-MonteCarlo using PyCUDA/PyOpenCL # # performs an estimation of Pi using Monte Carlo method # a large amount of iterations is divided and distributed to compute units # a lot of options are provided to perform scalabilty tests # # use -h for complete set of options # # CC BY-NC-SA 2011 ...
def byte_format(n, roundto=2): """ Runtime: O(1) """ units = ["B", "KB", "MB", "GB", "TB", "PB"] # ... id = 0 factor = 1024 # or 1000 while n > factor: n = float(n) / factor id += 1 n = "%.{0}f".format(roundto) % n return "{0} {1}".format(n, units[id]) print byte_fo...
# -*- coding: utf-8 -*- # # Copyright (c) 2015 Netheos (http://www.netheos.net) # # 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...
from __future__ import annotations # Needs https://www.python.org/dev/peps/pep-0563/ import sys import loguru from models.settings import get_settings __DEFAULT_LOGGER_NAME = "stream.tracker" def get_logger(logger_name: str = __DEFAULT_LOGGER_NAME) -> loguru.Logger: settings = get_settings() config = { ...
import os import sys import torch from torch.utils.cpp_extension import load base_path = os.getcwd() sys.path.append(os.path.join(base_path, 'defgrid/layers/DefGrid/mean_feature')) mean_feature_func = load( name='mean_feature', sources=[ os.path.join(base_path, 'defgrid/layers/DefGrid/mean_feature/me...
# Copyright 2020 by Aaron Baker. # All rights reserved. # This file is part of the Nightcap Project, # and is released under the "MIT License Agreement". Please see the LICENSE # file that should have been included as part of this package. from nightcapcore.printers import ( InputPrinter, ItemPrinter, Heade...
from typing import List, Mapping import boto3 __all__ = ['AwsLogUtil', 'LogEvent'] class LogEvent(object): """A AWS Cloudwatch log event. Args: record: A dictionary of log metadata. """ def __init__(self, record: Mapping) -> None: self.timestamp = record.get('timestamp') s...
import numpy as np import matplotlib.pyplot as plt import math def sign(x): if x >= 0: return 1 else: return -1 def logistic(x): return 1 / (1 + math.exp(-x)) def err01(x, y): if sign(x) == y: return 0 else: return 1 def err1(x, y): return max(0, 1 - y * x) def err2(x, y): return pow(max(0, 1 - y * ...
# -*- coding: utf-8 -*- from workalendar.core import WesternCalendar, ChristianMixin class Austria(WesternCalendar, ChristianMixin): "Austria" FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + ( (5, 1, "National Holiday"), # Staatsfeiertag (10, 26, "National Holiday"), # Nationalfeiertag ...
traffic = ['motocycle','car','bus'] message1 = "I like " + traffic[0] print(message1) message2 = "I don't like " + traffic[2] print(message2) message3 = "I would like " + traffic[1] print(message3)
# https://leetcode.com/problems/two-sum-iv-input-is-a-bst/ from typing import Optional # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right def _find_target(node: Optional[TreeNode], k: ...
#!/usr/bin/env python # coding: utf-8 # Copyright (c) 2002-2016 "Neo Technology," # Network Engine for Objects in Lund AB [http://neotechnology.com] # # This file is part of Neo4j. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # Y...
"""Class for loading embeddings""" import logging from os import path from gzip import open as gzopen from .BaseConfig import BaseConfig class EmbeddingsConfig(BaseConfig): def __init__( self, path, lower, separator, encoding, size, ...
from rtmbot.core import Plugin, Job import os import random bot_id = 'U3MSN806S' header = '<@{}> '.format(bot_id) responses = { 'hi': 'Nice to meet you, where you been?', 'who should i vote for?': 'Me, of course', 'who are you': '@swiftonsecurity', } directory = os.path.realpath( os.path.join(os.getc...
#!/usr/bin/env python # -*- coding: utf-8 -*- from webbreaker.common.webbreakerlogger import Logger from webbreaker.common.confighelper import Config from subprocess import CalledProcessError from webbreaker.common.webbreakerconfig import convert_verify_ssl_config from webbreaker.threadfix.common.loghelper import Thre...
"""eshopper URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-b...
#!/usr/bin/python -tt # -*- coding: utf-8 -*- #author:rujia #website:www.rujia.uk #version:1.0 from demo import * from flask import Flask from config import conf if __name__ == "__main__": app.run(host=conf.HOST,port=conf.PORT,debug=True)
import pymel.core as pm from mgear.core import attribute def get_connected_curve_guides(xgen_description): """return the connectected curve guides from descriptions Args: xgen_description (TYPE): Description Returns: list: curve guides list or empty list if none """ curv2spline_n...
def multiclass_precision_recall(y_true, probas_pred, classes, make_plot=False): """ A multiclass extension of the 'precision_recall_curve' function in Scikit-learn. Also includes a plotting functionality and outputs the PR AUC score. Dependencies: matplotlib.pyplot, sklearn.preprocessing, sklearn.m...
# -*- coding: utf-8 -*- __all__ = [ 'save_as_uigf', ] from xlsxwriter import Workbook from gwk.constants import WishType, GachaType from gwk.records.models import Wish from gwk.utils import classify def save_as_uigf( wish: Wish, file_path: str, font_name: str = '微软雅黑' ): """ 将祈愿...
import random def announce(players, action): #if hasattr(action, 'public'): # print('Player {} decides to {}'.format(action.player.id, action)) for player in players: player.tell_action(action) class ActionResult: def __init__(self, end_turn=False, immediate=False, next_player_turns=1): self.end_tu...
# -*- coding: latin-1 -*- __author__='Guinsly Mondésir' __copyrights__=['University of Ottawa'] __version__="1.0.0" __status__='Production' __license__='GPL' #python standard library import shutil import sys import os from os import listdir, path from os.path import isfile, join, exists from datetime import datetime i...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def maxPathSum(self, root: TreeNode) -> int: if root is None: return 0 max_sum = -f...
import inspect import os import sys import maya.cmds as cmds import maya.OpenMayaMPx as OpenMayaMPx kPluginCmdName = "PBRT" pluginDir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) sys.path.append(pluginDir) sys.path.append(os.path.abspath( os.path.join(os.path.dirname(__file__), '....
#!/usr/bin/env python """ Copyright (C) 2018 github.com/volskaya 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,...
#!/usr/bin/python3 # -*- coding: utf-8 -*- from src.IO.XMLParser.file import FileReader from src.Model.Package.entries.multiple.multiple_entry import MultipleEntry __author__ = 'Ondřej Lanč' class DefaultValuesFileReader(FileReader): def __init__(self, config, package): self._config = config sel...
import logging import os import time import torch import torch.nn as nn from utils.meter import AverageMeter from utils.metrics import R1_mAP_eval from torch.cuda import amp import torch.distributed as dist #cam import argparse import cv2 import numpy as np import torch from torchvision import models from pytorch_grad_...
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 # In its current form, this code is not fit for production workloads. """Formulas for transforming extracted data""" import json import time def obd2_convert(msg): """Convert OBD-II message""" timestamp = ...
import matplotlib.pyplot as plt import numpy as np from numpy import genfromtxt, array import pandas as pd import statsmodels.api as sm def compute_error_for_line_given_points(b, m, points): totalError = 0 for i in range(0, len(points)): # get the x value x = points[i, 0] # get the y ...
#Bruno Marchi Pires class Vertice: def __init__(self,rotulo): self.rotulo = rotulo self.degree = 0 def igualA(self,r): return r == self.rotulo
import logging from datetime import timedelta from django.core.management.base import BaseCommand from django.db.transaction import atomic from sushi.logic import cleanup class Command(BaseCommand): help = 'Cleanup old fetch attempts' def add_arguments(self, parser): parser.add_argument('--do-it'...
import math import time import sched class ClockMode: def __init__(self, display): self.display = display self.value = None self.active = True def deactivate(self): self.active = False def activate(self): self.active = True def update_value(self): ...
# -*- coding: utf-8 -*- """ The MIT License (MIT) Copyright (c) 2015-2016 Rapptz 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 u...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Created on 9/18/19 by Pat Daburu """ .. currentmodule::synolo_flask.api .. moduleauthor:: Pat Daburu <pat@daburu.net> This is the """ from flask_restplus import Api from .. import __version__ from .info import api as info API_ROOT: str = '/api' #: the common root for ...
# # Copyright 2021 Lukas Schmelzeisen # # 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 ...
import logging from classic.sql_storage import TransactionContext from sqlalchemy import create_engine from kombu import Connection from simple_shop.application import services from simple_shop.adapters import database, message_bus, mail_sending logging.basicConfig(level=logging.INFO) class DB: db = database ...
num_tuple = (10, 20) print(num_tuple)
import numpy as np import matplotlib.pyplot as plt from .NNFunction import NNFunction import os def Func4(x): f0 = 0.1*x**3 f1 = np.cos(x) f2 = np.arctan(x) f3 = 0.1*x**3 + 0.5*x**2 + x return np.array([f0,f1,f2,f3]).T def _GetNN4(): s = [1,4,6,4] model = NNFunction(s,'softplus') model.CreateData(Func4)...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from lib.models import BaseModel from lib.fields import ProtectedForeignKey from django.core.validators import MaxValueValidator, MinValueValidator from simple_history.models import HistoricalRecords from datetime import datet...
# Copyright 2019 - 2020 DarkPrinc3 # 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 ...
import shutil,os print(">< Deleting micro...") try: shutil.rmtree(os.getenv('HOME') + '/.local/bin/micro') except: print("ERROR: Installation directory not found! Exiting...") print(">< Removing from path") #with open(os.getenv('HOME') + '/.profile', ): #TODO: remove path changing file from .profile
#! /usr/bin/env python from __future__ import print_function import sys import math import rospy import StringIO import roslaunch from std_msgs.msg import UInt8, String import threading task_lock = threading.Lock() from mobility import sync '''Node that coordinates the overall robot task''' class Task : ...
import os from rhcephcompose.comps import Comps class TestComps(object): def test_constructor(self): c = Comps() assert c.all_packages == set() assert c.groups == {} def test_parse_basic_file(self, fixtures_dir): c = Comps() fixture_file = os.path.join(fixtures_dir, '...
#!/Users/farnoosh/Projects/PyradiomicsExample/myenv/bin/python3 """ Computes the apparent diffusion coefficient from two diffusion weighted MRI images. Copyright (C) 2013 Oskar Maier This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Iterator, Optional from ..functions import ArtificialFunction from .. import optimization from .xpbase...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2016 OpenMarket 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 req...
总结整型、浮点、字符串、列表、元祖、字典、集合的常用方法,且比较各自擅长的领域 整型:可进行加减乘除,使用方便 hex(num) print(h) o = oct(num) print(o) print(abs(-100)) a, b = 10, 90 max2num = max(a, b, 100, 40, 178, 2) print(max2num) c = 2 print(pow(a, c)) # a ** c print(pow(a, c, 3)) #a ** c % 3 python对于数据运算专门提供了数学库(math),所谓库称为模块 如果我们要使用ptyhon所提供的库,有以下方法 import math...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import import re import textwrap from click import echo, secho from click.termui import get_terminal_size class InfoUI(object): def __init__(self, info): self.info = info def build_ui(self): """Build the CLI UI f...
import hashlib import marshal import os class Cacher(object): """Class to implement saving/loading cache for given file.""" def __init__(self, file_name, cache_path): # type: (str, str) -> None """Init cache class for the given file.""" self.file_name = file_name checksum = ha...
#! /usr/bin/env python3 """ Copyright 2021 Anderson Faustino da Silva. 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...
# Clique Discovery # Minimum frequency of pairs MIN_CLIQUE_FREQ=0 MIN_CLIQUE_NUMBER=0 # Add START/END nodes to the graph ADD_START_END=False # Tolerance when checking parallel executions. Default=0 CLEANSING_TOLERANCE=0 import networkx as nx import scipy import matplotlib.pyplot as plt def created_auxiliary_g...
# # This file is part of pyasn1-alt-modules software. # # Created by Russ Housley with assistance from asn1ate v.0.6.0. # Modified by Russ Housley to include the opentypemap manager. # # Copyright (c) 2021, Vigil Security, LLC # License: http://vigilsec.com/pyasn1-alt-modules-license.txt # # Warranty Certificate Extens...
""" Inplace "hi" -> "ih" "good" -> "doog" "This is a Cat" -> "taCa si s ihT" "This is a Cat" -> "taC asi s ihT" "ab b c" --> "cb b a" "c b ba" """ def reverse_inplace(string): n = len(string) char_array = [char for char in string] i = 0 j = n - 1 while i <= j: char_array[i], char_arr...
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- import configparser from src.tomato import Tomato from src.scheduler import Scheduler import click def get_tasks_conf(filename="./tasks.ini"): conf = configparser.ConfigParser() conf.read(filename, encoding="utf-8-sig") sections = conf.sections() ret_righ...
#Archivo necesario para que Python trate los directorios como que fueran paquetes
__all__ = ['kmeans_segmentation'] from .. import lib from .atropos import atropos from .. import utils def kmeans_segmentation(img, k, kmask=None, mrf=0.1): """ Perform k-means segmentation on an ANTsImage Example ------- fi<-antsImageRead( getANTsRData("r16") ,2) fi<-n3BiasFieldC...
import os import shutil import numpy as np from scipy import misc from os.path import join as pjoin from sklearn.cluster import DBSCAN def face_cluster(db_path): # Face embedding parameters cluster_threshold = 0.78 min_cluster_size = 12 # Load face embedding face_label = pjoin( db_path, 'face_l...
from zope.interface import Interface # Registry tool id APP_FACTORY = 'app_factory' ELASTIC_SEARCH = 'elasticsearch' SNP_SEARCH_ES = 'snp_search' INDEXER = 'indexer' class ICachedItem(Interface): """ Marker for cached Item """
# Copyright 2017-2019 EPAM Systems, Inc. (https://www.epam.com/) # # 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...
from flask_caching import Cache from flask_cors import CORS from flask_restful import Api from flask_redis import FlaskRedis from flask_sqlalchemy import SQLAlchemy from flask_migrate import Migrate cache = Cache() cors = CORS() api = Api() redis_store = FlaskRedis() sql_db = SQLAlchemy() migrate = Migrate()
# This file contains the list of API's which performs RADIUS operations. # @author : Chaitanya Vella (chaitanya-vella.kumar@broadcom.com) from spytest import st import utilities.utils as utils import utilities.common as common_utils from apis.system.rest import config_rest, get_rest, delete_rest debug = False ##time...
from zeit.cms.i18n import MessageFactory as _ from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile import zeit.cms.content.add import zope.formlib.form import zope.session.interfaces class Form(zope.formlib.form.SubPageForm): template = ViewPageTemplateFile('form.pt') form_fields = zop...
import sqlite3 class SQL: '''Provides an easy-to-use library for dealing with the database within the project''' def __init__(self, filename) -> None: self._conn = sqlite3.connect(filename) self._c = self._conn.cursor() def add(self, id) -> bool: """ Add a post to the dat...
import requests URL = "https://pwpcourse.eu.pythonanywhere.com" def check_room(s, room_href): resp = s.get(URL + room_href) body = resp.json() if body["content"] is not None: print("****************************") print(body["handle"]) print("****************************") ...
from .model import Model from crescent.functions import AnyFn class Condition(Model): def __init__(self, id: str): super(Condition, self).__init__() self.__id = id def Fn(self, fn: AnyFn): return self._set_field(self.Fn.__name__, fn) def __to_dict__(self, **kwargs): conve...
import sys from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtCore import QTimer import css import pics_rc import func import func_2 import func_3 try: from pynotifier import Notification except: import subprocess # gg subprocess.call(['pip', 'install', 'win10toast']) subprocess.call(...
import time from datetime import date, datetime class Splitter: """Class that has the ability to split mint transactions in two For all accounts passed into the split_transactions method eligible transactions will be split into two transactions, changing one of their categories to "Hide fr...
import json import requests import urllib3 import sys import argparse from ipaddress import IPv4Network import details urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) verify = False header_get = { 'Accept': 'application/json', 'Authorization': details.api_key } header_put = { 'Accept':...
from grid_nav import * import os import subprocess from self_locator import * from micro_controller import * import yaml import math import signal import sys CONFIG = yaml.load(open("../config.yaml")) # Example Diagram with obstacles # DIAGRAM1_S = (1,4) # DIAGRAM1_G = (7,8) # DIAGRAM1 = GridWithWeights(10, 10) # DIA...
import datetime from libs import hub import sys def acc_write(arg_array: list): if len(sys.argv) < 5: arg_to_parse = "" for arg in sys.argv: arg_to_parse += (arg + ' ') arg_to_parse = arg_to_parse.strip() raise hub.errors.InputError( arg_to_parse, message =...
""" ---------------------------------------------------------------------------------------------------------- This file is part of Sim-ATAV project and licensed under MIT license. Copyright (c) 2018 Cumhur Erkan Tuncali, Georgios Fainekos, Danil Prokhorov, Hisahiro Ito, James Kapinski. For questions please contact: C....
import logging import numpy as np import astropy.constants as const import astropy.units as au def powersph_error(power, tsys, nfeeds, tobs, xarclen, yarclen, fwhm, nu_min, nu_max, dnu, nu0, k, cosmo): """ Get instrument sensitivity in power spectrum, provided a set of instrument parameters Require...
import torch import torch.nn as nn class MultiModelWrapper(nn.Module): def __init__(self, models_dict): super().__init__() self.models_dict = models_dict def forward(self, studies): """ Args: inputs (list): a list of studies. Each study is a list ...
from dashboard.models import Station import json import requests import datetime gbfs_resp = requests.get('https://gbfs.divvybikes.com/gbfs/fr/station_status.json') gbfs_json = json.loads(gbfs_resp.text) for station in gbfs_json['data']['stations']: s = Station.objects.create( num_bikes_disabled...
# Databricks notebook source # MAGIC %md # MAGIC # Delta Lake Basics Lab Solution # MAGIC # MAGIC Databricks&reg; Delta allows you to read, write and query data in data lakes in an efficient manner. # MAGIC # MAGIC ## Learning Objectives: # MAGIC In this lab, you will: # MAGIC * Create a new Delta Lake from aggregate...
import getpass username = input('username: ') password = getpass.getpass('password: ') if username == 'bob' and password == '123456': print('Login successful') else: print('Login incorrect')
from read_data import read_data import matplotlib.pyplot as plt import pandas as pd import matplotlib.patches as ptc import matplotlib.dates as mdt import datetime as dt import numpy as np import math #This visualization takes the first week of the data and projects forward to a monthly scale. # Then, it compares the ...
# -*- coding: utf-8 -*- """ Test with only config.ini file. """ import os import unittest from configparser import NoOptionError from xonfig import get_option, get_section, get_sections, get_config_files_detected this_dir = os.path.abspath(os.path.dirname(os.path.realpath(__file__))) class Test2(unittest.TestCase...
import pandas as pd import csv as csv from sklearn.ensemble import RandomForestClassifier from sklearn.ensemble import AdaBoostClassifier train_df = pd.read_csv("train.csv", header=0) train_df = pd.read_csv("train.csv").replace("male",0).replace("female",1).replace("S",0).replace("C",1).replace("Q",2) test_df = pd.re...
from flask_sqlalchemy import SQLAlchemy from flask import Flask, render_template, request, jsonify import pandas as pd import requests APP = Flask(__name__) FLASK_DEBUG=1 # server name is specified in proc file APP.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///MedCabinet.db" #DB.init_app(app) def predict(input_song)...
#-------------------------------------# # 调用摄像头检测 #-------------------------------------# from yolo import YOLO from PIL import Image import numpy as np import cv2 import time yolo = YOLO() # 调用摄像头 capture=cv2.VideoCapture(0) # capture=cv2.VideoCapture(r"C:\Users\a5372\Desktop\Lightweight_OpenPose\Test...
mat = [list(map(int, input().split())) for _ in range(5)] num = [list(map(int, input().split())) for _ in range(5)] cnt = 0 for i in range(5): for j in range(5): cnt += 1 n = num[i][j] for y in range(5): for x in range(5): if mat[y][x] == n: ...
"""This package contains utilities for performing various types of Kalman filtering/smoothing."""
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2018-10-25 01:38 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('app03plus', '0006_auto_20181025_0125'), ] operations = [ migrations.RemoveField( ...
# -*- coding: utf-8 -*- # # This file is part of Invenio. # # Copyright (C) 2021 Graz University of Technology. # # Invenio-Records-Marc21 is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see LICENSE file for more # details. """Routes for record-related pages provi...
#! /usr/bin/env python # -*- coding: utf-8 -*- #///////////////////////////////////////////////////////////////////////////////////////// #///////////////////////////////////////////////////////////////////////////////////////// # RPFramework by RogueProeliator <adam.d.ashe@gmail.com> # This framework is used for all ...
import math import numpy as np import matplotlib.pyplot as plt import csv import errno import os import pathlib import json def ensure_directory_exists(base_directory): """ Makes a directory if it does not exist """ try: os.makedirs(base_directory) except OSError as ex: if ex.errno ...
import csv file = open('phonebook.csv', 'a') name = input("Name: ") number = input("Number: ") writer = csv.writer(file) writer.writerow((name, number)) file.close()
# # Copyright (C) 2013 Satoru SATOH <ssato @ redhat.com> # License: MIT # import anyconfig.cli as T import anyconfig.api as A import anyconfig.tests.common as C import os import os.path import subprocess import unittest def run(args=[]): """ It will throw subprocess.CalledProcessError if something goes wrong...
# -*- coding: utf-8 -*- # Generated by Django 1.11.29 on 2021-10-29 08:27 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('wildlifecompliance', '0545_merge_20211029_1625'), ] operations = [ migrati...
stock_prices = [('APPL', 200), ('GOOG',400), ('MSFT', 100)] for item in stock_prices: print(item) for ticker, price in stock_prices: print(ticker) for ticker, price in stock_prices: print(price + (0.1*price)) work_hours = [('Abby', 100), ("Billy", 400), ("Cassie", 800)] def employee_check(work_hours): ...