text
stringlengths
8
6.05M
def checkproduct(item): return not item in ["Pen", "Pencil", "Crayon", "Notebook", "Binder", "Textbook"]
import morepath from onegov.core.framework import Framework from onegov.core.theme import get_filename from webtest import TestApp as Client class MockTheme: def __init__(self, name, version, result=''): self.name = name self.version = version self.result = result self.default_op...
from rest_framework import generics from .serializers import GroceriesSerializer from .models import Groceries from .permissions import IsOwnerOrReadOnly class GroceriesList(generics.ListCreateAPIView): permission_classes = (IsOwnerOrReadOnly,) queryset = Groceries.objects.all() serializer_class = GroceriesSeria...
import os start_time = 0; def start_timer(): global start_time (utime,stime) = os.times()[0:2] start_time = utime+stime def end_timer(txt='End time'): (utime,stime) = os.times()[0:2] end_time = utime+stime print ("{0:<12}: {1:01.3f} seconds". format(txt,end_time-start_time)) start_...
# -*- coding: utf-8 -*- """ Created on Mon Jun 7 17:48:42 2021 @author: 43739 """ import pandas as pd def HFDataProcess(folder = "E:/Projects/Hedge fund independency/DataInput/"): ### some dirty preprocessing for Credit Suisse Hedge Fund Index df_HF = pd.read_csv(folder + "Credit Suisse Hedge Fund In...
from node import Node class LinkedList: def __init__(self): self.head = None def prepend_node(self, data): new_node = Node(data) new_node.next = self.head self.head = new_node if self.head is None: self.head = new_node return def append_no...
#!/usr/bin/env python # coding: utf-8 # # Backpropagation (BP) # ក្នុងអត្ថបទមុនយើងបានសិក្សាអំពីដំណើរការរៀនដើម្បីកំណត់តម្លៃប៉ារ៉ាម៉ែត្រនៃFNNតាមរយៈវិធីសាស្រ្ត stochastic gradient descend(SGD)។ ដូចដែលអ្នកអាចចាប់អារម្មណ៍បានក្នុងSGD ការគណនាgradientឬដេរីវេនៃអនុគមន៍កម្រិតលម្អៀងត្រូវបានធ្វើឡើង។ ជាទូទៅការគណនានេះអាចធ្វើបានតាមរ...
import os import requests from validator_collection import checkers # validate url reload = True # False is Quit def add_http_to_url(url): if not url.startswith("http"): url = "http://" + url return url while reload: print("Welcome to IsItDown.py!") print("Please write a URL or URLs you want to check. (s...
# -*- coding: utf-8 -*- """ =============================================================================== module __GenericAlgorithm__: Base class to build custom algorithms ================================================================== This generic class contains the recommended methods for subclassed algorithms...
def capture_control(): """[Capture Device] [Package created to aid artist and in generating standard a camera] """ from cabinet.capture_control import capture_controller capture_controller.main()
__author__ = 'sf2016' # encoding: utf-8 import distance class Levenshtein: def defineDistanse(self,a, b): listA = list(a) listB = list(b) if len(listA) == 0 or len(listB) == 0: x = max(len(listA), len(listB)) else: if listA[-1] == listB[-1]: ...
import os no = ["tabletop.png", "resize.py", "README.md", "sounds"] filename_map = { "h": "Hearts", "d": "Diamonds", "c": "Clubs", "s": "Spades", } value_map = { 1: "A", 11: "J", 12: "Q", 13: "K", } images = os.listdir() for i in images: if i.startswith('.'): continue ...
from django.utils import timezone from ..base import StoredMessagesBackend from ..exceptions import MessageTypeNotSupported, MessageDoesNotExist from .. import signals from ...models import Inbox, Message, MessageArchive from ...settings import stored_messages_settings class DefaultBackend(StoredMessagesBackend): ...
def compressString(str1): cStr = "" if len(str1) <= 2: return str1 i = 0 for j in range(1, len(str1)): if str1[i] != str1[j]: cStr += (str1[i] + str(j-i)) i = j cStr += (str1[i] + str(len(str1)-i)) if len(cStr) >= len(str1): return str1 ret...
import sqlite3 from sqlite3 import Error def create_connection(db_file): conn = None try: conn = sqlite3.connect(db_file) except Error as e: print(e) return conn def insert_found(conn, found): sql = """ INSERT INTO Results(title, query_id, site_id, link, body_text, body_hash, c...
"""Cobaya Likelihood Connector Module for providing a likelihood for use in Cobaya. This module provides the class :class:`LikelihoodConnector`, which is an implementation of a Cobaya likelihood. """ from typing import List, Dict, Union import numpy as np import numpy.typing as npt from cobaya.likelihood import Like...
#-*- coding:utf-8 -*- # @author : MaLei # @datetime : 2020/4/20 10:38 下午 # @file : serializer.py # @software : PyCharm from SpiffWorkflow.serializer.json import JSONSerializer from strick import Nuclear class NuclearSerializer(JSONSerializer): def serialize_nuclear_strike(self,task_spec): return self.ser...
import json import requests import time from dateutil.parser import parse as parsedate from elasticsearch import Elasticsearch from elasticsearch import helpers as eshelpers from kafka import KafkaConsumer # # Constans # KAFKA_SERVER = 'kafka' KAFKA_TOPIC = 'tweets' KAFKA_CONSUMER_GROUP = 'sentiment-analysis-group' E...
from globals import getGlobalsInstance globalsInstance = getGlobalsInstance() BASE_URL = globalsInstance.getApiSetting('idealizar.whats-app.web.base-url') REQUEST_TIMEOUT = globalsInstance.getApiSetting('idealizar.whats-app.web.request-timeout')
from abc import ABCMeta, abstractmethod, abstractproperty # we can declare an abstract top-level class class Review(): __metaclass__ = ABCMeta @abstractmethod def __str__(self): pass @abstractproperty def min(self): pass @abstractproperty def max(self): ...
from config.config import TestData from config.payload_inf import Payload from infra.projects_client import ProjectsClient #Test 004 - API - Delete Project def test_T004(): project_client = ProjectsClient() response = project_client.delete_project(TestData.id_project, Payload.payloadT004) assert respo...
import sys f = open('data.csv', 'rb') out = open('out.log', 'wb') o = out d = f.read() needsClosing = False i = 0 c = '' escaped = False isAfterComma = True for ch in d: lc = c c = chr(ch) if isAfterComma: if needsClosing: o.close() o = out if c == 'E': o.writ...
from actors import * import atexit import os n_cpu_cores = 2 n_ff_downloaders = n_cpu_cores n_user_classifiers = 4 * n_cpu_cores core = Core() wa = WorkAssignerActor(core) dbm = DatabaseMasterActor(core) ff_dls = [] usr_cls = [] for _ in range(0, n_ff_downloaders): ff_dls.append(FFDownloaderActor(core...
# Generated by Django 2.2.6 on 2020-03-17 17:14 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('candidate', '0005_userprofileinfo'), ] operations = [ migrations.DeleteModel( name='UserProfileInfo', ), ]
import unittest from prime import prime_digit class Prime_test(unittest.TestCase): def test_primes(self): self.assertEqual(prime_digit(7), [2,3,5,7]) if __name__=='__main__': unittest.main()
import click from click.testing import CliRunner from mazel.commands.label_common import MakeLabel, MakeLabelCaptureErrors, RunOrder from mazel.label import Target from mazel.main import cli from .utils import LabelCommandTestCase class TestCommandTest(LabelCommandTestCase): def test_command(self): runn...
from django.contrib import admin from . models import employees admin.site.register(employees)
from rest_framework import generics from .serializers import * from .models import * class CourseApiViews (generics.ListCreateAPIView): queryset = Course.objects.all() serializer_class = CourseSerializer def perform_create (self, serializer): serializer.save() class BranchApiViews (generics.ListCreateAPIView...
from django.test import TestCase from backend.user_service.user.app.user_application_service \ import UserApplicationService class UserApplicationServiceTestCase(TestCase): def setUp(self): self.user_application_service = UserApplicationService() def test_register_when_no_vehicle_then_create_us...
#!/usr/bin/env pypy3 # -*- coding: UTF-8 -*- tmp='0000' k='' chk=set() for a in '0123': for b in '0123': for c in '0123': for d in '0123': if len(set([a,b,c,d]))==4: chk.add(a+b+c+d) while 1: print(tmp, flush=True) a,b=[int(i) for i in input().split()...
import unittest from windows_service import WindowsService from zeppos_logging.app_logger import AppLogger import os class TestTheProjectMethods(unittest.TestCase): def test_windows_service_name_method(self): self.assertEqual("zzz_windows_service_template", WindowsService.get_service_name()) def test...
from django.db.migrations.operations.base import Operation from django.utils.functional import cached_property __all__ = ( 'AddAuditTrigger', 'RemoveAuditTrigger', ) class AddAuditTrigger(Operation): reduces_to_sql = True reversible = True option_name = 'audit_trigger' enabled = True de...
import random, time, os, sqlite_manager, datetime, pdb from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait as wait from selenium.webdriver import FirefoxOptions from selenium.webdriver.common.proxy import Proxy, ProxyType from selenium.webdriver.common.by import By from selenium.webdr...
# Generated by Django 3.1.5 on 2021-01-28 09:27 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('main', '0010_auto_20210128_1453'), ] operations = [ migrations.AlterField( model_name='feedback...
class Coordinate(object): ''' speichert X- und Y-Wert ''' def __init__(self, x, y, z = 0, w = 0): self.x = x self.y = y self.z = z self.w = w def X(self): ''' gibt X-Wert zurück :return: int ''' return self.x def Y(self): ...
# -*- coding: utf-8 -*- from sklearn.datasets import load_files from sklearn.pipeline import Pipeline from sklearn.feature_extraction.text import CountVectorizer #bag of words from sklearn.feature_extraction.text import TfidfTransformer #from sklearn.cross_validation import KFold from sklearn.model_selection import KFo...
import matplotlib.pyplot as plt import numpy as np from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score, f1_score, confusion_matrix def split_dataset(dataset, seed=1): """ Split dataset into train (70%), validation (15%), test (15%). """ X = dataset.drop(colu...
import pickle def read_file(filename): labelled = pickle.load(open(filename, "rb")) for line in labelled: print line read_file("tedCruz_43k_7th_vader.p") #read_file("trump_list.p")
import pandas as pd exam_data = {'이름':['서준','우현','인아'],'수학':[90,80,70],'영어':[98,89,95],'음악':[85,95,100],'체육':[100,90,90]} df = pd.DataFrame(exam_data) print(df) print(type(df)) print() # '수학' 점수 데이터만 선택. 변수 math1에 저장 math1 = df['수학'] print(math1) print(type(math1)) print()
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2017-11-15 18:29 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('boutique', '0003_auto_20171113_2117'), ] operations = [ migrations.CreateMo...
#! /usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf from lib.fast_rcnn.config import cfg, cfg_from_file from lib.networks.factory import get_network from ctpn.demo import ctpn from pprint i...
''' Created on Oct 13, 2015 @author: Jonathan Yu ''' def howMany(meals, restaurant): num = 0 people = [] for meal in meals: data = meal.split(":") if data[1] == restaurant: if data[0] in people: continue num += 1 people.append(data[0]) ...
import threading import sys class ThreadedEx(threading.Thread): #2 """The thread. """ _lock = threading.Lock() def run(self): """Printing thread name and a number. """ for x in range(5): with ThreadedEx._lock: # Thr...
from tkinter import * import os master=Tk() w=Label(master,text='Choose your difficulty to start a game!',font=('calibri',11)) w.place(x=125,y=25,anchor=CENTER) w.pack def gabe(): os.startfile(r'C:/Users/2007d/Desktop/Guess the Number-CODEPACK/tetris.mp4') def stop(): master.destroy() def easy()...
#-- GAUDI jobOptions generated on Fri Jul 17 16:32:13 2015 #-- Contains event types : #-- 11104002 - 64 files - 1010900 events - 219.99 GBytes #-- Extra information about the data processing phases: #-- Processing Pass Step-124834 #-- StepId : 124834 #-- StepName : Reco14a for MC #-- ApplicationName : B...
import pytest from atsim.potentials.referencedata import Reference_Data, Unknown_Species_Exception, Unknown_Property_Exception def test_mass(): rd = Reference_Data() actual = rd.get("Gd", "atomic_mass") assert pytest.approx(157.25) == actual def test_mass_override(): rd = Reference_Data({"Gd" : {"atomic_mas...
import os import paramiko import sys #ftp part #hostname # username # password # localpath # remotepath def connect(hostname, username , password ,remotepath): ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(hostname, username, password) ...
""" 문제 주어진 수 N개 중에서 소수가 몇 개인지 찾아서 출력하는 프로그램을 작성하시오. 입력 첫 줄에 수의 개수 N이 주어진다. N은 100이하이다. 다음으로 N개의 수가 주어지는데 수는 1,000 이하의 자연수이다. 출력 주어진 수들 중 소수의 개수를 출력한다. 예제 입력 1 4 1 3 5 7 예제 출력 1 3 """ num_of=int(input()) N=list(map(int, input().split())) result=0 def prime_num(a): if ((a%2)==0 and a>2) or a==1: return 0 ...
import json with open("../date_file/user_info.json",'r') as g: data = g.read() user_list = json.loads(data) print(user_list)
import io import requests import zipfile import shutil import re from PIL import Image, ImageFilter # response = requests.get(f'http://www.pythonchallenge.com/pc/def/oxygen.png', stream=True) # with open('level-7.png', 'wb') as out_file: # shutil.copyfileobj(response.raw, out_file) # del response with open('leve...
from flask import Flask from flask_cors import CORS app = Flask(__name__,static_url_path='', static_folder="static",template_folder='templ') CORS(app) import requests from flask import Flask, request import json # used for URL's api_key = "?api_key=eb04bea4519a4b07b0788e5cbcfa3e41" base_url = "https://api.themoviedb.o...
#双分支 chTest = ['1', '2', '3', '4', '5'] if chTest: print(chTest) else: print('Empty')
from Tkinter import * import time import datetime top = Tk() h1 = Label(top, text="Product") h2 = Label(top, text="In Process") h3 = Label(top, text="Complete") l1 = Label(top, text="PRO-CIGNA") l2 = Label(top, text="UR-CIGNA") l3 = Label(top, text="MC & CR CARE NETWORK") l4 = Label(top, text="PBM-MAGELLIN RX") l5 ...
from account import views from django.urls import path from django.conf.urls import url, include urlpatterns = [ url(r'^edit$', views.edit), url(r'^$', views.index), url(r'^logout$', views.logout), url(r'^story$', views.story), ]
''' Created on Mar 17, 2017 @author: rashidi ''' def main(): print("test") # main()
import os import time #from sqlalchemy import create_engine #from sqlalchemy.ext.declarative import declarative_base #from sqlalchemy import Column, Integer, String, DateTime, Float, Boolean #from sqlalchemy.orm import sessionmaker, scoped_session from slackclient import SlackClient from app import app, db, mo...
from io import BytesIO from mock import MagicMock, patch, ANY import os from subprocess import Popen import tempfile import unittest from urllib.error import URLError import start from start import main, server_template, start_kafka, zk_conn_string EXHIBITOR_HOST = 'http://test-exhibitor' EXHIBITOR_RESPONSE = ('{"ser...
from hummingbot.client.config.config_var import ConfigVar from hummingbot.client.config.config_methods import using_exchange CENTRALIZED = True EXAMPLE_PAIR = "ZRX-ETH" DEFAULT_FEES = [0.25, 0.25] KEYS = { "bittrex_api_key": ConfigVar(key="bittrex_api_key", prompt="Enter your Bittrex ...
from datetime import datetime from django.contrib.auth.models import User from django.test import TestCase from django.urls import reverse from spiderTemplate.models import Site, Template, Field, Param, SiteType class SiteModelTests(TestCase): def test_logo(self): """网站图标URL""" site = Site(name...
fruit = ["apple", "banana", "mango"] veg = ['carrot', 'beans', 'potato'] drink = ['milk', 'water', 'juice'] #T1 def what_is_the_item(item): """ Write a function here that print what kind of item is given from the above lists. Example: if 'apple' given then it should print 'Its a Fruit' """ #T2 def merge_list(...
# Network Analysis # Creating retweet network # Import networkx import networkx as nx # Create retweet network from edgelist G_rt = nx.from_pandas_edgelist( sotu_retweets, source = 'user-screen_name', target = 'retweeted_status-user-screen_name', create_using = nx.DiGraph()) # Print the number of no...
import logging import common LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.INFO) def lambda_handler(event, context): ddb_table = common.get_ddb_table() box_client, _ = common.get_box_client() root_folder = common.get_folder(box_client, common.BOX_FOLDER_ID) root_shared = common.is_bo...
N, A, B = map( int, input().split()) print( min(A*N,B))
from __future__ import unicode_literals from django.db import models class Contact(models.Model): FirstName = models.CharField(max_length=100,null=True) LastName = models.CharField(max_length=100) Email = models.EmailField() MobileNo = models.IntegerField() def __str__(self): retur...
""" API for Game Board that allows interaction with boards. """ import json import random from time import sleep import uuid from rest_framework.decorators import api_view from rest_framework.response import Response from rest_framework import status from rest_framework.throttling import AnonRateThrottle from rest...
list=[1,2,3,4,5,2,2] list.append(6) print list print"-------------------" print list.count(2) print"-------------------" xList = [123, 'xyz', 'zara', 'abc', 123]; bList = [2009, 'manni']; xList.extend(bList) print "Extended List : ", xList print"-------------------------------" aList = [123, 'xyz', 'zara', 'abc']; prin...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'editor.ui' # # Created: Tue Feb 14 14:56:11 2012 # by: PyQt4 UI code generator 4.9 # # WARNING! All changes made in this file will be lost!
def solve(arr): x = int(arr[0]) y = int(arr[1]) z = int(arr[2]) for i in range(3,arr.size): if (x+y+z)>1 and (x+y+z)<2: print(x," ",y," ",z) if (x+y+z)>=2: if x>y and x>z: x=int(arr[i]) else: if(y>x and y>z): ...
import autograd.numpy as np # import torch class Model: def __init__(self, shape, lower, upper, layers, path): self.shape = shape self.lower = lower self.upper = upper self.layers = layers if layers == None and path != None: self.ptmodel = torch.load(path) ...
# -*- coding: utf-8 -*- """ Created on Mon Oct 8 15:23:20 2018 @author: Kankana Sinha """ import pandas as pd import matplotlib.pyplot as plt import numpy as np #Task5 def histedges_equalN(x, nbin): npt = len(x) return np.interp(np.linspace(0, npt, nbin + 1), np.arange(np...
# -*- coding: utf-8 -*- import json import re from unittest import TestCase from scrapy import Request, Item from scrapy.settings import Settings from scrapy.http.response.html import HtmlResponse from slybot.plugins.scrapely_annotations.extraction import ( TemplatePageMultiItemExtractor, SlybotIBLExtractor) f...
""" Faça um programa que mostre a tabuada de vários números, um de cada vez, para cada valor digitado pelo usuário. O programa será interrompido quando o número solicitado for negativo. """ n = 0 while True: n = int(input('Informe o valor: ')) if n < 0: break print('A tabuada é') print('-=' * 1...
from framework.data.jsonschema.base_jsonschema import BaseJSONSchema from framework.utils.service_utils import log_built_schema class HeadersJsonSchema(BaseJSONSchema): def __init__(self): super().__init__() def build_headers_schema_default(self): log_built_schema(self.json_schema) re...
a=input('Enter the list of colours') print(a[0]) print(a[-1])
# COMP90024 Team 1 # Albert, Darmawan (1168452) - Jakarta, ID - darmawana@student.unimelb.edu.au # Clarisca, Lawrencia (1152594) - Melbourne, AU - clawrencia@student.unimelb.edu.au # I Gede Wibawa, Cakramurti (1047538) - Melbourne, AU - icakramurti@student.unimelb.edu.au # Nuvi, Anggaresti (830683) - Melbourne, AU - na...
def sumDivisors(n): # this is a function for the sum of divisors of x (similar to problem 21) number = 1 # instead of initializing an array, it just creates a sum for x in range(2,int(n**0.5)+1): # for the same range if n%x == 0: # it adds the corresponding values number+= x + n/x ...
from torchvision import transforms def data_transform(name, size=224): name = name.strip().split('+') name = [n.strip() for n in name] transform = [] if 'resize_random_crop' in name: transform.extend([ transforms.Resize(int(size * 8. / 7.)), transforms.RandomCrop(size),...
""" __author__ = Hagai Har-Gil """ from unittest import TestCase import numpy as np import pandas as pd from typing import Tuple from pysight.nd_hist_generator.volume_gen import VolumeGenerator def gen_test_df(frame_num=10, end=1_000_000) -> Tuple[pd.DataFrame, pd.Series]: photons = np.arange(0, end, dtype=np.ui...
import numpy as np import os import random import cv2 import sys import re import datetime from keras.callbacks import ModelCheckpoint from keras.models import Sequential from keras.layers import Activation from keras.layers import Dense from keras.layers import Dropout from keras.layers import Flatten from keras.cons...
in_file = open('input_5.txt', 'r') # in_file = open('test_5.txt', 'r') def decode(line): row, col = line[:-3], line[-3:] cur_x, cur_y = [0, 127], [0, 7] f = 128 for i, ch in enumerate(row): if ch == 'F': cur_x[1] -= f/(2**(i+1)) else: cur_x[0] += f/(2**(i+1)) f = 8 for i, ch in enumerate(col): if ch == 'L'...
import itertools import json import uuid from datetime import datetime, timedelta # from django.shortcuts import render from django.contrib.auth import authenticate, login from django.contrib.auth.models import User from django.core.mail import send_mail from django.utils import timezone from rest_framework import g...
# -*- encoding: utf-8 -*- ############################################################################## # # Asterisk Click2dial module for OpenERP # Copyright (C) 2010-2013 Alexis de Lattre <alexis@via.ecp.fr> # # This program is free software: you can redistribute it and/or modify # it under the terms of ...
import vkquick as vq import typing , pyqiwi from src.config import complete_sticker, error_sticker from src.filters.error_handler import ErrorHandler from src.misc import app from src.database.base import location try: wallet = pyqiwi.Wallet(token=location.qiwi_key) except: pass @app.command("пе...
import random from typing import Optional from wingedsheep.carcassonne.carcassonne_game import CarcassonneGame from wingedsheep.carcassonne.carcassonne_game_state import CarcassonneGameState from wingedsheep.carcassonne.objects.actions.action import Action from wingedsheep.carcassonne.objects.meeple_type import Meeple...
Savings = eval(input("Enter your monthly savings amount")) Month_one = ((Savings) * (1 + .00417)) Month_two = ((Month_one + Savings) * (1 + .00417)) Month_three = ((Month_two + Savings) * (1 + .00417)) Month_four = ((Month_three + Savings) * (1 + .00417)) Month_five = ((Month_four + Savings) * (1 + .00417)) Month_six ...
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals from .shell import Shell # noqa
from datetime import datetime from flask import request from requirementmanager.app import app from requirementmanager.mongodb import ( requirement_collection ) from requirementmanager.dao.requirement import ( RequirementMongoDBDao ) from requirementmanager.utils.handle_api import handle_response from require...
#import tensorflow as tf from tensorflow.keras.models import load_model import os os.environ['TF_KERAS'] = '1' import keras2onnx import onnxruntime import argparse import inputLayerReplace def convertKerasToOnnx(fileName): model = load_model(fileName) # convert to onnx model onnx_model = ke...
# -*- coding: utf-8 -*- ''' Created on 2017. 7. 20. @author: HyechurnJang ''' import json import socket import pygics import acidipy import argparse apic_ip = None apic_user = None apic_pass = None apic_ctrl = None logstash_ip = None logstash_sock = None refresh = None debug = False dump = True c...
#!/usr/bin/env python3 import json import docker.errors from flask import (Flask, abort, flash, get_flashed_messages, redirect, render_template, request, url_for) SECRET_KEY = "1FGhw5s8" app = Flask(__name__) app.config["SECRET_KEY"] = SECRET_KEY client = docker.from_env() active_apps = {} def _...
class Node: def __init__(self, val): self.val = val self.left_child = None self.right_child = None self.ltag = 0 self.rtag = 0 class Tree: def __init__(self): self.root = None self.size = 0 def append(self, val): if self.root is None: ...
from flask import render_template as render from . import routes, session @routes.route('/', methods=('GET', 'POST')) def index(): return render('index.html', nickname=session.get('nickname'))
import numpy as np import cv2 import imageio imageio.plugins.ffmpeg.download() import imutils import matplotlib.image as mpimg from imutils.object_detection import non_max_suppression from moviepy.editor import * def pedestrian_detection_image(image): hog = cv2.HOGDescriptor() hog.setSVMDetector(cv2.HOGDescr...
''' input : first line contains a hexadecimal value secondline contains a decimal value output: check if they equal or not ''' h=input('Enter a Hexadecimal NUM:') k=int(input('Enter a decimal number:')) deci=int(h,16) # To convert hexa to a decimal number if deci==k: print('Equal') else: print('Not Equ...
import numpy as np from PIL import Image from Layer import Layer, Mode DEFAULT_NAME = "Layer" class Canvas: def __init__(self, canvas_name, first_layer=None, width=0, height=0): self.name = canvas_name self.layers_list = [] self.canvas_width = width self.canvas_height = height ...
from unittest import TestCase, main import numpy as np from ... import Comparator class TestIsNegative(TestCase): def test_negative(self) -> None: self.assertTrue(Comparator.is_negative(-6), "Should test negative.") self.assertTrue(Comparator.is_negative(-0.1), "Should test negative.") s...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Nov 9 12:14:42 2021 @author: janeyalex """ import numpy as np import matplotlib.pyplot as plt from scipy.stats import linregress import math import networkx as nx def func(k): return 3.46 * 10**8 * k**(-0.661) def q1(): y = [] for i in ...
''' author: juzicode address: www.juzicode.com 公众号: 桔子code/juzicode date: 2020.10.30 ''' import time,threading,sys from threading import Thread from multiprocessing import Manager if __name__ == '__main__': print('-----网址: www.juzicode.com') print('-----公众号: 桔子code/juzicode \n') manage...
#!/usr/bin/python3 import time import png from googlesearch import search import pyqrcode from pyqrcode import QRCode web=input("enter the topic u want to search") # to take input from user #now time for search url=[] for i in search(web,stop=3): print(i) #i will only print url time.sleep(1) ...
from flask import request from requirementmanager.app import app from requirementmanager.mongodb import ( archive_requirement_collection ) from requirementmanager.dao.archive import ( ArchiveRequirementMongoDBDao ) from requirementmanager.utils.handle_api import handle_response from requirementmanager.utils.ve...