index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
996,500
6e6a7281e2b4c3180c2659aaf0d31f3d74b20c4e
class stack: def __init__(self): self.stack=[] def __len__(self): return len(self.stack) def stack_contents(self): return self.stack def is_empty(self): return len(self.stack) == 0 def pop(self, index=None): if index and int(index) not in range(self.__len_...
996,501
62d7dcb73a42da62b2a2b9c9bda0570409b556a8
from django.urls import path from . import views urlpatterns = [ path('', views.index, name="url_index"), path('<int:note_id>', views.note_detail, name="url_detail"), path('tag/<int:tag_id>', views.tag_detail, name="url_tag"), path('note_create/', views.NoteCreate.as_view(), name="url_note_create"), ...
996,502
1e845839c1461fb18721d96fee4dd66ece9fcc8f
# encoding: utf-8 # module PyQt5.QtGui # from C:\Users\Doly\Anaconda3\lib\site-packages\PyQt5\QtGui.pyd # by generator 1.147 # no doc # imports import PyQt5.QtCore as __PyQt5_QtCore import sip as __sip class QPaintDevice(__sip.simplewrapper): """ QPaintDevice() """ def colorCount(self): # real signature unkn...
996,503
5234bab4e0d635c52c22f14ae4cb9b194bfdb1ae
import RPi.GPIO as GPIO import dht11 import time from datetime import datetime import csv import sqlite3 # initialize GPIO GPIO.setwarnings(True) GPIO.setmode(GPIO.BCM) instance = dht11.DHT11(pin=17) try: result = instance.read() if result.is_valid(): conn = sqlite3.connect('data.db') now = datetime.now() r...
996,504
ff168f8f063b805f868d7daeb20353b2847b7e18
''' 注释的作用: 1.对你的代码进行解释说明 2.排错 注意:注释的内容是不会执行的 注释的格式2种: 单行注释:# 快捷键是ctrl+/(?键) 多行注释(块注释、文档注释):前后3个引号"""注释的内容""" '''
996,505
b1370ea4e0624fef4fd6501f9e2c0eb3e176bbc1
from TextToSpeech import * from GlobalHelpers import * from AzureHelpers import * def startBotGreeting(): greet = getRandomBotAnswers(botAnswers["greeting"]) BotSpeak(greet) return greet def humanIntroduction(): intent,responseIntentJson = AzureContinuousIntentFetching() intrGreet = map...
996,506
73dcaa5145d8614cc149ef201e74c22b41b06793
import math from display import * AMBIENT = 0 DIFFUSE = 1 SPECULAR = 2 LOCATION = 0 COLOR = 1 SPECULAR_EXP = 4 #lighting functions def get_lighting(normal, view, ambient, light, areflect, dreflect, sreflect ): A = calculate_ambient(ambient, areflect) D = calculate_diffuse(light, dreflect, normal) S = ca...
996,507
efd90ac54fe31acfc0644edd6332a09712c9934d
import json import re from django.apps import AppConfig from django.core.handlers.wsgi import WSGIHandler from django.utils.encoding import force_text class DjangoExtendedJsonConfig(AppConfig): name = 'djext.json' verbose_name = 'JSON tools' def ready(self): self.wrap_request() def wrap_req...
996,508
4899070a424edb09a67f951e1fa9a28e20fd025a
import torch from network import MobileNetv2 import importlib, pdb if __name__ == "__main__": cfg = importlib.import_module('config') net = MobileNetv2(cfg) net.eval() test = torch.Tensor(3, 224, 224).unsqueeze(0) out = net(test) saved = torch.load('mobilenetv2_pretrained.pth') weights = n...
996,509
1b7630b62fba31e701c845e13aace53b1e324bac
from tkinter import * window = Tk() window.title("List_box") window.geometry('400x300+1000+150') list1 = ['one', 'two', 'three', 'four'] var = StringVar() var.set(list1) lb = Listbox(window, listvariable=var) lb.pack() window.mainloop()
996,510
bb938b5b49d6d339f2cc64d223ae52258a56d34d
list1 = [3, 6, 8, 9, 1] #[0, 1, 2, 3, 4] #[-5,-4,-3,-2,-1] # get 0 position number print(list1[0]) print(list1[4]) # Add data to the list with append method # This method will add value at the end of list list1.append(2) print(list1) #Remove specific value from list list1.remove(6) print(list1) # Inser...
996,511
6cc44862b33a24edb2331217e6f67582da74df46
import math num1 = int(input("Digite o um Numero :-> ")) if num1 >= 0: print(f"O numero {num1} é positvo e eis a sua Raiz Quadrada:-> " + str(math.sqrt(num1)) + " E eis ele elevado ao quadrado :-> " + str(num1 ** 2)) else: print(f"O numero {num1} tá negativo")
996,512
b499312d32102e561a6fbe0567f009dc05b308ed
from logging import debug from proto import contest_pb2 from proto import contest_pb2_grpc from util.data import contest_cache class Contest(contest_pb2_grpc.ContestDataServiceServicer): def GetContestData(self, request, context): data = contest_cache[request.platform].get(request.handle) retu...
996,513
ac9c8e931be69eff88daa0c1b6770d6ff60b17b1
from collections import Counter class Solution: def removeDuplicateLetters(self, s: str) -> str: stack = [] counter = Counter(s) for letter in s: counter[letter] -= 1 if letter in stack: continue while stack and letter < stack[-1] and co...
996,514
dd13f037225e08ab0e1db8f47492358213dd5913
import unittest import time from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait as wait from selenium.webdriver.support import expected_conditions as EC class automation(unittest.TestCase): def setUp(self): self.driver = webdri...
996,515
4497865380745f8679a350244522c264af02b06e
#!/usr/bin/env python3 import re g5_footprints = [4158,4413,4669,4924,5180,5436,5691,5947,6203,6459] xb_footprints = [4156,4412,4668,4924,5180,5435,5691,5947,6203,6459] bt_footprints = [4154,4409,4664,4919,5175,5430,5685,5940,6196,6451] benches = ['g5','xb','bt'] bench_names = {'g5':'Graph500','xb':'XSBench','bt':'BT...
996,516
e1d28b2f77b061657501a607654ba0f40ec1c059
import re import numpy as np import pandas as pd def string_has_only_letters(input_string): if input_string is not np.NaN: return not any(char.isdigit() for char in input_string) else: return False # function for cleaning short date format def clean_short_date(value): # regex for dd/mm/...
996,517
22de63dfa5d29580946bfde77532351cb722fa8c
import pytest # Test configuration options for regression tests config = { 'event' : False, 'exe': 'openmc', 'mpi': False, 'mpiexec': 'mpiexec', 'mpi_np': '2', 'update': False, 'build_inputs': False } def assert_atoms_equal(res_ref, res_test, tol=1e-5): for mat in res_test[0].index_ma...
996,518
1cac4fbd6d4bb18902e9d4413ae6308613771620
import os import sys import numpy as np import torch import torch.utils.data as data from PIL import Image import random from torchvision import transforms sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from utils.lmdb_utils import * from utils.image_utils import * from utils import YOLO_...
996,519
14e54684f3fa446d9f8706f4dd0320d28e57bcfb
import re from morepath.publish import resolve_model as _resolve_model from ..interfaces import ISchema import jsl import jsonobject import dataclasses from copy import copy import typing from datetime import datetime, date def resolve_model(request): newreq = request.app.request_class( request.environ.co...
996,520
fccdeeeaa37448b5dae9ec12e26d1f6ae4727146
#!/usr/bin/env from __future__ import print_function from bluetooth import * print("Looking for compatible devices") nearby_devices = discover_devices(lookup_names=1, duration=10, flush_cache=True) for addr, name in nearby_devices: if name == 'Nintendo RVL-CNT-01' or name == 'Nintendo RVL-WBC-01': print...
996,521
b2775461cedf9fede947a81025740d268f9765a2
#!usr/bin/python3 ''' ask You are given a string S. Your task is to print all possible size k replacement combinations of the string in lexicographic sorted order. Input Format A single line containing the string S and integer value k separated by a space. Output Format Print the combinations with ...
996,522
d337bc55bfeac4d3a9fe2f2d6f94dbce66f394d4
import sys import os import math import pygame try: import _path except: pass import tiledtmxloader # 'frm' denotes the portals in a map # this function returns the coordinates of hero after entering the portal def entry(map_name,frm): if(map_name=='./maps/village1.tmx' and frm==0): return ...
996,523
7fd4e9102e7ed888188337dea448bce04942d89c
import computational_graph as cg
996,524
621091d2f6ec2a9ded2101d7ed7519baa75d43bf
def standaardtarief(afstandKM): prijs = 0 if afstandKM >= 50: prijs += 15.00 for x in range(afstandKM - 50): prijs += 0.60 if afstandKM > 0 and afstandKM < 50: for x in range(afstandKM): prijs += 0.80 return round(prijs, 2) def ritprijs(leeftijd, weeken...
996,525
f40a00af68b3056703c875fca34b3bd8d9b94afb
''' Created on 02/06/14 @author: kibanez ''' #!/usr/bin/python import sys, re, shlex , os, string, urllib, time, math, random, subprocess, shutil from multiprocessing import Process, Manager import inspect from itertools import izip_longest,groupby from operator import itemgetter import ConfigParser import opt...
996,526
6bc7eefc7de7b4ac5b4e56e69816b81b45e357fb
class Field: name = "" type = "text" xpath = None cssPath = None def __init__(self,conf): self.name = conf['name'] self.type = conf['type'] self.xpath = conf.get("xpath","") self.cssPath = conf.get("cssPath","") def parse(self,obj): if self.xpath !=...
996,527
e6733431da5d0388e618cbff7299ef9162b6d598
from newsapi.newsapi_client import NewsApiClient import requests import spotipy import spotipy.oauth2 as oauth2 import random import nltk from nltk.corpus import words ## Retrieve top headlines and append to list. def TopHeadlines(): news_URL = "https://newsapi.org/v2/top-headlines?country=gb&apiKey=10...
996,528
55b99e100612857799c1f059b1d7ece5c34f4951
from django.contrib import admin from django.urls import path,include from django.contrib.auth import views as auth_views from django.views.generic import TemplateView urlpatterns = [ path('admin/', admin.site.urls), path('',TemplateView.as_view(template_name='panel/home.html'),name='home'), path('dashboa...
996,529
209e087f851772b8fd197e2ad111f609eb802b0c
# 6-11. Cities: Make a dictionary called cities. Use the names of three cities as keys in your dictionary. # Create a dictionary of information about each city and include the country that the city is in, # its approximate population, and one fact about that city. # The keys for each city’s dictionary should be somethi...
996,530
bedf1c2a597f487ef67b08ab40b571ae9c3d15e0
def z(x, y): return (x-5.0) ** 2.0 + (y-5.0) ** 2.0 + 7.0 if __name__ == '__main__': delta_z = 10.0 alpha = 0.01 x = 10.0 y = 10.0 nvz = 0.0 while (delta_z > 0.0001): vz = z(x,y) x = x - (alpha * (2.0 * x - 10.0)) y = y - (alpha * (2.0 * y - 10.0)) nvz = z(x,y) delta_z = vz - nvz print(delta_z) pr...
996,531
76b3086aceb75852bae1f2bf5ef3fa08a6c03b9a
import datetime import pathlib import re from typing import List, NamedTuple from matata.util import log, UserError class TimeSheetEntry(NamedTuple): date: datetime.date start_time: datetime.time end_time: datetime.time def __repr__(self): date_str = self.date.isoformat() start_time ...
996,532
1b6a65e99a843d099e3f46f17539ea9e5dc7f163
mylist=[10,2,3,4,4,4,3,3,3,56,7] for i in range(len(mylist)//2): mylist[i], mylist[len(mylist)-i-1] = mylist[len(mylist)-i-1], mylist[i] print(mylist)
996,533
c5571f0e8214c1faf4ad40763daedde0af0a5941
import pyximport pyximport.install() from collections import defaultdict import string import random from deap import base, creator, tools import matplotlib.pyplot as plt import numpy import itertools from recurse_grid import recurse_grid_external from recurse_grid import BOARD_SIZE import matplotlib.animation as anim...
996,534
95206da57b75b0ede0bbe48074f0551a7defe849
""" Simple Pinkcoin p2p node implementation. """ from asyncio import open_connection, create_task, CancelledError from .buffer import ProtocolBuffer from .core.serializers import Version, VerAck, Pong from .exceptions import NodeDisconnectException, InvalidMessageChecksum class Node: """ The base class for ...
996,535
b39e5057e672a8f0d887b92f04c0685394956ab2
#!/usr/bin/python #-*- coding: utf-8 -*- import os import json import rrdtool import sys from errno import EEXIST from itertools import product from math import ceil from os import makedirs, remove from os.path import abspath, dirname, expanduser, isdir, isfile, join from time import sleep PROJECT_ROOT = abspath(dir...
996,536
19f6a6f1cb6921fe62d92975a84e3350cf184a1f
#----------------------------------------------------------------------------- # Runtime: 48ms # Memory Usage: # Link: #----------------------------------------------------------------------------- import sys sys.path.append('LeetCode') from ListNode import ListNode class Solution: def reverseKGroup(self, head...
996,537
9bf9558801deb3e6b85e35be1aa96ab1345755ae
# -*- coding: utf-8 -*- # Generated by Django 1.9.3 on 2016-05-03 21:52 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('dosirak', '0007_auto_20160503_2146'), ] operations = [ migrations.AlterField...
996,538
d349dd191613ecd0dc37cba72879cecc3420b72f
#!/usr/bin/python if __name__ == "__main__": import sys import cv2 import time import logging import ctypes import numpy as np from logging.config import dictConfig from openni import openni2 from openni import _openni2 as c_api else: from .Common import * logging_config = dict...
996,539
414ce8da4727c87a49c83729510f1d87cc631f3f
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: wj """ import tensorflow as tf import glob import os import modeling import tokenization import optimization import collections import pickle from sklearn.metrics import classification_report import re class InputFeatures(object): """A single set of feature...
996,540
ea7ccf07e43f37688b96b5257674500154a71d35
from django.contrib import admin from django.urls import path from . import views urlpatterns = [ path('',views.main, name='main'), path('upload/', views.upload, name ='upload'), path('upload_DB/', views.upload_DB, name ='upload_DB'), path('word/', views.word, name ='word'), path('test/', views.tes...
996,541
23432934cedd284859c002645447e646b160422f
"""Crimetime test file CPE 101 Spring 2020 Author: Brenden Rogers """ import crimetime import unittest class MyTest(unittest.TestCase): """To test crimetime files""" def test_create_crimes(self): # c_1 = ['13456', 'ROBBERY', 'BODILY FORCE'] # c_2 = ['13456', 'ROBBERY', 'ARMED ROBBERY'] ...
996,542
edcb33cfc5ecb25c7d97bc8567dcefd5829d81c3
import subprocess, sys, json, os import re import sys import struct from shutil import copyfile addr_lo = 0xffffffff81000000 # 0xffffffff81609000 addr_hi = 0xffffffff819a1000 # 0xffffffff8160c000 file_offset = 0x200000 # 0x809000 text_size = 0x9a1000 # 12288 def read_file(fname): with open(fname) as f: content = f...
996,543
74591fe7ce082079c4903d00390164c01ef7d2cc
from django.contrib import admin from basic_app.models import UserProfileInfo, User,UserPictureCount # Register your models here. admin.site.register(UserProfileInfo) admin.site.register(UserPictureCount)
996,544
5f286e36c96af123ed0571ddc9edbcc2a9eb6a29
"""This class defines a device capable to calculate a distance using RSSI values""" from miso_beacon_ai.ranging_functions import rangedistance class RSSIRanger: def __init__(self, frecuency, gain=1): """Constructor""" self.frecuency = frecuency self.gain = gain def rangedistance(sel...
996,545
3da9693a5c9e90229d788304a4a9fd42585597e6
from django.shortcuts import render, redirect, HttpResponse import random def index(request): if 'gold' not in request.session: request.session['gold'] = 0 context = { 'gold': request.session['gold'], 'message': request.session['message'], } return render(request, 'index.ht...
996,546
6206f37fbc3f78d3f7c0d755d9ec5b01806d3abe
print('Será que conseguiremos formar um triângulo com os lados fornecidos por você?') l1 = float(input('Digite aqui o valor do primeiro lado: ')) l2 = float(input('Digite aqui o valor do segundo lado: ')) l3 = float(input('Digite aqui o valor do terceiro lado: ')) if (l1 + l2 > l3) and ((l2 + l3 > l1)) and (l1 + l3 > l...
996,547
8293fb0d660779bf48fd76e4e74ef171ff742df7
#!/usr/bin/env python # -*- coding: utf-8 -*- """ 红包封面小程序接口 """ from typing import List, Optional from fastapi import APIRouter, Depends, Body from pydantic import BaseModel from sqlalchemy.orm import Session from starlette.requests import Request from app.api import deps from app.api.api_v1.endpoints.index import te...
996,548
39400d008ea7188f5be6e20426a42b17bdcfeb2a
# -*- coding: utf-8 -*- import scrapy from bs4 import BeautifulSoup import re class BasicSpider(scrapy.Spider): name = "ratings_page" allowed_domains = ["imdb.com"] start_urls = ( 'http://www.imdb.com/title/tt4425200/ratings?ref_=tt_ov_rt', ) def parse(self, response): percent_mat...
996,549
47e4e0bb7d74136730895ea5097c4db40383d4d3
from datetime import datetime import pytest from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import random import string E...
996,550
ac3ae792ff89d52809927e7c5f74b47fa4535460
ENTRY_POINT = 'sum_product' #[PROMPT] from typing import List, Tuple def sum_product(numbers: List[int]) -> Tuple[int, int]: """ For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list. Empty sum should be equal to 0 and empty product should be equal to 1. ...
996,551
b7cbe858fdf5caebcc6b59529dc7d9c743855f77
from rest_framework import serializers from .models import Movie, TVShow class MovieSerializer(serializers.ModelSerializer): class Meta: model = Movie fields = ['id', 'title', 'released'] class TVShowSerializer(serializers.ModelSerializer): class Meta: model = TVShow fields = ...
996,552
7ae4e851584f87966e87a3a52a8c4f7acb3c3216
from django.db.models.signals import post_save from django.dispatch.dispatcher import receiver from services.institutes.models import Institute @receiver(post_save, sender=Institute) def feed_signal_update(sender, **kwargs): instance = kwargs.get('instance', False) if instance: pass
996,553
5dcd7b8f257c10841a5f1411d4dc7fd0be03a11b
"""List utility functions.""" __author__ = "730444252" # TODO: Implement your functions here. def all(a: list[int], b: int) -> bool: """Check all.""" if len(a) == 0: return False i: int = 0 while i < len(a): if a[i] != b: return False else: i = i + 1 ...
996,554
e0fac845789454582f5122d3fba25cad12ab8b88
train = pd.read_csv("../train.csv") test = pd.read_csv("../test.csv") t=train y=train.Survived X = train.copy() X.drop(columns='Survived',axis=1,inplace=True) X=X.fillna(-999999) X_copy = X.copy() for c in train.columns[train.dtypes=='object']: X[c]=X[c].factorize()[0] for c in test.columns[test.dtypes=='object']: ...
996,555
462bba0a10998441a98fd2441a530ebbae9db34e
'''<b>Enhance Or Suppress Features</b> enhances or suppresses certain image features (such as speckles, ring shapes, and neurites), which can improve subsequent identification of objects. <hr> This module enhances or suppresses the intensity of certain pixels relative to the rest of the image, by applying image proces...
996,556
c81c2ae61458819a0ec891cf1a262a292157086d
import csv import random import string import mmap with open('cleaned_data_numerical_training.csv') as File: with open('blacklistedIpAddresses.txt', 'rb', 0) as file, \ mmap.mmap(file.fileno(), 0, access=mmap.ACCESS_READ) as s: rows = [] reader = csv.DictReader(File) for row in reader: blacklistedIpAdd...
996,557
ada716c1a40ba31342747c32ed0a2614f489df48
from tkinter import * from tkinter import ttk root = Tk() button = ttk.Button(root, text = "Click Me") button.pack() def callback(): print("Clicked") button.config(command = callback)
996,558
0c9d1e7ea5af94ed29dcbcc25e4b90cb05e2ffde
rule = {} rule['include'] = { 'regText':r"""(include|require)(_once){0,1}(\s{1,5}|\s{0,5}\().{0,60}\$(?!.*(this->))\w{1,20}((\[["']|\[)\${0,1}[\w\[\]"']{0,30}){0,1}""", 'content':"文件包含函数中存在变量,可能存在文件包含漏洞" } rule['preg_replace'] = { 'regText':r"""preg_replace\(\s{0,5}.*/[is]{0,2}e[is]{0,2}["']\s{0,5},(.*\$....
996,559
2426044395df4a1ef0003707e5ca2a4fc7a3843e
#Todo: use abstract class using abc #for more info at abc , goto : http://docs.python.org/2/library/abc.html class BaseInfo(object): #constructor for basic properties def __init__(self): self.name = None self.id = None self.type = None #the type of the drone #dimension of the drone self.h...
996,560
784cbd8090b06a9510f8e9d4473ff3a0b309916d
# BSD 3-Clause License # # All rights reserved. # Copyright 2021 Huawei Technologies Co., Ltd # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, ...
996,561
41a5fe2b1d8685e370eaea424fb22081a8225b98
## ## ## Las tuplas son listas inmutables, es decir, no se pueden modificar después de su creación ## No permiten añadir, eliminar, mover elementos etc (no append, extend, remove) ## Si permiten extraer porciones, pero el resultado de la es una tupla nueva ## no permiten búsquedas (no index). "ANTES DE LAS VERSIO...
996,562
8ff94abc53c7f99f671a8ab12d2f6c2c1c27f078
def nest_paren(s): if not s: return True if s[0] != '(' or s[-1] != ')': return False return nest_paren(s[1:-1]) if __name__ == "__main__": s = "((()))8" print(nest_paren(s))
996,563
4e7298bf6682a56c9b159c1ddb9daf94b42f4045
import train_and_val if __name__ == '__main__': train_and_val.train()
996,564
7e0f493efbde89e69d5b20b0e2ab85467ae55615
# # Python GUI - Buttons - Generic # from GUI.Properties import overridable_property from GUI.Actions import Action from GUI import Control class Button(Control, Action): """ A pushbutton control.""" style = overridable_property('style', "One of 'normal', 'default', 'cancel'") def activate(self): """Highl...
996,565
e781280557a183e556658d768987354baff48344
from bs4 import BeautifulSoup import html import logging import re def __parseHTML(page_html: str) -> dict: """Function to parse EDGAR page HTML, returning a dict of company info. Arguments: page_html {str} -- Raw HTML of page. Returns: dict -- Structured dictionary of company at...
996,566
17cddf1d7193db09d63d0cd2497c58bed7d95025
enroll = [] temp = {} with open('enrollment.json') as f: data = json.load(f) for name in face_names: temp["Name"] = name temp["Enrollment"] = data[name] enroll.append(temp) temp = {} payLoad = dict() payLoad["data"] = enroll ...
996,567
5ec7319ba4f228b1d1cdf158ca9a3f90b2bc6fd9
while(1): new,dict1={},{} list1,list2=[],[] count=0 print("Enter 1)Entering the data 2)Deleting the Element 3)Printing the value 4)mapping two list into dictionary :") c=int(input()) if(c==1): n=int(input("Enter the number of elements :")) for i in range(0,n): key=input("Enter the {} key : ".format(i+1)) ...
996,568
ab3edcda98d336b9016d5ccbc90fb27130c72c3c
from django import forms class ChangeForm(forms.Form): '''登录验证表单''' username = forms.CharField(required=True) password = forms.CharField(required=True,min_length=5)
996,569
fde0e11b0b37f0631192581cd9be786b926a0311
from math import log, ceil,exp, floor primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101] logs = [1.0,1.0] + map( log, xrange(2,101) ) hamNumbers = [] lim = 10**9 degree = 100 loglim = log( lim ) lims = map( lambda x: int( floor( loglim/x ) ) + 1, lo...
996,570
41f732487a1c1a7c04322391e0b33751882ea35f
##no.12 print("=======Nomer 12======") from random import* x = randint(1, 100) print("saya menyimpan sebuah angka bulat antara 1 sampai 100. Coba tebak") while True : a=int(input("masukan tebakan:>")) if a<x: print("angka terlalu kecil. Coba lagi") elif a>x: print("angka terlalu ...
996,571
bd9c6e119f16dead0b4d6920eaca754748faebfe
#!/usr/bin/env python3 import time from threading import RLock from typing import * import epd2in9.epd2in9 as epd2in9 from PIL import Image, ImageDraw, ImageFont class Display2in9: PIXEL_CLEAR = 255 PIXEL_SET = 0 POS_TIME_1 = (220, 0) POS_TIME_2 = (340, 30) def __init__(self): ...
996,572
486c53c8e3ecc644af0b32115621f0bab00a1a2b
import time import random from discord_webhook import DiscordWebhook, DiscordEmbed from datetime import datetime import dateutil.relativedelta end_contest = datetime.fromisoformat('2020-02-29 21:00:00.000') dt2 = datetime.fromtimestamp(time.time()) rd = dateutil.relativedelta.relativedelta (end_contest, dt2) DISCOR...
996,573
8f93d3ac6d9d806fbd702cd99aa1fc04621c3300
from fake_useragent import UserAgent import requests import json import settings import proxy_manager import cookie_manager import urllib.parse class PixivRequestManager(object): _rank_page = { "r-18": "https://www.pixiv.net/ranking.php?mode=daily_r18&p={count}&format=json", "safe": "https://www.p...
996,574
5b279b1ad8d6b49ebb98b37c28bbee8bccfada7a
from django.conf.urls.defaults import * from django.conf import settings from django.contrib import admin #Custom from tbForms.admin_views import edit_formulario, add_formulario from tbForms.admin_views import log_unidadesaude, log_unidadesaude_by_form from tbForms.views import correct_address from tbForms.views impor...
996,575
aa8d7ab5ba3b4540234a8eb4baecf8a47c096bef
class IOutputEngine(object): def output(outputString: str): raise NotImplementedError
996,576
7fea48e28060e22ab8e171c87cb435e148d35294
#! /usr/bin/env python # # Copyright Alex Tomkins 2010 # import sys import logging import locale import codecs import time import asyncore from optparse import OptionParser import ConfigParser from iabot.bot import IAJabberBot from iabot.jabber.stats import StatsThread # Ensure we use the right encoding for the ter...
996,577
090faca49eddd99e2a825441c5b0c9de849761a9
from setuptools import setup from codecs import open from os import path here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() setup( name='Werkzeug-Raw', version='0.0.1', description='Werkzeug meets Raw HTTP', l...
996,578
040ed371830fbf3dda4dbd043766c657e089a3fc
# Generated by Django 2.1.15 on 2020-05-27 12:05 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('authentication', '0001_initial'), ] operations = [ migrations.AlterField( model_name='user_category', ...
996,579
0ede1d88049c802871422ae4f141357dfee21cf7
def f(n, a, p, r): for i in range(1, n): t = p + a[i] if p < 0 and t <= 0: r += 1 - t t = 1 elif p > 0 and t >= 0: r += t + 1 t = -1 p = t return r n = int(input()) a = list(map(int, input().split())) # 最初がプラス p = a[0] r = 0 if p...
996,580
ad131574dff80f662b1d167ee94d0e241c79a29e
from django.shortcuts import render, redirect from django.views import View from store.models.customer import Customer from django.contrib.auth.hashers import check_password class Login(View): def get(self, request): return render(request, 'login.html') def post(self, request): errMsg = '' ...
996,581
f0e4eddeffe520fcde693f85e1f86073d166ed84
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on 01 May 2020 @author: Fleur Couvreux Modifications: 2020-06-04, R. Roehrig: Add z0 value + some cleaning/formatting GABLS1 original case definition From Kosovic and Curry 2000; Cuxart et al 2006; Beare et al 2006 From Kosovic and Curry 2000: The initia...
996,582
05339823adb0f2a136ce20da35eafc981b22cb0b
# http://bigocoder.com/courses/OBLUE01/OBLUE01_LEC15/BLUE_L15P08/statement import queue INF = 10E9 class Node: def __init__(self,id,dist): self.dist = dist self.id = id def __lt__(self,other): return self.dist <= other.dist def Prims(s): pq = queue.PriorityQueue() pq.put(Node(...
996,583
b17b5759b06a9251aef0261f08eb8cef4c1251bb
# Plotting results from the pen accelerometer import serial import matplotlib.pyplot as plt import time arduino = serial.Serial("COM5") x = [] y = [] for i in range(1000): line = str(arduino.readline()).decode("utf-8") arr = line.split(",") x.append(arr[0]) y.append(arr[1]) time.sleep(0.01) plt...
996,584
983a41b59a5af926d2b49da729c18182f5014f9d
import pandas as pd dataset = pd.read_csv("data/crabs.csv") dataset.drop("index", axis=1, inplace=True) # convert M e F para numeros dataset['sex'] = dataset['sex'].replace('M',0) dataset['sex'] = dataset['sex'].replace('F',1) dataset['sp'] = dataset['sp'].replace('B', 0) dataset['sp'] = dataset['sp'].replace('O', 1...
996,585
bd927465cc07659c1d87263d7841887e1c840fac
"""wap to get the parent and process id""" import os print(os.getpid()) print(os.getpid()) print(os.getpid()) print('*'*18) print(os.getppid()) print(os.getppid()) """ output: ------- 23192 23192 23192 ****************** 11520 11520 """
996,586
6c362f2b5091ecc86a31781df67ef3c136a000e5
import tensorflow as tf import numpy as np class CNN(object): def __init__(self, input_size, output_size, filter_sizes, num_filters, l2_reg_lambda=0.0): #placeholders for input, output, dropout self.input_x = tf.placeholder(tf.float32, [None, input_size], name='input') self.input_y = tf.pla...
996,587
ad64c49e1ba6171b81961ba9b29b23b4dd801e78
import requests from bs4 import BeautifulSoup from time import sleep from random import choice from termcolor import colored from csv import DictWriter base_url="http://quotes.toscrape.com" def scrape_quotes(): all_quotes=[] url="/page/1" while url: res=requests.get(f"{base_url}{url}") #print(f"Now Scraping {...
996,588
03ccf1a91411389f00cc766826618780ee279440
import RPi.GPIO as GPIO import time ''' LLCDHelper ''' class Display: """ This class encapsulated the Display """ # Define GPIO to LCD mapping LCD_RS = 7 LCD_E = 8 LCD_D4 = 25 LCD_D5 = 24 LCD_D6 = 23 LCD_D7 = 18 # Define some device constants LCD_WIDTH = 16 # Maximum ...
996,589
fa7fbd736f9e08880c23927311f5b61a1c4d0262
import os class Config: #秘钥 SECRET_KEY = os.environ.get('SECRET_KEY') or 'guess' #数据库相关配置 SQLALCHEMY_COMMIT_ON_TEARDOWN = True SQLALCHEMY_TRACK_MODIFICATIONS = False #邮件发送 MAIL_SERVER = "smtp.googlemail.com" MAIL_PORT = 465 MAIL_USE_TLS = False MAIL_USE_SSL = True ...
996,590
a99d5b1fd58c63bbb0e89a2a99066d93181b087e
import unittest from werkzeug.exceptions import BadRequest from unittest import mock from parameterized import parameterized from salsa.api import user_accounts as user_accounts_api from salsa import permission from tests.unit.api import ApiUnitTestCase, PermissionsTestCase from tests import SalsaTestCase from tests....
996,591
96f1bfded8984f8efa5ccbbf9f4fdcefb64de8c6
# -*- coding: utf-8 -*- import string import codecs from solvertools.util import get_dictfile from solvertools.phonetic.arpabet import arpa_to_ipa from collections import defaultdict def translate_cmu_entry(entry): text, phonemes = entry.split(' ') if len(text) > 3 and text[-3] == '(' and text[-1] == ')': ...
996,592
65e5e3fdae9fe3dea2990ac1b9500f7acb01550b
def origin(messages, index): j = 0 for j in range(0, len(messages)): if messages[index] == index: return index break else: index = messages[index] if __name__ == "__main__": with open("MessageOriginsIN.txt", "r") as f: while True: ...
996,593
d5f42748ee1de12c7a07a4e22642e905d362cd5c
# Geral from functools import partial # Kivy from kivy.clock import Clock from kivy.properties import StringProperty, ObjectProperty from kivy.uix.behaviors import ButtonBehavior from kivy.uix.boxlayout import BoxLayout from kivy.uix.label import Label from kivy.uix.popup import Popup from kivy.uix.button impo...
996,594
199ea19d0fb83667d1fa63e183e96de28e9e710a
# try: # from umihico_commons.google_cloud_vision_api.request import get_text_dict # except (Exception, ) as e: # from .umihico_commons.google_cloud_vision_api.request import get_text_dict # # from threading import Thread # #
996,595
135053df77c4f559b5c142f6dbb38cfa2eea0860
# homework assignment section 8-16-2 from chapter08 import printing_functions as pf pf.sandwich('ham', 'cheddar', 'mustard')
996,596
4c98d9e8933e0174ef95cbc5e5de0ef77d578aaa
# -*- coding: utf-8 -*- """health-insurance-cost-predicition (1).ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1jqmXZi6u-gvmF1m7dUFVM9plXZT8scis # Prediction of Health Insurance Cost by Linear Regression ### Loading the libraries and modules "...
996,597
d84b185c56939d66af615cd64e36c63739ab96f9
#Booleans print(10 < 8) print(21 > 12) print(34 == 22) #If statements with booleans a = 200 b = 33 if b > a: print("b is greater than a") else: print("b is not greater than a") #bool() function allows you to evaluate any value, and give you True or False in return, print(bool("Hello")) print(bool(15)) #Lis...
996,598
7449ff63b52da9b48764531d4fd9d74538cdac35
n, l = map(int, input().split()) k = int(input()) a = list(map(int, (input().split()))) li = 0 ri = 10 ** 9 def check(i): sp_cnt = 0 pre = 0 for j in range(n): if a[j] - pre >= i and l - a[j] >= i: sp_cnt += 1 pre = a[j] if sp_cnt >= k: return True ...
996,599
d5e1c68cad6e6d73914c3b518e20b012b42c5608
#!/usr/bin/env python3 # """Analyze and warn of memory leaks as well as uploading result on test machine.""" """Usage: python3 ./memory_leak_analyser.py --file memory_info.log """ import argparse import datetime import json import os import statistics import time from enum import Enum from functools import reduce imp...