text
stringlengths
8
6.05M
#!/usr/bin/python3 from flask import Flask, request, render_template from flask_cors import CORS, cross_origin import time import RPi.GPIO as GPIO import Adafruit_DHT import json import sys import pandas as pd import logging from wwo_hist import retrieve_hist_data import os import datetime sys.path.append("/home/pi/.l...
#!/usr/bin/env python import urllib2, json from sys import argv script, url = argv user_agent = [('User-agent', 'https://github.com/bryanheinz/scripts/blob/master/python/utilities/is-up.py')] opener = urllib2.build_opener() opener.addheaders = user_agent data = json.load(opener.open("http://isitup.org/%s.json" % url...
# drugdealing.py # import os import sys import random import collections drugsAvail = ['acid', 'cocaine', 'heroin', 'meth', 'weed'] #drugBasePrices = [5, 100, 60, 25] #drugPriceModifier = [1, 1, 1, 1] #drugPrices = list() citiesAvail = ['boston', 'chicago', 'dallas', 'los angeles', 'new york'] # Enter c...
#!/usr/bin/python3 class Complex: def __init__(self, realpart, imagpart): self.realpart = realpart self.imagpart = imagpart x = complex(3.0, -4.5) print(x.real, x.imag) class Test: def prt(self): print(self) print(self.__class__) t = Test() t.prt()
# 문제 설명 # 게임 캐릭터를 4가지 명령어를 통해 움직이려 합니다. 명령어는 다음과 같습니다. # U: 위쪽으로 한 칸 가기 # D: 아래쪽으로 한 칸 가기 # R: 오른쪽으로 한 칸 가기 # L: 왼쪽으로 한 칸 가기 # 캐릭터는 좌표평면의 (0, 0) 위치에서 시작합니다. 좌표평면의 경계는 왼쪽 위(-5, 5), 왼쪽 아래(-5, -5), 오른쪽 위(5, 5), 오른쪽 아래(5, -5)로 이루어져 있습니다. # 방문길이1_qpp9l3.png # 예를 들어, "ULURRDLLU"로 명령했다면 # 방문길이2_lezmdo.png # 1번 명령어부터 ...
import sqlite3 conn = sqlite3.connect("nyt.db") cur= conn.cursor() #SELECT e.rank,b.name FROM Books as b,entries as e WHERE b.id=e.id; def update_score(): scores ={} cur.execute("SELECT id FROM Books ORDER BY score desc") l=cur.fetchall() count=0 for id in l: id=id[0] count=count +...
#!/usr/bin/env python3 """This is mydemo.py, a test for turtle.py""" from turtle import * import random import math import time import platform if platform.system() == 'Linux': from evdev import list_devices, InputDevice, ecodes PLANE_SPEED = 4 TURBO_SPEED = PLANE_SPEED * 2 BLT_SPEED = PLANE_SPEED * 4 MSLE_SPEED ...
#!/usr/bin/python3 # -*- coding: utf-8 -*- from colorama import Fore if __name__ == '__main__': print(Fore.GREEN + 'Hello World')
import unittest from selenium import webdriver from bs4 import BeautifulSoup class seleniumTest(unittest.TestCase): def setUp(self): self.driver = webdriver.PhantomJS() def testEle(self): driver = self.driver driver.get('http://www.douyu.com/directory/all') print(driver.title.encode(...
from Board.Map.Tile import * from Vector2 import Vector2 class Map: def __init__(self, game, tiles=None, selectedTile=None): self.Resolution = game.Settings.Resolution self.Tiles = tiles if tiles is not None else self.GenerateTiles(game) self.SelectedTile = selectedTile def GenerateT...
# # Copyright (C) 2020-2030 Thorium Corp FP <help@thoriumcorp.website> # from odoo import api, fields, models, modules class ThoriumcorpPractitioner(models.Model): _name = 'thoriumcorp.practitioner' _description = 'Thoriumcorp Practitioner' _inherit = 'thoriumcorp.abstract_entity' _sql_constraints...
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-04-26 23:57 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.Creat...
import os import pickle from neural_model import NeuralModel from sklearn.decomposition import PCA from util.neuron_metadata import NeuronMetadataCollection from util.analysis_util import * neuron_metadata_collection = NeuronMetadataCollection.load_from_chem_json('data/chem.json') # Make all the param values be exac...
#coding:utf-8 #输入参数生成一个URL库的list class urlku(object): def ulrs(self,numb): url_ku = [] url_zu = "http://www.tmsf.com/newhouse/property_searchall.htm?keytype=1&searchkeyword=&keyword=&sid=&districtid=&areaid=&dealprice=&propertystate=&propertytype=&ordertype=&priceorder=&openorder=&view720data=&pag...
import exceptions class UnitsError(exceptions.Exception): pass class Units(object): byte=0 g_byte=1 m_byte=2 k_byte=3 t_byte=4 second=5 percentage=6 kB = 7 def __init__(self): self.units_types = { 'byte':[Units.byte, Units.g_byte, ...
import json import boto3 import uuid def lambda_handler(event, context): body = event["body"] response = send_message(body) return { "statusCode": 200, "body": json.dumps({ "message_id": response['MessageId'], "event": body, }), } def get_queue(): ...
# Generated by Django 3.1.6 on 2021-02-19 11:21 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('sites', '0002_auto_20210207_1523'), ('purchase_request', '0004_sitespurchaserequest_month'), ] operations =...
import matplotlib.pyplot as plt from matplotlib import path import numpy as np from scipy.optimize import least_squares import matplotlib.patches as patches import cv2 import hylite from hylite.reference.features import HyFeature from hylite import HyData from hylite.project import pix_to_ray_pano, pix_to_ray_persp ...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import pickle from spyro.utils import progress from spyro.value_estimation import STATION_NAMES try: from fdsim.helpers import lonlat_to_xy except: progress("fdsim not installed, some functions might not work.") try: ...
"""setup for embeddable objects plugin""" from setuptools import setup setup( name = 'BloodhoundEmbeddingPlugin', version = '0.1', description = "Embeddable objects plugin support for Apache(TM) Bloodhound.", author = "Apache Bloodhound", license = "Apache License v2", url = "http://bloodhound....
#!/usr/bin/env python from BeautifulSoup import BeautifulSoup import re import sys def pulldata(fn): soup = BeautifulSoup(open(fn).read()) for l in soup.findAll('a', href= re.compile('xml$')): print('%s "facebook"' % l['href']) if __name__ == '__main__': pulldata(sys.argv[1])
from __future__ import print_function import re class Token(object): def __init__(self, name, value): self.name = name self.value = value def __str__(self): return "Token(name={}, value={})".format(self.name, repr(self.value)) class Tokenizer(object): def __init__(self, ...
from django.shortcuts import render from salvados.models import Salvado from django.views import generic from salvados.forms import SalvadoForm from django.urls import reverse_lazy class ListarSalvados(generic.ListView): model=Salvado template_name="salvados/listar_salvados.html" context_object_name="obj" ...
import pandas as pd import matplotlib.pyplot as plt import numpy as np # Automobile data set has wenty-six atributes/columns headers = ["symboling", "normalized-losses", "make","fuel-type", "aspiration", "num-of-doors", "body-style", "drive-wheels", "engine-location", "wheel-base", "length...
class Library: def __init__(self): self.x = 'sup' def method(self, text): print(self.x + ' ' + text)
import socketio from multiprocessing import Process import signal import sys import logging ## LOGGING INFO logging.basicConfig() LOGGER = logging.getLogger(__name__) LOGGER.setLevel(level=logging.INFO) ## Websocket client class WebsocketClient(): def __init__(self,ws_address,on_msg_callback = ""): # Va...
# Generated by Django 3.1.7 on 2021-07-19 23:00 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Author', fields=[ ('id', models.AutoField(a...
from flask.ext.wtf import Form from wtforms import TextField, SelectField, validators class AddSubscriptionForm(Form): handphone = TextField('handphone', validators=[validators.Regexp(r'^\d+$'), validators.Length(min=8, max=8)]) email = TextField('email', validators=[validator...
#----------------------------------------------------------------------------------------------------------------------- # Project: resnet-finetune-demo # Filename: resnet_demo.py # Date: 16.06.2017 # Author: Adam Brzeski - CTA.ai #----------------------------------------------------------------------------------------...
import cv2 print(cv2.__version__) vidcap = cv2.VideoCapture('passing_sample.mkv') success,image = vidcap.read() count = 0 while success: cv2.imwrite("frames/frame%04d.png" % count, image) success,image = vidcap.read() count += 1 import imageio import os image_folder="frames/" image_list = sorted([os.path.join(...
import logging from datetime import datetime from functools import reduce import numpy as np import matplotlib.pyplot as plt import scipy.integrate as integrate from common.gen import LinearCongruentialGenerator, UniformGenerator, NormalGenerator from common.log import init_logging from l6_filters.filter import Expon...
import numpy as np #import bpy #def draw_cube(verts): # edges = [(0, 1), (0, 2), (1, 3), (2, 3), (4, 5), (4, 6), (5, 7), (6, 7), (0, 4), (1, 5), (2, 6), (3, 7)] # mesh = bpy.data.meshes.new('Pyramid_Mesh') # mesh.from_pydata(verts, edges, []) #mesh.update() #pyramid = bpy.data.objects.new('Pyramid', m...
import sys import pyspark conf = pyspark.SparkConf() sc = pyspark.SparkContext(conf=conf) sqlContext = pyspark.SQLContext(sc) review_file_path = sys.argv[1] metadata_file_path = sys.argv[2] out_file_path = sys.argv[3] # Step 1 ====================================================================== # Find the number o...
from django.contrib.auth.models import User from order.models import Order from django import forms class OrderForm(forms.ModelForm): first_name = forms.CharField(label='First name') last_name = forms.CharField(label='Last name') class Meta: model = Order fields = '__all__' def __in...
from django.http import HttpResponse from django.shortcuts import render, redirect # Create your views here. import string import random from captcha.image import ImageCaptcha from log_regapp.models import User def login(request): return render(request,'log_regapp/login.html') def check_user(request): na...
from __future__ import print_function, division import numpy as np import matplotlib.pyplot as plt import thinkplot from matplotlib import rc rc('animation', html='jshtml') import warnings import matplotlib.cbook warnings.filterwarnings("ignore", category=matplotlib.cbook.mplDeprecation) from thinkstats2 import Ra...
import os import pandas as pd from functools import partial, reduce import numpy as np import pickle from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler import random import gc #=================== Environment variables =================== os.environ['TF_CPP_MIN_LOG_L...
#!/usr/bin/python3 """LockedClass Module""" class LockedClass(): """LockedClass""" __slots__ = ['first_name'] def __init__(self, first_name=''): self.first_name = first_name
import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.read_csv("task_21.csv") # print(df["std::sort"]) fig, ax = plt.subplots(1, 1) ax.plot([i*10 for i in range(len(df["std::sort"]))], df["std::sort"], label='std::sort') ax.plot([i*10 for i in range(len(df["std::nth_element"]))], df["std::nth_...
from django.contrib import admin from Avaliacao.models import TemplateAvaliacao from Avaliacao.Questao.models import FiltroQuestao class FiltroQuestaoInline(admin.TabularInline): model = FiltroQuestao extra = 4 class TemplateAvaliacaoAdmin(admin.ModelAdmin): fieldsets = [ ('Template de Avali...
# !/usr/bin/env python # -*- coding: utf-8 -*- # Copyright: Fabien Rosso # Version 0.1.1 - 19 Avril 2016 # Version 0.1.2 - 29 Avril 2016 import pickle from datetime import date, time, datetime def convertInt (listeStr): listeInt = [] for x in listeStr: listeInt.append(int(x)) return listeInt ...
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2018-06-23 12:39 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('hrr', '0011_remove_timeheartzones_activity_summary_id'), ] operations = [ m...
#引入socket#数据的传输,数据为bytes类型 import socket #创建套接字 s=socket.socket(socket.AF_INET,socket.SOCK_STREAM) #给套接字绑定地址和端口 s.bind(('localhost',8080)) #监听 s.listen(5) print('我正在等待数据') #接收链接 conn,address=s.accept() #接收请求信息 while True: res=conn.recv(1024)#recv堵塞 print('--他:',res.decode())#输出请求信息 data =inpu...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Sep 22 16:38:56 2019 @author: nico """ #%% importo los paquetes necesarios import os import matplotlib.pyplot as plt import numpy as np import pandas as pd import statistics as stats import sys sys.path.append('/home/nico/Documentos/facultad/6to_nivel...
#!/bin/python3 import os import sys # # Complete the twoStacks function below. # def twoStacks(x, a, b, n, m): total = 0 atmp = [] print(a) print(b) for i in range(n): val = a.pop() if total + val > x: break total += val atmp.append(val) print(atmp) ...
#bubble sort, most basic sorting algorithm, #generate sorted list for search functions to perform better. #the function require a list input #and will return the sorted list #and how many times have the algorithm go through the list. import random def bubble_sort(my_list): position = 0 status = True ...
import array import docker import fcntl import os import pty import re import sys import select import tempfile import termios import tty from pathlib import Path from ronto import \ dryrun, \ is_command_available_or_exit, \ is_in_docker, \ run_cmd, \ verbose from . import get_...
from django.urls import path, include, re_path from . import views app_name = 'ann' urlpatterns = [ path('', views.AnnView.as_view(), name='index'), path('<int:id>', views.AnnDetailView.as_view(), name='detail'), path('<int:id>/test/<int:training>', views.TestView.as_view(), name='test'), path('<int:i...
# 1、字符串:序列操作、编写字符串的其他方法、模式匹配 # 去空格及特殊符号 # lstrip:删除左边的空格 # rstrip:删除右边的空格 # strip:删除两端的空格 s = " changjie l " print(s.lstrip()) print(s.rstrip()) print(s.strip()) # 复制字符串 str1 = 'occupation' str2 = str1 str1 = 'occupation2' print(str1,str2) # 连接字符串 str1 = 'my' str2 = 'job' str1 += str2 print(str1) # 查找字符 <0 为未找到 str...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('scrub_csv', '0006_auto_20150416_2317'), ] operations = [ migrations.AddField( model_name='document', ...
# Copyright (c) Members of the EGEE Collaboration. 2004. # See http://www.eu-egee.org/partners/ for details on the copyright # holders. # # 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 #...
from end_to_end import end_to_end def main(): # Set parameters release_number = 500 number_infected_before_release = 200 stop_inflow_at_intervention = True print('Running simulation ...') t, S, I, R, D = end_to_end(release_number, number_infected_before_release, stop_inflow_at_intervention) ...
name = "polgrad" __all__ = ["BasePolicyGradient", "a2c", "ppo", "reinforce"] from flare.polgrad.base import BasePolicyGradient from flare.polgrad import a2c, ppo, reinforce
from django.apps import AppConfig class GooglemapsSocketsAppConfig(AppConfig): name = 'googlemaps_sockets_app'
name=" moona" print("hi", name) print(name.lower()) print(name.upper()) print(name)
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file acc...
import json from datetime import datetime from django.db import connection from django.db.models import Sum, Count from operator import itemgetter from djofx import models def get_training_data(owner): from djofx import models categorised = models.Transaction.objects.filter( account__owner=owner, ...
# 자막이 빠른 경우 import re def print_int(i): if i > 9: return str(i) else: return "0" + str(i) sec = 10 content = open('timing.txt', 'rt', encoding='UTF-8') newContent = open('timing_edited.txt', 'w', encoding='UTF-8') newLine = "" for c in content.readlines(): if c == "\n": newLine ...
def invert(lst): output = [] for i in lst: output.append(-i) return output
#!/usr/bin/env python3 import sys def takepizza(pizzas, key): ids = pizzas[key] ret = ids.pop() if not ids: # print(' took last {} pizza {} — deleting'.format(key, ret)) del pizzas[key] return ret with open(sys.argv[1]) as f: line1 = f.readline() m, t2, t3, t4 = [int(x) for...
# -*- coding: utf-8 -*- # Copyright (C) 2017 by # David Amos <somacdivad@gmail.com> # Randy Davila <davilar@uhd.edu> # BSD license. # # Authors: David Amos <somacdivad@gmail.com> # Randy Davila <davilar@uhd.edu> """Functions for computing vertex covers and related invariants in a graph.""" from...
board = [ [7,8,0,4,0,0,1,2,0], [6,0,0,0,7,5,0,0,9], [0,0,0,6,0,1,0,7,8], [0,0,7,0,4,0,2,6,0], [0,0,1,0,5,0,9,3,0], [9,0,4,0,6,0,0,0,5], [0,7,0,3,0,0,0,1,2], [1,2,0,0,0,7,4,0,0], [0,4,9,2,0,6,0,0,7] ] def solver(bo, box_size): """ Solves a soduku board with backtracking an...
# -*- coding: utf-8 -*- from util_settings import * DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': LOCAL('db.sqlite'), 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': '', } } DEBUG = True TEMPLATE_DEBUG = DEBUG SERVE_MEDIA = True ME...
from datetime import datetime from feature_tools import get_statistical_results_of_list def get_user_id(tweets): return tweets[0]['user']['id_str'] def get_user_name(tweets): return tweets[0]['user']['name'] def get_user_screen_name(tweets): return tweets[0]['user']['screen_name'] def get_all_friend_fea...
from collections import defaultdict def recoverSecret(triplets): letters = defaultdict(set) for a, b, c in triplets: letters[a].add(b) letters[a].add(c) letters[b].add(c) for key, value in letters.items(): for after_key in value: letters[key] = letters[key].uni...
import dsn.util.systems as dsnsys import re, inspect # system_strs = ['linear_2D', 'R1RNN_input', 'V1_circuit']; system_strs = ["linear_2D", "V1_circuit"] num_system_strs = len(system_strs) def doc2md(docstring, keywords): docstrings = docstring.split("\n") num_strings = len(docstrings) i = 0 key_in...
def stoer_wagner(G, weight: str = "weight", heap=...): ...
#Endi boolean turidagi o'zgaruvchilar bilan stringda qanday ishlasa buladi # Aytaylik bizga berilgan string turiadi o'zgaruvchida biron bir so'zni bor yoki yo'qligini tekshirmoqchi bulsak # Agar shu so'z bor bo'lsa True yo'q Bulsa Fulse qaytarsin a="Khamzayev Jamshid is wonderfull Python programmer!!!" print('Jamshid'i...
#! /usr/bin/python3.4 print ("Hello Poland")
import numpy as np import os import csv import pickle import sys import matplotlib import matplotlib.cm as cm import matplotlib.mlab as mlab import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot3d import Axes3D import scipy.interpolate from pyevtk.hl import pointsToVTK import pyvtk ...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'c:\Users\ric_j\OneDrive\Projects\FINISHZZ\arenavision_ui\ui\arenavision_ui.ui' # # Created by: PyQt5 UI code generator 5.10 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class...
try: try: raise IndexError finally: print('SPAM') finally: print('spam')
def my_factors(n): factors = [1, n] for i in range(2, n//2+1): if n % i == 0: factors.append(i) return sorted(factors) ls = list(map(int, input().split())) N, K = ls[0], ls[1] myFactors = my_factors(N) if len(myFactors) < K: print(0) else: print(myFactors[K-1])
from account.models import MyUser, RateReader, MyUserProfile from rate.models import Rate from countrycity.models import Location, Liner from rest_framework import viewsets, views from api.serializers import UserSerializer, UserCreateSerializer, UserUpdateSerializer, ChangePasswordSerializer, ChangeProfileImageSerializ...
from __future__ import absolute_import import re import pattern.en as english from compiler import get_nate_logic from peggy.peggy import flatten from peggy_test.keyvalue import parse_keyvalue, KeyValueListParser from nate.util import * from vm import NateVm DEFAULT_REPLACEMENTS = parse_keyvalue(read_data("initial_r...
""" Python Wechaty - https://github.com/wechaty/python-wechaty Authors: Huan LI (李卓桓) <https://github.com/huan> Jingjing WU (吴京京) <https://github.com/wj-Mcat> 2020-now @ Copyright Wechaty Licensed under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance wit...
import pygame from pygame.locals import * import copy pygame.init() pygame.font.init() clock = pygame.time.Clock() WIDTH = 600 dx = [-1, 0, 1] class Coord: def __init__(self, x, y): self.x = int(x) self.y = int(y) def __eq__(self, other): if not isinstance(other, Coord): ...
# -*- coding: utf-8 -*- """ Created on Sat Feb 1 09:42:48 2020 @author: akira """ import pandas as pd import numpy as np from keras.models import model_from_json arquivo = open('classificador.json','r') estrutura_rede=arquivo.read() arquivo.close() classificador = model_from_json(estrutura_rede) classificador.load...
def batch(iterable, n=1): """Allow to iterate in batch of size n over the given iterable Args: iterable (:iter:): Any iterable with a `len` function. n (int, optional): Int specifying the size of the batch. """ l = len(iterable) for ndx in range(0, l, n): yield iterable[...
import os import argparse import random from data import Data import cv2 import time import sys from tqdm import tqdm from bounding_box import bounding_box as bb from tqdm import tqdm parser = argparse.ArgumentParser() parser.add_argument("-r","--root_dir", type=str, default="/mnt/069A453E9A452B8D/Ram/surv...
""" Provide toy example classes which we can test PathSelection on. """ import networkx as nx import numpy as np from networkx.drawing.nx_agraph import graphviz_layout import matplotlib.pyplot as plt class ToyExample(object): """ Class as template for all DAG toy examples. These toy examples could be used to...
#!/usr/bin/env python3 # Copyright 2016 The Dart project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import argparse import os import subprocess import sys import utils HOST_OS = utils.GuessOS() SCRIPT_DIR = os.path.dirname(sys.ar...
# flake8: noqa: W191,E101 import copy import gzip import io import pickle import zlib from pathlib import Path from typing import Callable, Dict, List, Tuple, Type import numpy as np import pandas as pd import pytest import polars as pl from polars import DataType def test_to_from_buffer(df: pl.DataFrame) -> None: ...
# import the necessary packages import numpy as np import argparse import imutils import cv2 # construct the argument parser and parse the arguments ap = argparse.ArgumentParser() ap.add_argument("-i", "--image", required=True, help="Path to the image") args = vars(ap.parse_args()) # load the image and show it imag...
# coding: utf-8 """ Copyright 2016 SmartBear Software 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 applica...
from flask import Flask # => wsgi itself app = Flask(__name__) @app.route('/') def hello(): return 'merhaba zalım dunya' pass
#__date__ = 6/14/18 #__time__ = 4:09 PM #__author__ = isminilourentzou import lib import torch import os import logging logger = logging.getLogger("model") def build_wordrepr(opt, vocabs): if opt.load_from is not None: checkpoint = get_checkpoint(opt.load_from, opt) model = lib.model.WordRepr(ch...
from typing import List class BrowserHistory: def __init__(self, homepage: str): self.stack: List[str] = [homepage] self.pointer: int = 0 def visit(self, url: str) -> None: if self.pointer < len(self.stack) - 1: self.stack[self.pointer + 1] = url del self.stack...
import pymssql as ms conn = ms.connect(server='localhost', user='bitcamp', password='1234', database='BTDB') cursor = conn.cursor() cursor.execute('SELECT TOP(1000) * FROM train;') row = cursor.fetchone() print(type(row)) ## tuple while row: # print("첫컬럼=%s, 둘컬럼=%s" %(row[0], row[1])) print(row) ...
""" 厦一代表队 """ from os import lstat import grpc import contest_pb2 import contest_pb2_grpc import question_pb2 import question_pb2_grpc import pickle import numpy as np import pandas as pd import time import random import threading class Client: # --- class attribute --- ID = 121 # y...
import os import wget from setuptools import setup from setuptools.command.develop import develop as _develop from setuptools.command.install import install as _install with open("requirements.txt", "r") as f: REQUIRED_PACKAGES = f.read().splitlines() def get_config(config_dir=None): """Downloads config fil...
from bs4 import BeautifulSoup import re import urllib.request import urllib.parse import collections import sys import os from FileDownload import * import time class Crawler: DIR_PATH = os.path.dirname(os.path.abspath(__file__)) DIR_PATH_FILES = 'Downloaded_Files' CRAWLED_FILES = 'Crawled Urls.txt' d...
#!/usr/bin/env python from scapy.all import * import sys import argparse class Fabric(Packet): name = "Fabric " fields_desc = [ BitField('packetType', 0, 3), BitField('headerVersion', 0, 2), BitField('packetVersion', 0, 2), BitField('pad1', 0, 1), BitField('fabricColor'...
# from selenium import webdriver import requests from bs4 import BeautifulSoup import pandas as pd import re def webscrap(): try: # driver = webdriver.Chrome(executable_path="C:\Drivers\chromedriver")#,options=options) # driver.get("https://www1.nseindia.com/live_market/dynaContent/live_...
import boto3 import sys import urllib from urllib.request import urlopen # region Variables #This is github demo #This is github demo 2 #This is github demo 3 #This is github demo branch 1 ACCESS_KEY = 'Your Access Key' SECRET_KEY = 'Your Secret Key' IPSetId = 'ID of the IPList that you want to push the IP List' file_...
from setuptools import setup, find_packages import vikid._version setup( name='vikid', version=vikid._version.__version__, url='https://vikiautomation.com', author='John Shanahan', author_email='shanahan.jrs@gmail.com', license='Apache', description='Viki is a command line web hook reciever...
#!/usr/bin/python import time from datetime import date, datetime import json #read json files import glob #iterate over files in folder import os #we need to see current working directory. files = glob.glob(os.path.dirname(os.path.realpath(__file__)) + '/*.json') weeks = {} weekdays = {} for f in files: for ...
import serial import time s = None def setup(): global s s = serial.Serial("/dev/ttyS0", 57600) def loop(): s.write("1") time.sleep(1) s.write("0") time.sleep(1) if __name__ == '__main__': setup() while True: loop()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Nov 11 18:53:29 2019 @author: nico """ import sys sys.path.append('/home/nico/Documentos/facultad/6to_nivel/pds/git/pdstestbench') import os import matplotlib.pyplot as plt import numpy as np #import seaborn as sns from pdsmodulos.signals import spectra...
from typing import Union, List from graph_db.engine.label import Label from graph_db.engine.types import INVALID_ID from .property import Property from .node import Node class Relationship: """ Relationship between two nodes in a Graph. """ def __init__(self, label: Label, ...