index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
999,800
ef9648d46abe5293c5f28d35cdab59f2cc91ec69
""" 2) Crie um classe Agenda que pode armazenar 10 pessoas e seja capas de realizar as seguintes operações: . void armazenaPessoa(String nome, int idade, float altura); . void removePessoa(String nome); . int buscaPessoa(String nome); // informa em que posição da agenda está a pessoa . void imprimeAge...
999,801
e1118acddb52844d9a6464bf136a349228abe485
from abstract_objects import BonusObject class ShrinkBonus(BonusObject): def __init__(self, x, y): super().__init__(x, y) def activate(self, game, paddle_flag=0): if paddle_flag == 1: game.paddle1.shrink() elif paddle_flag == 2: game.paddle2.shrink() el...
999,802
85afae55a2c026c24e3140057379a0a272370bc1
# stack abstract data type # # 5/9/2021 # @author Jack Hangen # # follows last in first out (LIFO)s class stack: datatype = "stack" def __init__ (self): self.stackWorking = [] self.top = -1 # adds a new item to the top of the stack. It needs the item and returns nothing. def push(sel...
999,803
01a40f126b9a84e550daee97d9e9b5511c531754
from rest_framework import permissions from rest_framework.views import APIView from .models import Contact from django.core.mail import send_mail from rest_framework.response import Response from .serializers import ContactSerializer class ContactCreateView(APIView): permission_classes = (permissions.AllowAny,) ...
999,804
02c903d86fe147a3cdb531da347037532127fa53
''' BobKaehms_1_4_7: Change pixels in an image. This example first changes the background, then mirrors in the X-axis, then the Y-axis This example uses matplotlib to manipulate the image at the pixel level. The next iteration will use the PIL Image library ''' from PIL import Image import matplotlib.pypl...
999,805
a504456348c575fb7ba16bd5d962f255d6f3d962
import requests import re ''' 利用正则来爬去猫眼电影 1. url: http://maoyan.com/board 2. 把电影信息尽可能多的拿下来 分析 1. 一个影片的内容是以dd开是的单元 2. 在单元内存在一部电影的所有信息 思路: 1. 利用re把dd内容都给找到 2. 对应找到的每一个dd,用re挨个查找需要的信息 方法就是三步走: 1. 把页面down下来 2. 提取出dd单元为单位的内容 3. 对每一个dd,进行单独信息提取 ''' # 1 下载页面内容 headers = { "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WO...
999,806
b47f52fad0bd88d9b45b47ba61e2e952046400d5
print("* "*5) for i in range(5): print(" "*4,end="") print("*") print("* "*3) """ * * * * * * * * * * * * * """
999,807
301b6107ba32904de00396c33d88a7fb33419011
MIN_LENGTH = 10 password = input("Enter Password: ") if len(password) >= MIN_LENGTH: print(len(password) * "*") else: print("password not long enough")
999,808
ddcd0c681c55cfb58adf43a72030a780d5e02bf7
from sklearn import cross_validation from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_selection import SelectPercentile, f_classif import text features_train , features_test, labels_train, labels_test = cross_validation.train_test_split(text.preload(), text.get_label(), test_size =...
999,809
0c61efb7f476ab567d4670dc0eb017e64c5d5f8c
""" Question was "Given a pattern and a string input - find if the string follows the same pattern and return 0 or 1. Examples: 1) Pattern : "abba", input: "redbluebluered" should return 1. 2) Pattern: "aaaa", input: "asdasdasdasd" should return 1. 3) Pattern: "aabb", input: "xyzabcxzyabc" should return...
999,810
951cc098e31ad03329157eb74b7c54d3079c7979
# Question 8 # Level 2 # # Question: # Write a program that accepts a comma separated sequence of words as input and prints the words in a # comma-separated sequence after sorting them alphabetically. # # Suppose the following input is supplied to the program: # without,hello,bag,world # Then, the output...
999,811
6d4e4c16078b1c37b4cc9b5212cee79cf11e8bc4
""" snapshot ======== This module implements the :class:`~pynbody.snapshot.SimSnap` class which manages and stores snapshot data. It also implements the :class:`~pynbody.snapshot.SubSnap` class (and relatives) which represent different views of an existing :class:`~pynbody.snapshot.SimSnap`. """ import copy import ...
999,812
b3e2bb0ecdefa0b9e80ba426cf8ee8c0a04ae479
from IntrinsicAnalysis.clustering.AC_model import ACModel def analyse_paragraphs(paragraphs): answer_pairs=[] ac = ACModel(None, None) results = ac.analyse_paragraphs(paragraphs) indicis = results['suspicious_parts'] for index in range(len(paragraphs)): answer_pairs.append((paragraphs[inde...
999,813
e653d1d6c38530e88698f957ab472df206a67e18
from django.contrib import admin from django.contrib.auth.admin import UserAdmin from .models import news from .models import workers from .models import CartItem from .models import Cars admin.site.register(news) admin.site.register(workers) admin.site.register(CartItem) admin.site.register(Cars)
999,814
8b4452a4c917d5b0080016b26a31152453af0353
#Uppgift 7 """ Vad är siffersumman av 2¹⁰⁰⁰? """ #Svar: 1366 siffersumma = 0 num = 2**1000 for number in str(num): siffersumma += int(number) print(siffersumma)
999,815
4083774fd41faf063d96540e986b5df8f437591e
import os import shutil BASE_URL = "https://ru.wikipedia.org" NESTED_LINK_REGEXP = "^/wiki/" INDEX_PATH = "output/index.json" TEXT_DOCUMENTS_PATH = "output/text_documents" LEMMATIZED_TEXTS_PATH = "output/lemmatized_texts" INVERTED_INDEX_PATH = "output/inverted_index.json" TF_IDF_PATH = "output/td-idf-calculation.json...
999,816
481fcbdb7cd7905992475cb7e9f4371dce5be643
from django.contrib import admin from .models import MusicInstrument # Register your models here. class MusicInstrumentAdmin(admin.ModelAdmin): model = MusicInstrument fieldsets= [ (None,{'fields':['MusicInstrument']}) ] admin.site.register(MusicInstrument,MusicInstrumentAdmin)
999,817
2314a48e6ce9acac943071b0b365380c6c164856
from django.contrib import admin from django.urls import path from blog.views import TopView, WorkView, BlogView, WorkDetailView, BlogDetailView, AboutView, CategoryListView, CategoryDetailView urlpatterns = [ path('', TopView.as_view(), name='top'), path('bloglist/', BlogView.as_view(), name='bloglist'), ...
999,818
f1987ee193dfb3de661869a51d2ebeac0af4c926
#! /usr/bin/env python # -*- coding: utf-8 -*- import sys import re import time import logging # semi-standard modules try: import pexpect except ImportError: sys.stderr.write("Module pexpect is not available. It can be downloaded from http://pexpect.sourceforge.net/\n") raise class telnet(object): de...
999,819
b218b53e0a559cf414fd71809ef7756ab7b61636
import os import torch from speech_command_classifier.trainer import Trainer from speech_command_classifier.data import (SpeechCommandDataset, collate_fn, ALL_LABELS) from speech_command_classifier.model import Model TRAIN_META ...
999,820
93147e70a60d3ff156698cca1013a074d22c323d
from sproc import sproc import numpy as np import time,sys t0 = time.time() verbose=False ctr=0 if 'verbose' in sys.argv: verbose=True # This loop test 1D and 2D array conversions. while 1: # Test 1D float array np_array = np.random.random(size=(1000000)).astype(np.float32) # geneate C++ vector ...
999,821
3e4e79c2689f92b4a7f1eccb1cf2cdebf62b0d98
# -*- coding: utf-8 -*- """ Created on Thu Jun 13 17:04:32 2019 @author: corra """ import pandas as pd import pyreadstat import pymongo from pymongo import MongoClient client = MongoClient('localhost', 27017) #--------- Import db from sav --------------------------------------- df_WV2, meta_WV2 = pyrea...
999,822
8f1a164cceb19ead679fd70d92dae4b639025f72
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 19 13:31:21 2018 @author: rgugg """ from numpy import ndarray import numpy as np import artacs.tools as tools import logging logger = logging.Logger(__name__) # %% class StepwiseRemover(): def __init__(self, fs=1000, freq=None, period_steps...
999,823
cac173dbf9d43b7c89577e8bf43395d51ca96e6d
/home/vikassharma/anaconda3/lib/python3.6/sre_constants.py
999,824
81a33e4651aa9f0b37208621e9d05520a1c3c042
import beeline import os from django.apps import AppConfig class HelloConfig(AppConfig): name = 'hello' def ready(self): beeline.init( # Get this via https://ui.honeycomb.io/account after signing up for Honeycomb writekey=os.environ.get("HONEYCOMB_API_KEY"), api_ho...
999,825
df37dab0f38d4294224fbef310e0d7d423983a29
import gpt_2_simple as gpt2 from torch.nn.functional import softmax from transformers import BertForNextSentencePrediction,BertTokenizer from qnautils import * from fetch_google import * import nltk nltk.download('vader_lexicon') from nltk.sentiment.vader import SentimentIntensityAnalyzer sid = SentimentIntensityAnalyz...
999,826
04e1064f7fbec8894e253bb3aa885da3f4900402
from tensorflow.examples.tutorials.mnist import input_data import numpy as np from sklearn.preprocessing import MinMaxScaler import tensorflow as tf import matplotlib.pylab as plt from tensorflow.contrib import rnn from sklearn.model_selection import train_test_split from pca import PCA import json import matplotlib.m...
999,827
6a17417533bb06a4780f99bd370bcb0c65c72df5
#!/usr/bin/python # Cut tree at given %id using an alignment import os, sys, time, glob from matchmaker.shmm_shmm_lib import * def kerf_already_completed(seed_id): """ Must be run from kerf results directory. """ # if .summary file does not exist, return False kerf_summary_filename = "kerf.summary" if no...
999,828
348ef8df0e27fe0aed5f558d7650f3c75a14b71d
from libcity.config import ConfigParser from libcity.data import get_dataset from libcity.utils import get_executor, get_model, get_logger from libcity.data.utils import generate_dataloader # from geopy import distance from math import radians, cos, sin, asin, sqrt import numpy as np import pickle from collections impo...
999,829
9842bd54bc0bbcb3c5b1a2c4a8f805d35556ab5e
#!/usr/bin/env python3 x=float(input('Enter the value of x:')) n=term=num=1 result=1.0 while n<=100: term*=x/n #这里term后的*是什么意思我还不清楚 result+=term n+=1 if term<0.0001: break print('No of Times={} and Sum={}'.format(n,result))
999,830
b5b469c162f653faeca55d5d5c1d03526362e914
from typing import Any, TypeVar from pathlib import Path import numpy as np import numpy.typing as npt _SCT = TypeVar("_SCT", bound=np.generic, covariant=True) class SubClass(np.ndarray[Any, np.dtype[_SCT]]): ... i8: np.int64 A: npt.NDArray[np.float64] B: SubClass[np.float64] C: list[int] def func(i: int, j: int,...
999,831
e231cae9783d4e62abaf0001f2a50371ae19bc0b
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on 19.01.2021 @author: Feliks Kiszkurno """ import joblib import os import settings import slopestabilityML import slopestabilitytools def run_classification(test_training, test_prediction, test_results, clf, clf_name, *, hyperparameters=False, batch_name=...
999,832
34b70abed22a57f1ef15e37f31387ae9f2e8eb81
"""Enables a more complex manipulation with Runs.""" from sacredboard.app.data import DataStorage class RunFacade: """Enables a more complex manipulation with Runs.""" def __init__(self, datastorage: DataStorage): self.datastorage = datastorage def delete_run(self, run_id): """ D...
999,833
54108f050a42741422285493e0b565160291a0e0
import os import pandas as pd import numpy as np import torch from torch.utils.data.dataset import Dataset class Dataset(object): def __init__(self, path, timesteps): self.data_path = path self.timesteps = timesteps self.train_data_raw = pd.read_excel(os.path.join(path, "hour_ahead/tr...
999,834
75262e0f3b11457043f0420de489125aa5cfb9a9
import argparse import signal import sys from src.bfs import BreadthFirstSearch from src.digraph import Digraph class SAP(object): def __init__(self, graph): self.graph = graph def _ancestor(self, v, w, bfs_v, bfs_w): ancestors = [] for x in range(self.graph.V): # TODO: iterate ove...
999,835
d87346980dfdc9be519036c951d13f74dd9586a3
import numpy as np import pandas as pd import os import cv2 from sklearn.model_selection import train_test_split # from keras.applications.vgg19 import VGG19 from keras.applications.resnet50 import ResNet50 from keras.optimizers import * from keras.preprocessing.image import ImageDataGenerator from keras.models import...
999,836
81d51a290d075e1608ce303e0d0c3f8a6f5e6178
from shock.handlers import InterSCity from shock.core import Shock import importlib import sys sck = Shock(InterSCity)
999,837
c6506cd0b3de7f1f649dec17ad5543ddb7f9ad23
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- # vim: set filetype=python: # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. EXPORTS.mozi...
999,838
0179a7c5871d7ae61ee5d657a5a79ac3172e526e
default_app_config = 'messages_app.apps.MessagesConfig'
999,839
c84a97446790a232b3e65ac281c5ead396eecbaf
import sys import re try: import polyinterface except ImportError: import pgc_interface as polyinterface from copy import deepcopy LOGGER = polyinterface.LOGGER modeMap = { 'off': 0, 'heat': 1, 'cool': 2, 'auto': 3 } climateMap = { 'away': 0, 'home': 1, 'sleep': 2, 'smart...
999,840
dbd1a272ec5d073dd7685945e5d8ed798287d899
from project.card.card import Card class CardRepository: def __init__(self): self.count = 0 self.cards = [] def add(self, card: Card): try: temp = [c for c in self.cards if c.name == card.name][0] raise ValueError(f"Card {card.name} already exists!") e...
999,841
e4de16f7ac887921969c02c0f312d6eae47b87b6
import serial import time def main(): ser = serial.Serial('/dev/ttyACM0', 115200) delay = 1 while 1: ask_arduino(ser, '2;', delay) # hello ask_arduino(ser, '3, Foobar;', delay) # echo ask_arduino(ser, '4;', delay) # get temp ask_arduino(ser, '5;', delay) # get stat...
999,842
87f32dd63699d6a347d6ff86322abc92c941c438
# Generated by Django 3.0.8 on 2020-12-18 10:34 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('processes', '0089_auto_20201218_1330'), ] operations = [ migrations.AddField( model_name='process_2_2', ...
999,843
0ea084b4e495b2a90916d77633d69748e6cb709b
from unittest import TestCase from day_one.part_two import get_location class TestTrackPath(TestCase): def test_track_path(self): current_orientation = 0, 1 current_position = 0, 0 directions = [('R', 8), ('R', 4), ('R', 4), ('R', 8)] self.assertEqual( (4, 0), ...
999,844
544b294a3da3f61dab2e56283ab4558a3adefa43
import unittest from rational import Rational class SamRationalMethods(unittest.TestCase): # Sam def test_zero(self): # test if zero times zero zero = Rational(0,1) new = zero*zero self.assertEqual(new.n, 0) self.assertEqual(new.d, 1) # Sam def test_neg(self): #mak...
999,845
14e4ee648d96bde40839dc3e4acc7d0b669e88d9
# -*- coding: utf-8 -*- """Random graph permutation functions.""" import random from typing import Optional from pybel import BELGraph from pybel.struct.pipeline import transformation __all__ = [ 'random_by_nodes', 'random_by_edges', 'shuffle_node_data', 'shuffle_relations', ] @transformation def ...
999,846
f6322c218b142049ad06402ae6adda82a510fcb4
''' Given two arrays A and B of equal size, the advantage of A with respect to B is the number of indices i for which A[i] > B[i]. Return any permutation of A that maximizes its advantage with respect to B. Example 1: Input: A = [2,7,11,15], B = [1,10,4,11] Output: [2,11,7,15] Example 2: Input: A = [12,24,8,32],...
999,847
4de230941425caedb4ce81c793b654f8099aeada
import random import unittest from utils.client import ServerTest class TestBasicFunctionality(ServerTest): def setUp(self): self.connect_to_server() # CON should give us an ID def test_con(self): self.send("CON\n") self.assertTrue(self.recv().startswith("OK ID ")) # CON is only valid as first operation d...
999,848
0b495d9418472d99ec927ab9cc0bff11ae92ece2
class Cat(): """ This docstring will discuss how to interact with our Cat class. Parameters: name: str laziness_level: int This holds how lazy the cat is on a scale of 1 to 10. location: str This holds where the cat is currently located at. """ def __in...
999,849
0dde7525014f2d1ae8f99779b835061768b422ad
import numpy as np def mse(target, y): """ Mean Square Error :param target: number of samples * 1, numpy array :param y: number of samples * 1, numpy array :return: score """ mse_score = ((target-y)**2).mean(axis=1) return mse_score[0]
999,850
68340b302f7c18fba483bc77a0ffaac4c73654a8
from time import sleep cidade = str(input('Informe o nome de uma cidade: ')).strip() print('Vamos verificar se a cidade digitada começa com o nome Santo...') sleep(5) if cidade[0] in 'Santo' and cidade.upper() or cidade.lower(): print('Sim') else: print('Não')
999,851
ab9ddff054e6a0fcaefb63dbb6ff4c989730b06a
import numpy as np import matplotlib.pyplot as plt from scipy.special import gamma from genetica import * N = 20 names = ["r_histograma.pdf", "p_histograma.pdf"] data = ["r_poblacion.dat", "p_poblacion.dat"] for i in range(N): expresion = Expresion() expresion.resuelve() r = expresion.rt[-1] p = expre...
999,852
7965f5ebccb2b787222d605a434b532547559740
from .vertex import Vertex from .player import Player class Settlement: def __init__(self, vertex, player): assert isinstance(vertex, Vertex) self.vertex = vertex assert isinstance(player, Player) self.player = player self.level = 1
999,853
c576c814afa89f278f4c4e9dd2fe0f4499cf55ff
import json import zmq import os import random import pickle import time import threading import requests from collections import deque, defaultdict import logging logging.basicConfig(level=logging.WARNING) from kazoo.client import KazooClient from zmq.eventloop import ioloop, zmqstream class Messager: def __i...
999,854
501e61dbe23128cb91315cb6044927788e534af6
import os, time, datetime import numpy as np from sklearn.neural_network import MLPClassifier as MLP from sklearn.model_selection import train_test_split as tts from sklearn.metrics import confusion_matrix as CM from sklearn.metrics import accuracy_score as AS from sklearn.multiclass import OneVsRestClassifier from sk...
999,855
93fb63a7e68e3e7451e65ed19c3b5ba4add23003
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('users', '0008_personajuridica_logo'), ('config', '0006_auto_20160307_1514'), ] operations = [ migrations.CreateModel...
999,856
6a76e20b4e296874b627719cfedc03311937bfba
class Solution: def countTexts(self, p: str) -> int: MOD = int(1e9+7) if not p: return 0 n = len(p) f = [0] * (n+50) f[0],f[1],f[2] = 1,1,2 for i in range(3,n+1): f[i] = (f[i-1]+f[i-2]+f[i-3]) % MOD g = [0] * (n+50) g[...
999,857
608b7cef728a512beb8ca7b18e30555ea70f3b25
#! /usr/bin/env python # coding=utf-8 #================================================================ # Copyright (C) 2018 * Ltd. All rights reserved. # # Editor : VIM # File name : train.py # Author : YunYang1994 # Created date: 2018-11-30 15:47:45 # Description : # #=========================...
999,858
ac0d587c2c49e198d5eb7e0df0f488ac05ba7b7b
def testes: pass
999,859
15d2b90fb843442863b438d5cdc1418763592d27
# -*- coding: utf-8 -*- """ Created on Wed Feb 19 21:33:53 2020 FUNCTION APPLICATIONS @author: David """ def introduction(firstName, lastName): print("Hello, my name is", firstName, lastName) introduction("Luke", "Skywalker") introduction("Jesse", "Quick") introduction("Clark", "Kent") print("*...
999,860
8534fbada7c190705272615f7e0b390bae651815
__author__ = 'yinjun' class Solution: """ @param A : a list of integers @param target : an integer to be searched @return : a list of length 2, [index1, index2] """ def searchRange(self, A, target): # write your code here length = len(A) start = 0 end = length -...
999,861
b1dc2f454a8c2f1a1902741efde068a7bb108ff5
import pandas as pd import numpy as np class MSDDataset: def __init__( self, path='data/YearPredictionMSD.txt', normalize=True, binarize=True, train_size=463715, shuffle=True ) -> None: self.path = path self.normalize = normalize self.bin...
999,862
e713a6de196f9b576d7874fda15918a397fae431
import pika import uuid import json from rabbit import Rabbit class RpcClient(object): def __init__(self, routing_key, host="localhost"): # routing_key - 'rpc_queue' self.routing_key = routing_key self.rabbit = Rabbit(host) # 队列名,随机 self.callback_queue_name = self.rabbit...
999,863
819d9d79aa5f7a72ed7f000bcb5685e5e59e178d
import os import random import requests from bs4 import BeautifulSoup from flask import Flask,jsonify,request app= Flask(__name__) @app.route('/') def hello(): return '여기는 챗봇 페이지 입니다.' @app.route('/keyboard') def keyboard(): keyboard ={ "type" : "buttons", "buttons" : ["메뉴", "로또", "고양이","영화"]} r...
999,864
23cc08c8f5fbc8ae6e9bd25b3b6ad31ed485500e
from django.conf.urls import include, url, patterns from vivsite import settings from vivs.views.Project import * project_url = [ url(r'^$', DashboardView.as_view(), name ='dashboard'), url(r'^about/$', AboutView.as_view(), name='about'), url(r'^works/$', WorksView.as_view(), name='works'), url(r'^con...
999,865
e69bbc017f2f031aee93ce116d17a09f55be7934
import math as m def queq(a, b=0, c=0): if b == 0: try: return m.sqrt(-c/a), m.sqrt(-c/a) except (ZeroDivisionError, ValueError): return 'No roots' elif c == 0: try: return -b/a except (ZeroDivisionError, ValueError): return 'No r...
999,866
83aded3f2a6dabbbdcc07b21de1d3c8c592f0d32
class Instructor: def __init__(self): self.__instructor_name = None self.__technology_skill = None self.__experience = None self.__avg_feedback = None def set_instructor_name(self, instructor_name): self.__instructor_name = instructor_name def get_instructor_name(se...
999,867
fb945f613cf4eed20b36f895247c2e1e80f0a9dc
from collections import deque from sys import maxsize class Node: def __init__(self, x=0, y=0, distance=0, parent=None, move=None): if parent: self.distance = parent.distance + 1 if move is 'up': self.x = parent.x self.y = parent.y - 1 el...
999,868
a9eaf03c592b6ce0e1cf8f165a7b7fa91d69bb6c
from collections import deque KEY = "3" TREASURE = "4" def find_dest(M, start, dest): q = deque() q.append(start) dirs = [(1, 0), (-1, 0), (0, 1), (0, -1)] steps = 0 visited = set() visited.add(start) while q: for i in range(len(q)): node = q.popleft() x, y ...
999,869
6f38920ac3ee8e2b9a4188e32a5127ede74d1f59
# -*- coding: utf-8 -*- import sys import time import random start_time = time.time() def bubbleSort(array): size = len(array) for i in range(size-1): for j in range(0, size-i-1): if array[j] > array[j+1]: array[j], array[j+1] = array[j+1], array[j] return array with o...
999,870
0fad64e46cdc5bdb34ead1634cdb653f5206d095
import sys sys.path.append(".") import my_module my_module.test(execution,x,a,b,c,d,e)
999,871
ae3ded9e29d7b0125c45f0ad5173c78f66c8d2ea
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @File : show_all_jobs.py @Time : 2021/09/03 11:17:09 @Author : Jeffrey Wang @Version : 1.0 @Contact : shwangjj@163.com @Desc : 回显当前运行全部任务示例 输出: [Every 10 minutes do job() (last run: [never], next run: 2021-09-03 11:29:03), Every 2 seconds do jo...
999,872
c2175414ec9526f3de9a3caae8917d00ab0875a6
from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, BooleanField, SubmitField, IntegerField from wtforms.validators import ValidationError, DataRequired, Email, EqualTo from app.models import Therapist, Patient, Intervention, Session class LoginForm(FlaskForm): username = StringField('U...
999,873
800efa47342b09f166476aaa626667472e70481e
#!/usr/bin/env python2 ''' Find the target from contour detection and the contours nesting. Usage: ./polarity_find.py <image> ''' import cv2 import cv import numpy as np import random import argparse from ptgrey import PTGreyCamera import flycapture2 as fc2 from time import time def show_img(img, wait=True, tit...
999,874
21ce4180a954503b27180f9f58d0349d61f1c1e4
# Generated by Django 3.1.3 on 2020-11-30 14:47 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Poll', fields=[ ('id', mode...
999,875
9dfaf1a9bc588467f4c3df73e7b90e6ddd35d5b8
from django.shortcuts import render, redirect, get_object_or_404 from accounts.forms import * from django.contrib.auth.models import User from accounts.models import * from home.models import * from django.contrib.auth.forms import UserChangeForm, PasswordChangeForm from django.contrib.auth import update_session_auth_h...
999,876
5922154c540e735c69ec884aebfc8d3fbab9af4b
Python 3.8.3 (v3.8.3:6f8c8320e9, May 13 2020, 16:29:34) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license()" for more information. >>> string1= "Hello" >>> string2="Everyone" >>> string1+string2 'HelloEveryone' >>> #Concatenation >>> string1-string2 Traceback (most recent call last...
999,877
9bb87049ecc7b2e6de95d442178265af881443bf
# -*- coding: utf-8 -*- from __future__ import division from calendar import monthrange from ConfigParser import RawConfigParser from datetime import datetime import argparse import time from pyspark import SparkConf from pyspark.ml.evaluation import BinaryClassificationEvaluator from pyspark.sql import functions as ...
999,878
694fa0b722385eeae3420eca2e2eb73f1b1a6619
from collections import deque import sys read = sys.stdin.readline n = int(read()) queue = deque(range(1,n+1)) while True : if len(queue) == 1: break queue.popleft() queue.append(queue.popleft()) print(queue[0])
999,879
f1b47b67541089b074a5199891ccf49f793fd7cc
import random class Carte: def __init__(self, valeur, nom): self.valeur = valeur self.nom = nom def pioche(carte) : carte = Carte(pioche[0].valeur, pioche[0].nom) del pioche[0] Ezmo1 = Carte(1, "Ezmo") Ezmo2 = Carte(1, "Ezmo") Ezmo3 = Carte(1, "Ezmo") Ezmo4 = Carte(1, "Ezmo") Bob1 = Carte(...
999,880
03b06944ac1fdae2cebeea1aadc296ff3b9ce0b1
#! python3 # coding: utf-8 import numpy as np import gensim from collections import OrderedDict from sklearn.decomposition import PCA def load_model(embeddings_file, fasttext=False): if fasttext: emb_model = gensim.models.fasttext.load_facebook_vectors(embeddings_file) # Определяем формат модели по е...
999,881
b202a93d7b0969ce11639b60a4902f22960c68a0
import numpy as np from scipy.interpolate import interp2d from sklearn.base import BaseEstimator, TransformerMixin # from skimage.feature import hog class Scaler(BaseEstimator, TransformerMixin): """This class will scale the data as: x = (x/a) - b""" def __init__(self, a=100, b=1): self.a = a ...
999,882
6c82588bd680eb33a4634737333b62431c6580e7
import math import random import numpy as np import csv np.seterr(all = 'ignore') #np.random.seed(0) def tanh(x): return np.tanh(x) # derivative for tanh sigmoid def dtanh(x): y = tanh(x) return 1 - y*y def softmax(x): e = [np.exp(ex - np.amax(ex)) for ex in x] out = [e1 / np.sum(e1) for e1 in e...
999,883
c42b60cdb82b3c4b693a2a89489e551a708107f3
from math import * from sklearn.cluster import KMeans from sklearn.linear_model import LinearRegression from sklearn import preprocessing import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib as mpl import folium import seaborn as sns from mpl_toolkits.mplot3d import Axes3D from sklea...
999,884
9e704d74cb3189c8963800665a0bba393d3083ae
import math import numpy as np #Cost Function Bi-objective # x = Solution variable # Ftype = ZDT problem option def ZDT(x, Ftype,pRound = 2): n = len(x) if Ftype == 1: f1 = x[0] g = 1 + 9* sum(x[1:]/(n-1)) h = 1- math.sqrt(f1/g) f2 = g*h elif Ftype == 2: ...
999,885
a18f051484be9df17d5db76723947a8bf9b288dd
# ****************************************************** # * Copyright © 2017-2023 - Jordan Irwin (AntumDeluge) * # ****************************************************** # * This software is licensed under the MIT license. * # * See: LICENSE.txt for details. * # ********************************...
999,886
a45f2c9415f81c7e09bb1ed16a64651f26391272
from __future__ import absolute_import from multipledispatch import Dispatcher # Main interface to execution; ties the following functions together execute = Dispatcher('execute') # Individual operation execution execute_node = Dispatcher('execute_node') # Compute from the top of the expression downward execute_fi...
999,887
a4fbb98901c72367dbcc94e3e145bc44412c83f2
def count_triplet(arr: [], n, k): arr = sorted(arr) count = 0 for i in range(0, n): value = k - arr[i] count = count + upper_bound_v2(arr[i + 1:], value, len(arr[i + 1:]) - 1) return count # Finding element count lesser than k using sliding window def upper_bound_v2(arr: [], value, n):...
999,888
0b56fdd46b988270c6714dc96b58d907d3bc3006
def add_to( v, to, G, color, sum_ins, sum_out, tot_mas, ver_wei): """ Add vertex to community v - vertex, that we want to add to - vertex, to which community we want to add v G - adjacency matrix color - labels color sum_ins - sum of edges inside community ...
999,889
0b44a59eabeeb3a1362953bcfdc3d35b256492de
#!/usr/bin/python3 # Author: Suzanna Sia # Standard imports #import random import numpy as np import pdb import math import os, sys # argparser #import argparse #from distutils.util import str2bool #argparser = argparser.ArgumentParser() #argparser.add_argument('--x', type=float, default=0) # Custom imports def con...
999,890
8ed814b4c13f55deb3a725b98761e5a813e32396
#!/usr/bin/env python import matplotlib matplotlib.use("Agg") import threading import matplotlib.pyplot as plt from scipy.spatial import cKDTree as KDTree import tf import rospy from message_filters import ApproximateTimeSynchronizer from message_filters import Cache, Subscriber from visualization_msgs.msg import Ma...
999,891
798b3016ea39031b489db417077bb2340d5a0a0f
''' Akond Rahman Nov 21 2018 Content Grabber for Chef Analysis ''' import os import shutil def getFileLines(file_para): file_lines = [] with open(file_para, 'rU') as log_fil: file_str = log_fil.read() file_lines = file_str.split('\n') file_lines = [x_ for x_ in file_lines if x_ != '\n...
999,892
3373e903201fb545dbc7b1b55572572982380b20
from BeautifulReport import BeautifulReport import time import unittest discover=unittest.defaultTestLoader.discover("../case","test_case.py") BeautifulReport(discover).report( description=u'自动化测试报告', filename=time.strftime("%Y-%m-%d %H_%M_%S") )
999,893
053b6fbe91b21179f49cbf2750679447e6186e46
# -*- coding: utf-8 -*- import scrapy from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.remote.remote_connection import LOGGER import logging import ...
999,894
099dd0d803946e1d053ed7b0aa8664bb3b098a0c
from ._leap import * from ._leapros import *
999,895
e3b1d264aca1460d021adb1aa80928da8c4b0f4f
from django.urls import path from . import views urlpatterns = [ path('', views.index, name='index'), path('bluefire/<str:color>/', views.picker, name='bluefire') ]
999,896
303dda4eda54e4940a392cb0e8103d1deb5449de
x = int(input()) z = int(input()) if z <= x: while z <= x: z = int(input()) if z > x: k = 0 soma = 0 while True: soma+= x+k k += 1 if soma > z: print(k) break else: print("0")
999,897
a42d9ba989db123e703e35d8d02ce6e78878bb23
import asyncio class AsyncHTTPHandler: ''' This is just to mimic the socketserver.TCPServer functionality ''' def __init__(self, writer): self.wfile = writer def send_response(self, status): self.wfile.write(f'HTTP/1.1 {status} OK\r\n'.encode()) def send_header(self, header, ...
999,898
3c1ab82d364f9d9ce83b3ca21ecc5efe2decc1c8
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import re, time, json, logging, hashlib, base64, asyncio from coroweb import get, post def check_admin(request): if request.__user__ is None or not request.__user__.admin: raise APIPermissionError() @get('/') async def index(*, page='1'): return { ...
999,899
2587d3f629f6107070698e02067ee8d12a51c61c
import os from datetime import datetime mod_time = os.stat('destination.loc.txt').st_mtime print(datetime.fromtimestamp(mod_time))