text stringlengths 8 6.05M |
|---|
# -*- coding: utf-8 -*-
print "Hello World!"
print "this is a new line"
print "test # test"
print '吃呢色'
# print "not rint this line"
|
from django.urls import path
from . import views
urlpatterns = [
path('', views.food_list, name='food_list'),
path('berechnung', views.calc, name='berechnung')
]
|
# -*- coding: utf-8 -*-
"""Download specified NWP model data.
A quick conversion of my images-on-demand python/django code to just
save the downloaded data. It appears GFS, NAM, and ECMWF work. I
added code for NAVGEM but it appears their update cycle is a bit
slower.
At present, this is designed to be run in a for... |
'''
CLM and WRF Coupled System
'''
Def_PP = 2 # (0: Serial, 1: ParallelPython 2: MPI4Py)
mpi4py_comm = []
mpi4py_null = []
mpi4py_rank = 0
mpi4py_size = 0
mpi4py_name = []
if Def_PP == 2:
from mpi4py import MPI
try:
import dill
MPI.pickle.dumps = dill.dumps
MPI.pickle.loads = dill.l... |
# Copyright (c) 2013 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# dep.gyp contains a target dep, on which all the targets in the project
# depend. This means there's a self-dependency of dep on itself, which is
# pruned by sett... |
"""
Faça um Programa que verifique se uma letra digitada é "F" ou "M".
Conforme a letra escrever: F - Feminino, M - Masculino, Sexo Inválido.
"""
def pede_letra_ao_usuario(msg):
# upper - deixa a letra em MAIÚSCULO
# strip - remove espaços em branco antes ou depois da letra
return input(msg).upper().strip... |
import os, sys, json, re, ast, io
from functools import reduce
from flask import Flask, request, render_template, redirect, url_for, jsonify
from flask_cors import CORS
from flask_mysqldb import MySQL
from urllib.parse import urlparse
from Shaker_Manifesto import SM_Search
from Shaker_Manifesto import SM_Autocomplete
... |
# coding: utf-8
import re
import os
ROOT_PATH = re.match(r'\S+360', os.getcwd()).group()
DATA_PATH = ROOT_PATH + '/data/' # 所有数据
MODEL_PATH = ROOT_PATH + '/model/' # 所有模型
RESULT_PATH = ROOT_PATH + '/result/' # 所有结果
CLASSIFIER_PATH = ROOT_PATH + '/classifier/' # 机器学习算法得到的所有分类器
TEXT_CNN_PATH = ROOT_PATH + '/mode... |
# Copyright (c) 2013, Indictrans and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
def execute(filters=None):
columns, data = [], []
columns = get_columns()
data = get_data(filters)
return columns, data
def get_data(fi... |
#Crie um programa que leia duas notas de um aluno e calcule sua média, mostrando uma mensagem no final, de acordo com a média atingida:
#– Média abaixo de 5.0: REPROVADO
#– Média entre 5.0 e 6.9: RECUPERAÇÃO
#– Média 7.0 ou superior: APROVADO
n1 = float(input('Digite a primeira nota: '))
n2 = float(input('Digite a seg... |
import time
from datetime import datetime
class Node:
def __init__(self, value, link=None):
self.value = value
self.link = link
def get_value(self):
return self.value
def get_link(self):
return self.link
def set_link(self, new_link):
self.link = new_link... |
srcDir = "/srv/unmix-server/1_sources/RockBand-GuitarHero/"
destDir = "/srv/unmix-server/1_sources/RockBand-GuitarHero-moggs/"
# Handle multitrackdownloads-alphanumeric
# This folder contains mogg files (sometimes directly in song folder, sometimes in subfolder).
# Take those and convert them with ffmpeg.
import su... |
n1 = int(input('Digite um número:'))
n2 = n1+1
n3 = n1-1
print("O núm é: {}, o nº anterior é: {} e o nº seguinte è: {}".format(n1, n3, n2)) |
def remove_repetidos(lista):
lista_intermediaria = list()
b = list()
a = list(lista)
for i in range(len(a)):
if a[i] != '[' and a[i] != ']' and a[i] != ',':
b.append(int(a[i]))
for i in range(len(b)):
if i < len(b)+1:
if b[i] not in b[(i+1):]:
... |
# Copyright 2021 DAI Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %%
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from sklearn.model_selection import train_test_split
import seaborn as sns
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model imp... |
# coding=utf-8
import os
import numpy as np
# PyTorch
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
#-------------------------------------
# ネットワーク重み初期化
#-------------------------------------
def weights_init_normal(m):
classname = m.__class__.__name__
if classna... |
from original_approach.dataset import X_seqs, y, num_outputs
from chem_props_approach.encoding import encode_chemical_properties
X = encode_chemical_properties(X_seqs) |
'''
对于crawl_mm_img修改
'''
import requests
import random
import re
import os
import time
#打开获取到的链接地址
def open_url(url):
headers = {
"Referer": url,
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"}
html = requests... |
import unittest
from tree_data import FileSystemTree
DIR_PATH = "Testing\\"
class Test_File_System(unittest.TestCase):
@staticmethod
def get_names(fs):
if fs.is_empty():
return []
string_list = [fs._root]
for tree in fs._subtrees:
string_list.a... |
def biggest(num1,num2,num3):
if num1 > num2 and num1 > num3:
return num1
elif num2 > num1 and num2 > num3:
return num2
else:
return num3
num1 = int(input("enter a num1: "))
num2 = int(input("enter a num2: "))
num3 = int(input("enter a num3: "))
largest = biggest(num1,num2,num3)
prin... |
try:
from django.template.engine import Engine
from django.template.loaders.base import Loader as BaseLoader
except ImportError: # Django < 1.8
Engine = None
from django.template.loader import BaseLoader, find_template_loader, get_template_from_string
def template_loader(loader_name):
if Engine:
... |
gdb.execute('file template', to_string=True)
gdb.execute('break smart_pointer<int>::get()', to_string=True)
gdb.execute('run', to_string=True)
frame = gdb.selected_frame()
block = frame.block()
names = set()
while block:
if(block.is_global):
print()
print('global vars')
for symbol in block:
... |
from contextlib import contextmanager
import requests
import sqlite3
import json
import math
import os
import re
DB_URL = os.path.join('..', 'data', 'stock.db')
@contextmanager
def db(db_filename=DB_URL):
conn = sqlite3.connect(db_filename, detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
cur =... |
# LEVEL 24 (second part)
import hashlib
import zipfile
from io import BytesIO
with zipfile.ZipFile('data/level_24.zip') as zf:
for zi in zf.infolist():
print(zi)
zf_data_b = zf.read('mybroken.zip')
zf_data = BytesIO(zf_data_b)
with zipfile.ZipFile(zf_data) as bzf:
for zi in bzf.infolist... |
#!/usr/bin/env python3
"""Store path variables and other constants.
Usage:
python3 words.py <URL>
"""
DIR_PATH = r'C:\Users\Ilija\PycharmProjects\LeafClassificationMongoDb\Data'
TEST_FILE_PATH = '\\Csv\\'.join([DIR_PATH, 'test.csv'])
TRAIN_FILE_PATH = '\\Csv\\'.join([DIR_PATH, 'train.csv'])
TRAINED_MODELS_PATH ... |
'''
MIT License
Copyright (c) 2017 Sterin, Farrugia, Gripon.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, mer... |
# encoding: utf-8
'''
@Version: V1.0
@Author: JE2Se
@Contact: admin@je2se.com
@Website: https://www.je2se.com
@Github: https://github.com/JE2Se/
@Time: 2020/6/10 19:25
@File: PhpStudyDB.py
@Desc:
'''
from lib import *
import logging
from lib.Urldeal import umethod
import requests
def PhpStudyDB(Url): #必... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
from router_solver import *
import compilador.helpers.printer
from compilador.helpers.printer import *
import numpy as np
# CLASE BASE ADDRESS
# Objeto que guarda la dirección base de un arreglo
class BaseAddress(object):
def __init__(
self, name=None, symbol=None, parent=None, type=None, scope=None, off... |
from rest_framework import serializers
from resume.apps.resumes.models import Resume
class ResumeSerializer(serializers.ModelSerializer):
author = serializers.SlugRelatedField(read_only=True, slug_field='username')
class Meta:
model = Resume
fields = ('id', 'title', 'content', 'created_at', ... |
#Git Verkefni Dags. 24.1.2017
#Hrannar Helgi Auðunsson
#Dæmi 1
print("Dæmi 1")
tala1 = int(input("Sláðu inn eina tölu "))
tala2 = int(input("Sláðu inn aðra tölu "))
margf = tala1*tala2
lagdar = tala1+tala2
print("Tölurnar lagðar saman:",lagdar)
print("Tölurnar margfaldaðar saman:",margf)
#Dæmi 2
print("Dæmi 2")
for... |
# _*_ coding:utf-8 _*_
'''
Created on 2016年11月4日
@author: loryu
'''
import logging,os,sys
import ConfigParser
LOG=logging.getLogger("loryu")
LOG.setLevel(logging.DEBUG)
fmtr=logging.Formatter('%(name)-8s %(asctime)s [%(levelname)-5s] line:%(lineno)d %(message)s','%a,%d %b %Y %H:%M:%S',)
file_handler=log... |
#!/usr/bin/env /data/mta/Script/Python3.6/envs/ska3/bin/python
#################################################################################################
# #
# plot_grating_angles.py: update grating angle plots ... |
import numpy as np
import numpy.ma as ma
import cv2
import scipy.io
import os
import matplotlib.pyplot as plt
import matplotlib
import torch
from cnn.inception_resnet_v1 import InceptionResNetV1
from cnn.inception_resnet_v2 import InceptionResNetV2
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu... |
import os.path
import pandas as pd
import numpy as np
import pickle
import multiprocessing
import time
import random as rand
from scipy.optimize import minimize as minimize
from decision_theory_functionals import *
from experiment_setup import *
from learn_topk_models import *
negInf = float("-inf")
DEBUG=True
"""
... |
import ConfigParser
import datetime
import time
import os
from flask import json
import requests
config = ConfigParser.ConfigParser()
config.read(os.path.dirname(os.path.realpath(__file__)) + '/server.cfg')
cps_address = config.get('CPS', 'address')
def test_report_incident():
start_time = datetime.datetime.no... |
from behave_webdriver import Chrome
def before_all(context):
context.behave_driver = Chrome()
def after_all(context):
context.behave_driver.quit()
|
# -*- coding: utf-8 -*-
# @Time : 2018/10/8 15:38
# @Author : SWHL
# @Email : 1226778264@qq.com
# @File : spider_wuruo_novel.py
# @Software: PyCharm
import os
import time
import urllib.request
from bs4 import BeautifulSoup
import re
from tqdm import tqdm
def get_html_text(url):
# try:
# res = request... |
from plotly.offline import plot
import plotly.graph_objs as go
from compute import grid_deterministic
def main():
plot_grid_deterministic()
def plot_grid_deterministic():
Nbits, Niter = 8, 256
#Nbits, Niter = 16, 65536
grid, x, y = grid_deterministic(Nbits, debug=True)
for r in grid:
m... |
#! /usr/bin/python
import sys
name = "B-large-practice"
path = ""
f = open(name + ".in", 'r')
o = open(name + ".out", 'w')
T = int(f.readline().strip())
sys.setrecursionlimit(1500)
print T
for t in xrange(T):
size = int(f.readline())
all = []
for i in range((size*2)-1):
all += map(int, f.readl... |
"""empty message
Revision ID: e7f075d75904
Revises:
Create Date: 2017-02-18 13:34:22.021966
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'e7f075d75904'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... |
# -*- coding: utf-8 -*-
"""Tests for Windows (Enhanced) Metafile Format (WMF and EMF) files."""
import unittest
from dtformats import wemf
from tests import test_lib
class EMFFileTest(test_lib.BaseTestCase):
"""Enhanced Metafile Format (EMF) file tests."""
# pylint: disable=protected-access
def testDebugPr... |
# Copyright (c) 2018, NVIDIA CORPORATION.
from .dataframe import DataFrame
from .index import Index
from .series import Series
from .multi import concat
from .io import read_csv
from .settings import set_options
# Versioneer
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
|
def naive_topsort(g, s=None):
if s is None:
s = set(range(len(g)))
if len(s) == 1:
return list(s)
v = s.pop()
seq = naive_topsort(g, s)
min_i = 0
for i, u in enumerate(seq):
if v in g[u]:
min_i += 1
seq.insert(min_i, v)
return seq
def main():
a, ... |
import pyodbc
con = pyodbc.connect('Driver={SQL server};Server=DESKTOP-T66VEKU\SREENATHSQL;Database=master;')
cursor = con.cursor()
cursor.execute("insert into employee values(1,'sreenath'),(2,'praveen'),(3,'venkat')")
cursor.close()
con.close()
|
import datetime
import sys
from _sha256 import sha256
import requests
BASE_URL = "https://cdn-api.co-vin.in/api/v2/"
BASE_HEADER = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
'origin': 'https://selfregistration.cow... |
#!/usr/bin/python
if x=30
print "x is equal to 30"
else
print "x is not equal to 30"
|
def fac(n):
if (n==1): return n
else: return n*fac(n-1)
|
#BARISO SORA
#I need your comment and feedback before I submit it.
#Find Maximum value in the sequences of list L
def maximum(L):
if len(L)==1:
return L[0]
else:
return max(L[0],maximum(L[1:]))
L=[2,4,100,6,23,46,86,0] #This is assumed sample list of sequence(this program work f... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 10 11:19:29 2019
@author: Vall
"""
import iv_analysis_module as iva
import matplotlib.pyplot as plt
import iv_save_module as ivs
import iv_utilities_module as ivu
import numpy as np
import os
import random as ran
#%%
# Parameters
home = r'C:\Users\Vall\OneDrive\Labo 6 ... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import time
import numpy as np
import OpenGL.GL as gl
import OpenGL.GLU as glu
#local imports
from common import DEBUG, COLORS, cart2pol, pol2cart
from sprites import Sprite
################################################################################... |
# -*- coding: utf-8 -*-
"""
query :
{
id:,
action:"",
session:,
request:{
param1:'',
param2:''
}
}
response :
{
id: "id de la petición",
ok: "caso exito",
error: "error del servidor",
response:{
[] | params
}
}
"""
class ActionExample:
config = inject.attr(Config)
prof... |
import csv
from numpy import genfromtxt
tan="/Users/mengqizhou/Desktop/datamining/assignment5/algorithm2/test_article_numbers.csv"#test article number
test=genfromtxt(tan,dtype=int,delimiter=',')
tran="/Users/mengqizhou/Desktop/datamining/assignment5/algorithm2/training_article_numbers.csv"#training article number
trai... |
from BusinessCardParser import BusinessCardParser
import tkinter as tk
# Updates the output text box with the information of the contact
def updateOutput(thisContact):
outputText.delete("1.0", "end")
outputText.insert("1.0", "Name: " + thisContact.getName() + "\nPhone: " + thisContact.getPhoneNumber() + "\nEm... |
#!/usr/bin/env python
#coding=utf-8
import zerorpc
import re
import urllib2
import crawler
import json
import pymongo
class CrawlerRPC(object):
def __init__(self):
self.pattern = re.compile(r"<br title='(.*?)'>");
self.conn = pymongo.Connection("localhost",27017)
self.db = self.conn.falcon... |
from .get_files import Get_External_Data_Files
from .applicable_federal_rates import Applicable_Federal_Rates
from .spread_factor import Spread_Factor
from .treasury_rate import Treasury_Rate |
# coding: utf-8
import fractions
import copy
solids = ("flour", "sugar", "salt", "shortening")
liquids = ("water", "spice")
large_items = ("apples", "eggs")
class IngredientBase:
" Base class for common functionality "
target = ()
def __init__(self, ingredient_str):
self.original_in... |
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from grade_functions import *
def main():
# load data
grade = pd.read_csv("DOHMH_New_York_City_Restaurant_Inspection_Results.csv")
# remove NAs in GRADE
grade = grade.dropna(subset=['GRADE'])
# remove invalid grade
grade = g... |
def area_quadrado(lado):
return lado ** 2
def area_retangulo(base, altura):
return base * altura
def perimetro_retangulo(base, altura):
return 2*base + 2*altura |
#!/usr/bin/env python3
import os
import http.server
import socketserver
from http import HTTPStatus
version = os.getenv('version')
class Handler(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
self.send_response(HTTPStatus.OK)
self.end_headers()
resp = 'Hello my world!!! (new ver... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-11 19:56
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... |
import simplejson as json
import requests
class SlaveAllocAPI(object):
def __init__(self, api="http://slavealloc.build.mozilla.org/api"):
self.api = api
def get_slave(self, slavename):
r = requests.get(self.api + "/slaves/%s?byname=1" % slavename)
return json.loads(r.content)
def ... |
# File: palindrome.py
# Author: Joel Okpara
# Date: 2/29/2016
# Section: 04
# E-mail: joelo1@umbc.edu
# Description: Determines whether or not the word that the user provides
# is a palindrome
def main():
pali = input("Please enter a word: ")
newString = ""
for c in range((len(pali)-1),-1,... |
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import collections
import numpy as np
from torch.autograd import Variable
## Netowrk Types ##
def generateSquareWeightMask(imageSize, boundarySize):
##################################################################
# Fun... |
# %load_ext autoreload
import time
import matplotlib.pyplot as plt
import numpy as np
from keras import models
from DeepVelocity import DeepVelocityV2
from ClassyVCoder_1 import ClassyVCoder
from util.DataBag import DataBag
from keras.utils.np_utils import to_categorical
from util.FrameGrabber import FrameGrabber
i... |
def mais_arestas(lista):
pos_maior = 0
maior = 0
#print(lista)
for i in range(len(lista)):
#print("len(lista) = " + str(len(lista[i])))
#print("maior = " + str(maior))
if int(len(lista[i])) > maior:
pos_maior = i
maior = len(lista[i])
return pos_mai... |
def countries():
file=open('countries.txt','r', encoding="utf-8").read().split('\n')
country={}
for i in range(1,len(file)):
if len(file[i])>0:
row=file[i].split('\t')
if len(row[1])>0:
if row[1]!='-':
country[row[1]]=row[3].lower()
re... |
#
#
# Author: Li Zhang <lz@robots.ox.ac.uk>
# Date : 30 Sep. 2018
#
import torch.nn as nn
class AlexNet(nn.Module):
def __init__(self, c_mul=1):
super(AlexNet, self).__init__()
self.features = nn.Sequential(
nn.Conv2d(3, 96*c_mul, kernel_size=11, stride=2),
nn.BatchNorm2d... |
from xml.dom.minidom import Document
import os
import cv2
Customer_DATA = {
"NUM": 7, # dataset number
"CLASSES": [
"number",
"left_matrix",
"right_matrix",
"add",
"minus",
"multi",
"T",
], # dataset class
}
label_class = {}
for idx, s in enumerate... |
import socket, threading
import socketserver
import signal
import sys
import logging
import session
import telnet
import assets
class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
pass
class TelnetHandler(telnet.NVTBaseClass):
"""
Class to handle Telnet commands and emulate ... |
import pytest
import pathlib
def versiontuple(v):
"""Get the version as a tuple.
Taken from https://stackoverflow.com/a/11887825/5934316
"""
return tuple(map(int, (v.split("."))))
if versiontuple(pytest.__version__) < (3, 9, 0):
# the tmp_path fixture does not exist, but it is widely used,
#... |
from django.contrib import admin
from .models import data_locality
# Register your models here.
admin.site.register(data_locality) |
#Python program to display the palindrone numbers in the given range.
#Solution:
low = int(input("Enter the lower range number:"))
high = int(input("Enter the upper range number:"))
def print_palindrone(low,high):
container = []
for number in range(low,high):
temp = number
reverse ... |
def remove_duplicate_words(s):
output = ""
for x in s.split():
if x not in output:
output+= "{} ".format(x)
return output[:-1]
'''
Your task is to remove all duplicate words from string, leaving only single
(first) words entries.
Example:
Input:
'alpha beta beta gamma gamma gamma d... |
import unittest
from guessadapt.core import count_adapters
from guessadapt.core import parse_fastq
class TestFastqParser(unittest.TestCase):
def setUp(self):
self.stream = iter(['@SequenceA', 'ACGT', '+', 'IIII',
'@SequenceB', 'TCGA', '+', 'IIII'])
def test_parser(self):... |
#Sving image we edited
import cv2
input = cv2.imread("./Desktop/OpenCV/Basics/hand.jpg")
cv2.imwrite("Output.jpg",input)
cv2.imwrite("Output.png",input)
|
#!/usr/bin/env python3
import requests
from bs4 import BeautifulSoup
import json
import datetime
import time
import sys
import os
def ParseAd(html): # Parses ad html trees and sorts relevant data into a dictionary
ad_info = {}
#description = html.find('div', {"class": "description"}).text.strip()
... |
from statistics import mean
from _collections import defaultdict
plants_rarity = {}
plants_rating = defaultdict(list)
plants_average_rating = defaultdict(int)
n = int(input())
for _ in range(n):
information = input().split("<->")
plant = information[0]
rarity = int(information[1])
if plant not in pla... |
#!/usr/bin/env python
"""
pyjld Phidgets Erlang Manager
@author: Jean-Lou Dupont
"""
__author__ = "Jean-Lou Dupont"
__email = "python (at) jldupont.com"
__fileid = "$Id: phidgets_erl_manager.py 70 2009-04-20 13:46:19Z jeanlou.dupont $"
from pyjld.phidgets.erl_manager.main import main
main()
|
import sys
sys.path.append("/usr/local/share/vsscripts")
import vapoursynth as vs
import math
core = vs.get_core(threads=20)
import mvsfunc as mvf
import havsfunc as haf
import CSMOD as cs
ret = core.lsmas.LWLibavSource(source="/opt/How.to.Train.Your.Dragon.The.Hidden.World.2019.1080p.BluRay.x264.TrueHD.7.... |
# Dynamic programming Python implementation of LIS problem
# lis returns length of the longest increasing subsequence
# in arr of size n
def lis(arr):
n = len(arr)
# Declare the list (array) for LIS and initialize LIS
# values for all indexes
lis = [1]*n
prev = [0]*n
for i in range(... |
# -*- coding: utf-8 -*-
# @Author: Safer
# @Date: 2016-08-18 02:15:44
# @Last Modified by: Safer
# @Last Modified time: 2016-08-18 02:20:09
|
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import pytest
@pytest.mark.parametrize(
"variables, expected_data",
[
(
{"name": r"pants_explorer\."},
{
... |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 9 22:09:48 2019
@author: HP
"""
import cv2
import numpy as np
img = cv2.imread(r'C:\Users\HP\Downloads\abc.jpg')
rows, cols, ch = img.shape
gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray, (5, 5), 0)
corners=cv2.goodFeaturesToTrack(gray,5,0.1... |
"""
A freely-propagating, premixed hydrogen flat flame with multicomponent
transport properties.
O2:N2--1:4 to 1:2
"""
# presurre from 1 to 50 25 times
# alist 1 to 10 10 times
# temperature 300 to 700 every 50 9 times
import sys
import numpy as np
import matplotlib.pyplot as plt
imp... |
from __future__ import division
import os
import time
import datetime
from glob import glob
from six.moves import xrange
import fnmatch
import tensorflow as tf
import numpy as np
from ops import *
from utils import *
from tqdm import trange
from logging import getLogger
logger = getLogger(__name__)
from optim_mana... |
import os
import binascii
def generate_random_string(length):
random_bits = os.urandom(length)
random_string = binascii.hexlify(random_bits)
return random_string.decode('utf-8')
|
from Tested_Method.MethodToTest import working_function_3
from unittest.mock import patch
import pytest
TESTED_MODULE = 'Tested_Method.MethodToTest'
# mocking just the public function
@patch(f'{TESTED_MODULE}.get_element_1', return_value = -10)
@patch(f'{TESTED_MODULE}.get_element_2',return_value= 5)
@patch(f'{TESTED_... |
# Enter your code here. Read input from STDIN. Print output to STDOUT
# n1 = int(input())
# print(n1)
n1 = 3
from sys import stdin
phoneBook = {}
for nums in range(n1):
data = input()
name, number = data.split()
# print(data, name, number)
phoneBook[name] = number
# print(phoneBook)
# print(phoneB... |
import socket
srvsock = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
srvsock.bind( ('', 8000) )
srvsock.listen( 5 )
while 1:
clisock, (remhost, remport) = srvsock.accept()
str = clisock.recv(100)
clisock.send( str )
clisock.close()
|
import os
import sys
import pandas as pd
import numpy as np
import scipy.stats as stats
import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt
matplotlib.rcParams['pdf.fonttype'] = 42
import statsmodels.stats.multitest as multitest
import xenaPython as xena
##########################################... |
# -*- coding: utf-8 -*-
__license__ = """
This file is part of **janitoo** project https://github.com/bibi21000/janitoo.
License : GPL(v3)
**janitoo** is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either vers... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name='home'),
path('on', views.on, name='on'),
path('off', views.off, name='off'),
path('camera', views.off, name='camera'),
]
|
def printBoard(board):
print(board['top-L'] + '|' + board['top-M'] + '|' + board['top-R'])
print('-+-+-')
print(board['mid-L'] + '|' + board['mid-M'] + '|' + board['mid-R'])
print('-+-+-')
print(board['low-L'] + '|' + board['low-M'] + '|' + board['low-R'])
# TO DO #######################... |
import numpy as np
import argparse
import cv2
ap = argparse.ArgumentParser()
ap.add_argument('-avi','--image', help = 'this is help')
args= vars(ap.parse_args())
image = cv2.imread(args['image'])
image = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
#cv2.imshow('image',image)
lap = cv2.Laplacian(image, cv2.CV_64F)
lap = ... |
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 22 22:40:36 2021
@author: mtran
"""
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 17 18:26:37 2021
@author: mtran
"""
import itertools
import operator
import os, glob
import numpy as np
import cv2
class Patient(object):
# Host all Images that belongs to a single p... |
from flask import Flask, render_template, request, send_file
import json
from flask_bootstrap import Bootstrap
from etl import ImageParser
from model import return_top_5
from torchvision import transforms
import io
import base64
def create_app():
app = Flask(__name__)
Bootstrap(app)
return app
app = cre... |
class InvitationRequired(Exception):
"""User must be in invitation list to register"""
def __init__(self,m):
self.message = m
def __str__(self):
return self.message |
# the file used to define a collection
COLLECTION_FILE = "collection.yaml"
# the file used to define a publication and its artifacts
PUBLICATION_FILE = "publication.yaml"
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.