text
stringlengths
38
1.54M
# -*- coding: utf-8 -*- from django.db import models class Function(models.Model): id = models.IntegerField(primary_key=True) name = models.CharField(max_length=255) icon = models.CharField(max_length=255) belong_to_building = models.ForeignKey('building.Building', null=True, blank=True, verbose_name...
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.userLogin, name='index'), url(r'^login_app/$', views.authenticateUser, name='login_app'), url(r'^privacy/$', views.privacy_view, name='privacy'), url(r'^signup/$',views.signup, name = 'signup'), url(r'...
#-*- coding:utf-8 -*- #增加数字“4”的数据量,对每个“4”的样例,生成一个新样例 from keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array, load_img import Image import methods import random import os def gen_single_txt(data_path,txt_name,is_random = True): txt_path = os.path.join('/home/nikoong/Algorithm_test/han...
from django.shortcuts import render, redirect from .models import Category, photos # Create your views here. def gallery(request): category = request.GET.get('category') print(category) if category == None: images = photos.objects.all() else: images = photos.objects.filter(category__name...
import matplotlib.pyplot as plt import torch import torchvision.io from mmseg.models import VisionTransformer from mpl_toolkits.axes_grid1 import make_axes_locatable from torch import nn from torch.nn.functional import interpolate from src_lib.models_hub.trans_unet import get_r50_b16_config, VisionTransformer as ViT f...
# Copyright 2016 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 file or at # https://developers.google.com/open-source/licenses/bsd """Time-to-string and time-from-string routines.""" from __future__ import print_function from ...
import os from processing.tile_image import TileSlide from queue import Queue from threading import Thread from time import time import logging logging.basicConfig(filename='run_global_001.log', level=logging.DEBUG) def preprocessing(): print("preprocessing_001 started") ts = time() slideextension1 = "mrxs" ...
# -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2018-09-02 23:11 from __future__ import unicode_literals import django.contrib.postgres.fields.jsonb from django.db import migrations, models import django.db.models.deletion from dataentry.models.form_migration import FormMigration def migrate_forms(apps, schem...
""" Initialize Flask app """ from flask import Flask import os import application.settings from flask_restful import Api app = Flask('__name__') api = Api(app) if os.getenv('FLASK_CONF') == 'TEST': app.config.from_object('application.settings.Testing') else: app.config.from_object('application.settings.Produ...
# 2. Determine if the sum of two integers is equal to the given value # Given an array of integers and a value, # determine if there are any two integers in the array whose sum is equal to the given value. # Return true if the sum exists and return false if it does not. def solution_by_educative(A, val): found_va...
from .astnode import AstNode class ArrayDeclaration(AstNode): def __init__(self): super(ArrayDeclaration, self).__init__(parent=None) self.type = None self.dim = None self.dim_quals = None def prepare_to_print(self): self.name += "ArrayDecl: " def c_visitor(self):...
import random import os wordsCount = 1000000 linkers = ["So", "Also", "By the way", "Moreover"] personal = ["I", "personaly I"] like = ["like", "love", "prefer"] code = ["to write programms", "to program", "to code", "to write code"] file = open("text.txt", "w") for i in range(0, wordsCount): sentence = random.ch...
from PyQt5.QtWidgets import QWidget,QPushButton,QListWidget,QHBoxLayout,QVBoxLayout from PyQt5.QtCore import QObject,pyqtSignal from PyQt5.QtGui import QIcon from view.AuxiliaryElements.BlinkingText import BlinkingText from view.AuxiliaryElements.ListWidgetCustomScroll import ListWidgetCustomScroll class ChosePo...
import switch import time temp = 1 setTemp = 5 #while True: def controlPower(temp, setTemp): if temp < setTemp: print "low, "+str(temp) switch.setPower(1) time.sleep(2) temp = tempRead.read_temp() if temp >= setTemp: print "high, "+str(temp) switch.setPower(0) time.sleep(2) temp = tempRead.read_temp...
# Time Complexity : O(nlogn) # Auxiliary Space : O(n) def activityselection(start, end, n): if not (start and end): return 0 num_of_activity = 0 i = 0 for j in range(n): if start[j] >= end[i]: num_of_activity += 1 i = j return num_of_activity
from enum import Enum class linkType(Enum): P2P = 'p2p' # peer to peer P2C = 'p2c' # provider to customer # holds values for each AS link entry class ASEntry(): ### ctor def __init__(self, as1, as2, type): self.as1 = as1 self.as2 = ...
""" SOLR module Generates the required Solr cores """ from typing import Any import luigi from luigi.contrib.spark import PySparkTask from pyspark import SparkContext from pyspark.sql import SparkSession from pyspark.sql.functions import ( col, concat_ws, collect_set, when, flatten, explode_...
# Copyright (C) 2019 The Electrum developers # Distributed under the MIT software license, see the accompanying # file LICENCE or http://www.opensource.org/licenses/mit-license.php import asyncio import base64 from PyQt5.QtCore import Qt, QThread, pyqtSignal from PyQt5.QtWidgets import (QWidget, QVBoxLayout, QLabel, ...
from tkinter import * import tkinter.messagebox import adv_backend from tkinter import ttk from ttkthemes import themed_tk as tk import backend class infrch: def __init__(self): root = tk.ThemedTk() root.get_themes() root.set_theme('radiance') root.title('Advertiser Syst...
class SumTree: def __init__(self, capacity): self.capacity = capacity self.tree = [0] * (2 * capacity - 1) self.data = [None] * capacity self.size = 0 self.curr_point = 0 # 添加一个节点数据,默认优先级为当前的最大优先级+1 def add(self, data): self.data[self.curr_point] = data ...
from abc import ABC, abstractmethod class Car(ABC): """Product""" @abstractmethod def show(self): pass class FerrariCar(Car): """法拉利车抽象类""" def __init__(self): self.origin_place = "未知产地的" def show(self): print(f"这是一辆{self.origin_place}法拉利") class DomesticFerrariC...
#!/usr/bin/python import qlib import numpy as np def isClose(x,y, eps = 1e-10): t = np.abs(x-y) < eps if not t: print x,y,eps return t def test_getNextAction(): epsilon = 0.1 learnRate = 0.3 discountRate = 0.5 value = qlib.ValueFunction(epsilon = epsilon, ...
# cv2.cvtColor takes a numpy ndarray as an argument import numpy as nm import pytesseract pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files (x86)\Tesseract-OCR\tesseract.exe" # importing OpenCV import cv2 from PIL import ImageGrab, Image, ImageEnhance import datetime import time import os import sy...
class Solution: def maxProfit(self, prices: List[int]) -> int: ans=0 ini=prices[0] for i in range(len(prices)): if prices[i]<ini: ini=prices[i] else: ans=max(ans,prices[i]-ini) return ans
# Generated by Django 2.0.4 on 2018-04-08 15:27 import datetime from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='UserAsk', ...
# Generated by Django 2.1.2 on 2019-11-26 08:11 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import utils.upload import utils.validators class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependen...
from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler import time, os, shutil, sys sys.path.append("c:/users/yamen/appdata/local/programs/python/python38-32/lib/site-packages") from colorama import init, Fore, Back, Style class Handler(FileSystemEventHandler): def on_cre...
# -*- coding: utf-8 -*- # Advent of Code 2019 - Day 13 # Care package from os import system import sys sys.path.append("../python_modules/custom") from intcomputer import Intcomputer arcade = Intcomputer(list(map(int, open("game_free.txt", "r").read().split(",")))) sprites = { 0: ' ', 1: '#', 2: '█', 3: '_', 4: 'O'}...
from rest_framework import serializers from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from .models import Personal from rest_framework.response import Response from rest_framework import pagination class ImageSerializer(serializers.ModelSerializer): class Meta: model = Personal fields =(...
# Command Pattern: Controlling the sequence of operations from abc import abstractmethod,ABC class Command(ABC): @abstractmethod def execute(self): pass class Copy(Command): def execute(self): print('Copying...') class Paste(Command): def execute(self): print('Pasting...') cl...
num = (int(input('Digite o 1º numero: ')),int(input('Digite o 2º numero: ')), int(input('Digite o 3º numero: ')),int(input('Digite o 4º numero: '))) print(f'O numero 9 apareceu {num.count(9)} vezes') if 3 in num: print(f'O numero 3 esta na posição {num.index(3)+1}') else: print('O valor 3 não foi d...
import random import time class Node: def __init__(self, k, v): self.key = k self.value = v self.left = None self.right = None self.count = 1 self.dups = 1 # Duplicates def __str__(self): return f"Key: {self.key}, Value: {self.value}" def generate_r...
p=float(input("Enter the Principle Amount(P) : ")) t=float(input("Enter the Time Period(T) : ")) r=float(input("Enter the rate of interest per annum: ")) print("The simple interest is {:.6f}".format(p*t*r/100))
def matrix_mul(s, j): for i in range(len(s)): if s[i] == '(' and s[i + 3] == ')': # 最先计算的两个矩阵位置,i/2 k = j[int(i / 2)][0] * j[int(i / 2)][1] * j[int(i / 2) + 1][1] # 每次计算量 s = s[0:i] + 'Z' + s[i + 4:] # 更新计算法则 j = j[:int(i / 2)] + [[j[int(i / 2)][0], j[int(i / 2) + 1][1...
import numpy as np import matplotlib.pyplot as pt import scipy P,L,U=scipy.linalg.lu(A) np.set_printoptions(precision=1) #print(A) #Find d_8 #A(d_8)=d_9 #A=PLU PLU(d_8) = d_9 LU(d_8) = (P.T)(d_9) #L(U(d_8)) = d_9 p_9 = (P.T).dot(d_9) #print(p_9) U_8 = scipy.linalg.solve_triangular(L,p_9,lower=True) d_8 = scip...
next(iterdata) for (columnName, columnData) in iterdata: key = "ln" + str(item) data[key].append(float(columnData[count])) lines[key].set_data(xdata, data[key]) item+=1 count+=1
#Metodos de los Strings loro= "Azul Noruego" print(len(loro))#equivalente a .length() #.lower() convierte todo un string a minusculas, #Fijate que se usan diferente que len() print (loro.lower()) #.upper() convierte todo a MAYUSCULAS print (loro.upper()) """las funciones .lower() y .upper() solo funcionan con stri...
""" This is the main file. This contains code generated from the game_main_window.ui file and modifications. Run this file to launch the Fantasy Cricket app. """ import sqlite3 from PyQt5 import QtCore, QtGui, QtWidgets from final_dialog_box import Ui_dialog from final_evaluate_teams import Ui_evaluate_team_dialog f...
# Generated by Django 2.1 on 2019-07-29 11:22 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('nijaherbs', '0009_auto_20190729_1508'), ] operations = [ migrations.AlterModelOptions( name='herb', options={'ordering': ('-cr...
from opendr.perception.fall_detection.fall_detector_learner import FallDetectorLearner __all__ = ['FallDetectorLearner']
from django.contrib.auth.mixins import LoginRequiredMixin from django.shortcuts import render_to_response from django.template.context_processors import csrf from django.views import generic import datamanager.services.config as cfg from datamanager.models import Configuration class SettingsView(LoginRequiredMixin, ...
#!/usr/bin/python # this script is used for video cut :one picture/per second import os import cv2 videos_src_path = "./" video_formats = [".MP4", ".MOV"] frames_save_path = "./" width = 320 height = 240 time_interval = 29 def video2frame(video_src_path, formats, frame_save_path, frame_width, frame_height, interval)...
class Solution: def wiggleMaxLength(self, nums) -> int: if len(nums) <= 1: return len(nums) cnt = 1 up_flag = True i = 1 add_flag = False while i < len(nums): if up_flag: if nums[i] > nums[i-1]: ...
import re, requests, json from slackbot.bot import respond_to from slackbot.bot import listen_to API_URL = "https://api.zaif.jp/api/1/" SUPPORTED_COIN = ["zaif","sjcx","btc","ncxc","cicc","xcp","xem","pepecash","jpyz","bitcrystals","bch","eth","fscc","mona"] MAIN_SUPPORTED_COIN = ["btc","xem","bch","eth","mona","zaif...
#!/usr/bin/env python # encoding=utf-8 # int/long print(42) print(100000000000000000000000000000000000000000000000000000) # float print(3.1415) print(1.2e10) print(3e-3) print(-3e-3) # complex print(2 + 3j) print(1.5 + 2.8j) print(1e10 + 3e-5j)
# Converting our SNAKE_GAME.py script into a executable file: import cx_Freeze executables = [cx_Freeze.Executable("Snake_Game.py")] cx_Freeze.setup( name = "Snake Game", options = {"build_exe":{"packages":["pygame"],"include_files":["apple.png","SnakeHead.png"]}}, description = "Snake Game Tutorial...
a = int(input("請輸入數字 a:")) b = int(input("請輸入數字 b:")) if a > b: print("a > b") elif a < b: print("a < b") else: print("a = b")
import os import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from tensorflow.keras.utils import to_categorical from tensorflow.keras.datasets import mnist from tensorflow.keras.layers import * from tensorflow.keras.activations import * from tensorflow.keras.models import * from tens...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Changing the shape of an array """ import numpy as np a = np.random.randint(0, 100, 12).reshape(4, 3) # =================== # # Most common methods # # =================== # # To convert a multidimensional array in a one-dimensional array # We can not use "a.flat" ...
# encoding: utf-8 """Unit test suite for the docx.text.paragraph module""" from __future__ import absolute_import, division, print_function, unicode_literals from docx.enum.style import WD_STYLE_TYPE from docx.enum.text import WD_ALIGN_PARAGRAPH from docx.oxml.text.paragraph import CT_P from docx.oxml.text.run impor...
from rest_framework import viewsets from rest_framework.authtoken.views import ObtainAuthToken from rest_framework.authtoken.models import Token from ..models import SSUser from rest_framework.response import Response from ..API.serializers import SSUserSerializer, SSUserShortSerializer class GetAuthToken(ObtainAuthT...
#!/usr/bin/env python3 import os import sys import argparse from .usage import usage from .smdimerge import smdimerge from .timerge import timerge from .maganim import maganim def parse_args(args): funcs = { "smdimerge": smdimerge, "timerge": timerge, "maganim": maganim } if "--...
''' Test for grabbing a list of manifests, and then working through retrieving and extracting data using the IIIF_Manifest class in iiif_collections. ''' import json from iiif_collections import IIIF_Manifest harvest_list = [] top_level_manifests = json.loads(open('master.json').read()) for top_level_collection in t...
#!/usr/bin/python import pyrebase import cgi from time import gmtime, strftime from calamities import calamities_list print "Content-type: text/html" print "" config = { "apiKey": "AIzaSyCMoO7CX52RaO5CqSBWTZ67PiLiigAh4jM", "authDomain": "calamity-control-1478121312942.firebaseapp.com", "databaseURL": "https://calamit...
# # @lc app=leetcode.cn id=454 lang=python3 # # [454] 四数相加 II # # @lc code=start from typing import List class Solution: def fourSumCount(self, A: List[int], B: List[int], C: List[int], D: List[int]) -> int: from collections import Counter countAB = Counter([a+b for a in A for b in B]) r...
#!/usr/bin/env python3 # Most of this code was not mine but was from # https://www.programcreek.com/python/example/136/logging.basicConfig import logging ################################### # Initialize the logging. # logFile is the name of the logfile # logLevel is the logging level (INFO,DEBUG,ERROR) # loggingMode...
# coding=utf-8 ''' 3D 数据图 ''' import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.mplot3d import Axes3D if __name__ == '__main__': fig = plt.figure(figsize = (12,8)) ax = Axes3D(fig) #生成 X,Y X = np.arange(-4,4,0.25) Y = np.arange(-4,4,0.25) X,Y = np.meshgrid(X,Y) R = np...
from ..helper_scrapping import Scrapping_helper import unittest class TestConvertingStringToInt(unittest.TestCase): def test_square_meters_int(self): self.assertEqual(Scrapping_helper.string2float_of_square_meters(' 26 м²'), 26) def test_square_meters_float(self): self.assertEqual(Scrapping_he...
from tkinter import * from tkinter import Canvas import pandas as pd import random PINK = "#e2979c" RED = "#e7305b" GREEN = "#9bdeac" YELLOW = "#f7f5dd" HONEYDEW = "#F0FFF0" # ------------------------------------------------- # Lists new_data = pd.read_csv( "/Users/kevinwong/Python Projects/Small Python Games + P...
import unittest import pytest import PIL from erika.image_converter import * root_path = 'tests/test_resources/' # noinspection SpellCheckingInspection class WrappedImageUnitTest(unittest.TestCase): def testPillowIsProperlyInstalled(self): self.assertIsNotNone(PIL.PILLOW_VERSION) self.assertNo...
# Copyright (c) 2013, Pullenti. All rights reserved. Non-Commercial Freeware. # This class is generated using the converter UniSharping (www.unisharping.ru) from Pullenti C#.NET project (www.pullenti.ru). # See www.pullenti.ru/downloadpage.aspx. from pullenti.unisharp.Utils import Utils from pullenti.ner.Refer...
#!/usr/bin/env python # coding: utf-8 # # Projected Gradient-based algorithms # # In this notebook, we code our Projected gradient-based optimization algorithms. # We consider here # * Positivity constraints # * Interval constraints # # 1. Projected Gradient algorithms (for positivity or interval constraints) # # ...
import os FILE = os.environ.get('FILE', 'tests/input-file-test.csv') DATA_STRUCTURE = "HTTP/1.1 {status_code} {status}\r\n" \ "Content-Type: application/json; charset=utf-8" \ "\r\n\r\n{body}\r\n\r\n" INITIAL_DATA = [ 'GRU,BRC,10\n', 'BRC,SCL,5\n', 'GRU,CDG,75\n', 'GRU,SCL,2...
import yarp as y from time import sleep ## Client class for hand data reciving class HandClient: ##Define the fingers and articulations id, then wait for the service called handData_service to be initialized def __init__(self): ##Default definition fingers id self.fingers={ "Thumb"...
# -*- coding: utf-8 -*- # Author:liyu # 导入库位库存 from UIAutomation.Utils import close_oracle, basic_cit_01 def release_import_inventory(): con, curs = basic_cit_01() try: sql = [ ''' UPDATE XDW_APP.TS_OPERATION SET STATUS = 0, ACT_START_TIME = NULL, ACT_END_TIME = NULL WHERE OPERATION_UKID =...
import requests from config import * from gdax_auth import GdaxAuth import pprint from market_maker import get_position, get_bid_ask, get_usd_ex, get_total_balance if __name__ == "__main__": auth = GdaxAuth(key, secret, passphrase) resp = requests.get(base_url + '/accounts', auth=auth) print resp.json() ...
from item.static import Item from block_group.inode import Inode from directory.file import File from factory.filesystem import filesystem_factory from factory.superblock import superblock_factory class Directory: STATIC_FILE_FIELDS_LENGTH = 8 def __init__(self, address): self.file_structure = [ ...
from flask import Flask, render_template, request, redirect, session, url_for, flash from tools.GetRequests import GetRequest from tools.Likes import FindLikes from tools.Matches import FindMatches from tools.UserInfo import GetInfo from tools.login_query import ValidateLogIn from tools.register_query import ValidateS...
import requests import json url = 'https://maps.googleapis.com/maps/api/geocode/json' with open('campusbuildings_refined.json') as data_file: data = json.load(data_file) keys_list = data.keys() length = len(keys_list) print length lat_long = {} kind = {} building = "1 E 26-1/2th St, Austin TX, 78705" params =...
__author__ = 'thorwhalen' import datetime from . import reporting as rp import pandas # settings save_folder = '/D/Dropbox/dev/py/data/query_data/' account_list = rp.get_account_id('dict') account_list = list(account_list.keys()) numOfDays = 60 report_query_str = rp.mk_report_query_str(varList='q_iipic', start_date=n...
word = [] with open('MyFile.txt') as f: for line in f: word = [line.strip()] print(word)
import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = 'migrations-git-conflicts' ALLOWED_HOSTS = ['*'] INSTALLED_APPS = [ 'migrations_git_conflicts', 'tests.app_bar', 'tests.app_foo', ] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3...
#!/usr/bin/env # coding:utf-8 """ Created on 17/7/5 下午2:58 base Info """ __author__ = 'xiaochenwang94' __version__ = '1.0' import numpy as np import pandas as pd import xgboost as xgb from sklearn.cross_validation import train_test_split import time start_time = time.time() data = pd.read_csv('./tmp_data/new.csv', ...
import sys from django.db import migrations, models import django.db.models.deletion def cache_cable_devices(apps, schema_editor): Cable = apps.get_model('dcim', 'Cable') if 'test' not in sys.argv: print("\nUpdating cable device terminations...") cable_count = Cable.objects.count() # Cache ...
#!/usr/bin/env/ python # -*- coding:utf-8 -*- # Created by: Vanish # Created on: 2019/3/21 # 23ms # 输入n个整数,找出其中最小的K个数。 # -*- coding:utf-8 -*- class Solution: def GetLeastNumbers_Solution(self, tinput, k): # write code here def big_heap(arr,root,end): while 1: child = ro...
from django.urls import path from django.contrib.auth.decorators import login_required from .views import * app_name='lide' urlpatterns = [ # LISTs path('', clovek_list, name='lide_list'), # DETAILs path('detail/<str:slug>/', ClovekDetailView.as_view(), name='clovek_detail'), path...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sat Mar 25 15:25:51 2017 @author: Work """ # glass identification dataset import pandas as pd url = 'http://archive.ics.uci.edu/ml/machine-learning-databases/glass/glass.data' col_names = ['id','ri','na','mg','al','si','k','ca','ba','fe','glass_type'] glass...
import time, pyodbc, csv, numpy as np, pandas as pd, requests, smtplib, matplotlib.pyplot as plt from tkinter import * import tkinter as tk from PIL import ImageTk, Image from io import BytesIO #Labeling the tkinter variable master = tk.Tk() #Creating a title for the window - shown in the white space @ the top...
import random C = 50 GAMMA = 0.7 EPSILON = 0.01 # https://github.com/MorvanZhou/Reinforcement-learning-with-tensorflow/blob/master/contents/3_Sarsa_maze/RL_brain.py # https://github.com/studywolf/blog/blob/master/RL/Cat%20vs%20Mouse%20exploration/qlearn.py class RL(object): def __init__(self): self.actio...
#!/usr/bin/python import socket, struct, sys, getopt def main(argv): try: opts, args = getopt.getopt(argv, "x") except getopt.GetoptError: print 'ipconverter.py [-x] <ipaddress as number>' sys.exit(1) if (len(args) == 0): print 'ipconver...
import pandas as pd import tensorflow as tf from sklearn.model_selection import train_test_split from sklearn.metrics import classification_report import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' census = pd.read_csv("adult.csv", header=None) census.columns = ['age', 'workclass', 'fnlwgt', 'education', 'education_n...
###################################################################################################### # more-complex-files.py by Dave Ames # david.john.ames@gmail.com # @davidames # # Problem: More Advanced File Handling # # Examples of more advanced file handling ######################################################...
import builtins class Hand: def __init__(self): self.player_hand = [] def __str__(self): s = '' for card in self.player_hand: s = s + str(card) + ' ' return s def add_card(self, card): self.player_hand.append(card) return self.player_hand ...
# -*- coding: utf-8 -*- __author__ = 'Alexandr' import webapp2 from views import GroupSelectionPage, DoTheMagic, ItsAlive, decorator application = webapp2.WSGIApplication([ ('/', GroupSelectionPage), ('/dothemagic', DoTheMagic), ('/its-alive', ItsAlive), (decorator.callback_path, decorator.callback_ha...
from ctapipe.reco.hillas_intersection import HillasIntersection import copy from tqdm import tqdm from ctapipe.image import tailcuts_clean, dilate from ctapipe.image.hillas import hillas_parameters, HillasParameterizationError import numpy as np import astropy.units as u __all__ = ["hillas_parameterisation", "reconstr...
import path_utils import Statistics """ For getting statistics with various combos of parameters. """ # ############################## Basic runs Statistics.run_vary_params( { "NN": "FFNN", "N_hidden_units": 4, "use_bias": False, "max_episode_steps": 200, }, { "env_...
#Real-time detection of microphone signaling import pyaudio import numpy as np import time from datetime import datetime import sys import wave import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation from pymatbridge import Matlab from time import sleep import serial from tkinter impo...
#!/usr/bin/env python3 import logging logger = logging.getLogger(__name__) from api.models.BriefingManager import BRIEFING_MANAGER def trigger(userName, body): """This function is triggered by the api. """ logger.info(body) BRIEFING_MANAGER.run(userName) return '', 204
# Copyright 2017 The TensorFlow 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 applica...
"""CSC148 Lab 5: Linked Lists === CSC148 Fall 2020 === Department of Mathematical and Computational Sciences, University of Toronto Mississauga === Module description === This module runs timing experiments to determine how the time taken to call `len` on a Python list vs. a LinkedList grows as the list size grows. ...
# -*- coding: utf-8 -*- # Create your views here. from __future__ import unicode_literals from django.shortcuts import render from django.shortcuts import render,get_object_or_404,redirect from django.template import loader from rest_framework.response import Response from rest_framework.views import APIView from rest...
# # 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 "License"); you may not us...
# coding: utf-8 s = 0 for i in range(1000): #print i, if (i % 3 == 0): s = s + i if (i % 5 == 0): s = s + i if (i % 15 == 0): s = s - i print s
import cv2 import pickle import numpy as np import matplotlib.pyplot as plt from tqdm import tqdm from pathlib import Path from torch.utils.data import Dataset from utils.data_manipulation import resize, normalize_mean_variance, generate_affinity, generate_target class DatasetSYNTH(Dataset): def __init__(self, cf...
import json from unittest import TestCase from companies.models import Company #from coronavstech.companies.models import Company from django.test import Client from django.urls import reverse import pytest @pytest.mark.django_db class BasicCompanyAPITestCase(TestCase): def setUp(self) -> None: self.clie...
import pandas as pd import nltk import pdb def combine_premises(row): #import pdb; pdb.set_trace() ''' Index([u'ID', u'premise1', u'premise2', u'premise3', u'premise4', u'hypothesis', u'entailment_judgments', u'neutral_judgments', u'contradiction_judgments', u'gold_label'], dtype='objec...
from typing import List, Optional, Tuple, Union from ray.data._internal.planner.exchange.interfaces import ExchangeTaskSpec from ray.data._internal.sort import SortKey from ray.data._internal.table_block import TableBlockAccessor from ray.data.aggregate import AggregateFn, Count from ray.data.aggregate._aggregate impo...
import sys import time import threading import queue from hashlib import sha256 from secrets import token_bytes import grpc from lnd_grpc.protos import invoices_pb2 as invoices_pb2, rpc_pb2 from loop_rpc.protos import loop_client_pb2 from test_utils.fixtures import * from test_utils.lnd import LndNode impls = [LndNo...
import tensorflow as tf from tensorflow.keras.layers import BatchNormalization, LeakyReLU from tensorflow.keras.activations import relu, tanh, sigmoid from tensorflow.keras.layers import Conv2D, Conv2DTranspose from tensorflow.keras import Model conv_initializer = tf.keras.initializers.RandomNormal(mean=0.0, stddev=0...
from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() class Doctor(db.Model): __tablename__='doctor' DoctorId = db.Column(db.Integer, primary_key=True,autoincrement=True) username = db.Column(db.String,nullable=False,unique=True) email = db.Column(db.String,nullable=False,unique=True) password...