text
stringlengths
8
6.05M
""" onsider the following algorithm to generate a sequence of numbers. Start with an integer n. If n is even, divide by 2. If n is odd, multiply by 3 and add 1. Repeat this process with the new value of n, terminating when n = 1. """ def three_plus_one(n): result = [] result.append(n) while n != 1: ...
""" Authorize the SMART API. """ import itertools import logging import time from urllib import parse import uuid from selenium import webdriver from selenium.common.exceptions import ( NoAlertPresentException, NoSuchElementException, StaleElementReferenceException, TimeoutException, UnexpectedAler...
import sys from bs4 import BeautifulSoup import re soup = BeautifulSoup(open(sys.argv[1]), 'html.parser') #doc=soup.find('div', {'class':'contentus'}) #text=doc.get_text() text=soup.get_text() text = re.sub('[0-9]+', '\1 ',text) for c in '[|]': text=text.replace(c,'') text=text.replace('{b}','ƀ').replace('{d}'...
from collections import Counter file = "./2020/Day10/mattinput.txt" def jolt_adapter(int_list): difference_list = [] for i in range(len(int_list)): if i - 1 < 0: difference_list.append(int_list[i]) else: difference_list.append(int_list[i] - int_list[i - 1]) differen...
km = int(input('Quantos km até o destino da sua viagem? ')) if km <= 200: p = 0.50*km print('A sua passagem vai custar R${}'.format(p)) else: p2 = 0.45*km print('A sua passagem vai custar R${}'.format(p2))
""" Let's call an array A a mountain if the following properties hold: A.length >= 3 There exists some 0 < i < A.length - 1 such that A[0] < A[1] < ... A[i-1] < A[i] > A[i+1] > ... > A[A.length - 1] Given an array that is definitely a mountain, return any i such that A[0] < A[1] < ... A[i-1] < A[i] > A[i+1] > ... > A[...
/Users/daniel/anaconda/lib/python3.6/tokenize.py
#!/usr/bin/python3 def uppercase(str): for letters in str: if ord('a') <= ord(letters) and ord(letters) <= ord('z'): letters = chr(ord(letters) - 32) print("{}".format(letters), end="") print()
from .models import * from rest_framework import serializers class UserSerializer(serializers.HyperlinkedModelSerializer): class Meta: model=User fields=('name','phone',) class DocumentSerializer(serializers.ModelSerializer): owner=UserSerializer class Meta: model=Document ...
#!/usr/bin/python3 import brlapi from subprocess import Popen, PIPE from re import findall def batinfo(): key = 0 acpi = Popen("acpi", stdout = PIPE, stderr = PIPE, shell = True) batteryInfo = str(acpi.stdout.read()) if len(acpi.stderr.read()) > 3: batteryInfo = 'Erreur...
#!/usr/bin/env python3 icnt = 5000000 #icnt = 5 # Test count = 0 def genAgen(): genAval = 699 #genAval = 65 # Test for i in range(0, icnt): genAval = genAval * 16807 % 2147483647 while genAval % 4 != 0: genAval = genAval * 16807 % 2147483647 yield genAval def genBge...
from .a_scan import AScan as ReshapeAScan import src.basic_correct.b_scan as bbscan import src.ADC.contrast_full_range_stretch_ADC as ADC import numpy as np import PIL from PIL import ImageFilter from PIL import Image import math import pywt import os import os.path as path import pdb class BScan(bbscan.BScan): de...
import math def mergesort(a): l=len(a) al=a[:int(l/2)] ar=a[int(l/2):] if len(al)>1: al=mergesort(al) if len(ar)>1: ar=mergesort(ar) ta=list() i=0 j=0 while i<len(al) and j<len(ar): if al[i]>ar[j]: ta.append(ar[j]) j=j+1 else: ...
import unittest from katas.kyu_8.rock_paper_scissors import rps class RockPaperScissorsTestCase(unittest.TestCase): def test_equals(self): self.assertEqual(rps('rock', 'scissors'), 'Player 1 won!') def test_equals_2(self): self.assertEqual(rps('scissors', 'paper'), 'Player 1 won!') def ...
# encoding:utf-8 #!/usr/bin/python #-*-coding:utf-8-*- import MySQLdb db = MySQLdb.connect(host="localhost",user="root",passwd="4242",\ db="coolSignIn",charset="utf8",use_unicode=True) cursor = db.cursor() data = ["学生","201226630205",1] length = 20 for i in xrange(length): data[0] = data[0] + str(i) dat...
"""Syncronizes cell Zookeeper with LDAP data. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import collections import hashlib import json import io import logging import sqlite3 import tempfile from treadmill i...
import sys, os import inspect import http import re from dotenv import load_dotenv from flask import Flask, request, make_response import json from functools import reduce from App.app_cors.functions import valid_origin, preflight_request_response from App.type_info.functions import members_names, is_hashable, is_itera...
print('2 задание') str = input('Введите сторку: ') list = str.split(';') max = list[0] for i in range(len(list)): if len(list[i]) > len(max): max = list[i] print('Самое длинное слово: ', max) #python task2.py
from uff import converters, model # noqa from uff.converters.tensorflow.conversion_helpers import from_tensorflow # noqa from uff.converters.tensorflow.conversion_helpers import from_tensorflow_frozen_model # noqa ''' uff ~~~ Universal Framework Format Toolkit. Convert models from common frameworks...
# Copyright (c) 2017-2023 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from asyncio import sleep from dazl import Network, connect from dazl.testing import SandboxLauncher import pytest from .dars import UploadT...
from django import forms from django.contrib.auth import password_validation from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm, PasswordResetForm, SetPasswordForm from django.core.exceptions import ValidationError from django.core.validators import MinLengthValidator from django.forms import ...
import requests from bs4 import BeautifulSoup as bs from datetime import datetime import re class RssFeeder(object): def __init__(self, _url, _collection, _category): self.url = _url self.collection = _collection self.data = {} self.category ...
from django.db import models import datetime from django.contrib.auth.models import User from django.utils import timezone from functools import reduce # Create your models here. class Topic(models.Model): name = models.CharField(max_length=200) category = models.CharField(max_length=200, blank=False, default...
# -*- coding: utf-8 -*- # # This file is part of Flask-AppExts # Copyright (C) 2015 CERN. # # Flask-AppExts is free software; you can redistribute it and/or # modify it under the terms of the Revised BSD License; see LICENSE # file for more details. """Admin extension.""" from __future__ import absolute_import, unico...
from restaurant import Restaurant from User import * from Admin import * res=Restaurant("xiaocao","drinking") res.open_restaurant() admin=Admin("BB","Z") admin.show_privileges()
def oddTuples(aTup): ''' aTup: a tuple returns: tuple, every other element of aTup. ''' newTup = () odd = 0 while odd < len(aTup): if len(aTup) == 0: break newTup = newTup + (aTup[odd],) odd += 2 return newTup
### ### Copyright (C) 2018-2019 Intel Corporation ### ### SPDX-License-Identifier: BSD-3-Clause ### from ....lib import * from ..util import * spec = load_test_spec("vpp", "deinterlace") @slash.requires(have_gst) @slash.requires(*have_gst_element("vaapi")) @slash.requires(*have_gst_element("vaapipostproc")) @slash.r...
from django.shortcuts import render from rest_framework.views import APIView from rest_framework.response import Response from .serializers import UserSerializer, UserLogSerializer from .models import UsersMan from rest_framework import status from django.db.models import F #For posting the information about users and...
from import_export import resources from import_export.fields import Field from .models import Finding class FindingResource(resources.ModelResource): severity = Field(attribute='severity__severity', column_name='severity') finding_type = Field(attribute='finding_type__finding_type', column_name='finding_type...
import speech_recognition as sr r = sr.Recognizer() mic = sr.Microphone(device_index=1) with mic as source: r.adjust_for_ambient_noise(source, duration=1) print("What is your name: ") audio = r.listen(source, timeout=7) print("Wait till your voice is recognised......\n") try: print("You are entering ...
from aiogram import types import logging from aiogram.dispatcher.filters import Command from aiogram.types import CallbackQuery from keyboards.inline.callback_datas import buy_callback from keyboards.inline.choice_buttons import choice, pear_keyboard_terrain, pear_keyboard_route from loader import dp @dp.message_ha...
class Transform: def __init__(self, coords=(0, 0), parent=None): self.local_x, self.local_y = coords self.parent = parent self.children = [] def get_global_coords(self): if not self.parent: return int(self.local_x), int(self.local_y) parent_global_coords = se...
from django.conf.urls import include, url from django.contrib import admin from . import views app_name = 'main' urlpatterns = [ url(r'^list/$', views.list, name='list'), url(r'^$', views.index, name='index'), url(r'^(?P<slug>[-\w]+)/$' ,views.detail, name='detail'), ]
import torch from utils import one_hot class ExponentialFamilyArray(torch.nn.Module): """ ExponentialFamilyArray computes log-densities of exponential families in parallel. ExponentialFamilyArray is abstract and needs to be derived, in order to implement a concrete exponential family. The main use of...
from django.db import models class Department(models.Model): name = models.CharField(max_length=10, verbose_name='部门名称') brief_introduction = models.CharField(max_length=500, verbose_name='部门简介', null=True, blank=True) is_delete = models.BooleanField(verbose_name='是否删除') def __str__(self): ret...
import random from secret_words import word_list import json import score_board def get_secret_word(): word = random.choice(word_list) return word.lower() def play_hanman(word): allowed_errors = 5 guesses = [] done = False player_name = input("Please enter your name: ") p...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Dec 4 14:49:27 2020 @author: nerohmot """ import struct from .common import command_ABC class GET_BOOT_SEQUENCE(command_ABC): ''' Description: With this we can get the current boot sequence and timing. Input: None Outp...
import socket import sys import struct import fcntl import array import threading import time import json import multiprocessing import datetime import serial import servo.servo as servo import peltier.peltier as peltier CLIENT_ADDR = ('10.22.214.188', 8000) accel_gyro = ["", ""] servo_data = ["","",""] sock = 'nil' ...
"""A Community is a thin wrapper around a long-form time-series geodataframe.""" import tempfile from pathlib import PurePath from warnings import warn import contextily as ctx import geopandas as gpd import mapclassify.classifiers as classifiers import matplotlib.pyplot as plt import pandas as pd import numpy as np i...
def binary_to_string(binary): return ''.join(chr(int(binary[a:a + 8], 2)) for a in xrange(0, len(binary), 8))
xiaoming = {"name": "xiaoming", "height": 1.75, "age": 18, "weight": 60, "gender": True} print(xiaoming)
from numpy import * filename = 'euler11.txt' with open(filename, "r") as ins: array = [] for line in ins: array.append(line) print(array) newArray = [] for i in array: j = i.split(' ') k = [int(n) for n in j] newArray.append(k) print(newArray) problemMatrix = matrix(newArray) print(proble...
#! /usr/bin/env python # -*- coding: utf-8 -*- """ This module consists of the key-value store abstract class and an implementation for memcached using python memcached """ import memcache class KVStoreClient(object): """Abstract KV client class for interacting with a single-node KV store Initialiation wil...
from django.db import models # Create your models here. class Maker(models.Model): name_maker = models.CharField(max_length=20) date_of_birth = models.DateField() salary = models.IntegerField() telephone = models.IntegerField() pos = (('T', 'tailor'), ('E', 'engineer'), ('C', 'cutter')) posit...
def hundred(): name = str(input("What's your name my dude? : ")) age = int(input("How old are you? : ")) year = int(input("I lose track of time, what year is it? : ")) dif = 100-age answer = str(year + dif) print(name + ", you'll turn 100 in " + answer +". Congratulations...
# -*- coding: utf-8 -*- # @Time : 2018/11/18 14:54 # @Author : Monica # @Email : 498194410@qq.com # @File : my_log.py import logging from Common import project_path class MyLog: def my_log(self, level, msg): # 定义一个日志收集器my_logger my_logger = logging.getLogger("Monica") # 设定级别 my...
import pandas as pd import numpy as np import math import sys import argparse import json from urllib import request from bs4 import BeautifulSoup import hashlib import os import requests import csv genji_dir = "/Users/nakamurasatoru/git/d_genji" prefix = "https://utda.github.io/genji" manifests = [] id = "utokyo"...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/9/30 16:12 # @Author : Jason # @Site : # @File : test2.py # @Software: PyCharm from multiprocessing import Pool from multiprocessing import Process def f2(nane): print("hello",nane) def f(x): return x*x if __name__ == '__main__': ...
from .client import Client class Stats(Client): def __init__(self, api_key='KMK786MB5AZYQSFS5CW3JQ9AAW4DCX3AX4'): Client.__init__(self, address='', api_key=api_key) self.module = self.URL_BASES['module'] + 'stats' def make_url(self, call_type=''): if call_type == 'stats': ...
import numpy as np import param from boundingregion import BoundingBox, BoundingRegion from dataviews import Stack, Histogram, DataStack, find_minmax from ndmapping import NdMapping, Dimension from options import options from sheetcoords import SheetCoordinateSystem, Slice from views import View, Overlay, Annotation,...
from django.db import models from django.contrib.auth.models import AbstractUser import datetime # Create your models here. class Teacher(AbstractUser): surname = models.CharField(verbose_name='Фамилия', max_length=20) name = models.CharField(verbose_name='Имя', max_length=20) second_name = models.CharFie...
from django.shortcuts import render, HttpResponse, redirect from django.contrib import messages from .models import User def index(request): if 'user' in request.session: return redirect('/success') else: return render (request, 'logApp/index.html') def new(request): if request.method == "POST": errors = Us...
#!/usr/bin/env python3 from typing import List, Tuple import os import nltk from contextlib import redirect_stdout # Do not print log messages: with redirect_stdout(open(os.devnull, "w")): nltk.download('punkt') nltk.download('wordnet') nltk.download('averaged_perceptron_tagger') def cached(method): ...
import requests import json # resp = requests.get("https://status.github.com/api/status.json") # txt = resp.text # obj = json.loads(txt) # # print(obj) # print(type(obj)) # print(obj) ######################################################################## # class User(object): # def __init__(self, name, username,...
#Created on July 7, 2014, adjusted Dec 11, 2015 by chahn #@author: rspies # Python 2.7 # This script plots a raster image of an input stream dischare txt file import os import matplotlib.pyplot as plt #Turn interactive plot mode off (don't show figures) plt.ioff() import matplotlib.ticker as ticker from mat...
from bs4 import BeautifulSoup import requests import unicodedata r = requests.get("https://docs.python.org/2/library/functions.html") data = r.text soup = BeautifulSoup(data) names = [] descs = [] for name in soup.findAll("tt", {"class" : "descname"}): names.append(str(''.join(name.findAll(text=True)))) descs = soup...
#All code is owned by https://github.com/QuantzLab/ with an Apache 2.0 liscence n = int(input("Till how much do you want prime numbers?")) def isPrime(n): # Corner case if n <= 1 : return False # check from 2 to n-1 for i in range(2, n): if n % i == 0: retur...
"""将 xml 文件按照类别生成多个标注文件,每个文件都是 txt 文件,包含该类别的框信息 @Author: patrickcty (Tianyang Cheng) @Filename: separate_classes_from_xml.py """ import os import xml.etree.ElementTree as ET from collections import defaultdict from .make_dir_if_not_exist import make_dir_if_not_exists def generate_txt(xml_dir, target_dir, image_path...
""" This is a Python 3 script to convert the microscope XML documentation into markdown """ import xml.etree.ElementTree as ET import sys import os import shutil import re import time def namify(title): """Replace spaces with underscores etc. to generate sensible filenames from titles""" name = title.replace(...
#!/usr/bin/env python2 # coding=utf-8 __author__ = 'Hanzhiyun' # returns the factorial of the argument "number" def factorial(number): if number <= 1: # base case return 1 else: return number * factorial(number - 1) # def factorial(number): # product = 1 # for i in range(number): #...
from netCDF4 import Dataset import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap import numpy as np # 读取nc文件 dataset = Dataset('E:\PycharmProjects\yiyue\MERRA2_400.tavgM_2d_chm_Nx.202101.nc4', mode='r', format='NETCDF4') # # 查看信息 # print(dataset) # 查看变量 print('变量:',datas...
first = [1, 2, 3, 4, 5] second = first second.append(6) print(first) print(second)
single = [] pipeline = [] with open("out_single","r") as f: for l in f: single.append(l.strip()) with open("out","r") as f: for l in f: if len(pipeline) == len(single): break pipeline.append(l.strip()) for i,x in enumerate(single): if x != pipeline[i]: print("single: "+x) print("pipeline: "+pipeline[...
{ 'variables': { 'foo': '"fromhome"', }, }
from setuptools import setup, find_namespace_packages from typing import List from pathlib import Path import re setup_requires = [ 'setuptools>=54.2.0', ] install_requires = [ 'aiohttp~=3.8.0', 'aiotusclient~=0.1.4', 'appdirs~=1.4.4', 'async_timeout>=4.0', 'attrs>=20.3', 'click>=8.0.1', ...
import random import sys # v, w, k, n, a - 0-9 - (1,2)x(1,2,3) def gen_callsign(call_seed): random.seed(call_seed) #n_letter = call_seed % 5 #call_seed = int(call_seed / 5) #n_chars1 = (call_seed % 2) #call_seed = int(call_seed / 2) #n_chars2 = 1 + (call_seed % 3) #call_seed = int(call_seed...
class Queue: def __init__(self, size): self.front = 0 self.rear = 0 self.items = [] self.size = size def add(self, item): if self.is_full(): raise Exception("Queue is full") self.items.insert(self.rear, item) self.rear += 1 def remove(se...
# 运算符 # 算术运算符, +, -, *, /, //, %, **, 注意//为整除 # 赋值运算符, =, +=, -=, *=, /=, //= ,%=, **= # 比较运算符, ==, !=, <>, >, >=, <, <= # 逻辑运算符, and, or, not # 成员运算符, in, not in # 身份运算符, is, not is # 位运算符, &, |, >>, <<, ^, ~ # 优先级 算术>比较>逻辑>赋值 a = 3 b = 5 print(b // a) # 1 a *= 3 # 9 print(a > b) # True,9>5 print(3>4 an...
import os class Config(): REGISTERED_USERS = { #variable names in all caps indicate that that variable will be a constant 'kevinb@codingtemple.com': {'name':'Kevin', 'password': 'abc123'}, 'johnl@codingtemple.com': {'name':'John', 'password': 'Colt45'}, 'joel@codingtemple.com': {'nam...
import random import copy from game import Game tree = { 0: {}, 1: {} } # Search the tree and back trace victory class TreeBot: @classmethod def computeTree(Class, player=None): board = [ None, None, None, None, None, None, None, None, None] Class.sc...
import socket import struct import time import os import threading def read_msg(buff): sid = buff[-2:] #get id msg = buff[:-2] #get msg return int.from_bytes(sid, 'little'), str(msg, 'utf-8') def udp_m_receive_fun(socket): try: while True: buff, _addr = socket.recvfrom(buf...
# -*- coding: utf-8 -*- from __future__ import print_function import os,time from collections import OrderedDict import pygame, pygame.image import OpenGL.GL as gl import OpenGL.GLU as glu import numpy as np import itertools import fractions import copy import sys import shelve import scipy.interpolate import resourc...
# -*- encoding : utf-8 -*- from enum import Enum, unique @unique class Release_version(Enum): B010 = '1335' B020 = '1340' B030 = '1352' B050 = '1353' B060 = '1354' B070 = '1364' B080 = '1365' B090 = '1366' @unique class Severity(Enum): Critical = 1 Major = 2 Minor = 3 ...
from django.shortcuts import render, get_object_or_404 from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView from .models import Post, Categories from .forms import PostForm, EditForm from django.urls import reverse_lazy, reverse from django.http import HttpResponseRedirect # Create...
import threading import os os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide" import pygame as pg WHITE = (255, 255, 255) BLACK = (0, 0, 0) FPS = 30 graphs = [] i = 0 screen_size = (640, 640) graph_dimensions = (1, 1) clock = pg.time.Clock() def scale_position(pos): x, y = pos dim_x, dim_y = graph_dimensions...
#!python3 from numpy import random from time import perf_counter def insert_sort(a): "a is a list like iterable. returns sorted version of a." for i in range(len(a)-1): for j in range(i+1): if a[i+1-j] < a[i-j]: a[i-j], a[i-j+1] = a[i-j+1], a[i-j] def main(): a = rando...
import os import shutil as s def copy(path_in,path_out): s.move(path_in, path_out) def all_picture(path1,path2): a = set(os.listdir(path1)).difference(os.listdir(path2)) return list(a) if __name__ == '__main__': path_out = r'D:\Git_project\VKR\FALSE_DETEC_CARS' path_in = r'D:\Git_project\VKR\OUPUT_A...
import math import os, glob import sys import string from porter2stemmer import Porter2Stemmer bow_doc_col = {} DF = {} TFIDF = {} class BowDocument: def __init__(self, doc_ID, dict_): self.documentID = doc_ID self.dict = dict_ self.wordCount = 0 self.tfDict = {} self.idfD...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'log_reg_windows.ui' # # Created by: PyQt5 UI code generator 5.15.4 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. from PyQt5 import QtCo...
import requests from tools import imgAutoCick,location import pyautogui import time import pyperclip import keyboard def moveClick(x=None,y=None,duration=None,tween=pyautogui.linear): pyautogui.moveTo(x=x, y=y, duration=duration, tween=tween) pyautogui.click() def trans_money(account,money): # 点击头像 m...
# -*- coding: utf-8 -*- import scrapy import time import os class mzSpider(scrapy.Spider): name = "Mzitu_Spider" start_urls = [ "http://mzitu.com/all" ] def parse(self, response): for ctgry_link in response.css('div.all a::attr(href)'): time.sleep(0.5) ...
c = input("Enter the temprature in celcious") c = int(c) f = (9/5)*c + 32 print(f)
old = int(input('만 나이를 입력하세요:')) sex = str(input('성별을 입력하세요:')) if old >= 19: print('성인 %s입니다'%sex) else: print('미성년자 %s입니다'%sex)
import math def prime(n): for i in range(2,int(math.sqrt(n))): if n%i==0: return False return True if __name__=='__main__': for i in range(100,1000+1): if prime(i): print i
#!/usr/bin/env python3 ################################################## # Anton Rubisov 20150119 # # University of Toronto Sports Analytics Group # # # # Search through the Mongo database and return # # stats on the collection, query a partic...
from bootstrap3_datetime.widgets import DateTimePicker from django import forms from django.forms import ModelForm from models import * class ParteForm(ModelForm): class Meta: model = Parte widgets = { 'fecha' : DateTimePicker(options={"format": "YYYY-MM-DD", "pickTime": False}) ...
# -*- coding: utf-8 -*- # import pygmsh import examples import os import tempfile from importlib import import_module import subprocess def test_generator(): for name in examples.__all__: test = import_module('examples.' + name) yield check_output, test def check_output(test): pygmsh.genera...
# -*- coding: utf-8 -*- """Tests for oauth2_provider overrides.""" from __future__ import unicode_literals from django.test import RequestFactory from oauth2_provider.exceptions import FatalClientError, OAuthToolkitError from oauth2_provider.http import HttpResponseUriRedirect from webplatformcompat.tests.base impor...
import sqlite3 import random import time def LoggingOut(): print("\nLogging out", end="") for logging_out in range(5): print(".", end="") time.sleep(1) print("\nYou logged out.") def AddingEmployee(): print("\nPlease enter employee's information\n") x = input("Ente...
# -*- coding: utf-8 -*- """ Created on Tue Nov 10 09:57:08 2020 @author: sumant """ class Memory: """ This is Memory data """ def __init__(self,internal,secondary,ram): self.internal = internal self.secondary = secondary self.ram = ram def details(self)...
# -*- coding: utf-8 -*- """ ytelapi This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). """ from .base_controller import BaseController from ..api_helper import APIHelper from ..configuration import Configuration from ..http.auth.basic_auth import BasicAuth class Acc...
import numpy as np import pandas as pd from flask import Flask,request,jsonify import pickle import requests,ssl from flask_cors import CORS app=Flask(__name__) rfregressor=pickle.load(open('model.pkl','rb')) CORS(app) visibility_item_avg = [[]] def impute_visibility_mean(cols): visibility = cols[0] ...
# Copyright 2023 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from pants.option.option_types import SkipOption from pants.option.subsystem import Subsystem class RustfmtSubsystem(Subsystem): options_scope = "rustfmt" name = "rustfmt" h...
soma = 0 velho_nome = '' velho_idade = 0 mulheres_novas = 0 for c in range(0, 4): print('----- Pessoa {} -----'.format(c+1)) nome = str(input('Nome: ')) idade = int(input('Idade: ')) sexo = str(input('Sexo [m/f]: ')) if(sexo.lower() == 'm'): if (c == 0): velho_nome = nome ...
from __future__ import unicode_literals from django.db import models class News(models.Model): title = models.CharField(max_length=500) resumen = models.CharField(max_length=5000) content = models.CharField(max_length=10000) imagen = models.FileField(upload_to='news/') created_at = models.DateTime...
#!/usr/bin/env python3 import io import csv import utils def download(): utils.download_file('https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3932451/bin/amiajnl-2013-001612-s3.csv', '../data/pmid_24158091/amiajnl-2013-001612-s3.csv') def map_to_drugbank(): result = [] total = 0 ...
import os import numpy as np from skimage import io import matplotlib.pyplot as plt from photutils import DAOStarFinder, IRAFStarFinder from astropy.stats import mad_std from photutils import aperture_photometry, CircularAperture img = io.imread("/home/mot/data/saliance/exp3/frame.png", as_grey=True) img = 1-img ...
import csv import smtplib from email.mime.text import MIMEText class Mailer(object): def send(sender, recipients, subject, message): msg = MIMEText() msg['Subject'] = subject msg['From'] = sender msg['To'] = recipients class Logger(object): def output(message): print(...
#!/usr/bin/python import numpy as np import pylab as py import scipy.interpolate as interp1d from COMMON import yr,week,nanosec def PPTA_data(): '''Outputs arrays with frequency and strain of the EPTA upper limits.''' #Input parameters: inputdir='../data/PPTA/' ifile1='LimSen4f.dat' #ZhuEtAl2014 limit. #Load EPT...
# # Copyright © 2021 Uncharted Software 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...