index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
998,600
d2c51f9398e7d184ba0b0addd04601961d328551
import numpy as np from collections import defaultdict from nn import Block, Vars, Dot, Softmax from vocab import Vocab from nn.utils import timeit VOCAB = """i would like some chinese food what about indian give me czech i like english food ok chong is a good place i have taj here go to hospoda tavern is not bad . ...
998,601
c587f328b21be869a5ef072622c9f4dfc2942530
f1,z=input().split() print(f1+z)
998,602
7e39d189ba2f83311b918c4e1bc5c04b1e98a897
import math import numpy as np from sklearn.model_selection import train_test_split import os def generateFormula1Values(): values = [] x = -1 while (x <= 1): x = round(x, 3) values.append(x) x += 0.002 return np.array(values) def generateFormula2Values(): values =[] x ...
998,603
a9298a1eb713ef5af695abbe1f84aa78b32d5f46
import math class Queue: def __init__(self, capacity): self.capacity = capacity self.storage = [None] * (self.capacity + 1) self.head = 0 self.tail = 0 def enqueue(self, x): if (self.head - self.tail) % len(self.storage) == self.capacity: raise Exception("Qu...
998,604
f63dc97cb43a94f83999e1c991f91730898e455b
# -*- coding: utf-8 -*- """ webpanda.jobs.forms ~~~~~~~~~~~~~~~~~~~~~~~ Jobs forms """ from webpanda.forms import RedirectForm from wtforms import IntegerField, StringField, BooleanField, SubmitField, HiddenField, TextAreaField, SelectField from wtforms import validators from wtforms.validators import Lengt...
998,605
9b92cfe96bd7c6b03d756c9fb0ee4fba087f359d
#!/usr/bin/env python # # The output of parallel_summarize_job.sh can be very verbose and difficult to # sift through to find jobs that were not correctly processed. This script # scrapes the combined stderr+stdout stream of parallel_summarize_job.sh and # highlights the darshan log file and error generated for jo...
998,606
961a7d92e9dc418cd5c72f4453f31fd47de25936
import numpy as np from embed.spectrum import spectrum_map from falkon import Falkon, kernels import torch from tqdm import tqdm def mmd(seq1=None, seq2=None, emb1=None, emb2=None, mean1=None, mean2=None, embedding='spectrum', kernel='linear', return_pvalue=False, progress=False, **kwargs): ''' Calculates MMD ...
998,607
c73fa600c5c1e275ba9b7e8e5beeb3969d24d6f7
from django.db import models class tImage(models.Model): name=models.CharField(max_length=30) data=models.CharField(max_length=350) img=models.ImageField(upload_to = './img') class Image(models.Model): img = models.ImageField(upload_to = './img') class Text(models.Model): text = models.CharField(max_length=102...
998,608
f749806b18d56ad6e6c1bf57cdbbd7feaf1985e4
k, n, w = map(int, input().split()) b = [i*k for i in range(1, w+1)] a = sum(b)-n if sum(b) > n: print(a) else: print(0)
998,609
1cc8b7d60587079e9e306274d784fc44f8f1a95b
import sys import os import KratosMultiphysics.KratosUnittest as KratosUnittest import test_helper class KratosGeoMechanicsElementTypeTests(KratosUnittest.TestCase): """ This class contains benchmark tests which are checked with the analytical solution """ def setUp(self): # Code here will be...
998,610
a3467e08ec49bd1bf69d7f174379fe036c27fbdf
a, r, n = map(int, input().split()) print(a * r ** (n - 1))
998,611
bdbca3b1cee54f9f910db2c294ac4574ee2465f0
from flask import Blueprint, render_template from .models import TODOS HelloApi = Blueprint('hello_api', __name__) tasks = TODOS.query.order_by((TODOS.due_date).asc()).all() @HelloApi.route('/<name>') def hello_user(name): return render_template('hello.html', user=name, tasks=tasks)
998,612
d894cabb566392b38c3d0166ec323223ea816135
# -*- coding: utf-8 -*- """ Created on Mon Feb 1 14:36:21 2021 @author: USER """ from mcpi.minecraft import Minecraft as mcs import time mc = mcs.create() while True: time.sleep(0.5) x,y,z = mc.player.getTilePos() mc.setBlock(x,y,z,46) mc.setBlock(x+1,y,z,152)
998,613
6aeb20d294b3eea42a45da783e696d9b99c1af3b
# -*- coding: utf-8 -*- """ @author: 陳柏劭 """ chi=int(input("國文:")) eng=int(input("英文:")) math=int(input("微積分:")) pe=int(input("體育:")) code=int(input("程式設計:")) avg=round((chi+eng+math+pe+code)/5,2) print("平均分數:"+str(avg)) dict1={chi:"國文",eng:"英文",math:"微積分",pe:"體育",code:"程式設計"} list1=[chi,eng,math,pe,code] mmm=max(list...
998,614
c06217c63dd9a7d955ae6f2545773486d84158b0
''' 4. Write a Python program to accept a filename from the user and print the extension of that. Sample filename : abc.java Output : java ''' file=input("Please enter a file full name: ") type=file.split(".") print("Your file type is: " + repr(type[-1]))
998,615
c13a4d01c36b7ef5c2a55822094ed2f2955e8916
from adk.adkplugin import ADKPlugin import os import logging class InitPlugin(ADKPlugin): def name(self): return "init" def describe(self): return "Bootstrap the environment" def run(self,appliance, settings): for directory in ["log_directory", "output_directory"...
998,616
41278aea992a4e1503ca559eb8eb917f986b123f
import numpy as np import time import imutils import cv2 face_cascade = cv2.CascadeClassifier('C:/Program Files/Python37/Lib/site-packages/cv2/data/haarcascade_frontalface_default.xml') low_cascade = cv2.CascadeClassifier('C:/Program Files/Python37/Lib/site-packages/cv2/data/haarcascade_lowerbody.xml') video = cv2.Vi...
998,617
531526065773954d044d4e1aafa9b831415e9d49
import os import tools import sad import feat def run_bic(attr): path = tools.set_path() sadname = attr['sad'] featname = attr['mfcc'] bicname = attr['bic'] command = '%s/sbic --segmentation=%s --label=speech %s %s' exe_cmd = command%(path['audioseg'],sadname,featname,bicname) os.system(exe...
998,618
b8c41f7f3a8821c87ab32f39966039257534bd37
from flask import Flask, render_template, request, Response, redirect import json from classes.Updater import Updater from classes.DI import DI from classes.Config import Config app = Flask(__name__) # pip install requests # pip install json-rpc @app.route('/bootstrap.css') def bootstrap_css(): f = open('css/boo...
998,619
4a90d79bf379b5d7d04dea6f73c7fc830cf80206
# -*- coding: utf-8 -*- """Color vision deficiency.""" from .. import algebra as alg from ..filters import Filter from ..types import Vector, Matrix from typing import Any, Optional, Dict, Tuple, Callable, TYPE_CHECKING if TYPE_CHECKING: # pragma: no cover from ..color import Color LRGB_TO_LMS = [ [0.1788240...
998,620
1266e9ad3afb8430c5ed0316d59ddc7e113b8a2d
# Dependencies from flask import Flask,render_template, request, jsonify import traceback import pandas as pd import numpy as np import sklearn import sys import pickle from models import nettoyage, trouve_journal from sklearn.feature_extraction.text import TfidfVectorizer app = Flask(__name__) @app.route('/', method...
998,621
f8926b8296fa58c39ce4621a9cc42063239cb0ff
#https://docs.aws.amazon.com/code-samples/latest/catalog/python-ec2-ec2_basics-ec2_setup.py.html import sys import boto3 from botocore.exceptions import ClientError import logging logger = logging.getLogger(__name__) # instantiation of the ec2 client ec2 = boto3.resource('ec2') def create_instance( ...
998,622
1a4ef0731fe8151b66fe07193f1109251162ed1c
import time import random from chatbot_utils.redict import ReDict import matplotlib.pyplot as plt random.seed(time.time()) def plot(xdata, ydata, xlabel=None, ylabel=None, legend=None): for y in ydata: plt.plot(xdata, y) if xlabel: plt.xlabel(xlabel) if ylabel: plt.ylabel(ylabel)...
998,623
9219074873b1a732562c6f3b02ede54e37991e04
i=3 j=5 sum=0 while i<1000: sum+=i i+=3 while j<1000: if j%3!=0: sum+=j j+=5 print(sum)
998,624
cb7105c03b6af352b8d823f4b534a818ec291458
######################################################## ######################################################## ############# Automated music for work ################# ######################################################## ######################################################## ##############################...
998,625
3192285e57aeb8cec16c78edc2e3312bf5f252c4
# Generated by Django 3.0.5 on 2020-08-07 07:04 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('pages', '0009_auto_20200806_2122'), ('pages', '0011_merge_20200807_1447'), ] operations = [ ]
998,626
5ac80c6af41c9ef9153628dbbb83638abb1cf62b
import os import csv import sys from filelock import Timeout, FileLock DATASET_NAME = 'echo-msk' curr_dir_path = os.path.dirname(os.path.realpath(__file__)) dataset_folder_path = os.path.join(curr_dir_path, DATASET_NAME+"-dataset/") def change_paths(find, replace): for item in os.listdir(dataset_folder_p...
998,627
802e6d40b5f1b1b305196a49ebb55b629e750550
import datetime import logging.config import binascii import json import re from os import linesep import argparse import psycopg2 from autobahn.twisted.websocket import ( WebSocketServerProtocol, WebSocketServerFactory, ) from twisted.protocols import basic from twisted.internet import stdio from config impo...
998,628
76472c7222898b8576d25858dba37342a21ae6cb
# -*- coding: utf-8 -*- """ Created on Tue Mar 16 15:08:32 2021 @author: dingxu """ import os listroute = [0 for i in range(22)] #https://nadc.china-vo.org/psp/csp/calibration/dark/-35c/20200204/ #listroute[0] = 'https://nadc.china-vo.org/psp/csp/2020CSP/20201122/AutoFlat20201122/' listroute[0] = 'https://nadc.chin...
998,629
f4a08702b6a25c2c191f8d1c7aa133e7e8016719
mod_type = "cover" nav1 = "" nav2 = "" nav3 = "" headline = "" background_image = "" text = ""
998,630
49c4ee60e360a88910e83196c1ec7e3021117564
from typing import TYPE_CHECKING from sqlalchemy import Column, Integer, String, ForeignKey from sqlalchemy.orm import relationship from app.db.base_class import Base from .search_category import Search_Category if TYPE_CHECKING: from .search_category import Search_Category # noqa: F401 class Cse(Base): i...
998,631
9db7d56b828f10c663f8441e76353e08c2e8307e
import boto3 from dotenv import load_dotenv import os load_dotenv() db_connection = boto3.client( 'dynamodb', aws_access_key_id=os.getenv('AWS_ACCESS_KEY_ID'), aws_secret_access_key=os.getenv('AWS_SECRET_ACCESS_KEY') ) tables = db_connection.list_tables()['TableNames'] ...
998,632
962b5f359a6ab494ba575d2415ad60a42d2234d3
from flask import Flask, render_template, request, redirect, session from flask import flash from flask_bcrypt import Bcrypt import re from mysqlconnection import connectToMySQL app = Flask(__name__) app.secret_key="Super secret!" bcrypt=Bcrypt(app) @app.route("/") def login_and_registration_page(): print("*"*80) ...
998,633
6ebaa53a27a37174851e7bc570aa3cac79d514d6
import turtle # Everything that comes after the # is a # comment. # It is a note to the person reading the code. # The computer ignores it. # Write your code below here... turtle.penup() #Pick up the pen so it doesn’t #draw turtle.goto(-200,-100) #Move the turtle to the #position (-200, -100) #o...
998,634
8a0868870a8c3e59955b06f742bad47ffc1f11d4
from .client import GrpcClient, default_grpc_retry_predicate from . import exceptions __all__ = ["GrpcClient", "default_grpc_retry_predicate", "exceptions"]
998,635
a65bf235da6fa89dde327f35a883999927db726f
from torchvision.datasets import VisionDataset class DatasetMemory(VisionDataset): """ Args: imgs (list of array)): List of images in the dataset transform (callable, optional): A function/transform that takes in a sample and returns a transformed version. E.g, ``transf...
998,636
7013a3d588b987e7878f585dc515c5bdd1dc3c1b
# Tai Sakuma <tai.sakuma@gmail.com> from ..misc import mkdir_p import os ##__________________________________________________________________|| class WritePandasDataFrameToFile: def __init__(self, outPath): self._outPath = outPath def deliver(self, results): if results is None: return ...
998,637
1e3fe9b964c4dbb2c0e1d6e73863b02064836cd2
import pytest from praw.exceptions import ClientException from praw.models import RemovalReason from ... import IntegrationTest class TestRemovalReason(IntegrationTest): def test__fetch(self, reddit): reddit.read_only = False subreddit = reddit.subreddit(pytest.placeholders.test_subreddit) ...
998,638
88ab9ceee12c1354662e64594301d32628283ac7
'''crie um programa que peça a usuário dois numeros e faça a soma''' print('insira dois numeros para fazer a soma') primeiroNumero = float(input('Digite o primeiro numero: ')) segundoNumero = float(input('Digite o segundo numero: ')) soma = float(primeiroNumero + segundoNumero) print(f'a soma entre {primeiroNumero} e...
998,639
a62fa3cc318ef9ca979812b2f5efbf20236ddbe4
################################################################ ################# Preprocessing for the FNM #################### ################################################################ ## ## ################################################################ ## so far, only works on models with a single f...
998,640
702b6afc44fe20c3bbeae700fdf3aec662dd923d
""" CP1404/CP5632 Practical File renaming and os examples """ import shutil import os import string # TODO: Fix this def main(): """Demo file renaming with the os module.""" print("Current directory is", os.getcwd()) os.chdir('Lyrics/Lyrics') for dir_name, dir_list, file_list in os.walk("."): ...
998,641
b2f3d65c6e6bb1c2f8a7f5c3da4f378e32a2a392
# I'm Yang. It's my first 2D game based on pygame. """ @author: Yang Zhou """ from Role import * pygame.init() # set screen screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT)) filename = 'image/shoot.png' plane_img = pygame.image.load(filename) ADDENEMY = pygame.USEREVENT + 1 pygame.time.set_timer(ADDE...
998,642
afcab117479b6d646285986541cd1217bf980e05
WHITE = "WHITE" BLACK = "BLACK" ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" SIZE = 8 IMAGE_SIZE = 100 from enum import Enum class Color(Enum): RED = (255,0,0) BLUE = (0,0,255) GRAY = (100,100,100) GREEN = (0,255,0) WHITE = (255,255,255) BLACK = (0,0,0) BROWN = (150, 75, 0) DARK_BROWN = (6...
998,643
9ef7f1b4d8e9b71136a65e9f50c51f2ef80ed14d
num1 = input("Enter a number: ") num2= input("Enter another decimal: ") result = int(num1) + float (num2) print (result) num3 = input("Enter a number: ") num4 = input("Enter a number: ") result= int(num3) + int(num4) print (result) num5 = input("Enter a decimal: ") num6 = input("Enter a decimal: ") ...
998,644
17e7aa04f4524509c516413de01b6013716a2fab
#!/usr/bin/env python import os import argparse as ap import pandas as pd from uc.batch import batch_process def main(): parser = ap.ArgumentParser(prog='ucmod', description='Batch tool for converting UC spectra to IR spectra.') # String valued arguments parser.add_argument('-s', '--spectra', ...
998,645
738c1a0d893fda11408cf750e1ca24ef8d4a99e3
import os import re import pytest from dazzler.system import Component, Aspect from . import spec_components as spec def test_simple_component(): # Sanity test. class SimpleComponent(Component): simple = Aspect() component = SimpleComponent({'simple': 'foo'}) assert component.simple == 'foo...
998,646
732ad8d1edc0bc4f591e96f2586472e3f05c53a7
import os basedir = os.path.abspath(os.path.dirname(__file__)) class Config: WTF_CSRF_ENABLED = False SECRET_KEY = 'this-place-we-should-put-some-random-key' SQLALCHEMY_COMMIT_ON_TEARDOWN = True SQLALCHEMY_TRACK_MODIFICATIONS = False class DevelopmentConfig(Config): DEBUG = True SQLALCHEMY_D...
998,647
a584319b9fb02458acf2c0a44fae247f7121e0a4
def BaseM2Num(N): if N==0: return [0] else: List = [] while abs(N)>0: if N%2==0: N //= (-2) List.append(0) else: N = (N-1)//(-2) List.append(1) return List[::-1] List = BaseM2Num(int(in...
998,648
09434acb9fb42bc333181db80e092acbe740a897
from pymongo import MongoClient # passwo = "123" # mail = "hyderdanyal@gmail.com" def change(passwo, mail): print(passwo) client = MongoClient() client = MongoClient('localhost', 27017) db = client.vickytailor authentication = db.authentication # distinctemail = db['authentication'].distinct...
998,649
8fe2cd3cdfcbba4c6ff57a79c586d772c2017749
import turtle import math pen = turtle.Turtle() pen.speed(0) def starfish(n=None): if n is not None and not n % 360: return if n is None: n = 0 pen.forward(40) pen.left(math.sin(n) * math.cos(n) + n) starfish(n + 30) starfish(179) turtle.done()
998,650
4c001ae1e9747c7d160982d1b391a6ea9ebe147d
# Buffer pH adjuster # www.scienceexposure.com # Ismail Uddin, 2015 # This has sections adapted from the sample code provided by Atlas Scientific # provided here: http://atlas-scientific.com/_files/code/pi_sample_code.pdf from rrb2 import * import serial rr = RRB2() # pH value to set buffer at ph_set = ("Input the va...
998,651
c548f8e9988c9f3517aa9f74c636841f2dfe6935
#!/usr/bin/env python import RPi.GPIO as GPIO import time import signal import atexit #atexit.register(GPIO.cleanup) SERVO=5 GPIO.setmode(GPIO.BCM) GPIO.setup(SERVO, GPIO.OUT, initial=False) p = GPIO.PWM(SERVO,50) #50HZ p.start(0) time.sleep(1) DURATION=0.15 SLEEP=0.02 #MAX=181 BEGIN=70...
998,652
64eea34e525256a46d67d3b54d7fa15d366a9956
# -*- coding: utf-8 -*- """ Created on Thu Jun 07 16:44:20 2018 @author: sdenaro """ # this file runs the Willamette operational model following the settings # specified in the file settings.xml and plots/validates the results import matplotlib.pyplot as plt import pandas as pd from pandas.plotting import autocorrel...
998,653
d468bb0121cf0657c2c67886bceeabf61d2f5e40
#!/usr/bin/env python import RPi.GPIO as GPIO import time def main(): print("starting") GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(23, GPIO.OUT) GPIO.setup(24, GPIO.OUT) GPIO.output(23, True) GPIO.output(24, True) time.sleep(1) GPIO.output(23, False) GPIO.output(24, False) GPIO.cleanup() ...
998,654
bfac0d0a6e7d813d9e057c4756c511c67b68397a
from django.db import models # Create your models here. # 用户 class User(models.Model): class Meta: db_table = '用户' # id = models.AutoField(primary_key=True) name = models.CharField(max_length=100, verbose_name='昵称', null=False) accountNumber = models.CharField(max_length=50, verbose_name='账户', ...
998,655
92e4ab011abffb9b796f8518c670f0a83fdaf241
# https://gist.github.com/Arachnid/491973 import bisect from abc import ABC, abstractmethod from typing import List, TypeVar, Optional, Iterable, Generic from typing_extensions import Protocol class SupportsStr(Protocol): """ word object that's fed into the automaton """ def __str__(self) -> str: ...
998,656
bb56a6238020390962e1934330f07d533927a585
#import torch #simport torch.nn as nn #class InterpretableClassifier(nn.Module): # def __init__(self, num_channels, num_classes, classifier='fc'): # super(InterpretableClassifier, self).__init__() # self.classifier = classifier # self.fc1 = nn.Linear(num_channels, 200) # self.relu1...
998,657
7614c3c61385796174a8b8b8b9046a13c539dd70
################################################################################# ##____ ___ _ _ ____ ___ _____ ____ ___ #| _ \_ _| \ | | __ ) / _ \_ _| |___ \ / _ \ #| |_) | || \| | _ \| | | || | __) || | | | #| __/| || |\ | |_) | |_| ...
998,658
ad0ec59e8424b529a5c22a6686696056026056be
__doc__ = '''Comp 305 final project Group No: 21 Members: Altay Atalay Andrew Bond Project Name: Pokemon ''' from util import * def findLargestVertex(road_network: dict, cities_list: list) -> str: if len(cities_list) == 0: return largestVertex = cities_list[0] numEdges = len(road_network...
998,659
153bfafba82c56af6f06cc116c59167f68b4dcd1
def s2b(inp): bn = [] for i in inp: b = bin(ord(i)).replace("0b", '') if len(b) < 8: b = "0"*(8 - len(b)) + b bn.append(b) res = "".join(bn) return res def Hamming(in1, in2): cnt = 0 res = [] for i,j in zip(in1, in2): tmp = int(i) ^ ...
998,660
afd22bd66083abf964c0d35221b53cd24da63cf6
import brickpi import time interface=brickpi.Interface() interface.initialize() motors = [0,1] interface.motorEnable(motors[0]) interface.motorEnable(motors[1]) motorParams = interface.MotorAngleControllerParameters() motorParams.maxRotationAcceleration = 6.0 motorParams.maxRotationSpeed = 12.0 motorParams.feedForw...
998,661
4bee6657d95f3572ef4cc46d02da28db8c35ad68
class Solution(object): def lengthOfLastWord(self, s): s = s.rstrip(' ').split(' ') return len(s[-1]) if s else 0
998,662
af8af7bcd1ff056e3ea46c7f2717b6b15b412bd7
# -*- coding: utf-8 -*- import unittest from common.myunit import StartEnd from page.home_page import MePage class Test_Personal_Center(StartEnd): def test_1message_center(self): M=MePage(self.driver) M.message_center() self.assertTrue(M.check_message_center()) def test_2nickname_edit(...
998,663
c734611d0bcbc0bfb169c315180ae97c0bc1edc5
from django import forms from django.utils.translation import ugettext as _ from .models import Schedule # class AddEventForm(forms.ModelForm): # group = forms.CharField() # lesson = forms.CharField() # date_start = forms.CharField() # date_end = forms.CharField() # class Meta: # model = ...
998,664
f299b8b9b91121d025f32d3c3a430f228efb8ac0
# -*- coding: utf-8 -*- import importlib import logging import os import time import click from optimus.conf.loader import ( import_pages_module, import_settings_module, load_settings, ) from optimus.interfaces.build import builder_interface from optimus.interfaces.watch import watcher_interface from opti...
998,665
53c315ff20493b1039d4e02012cfd90faa5eb1ab
import cv2 import numpy as np import matplotlib.pyplot as plt def cv2_bgr2rgb(bgr_img): return cv2.cvtColor(bgr_img, 4) # cv2.COLOR_BGR2RGB = 4 def apply_clahe(gray_img, **clahe_kwargs): clahe = cv2.createCLAHE(**clahe_kwargs) return clahe.apply(gray_img) def to_gray(cv2_img): return cv2.cvtColor(c...
998,666
412ae7da66d7727ed9f54d111ae8cfa7d78c4949
""" Copyright 2018 EPAM 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.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
998,667
3b48506419868f284028b7601dc3cc951ae8f7d4
# Copyright © 2020 Province of British Columbia # # 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 agr...
998,668
64eccb6d1cb1b0c09842c7280ea894538db5b0ad
# -*- coding: utf-8 -*- import math import time import gzip import fileinput import numpy as np from sklearn import pipeline from sklearn import linear_model from sklearn.svm import SVC from sklearn.cross_validation import KFold from sklearn.cross_validation import LeaveOneOut vectormap, vclass1, vclass2, vclass3 = {...
998,669
5c4edf78948855410393d99b72cff21125c824ee
import pandas as pd from pymongo import MongoClient def getQueryData(): client = MongoClient('mongodb://onega:27017') db = client.AutoRedGreen collection = db.QUERY data = pd.DataFrame(list(collection.find())) return data a = getQueryData() print(a)
998,670
b10f8ee802f96d4e9286d31c524189053d17e4fb
import time def signs_counter(sign,string): if len(sign)>1: return "Błąd" counter=string.count(sign) return counter,sign string=input("Podaj łańcuch znaków: ") sign=input("Podaj znak do znalezienia: ") start=time.time() result=signs_counter(sign,string) end=time.time() time=end-start print("Jest",re...
998,671
1c5af629fc50aeefbf1b54e1314ec5413035b4d3
#1) TMDN_Dataset #1.1) get genres & overview from movies #1.2) tokenize data using BERT_Tokenizer #1.3) make input_form : [CLS] + genres + [SEP] + overview + tagline + [SEP] #1.4) make token_type_ids #1.5) make attention_mask #1.6) make input be tensor #1.6.1) input_ids #1.6.2) token_type_ids #1.6.3) attent...
998,672
986ec9cfcc90946821a777854cd7c4f68b220088
import jwt def generate_jwt(playload,private_key): token = jwt.encode( playload, private_key, algorithm='RS256') return token
998,673
5d8e23a7c87730bb3b2b5412917a6f82fd936b40
import asyncio import time import wx from wxasync import WxAsyncApp, StartCoroutine from pynput.keyboard import Key, Controller from bleak import BleakScanner, BleakClient # Key assignments KEY_JUMP = 'a' KEY_LEAN_FORWARD = Key.right KEY_LEAN_BACKWARD = Key.left KEY_RED_TILE = 'b' KEY_GREEN_TILE = Key.down # Timing B...
998,674
21b7bd39ea2fe136bb35619d87ea213ef5e119fc
ad = 6 # print the numbers till ad from 0 i = 0 while i < ad: i+=1 print(i)
998,675
362977621b8c476325e012195c95d02a8e0c6802
# -*- coding: utf-8 -*- """ Created on Wed Dec 25 12:30:08 2019 @author: ja2 """ # check version import tensorflow print(tensorflow.__version__)
998,676
b6284a6d13790e391ce2c525aaac4cd57b56e75d
import numpy as np import torch from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter import torchaudio.transforms as tfa_transforms import timm import data import models import yaml import nussl from ignite.engine import Events from yaml import Loader import os import logging from n...
998,677
b728afe0a8d6a1a213ece66a8a83f50345540b15
#/usr/bin/env python #import numpy as np #import matplotlib.pyplot as plt from matplotlib.colors import LinearSegmentedColormap #http://stackoverflow.com/questions/3279560/invert-colormap-in-matplotlib def reverse_colourmap(cmap, name = 'my_cmap_r'): """ In: cmap, name Out: my_cmap_r Explan...
998,678
8d4c88dfd49d32dd20c35bebd6a865eb0801e646
# -*- coding: utf-8 -*- import cookielib import urllib2 import urllib import requests import json import base64 from poster.encode import multipart_encode from poster.streaminghttp import register_openers import inspect from odoo.exceptions import ValidationError class NodeAction: DELETE_NODE = 0 UPDATE_NODE...
998,679
1d50ab61b77d71231af030807b744e7e6175b80c
import Pixiv_Crawler def on_PC(illust_id): pixiv = Pixiv_Crawler.Pixiv() res = pixiv.illust_detail(illust_id, is_pc=True) details = res['body']['illust_details'] html = pixiv.illust_pages(illust_id)['body'] for data in html: url = data['urls']['original'] pixiv.download(url) ...
998,680
9be37e4bb8915964bd9a80caf7c9bc00fda723c5
# -*- coding: utf-8 -*- """ Copyright [2009-2018] EMBL-European Bioinformatics Institute 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...
998,681
c4b8c35f22d2b294594a578f92e7c9684810f682
import numpy as np import pandas as pd import os import keras from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten from keras.layers import Conv2D, MaxPooling2D, ZeroPadding2D from keras.layers.normalization import BatchNormalization from keras.initializers import he_normal ...
998,682
a07d9baf74d288dbc3ff5c059233299ee2d2f87b
#view for page three from django.contrib.sessions.models import Session from django.shortcuts import render import requests import time import datetime def bugThree(request): request.session['sVar']['weight'] = "weight created from bug 3 m" #request.session.modfied = True ts = time.time() timeS3 = ...
998,683
b98459ab9b2d888821b1a0e9b046f6721621034f
# flake8: noqa import os.path as osp import numpy as np import yaml here = osp.dirname(osp.abspath(__file__)) def arc2017(): data_file = osp.join(here, "data.npz") data = dict(np.load(data_file)) # compose masks to class label image class_label = np.full(data["rgb"].shape[:2], 0, dtype=np.int32) ...
998,684
85fc2ede22a2e0de25092d8cdb17a04edbe44b76
''' Знайти суму додатніх елементів лінійного масиву цілих чисел. Розмірність масиву - 10. Заповнення масиву здійснити з клавіатури. ''' import numpy as np A = np.zeros(10) s = 0 for i in range(len(A)): A[i] = int(input('Enter element: ')) for i in A: if i > 0: s += i print(A) print(s)
998,685
1ab302b5c45b22e9a4b706b6377071d474d75140
#!/usr/bin/env python POWS = [1 << POS for POS in range(33)] t = int(raw_input().strip()) for _ in xrange(t): a, b = map(int, raw_input().strip().split()) c = b - a + 1 if c == 1 or c == 2: print a & b else: pos = 0 while c > POWS[pos]: pos += 1 a //= POWS[p...
998,686
2f7bc50f55c30d851e6e1af9b9ccaeb399af936b
import sys sys.path.append("..") from guerraterritorios.tests.testsFunctions import * from guerraterritorios.models.provincias import * def esUnaProvinciaPuedeDetectarSiUnaListaCumpleLaEstructura(): provincia = [ "Alajuela", [ [ "Upala", [ ...
998,687
0a56355d7b704646c4c9c1dff4057d085214501e
from params import * from K2_K2_64x52 import K2_K2_transpose_64x52 p = print def karatsuba_eval(dst, dst_off, coeff, src, t0, t1): """ t1 can overlap with any source register, but not t0 """ p("vmovdqa %ymm{}, {}({})".format(src[0], (dst_off+4*0+coeff)*32, dst)) # a[0:] p("vmovdqa %ymm{}, {}({})".forma...
998,688
357e7f305eef49676e072ca8a0c667e1f18b492e
#!/usr/bin/python import sys gfafile = sys.argv[1] goodnodefile = sys.argv[2] startnode = sys.argv[3] # format 123 without <> node_lens = {} one_outedge = {} with open(gfafile) as f: for l in f: parts = l.strip().split('\t') if parts[0] == 'S': node_lens[parts[1]] = len(parts[2]) elif parts[0] == 'L': ...
998,689
7680ac3bf4ab0144841638563c74eb379f69a829
import re import os import numpy as np import pandas as pd import multiprocessing match = 3 mismatch = -3 gap = -2 #空位罚分 空位权值恒定模型 # 蛋白质替换记分矩阵用BLOSUM-62 S_matrix = [[9,-1,-1,-3,0,-3,-3,-3,-4,-3,-3,-3,-3,-1,-1,-1,-1,-2,-2,-2], [-1,4,1,-1,1,0,1,0,0,0,-1,-1,0,-1,-2,-2,-2,-2,-2,-3], [-1,1,4,1,-1,1,0,1,0,0,0,-1,0...
998,690
10aaf983f059a8c1eb5ba4eb506d1892b14899b2
# Generated by Django 2.2 on 2019-04-26 05:38 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('NewsFeed', '0002_subscribe...
998,691
38865c2e65cc9019abf01186eb4ddc736e2a7506
""" WHAT - model HOW - xxx """ import os from flask import ( Blueprint, flash, redirect, render_template, request, session, url_for ) from models.__init__ import init_db from models.card import Card from models.plan import ( get_rand_card, get_plan, get_card_by_id, set_kno...
998,692
50bf66278380a01cc5750ec8a458ba98c32df675
"""djEmpleosIngenia URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') ...
998,693
9ae998e6576759d73a389051d1f9b07916ac9423
#!/usr/bin/env python # coding: utf-8 # # <font color='blue'>Data Science Academy - Python Fundamentos - Capítulo 5</font> # # ## Download: http://github.com/dsacademybr # In[ ]: # Versão da Linguagem Python from platform import python_version print('Versão da Linguagem Python Usada Neste Jupyter Notebook:', pytho...
998,694
e205852f3196394e6fce50ef0bd3e91b97d3e6a4
import time from selenium import webdriver # Optional argument, if not specified will search path. driver = webdriver.Chrome( '/home/fenris/work/Kamtech/Scrapers/LinkScraper/src/chromedriver_1') driver.get('http://www.google.com/') time.sleep(5) # Let the user actually see something! search_box = driver.find...
998,695
caf63c0023d51a7f6ac0aa52fc8a87557e1b219a
# Register your models here from .models import * from django.contrib import admin admin.site.register(Question) admin.site.register(Answer) admin.site.register(Comment) admin.site.register(Topic) admin.site.register(Discussion) admin.site.register(Vote) admin.site.register(Message) admin.site.register(Thread) admin.s...
998,696
10b31b4bccb5ea90d1f952512d6bb98f46f3ba75
from trlib.algorithms.algorithm_handler import Double_FQI_SSEP_Handler import numpy as np import json def calculate_q_values(double_fqi_ss_ep_handler, file_name): assert isinstance(double_fqi_ss_ep_handler, Double_FQI_SSEP_Handler) q_max_list = [] q_min_list = [] persistences = double_fqi_ss_ep_handle...
998,697
692aab5f54e4f254f5c2cd69527265ba950e7374
""" In this kata you have to create all permutations of an input string and remove duplicates, if present. This means, you have to shuffle all letters from the input in all possible orders. Examples: permutations('a'); # ['a'] permutations('ab'); # ['ab', 'ba'] permutations('aabb'); # ['aabb', 'abab', 'abba', 'baab',...
998,698
200370c10ce61c0325509c20e71844381191c39a
# intersection_update()方法:用于获取两个或更多集合中都重叠的元素,即计算交集 # intersection_update() 方法不同于 intersection() 方法,因为 intersection() 方法是返回一个新的集合, # 而 intersection_update() 方法是在原始的集合上移除不重叠的元素 set23 = {'a', 'b', 1, 2} set24 = {'a', 'c', 3, 2} set23.intersection_update(set24) print(set23)
998,699
5dee86f77bf7b9f3b813616a4352a485ac9d2b0a
# -*- coding: utf-8 -*- # Copyright 2016 Yelp 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.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...