index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
990,500
13113f7ed23e9bcfd5bfae1faf140f4e1014f43a
import csv import os from rdbtools import RdbCallback, RdbParser import pandas as pd from rdbtools.callbacks import JSONCallback def load_rdb(filename, filters=None): r = MockRedis() parser = RdbParser(r, filters) parser.parse(filename) return r class MockRedis(RdbCallback): def __init__(self):...
990,501
a737bf698f3ce72921aff41016ad64bdcbe51b96
# Ejemplo de conjuntos s = set([5, 4, 6, 8, 8, 1]) print(s) print(type(s)) s = {5, 4, 6, 8, 8, 1} print(len(s)) lista = ["España","Perú", "Argentina"] print("España" in lista)
990,502
5ed99d6a04dce08b99362b7014bd9338c31d3ebd
class SwiftArray: pass
990,503
113341df725a47570ec03f2e4b98420fc7cca347
import pytest from Bio.Seq import Seq from cargo_oligo_creator import guide, guide_splitter, split_configuration class TestGuideSplitter: def test_split(self): guides = [guide.Guide("AAAATTCCCCGG")] config = split_configuration.SplitConfiguration([3]) splitter = guide_splitter.GuideSplitt...
990,504
90c85cf9301e86a0d9800a09f534294276d46abe
from bs4 import BeautifulSoup import requests class Stock: #建構式 def __init__(self, *stock_numbers): self.stock_numbers = stock_numbers #爬取 def scrape(self): response = requests.get("https://tw.stock.yahoo.com/q/q?s=2451") soup = BeautifulSoup(response.text.replace("加到投資組合", ""), "lxml...
990,505
eba61e079a0ed400e1cb9aed8800f184e4048594
#!/usr/bin/python # Get Xineoh's Mnist Data import mysql.connector as mysql import time import tensorflow as tf import numpy as np hostname = '173.45.91.18' username = 'user01' password = 'nw21ZDcWzTG4' database = 'mnist01' ###Specify some preliminaries like what we want the output files to be called train_out = 'TF_m...
990,506
d53182b8d431eef85fb5f35773c308f3b58897e2
# -*- coding: utf-8 -*- import requests import redis import lxml.html import os client_redis = redis.StrictRedis() def get_pictures_to_redius(): html = requests.get("http://news.4399.com/gonglue/lscs/kptj/") html_str = html.content.decode('gbk') selector = lxml.html.fromstring(html_str) url_list = se...
990,507
773ee53dc135f5b01df467ba5225e46afc2b556b
from lxml import etree import sqlite3 def myFunction(): print("maj") connexion = sqlite3.connect("../base_EPI.db") curseur = connexion.cursor() fichier = etree.parse("../data.xml") epis = fichier.getroot() curseur.execute("SELECT * FROM EPI") rows = curseur.fetchall() for row in r...
990,508
ede921c4b80d1f28fef234f6fb8a886851879d95
import numpy as np import pytest import tensorflow as tf from tf_explain.core.grad_cam import GradCAM def test_should_generate_ponderated_output(mocker): mocker.patch( "tf_explain.core.grad_cam.GradCAM.ponderate_output", side_effect=[mocker.sentinel.ponderated_1, mocker.sentinel.ponderated_2], ...
990,509
17889e614bdb603b1a2bf0c95caa8bc01bc37cf6
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-01-17 08:41 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('play', '0002_auto_20170113_0746'), ] operations = [ migrations.RenameField( ...
990,510
fc0feb262255448e81bbf8dbba894904456c995e
#!/usr/bin/python3 def number_keys(a_dictionary): ''' get number of keys in the dictionary ''' if not a_dictionary: return 0 return len(a_dictionary)
990,511
138d6c18ea9b9e64d1ce9830f6db4869ea76eb44
import matplotlib.pyplot as plt from transformers import BertTokenizer from imblearn.over_sampling import RandomOverSampler from sklearn.model_selection import train_test_split import numpy as np from sklearn.preprocessing import OneHotEncoder import pandas as pd tokenizer = BertTokenizer.from_pretrained('bert-base-c...
990,512
7a32f70a265578eb1d6f635da0391c2a2acae96f
"""Tests for sktime custom model flavor.""" import os from pathlib import Path from unittest import mock import boto3 import flavor import moto import numpy as np import pandas as pd import pytest from botocore.config import Config from sktime.datasets import load_airline, load_longley from sktime.datatypes import co...
990,513
52f61729420fb069b371453265a84e5f9c0e3508
# usage: python3 airpurifier.py IP TOKEN # dependency: python-miio import miio import sys import time airpurifier = miio.airpurifier.AirPurifier(sys.argv[1], sys.argv[2]) status = airpurifier.status() data = status.data def print_data(key): print('miio,device=airpurifier,ip={} {}={} {}'.format(sys.argv[1], key, ...
990,514
488b6acf374346fe4921bfb0a927accab161cfdb
import numpy as np import keras import cv2 import copy import os from imgaug import augmenters as iaa from sklearn.preprocessing import LabelEncoder from postprocessing import interval_overlap BASE_DIR = os.path.dirname(__file__) IMAGES_DIR = os.path.join(BASE_DIR, 'dataset', 'images') def bbox_iou(box1, box2): ...
990,515
bbbfac08d40e81b5d9a162a9fd4c2f14ec7e93ad
import argparse from estimator import run parser = argparse.ArgumentParser() parser.add_argument("mode") parser.add_argument("base_path") parser.add_argument("model_dir") parser.add_argument("-B", "--batch_size", type=int, default=128) parser.add_argument("-L", "--learning_rate"...
990,516
1cfd364d532058e12daddc0f2e5036592cd86e56
""" BITalino API Created on Tue Jun 25 2013 @author: Priscila Alves Adapted on Wed 18 Dec 2013 for Raspberry Pi @author: Jose Guerreiro """ import BITalinoPi try: #example device = BITalinoPi.BITalino() SamplingRate = 10 nSamples = 10 device.open(SamplingRate) BITversion = device.version() print "version...
990,517
060e655408dbe78e76296579f4b1cfcb4351ac55
#!/usr/bin/env python """ Generates TOD pickle file. """ import argparse import glob import os from atl02v.tod.tod import TOD from atl02v.shared.paths import path_to_data, path_to_outputs from atl02v.shared.tools import make_file_dir, pickle_in from gen_tof import get_size def generate(path_in, atl01_file=None, anc...
990,518
d7cff9228acb56feb513a36c2511e5b926101357
from pyramid.response import Response # noqa from pyramid.view import view_config from collections import OrderedDict @view_config(route_name='home', renderer='json') def home_view(request): hello = OrderedDict() hello['message'] = ( 'Hello. some day, this page will be a pretty HTML document. ' ...
990,519
3e0f100e843dfdb47f981d73a2bac402ab3b928b
# 9095 - 1, 2, 3 더하기(다이나믹 프로그래밍) def int_input(): return int(input()) def ints_input(): for d in input().split(' '): yield int(d) def main(): cnt = int_input() dp = [0] * 11 dp[1] = 1 dp[2] = 2 dp[3] = 4 for i in range(4, 11): dp[i] = dp[i - 1] + dp[i - 2] + dp[i ...
990,520
5f6ede504f5a33148f4c12210e024d931cd12a09
import importlib import tensorflow as tf import kaleido as kld import numpy as np ##### TESTER class Tester( kld.Algorithm ): ### __INIT__ def __init__( self , args ): self.preInit() self.args = args self.sess = tf.Session() self.load_network() args.image_test = kld....
990,521
2c7d85845c8a3ee5814978f27138c910cb67c406
__all__ = [ "read_IGRF13_COF", "read_IGRF13coeffs", "read_WMM", "read_fortran_DATA", "read_gauss_coeff", "read_WWW_test_2020", ] def read_gauss_coeff(file=None): '''Reads the tabulated Gauss coefficients Arguments: file (string): name of the file must be ...
990,522
effafadf4d8596895464cd965c147ce466061154
# coding=utf-8 from django.conf.urls import patterns, url urlpatterns = patterns( 'app.contents.views', url(regex='^articles/list$', view='list_articles', name=u'list_articles'), url(regex='^articles/new$', view='new_article', name=u'new_article'), url(regex='^articles/edit/(?P<id>\d+)$', view='edit_ar...
990,523
1603e64203aa15f6dbd4227f9ac329e3f85f8335
#!/usr/bin/env python # Adds stat uncertainty to json file output from combineTool.py -M Impacts import json from argparse import ArgumentParser from ROOT import TFile parser = ArgumentParser() parser.add_argument("-j", "--json", help="input json file") parser.add_argument("-s", "--statF", default="higgsCombine_param...
990,524
ef7f6d206e65a5af46e6f39db6b0ab761f1e880a
""" 见 day13天的案例中测试 """
990,525
49cea5865de2a8cfe1d24cd6bbd85b4a79cc2618
# -*- coding: utf-8 -*- from email.policy import default from odoo import models, fields, api class CabinetPatientPartner(models.Model): _inherit = 'res.partner' l_name = fields.Char('Last Name') date_naissance = fields.Date('Date de naissance') sexe = fields.Selection([('male', 'Male'), ('female',...
990,526
ebfc2b0feb768d3ec6354a6aac33be78b8fe1eab
#!/usr/bin/env python ''' A helper script to extract regions from LRW with dlib. Mouth ROIs are fixed based on median mouth region across 29 frames. @author Peratham Wiriyathammabhum @date Jan 10, 2020 ''' import argparse import os, os.path import sys import glob import errno import pickle import math import time imp...
990,527
75f63351a6855714681ba7259d1c2120d63775f8
#!flask/bin/python import numpy as np import os import sqlite3 from flask import Flask, jsonify, request, g from sklearn.externals import joblib # Configs DATABASE = 'iris.db' DEBUG = True SECRET_KEY = 'my predictive api' USERNAME = 'admin' PASSWORD = 'default' # Create App app = Flask(__name__) app.config.from_obj...
990,528
99afbf7ff25cf560fd60764229cccbef7e4d7e86
from ansys.dpf.core import Model from ansys.dpf.core import check_version from ansys.dpf.core import errors as dpf_errors import pytest def test_get_server_version(multishells): model = Model(multishells) server = model._server # version without specifying server version_blank = check_version.get_serv...
990,529
0f8eb26846afd65415da0baa4bfafe7188417479
def check_if_palindrome(): string_to_check = str(input("Please enter your word/phrase to ckeck if it's a palindrome : \n")) reverse = string_to_check[::-1] # method2 if string_to_check.lower() == reverse: print("Your string {} is a palindrome! ".format(string_to_check)) else: print...
990,530
6aa17f659f8bb0b5df20ac73e134a2043544acb4
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="multiquery", packages=setuptools.find_packages(), install_requires=[ "psutil", "coloredlogs" ], entry_points={ "console_scripts": [ "multiquery = multiq...
990,531
7554f1b0e446b40280b12004d18fcf9583dd4076
import os import os.path import json import sys from ctypes import * import os import functools import thread import array from ctypes import * import os import os.path import re import shutil import time, datetime import fileinput; s = os.sep root = "./" songs = None; preKey = "g_stsj_"; # resFile = open("default.r...
990,532
e404265ef11c001e01cd5a22e94016326c8e5b70
# Communication module to the DataCenter AC rotator. # William Schoenell <william@iaa.es> - Aug 16, 2014 import argparse import urllib import csv import sys import time import datetime import numpy as np class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' ...
990,533
7b9f7dbbd405ad1f29d883f1d2bca02063c2751d
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Nov 23 11:07:33 2020 @author: aaronberlow """ #linked lists import random class Node: def __init__(self, data=None, next=None): self.data = data self.next = next def print_node(self): print(self.data) class L...
990,534
fe0bcce8fe4256d93f01c51726f084ae6002d7a0
# # S.E.P.I.A. account handling # by Florian Quirin # import sys import requests import json import getpass import argparse try: from .storage import Storage except ValueError: raise ValueError("Please use 'python -m sepia.account' (from outside the 'account.py' folder) to start the main function of this mod...
990,535
a4de7e33eee4e538b9bfc4027cbfb7795a18e3d8
#sys.path.append('C:\Users\Enrique Cruz\Documents\Columbia\Scalper') from research import location_settings #COUNTRY URLS base_uk = 'http://www.ticketmaster.co.uk' base_us = 'http://www.ticketmaster.com' base_ca = 'http://www.ticketmaster.ca' base_ir = 'http://www.ticketmaster.ie' base_au = 'http://www.ticketmaster.co...
990,536
524df03c3358cabdf3036c9a1614cd423642d05d
frase1 = input().lower().strip().replace(" ","").replace(".", "").replace("!","").replace("?","").replace(",","") frase2 = input().lower().strip().replace(" ","").replace(".", "").replace("!","").replace("?","").replace(",","") letras1 = [] letras2 = [] for letra0 in frase1: letras1.append(letra0) for letra1 in fra...
990,537
219c3ca5fd5c7011670e8dd6ba9d802b9df034cb
from topics import QAgiSubscriber from packages import get_pkg_dir_from_prefix, \ get_ros_workspace_dir, \ get_ros_workspace_src_dir, \ QAgiPackages from resources import QAgiResources, \ loadRsc, loadRes
990,538
79b09b62c38a97b9a1cc61f83d3adacd29fb76b1
### Fastai v2 training script # built on fastai v2.2.2 # testing to see how the presets compare to my hand tuning ## So this is training better than my pytorch lightning... from fastai.vision.all import * path = '../cv_data/cifar10' ### Setup Image transforms item_transforms = [ToTensor, Resize(size=(300,300)), ...
990,539
9e5345a7e94a7cc79077e238cbf91d1692f27902
from application import db from datetime import date, datetime, timedelta from application.admin.models import Settings class SpareKey(db.Model): id = db.Column(db.Integer, primary_key=True) branch = db.Column(db.String(32), nullable=False) loan_no = db.Column(db.String(32), nullable=False) name = db...
990,540
5ad8c6b4ea22345b5d2bae67062177a958f26ab7
#ASSIGNMENT - CLASSES AND OBJECTS #question-1 class circle: def __init__(self, r): self.radius = r def getArea(self): return(3.14*self.radius*self.radius) def getCircumference(self): return(2*3.14*self.radius) r=int(input("enter radius")) c=circle(r) print("area is ",c.get...
990,541
35f8581a47ee12a18c0c860deef0faa7988bd463
cars = 100 space_in_car = 4.0 drivers = 30 passengers = 90 cars_not_driven = cars - drivers cars_driven = drivers carpool_capacity = cars_driven * space_in_car average_passengers_per_car = passengers/cars_driven print('There are', cars,'cars available.') print('There are only', drivers,'drivers available.') print('The...
990,542
ff54cf5b63baff575025f41d7a67faf457e79471
""" API __init__.py ~~~~~~~~~~~~ This file contains the initialization code for the API. :copyright: 2019 Moodify (High-Mood) :authors: "Stan van den Broek", "Mitchell van den Bulk", "Mo Diallo", "Arthur van Eeden", "Elijah Erven", ...
990,543
2fcb084d8431c9660470e34c7627ff789681ce68
class Persona(): #constructor, se crea el objeto def __init__(self, nombre, apellido): self.nombre = nombre; self.apellido = apellido; print("El objeto {} {} ha sido creado".format(self.nombre, self.apellido)); #convierte a cadena de texto def __str__(self): return "El ...
990,544
f0884a453b31909e22db44e38fe2ebeab0cad645
from rest_framework import serializers from bangazon_ultra.models import * class ProductTypeSerializer(serializers.HyperlinkedModelSerializer): ''' The CategorySerializer class translates the Category models into other formats, in this case JSON by default. that Category table so a database can be created from it....
990,545
08b826a2f95dc9aa89a056ecd78da4ea386c06c9
from django.contrib import admin from .models import * @admin.register(User) class searchUser(admin.ModelAdmin): search_fields = ('ticket_code',) # admin.site.register([User, searchUser]) admin.site.register(Event) admin.site.register(Admin)
990,546
15ca845b359d921a96c40028ef2221dba15363c9
def nojobsrunning(user): '''does the user have any jobs active on Condor? ''' from subprocess import check_output check = check_output(['condor_q {}'.format(user)], shell=True).split('\n')[-2] return True if '0 jobs; 0 completed, 0 removed, 0 idle, 0 running, 0 held, 0 suspended' in check else False...
990,547
96795ba97c7380d1e3e6b0503a89cabdc59656e6
1-re: import re from chp1.advanced_link_crawler import download url = 'http://example.webscraping.com/places/default/view/Aland-Islands-2' html = download(url) #type(html)为<class 'str'> #urlopen(url).read()得到的是bytes-like object,正则表达式的string模式不适用该对象 #urlopen(url).read().decode('utf-8')即为<class 'str'>,可用正则表达式匹配 print(r...
990,548
df597c26779a2b5744e4e8959734a22991a773c2
#!/usr/bin/env python # # GrovePi Example for using the Grove - Barometer (High-Accuracy)(http://www.seeedstudio.com/depot/Grove-Barometer-HighAccuracy-p-1865.html # # The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi # # Have a que...
990,549
f86d56beb8737dc918b85bb0d7af42f111ae7be5
import pickle import matplotlib.pyplot as plt import numpy as np import os def IQ(adc_raw): adc_shape=np.shape(adc_raw) adc_raw=adc_raw.reshape(adc_shape[0]*2,2) adc_raw=adc_raw-np.mean(adc_raw) if(((adc_raw[0]>0)==[True,True]).all()): I_Qmask=[1,1] elif(((adc_raw[0]>0)==[True,False]).all...
990,550
c16f40ecdf1ccd2a2c4fefe6cd41d060fe246ef6
''' Calls the GUI for jet tracking. Ultimately only this file should need to be run, and the GUI will control when the jet tracking methods e.g. calibrate(), jet_detect(), etc should be run ''' from qtpy.QtCore import QThread from pydm import Display import jt_utils import jet_control from time import sleep class T...
990,551
b05c0cb05e2ba610cc798ab1d6239c87e79079ce
## engine.py ################################################################### ## core game engine stuff ###################################################### ################################################################################ class voidEngine: def __init__(): #foooo self.gameObjects = [];
990,552
ecc86c2df056f09cd009772c960584bf022536fd
import xml.etree.ElementTree as etree with open("table-input.htm", "r") as f: read_data = f.read() print ("File content:") print(read_data) tree = etree.fromstring(read_data) with open("table-input.csv", "w") as f: for amt, unit, item in tree.getiterator('tr'): print("%s,%s,%s" % (amt.text, u...
990,553
f200f13b3815ae7f817bcac14fb2b0fc6b7ee3ac
#!/usr/bin/env python # -*- coding:utf-8 -*- # author: wangfp time:2017/11/4 MONGO_URL = 'localhost' MONGO_DB = 'taobao' MONGO_TABLE = 'meishi' # 查看官网获得命令行参数信息 SERVICE_ARGS = ['--load-images=false', '--disk-cache=true'] # 注意同时修改表名 KEYWORD = '美食'
990,554
1005361f5020fc6b3220c77b18e45f7a8a19e964
from os import environ from collections import OrderedDict import sys class SetupExample: def __init__(self, help=None): self.required_vars = OrderedDict() self.optional_vars = OrderedDict() self.help = help def required_var(self, var, desc): self.required_vars[var] = desc ...
990,555
20e51ef6186f6775f054a15bd4c790a5af054b26
# -*- coding: utf-8 -*- # file: asgcn.py # author: <gene_zhangchen@163.com> # Copyright (C) 2020. All Rights Reserved. import math import torch import torch.nn as nn import torch.nn.functional as F from layers.dynamic_rnn import DynamicLSTM class GraphConvolution(nn.Module): """ Simple GCN layer, similar to ...
990,556
678c890f6fe48638742b2ec308f22100b69233a1
import itertools from colorama import Fore,Back,Style,init init() def win(current_game): def all_same(l): if l.count(l[0]) == len(l) and l[0] != 0: return True else: return False for row in game: #print(row) if all_same(row): prin...
990,557
dcb244c310d8948936efd55a43b43a1f230ce658
import pygame import random import time pygame.init() white = (255, 255, 255) black = (0, 0, 0) red = (255, 0, 0) green = (0, 128, 0) chrome_white = (232, 231, 226) masala = (87, 86, 84) redoxide = (106, 27, 27) font1 = pygame.font.SysFont(None, 35) font2 = pygame.font.SysFont(None, 35) display_width = 1024 display...
990,558
c8f41d823d202d6ec7003a10e75cd0d92f386b07
## import numpy as np import patsy import scipy import statsmodels.api as sm ## def predict(L, formula, data, level=0.95, interval="prediction", model_matrix = False): """ L is either a model matrix or a data frame of the same structure like the data argument. formula and data describe the model. ...
990,559
e2d799c7d21df1c1a27cc3bd90cde1c9b276908b
class Solution(object): def topKFrequent(self, nums, k): hash_dict = dict() lst = list() for num in nums: hash_dict[num] = hash_dict.get(num, 0) + 1 for key,val in hash_dict.iteritems(): lst.append((val, key)) lst.sort(reverse=True) res = list(...
990,560
b63e8dcf8f3456f87ca250abb7fb0f1372091b6b
""" Test crosss platform terminal color https://pypi.python.org/pypi/colorama """ import colorama colorama.init() from colorama import Fore, Back, Style print(Fore.RED + 'some red text') print(Back.GREEN + 'and with a green background') print(Style.DIM + 'and in dim text') print(Fore.RESET + Back.RESET + Style.RESE...
990,561
46a39f1a7dd8eb640ccee346681621b56b3a28e5
def get_dict(filename='../data/pku_training_words.utf8'): """读取字典""" d = {} d['_t_'] = 0.0 with open(filename, "r") as f: for line in f: word = line.split('\n')[0] d['_t_'] += 1 d[word] = 1 return d d = get_dict() def build_graph(s, big_dict): l = le...
990,562
37dea98c4a50738111f13c066ee69cb14d8b9992
# Livro...: Introdução a Python com Aplicações de Sistemas Operacionais # Capítulo: 07 # Questão.: Exercício Proposto 4 # Autor...: Emanuel Lázaro # Data....: 29/10/2019 from MinhasFuncoes import * linhas = int(input('Informe a quantidade de linhas da matriz: ')) colunas = int(input('Informe a quantidade de colunas d...
990,563
66361878e5d44608b87302605b53724fe94e1bff
from __future__ import division import torch import math import random try: import accimage except ImportError: accimage = None import numpy as np import numbers from PIL import Image, ImageOps, ImageEnhance import collections import scipy.ndimage.interpolation as itpl import scipy.misc as misc import types imp...
990,564
1ce5c6c24162c1b07ebc8dc7bf7564954969de59
import re import logging import string import random import inspect import functools import threading from django.db import models from django.core.cache import cache _format_re = re.compile('%[^%]') __all__ = ('cachelib',) class CacheLibrary(threading.local): cache_keys = None chars = string.lowercase + s...
990,565
f3c6c4f363408b4d5f0cd7d520e43fe5ee48a2d4
from django.shortcuts import render from wisata.models import Wisata from news.models import News, Agenda from gallery.models import Video # Create your views here. def index(request): news = News.objects.order_by('-created')[:2] wisata = Wisata.objects.order_by('-created')[:2] agenda = Agenda.objects.filter(avail...
990,566
fd1914d7b465350145af05ea0975c2158438abe2
import random from TestManager import TestManager from TestingWay import TestingWay from TestingWay1 import TestingWay1 from TestingWay2 import TestingWay2 import Tkinter import time import tkMessageBox from TestingWay import TestingWay class TestWindow(Tkinter.Tk): def __init__(self,parent): Tkinter.Tk....
990,567
38894a076252c9aedd57ff7596d978c0fd64d724
gender=(input("enter the gender")) age=int(input("enter the age")) print(gender,age) if(gender=='F'): print("She will work only in urban areas") elif(20<age<40): print("he may work anywhere") elif(40<age<60): print("he will work only in urban areas") else: print("error")
990,568
9a53f22d874f81a4d9456cc1c4fa3453d82978ab
import numpy as np import random from collections import namedtuple, deque from memory import ReplayMemory, PrioritizedReplayMemory from model import QNet, DuelingQNet import torch import torch.nn.functional as F import torch.optim as optim device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") cla...
990,569
bee70e1b325b67699ae0733fcce9a3929ed59791
#!/usr/bin/env python # -*- coding: UTF-8 -*- from __future__ import division from fileparser import FileParser def repl(s, i, char): assert i < len(s) return s[:i] + char + s[i+1:] def solve(c_str, j_str): all_c = [""] all_j = [""] for i, (c, j) in enumerate(zip(c_str, j_str)): if c ==...
990,570
1c76a97da71e128a47a1a64611acc956840383c1
import os import secrets import discord import yaml from marshmallow.core.utilities.data_processing import user_avatar from .item_object import RawItem, CookedItem from .properties import rarity_names, item_colors, item_icons class ItemCore(object): def __init__(self, item_directory): self.base_dir = it...
990,571
c1818d2df9943213cdfae57674d14428995405ec
import random # DEFINE THE FUNCTIONS # 1. chatbot def chatbot(): print("Hello. I'm Chatbot. ") user_name = get_name() user_mood_response = get_mood(user_name) print(user_mood_response) if user_mood_response == "Sorry to hear that.": print(therapist()) else: random_question() ...
990,572
711edfbbf84cb8d29bbd63d6403b1e5197db263d
# Generated by Django 2.0.4 on 2018-05-04 16:41 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('downloads', '0002_auto_20180430_1025'), ] operations = [ migrations.AddField( model_name='files', name='download_url...
990,573
eb10a515a4132f0654be32eead1f7584eff32f33
import re def is_phone_number_valid(phone_number): """ This function returns whether a given number is a valid phone number or not. All valid: International Numbers +905422672332 1 800 5551212 0543 555 1212 5425551212 18005551212 +1800 555 1212 extension65432 800 55...
990,574
414b853debfe5b22afd40d131c27fd488bde999f
class Node(): def __init__(self,value): self.value = value self.next = None class Stack (): def __init__(self): self.top = None self.bottom = None self.length = 0 def peek(self): return self.top def push (self,value): newItem = Node(value) ...
990,575
34a2c8e032073131fdb32d5ae4578d2ef6738abc
import argparse import csv from apiclient.discovery import build from oauth2client.service_account import ServiceAccountCredentials import httplib2 from oauth2client import client from oauth2client import file from oauth2client import tools import creds #credentials file SCOPES = ['https://www.googleapis.com/auth/an...
990,576
c4efba8854dc93d3f0e87505417023134055a6fa
## Linear Stability of a Barotropic QG Vortex # This is an attempted re-write of the code # qg_BTvortex_stab_SpecFD_loop. # provided by Francis. import timeit import scipy import time import sys import argparse import scipy.sparse as sp import scipy.linalg as spalg import numpy as np import numpy.linalg as nlg im...
990,577
d6f0dd5c587a5205dc3e3b19517b90443f991d4e
#coding=utf-8 from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains#######鼠标事件的类 import time from selenium.webdriver.common.desired_capabilities import DesiredCapabilities driver=webdriver.Remote(desired_capabilities=DesiredCapabilities.CHROME) driver.get('http://www.baidu.com...
990,578
02f76ae07d4bb429bf6a8319cce2aba0cb80ef58
# Filename: compute_bmi.py # Author: Thng Jing Xiong # Created: 20130121 # Modified: 20130121 # Description: Program to get user weight and height and # calculate body mass index (BMI) # main # prompt and get weight weight = int(input("Enter weight in kg:")) # prompt and get height height = float(input("Enter heigh...
990,579
408e375db7e4e6367ff2ec5fae56b96f40b8dd0b
import solaris roof_gt = '/data/buildchange/v2/xian_fine/xian_fine_roof_gt.csv' footprint_gt = '/data/buildchange/v2/xian_fine/xian_fine_footprint_gt.csv' roof_pred = '/home/jwwangchn/Documents/100-Work/170-Codes/aidet/results/buildchange/bc_v014_mask_rcnn_hrnetv2p_w32_v2_roof_trainval/result_roof.csv' footprint_pred...
990,580
f1467045593ca351f4b4015b706487217e1b04f2
class Solution: def count_and_say(self, n): """ Idea: https://discuss.leetcode.com/topic/28084/simple-python-solution Time: O(mn) where n is the num till which we calculate the sequence and m is the max length we perform n steps and on each step you iterate over the length of the...
990,581
94194425eeb77d1e6c42248574b4bd3c9bc16f02
from django.conf.urls import url from .views import * urlpatterns = [ url(r'^$', BanListView.as_view(), name='ban-list'), url(r'^(?P<id>\d+)/$', BanDetailView.as_view(), name='ban-detail'), url(r'^(?P<id>\d+)/edit/$', BanEditView.as_view(), name='ban-edit'), url(r'^(?P<id>\d+)/lift/$', BanLiftView.as_...
990,582
e5c4d46284a05c4140bc081e5001ea03d72af446
import sys sys.path.append('./LowerMachine') sys.path.append('./Vehicle') from LowerMachine import UpperMachine from Vehicle import VehicleData_add import FuzzyInfrerence import TrustInfernce import time import datetime def TheardMain(): ''' 主线程,不断循环,完成传感器控制和推理机的控制 ''' # 先声明一个对象 my_upper_machin...
990,583
a6ea4887db7b52f9934a403d738f74f3ae000cbd
import sys import json from math import floor import spotipy import spotipy.util as util keys = json.load(open('keys.json')) username = '' scope = 'playlist-modify-public user-top-read' token = util.prompt_for_user_token(username, scope, client_id=keys['client_id'], client_secret=keys['client_secret'], redi...
990,584
c7d990ce355d302b1f99be76137bc89414ea1570
# -*- coding: utf-8 -*- """ Created on Fri Oct 10 09:18:53 2014 @author: Greg """ import argparse import os from Bio import SeqIO parser = argparse.ArgumentParser() parser.add_argument('infile', type = str) parser.add_argument('size', type = float, help="Size in GB") args = parser.parse_args() filename = os.path.spl...
990,585
31cac69b2ea612e27d1d28ddf0fa848aca24e639
# Generated by Django 3.1 on 2020-08-16 22:08 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('temperaturas_rf', '0001_initial'), ] operations = [ migrations.AlterField( model_name='sensor', name='battery_low', ...
990,586
0467660ebb0bb8699511322c96913410af73adec
from datetime import date from factory import SubFactory from iati.transaction.models import Transaction from iati.transaction.models import TransactionType from iati.factory.iati_factory import NoDatabaseFactory from iati.factory.iati_factory import ActivityFactory class TransactionTypeFactory(NoDatabaseFactory): ...
990,587
3198b695ba5ec9caba21593fe61dea4d9826aa19
import math A,B,H,M = map(int,input().split()) t1 = (30*H+M/2)*math.pi/180 x1 = A*math.cos(t1) y1 = A*math.sin(t1) t2 = M*math.pi/30 x2 = B*math.cos(t2) y2 = B*math.sin(t2) d = ((x1-x2)**2+(y1-y2)**2)**0.5 print(d)
990,588
b60a13e54cffd44868a2bc92a363d9604fa933ca
import os import glob class FileUtils: @staticmethod def clean_directory(dir_path, ignore_pattern): files = glob.glob(dir_path) for file_ in files: if not ignore_pattern in file_: os.remove(file_) print('File removed {}'.format(file_)) @staticme...
990,589
75f1f52a9201db926f26b7e909055ae763cda132
# -*- coding: utf-8 -*- # Resource object code # # Created by: The Resource Compiler for PyQt5 (Qt v5.11.3) # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore qt_resource_data = b"\ \x00\x00\x02\xc0\ \x89\ \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ \x00\x00\x18\x...
990,590
cde1fc4fa1c8a3fc028218f34737874d383d0b57
# -*- encoding: utf-8 -*- import collections import datetime import heapq import re def count_urls(urls): top_five_urls = [] counter = collections.Counter(urls) for url, count in counter.most_common(5): top_five_urls.append(count) return top_five_urls def update_url_to_statsionary(d, url, ti...
990,591
75bc77c1a1331cbd52bb0efee5358146da9d80e8
from pico2d import * class Key: def __init__(self): self.image = load_image('sprite//key.PNG') def update(self): pass def draw(self): self.image.draw(1700, 50)
990,592
29c8f8e1d07fca6057bb6aa488bd6ddcafd186b5
from django.urls import path, re_path, include from .views import AbstractAPIview, AnnotatedAPIview, AbstractAPIDetail, AnnotatedAPIDetail # Wire up our API using automatic URL routing. # Additionally, we include login URLs for the browsable API. urlpatterns = [ path('abstracts/', AbstractAPIview.as_view(), name='...
990,593
b95b95d6c3c1e9cd6576eace276afa786889d8ea
from re import search from tabulate import tabulate from datetime import datetime class QRelease: """ QRelease: the MTC release class Args: args(list): the command line arguments. start(obj): a datetime object. Attributes: curRel(str): current release in YYYY.MM format. curShort(str): ...
990,594
9f3f9f7a02c7774469de7027de1e42f08e97de87
# Adnan Munawar # Testing Robot IO Loading with varying ROS Communication Load from dvrk import arm, psm, mtm, ecm import rospy from geometry_msgs.msg import PoseStamped import time from threading import Thread from cisst_msgs.msg import mtsIntervalStatistics as StatsMsg class stats(object): def __init__(self): ...
990,595
91ce51f6e148a97357418ea9033c205cac68ffba
import json import os from deep_regression.predict import Predict import pandas as pd import numpy as np from sklearn import preprocessing from deep_regression.data_helper import TrainData config_path = 'deep_regression/config.json' with open(os.path.join(os.path.abspath(os.path.dirname(os.getcwd())), config_path), "r...
990,596
c190071016ddcb5de9ef0d9ae26441281706d14f
# template for "Stopwatch: The Game" # define global variables import simplegui import random interval = 100 time = 0 position = [140,120] x = 0 y = 0 # define helper function format that converts time # in tenths of seconds into formatted string A:BC.D def format(t): minu = int(t // 600) if minu > 9: ...
990,597
3f7a992d446519fa959988d129e56c1b282360ad
from django.db import models from django.contrib.auth.models import User from django import forms from django.forms import ModelForm, ModelChoiceField from sorl.thumbnail import ImageField from django_summernote.widgets import SummernoteWidget ## MODELS ## class Profile(models.Model): user = models.ForeignKey(User) ...
990,598
8ec09ed647c8aa36b0146796fbe17dc5888630dc
from __future__ import division import os import csv import glob import math import numpy as np import pandas as pd from scipy.interpolate import interp1d import matplotlib.pyplot as plt # ---- PARAMETERS TO ADJUST ---- projectname = 'RoundSiO2FineTM' detectornumber = '2' # Component number for rsoft monitor filename ...
990,599
2f0a6ad0359e5c37562eec28e5b799e7882d20a5
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...