index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
999,200
52e18b327c4158bec5ff002230304ed75230c7e1
from flask import Flask, redirect, url_for, render_template, request, session, flash, abort from requests import get import os,subprocess from subprocess import Popen, PIPE import pwd app = Flask(__name__) app.secret_key = "A_skdfjPskdfkPdsgllflkdnfkljadklf" ip = get('https://api.ipify.org').content.decode('utf8') d...
999,201
58c23e231133e702be3172b8125dad89ae373a29
import pygame, sys, os, random from classes import * from pygame.locals import * blocksFile = "blocks.txt" thisBlock = "" allBlocks = [] boardWidth = 15 boardHeight = 20 gameOver = False # Make all the blocks which are in file "blocks.txt" file = open(blocksFile, "r") while file: line = file.readline() if l...
999,202
533cc4fa07ad8698472bda43f710578d2fc1731d
# coding:utf-8 from math import log class BitMap(object): def __init__(self, max_num=0): self.bit_mask=1 self.bucket_mask=0x40 self.right = int(log(self.bucket_mask, 2)) self.int_numbers = int(max_num/self.bucket_mask)+1 self.bit_map = [0 for _ in range(self.int_numbers)] ...
999,203
981df90fb317e228f1730619b12d5f58087e8842
import argparse import os import json5 import numpy as np import torch from torch.utils.data import DataLoader from util.utils import initialize_config def main(config, resume): torch.manual_seed(config["seed"]) # for both CPU and GPU np.random.seed(config["seed"]) train_dataloader = Data...
999,204
728c83a72c77f478220b2e63268ea967cec3c5e0
class SeamCarving: def carve_seam(self, disruption: [[int]]) -> [int]: # print(disruption) l = len(disruption) for i in range(1,len(disruption)): for j in range(l): if j==0: disruption[i][j] += min(disruption[i-1][j],disruption[i-1][j+1]) ...
999,205
0a15e1747863ad74b799edfe567cf26e3ba1886f
#!/usr/bin/python # This code extract gi_accession number, protein sequence and length information from fasta database #argv[1]: fasta database #argv[2]: output file import sys from Bio import SeqIO from Bio.Seq import Seq from Bio.Alphabet import IUPAC #import argparse #parser=argparse.ArgumentParser(description='pyt...
999,206
e2f15466e750fc3559647f23dd5f3e5626220e36
#!/usr/bin/env python3 # This file is Copyright (c) 2020 Florent Kermarrec <florent@enjoy-digital.fr> # This file is Copyright (c) 2020 Dolu1990 <charles.papon.90@gmail.com> # License: BSD import argparse from migen import * from litex.build.generic_platform import * from litex.build.sim import SimPlatform from lit...
999,207
bf04c17916127558dcf70bc70fd77e27fb994d5d
print('MAD LIBS CODE 2') name = input('What is your name? ') food = input('What is your favorite food? ') swim = input('Please name your favorite place to swim. ') print(name, 'is a small boy. He likes to eat', food, 'and loves to swim at the', swim, '.')
999,208
e53ca8f48592a78768074e1c9c9e5065b90ce51f
# -*- coding: utf-8 -*- # Copyright 2015 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 ...
999,209
753e309d2552e7d44a850cea1bb6dbe52429e977
from tkinter import * from tkinter import ttk from PIL import ImageTk from PIL import Image from api_db.op_api import * from tkinter import messagebox import datetime from tkinter.filedialog import asksaveasfile import csv import matplotlib.pyplot as drawer def disable_close(): return None # initialize db conne...
999,210
b38cd3ae179533c25c6bac25d103823c8291b567
from __main__ import session, config, paths from dotabase import * from utils import * from valve2json import valve_readfile def load(): session.query(Item).delete() print("items") print("- loading items from item scripts") # load all of the item scripts data information data = valve_readfile(config.vpk_path, p...
999,211
8f2d0b7eb61004771c4cde93ac630004ef650cf3
smallno=0 n=0 while (True): ## counter =c 1 n = int(input("Enter the number: ")) if(smallno > n): smallno=n if (n == -1): break; print("Smallest number is",smallno)
999,212
d68e82b8c3c6fa21bf866f6b1a0d843aeba33b38
class Solution: def maxTurbulenceSize(self, A): """ :type A: List[int] :rtype: int """ ans=1 cur=[1,1] for i in range(1,len(A)): if A[i]==A[i-1]: cur=[1,1] elif A[i]>A[i-1]: cur=[1,cur[0]+1] e...
999,213
7184d69379c7031984d37472f7b2d29508c1e118
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """config.py""" __author__ = 'Gary.Z' from data_cleansing.logging import * EXCEL_INDEX_BASE = 1 HEADER_ROW_INDEX = 0 + EXCEL_INDEX_BASE BASE_INFO_COLS_MIN = 23 MAJOR_FILTER_LIST = ('测试专业',) NC_OPTION_FILTER_LIST = ('无法评价', '以上均不需要改进') G1_OPTION_FILTER_LIST = ('国际组织',...
999,214
ad3dd11ca7efce8c982291ee2877f0922fea1ff3
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
999,215
936bc0b22ba9785cf5c586579ef51ca9c38cffc2
import time debug = False def checkreduceboard(board): while board: if debug: print '---' for row in board: print row nextpass = False boardmin = min(min(board[i]) for i in range(len(board))) for rc in range(len(board)): ...
999,216
496ce8576c45f0b8f4b4d903987d9351ee1fa652
from django.shortcuts import render from django.http import HttpResponse from django.db.models import Max import json from datetime import date from .models import Application,EduExp,WorkingExp,Recommander,ProfExp # Create your views here. def confirm_application(request): if request.method == "POST": appl...
999,217
7f2c5f6d6f62d3ac8fdd14b4e4c024715977892b
#!/usr/bin/env python """ Tight-binding chain e0:on-site energy t:hopping t N:chain length N. """ import numpy as np import matplotlib.pyplot as plt def band_energy(k,t=1.0,e0=0.2,a=1.0): """The function of energy with respect to k.""" return e0-t*np.exp(1j*k*a)-t*np.exp(-1j*k*a) def band_plot(N=400,a=1.0): ...
999,218
b6a301905f38d0c392555fc9250b8a8bdb88b91b
from django.conf.urls import url from django.urls import path, include from django.contrib import admin from django.urls import path, include from django.contrib.auth import views as auth_views from . import views app_name='logistics' urlpatterns = [ path('register', views.register_request, name='register'), ...
999,219
60151d0c3b19737e06c56da3798df258008bb813
# coding=utf8 __author__ = 'smilezjw' class Solution: def combinationSum(self, candidates, target): candidates.sort() # 先对候选数字进行排序 Solution.res = [] # 初始化全局变量 self.dfsSum(candidates, target, 0, []) return Solution.res def dfsSum(self, candidates, target, start, temp): # 深度...
999,220
8558e6466caaaadddbd0f930dc19c886d222edb7
import functools from .util import preserve_signature def file_writer(fn): def wrapper(path,*args,**kwargs): with open(path,'w') as f: for l in fn(*args,**kwargs): print(l,file=f) return preserve_signature(wrapper,fn) #return functools.update_wrapper(wrapper,fn,assigned...
999,221
eef003dbb9866dea7c08a13fa72f61079af304c6
import pandas as pd import numpy as np import seaborn as sns import csv # import pdb import ipdb from scipy.stats import median_test from sklearn.model_selection import KFold from sklearn.linear_model import LinearRegression as LR from sklearn.ensemble import RandomForestRegressor as RF import matplotlib.pyplot as plt...
999,222
f3fe9d3e1c2611e87e2345a8fef67c48d9cf5c54
from scrapy.linkextractors import LinkExtractor from scrapy.spiders import Spider, Request, Rule, CrawlSpider from datetime import datetime from scrapy.selector import Selector from faa.items import FaaDocItem import pdb import re import os from scrapy.xlib.pydispatch import dispatcher from scrapy import signals from f...
999,223
fc71a78b6bfc550d155c338341d95916214e8d53
from matplotlib import pyplot as plt import random from functions import * # get price & techinical indicator data as pandas dataframe pdata, data = getData(1) # load model from file model = getModel(1) # initialize signal(buy/sell/hold decisions) signal = pd.Series(index=np.arange(len(data))) signal.fillna(value=...
999,224
9965f491c8ff8cca62e965f60fe04259f4424b42
import heapq N = int(input()) es = [[] for _ in range(N)] for _ in range(N-1): a,b = map(int, input().split()) es[a-1].append(b-1) es[b-1].append(a-1) INF = float("inf") # ダイクストラでフェネック君の開始地点からの距離を探索 dist_f = [INF] * N dist_f[0] = 0 q = [(0,0)] while q: cost, curr = heapq.heappop(q) if dist_f[c...
999,225
200b8e55618a55a11bade339e1b69d7097c164bb
from django.apps import AppConfig class MaxproappConfig(AppConfig): name = 'MaxproApp'
999,226
ef46f028f8cc70499a4b7ed1a12c201d0e4e6f3a
from enum import Enum class Edge(Enum): MaxY = 1 MaxX = 2 MinY = 3 MinX = 4 CenterY = 5 CenterX = 6 def PairFromCompass(cmp): if isinstance(cmp, Edge): return None if isinstance(cmp, str): cmp = cmp.upper() if cmp in ["C", "•"]: ...
999,227
637957da11b85b35269cf27bebf1d39f6d8bdec7
import discord, time, asyncio, os, random, json, re from discord.ext import commands, tasks from discord.ext.commands import has_permissions, cooldown, MissingPermissions, check, has_role from discord.utils import get from termcolor import colored from datetime import datetime, date from urlextract import URLExtract c...
999,228
dd3d4e22a3b17454930b1e1d65c5f88bfde99a6c
from itertools import * list1 = [1, 2, 3, 'a', 'b', 'c'] list2 = [101, 102, 103, 'X', 'Y'] chained = chain(list1, list2) print(type(chained)) print(list(chained)) counter = count(10, 2.5) for i in counter: if i <= 20: print(i) else: break newRange = range(0, 5) newCycle = cycle(newRange) ex...
999,229
40f837d27f00808d4ae7432fb390f5101ee3266b
import base64 import logging import simplejson import tornado import tornado.httpclient def _callback(response): if response.error: logging.error("Failed to send data to mixpane. Reason: " + response.error) def track(token, event, properties=None): if "token" not in properties: properties["token"] = token pa...
999,230
815f3aec29c46382ba30c4e357a21ede9bbe4300
# coding: utf-8 """ Arduino IoT Cloud API Provides a set of endpoints to manage Arduino IoT Cloud **Devices**, **Things**, **Properties** and **Timeseries**. This API can be called just with any HTTP Client, or using one of these clients: * [Javascript NPM package](https://www.npmjs.com/package/@arduino/ard...
999,231
b68c114450de23beb888bfe7944c7336047d19b3
''' This file contains many rules used by both the pruning step and feature generation. ''' import re # List of top 15 countries by GDP countries = ['United States', 'China', 'Japan', 'Germany', 'United Kingdom', 'England', 'India', 'France', 'Brazil', 'Italy', 'Canada', 'Russia', 'Korea', '...
999,232
b179bcf02941d5a3d5b1cb3ec78cf92554efb206
import ray def register_serializer(cls, *, serializer, deserializer): """Use the given serializer to serialize instances of type ``cls``, and use the deserializer to deserialize the serialized object. Args: cls: A Python class/type. serializer (callable): A function that converts an insta...
999,233
9d8f375884da77d993ac429226178f34d2b4f2f2
from django.conf.urls import include, url from django.contrib import admin from constellation import views urlpatterns = [ url(r'^json/links/$', views.links_json, name='links_json'), url(r'^json/floatsam/$', views.floatsam_json, name='floatsam_json'), url(r'^jetsam/change/(?P<makerslug>[\w-]+)/(?P<slug>[...
999,234
1193d2aa321cdd555cce02d1774137520377e40f
import parser import webbrowser import re def repl(): while True: read = input('rss>> ') eval = feed_eval(read) if eval is not None: post_repl(eval) print('Exited Feed') def post_repl(feed): print('In feed '+ feed.title) curr = 0 while True: foun...
999,235
0a53e0ab27aef719c5aab1297749cf2f3b570334
import datetime from builtins import ValueError, int from django.http import Http404, HttpResponse # int valueerror报错 换个页面导包正常了 def hours_ahead(request, offset): try: offset = int(offset) except ValueError: raise Http404() dt = datetime.datetime.now() + datetime.timedelta(hours=offset) ...
999,236
d3e7a7a9f41df41558ec06383baa15347862e7ea
#!/usr/bin/env python3 import random numTentativas = 0 numero = random.randint(1, 20) print('Estou pensando em um numero entre 1 e 20.') while numTentativas < 5: numeroUsuario = input('Adivinhe: ') numeroUsuario = int(numeroUsuario) numTentativas = numTentativas + 1 if numeroUsuario < numero: print('Tente m...
999,237
724b746e6c9690a8d850f7f2ec185afcc58e65fb
from django.shortcuts import render from django.http import HttpResponse import os import librosa import librosa.display import IPython.display as ipd import numpy as np import matplotlib.pyplot as plt import io import urllib, base64 audio_file = "audio/debussy.wav" audio, sr = librosa.load(audio_file) sample_duratio...
999,238
0f06804f022be61f81ff7afe9f9a8c97f9fe9a58
import cv2 import numpy as np def execute(imgName): print(imgName) img = cv2.imread('imgSaved/test1/'+imgName, 1) gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) ret, binary = cv2.threshold(gray,127,255,cv2.THRESH_BINARY) contours, hierarchy = cv2.findContours(binary,cv2.RETR_TREE,cv2.CHAI...
999,239
e466d3634b6da0d12ef3d2b7c06dc8e276d0f81a
class Student: def __init__(self, name, Id, percentage = 0, skills = []): self.name = name self.Id = Id self.percentage = percentage self.skills = skills def get_name(self): return self.name def get_Id(self): return self.Id def get_percentage(self): ...
999,240
9119575e80d94b2205b950bbd3dff055744ace3e
# Generated by Django 2.0 on 2018-10-22 13:20 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('blog', '0005_blog_readed_time'), ] operations = [ migrations.RenameField( model_name='blog', old_name='readed_time', ...
999,241
cbdd1832497a1b7e2e5ac1249e625ab9c763e0fc
L = [ ['Apple', 'Google', 'Microsoft'], ['Java', 'Python', 'Ruby', 'Php'], ['Adam', 'Bart', 'Lisa'] ] print('''打印Apple:L[0][0] = %s 打印Python:L[1][1] = %s 打印Lisa:L[-1][-1] = %s''' % (L[0][0], L[1][1], L[-1][-1]))
999,242
9bc631cc13b732cbe37df04953961f565d8c4bf1
H, W = map(int, input().split()) HW = [0] * H for i in range(H): HW[i] = str(input()) #縦 T = [[0] * W for i in range(H)] for i in range(H):#4000000 now = 0 for j in range(W): if HW[i][j] == "#": T[i][j] = 0 now = 0 else: now += 1 T[i][j] = now now = 0 for j in...
999,243
a820d5ba0ae74474eca2e2d8d177df2e950f55de
# -*- coding: utf-8 -*- from pyquery import PyQuery as pq html = open("./_build/html/family_marriage.html").read() dom = pq(html) for tr_node in dom.find("tr"): pq_tr_node = pq(tr_node) header = pq_tr_node.find("th") if header.is_("th"): print([th.text for th in pq_tr_node('th')]) else: ...
999,244
fe6d32539ef3e1fba31b28aa1250d3074fe0fb36
import random def quicksort(nums): """ Швидке сортування :param nums: Список з вхідними даними :type nums: list :return: Повертає відсортований список """ if len(nums) <= 1: return nums else: q = random.choice(nums) l_nums = [n for n in nums if n < q] e_nums =...
999,245
c9bc32116917e27d35df5f89aaecd38186566f3e
import sys from PyQt5.Qt import * class MyWindow(QWidget): def __init__(self): super().__init__() self.resize(500, 500) self.setWindowTitle('布局管理器') # self.setup_ui() self.详解() def setup_ui(self): label1 = QLabel('标签1') label2 = QLabel('标签2') la...
999,246
24c8354b0a4bc516acbc13f6dde4da7d563cdd8c
n=int(input()) l=[] for i in range(0,n): c=int(input()) l.append(c) for i in range(len(l)): j=int(l[i]/5) k=j+1 b=k*5 if l[i]<38: print(l[i]) elif(b-l[i])<3: print(b) else: print(l[i])
999,247
cc3329776e7d8f15ba306cd937d0729e9ad99253
rule star: input: sample=["reads/{sample}.1.fastq", "reads/{sample}.2.fastq"] output: # see STAR manual for additional output files "star/{sample}/Aligned.out.bam" log: "logs/star/{sample}.log" params: # path to STAR reference genome index index="index", ...
999,248
5edf833f8026ef522234e56d97b2471b4b50be6b
#checkargs2.py #コマンドライン引数が2個以上であることをチェックする import sys if len(sys.argv)<3: print("引数として2つの整数が必要です。") exit() print("引数チェックOK!")
999,249
f5f1b328fcc9e882f6bf102006e49f260254206e
from django.contrib.auth import decorators, views from django.http import HttpResponse, HttpRequest, HttpResponseBadRequest, QueryDict from django.conf import settings from django.views.decorators.csrf import csrf_exempt from bii_webapp.apps.files.models import * from threading import Thread import json import r...
999,250
77eb5fab196f60d76a29a4ff97e64cf24582f833
import argparse import copy import logging import pathlib import shutil import sys import tarfile import unittest from .base import Profile, Target, Scope from .build import Build from .config import ConfigDict from .tests import Skip, TestCase from . import compilers, targets if not any([ '.xz' in i[1] for i in shut...
999,251
a899c90d1b92a92b91351cadbf1ba68cb02db5e1
#!/usr/bin/python3 import sys, os, subprocess import PyQt5 from PyQt5 import QtCore, QtGui, QtWidgets # --- Variables ----------------------------------------------------------------------------------- special_keys = { 16777264 : 'F1', 16777222 : 'KP0', 16777235 : 'UP', 16777265 : 'F2'...
999,252
66d1ad005cce45f47d7b6b556053de992ee5f094
''' Created on Apr 10, 2016 @author: Dell ''' candies = [] valleys = [] def get_rating(i,N,arr): if i < 0 or i > N-1: return None return arr[i] def get_candies(arr): for i,v in enumerate(range(0,len(arr)-1)): if get_rating(i,len(arr),arr) <= get_rating(i-1,len(arr),arr) and get_rating(i,len...
999,253
6fab300c290906ae2e1515d2f3663e1d1ee47bea
import sys with open( sys.argv[1] ) as dataFile: currentCase = 1 numCases = dataFile.readline() for unsplitLine in dataFile: A, B = [ int( i ) for i in unsplitLine.split() ] count = 0 for n in range( A, B ): m = {} nAsList = [ digit for digit in str( n ) ] ...
999,254
235de3d6ce526504d5af3aa302d54dedbc19bd3d
from async_event_bus.types import EventHandler, FilterFunction, EventHandlerFunction, Context, EventGenerator, Event def define_handler(filter: FilterFunction, handler: EventHandlerFunction, context: Context) -> EventHandler: def handle(event: Event) -> EventGenerator: if filter(event): return...
999,255
82a569397bdf10ffb5908e17c257ecb5c042c4d2
import unittest from scrape import * from unittest.mock import patch, Mock class TestMS(unittest.TestCase): def setUp(self): self.target_url = 'https://www.metal-archives.com/browse/ajax-country/c/SE/json/1' self.target_url += '?sEcho=1&iColumns=4&sColumns=&iDisplayStart=0&iDisplayLength=500' ...
999,256
88450cc4830d1ee25fda18b65022b7140da40d27
#Copyright (c) Ramzi Al Haddad 2002-2017 import pyautogui as pag import time time.sleep(5) while True: pag.typewrite(['e','t','a','i','n','o','s','h','r','d','l','u','c','m','f','w','y','g','p','b','v','k','q','j','x','z','e','t','a','i','n','o','s','h','r','d','l','u','c','m','f','w','y','g','p','b','v','k',...
999,257
fd3dd5344539c9c98d8a12246c5d6fff825ce28d
from .. import db from flask import current_app from flask_login import AnonymousUserMixin, UserMixin from itsdangerous import TimedJSONWebSignatureSerializer as Serializer from itsdangerous import BadSignature, SignatureExpired class Bank(UserMixin, db.Model): __tablename__ = 'bank' id = db.Column(db.Integer...
999,258
24fbff50d9793ddaece5da51f02e245858916570
i=str(input()) if (i!=i[::-1]): print(i) else: k=i[:-1] print(k)
999,259
5837e5f8b30ad0fcba80309146a38d7d485d4116
import time from datetime import datetime from time import ctime from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.select import Select driver = webdriver.Chrome() driver.maximize_window() driver.get('http://oa.troila.com') time.sleep(3) driver.find_ele...
999,260
feff450f054e22be9e61d3ce49dc70cdfe1afaed
from tkinter import * from gui import gui from sudoku import sudoku def core(): g.pullinput() s=sudoku(g.m) if s.solve(): g.pushoutput(s) if __name__=='__main__': g=gui(core) g.format() mainloop()
999,261
f3a4f92122d465e0640143b15dae78a35c82b933
import matplotlib.pyplot as plt import numpy as np img = skimage.io.imread('tiger.png', as_gray=True) h=img.shape[0] w=img.shape[1] matrix=np.ones((h,w))*100 img1 = img+matrix for i in range (0,w): for j in range(0,h): if img1[j][i] > 255: img1[j][i]=255 h,w=img.shape img90=np.zeros((w,h)...
999,262
5b04e5d7a34b705c8f615e79dafa1cd70e63bcd7
# Load in all required libraries import os import sys import pandas as pd import boto3 import botocore.exceptions import json import configparser import time # Set path to current directory os.chdir(os.path.dirname(sys.argv[0])) # Open and read the contents of the config file ioc_config = configparser.ConfigParser...
999,263
c0742cbff221a2a82ffdd9adda0f84f68c074a6a
import unittest import json import tests.webapp.test_client class TestReadyForBattle(unittest.TestCase): def setUp(self): self.app = tests.webapp.test_client.build() def test_ready_for_battle_when_no_ships_deployed(self): self._do_attack_request(self._do_auth_request()) auth_token = s...
999,264
de52ef7dbeaddc84d5003c0bbffedac35c570516
# -*- coding: utf-8 -*- """PythonProblem10.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/15hLFFwmlsAPEApEA62wQtewfBCO1YTrt Problem 10: Print characters at even index in string Solution: """ #Assigning string a value String = "Welcome to the ...
999,265
d76adff37ff35fc4a3d23ae5073f30ee0ec3b6e8
#!/opt/Python/2.7.3/bin/python import sys from collections import defaultdict import numpy as np import re import os import argparse import glob import time from Bio import SeqIO def usage(): test="name" message=''' python RunInsertSize.py --input /rhome/cjinfeng/BigData/00.RD/RILs/QTL_pipe/input/fastq/RILs_AL...
999,266
5265036dbe1cd26ac54328fbbed2a24ecd562523
#!/usr/bin/env python # coding:utf-8 import subprocess a = subprocess.Popen('ls',shell=True,stdout=subprocess.PIPE) print(a) print(a.stdout.read().decode("utf8"))
999,267
b3851ea8f75769cf917e6ce7f66199304f038e96
from django.db.models import Avg from django.http import Http404 from django.shortcuts import render, get_object_or_404 from .models import Book # Create your views here. def index(request): # we can sort the data using order_by() function | add - for descending order # books = Book.objects.all() books = ...
999,268
27701991639a3d2aeeb7689fba6321c07836db99
#------------------------------------------------------------------------------- # Name: pygametools.py # Purpose: This module will hold different tools that I have made to improve # the rate of development of pygame programs # # Author: James # # Created: 18/06/2014 # Copyright: (c) ...
999,269
fef955b0820211efda48f757e91e888b2cbdd127
import email import imaplib import re import time from .base_page import BasePage from .locators import MainPageLocators class MainPage(BasePage): def should_be_login_in_link(self): self.is_link_correct("login") def should_be_auth_in_link(self): self.is_link_correct("auth") def fill_firs...
999,270
43eab73794d4f278a6397907118c00ef973832c9
from django.db import models class ExerciseEvent(models.Model): woType = models.CharField(max_length=100) #Stores in the name of a workout type from the program startTime = models.DateTimeField() #Time functions are stored in from Python because they're cleaner endTime = models.DateTimeField() #Same as abo...
999,271
d8cd3133ff8fe874bb4ff19cd1106fbcaaa25acf
class Time(object): def __init__(self, hours, minutes, seconds): self.hours = hours self.minutes = minutes self.seconds = seconds def __str__(self): return str(self.hours) + ':' + str(self.minutes) + ':' + str(self.seconds) time = Time(11, 59, 30) # time.hours = 11 # time.minu...
999,272
5cd10ff860d8b9d1094d308dfe68e8e2711d7142
""" Hardcore - The "screen" series - Aligning """ def main(): """ Draw screen """ width = int(input()) height = int(input()) line = int(input()) align = input() text = input() top = line - 1 bottom = height - top - 3 space = width - 2 if len(text) > space: print("!!!ERR...
999,273
ac15abfcf8f8aa1cd77acca971cbad059a297c2f
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack.package import * class RQuickplot(RPackage): """A System of Plotting Optimized for Speed and Modularity. ...
999,274
1b9a1b7e7d47dbd26053f661af1f8635833c0a07
import astropy.io.votable import vaex from vaex.dataset import DatasetFile from vaex.dataset_misc import _try_unit class VOTable(DatasetFile): snake_name = "votable" def __init__(self, filename, fs_options={}, fs=None): super().__init__(filename) self.ucds = {} self.units = {} self.filename = filename sel...
999,275
c9c127c4a336dd76dd166da3c8627b51ecf1bd69
#!/usr/bin/env python2 from nvr.nvr import main main()
999,276
bf6fb66c261b5fdefe4fb1a7ae464219bf5f2422
usia = [19, 20, 21, 18, 17, 19, 19, 18, 19, 18] jumlah_data = len(usia) total_usia = 0 for i in range(0, len(usia)): total_usia = total_usia + usia[i] rata_rata_usia = total_usia / float(jumlah_data)
999,277
d53c539a42e6da9227bc178055f925e23ac214c0
# %% import pandas as pd import matplotlib.pyplot as plt import numpy as np from datetime import datetime # %% from pandas_datareader import data from pandas_datareader._utils import RemoteDataError # %% #zona temporal para extraer datos START_DATE = '2019-01-01' #END_DATE = str(datetime.now().strftime('%y-%m-%d'))...
999,278
2f80fae62a66eb0c5109909be6b60f716b61bd82
# __author__ = 'eslam' def solveMeFirst(a,b): # Hint: Type return a+b below return a+b num1 = input() num2 = input() res = solveMeFirst(num1,num2) print(res)
999,279
20b5da842881e07ef7f2cb50056bdbb0cdacdfef
import numpy as np import pytest from baloo import Index, Series, RangeIndex, DataFrame from .indexes.utils import assert_indexes_equal from .test_frame import assert_dataframe_equal from .test_series import assert_series_equal class TestEmptyDataFrame(object): def test_aggregation_empty(self, df_empty): ...
999,280
b931c914296ffed3a93513c985ea281edccf0047
from enum import Enum from enum import auto __all__ = ( 'Side', 'WebSocketType', 'MessageFeedType', 'TradeEvent', 'AccountEvent', 'OrderStatusType', 'OrderType', 'StopLimitType', 'TimeInForce', 'BatchOrderType', 'TransactionType', 'CurrencyPair', ) class NameStrEnum(En...
999,281
4af35bcdd2a5ee6aecc982b0b43b8039c6c6476f
""" Behaviors/Magic =============== .. rubric:: Magical effects for buttons. .. warning:: Magic effects do not work correctly with `KivyMD` buttons! To apply magic effects, you must create a new class that is inherited from the widget to which you apply the effect and from the :attr:`MagicBehavior` class. In `KV fi...
999,282
6e9f2d1e7a2f39c6fd7bec3e8085b8777e769e30
# Comparing Tuples t1=(80, 90, 56, 44, 99) t2=(100, 200, 300, 400, 500) print(t1>=t2)
999,283
f3ceb5b41a7091c5220e8e286ac373971a61cad1
import numpy as np import pandas as pd import pickle import random def getMcIntireDataset(): filename = "dataset/mcIntire.csv" data = pd.read_csv(filename) x = data['text'].tolist() m = {'FAKE':1,'REAL':0} y = data['label'].map(m).tolist() y = np.array(y) print("CSV file loaded!!") ...
999,284
ee6d426f95a3b19a65bc8293d5937a6d93b7e635
import unittest from days import day13 import util class MyTestCase(unittest.TestCase): def test_example_a1(self): table = day13.Table() self.assertEqual(table.find_optimal_seating_arrangement( ['Alice would gain 54 happiness units by sitting next to Bob.', 'Alice would lose 79 happiness units by s...
999,285
d1780fae455fcabc9bfb3dea564aad116457e463
You are given an array A of size N. Your task is to find the minimum number of operations needed to convert the given array to 'Palindromic Array'. Palindromic Array: [23,15,23] is a ‘Palindromic Array’ but [2,0,1] is not. The only allowed operation is that you can merge two adjacent elements in the array and replace...
999,286
fa0b3502bb1ec4410176bbec40efc8efabe2eade
# python3 # Finding user input is odd or even num = int(input("enter a num: ")) print(num) if num % 2 == 0 and num % 4 == 0: print("your num divided by 2 n 4") elif num % 2 == 0: print("you entered even number") else: print("your num is odd")
999,287
93646756ce63f254b5101dc2be3994a43fa6bfa4
""" Test data created by CourseSerializer and CourseDetailSerializer """ from datetime import datetime from unittest import TestCase import ddt from opaque_keys.edx.locator import CourseLocator from rest_framework.request import Request from rest_framework.test import APIRequestFactory from xblock.core import XBlock...
999,288
a4283edbf2dc5b7f6bda830d3aaefe11ffee52da
from django.urls.conf import path from django.urls.resolvers import URLPattern from .import views urlpatterns=[ path('id_measurements/<id>/',views.get_id_measurements, name='measurements_id'), path('list_measurements/', views.get_measurements, name='measurements_List'), path('modificar_measurements/<id_modifi...
999,289
55d08ffdb1e6ab8e363689783110c374e1f062c4
# 非参数估计概率密度 import numpy as np import math import matplotlib.pyplot as plt import matplotlib as mpl class DensityEstimated: def __init__(self, N, h): self.n = N # 样本数 self.k_n = int(math.sqrt(N)) # (Kn近邻估计使用的)每个小舱固定的样本数 self.h = h # (parzen窗使用)每个小舱的棱长(方窗) self.sigma =...
999,290
512237af12731f56e43d7cb0a48d8e0bd92cc5c9
from __future__ import print_function import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms from torch.autograd import Variable from torch.utils.data import Dataset, DataLoader import itertools def to_one_hot(...
999,291
563e832068069595fdd0c06175630725f864e176
import argparse from csat.acquisition import base __version__ = '0.1.0' class ListAction(argparse.Action): def __init__(self, option_strings, dest, const, default=None, required=False, help=None, metavar=None): super(ListAction, self).__init__(option_strings=option_strings, ...
999,292
938fe5e354b4a91d4ac42abc7cde698ad83852a9
class Solution: s = None def lengthOfLongestSubstring(self, s): if len(s) <= 1: return len(s) self.s = s table = set() index = len(s) // 2 l1 = self.helper(index, index, table, 0) return max(self.lengthOfLongestSubstring(s[:index]), self.lengthOfLonge...
999,293
1280a594aa329becdad3fdef6d0f883f8f12db19
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re import time from distutils.version import LooseVersion from glob import glob from os import path, makedirs, remove from shutil import copyfileobj, rmtree import psutil from six import iteritems from six.moves.configparser import NoSectionError from six....
999,294
098e10680eacbe906cb1c83770f452aa847d29f5
#!/usr/bin/env python # -*- coding: utf-8 -*- import pygame from pygame.locals import * import window import system_notify import character_view import item import shop TITLE, CITY, BAR, INN, SHOP, TEMPLE, CASTLE, TOWER, STATUS_CHECK, GAMEOVER = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) CHARACTER_MAKE = 10 NO_EXT...
999,295
cb09426509b18d52cad1f2764ae7525c95f1fa5e
from segmentation_models_pytorch.base import (SegmentationHead, SegmentationModel) from segmentation_models_pytorch.encoders import get_encoder from torch import nn from trainer.start import * from utils.pretrain import * from model.common import * @dataclass class Pylon...
999,296
3b1217ac713d10c9a98874de6c4aba20b1483dca
''' Created on 8 avr. 2013 utilitaires sur les transformation. on utilisera les matrices 4*4 de la géometrie projective pour définir les transformation les utilitaires pour créer les transformations de bases sont déjà prédéfinis dans mathutils.Matrix pour appliquer une transformation, il faut l'appliquer au champ m...
999,297
b4bab6138e5ca06d35c15e3575ba14d0aaba6ff0
#! /usr/bin/env python3 import pandas as pd f_path = 'py/question.txt' cols = ['序号','题目','A','B','C','D','正确选项'] # rows = [[1,'Title-1','Opt-A','Opt-B','Opt-C','Opt-D','C'],[2,'Title-2','Opt-A','Opt-B','Opt-C','Opt-D','D'],[3,'Title-3','Opt-A','Opt-B','Opt-C','Opt-D','A'],[4,'Title-4','Opt-A','Opt-B','Opt-C','Opt-D','...
999,298
899cf48607acf464717068627fb9f213f661942b
import bng import pyproj # Define coordinate systems wgs84=pyproj.CRS("EPSG:4326") # LatLon with WGS84 datum used by GPS units and Google Earth osgb36=pyproj.CRS("EPSG:27700") # UK Ordnance Survey, 1936 datum # Transform #x, y = bng.to_osgb36('NT2755072950') x , y = 538890, 177320 res = pyproj.transform(osgb36, wgs84...
999,299
6ac97fe12363e50b6cd640eecf901dbe49a9f0b9
import numpy as np from scipy import linalg #=============================================================================== # s_av: mean value for each bin ; s1_av: possible values of s_av #=============================================================================== def data_binning(s,nbin): l = len(s) nbi...