text
stringlengths
8
6.05M
import random lower = "abcdefghjiklmnopqrstuvwxyz" upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" numbers = "0123456789" symbols = "!”#$%&'()*+,-./:;<=>?@[]^_`{|}~" characters = lower + upper + numbers + symbols password = "".join(random.sample(characters, random.randint(8, 25))) print(password)
#! /usr/bin/env python def f(x): return x**3 - 1 def nwtn_meth(f,x_0,i): """nwtn_meth(f,x_0,i) Finds one of the roots of formula f, using newton's method starting at point x_0 and iterating over i iterations""" import num_diff grad = num_diff.num_diff(f, x_0, 0.0001) x_j = x_0 for j in range(i): x_j_new = x...
# Given a string, you need to reverse the order of characters in each # word within a sentence while still preserving whitespace # and initial word order. class Solution: def reverseWords(self, s): return " ".join([word[::-1] for word in s.split()]) if __name__ == "__main__": testinput = "L...
from squirrel.config import register_config @register_config('valid') def build_valid_config(parser): parser.add_argument( '--valid_batch_size', type=int, default=2048, help='# of tokens processed per batch') parser.add_argument( '--valid_maxlen', type=int, ...
#!/usr/bin/env /data/mta/Script/Python3.8/envs/ska3-shiny/bin/python ############################################################################# # # # mta_common_functions.py: colleciton of funtions used by mta # # ...
# -*- coding: utf8 -*- # [학번] [이름] # https://wikidocs.net/13 <- 이 웹사이트 내용을 참고하여 아래 각 행 출력 내용을 예상하시오 # 실행 결과와 예상을 비교하시오 print("1234567890" * 4) # print(math.pi) # 예상 : 3.14159265359 # 결과 : 3.14159265359 # print("%f" % math.pi) # 예상 : # 결과 : # print("%d" % math.pi) # 예상 : # 결과 : # print("%5d" % math.pi) # 예상 : # 결과 : #...
f_path=open("ticket.txt","r") lines=f_path.readlines() lines="".join(lines).split(";") newlines=[] for x in lines: newlines.append(x.replace("\n","")) print(newlines)
# KVM-based Discoverable Cloudlet (KD-Cloudlet) # Copyright (c) 2015 Carnegie Mellon University. # All Rights Reserved. # # THIS SOFTWARE IS PROVIDED "AS IS," WITH NO WARRANTIES WHATSOEVER. CARNEGIE MELLON UNIVERSITY EXPRESSLY DISCLAIMS TO THE FULLEST EXTENT PERMITTEDBY LAW ALL EXPRESS, IMPLIED, AND STATUTORY WARRANT...
import torch import cv2 from .modules.darknet import Darknet from ..utils.image_preprocess import to_tensor, prepare_raw_imgs from ..utils.utils import load_classes, get_correct_path from ..utils.bbox import non_max_suppression, rescale_boxes_with_pad, diff_cls_nms class CarLocator(): def __init__(self, cfg): ...
import numpy as np import cv2, math, sys def get_val(img, x, y): if x < 0 or x > img.shape[0]-1 or y < 0 or y > img.shape[1]-1: return 0 return img[x, y] def get_neighbors(img, origin, sizes): neighbors = np.zeros((sizes[0], sizes[1]), int) half = sizes[0] / 2 x = origin[0] y = origin[1] for row in...
# -*- coding: utf-8 -*- from time import sleep import math, random import sqlite3 from threading import Thread from Battery import Battery from drone_state import DroneState from Log import Log as l from threading import Thread, Lock from utils import * from parametersModel import oneSecond #from Simulator import main...
class Persegi: def __init__ (self, panjang, lebar) : self.panjang = panjang self.lebar = lebar self.luas = panjang * lebar def itung (self): print (f'Luas Persegi Panjang anda sebesar {self.luas}') panjang = int(input("Tentukan Panjang Dari Persegi Panjang Anda : ")) lebar = in...
from collections import namedtuple, deque import numpy as np import copy import random import torch device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") class ReplayBuffer: """Fixed-size buffer to store experience tuples.""" def __init__(self, action_size, buffer_size, batch_size, seed):...
from django.db import models from django.db.models.query import QuerySet from django.utils.translation import ugettext_lazy as _ class TeamMixin(object): pass class TeamQuerySet(QuerySet, TeamMixin): pass class TeamManager(models.Manager, TeamMixin): def get_queryset(self): return TeamQuerySe...
h,w = map(int,input().split()) field = [] xx = [-1, -1, -1, 0, 0, 1, 1, 1] yy = [-1, 0, 1, -1, 1, -1, 0, 1] for i in range(h): field.append(input()) for i in range(h): line = '' for j in range(w): if field[i][j] == '#': line += '#' else: temp = 0 for x,y ...
#!/usr/local/bin/python import os import sys import json import pickle #Sagemaker directory structure prefix = '/opt/ml/' input_path = prefix + 'input/data' output_path = os.path.join(prefix, 'output') model_path = os.path.join(prefix, 'model') param_path = os.path.join(prefix, 'input/config/hyperparameters.json') inp...
from itertools import combinations #operator.le() x = "5 1 4 2 3".split() perms = [] y = [] for i in range(2, len(x)+1): for c in combinations(x, i): perms.append("".join(c)) for i in range(0, len(perms)): x = list(perms[i]) if (x == sorted(x)): y.append("".join(str(x))...
from django.test import TestCase from django.db.utils import IntegrityError from products.models import Category, Product, ProductType def model_setup(): prod_type_female = ProductType.objects.create(name='Footwear', sex='Female') prod_type_male = ProductType.objects.create(name='Footwear', sex='Male') ...
#!/usr/bin/env python """ pyjld.phidgets.erl_manager.erl_server """ __author__ = "Jean-Lou Dupont" __email = "python (at) jldupont.com" __fileid = "$Id: erl_server.py 77 2009-05-04 18:10:24Z jeanlou.dupont $" __all__ = ['',] class ErlServer(object): """ """ def __init__(self): pass ...
import requests from urllib.request import urlopen, Request from bs4 import BeautifulSoup import re import os import gzip import json ''' 测试网页httpbin.org Attention: 1.网址中的参数有中文报错,要变成编码形式。e.g. name=周杰伦 --->name=%E5%91%A8%E6%9D%B0%E4%BC%A6 ''' url = 'http://tool.liumingye.cn/music/?page=audioPage&type=migu&n...
""" 我的哈希的理解: 1. 哈希是一种一一映射方法 2. 它需要保证对不同的对象生成的哈希值不可以相同 3. 哈希过程很快 4. 也叫散列技术 """ print(hash('sdg'))
# -*- coding: utf-8 -*- import math import time import random from heap import * h = 0 # Global räknare för Vertex-ID:n d = 2 # Djikstras algoritm # G is the graph # s is the starting node # e is the ending node def djikstra(G, s, e): unvisited = [] # Here we can do variations of d visited = [] for i in G: # Runs i...
from telegram import InlineKeyboardButton from core.models import UserPreference from intent import Intent, IntentType from chatgpt_model import model_names, get_next_model def ask_button(): return InlineKeyboardButton( text=f'Задать вопрос', switch_inline_query_current_chat='', ) def eco_m...
import ast import sys import difflib from textwrap import indent import numpy as np import numpydoc.docscrape def w(orig): ll = [] for l in orig: if l[0] in "+-": # ll.append(l.replace(' ', '⎵')) ll.append(l.replace(" ", "·")) else: ll.append(l) lll =...
# On a N * N grid, we place some 1 * 1 * 1 cubes that are axis-aligned # with the x, y, and z axes. # # Each value v = grid[i][j] represents a tower of v cubes placed on top # of grid cell (i, j). # # Now we view the projection of these cubes onto the xy, yz, and zx planes. # # A projection is like a ...
def main(): i = 0 for i in range(0,101,2): print(i) for i in range(0,101,2): print(100-i) main()
# coding:utf-8 # -------------------------------------------------------- # Pytorch multi-GPU Faster R-CNN # Licensed under The MIT License [see LICENSE for details] # Written by Jiasen Lu, Jianwei Yang, based on code from Ross Girshick # -------------------------------------------------------- from __future__ import a...
from operator import add, mul as multiply, div as divide,\ mod, pow as exponent, sub as subt # add = lambda a, b: a + b # multiply = lambda a, b: a * b # divide = lambda a, b: a / b # mod = lambda a, b: a % b # exponent = lambda a, b: a ** b # subt = lambda a, b: a - b
from __future__ import print_function import pickle import os.path from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request import json # If modifying these scopes, delete the file token.pickle. SCOPES = ['https://www.googleap...
# -*- coding: utf-8 -*- """ Created on Thu Jul 4 16:01:17 2019 @author: Administrator """ import numpy as np import matplotlib.pyplot as plt my_bid = 215 my_bid_cnt = 3 op_bid_start = 180 op_bid_end = 220 op_bid_cnt = 1 bid_step = 0.1 my_offer = 215 def calc_base(mb,mbc,opbs,opbe,opbc,bid_step): ...
from flask import Flask, request, Response from rdflib import Graph, URIRef app = Flask(__name__) import pickle import nif_system import json #fullText = URIRef("http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#isString") #entityMention = URIRef("http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-...
class FunctionalError(Exception): """Base class for all 'normal' errors of the API""" pass # --- class ExistenceError(FunctionalError): pass class KeyDoesNotExist(ExistenceError): pass class KeyAlreadyExists(ExistenceError): pass class KeystoreDoesNotExist(ExistenceError): pass clas...
from django.conf import settings MERCHANT_ID = getattr(settings, 'DJANGO_W1_MERCHANT_ID', '') SIGN_METHOD = getattr(settings, 'DJANGO_W1_SIGN_METHOD', None) SECRET_KEY = getattr(settings, 'DJANGO_W1_SECRET_KEY', '') SUCCESS_URL = getattr(settings, 'DJANGO_W1_SUCCESS_URL', '') FAIL_URL = getattr(settings, 'DJANGO_...
""" CCT 建模优化代码 二维曲线段 作者:赵润晓 日期:2021年4月27日 """ import multiprocessing # since v0.1.1 多线程计算 import time # since v0.1.1 统计计算时长 from typing import Callable, Dict, Generic, Iterable, List, NoReturn, Optional, Tuple, TypeVar, Union import matplotlib.pyplot as plt import math import random # since v0.1.1 随机数 import sys i...
# -*- coding: utf-8 -*- """dfVFS helpers.""" from dfvfs.helpers import command_line as dfvfs_command_line from dfvfs.helpers import volume_scanner as dfvfs_volume_scanner from dfvfs.lib import definitions as dfvfs_definitions from dfvfs.path import factory as path_spec_factory from dfvfs.resolver import resolver as df...
def int_list(list): return [i if isinstance(i, int) else 0 for i in list] print(int_list(["a",1,"b",2,"c",3]))
from math import pi import numpy as np def Critical_Stress(height, width, t, sigma_y = 240*10**6, E = 69*10**9, v = 0.33, n = 0.6, alpha = 0.8): def sigma_cc_over_sigma_y(b, C = 4, t = t, sigma_y = sigma_y, E = E, v = v, n = n, alpha = alpha): sigma_cc_over_sigma_y = alpha*((C*(pi**2)*E*t**2)/(sigma_y*12*...
def odd_one(arr): for i,x in enumerate(arr): if x%2!=0: return i return -1 ''' Create a method that takes an array/list as an input, and outputs the index at which the sole odd number is located. This method should work with arrays with negative numbers. If there are no odd numbers in th...
ft = open("/Volumes/PUBLIC/Everyone/corpus/rakuten-2016-/matome/201002-04.tsv","w") count = 0 for i in rang(2,5): f = open("/Volumes/PUBLIC/Everyone/corpus/rakuten-2016-/review/ichiba04_review20100"+str(i)+"_20140221.tsv") for line in f: ft.write(line) ft.close()
import logging from model.sileg.designation.designation import Designation from model.sileg.place.place import Place from model.sileg.position.position import Position from model.users.users import User class SilegModel: @classmethod def getEconoPageDataUser(cls, con, userId): designationIds = Design...
from fabric.api import env as _env TARGET_LIVE = _env.get("live", None) VIRTUALENV_ROOT = "~/virtualenv" PROJECT_NAME = "pikapika" if TARGET_LIVE else "pikapika-saber" REMOTE_PYTHON_EXEC = "python2.7" MAIN_PACKAGE = "pikapika" print ("Target: " + PROJECT_NAME)
# Generated by Django 2.2.3 on 2019-07-10 09:24 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('DBStorage', '0011_auto_20190710_0902'), ] operations = [ migrations.RemoveField( model_name='giftanswers', name='gif...
class Solution: # @param A : tuple of integers # @return an integer def maxSubArray(self, A): curr_max = A[0] max_so_far = A[0] for i in range(len(A)): curr_max = max(curr_max + A[i],A[i]); max_so_far = max(max_so_far,curr_max); retur...
import pygame import time tank1_image = 'global image1' tank2_image = 'global image2' bullet_image = 'global bullet' class Player(): def __init__(self, x, y, tank_image_file, place, dir_lurd, hp): self.x = x self.y = y self.tank_velocity = 10 self.bullet_velocity = 20 sel...
def read_from_file(file_name:str) -> str: with open(file_name, 'r') as file: return file.read()
counts = dict() names = ['jane', 'tom', 'jhon', 'tom'] for name in names: counts[name] = counts.get(name, 0) + 1 print(counts)
""" Processes Finngen's manifest to extract all studies and their metadata in the OTG format. """ # coding: utf-8 import argparse from collections import OrderedDict import logging import numpy as np import pandas as pd def main(input_path: str, output_path: str) -> None: logging.basicConfig(format="%(asctime)...
import torch import numpy as np from torch.utils.data import Dataset from torch.utils.data import DataLoader from sklearn.model_selection import train_test_split # 读取原始数据,并划分训练集和测试集 raw_data = np.loadtxt('diabetes.csv', delimiter=',', dtype=np.float32) X = raw_data[:, :-1] y = raw_data[:, [-1]] Xtrain, Xtest, Ytrain, ...
import pandas as pd import matplotlib.pyplot as plt df = pd.read_csv('injury_data.tsv', sep='\t') df['2020/21 proj'] = df['2020/21'] * 3 COLS = ["2016/17", "2017/18", "2018/19", "2019/20", "2020/21"] PRIOR_YEARS = ["2016/17", "2017/18", "2018/19", "2019/20"] # Injuries this year res = df[['Country', 'Club', '202...
import logging , requests , lxml.html , os from urllib.parse import urljoin import pickle def save_cookies(session,filename): with open(filename, 'wb') as f: pickle.dump(session.cookies, f) def load_cookies(session,filename): with open(filename,'rb') as f: session.cookies.updat...
class YearResult: def __init__(self): self.modules = [] def total_credits(self): total_credits = 0 for m in self.modules: total_credits += m.credits return total_credits def get_result(self): total_credits = self.total_credits() total_result = 0 ...
# coding:utf-8 import os, sys # import pandas as pd from glob import glob from os import path wildchar_dict = {'mapl8': ['/L*B[4-6].TIF', '/L*BQA.TIF', '/L*MTL.txt'], 'mapl57': ['/L*B[3-5].TIF', '/L*BQA.TIF', '/L*MTL.txt'], 'raw': ['']} def parse_url(url, craft='LANDSAT'): if cra...
import random element_1=[] element_2=[] player_1=0 player_2=0 for i in range(5): element_1=random.randint(1,6) element_2=random.randint(1,6) player_1+=element_1 player_2+=element_2 print ("player 1 =", element_1) print ("player 2 =", element_2) print("player 1 has", player_1, "points whil...
from math import sqrt, exp, floor, pi import numpy as np import matplotlib.pyplot as plt import sys sys.path.append('../lab1') import distributions as dst def kernel_function(x: float): return exp(-x*x/2)/sqrt(2*pi) def kernel_approximation(xs: np.ndarray, sel: np.ndarray, k): n = len(sel) s = sqrt((se...
from src.character.player import Player from src.character.class_.standart import Warrior, Wizard from .notification import ShowPlayerStats from . import BaseScene, Quit class Menu(BaseScene): def exit(self, game): pass def execute(self, game): text = [ 'Привет. Это моя игра в консоли.', '1...
import os import tempfile ################################################################################################# # # # Wrapper Function #...
import pygame import sys from pygame.locals import * import time from lib.apple import Apple from lib.player import Player WINDOW_WIDTH = 1280 WINDOW_HEIGHT = 736 white = (255, 255, 255) black = (0, 0, 0) blue = (0, 0, 128) class App: def main(self): pygame.init() self.DISPLAYSURF = pygame.disp...
#!/usr/bin/python import sys import boto.ec2 instance_id = sys.argv[1] print(instance_id + 'will be terminated') conn = boto.ec2.connect_to_region("us-east-2", aws_access_key_id="", aws_secret_access_key="" ) conn.terminate_instances(instance_ids=[instance_id])
import multiprocessing import time import contextlib import requests import selenium.webdriver as webdriver import apl from constants import driver_path, hapag_url, backup_msc_url import cosco from database import get_containers_by_steamship, update_container_eta, update_container_tracing import hpl import msc import...
import unittest from neo.rawio.plexonrawio import PlexonRawIO from neo.test.rawiotest.common_rawio_test import BaseTestRawIO class TestPlexonRawIO(BaseTestRawIO, unittest.TestCase, ): rawioclass = PlexonRawIO files_to_download = [ 'File_plexon_1.plx', 'File_plexon_2.plx', 'File_plexo...
import sys from collections import OrderedDict from lib.intcode import Machine from time import sleep import subprocess if len(sys.argv) == 1 or sys.argv[1] == '-v': print('Input filename:') f=str(sys.stdin.readline()).strip() else: f = sys.argv[1] verbose = sys.argv[-1] == '-v' for l in open(f): mreset = [i...
import nltk from sklearn.model_selection import train_test_split nltk.download('punkt') nltk.download('wordnet') from nltk.stem import WordNetLemmatizer import json import pickle import numpy as np from keras.models import Sequential from keras.layers import Dense, Activation, Dropout,LSTM from keras.optimizers import ...
"""Module with functions for management of installed APK lists.""" import glob import re import subprocess import apkutils # needed for AndroidManifest.xml dump import utils # needed for sudo # Creates a APK/path dictionary to avoid the sluggish "pm path" def create_pkgdict(): """Creates a dict for fast pa...
from sklearn.externals import joblib question = raw_input(":> Ingresa la pregunta: ") clf = joblib.load('clf.pkl') vectorizer = joblib.load('vectorizer.pkl') selector = joblib.load('selector.pkl') question = vectorizer.transform([question]) question = selector.transform(question).toarray() print clf.predict(question)
from collections import defaultdict import numpy as np def solution1(input): m = defaultdict(lambda: defaultdict(int)) for i, ol, ot, w, h in input: for x in range(ol, ol+w): for y in range(ot, ot+h): m[x][y] += 1 c = 0 for x in m: for y in m: if...
#B zub=int(input()) x2,y3=map(int,input().split()) if(zub<y3 and zub>x2): print("yes") else: print("no")
from arcgis_terrain import meters2lat_lon from arcgis_terrain import lat_lon2meters import csv import numpy as np import matplotlib.pyplot as plt # params = [37.67752, -79.33887, 'punchbowl'] # # params = [38.29288, -78.65848, 'brownmountain'] # # params = [38.44706, -78.46993, 'devilsditch'] # # params = [37.99092...
""" Contains business logic tasks for this order of the task factory. Each task should be wrapped inside a task closure that accepts a **kargs parameter used for task initialization. """ def make_task_dict(): """ Returns a task dictionary containing all tasks in this module. """ task_dict = {} task...
#!/usr/bin/python3 import time import re from datetime import datetime gpio='/gpio/pin26/edge' def setup_gpio(gpio): with open(gpio, "w") as f: f.write("rising") #1Hz – 0.98 LPM val=0 last_val=0 last_time='' total_litres=0 sleep=10 Interrupts='/proc/interrupts' # 41: 299 gpio-mxc 14 Edge g...
class sport(): activity = 'physical' games = 'competitive' def __init__(self, name, numberOfPlayers, ballShape): self.name = name self.numberOfPlayers = numberOfPlayers self.ballShape = ballShape def printAll(self): print('name: %s\nnumber of players: %d\nball shape: %s...
from base.models import Group from rest_framework.permissions import BasePermission, IsAuthenticated class GroupAdminPermission(BasePermission): """ Checks that the request user is a group admin """ def has_permission(self, request, view): group = Group.objects.get(id=view.kwargs.get('group_id...
import math import itertools from collections import defaultdict import pprint # part 1 stuff with open("input1.txt","r") as f: data = f.readlines() points = [] for y in range(len(data)): for x in range(len(data[0])-1): if data[y][x] == '#': points.append([x,y]) maxSighted = 0 keyPoint = [0,...
x1,y11,z11=map(int,input().split()) d13=(x1*y11)//z11 print(d13)
import random #NOTES FROM DO NOW: #1. Work with integers #2. Random number generator #3. A way to give commands(controls) #FEATURES TO ADD: #1. How to keep the program running until i quit #2. Use numberOfRolls variable to show multiple die rolls #3. Add roll totaling features (sum/highest/lowest) #4. More...
import asyncio import json import wave import websockets import app from playground.noise_reduction.denoiser import Denoiser class VoskAudioRecognizer(app.AudioRecognizer): def __init__(self, host): self.host = host def parse_recognizer_result(self, recognizer_result): return app.Recognized...
import unittest from pyfiles.model import characterClass EXPECTED_VALUES = ['Fighter', 'Spellcaster', 'Rogue'] class TestCharacterClass(unittest.TestCase): def test_get_values(self): values = characterClass.CharacterClass.get_values() self.assertEqual(values, EXPECTED_VALUES) def test_get_js...
from django.contrib import admin from .models import Aparcamiento, AparcaSeleccionado, Comentario, Css admin.site.register(Aparcamiento) admin.site.register(AparcaSeleccionado) admin.site.register(Comentario) admin.site.register(Css)
import numpy as np import pandas as pd from pathlib import Path from sklearn.model_selection import train_test_split import lightgbm as lgb # Global constants MAX_LAG = 57 def downcast(df, verbose=False): """ Downcast the data to reduce memory usage. Adapted from: https://www.kaggle.com/ragnar123/v...
#!/usr/bin/env python #-*-coding:utf-8-*- from flask import Flask, render_template from flask_bootstrap import Bootstrap from flask_sqlalchemy import SQLAlchemy #引用数据库,需要安装MySQL-python import os from flask_script import Manager from flask import session, redirect,url_for # 引入重定向和用户会话 from flask import flash #Flash...
import zipfile import wget import glob import os import torch import argparse import pandas as pd from tqdm import tqdm from utils import overwrite_base, Logger from configs.config import GlobalConfig import mmcv from mmcv import Config from mmdet.apis import set_random_seed from mmdet.datasets import build_dataset, ...
''' Main.py Starting File ''' import os import numpy as np import tensorflow as tf from model import Model from plot import Plot from game import Game #import matplotlib.pyplot as plt class Main: def __init__(self): self.feature_length = 6 self.label_length = 4 self.cost_plot = Plot([], '...
# 自然数Nをコマンドライン引数などの手段で受け取り,入力のうち先頭のN行だけを表示せよ. # 確認にはheadコマンドを用いよ. # head -n 5 hightemp.txt # !usr/bin/env python # -*- coding;utf-8 -*- import sys N = int(sys.argv[1]) assert len(sys.argv) is 2, "usage: python nock_14.py [N]" with open('hightemp.txt') as f: print(''.join(f.readlines()[:N]),end="") # count=0 ...
from datetime import datetime from tkinter import * win = Tk() win.geometry("600x100") win.title("What time??") win.option_add("*Font","맑은고딕 8") def what_time(): dnow = datetime.now() btn.config(text=dnow) btn = Button(win) btn.config(text="현재 시각") btn.config(width=30) btn.config(command=what_time) btn.pack()...
# Generated by Django 3.0.1 on 2019-12-24 17:30 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('paroll', '0005_auto_20191225_0104'), ] operations = [ migrations.AddField( model_name='account', name='address', ...
#!/usr/bin/env python import array import math import sys import time numb = array.array('l',[0]*1000000) numbsize = 0 echostep=10 #tcount = 0 targ = {} chash = {} def DeDupes(): global numbsize dupes=0 uniqid=0 for i in range(1,numbsize): if numb[i] == numb[uniqid]: dupes+=1 else: uniqid+=1 numb[uni...
import sys import requests from requests.api import head from bs4 import BeautifulSoup import pandas as pd import xlsxwriter from datetime import datetime companies = [] base_url = "https://www.finanzen.net/bilanz_guv/" user_agent = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, l...
#!/usr/bin/python3 # -*- coding: utf-8 -*- # Base Class for Protocols from .protocol import Protocol # Utility Classes for Protocols from .header import Header from .frame import Frame from .link import * from .internet import * from .transport import * from .application import * # Ptotocol Chain from .utilities im...
# coding=utf-8 """ preInit.py Desc: Maintainer: wangfm CreateDate: 2016/12/7 """ import ConfigParser import argparse import os import sys try: from statusdocke import checkRunner from configTest import TestRunner from logger import logger except ImportError: sys.path.append(os.getenv('PY_DEV_HO...
#The upper() String Method fruit = 'Apple' print(fruit.upper())
import numpy as np from bokeh.plotting import figure, show, output_file, vplot from bokeh.io import output_notebook N = 100 x = np.linspace(0, 4*np.pi, N) y = np.sin(x) #output_file("legend.html", title="legend.py example") TOOLS = "pan,wheel_zoom,box_zoom,reset,save,box_select" p2 = figure(title="Another Legend E...
from flask import request, redirect, url_for from flask_restful import Resource, marshal_with from ..fields import Fields from app.models.models import Sale, Product, SaleGroup, User, db from app.forms import CreateSaleForm from .sale_group import SaleGroupListAPI sale_fields = Fields().sale_fields() class SaleListAP...
from django.conf.urls import url from . import views urlpatterns = [ url(r'^createGenesisNode/', views.createGenesisNode), url(r'^createChildNode/', views.createChildNode), url(r'^editNode/', views.ediNode), url(r'^findLongestChain/', views.findLongestChain), ] ''' API ENDPOINTS 1. localhost:800...
#2019.07.20-KimSeokMin #필요 라이브러리 : selenium, bs4(beautifulsoup) import time from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import Select from bs4 import BeautifulSoup as BS from multiprocessing.pool import Pool, ThreadPool from selenium.webdriver.suppor...
# Criando/escrevendo arquivos no python file = open('aula57/abcd.txt', 'w+') file.write('Linha 1\n') file.write('\t Linha 2\n') file.write('\t\t Linha 3\n') file.seek(0, 0) print('Lendo... ') print(file.read()) # print(f'----------------------') file.seek(0, 0) print(file.readline(), end='') print(file.readline(), en...
def main(): iList = [None] with open('test.txt') as f: firstLine = f.readline().split(' ') kSize, n = int(firstLine[0]), int(firstLine[1]) for line in f: tempList = line.split(' ') iList.append((int(tempList[0]), int(tempList[1]))) print(knapsack(n, kSize, iList)) def knapsack(n, kSize, iList)...
#!/usr/bin/env python from comet_ml import Experiment import argparse import os import sys from datetime import datetime import warnings warnings.simplefilter("ignore") import keras import tensorflow as tf from keras_retinanet import models from keras_retinanet.utils.keras_version import check_keras_version #Custo...
import sys import numpy as np from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D import mpl_toolkits.mplot3d.art3d as art3d from matplotlib.patches import Rectangle import seaborn as sns from astropy.table import Table from dust_blorentz_ode import streamline try: thB_degrees = float(sys....
# This is a sample Python script. # Press ⌃R to execute it or replace it with your code. # Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings. from myStock_handler.stock_day_handler import regist_day, get_stock_day import datetime from myAI.stock_litm import LSTM_model from myA...
import pandas as pd import unittest import os import pyterrier as pt from .base import BaseTestCase class TestFeaturesBatchRetrieve(BaseTestCase): def test_fbr_ltr(self): JIR = pt.autoclass('org.terrier.querying.IndexRef') indexref = JIR.of(self.here + "/fixtures/index/data.properties") re...
__version__ = "0.9.94.dev3"