index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
994,700
550cfc3b4a4d514a5ddda4392c042927648f00d7
import calendar import datetime ''' You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday. Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has twenty-eight, rain or shine. And on leap yea...
994,701
7029ea2ac084a36220e4cdbe9fffcf99be107c86
# coding:utf-8 import re import time from urllib import request class PL: def __init__(self): # 定义初始信息 # 定义http头信息 self.headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/55.0.2883.87 Safari/537....
994,702
d4f18e60460ee250581a530e2f5896bc0b88540e
# -*- coding: utf-8 -*- from tccli.services.mna.mna_client import action_caller
994,703
56a10646f4a62d804e28f985ddd42e492f8a4d3c
# Step1 from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import json import time # Step2 def PrintSetUp(): # 印刷としてPDF保存する設定 chopt = webdriver.ChromeOpti...
994,704
2cff03eda00dc3831ce7270731c34560db139055
from kafka import KafkaConsumer from kafka.admin import KafkaAdminClient, NewTopic REQUIRED_SUFFIXES = ["_events", "_sampleEnv", "_runInfo", "_epicsForwarderConfig", "_detSpecMap"] def get_existing_topics(kafka_broker): return KafkaConsumer(bootstrap_servers=[kafka_broker]).topics() def add_required_topics(kaf...
994,705
aeb7407fcaf2778f5aad1167d3fba7d4e968e7b8
from __future__ import annotations import falcon from app import auth_backend from app.schemas.login import login_schema class LoginResource: auth = {"auth_disabled": True} deserializers = {"post": login_schema} def on_post(self, req: falcon.Request, resp: falcon.Response): """ --- ...
994,706
ebd364f2111c211aa734031ecb2c4653442b234c
"""Tests for src/f_cli/resources/click_options.py.""" import json from typing import Any, Dict from unittest import TestCase import click from click.testing import CliRunner, Result from f_cli.resources.click_options import (click_common_options, click_debug_option, ...
994,707
494c5df655ba604ef3183c68f7b4eac9244d71a6
# date: 2019.08.01 # https://stackoverflow.com/questions/57308598/rectangle-moving/57309451#57309451 # https://www.qtcentre.org/threads/32958-multiple-QPropertyAnimations-after-each-other-how # https://doc.qt.io/qt-5/qpropertyanimation.html # https://doc.qt.io/qt-5/qtimer.html # https://doc.qt.io/qtforpython/PySide2/Q...
994,708
b3b79b80a7ea3fe4cee9e319c5a057ac6df8acd3
import os from demo_env.envs.demo_env import DemoEnv from stable_baselines.common.policies import MlpPolicy from stable_baselines.common.vec_env import DummyVecEnv, SubprocVecEnv from stable_baselines import PPO2 def train(): n_cpu = os.cpu_count() env = SubprocVecEnv([lambda: DemoEnv() for i in range(n_cpu)]...
994,709
3b0922bc08da4fd3ee20c892e9b2786bd920ca06
def hotdogify(my_string): """ This functions adds "_hotdog" to any string. """ return '{}_hotdog'.format(my_string)
994,710
8905b88c84f0b6fcc5e1d8ccc4bd929db36d9ee0
import pytest def one(): return 1 def test_one(): """ This test expect success """ expected = 1 actual = one() assert actual == expected class DanielPracticeError(Exception): pass # In this function error_we_raise=None specifies default value for the argument. # So in case you ca...
994,711
8fb2dc483efc385c77cad6b1ebcf7427813781c6
from tensorflow.python.ops.gen_math_ops import maximum from examples import creare_padding_mask, create_look_ahead_mask, Transformer import logging import tensorflow as tf from tensorflow.python.autograph.pyct import transformer import tensorflow_datasets as tfds from loss import CustomSchedule import matplotl...
994,712
d8e1379c43a70b9c2ec4a5046c71d0fbb2968c07
from .sortingcomparison import SortingComparison, MappedSortingExtractor, compute_performance, confusion_matrix from .multisortingcomparison import MultiSortingComparison
994,713
c71123b60fd7098fa8c550a724b177f23b72b8d6
import numpy as np import numpy.random as rd def int_plus(params): num = params['num'] if num == 0: return False low = params['low'] high = params['high'] maximum = params['maximum'] if low > high: raise Exception('[Integer Plus] high must be lager than low.') if low == high...
994,714
395374bcebdc4102dd90dd286dc8e560fd54463f
from django.urls import path from django.contrib.auth.views import (LoginView, LogoutView, PasswordResetView, PasswordResetConfirmView, PasswordResetDoneView, Passw...
994,715
b847126fa05e82ea69ce8d0bf82305679bdc772e
import pandas as pd import numpy as np import helpers train_data=helpers.train_data test_data=helpers.test_data pd.set_option('display.max_rows',train_data.shape[0]+1) pd.set_option('display.max_columns',train_data.shape[1]+1) # data shapes #print(train_data.shape) satisfied_number=len(train_data.where(t...
994,716
ffd154d9f3ec999bc5433404fb4a18bf9d9344a5
# =============================================================================== # Copyright 2013 Jake Ross # # 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/licens...
994,717
f4baecc1c0b3682df5e768b3845ed2e7b62f1044
from bigO import BigO from random import randint from sorting_algorithms import * lib = BigO() complexity = lib.test(bucketsort, "random") # complexity = lib.test(countsort_neg, "sorted") # complexity = lib.test(countsort_neg, "reversed") # complexity = lib.test(countsort_neg, "partial") # complexity = lib.test(countso...
994,718
8f9078ead1a42e260c505fe177d86acd53f41d54
print('a) Apresente a imagem e as informações de número de linhas e colunas; número de canais e número total de pixels;') import cv2 import numpy as np nome_arquivo = "arroz.png" imgbgr = cv2.imread(nome_arquivo,1) # Carrega imagem (0 - Binária e Escala de Cinza; 1 - Colorida (BGR)) img_arroz = cv2.cvtColor(imgbgr...
994,719
2e7490ea57f6dfd6d4c86536cba8d289215638cb
from flask_wtf import FlaskForm from wtforms import StringField, IntegerField, BooleanField, SubmitField, TimeField, FileField from wtforms.fields.html5 import EmailField from wtforms.validators import DataRequired, Email, Length, NumberRange class formCentros(FlaskForm): class Meta: csrf = False ...
994,720
f29ff142307b12cbd56b163d9afa1668ab97e5b5
from skiplistlist import SkiplistList lista = SkiplistList() for i in range(100): lista.add(i, i) print(lista) print("Altura: ", lista.h) #Será a maior altura possivel, se não for a mesma que a altura na nova lista ou da antiga-modificada algo deu errado segunda = lista.truncate(50) print("Segunda lista:", segunda...
994,721
0a94b3a400baaab6689ed3e412344d9315f42516
import web urls = ( '/', 'app.controllers.index.Index', '/docker', 'app.controllers.docker.Docker', '/ubuntu', 'app.controllers.ubuntu.Ubuntu', ) app = web.application(urls, globals()) if __name__ == "__main__": app.run()
994,722
15d1b50f14fc4a6189fc99c2d70db9a74ad69d9f
# 檔名:main.py # 功能:主程式、監聽訊息、鏈結加入其他功能 # TODO:實作 unload, reload import discord from discord.ext import commands import os # Bot object、設定指令開頭 bot = commands.Bot(command_prefix='$') token = os.getenv("ODQ4NDQ0NjU1MDQwNzI1MDEz.YLMtqQ.bGlL-_sXphITfCNFe38O9BHaIGg") # 從 token.txt 中讀取 token # 使用 os.path.join() 在不同作業系統會以 / 或是...
994,723
c5d85abdcde160ce10c287d6042742e05ae0951d
# 表单信息 from flask_wtf import FlaskForm # 表单由若干输入字段组成,每种字段用一种类接收,组成一种类,每种字段作为组合类的一种属性; from wtforms import StringField, PasswordField, BooleanField, IntegerField, TextAreaField, SubmitField, MultipleFileField ,SelectField,RadioField from wtforms.validators import DataRequired, Length, ValidationError, Email,InputRequir...
994,724
374d431b8006e1b763b3f9e25846d7a32b721a6e
import sys import parameter import socket import loadingGif from PyQt5.QtWidgets import QPushButton from PyQt5.QtWidgets import QApplication from PyQt5.QtCore import * class Base_Button(QPushButton): def __init__(self, text): QPushButton.__init__(self, text) self.colors = {True:'green', False:'ora...
994,725
cd353d3d76f925cf06d5c07d1a37108ff2e72588
#!/usr/bin/env python3 #Copyright (C) 2011 by Glenn Hickey # #Released under the MIT license, see LICENSE.txt """ Wrap a tree and add some simple partitioning functionality. note that nameUnlabeledInternalNodes() and computeSubtreeRoots() need to be called (in that order) for anything to work... """ import math f...
994,726
e2d4f2e3178e7fd816dd5d2ac0ae732327e0a5f7
import torch import os import io import codecs import xml.etree.ElementTree as ET from collections import defaultdict from torchtext.utils import (download_from_url, extract_archive, unicode_csv_reader) URLS = { 'Multi30k': [ "https://raw.githubusercontent.com/multi30k/dataset...
994,727
4303419f0bad63581cc0d4b012f3e2a754bd9125
from Framework import * import random import sys import time PLAYER_LIST="PLAY" REPLY = "REPL" ERROR = "ERRO" GAME_START="GAME" # send to bootstrap to get game details DETAILS="DETL" # bootstrap replies with this as first message followed by PLAYER_LIST messages PLAY_START="PSTA" INFORM_GAME_END_BOOTSTRAP="OVER" LEAVI...
994,728
06cae3f01468a59cd1860b0974fee41c0e034aab
from selenium import webdriver from bs4 import BeautifulSoup import pandas as pd from datetime import datetime as dt import time option = webdriver.ChromeOptions() option.add_argument('--headless') option.add_argument('--no-sandbox') option.add_argument('--disable-dev-shm-usage') driver = webdriver.Chrome('chromedrive...
994,729
ce8c73c7c6be13fc97de35ab0a0b913dd6d02740
#https://www.geeksforgeeks.org/turtle-programming-python/ import turtle #Inside_Out wn = turtle.Screen() wn.bgcolor("black") skk = turtle.Turtle() skk.color("white") def sqrfunc(size): for i in range(10): while 1==1: for i in range(10): skk.fd(size) skk.left(10) size = size + 5 sqrfunc(10) sqrfunc(...
994,730
5915c3f761288151a2f51f4b5f51b06fb137ca4c
import math import numpy import numpy.random as nrand import pandas as pd from pyquery import PyQuery as pq import datetime import time import enum def Month2int(monthstr): if monthstr=='Jan': return 1 elif monthstr=='Feb': return 2 elif monthstr=='Mar': return 3 elif monthstr...
994,731
b5f9f90112e810284d65a849a38f9d6f77f4b4ab
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from django.core.urlresolvers import reverse # Create your models here. class User(models.Model): username = models.CharField(max_length=50) password = models.CharField(max_length=50) email = models.CharField(ma...
994,732
b1a610ce52f81fcd65840da4652ee38b613553b5
import numpy as np class HashTableLP(object): def __init__(self,size, hashNum): self.item = np.zeros(size,dtype=np.object)-1 self.hashNum = hashNum def insert(self,k): for i in range(len(self.item)): pos = h(self, k)+i if pos >= len(self.item): ...
994,733
fa57aa0fe58e853af9eb0be6e95da567517c8d48
import os import shutil from cookiecutter import main import pytest CC_ROOT = os.path.abspath( os.path.join( __file__, os.pardir, os.pardir, ) ) @pytest.fixture(scope='function') def default_baked_project(tmpdir): out_dir = str(tmpdir.mkdir('pki-project')) ...
994,734
cea1dc029a3b3f1be40c33e073f9a79681f9c864
#!/usr/bin/env python # coding: utf-8 # In[ ]: class IntroductionClass: def __init__(self, data): self.data = data
994,735
46b9f5e6baf2f0fadd150d0176abea18b0714cc5
import yaml import requests from django.contrib import messages from django.shortcuts import render, redirect from django.contrib.auth.decorators import login_required from django.urls import reverse from django.http import HttpResponseRedirect from django.db.models import Q from django.http import JsonResponse import ...
994,736
e1de0385768bc990a8b86325e1a0bdd2be0e6552
import os Import('buildenv') zookeeper_include = Glob('zookeeper/include/*.h') if buildenv._isLinux: if buildenv._is64: Install('../lib','lib64/libscew.a') Install('../lib','lib64/libexpat.a') Install('../lib','lib64/libreadline.a') Install('../lib','lib64/libncurses.a') In...
994,737
72d58bb940ed1c4c0cae7b96d1a08022774e7f63
from django.contrib.auth.models import AbstractUser from django.db import models from django.utils.translation import gettext_lazy as _ from users.managers import UserManager class AskRegistration(models.Model): """Класс AskRegistration используется для описания модели хранящей временные коды регистрации. ...
994,738
0d36e0f7bf2c9d56530d167b5413aa097f8b2c24
from flask import Flask, render_template, request, url_for, flash, redirect, Response, session, send_from_directory from flask_bootstrap import Bootstrap import os from app.classes.MarioExtravaganza import MarioExtravaganza app = Flask(__name__) Bootstrap(app) app.secret_key = os.environ["SECRET"] ## MAIN PAGE @app.r...
994,739
ee351a423e4d883b38b190cc5c01e2d8b7a5eb92
# # Autogenerated by Thrift Compiler (0.9.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # # options string: py # from thrift.Thrift import TType, TMessageType, TException, TApplicationException from thrift.transport import TTransport from thrift.protocol import TBinaryProtocol, TProtocol tr...
994,740
bf6105e89fda11c3f817da77e220852772b23b5f
import bs4 from urllib.request import urlopen as uReq from bs4 import BeautifulSoup as soup #Opens webpages from gurps wiki and creates a csv with info about advantages, disadvantages, and skills #Open, Save, and Parce Webpage #Save info as csv #Opens the webpage and returns it #parameters should be type...
994,741
4c9a1e744958dd7e90b3780d7bcbaa0b9ec026cd
from numpy import * import scipy.linalg as ln import matplotlib import matplotlib.cm as cm import matplotlib.mlab as mlab import matplotlib.pyplot as plt import matplotlib.colors as col from matplotlib.colors import LogNorm from matplotlib.ticker import LogLocator,LogFormatter from matplotlib.backends.backend_pdf impor...
994,742
b8e7145ef91bb420d33d43d6bbde0cb582bdd551
from __future__ import unicode_literals from django.utils.translation import gettext_lazy from django.views.generic import ListView from django.http import HttpResponseRedirect from cradmin_legacy.registry import cradmin_instance_registry class RoleSelectView(ListView): paginate_by = 30 template_name = 'crad...
994,743
9fc768241e6b971cffee0a6f9831f0b2b1d575ec
import urllib.request import re def gethref(url): html_content = urllib.request.urlopen(url).read() r = re.compile('href="(.*?)"') result = r.findall(html_content.decode('GBK')) return result def find_links(website): html_content = urllib.request.urlopen(website).read() r = re.compile('href=...
994,744
0e13133348e7f75e8610697c84f902833394a50a
# -*- coding: utf-8 -*- from django.core.exceptions import ValidationError from django.db import models from django.db.models import Q from django.utils.text import slugify from django.utils.translation import ugettext_lazy as _ class Timetable(models.Model): school = models.ForeignKey("schools.School") name...
994,745
4c1f31c0e9250f63b6b0525494a4756e8c779bb8
# -*- coding: utf-8 -*- # wakeup.py import json import simplejson import subprocess from run import csrf from lib.files import * from lib.config import * from flask import request from flask import redirect, url_for from lib.upload_file import uploadfile from views.login import login_required from werkzeug.utils impor...
994,746
faee622d03dfafaf7cad75b6701577ac04bbf2dc
from summpackage.summtest import g print(g)
994,747
4f11c0a2e0e62c0a52ceb21fe107aed81a010632
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import matplotlib matplotlib.use('Agg') import json, urllib, numpy as np, matplotlib.pylab as plt, matplotlib.ticker as mtick, sys import sunpy.map from astropy.io import fits from sunpy.cm import color_tables as ct import sunpy.wcs as wcs import datetime import matplotlib...
994,748
8421f655c229895cc780a658431d98319973bd0f
import time from time import sleep import pytest from application.snake import Snake #if tests fail, may have to increase sleepTime to give game instance more time to execute. sleepTime = 3 def test_start(): #create snake game instance, let it run until game over, then test if game over happened. snake = Snak...
994,749
4a3d96517baf56f926fe96478c1d25b147991fb1
#! /usr/bin/env python3 import numpy as np from PIL import Image def read_image(image_path): # Read image file img = Image.open(image_path) image_arr = np.asarray(img).copy() return image_arr if __name__ == '__main__': import argparse from steganography_decoder import Decoder from steganog...
994,750
595182e5f3c2e5829e7bbef3d7bf7d3bc4576c6f
from typing import List from logging import Logger from telegram.ext import Dispatcher, CommandHandler, Filters # Commands from .admin import admin from .registrasi import registrasi from .link import link from .formulir import formulir from .donasi import donasi from .elearning import elearning from .courses import c...
994,751
ee758f56035a5162f6f9b0b107468c36580bc104
import os,subprocess,psutil,re,shutil,datetime,sys,glob import urllib,urllib2,urllib3 from bioservices.kegg import KEGG from socket import error as SocketError import errno from Bio import SeqIO import xmltodict from xml.dom import minidom from xml.parsers.expat import ExpatError import random, time from goatools impor...
994,752
5465d8a0fc3c979d5b6331e1f6128458d7c86186
# Data Preprocessing Template # Importing the libraries import pandas as pd import matplotlib.pyplot as plt import hebb as hb import perceptron as per import form as fm # Importing the dataset def set_dataset(pass_data): dataset = pd.read_csv(pass_data) return dataset """ x = dataset.iloc[:,:-1].val...
994,753
200d83dad2ab78c89011134081cbf0ac643a7d05
# Generated by Django 2.1 on 2021-07-27 09:54 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('auction', '0004_auto_20210726_2220'), ] operations = [ migrations.CreateModel( name='Bid', ...
994,754
9400c95436dd14da30c48e2f1e1d71d4764a3630
def read_file(): filename = input('Enter path of file:') with open(filename) as f: print(f.read()) def write_to_file(): filename = input('Enter path of file: ') content = input('Enter content: ') with open(filename, 'w') as f: f.write(content) if __name__ == '__main__': re...
994,755
9b9f4acec3e2ff1fc78a2fc4b583f192eaffcc2d
#-*-coding:utf-8-*- dimension = 384 caseNum = 0 theta = list() items = list() featureRange = list() featureMean = list() def load_from_file(filename): global caseNum, theta, items with open(filename, 'r') as f: for line in f.readlines()[1:]: item = list() data = line.strip().sp...
994,756
ec54b510f29fabcad3f5c1869ad6536f2f2d28ee
from django.shortcuts import render from django.core.mail import EmailMessage from django.http import HttpResponse import json # Create your views here. def home(request): return render(request, 'home.html') def about(request): return render(request, 'about.html') def services(request): return render(req...
994,757
27412f1bd33d84dd9b567e15b000ca72c0fb55b8
from math import sin, pi import numpy as np class Heaviside: def __init__(self,eps=None): self.eps=eps def __call__(self,x): eps=self.eps r=np.zeros_like(x) if eps==None: condition=x>=0 r[condition]=1.0 else: ...
994,758
403b7b2cb60222ff752c2637725ffc135249e4d9
# # One Convergence, Inc. CONFIDENTIAL # Copyright (c) 2012-2014, One Convergence, Inc., USA # All Rights Reserved. # # All information contained herein is, and remains the property of # One Convergence, Inc. and its suppliers, if any. The intellectual and # technical concepts contained herein are proprietary to One Co...
994,759
cf665f5b1bfa3488696a06983e0c74cfeda0a075
#Podemos fazer repetições em python através do laço while #Vamos fazer um contador de 0 a 10 cont = 0 #O while testa a condição e se for verdadeira ele sera excecutado #diversas vezes ate que a condição se torne falsa #Enquanto variavel cont for menor ou igual a 10, cont recebe 1 while cont <= 10 : print(cont) ...
994,760
243a2964aeef7447fc007afb30af69ce80187301
import random number = random.randint(1, 9) won = False guessCount = 0 while True: guess = input("Guess a number between 1 and 9 - or type exit to quit: ") if guess == "exit": break else: guess = int(guess) guessCount += 1 if number > guess: print("Higher...") elif number...
994,761
77f3ada8b349dc8eb55751c3a7e21a5f835f173b
from TechnicalAnalysis import * import time class WilliamsIndicatorsTest(WilliamsIndicators): def __init__(self): self.WI_test = WilliamsIndicators() #self.all_candles = BinanceConnect.get_candles_list(self, self.currency_pair, self.time_interval) #self.candles_all_time = self.get_candles_...
994,762
85ef59830d6cd89109fcac38c110f5d107311788
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-12-19 17:35 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('wetLab', '0034_auto_20161219_1728'), ] operations = [ migrations.RenameField( ...
994,763
1cf78e3b8fd299eb4c8e43cac5cd5ba90e8c6dd6
from django.urls import path from .views import UserSerializerListView, CustomAuthToken urlpatterns = [ path('', UserSerializerListView.as_view()), path('token-auth/', CustomAuthToken.as_view()), ]
994,764
5310810f8672207b5e0830a2bff5c9ea31751965
bicycles = ['trek', 'redline', 'connondale'] message = "I have a " + bicycles[0].title() + "!" print(message) bicycles[0] = 'honada' //修改列表的值 print(bicycles[0])
994,765
50ab0b8c5f7a69e1def44431666daeeae3563e48
# Generated by Django 3.1.4 on 2020-12-10 22:32 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('proyecto', '0006_delete_aparece'), ] operations = [ migrations.AlterField( model_name='categoria', name='name', ...
994,766
030a541fc8172a6678db1451db1a9b84c973d9eb
# Copyright (c) OpenMMLab. All rights reserved. import copy from typing import Optional, Sequence import torch import torch.nn.functional as F from mmocr.utils.typing_utils import TextRecogDataSample from torch import nn from mmdeploy.core import FUNCTION_REWRITER, MODULE_REWRITER @FUNCTION_REWRITER.register_rewrit...
994,767
8f6cf9f95b7bab520045985c6bd260af001fd172
""" CP1404/CP5632 - Practical Program gets a password from user and displays the number of characters as asterisks. """ MINIMUM_LENGTH = 3 def main(): """Passes the password through the necessary functions""" password = get_password(MINIMUM_LENGTH) convert_to_asterisks(password) def get_password(MINIMU...
994,768
c8a197232ff5fea3cc00c84bde66d670624c0f6e
from fractions import gcd def int_input(): return int(raw_input()) def list_int_input(): return map(int, raw_input().split()) def get_years(): years = list_int_input() del years[0] years = list(set(years)) years.sort(reverse=True) return years def get_diff(years): diff = list() f...
994,769
1502067b1e6a2d394baf7c6b223f13cf56fb4eec
"""Intersect a single CSV file with multiple shapefiles.""" import argparse from concurrent.futures import ProcessPoolExecutor import os from random import randint from time import sleep from bison.common import BisonFiller from bison.common import get_logger, get_chunk_files, get_line_count # .........................
994,770
8a6334ebd06db59dc1da769b9c16ca0723b64c5a
# coding:utf-8 from . import app_seller from saihan import db from flask import render_template,request, url_for, current_app, jsonify from saihan.models import Product, Profile,ProductMedia,Order from flask_login import current_user, login_required import os import datetime # from saihan.models import ... ...
994,771
b890a6e4832dc4203da3e7d49e7204d6f5c35474
from flask import Blueprint, request # create a blueprint for the routes to be registered to, not necessary but ood for modularization of routes from back_end.models import create_db_connection, Groups # calling our helper function to create a connection to the databse to execute a request from botocore.exceptions impo...
994,772
755aa5af078f213238e87e1439c67411c9f30e57
__package_name__ = 'gdal-utils' gdal_utils_version = (3, 3, 2, 0) __version__ = '.'.join(str(i) for i in gdal_utils_version) __author__ = "Frank Warmerdam" __author_email__ = "warmerdam@pobox.com" __maintainer__ = "Idan Miara" __maintainer_email__ = "idan@miara.com" __description__ = "gdal-utils: An extension library f...
994,773
055c74bb3d98ed8155fb7556895b8c2aba135b19
def sequencia(x): if x==1 or x==0: return 1 elif x%2==0: y=x/2 return y elif x%2!=0: y=3*x+1 return y n=1 s=0 while n<1000: temp=n i=0 while temp!=1: temp=sequencia(temp) i+=1 if s<i: s=i w=n n+=1 print(w) ...
994,774
781235f0bc80e8eb4b0bfe952f70379c48f4ccb2
import numpy as np import collections import cPickle as pickle import os import random from gensim.models import word2vec def bulid_vocab(dataset, vocab_size): f1 = open("dataset/%s/train_source.txt" % (dataset, ), "r") f2 = open("dataset/%s/valid_source.txt" % (dataset, ), "r") f1_2 = open("...
994,775
9931cbef977d1dd7e725b1d2e9bb72a075c40692
#!/usr/bin/env python # encoding: utf-8 # for stderr # from TreeBuilder import show_tree # from english_parser import result, comment, condition, root import sys try: import readline except: print('readline not available') py2 = sys.version < '3' py3 = sys.version >= '3' import tokenize import english_tokens import...
994,776
6cd1896916763ea918a1b10911cde6304cd4fa7a
#Programa de inventario def menu(): print("---------------------------------") print("Bienvenido Escoge la opcion:") print("1 : Agregar Producto") print("2 : Quitar Producto") print("3 : Inventario") print("0 : Salir") def addProducto(): print("Agregar Producto") blMenuProducto = True ...
994,777
bc735711ff4ea77610706b2a95f849671deacb19
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from pants.backend.docker.goals.tailor import rules as tailor_rules from pants.backend.docker.rules import rules as docker_rules from pants.backend.docker.target_types import DockerImageTa...
994,778
d752f357849c3808748a0cab021c7722f1c5b3b9
import itertools from classes_pieces import King, Queen, Rook, Knight, Pawn, Bishop, Pieces class TwoPlayers: """ A class used to start playing between two players ... Attributes ---------- name_player1, name_player2 : str names of players start_positions : dict dict for...
994,779
be5fe4dcab58504acacf1977a402690bc42f86c8
#!/usr/bin/env python3 """ Convert H5 matrix to NxN3p TSV file.""" import sys import argparse import numpy as np from hicmatrix import HiCMatrix as hm from utilities import setDefaults, createMainParent __version__ = '1.0.0' def H5_to_NxN3p(matrix): hic = hm.hiCMatrix(matrix) chrom = hic.getChrNames()[0] ...
994,780
34dde960bf0995b4cc0b9888475dd70df8803c7b
# Testing of Generalized Feed Forward Neural Network import os os.environ['CUDA_VISIBLE_DEVICES'] = '0' import tensorflow as tf import numpy as np import gzip, cPickle, random import fnn_class_noise as NN_class # Getting the data path_here = '/usr/local/home/krm9c/shwetaNew/data/' datasets = ['arcene', 'cifar10', '...
994,781
6c89a44ad65663330b609302600cb1b6e31175bb
from django import forms from django.forms import ModelForm from .models import Item, Patron, Author class SearchModeForm(forms.Form): SEARCH_MODES = ( ('item', 'Item'), ('patron', 'Patron'), ) mode = forms.ChoiceField(label='', choices=SEARCH_MODES) class SearchForm(forms.Form): query = forms.CharField(la...
994,782
4886ef3fbc3398886fe91305f0f37dbe1350fd85
import argparse import catalyst as ct import pandas as pd import torch from pathlib import Path from catalyst.dl import SupervisedRunner from catalyst.utils import get_device from src.callbacks import get_callbacks from src.dataset import get_base_loader from src.losses import get_loss from src.models import get_mo...
994,783
39a777aa07b67d7a6d9428106ba27f37b275cd29
# How to validate Amazon access key and secret key is correct? get_all_regions()
994,784
ef29deea3e6f9a7cbf83db25b2120b249178070c
import sys import pickle import os.path from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request # If modifying these scopes, delete the file token.pickle. SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly'] # ...
994,785
dede18394c20f3a0e0edc6a6a44b4b7d77850eab
#Programme to find whether source and target word are transliterate word or not. If its a transliterate word then we get the shortest path that matched the target word. #Written by Roja(13-07-17) #RUN:: python get_transliterate_wrds.py eng hnd Sound-list.txt out > transliterate.txt #OUTPUT: out file contains path i...
994,786
14db769b61a00ce17734df032d244d681452b5a2
from django.forms import * #from django.forms.extras.widgets import SelectDateWidget from .models import * from django.forms import CheckboxInput from django.contrib.auth.forms import UserChangeForm from django.contrib.auth.models import User import datetime class VolunteerForm(ModelForm): def __init__(self, *arg...
994,787
db632f2ea08349cc9ca60131e5020f35936133c4
import tkinter import point from game_logic import * class board: def __init__(self,GameState): self.root_window = tkinter.Tk() self.GameState = GameState self.state = GameState.board self.row = GameState.height self.column = GameState.width self.turn = ...
994,788
ea27f5d36f23c5fea5008d638bda8790684adc11
from django.test import TestCase, Client from django.urls import reverse import json class BookViewTest(TestCase): def setUp(self): print("Test started") def testListView(self): client = Client() response = client.get(reverse("books:create")) def testCreateView(self): q...
994,789
4906486bf5d1acbcdb58b661c2451f41f2f7e8d4
name = "" while name != "Michael": name = input("What is your name?")
994,790
5e4785cddbf5b4fd8670bee90c1e0894428fcf74
''' @Author: dong.zhili @Date: 1970-01-01 08:00:00 @LastEditors : dong.zhili @LastEditTime : 2020-01-17 18:48:52 @Description: ''' import time import requests from dateutil.relativedelta import relativedelta import datetime import json import pandas as pd import requests def get_hist(code, start, end, timeout = 10, ...
994,791
6640588dbc59dfd23bc1346c0367b87fcc376df4
# coding=utf-8 from __future__ import absolute_import, unicode_literals, division from fcc.ast.expressions import (Expression, IntExpression, CharExpression, FloatExpression) from fcc.ast.variables import (VariableDefinition, IntVariableDefinition, CharVa...
994,792
49903764b06c2eba8aed47afe17977bca2dc18cf
"""Constants for the Wallbox integration.""" DOMAIN = "wallbox" CONF_STATION = "station" CONF_ADDED_ENERGY_KEY = "added_energy" CONF_ADDED_RANGE_KEY = "added_range" CONF_CHARGING_POWER_KEY = "charging_power" CONF_CHARGING_SPEED_KEY = "charging_speed" CONF_CHARGING_TIME_KEY = "charging_time" CONF_COST_KEY = "cost" CON...
994,793
afe2cec0a22b6c586b89042f788d0ee877ab4ddd
import math from keyloop.api.v1.exceptions import PermissionAlreadyExists, PermissionNotFound from keyloop.utils import generate_uuid class Page(object): def __init__(self, items, page, page_size, total): self.items = items self.previous_page = None self.next_page = None self.has_...
994,794
2347be4a07d9895d50b82213202af743b7c23eda
n, k = map(int, input().split()) # n : [1, 1000] infoList = [] for i in range(1, n + 1): infoList.append(list(map(int, input().split()))) infoList = sorted(infoList, key = lambda x : (-x[1], -x[2], -x[3])) print(infoList)
994,795
03783a571cf917b55d4083b3ce71e757f11ea25b
# -*- coding: utf-8 -*- __author__ = 'hyd' from abc import ABCMeta,abstractmethod from lib.exceptions import ArgumentTypeException from uuid import uuid4 ''' schemas : container : 标识一个容器 portId : 对应的交换机端口号 mac : container的mac地址 hostId : 容器对应的主机ID dpId : 容器所连...
994,796
3f7e698bfabcc1f5bf7f445d7c905f7908258f69
import SCons.Action import subprocess Import('env') Import('lib_env') asm_objs = env.Glob('blake2b-asm/zcblake2_avx*.o') blake2_src = Glob('blake2/*.c') benchmark_src = ['benchmark.cpp'] benchmark_objs = env.Object(benchmark_src + blake2_src + env['COMMON_SRC']) benchmark = env.Program('zceq_benchmark', benchmark_...
994,797
0b7cb1addd04b8c0518d1cec1acdaea86ef96fed
from django.contrib import admin from .models import Question, Source, Recommendation, Choice for model in [Question, Source, Recommendation, Choice]: admin.site.register(model)
994,798
0613de32318aeddb9cfcb810fe548c699bb508cb
# coding: utf8 __version__ = "0.4"
994,799
a98d028306b87ae4f1fc429e548ee3a10743fa9e
import scrapy from locations.items import Feature from locations.spiders.mcdonalds import McDonaldsSpider class McDonaldsZASpider(scrapy.Spider): name = "mcdonalds_za" item_attributes = McDonaldsSpider.item_attributes allowed_domains = ["www.mcdonalds.co", "www.mcdonalds.co.za"] start_urls = ("https:...