text stringlengths 38 1.54M |
|---|
from .location import LocationsApi, LocationApi
from .plan import PlansApi, PlanApi
from .user import UsersApi, UserApi, UserPlansApi
from .signIn import SignInApi
from .signUp import SignUpApi
# API endpoints to access Database
def initialize_routes(api):
api.add_resource(LocationsApi, '/api/locations/')
api.... |
#!/usr/bin/python
import sys
file=sys.argv[1]
# & numberOfContigs &scaffolds & bases & meanSize & n50 & max & coverage & misassembledContigs & misassembledScaffolds & mismatches & indels
# 300-strept.sh.Ray & 86 & 68 & 1969888 & 22905 & 44534 & 194158 & 0.9627 & 1 & 1 & 1 & 0 \\
print "<table border=\"1\... |
import tkinter as tk
# noinspection PyUnusedLocal
class ToolTip(object):
"""
Show a tooltip
from https://stackoverflow.com/a/56749167/5539184
"""
def __init__(self, widget, text):
self.widget = widget
self.tip_window = None
self.id = None
self.x = self.y = 0
... |
from kiwoom import *
import pickle
f = open("data.db", "rb") ##얘는 읽고 주문 넣으면 되니까 r : 리드모드로 가져와
codes = pickle.load(f) ## 아까 list로 저장했으니 pickle은 list로 읽어온다
f.close() ## open을 했으면 항상 close하는 습관
print(codes) |
#!/usr/bin/env python
import os
try:
currdir = os.getcwd()
dir = currdir + "/a2sv-master"
os.chdir(dir)
os.system("chmod 777 install.sh")
os.system("./install.sh")
os.system("pip install -r requirements.txt")
os.chdir(currdir)
dir = currdir + "/Sublist3r-master"
os.chdir(dir)
os.... |
def fib(nums):
'''
:param nums: 一个整数,相当于数列的下标
:return: 返回该下标的值
'''
if nums == 0 or nums == 1:
return nums
else:
return fib(nums-2) + fib(nums-1)
def createFib(n):
'''
:param n: 需要展示前面n个数
:return: 返回一个列表,费波那契数列
'''
list1 = []
for i in range(n):
... |
import os
def rename_files(path):
files = os.listdir(path)
table = str.maketrans(dict.fromkeys('0123456789'))
saved_path = os.getcwd()
os.chdir(path)
for file in files:
new_file = file.translate(table)
print("Old name file: {}".format(file))
print("New name file: {}".forma... |
"""
@brief PSF characterization from distribution of Gaussian fit
parameters to Fe55 data.
@author J. Chiang <jchiang@slac.stanford.edu>
"""
from __future__ import print_function
import os
from MaskedCCD import MaskedCCD
from pipeline.TaskParser import TaskParser
import pylab_plotter as plot
from fe55_psf import PsfGa... |
"""
Contains a mapping of integers to the chart type they represent.
"""
symbol_dict = {
1: "line",
2: "scatter",
4: "bar",
19: "geographic_map",
35: "graph",
14: "chord",
10: "bubble",
37: "parallel_coordinates",
13: "sankey",
9: "box",
16: "area",
31: "stream_graph",
... |
with open("input.txt","r+") as f:
case = int(f.readline())
w = open("output.txt","w")
for j in range(1,case+1):
m = int(f.readline())
i = 1
flag = [0]*10
fl = 0
while(i<500):
res = i*m
for r in range(0,10):
if str(r) ... |
"""
评分卡
"""
import numpy as np
import statsmodels.api as sm
#import re
import pandas as pd
def tool_group_rank(tmp_frame,group):
c,s = pd.qcut(tmp_frame.iloc[:,0].unique(),group,retbins =1)
def get_group_num(x):
for i in range(len(s-1)):
if x<=s[i+1]:
ret... |
t=int(input())
ans=[[0,0,0]]*t
for i in range(t):
n=int(input())
n=n-1
bits=0
rem=n/26
bits=int(2**rem)
if(n%26<2):
ans[i][0]=bits
else:
ans[i][0]=0
if(n%26>=2)and(n%26<10):
ans[i][1]=bits
else:
ans[i][1]=0
if(n%26>=10)and(n%26<26):
ans[i][... |
# Copyright (c) 2015-2020, Swiss Federal Institute of Technology (ETH Zurich)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright... |
# Copyright (c) 2012-2022, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
#
# *** Do not modify - this file is autogenerated ***
from . import AWSObject, AWSProperty, PropsDictType, Tags
from .validators import boolean, double, integer
from .validators.appsync import resolver_... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 5 22:38:03 2020
@author: harsh
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('Restaurant_Reviews.tsv', delimiter = '\t', quoting = 3)
# Cleaning the texts
# Stemming Proces... |
from fastapi import FastAPI
from utils.io_utils import load_config
from utils.model_utils import load_model, load_bow, get_text_sentiment
import uvicorn
config = load_config()
model = load_model(config["paths"]["model"])
bow = load_bow(config["paths"]["matrix"])
app = FastAPI()
@app.get("/")
def read_root():
ret... |
import cv2
import os
from ..modelo.Imagen import Imagen
from .Configuracion import Configuracion
class DaoDBMuestral:
def __init__(self):
'''
Constructor
'''
None
def leer_carpetas(self):
"""
leer_carpetas
@details lee las nombres de las ca... |
import numpy as np
import streamlit as st
import math
import csv
from PIL import Image
import pandas as pd
def app():
st.title("Meters to kilometers")
a = st.number_input("Enter length in meters:")
b = ( a / 1000)
st.text("Length in kilometer is:")
st.write(b)
c = st.numb... |
import pygame
from character import character
class player(character.character):
facingDir = [0, 0]
def __init__(self, levelRect, startPos, playerSize, scale, physEnabled, inGame, floorGroup):
super().__init__(levelRect, startPos, playerSize, scale, physEnabled, inGame, floorGroup, 3)
self.ac... |
#!/usr/bin/env python
from std_msgs.msg import Int16
from std_msgs.msg import Int32
from std_msgs.msg import String
from geometry_msgs.msg import PoseArray
from geometry_msgs.msg import Pose
from geometry_msgs.msg import Point
import rospy
import tellopy
import time
import datetime
import os
import csvio
import getpas... |
# flake8: noqa
from tune_notebook.monitors import (
NotebookSimpleChart,
NotebookSimpleHist,
NotebookSimpleRungs,
NotebookSimpleTimeSeries,
PrintBest,
)
|
from constants import Constants
from pre_processor import Pre_processor
from database import Database
from hpelm import ELM
# CONTAINS ALL STATIC MEMBERS
class Elm:
@staticmethod
def epoch(train_x, train_y, test_x, test_x_raw, filename):
features = train_x.shape[1]
train_y = Pre_processor.one_hot_encoding(trai... |
class Solution:
def exist(self, board: [[str]], word: str) -> bool:
if not board:
return False
maxH = len(board)
maxW = len(board[0])
def checkMove(x, y):
if x < 0 or y < 0 or x >= maxW or y >= maxH:
return False
return True
... |
from json import load
from pprint import pprint
from collections import namedtuple
from itertools import chain, zip_longest
from statistics import mean, pstdev
from math import ceil
from operator import itemgetter
def grouper(iterable, n, fillvalue=None):
"Collect data into fixed-length chunks or blocks"
# gro... |
import datetime
import uuid
from enum import IntEnum
from tortoise import Model, fields
class ProductType(IntEnum):
article = 1
page = 2
class PermissionAction(IntEnum):
create = 1
delete = 2
update = 3
read = 4
class Status(IntEnum):
on = 1
off = 0
class User(Model):
userna... |
# class Student:
# '''This is a class of student and his marks'''
# def __init__(self, name, marks):
# self.name = name
# self.marks = marks
# def display(self):
# print("Student name:", self.name)
# print("Marks of the student is", self.marks)
# def grade(self):
# ... |
#!/usr/bin/env
#
from ansible.module_utils.basic import *
# 创建一个AnsibleModule的实例,argument_spec初始化参数为空字典,因为我们这个模块不需要传递参数,所以传递空字典进去就好了.
module = AnsibleModule(
argument_spec = dict(),
)
# 调用本地系统命令获取时区设置
status,output = commands.getstatusoutput('''date''')
if status == 0:
# 按照ansible 的返回格式定义返回内容,stdout为标... |
def get_goal_string(object_dict, obj_list, obj_loc_list, goal_list,
goal_loc_list,env):
"""
Returns
========
str:
A generic goal condition that will place every object based on
its type and size at the correct goal.
"""
# Append your goal con... |
from python_resources.functions import permutations
# print(permutations([8,11,15]))
# print(permutations([10,12,14]))
print(8 | 10)
print(0b1000 | 0b1010)
print(8 & 10)
print(0b1000 & 0b1010)
print(8 ^ 10)
print(0b1000 ^ 0b1010) |
from django.db import models
# Create your models here.
class CBTIapp2_model(models.Model):
username = models.CharField(max_length = 32, verbose_name = '사용자명')
useremail = models.EmailField(max_length = 32, verbose_name = '사용자이메일')
password = models.CharField(max_length = 32, verbose_name = '비밀번호')
reg... |
from point import Point
from typing import List, Optional, cast
from scl import Scl
from decimal_math import Decimal, sin, pi, cos, sqrt
from line import Line, CircleLine
Polygon = List[Point]
def construct_center_polygon(n: int, k: int, quasiregular: bool) -> Polygon:
# Initialize P as the center polygon in an n-... |
#!/usr/bin/env python
"""The setup script."""
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
"Click>=7.0",
"Flask==1.1.2",
"authlib==0.15.3",... |
import pygame, random
#variables
screen_width = 920
screen_height = 560
obj_size = 50
#Colors
white_color = (200, 200, 200)
light_gray = pygame.Color('grey12')
pygame.init()
clock = pygame.time.Clock()
screen = pygame.display.set_mode((screen_width, screen_height))
def mover_rectangulo():
global speed
if r... |
#checks for observaciones and predicciones keywords and data
import sys
def headersFound(fileString):
observPos=fileString.find('observaciones')
predictPos=fileString.find('predicciones')
missing=''
try:
if observPos==-1:
missing='observPos'
print("Input File... |
import pandas as pd
import geopandas as gpd
from scipy import stats
import numpy as np
import math
# class Manipulation():
# def __init__(self):
# print("Initializing class 'Manipulation'")
def drop_unit_columns(df):
units = df.filter(like='.unit').columns
units.tolist()
df.drop(units, axis... |
import sys
import numpy as np
sys.path.append("..")
import grading
# code_size = 71
# img_shape = (38, 38, 3)
def submit_char_rnn(submission, email, token):
grader = grading.Grader("cULEpp2NEeemQBKZKgu93A")
history, samples = submission
assert len(samples) == 25
grader.set_answer("pttMO", int(np.mean(... |
import os.path
from time import sleep
import socket
import traceback
import struct
import copy
import logging
import paramiko
from .ssh import SSH
from .ssh_bruteforce import *
from utils.output import Output
from utils.dispatch import dispatch
from utils.db import DB
logging.getLogger("paramiko").setLevel(logging.C... |
# Generated by Django 2.2.17 on 2020-11-30 23:23
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0009_auto_20201201_0217'),
]
operations = [
migrations.AlterField(
model_name='blog',
name='... |
# -*- coding: utf-8 -*-
import time
import socket
import json
import threading
from queue import Queue
import logging
UDP_PORT = 8988
TCP_PORT = 8987
class Sock:
"""
当前主机探测直接采用udp群发消息,没有采用多线程tcp探测主机端口和arp缩小主机范围
目前已经打开 8987 TCP 主机探测端口; 8988 UDP 游戏初始化端口
发现就算将UDP切换为TCP协议,也无法改变类似UDP一样采用多线程,一样要统计每个玩家是否发送成... |
## @file
## Script for the quest room of the Brynknot Sewers Maze.
from Atrinik import *
from QuestManager import QuestManager
import os
activator = WhoIsActivator()
me = WhoAmI()
## Talthor's quest.
quest = {
"quest_name": "Enemies beneath Brynknot",
"type": QUEST_TYPE_KILL,
"kills": 1,
"message": "Go through t... |
import turtle
turtle.shape("turtle")
turtle.color("black","yellow")
turtle.begin_fill()
turtle.circle(100)
turtle.end_fill()
turtle.up()
turtle.setpos(-30,100)
turtle.down()
turtle.color("black","blue")
turtle.begin_fill()
turtle.circle(20)
turtle.end_fill()
turtle.up()
turtle.setpos(30,100)
tu... |
def cuboid(arg):
centre = [float(arg[1]), float(arg[2]), float(arg[3])]
length = float(arg[4])
width = float(arg[5])
height = float(arg[6])
vertices = []
for i in [-1, 1]:
for j in [-1, 1]:
for k in [-1, 1]:
vertices.append([centre[0]+0.5*i*length, centre[1]+0.5*j*width, centre[2] + 0.5*k*height])
tri... |
'''
Created on Mar 11, 2021
@author: ssmup
'''
import discord
from discord.ext import commands
class LeagueOfLegends(commands.Cog):
'''
classdocs
'''
def __init__(self, bot):
'''
Constructor
'''
self.bot = bot
@commands.command(name='opgg', help='!eba opg... |
#
# Copyright (C) 2013 - 2015 Satoru SATOH <ssato @ redhat.com>
# License: MIT
#
# pylint: disable=missing-docstring
import os
import tempfile
import unittest
import anyconfig.backend.configobj as TT
from anyconfig.tests.common import dicts_equal
CNF_0_S = """\
# This is the 'initial_comment'
# Which may be several ... |
import asyncio
import json
import os
from pathlib import Path
from typing import List, Optional, Generator, Dict
from server.data import Metrics, Segment, Value
from server.server import post_after, post_after_async, Component, LogAccessMixin, JSONType
from abr.video import get_video_bit_rate, get_vmaf, get_chunk_siz... |
# -*- coding: utf-8 -*-
"""ERP - Product Search"""
import json
import logging
from json import JSONDecodeError
from random import choice
from types import BuiltinFunctionType, ModuleType
from typing import List, Tuple
from retrying import retry
from selenium.webdriver.common.by import By
from selenium.webdriver.remote... |
import os
import datetime
import time
from django.utils import timezone
# TODO: this is out of date, but do we really need it?
def populate():
clients()
inventory()
def clients():
# Constants for the client model
MALE = Client.MALE
FEMALE = Client.FEMALE
# Add Clients
eric = add_client... |
# Generated by Django 3.0.3 on 2020-03-04 09:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('extendflix', '0004_auto_20200304_0944'),
]
operations = [
migrations.AlterField(
model_name='movie',
name='image',
... |
import numpy as np
import random
class perceptron:
#global weights;
def __init__(self,NumEntradas):
"""
NumEntradas: para genererar los pesos aleatorios
"""
self.weights=list(random.uniform(-0.5,0.5) for i in range(NumEntradas+1))
self.lr=0.3 #taza de aprendiza... |
from dcbase.apps import TIMEZONE_SESSION_KEY
from dcbase.decorator.profileFormView import profile_form_view
from dcbase.forms.userProfile import UserProfileForm
from dcbase.views.profile.profileEditFormView import ProfileEditFormView
from django.contrib.auth.decorators import login_required
from django.core.urlresolver... |
import requests
import dotenv
import json
import pandas as pd
import openpyxl as xl
import time
class constants:
name=0
company_number=1
Jurisdiction_code=2
cmpnyType=3
registry_url=4
branch=5
branch_status=6
current_status=7
street_add=8
locality=9
region=10
postal_co... |
from django.contrib import admin
from .models import Article, Person, Update_items
from django.contrib.auth.apps import AuthConfig as _AuthConfig
from django.contrib.admin.apps import AdminConfig as _AdminConfig
from django.apps import AppConfig
class ArticleAdmin(admin.ModelAdmin):
list_display = ('title', 'pub_... |
#!python
from linkedlist import LinkedList # from folder.filename import Class
class Queue(object):
def __init__(self, iterable=None):
"""Initialize this queue and enqueue the given items, if any."""
# Initialize a new linked list to store the items
self.list = LinkedList()
if iter... |
import os, subprocess, tempfile
def run_test(infile, outfile):
print("running " + infile)
with open(outfile) as f:
expected = f.read()
with os.popen("../microchess < " + infile) as f:
actual = f.read()
if not actual.endswith('\n'):
actual += '\n'
if actual != expected:
... |
from math import log
def f(x):
return log(x) - 2
def checkrange(func):
def inner(x):
if x <= 0:
print("X has to be greater than 0")
else:
return func(x)
return inner
#def test_checkrange():
#return assert(f_safe(2))
f_safe = checkrange(f) # f_safe is now a function
print(f_safe(-2))
print(f_safe(2))... |
#
# Copyright (c) 2008-2015 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
from pypokerengine.players import BasePokerPlayer
class FishPlayer(BasePokerPlayer): # Do not forget to make parent class as "BasePokerPlayer"
# we define the logic to make an action through this method. (so this method would be the core of your AI)
def declare_action(self, valid_actions, hole_card, round_... |
#!/usr/bin/env python3
import os
import logging
import argparse
import csv
OK_SIGN = "OK ]"
FAILED_SIGN = "FAILED ]"
SEGFAULT = "Segmentation fault"
SIGNAL = "received signal SIG"
PASSED = "PASSED"
def get_test_name(line):
elements = reversed(line.split(" "))
for element in elements:
if "(" not in ... |
_PAGE_ACCESS_TOKEN = ""
_VERIFY_TOKEN = ""
def get_page_access_token():
return _PAGE_ACCESS_TOKEN
def get_verify_token():
return _VERIFY_TOKEN
|
# Copyright 2017-2023 Lawrence Livermore National Security, LLC and other
# Hatchet Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: MIT
from abc import abstractmethod
try:
from abc import ABC
except ImportError:
from abc import ABCMeta
ABC = ABCMeta("ABC", (ob... |
N = int(input())
if int(N) == 2 or int(N) == 4 :
print('Not Weird')
elif int(N) % 2 == 0 and N > 20:
print('Not Weird')
else:
print('Weird') |
#DE FIECARE DATA CAND UN USER SE INREGISTREAZA I SE CREEAZA PROFILUL AUTOMAT
#FARA SA MAI TREBUIASCA SA PUN EU DIN ADMIN
from django.db.models.signals import post_save, pre_delete #Se apeleaza dupa ce un user este creat
from django.contrib.auth.models import User #senderul - se trimite semnalul
from django.dispatch im... |
import FWCore.ParameterSet.Config as cms
process = cms.Process("demo")
process.options = cms.untracked.PSet(
SkipEvent = cms.untracked.vstring('ProductNotFound')
)
process.load("FWCore.MessageService.MessageLogger_cfi")
process.ZCandidate = cms.EDProducer("CandViewShallowCloneCombiner",
... |
#!/usr/bin/env python
""" Rosalind project - Problem: Finding a Shared Motif
Problem
A common substring of a collection of strings is a substring of every member of
the collection. We say that a common substring is a longest common substring if a
longer common substring of the collection does not exist. For exampl... |
import gamestate
from lib.characters import *
from settings import Settings
if __name__ == "__main__":
state = gamestate.GameState([Villager('test0'), Villager('test1'), Doctor('test2'), Cop('test3'), Mafia('test4')], Settings())
state.run() |
from eppy.doc import EppDoc
class EppUpdateLaunch(EppDoc):
_path = ('launch:update',)
def __init__(self, phase: str, applicationid: str):
dct = {
'launch:update': {
'phase': phase,
'applicationID': applicationid
}
}
super(EppUpda... |
import numpy as np
import cv2
import os
__all__ = ['load_test_data', 'load_training_data']
labels = ["covid", "lung_opacity", "pneumonia", "normal"]
img_size = 224
def load_training_data(data_dir):
"""
Load in training data.
input: data_dir, str, path of data folder.
output: np.array(data), np.array ... |
from IPython.utils.py3compat import xrange
price = '200'
print(price.zfill(4))
name = "sudeeppatel"
print(name.upper())
print(name.swapcase())
print(name.swapcase())
print(name.isalnum(), name.isalpha(), name.isdigit())
name = "sudeep patel"
print(name.isalnum(), name.isalpha(), name.isdigit())
print(name.encode... |
from neural_nlp.stimuli import load_stimuli
class TestDiverseSentences:
def test_1(self):
data = load_stimuli('diverse.1')
assert len(data) == 384
assert data[0] == 'An accordion is a portable musical instrument with two keyboards.'
assert data[-1] == 'A woman has different reprodu... |
import numpy as np
import matplotlib
#matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
import torch
#import model
import config as c
#c.feature_net_file+="_trained"
c.additionally_trained_feature_net = False
c.use_pretrained = True
#import new_net as feature_net
import feed_forward_net as feature_net
#import ... |
def tribonacci_rec(signature, n):
if n == 1:
return signature[0]
if n == 2:
return signature[1]
if n == 3:
return signature[2]
return tribonacci_rec(signature, n-1) + tribonacci_rec(signature, n-2) + tribonacci_rec(signature, n-3)
def tribonacci(signature, n):
result = [... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2014 Hamilton Kibbe <ham@hamiltonkib.be>
# Based on render_svg.py by Paulo Henrique Silva <ph.silva@gmail.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 obtai... |
# import the necessary packages
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
import cv2
import numpy as np
import serial
import time
ser = serial.Serial('/dev/ttyACM0',115200)
# initialize the camera and grab a reference to the raw camera capture
camera = PiCamera()
camera.resolution ... |
import numpy as np
import vertex_screen as vt
# layout: u (n_dim) f (1) n_frames * [r (3) t(3) e (n_exp-1)]
def f_id(x, m_vertex, gt_landmarks, f, rte_guess, f_blend_shape, w_reg):
u = x
p = rte_guess
e = p[:, 6:]
e = np.c_[1 - np.sum(e, axis=1), e]
blend_shape = f_blend_shape(u) # (dim_exp, n_... |
def main():
n = int(input())
print((n*(n+1))//2 - n)
if __name__ == '__main__':
main()
|
# -*- coding: utf-8 -*-
"""
# --------------------------------------------------------
# @Project: torch-Slim-Detection-Landmark
# @Author : panjq
# @E-mail : pan_jinquan@163.com
# @Date : 2020-04-03 18:38:34
# --------------------------------------------------------
"""
from __future__ import print_function
import o... |
from __future__ import print_function
from __future__ import division
import numpy as np
from . import _preload_lattice
class Permutohedral_fast(object):
def __init__(self, N,M,d,with_blur=True):
self._impl = _preload_lattice.Permutohedral_p(N,M,d,with_blur)
def init_with_val(self,features,in_tmp,wit... |
from flask import Blueprint
ac = Blueprint('ac',__name__,url_prefix='/ac')
@ac.route('/login')
def login():
return 'login'
@ac.route('/logout')
def logout():
return 'logout' |
from django.test import TestCase, Client
from django.urls import reverse
class Test_home_page(TestCase):
def setUp(self):
self.client = Client()
self.url = reverse('lista')
def tearDown(self):
pass
def test_status_code(self):
response = self.client.get(self.url)
s... |
#!usr/bin/python
import sys
from key_generator import *
from fast_exponentiaton import *
def encrypt(data,pub_key,n):
cipher = pow(data,pub_key,n)
return cipher
def decrypt():
pub_key,pri_key,n= generating_keys()
cipher = encrypt(5000000,pub_key,n)
decipher = pow(cipher,pri_key,n)
return deciph... |
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
import threading
from bs4 import BeautifulSoup
import random
import sys
import os
import re
import sqlite3
from openpyxl import Workbook
from openpyxl import load_workbook
from openpyxl.styles import Alignment
import yaml
import atexit
import time
import ... |
from flask import Flask, send_file
import time
app = Flask(__name__)
@app.route('/date/')
def datePage():
return time.ctime()
@app.route('/')
def alarmPage():
return send_file('./Soc_Prosjekt/CameraImage/alarmphoto.jpg', mimetype='image/jpg')
if __name__=='__main__':
app.run(host='128.39.113.212') #everyo... |
# ECE 5725
# Michael Xiao (mfx2) and Thomas Scavella (tbs47)
# 3D scanner software
import cv2
import numpy as np
import math
from picamera import PiCamera
from time import sleep
import RPi.GPIO as GPIO
import time
import os
from gpiozero import LED
from gpiozero import PWMLED
from gpiozero import Button
import smtplib
... |
# coding: UTF-8
from lxml.builder import E, ET
from copy import copy
import urllib
from functools import wraps
from werkzeug.wrappers import BaseResponse
def CLASSES(*args):
return {'class': ' '.join(args)}
SITE_TITLE = 'ahri.net'
SITE_URL = 'ahri.net'
AUTHOR_NAME = 'Adam Piper'
AUTHOR_EMAIL = 'adam@ahri.net'
YEA... |
def main():
age = int(input("What is your age? "))
while age < 0 or age > 150:
age = int(input("What is your age? "))
credits = int(input("How many credits have your earned toward graduation (120 if done)?"))
while credits < 0 or credits > 120:
credits = int(input("How many credits have... |
list_1 = [0,1,2,3,4,5,6,7,8,9]
list_2 = [0,2,3,4,7,8,12]
counter = 0
for i in list_1:
if i in list_2:
counter += 1
print(counter) |
def parse_args():
"""-> argparse.Namespace"""
import argparse
parser = argparse.ArgumentParser(description="train a darc parser.")
parser.add_argument('--verbose', '-v', action='count', help="maximum verbosity: -vv")
parser.add_argument('--model', required=True, help="npy model file to save")
pa... |
def minimumOnStack(operations):
ans = []
stack = []
minchecker = []
for i in range(0,len(operations)):
if operations[i] == "min":
ans.append(minchecker[0])
elif operations[i] == "pop":
num = stack.pop()
if num == minchecker[0]:
minc... |
##########
#
# timesOfIndia.py
# By Aadarsha Shrestha (aadarsha.shrestha.nepal@gmail.com, aadarsha@tutanota.com)
#
# Returns the current day's headlines from Times Of India
# API: (RSS) http://timesofindia.indiatimes.com/rss.cms
#
# NOTE:
# - url_formatter(), extractor() are to be changed according to need
# - Do not... |
#!/usr/bin/python
# -*- coding: latin-1 -*-
"""
Modelo productor-consumidor con conditional variables
porque siempre se libera el lock después de lista.pop()
"""
import threading
from time import time, sleep, clock
from random import seed, uniform
# Global variables #
lista = list([])
evento = thread... |
import arcpy
arcpy.env.overwriteOutput = True
#---------------------------------
# Set Spatial Reference for State Plane Feet HARN83 Florida East
#--------------------------------
SR = arcpy.SpatialReference(2881)
def get_SpatialA():
arcpy.CheckInExtension("Spatial")
# Check out the ArcGIS Spatial Analyst ... |
import os
import json
import pandas as pd
from docx import Document
import openpyxl
from openpyxl import load_workbook
from pathlib import Path
from xlrd import open_workbook
from xlutils.copy import copy
import xlsxwriter
class TempleteGenerator():
def __init__(self):
self.Keydictionary = ["REPLACE_NAME"... |
#dictionary
houses = {"Jesus": "Salvation", "Success": "Divine Help + Human Effort"}
houses["Peace"] = "Jesus"
print(f"My peace is in {houses['Peace']}") |
import pandas as pd
from datetime import datetime
from commons.csv_writer import CSVWriter
from driver.webdriver import WebDriver
from selenium.webdriver.common.keys import Keys
import random
from time import sleep
import os
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv())
import constants
impor... |
import sqlite3
connection = sqlite3.connect('data.db')
cursor = connection.cursor()
create_table_query_1='CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY,username text,password text)'
cursor.execute(create_table_query_1)
create_table_query_2='CREATE TABLE IF NOT EXISTS items (id INTEGER PRIMARY KEY,name t... |
m = float(input("Digite uma medida em metros: "))
cm = m * 100
print(m, "metros equivalem a", cm, "centímetros")
|
"""
Burak Himmetoglu, 2019
Testers for elasticnet regression
"""
from sklearn.datasets import make_regression
from mlbook.utils.losses import mse
from mlbook.linear_regression.enet import *
from mlbook.utils.scalers import standardize
from mlbook.linear_regression.common import init_coef
if __name__ == "__main__":
... |
from crispy_forms.helper import FormHelper
from crispy_forms.layout import ButtonHolder, Submit
from crispy_forms_foundation.layout import Column, Fieldset, Layout, Row
from django import forms
from bpp.util import formdefaults_html_after, formdefaults_html_before
from import_list_if.models import ImportListIf
class... |
import turtle
turtle.Screen().bgcolor("black")
turtle_stamp = turtle.Turtle()
turtle_stamp.shape('turtle')
turtle.Screen().colormode(255)
turtle_stamp.color(121, 186, 78)
turtle_stamp.penup()
turtle_stamp.left(90)
turtle_stamp.forward(100)
turtle_stamp.right(90)
turtle_stamp.forward(100)
turtle_stamp.stamp()
turtle_s... |
"""
Module providing flow control in simulation
"""
import random
import logging
from time import time
import copy
import cPickle
class Simulation(object):
"""
This class defines what happens and when.
"""
global_environment = None
environments = {}
def __init__(self, graph = None, interaction = None, ag... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.