index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
986,400
e4a715eeea1024121fedbc4a4dba0b6973ce5113
import subprocess,os,sys from timeit import timeit # timeit.timeit(stmt, setup, timer, number=??) count = 10 def timingIt(prog): cmds = "import subprocess,os,sys;" cmds += "from timeit import timeit;" cmds += 'subprocess.call(["' + prog + '"],stdout=open(os.devnull, "w"))' print prog, ...
986,401
25ea6de399dc5476199d73f24e231d9a89a349ca
EPS = 0.00000001 if __name__ == "__main__": T = int(raw_input()) memo = {} for cnt in xrange(T): n = int(raw_input()) hikerInfo = [] # STARTING POSITION, NUMBER OF CIRCLES, FASTEST POSITION for i in xrange(n): hikerInfo.append(map(int, raw_input().split())) ...
986,402
96b30501ea4bd19b8ea01da1ded25b7c87150dd1
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ @Author :yicg @Time : 2021/2/18 下午4:31 @Version : 1.0 @Description : """ import time #1.基本操作 print(time.asctime()) # 当前时间的国外时间格式 Thu Feb 18 16:34:19 2021 print(time.time()) #当前时间戳 1613637308.6508229 time.sleep(1) # 等待时间 print(time.localtime(1613637308.65...
986,403
489f4a9e178908812bfcf863dc9877b25b927c59
import numpy as np import cv2 img = cv2.imread('im1.jpg') cv2.imshow('original',img) cv2.waitKey(0) cv2.destroyAllWindows()
986,404
6ec44e03d75b794bea0f693466b6f85e2a85433c
from mpi4py import MPI comm=MPI.COMM_WORLD rank=comm.Get_rank() sendmsg=rank print("I am rank {} I have sendmsg as {}".format(rank,sendmsg)) recvmsg1=comm.reduce(sendmsg,op=MPI.SUM,root=0) if rank==0: print("rank zero",recvmsg1) print("all reduce at rank {}".format(rank)) recvmsg2=comm.allreduce(sendmsg,op=MPI...
986,405
93d1b40ff4803fb2846251325784c4b94961381b
from argparse import ArgumentParser import logging from run_tests import run_test def main(): """ :return: """ parser = ArgumentParser() parser.add_argument( "--testing", type=bool, default=True ) parser.add_argument( "--test_type", type=str, ...
986,406
60a7f8efb0c344579cf9ac772163d45f15325f68
import abjad import baca from akasha import library ######################################################################################### ########################################### 02 ########################################## ######################################################################################...
986,407
c22298845895673b7e5cf5544183539bd760f171
""" This is the virtual base class of retriever """ import os import numpy as np import torch from metrics import * from utils import * class BaseRetriever(torch.nn.Module): def __init__(self, documents, config): """ Args: - documents: a big dict for all documents ...
986,408
4be70e87b58cab629f47098eecc769f2e9033f74
import re import unittest # with open('../../input/day22') as f: with open('../../input/day22-sample') as f: data = f.read().strip().split("\n") p = re.compile(r'(\w+) .=(.*),.=(.*),.=(.*)') ins = [] X = set() Y = set() Z = set() for line in data: m = p.match(line) switch = m.group(1) == 'on' x1, x...
986,409
ec5e1259841b8fe2aa51b90fe114b5769d654733
# prepare_data() # make_experiment() # collect_result() import re import shutil import subprocess import sys import fortranformat as ff import logging from saxs_experiment import LogPipe import os def prepare_data(all_files, tmpdir, method, verbose_logfile, mydirvariable): for file in all_files: # not strict form...
986,410
99f05120d9dac847d52c21155880031b96c86a7e
from bs4 import BeautifulSoup import requests, lxml, html5lib import pandas as pd class nflScraper(object): """ Base class for web scraping NFL data. Basic operations are: 1. find a link 2. find a table 3. extract information from table. """ domain = "https://www.pro-football-...
986,411
4d94c43e797d7920c74fd2bb011f5f4177a11765
Solution to [Validating and Parsing Email Addresses](https://www.hackerrank.com/challenges/validating-named-email-addresses)
986,412
fd1cc2138aee2d8baa32057e25d7c1b206a52e44
import indiesolver import numpy as np import scipy def evaluate(solution): x = solution["parameters"] mf = 3 collf = CollGaussRadau_Right(num_nodes=mf, tleft=0.0, tright=1.0) # coll = CollGaussLobatto(num_nodes=m, tleft=0.0, tright=1.0) # coll = EquidistantNoLeft(num_nodes=m, tleft=0...
986,413
d3e105d8cc972d42840f5a659ba3efb8a6276974
import geoip2.database # # create a reader object # reader = geoip2.database.Reader('/home/yang/pyproject/i2p/GeoLite2-City.mmdb') # # give the ip address # response = reader.city('223.3.68.179') # # get the attribution of the ip # print(response.country.iso_code) # # print(response.location.latitude) # # print(respo...
986,414
ac161f6441e8f5f66b22426b2a898b3cc3afebab
# -*- coding: utf-8 -*- import nose import unittest import time from suds import WebFault from suds.client import Client from suds.sax.element import Element from authenticator import Authenticator from creation import * import db import datetime import urllib2 import base64 ids = [ 18559, 64272, 64309,...
986,415
e16e7b3bd9064cf4adb70a6e0883cdbdbc119551
import re import boto3 import pandas as pd from botocore.exceptions import ClientError from typing import List BUCKET_NAME = 'sok-repository-eval-benchmarks' client = boto3.client("s3") def get_csv_files_in_s3_path(path: str, filter: str, get_s3_url: bool = False): response = client.list_objects(Bucket=BUCKET_NA...
986,416
f72e860d6d4a3a33961195081f5e0dccf3c1476f
#!/usr/bin/env python3 # Copyright (c) 2002-2017, California Institute of Technology. # All rights reserved. Based on Government Sponsored Research under contracts NAS7-1407 and/or NAS7-03001. # # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the followin...
986,417
6bbce1d9ea5e7027b3c1f4a77611a93b3d657172
import django from django import template from django.template.base import Node, NodeList, TemplateSyntaxError, token_kwargs from django.template.library import parse_bits from django.utils.safestring import mark_safe from django_components.component import registry # Django < 2.1 compatibility try: from django.t...
986,418
a93c08285db122733789db6871b4dbb8fb9b8f37
from django.db import models # Create your models here. class Search(models.Model): topic = models.CharField(max_length=100)
986,419
0c72656d3872c3af5c9fc5339432e68ebe5673b1
import pandas as pd import seaborn as sns import matplotlib import matplotlib.pyplot as plt # 한글 설정 import platform print(platform.system()) if platform.system() == 'Windows': matplotlib.rcParams['font.family'] = 'Malgun Gothic' # '맑은 고딕'으로 설정 else: matplotlib.rcParams['font.family'] = 'NanumGothicCoding' #...
986,420
2895bbc6da5091e0bdd5b4f2b16e82183824ff03
#coding=utf-8 import RPi.GPIO as GPIO import time servopin = 18 GPIO.setmode(GPIO.BOARD) GPIO.setup(servopin, GPIO.OUT, initial=False) p = GPIO.PWM(servopin,50) #50HZ p.start(0) time.sleep(2) def turn(s,t): k=s if s<=t: while k<=t: p.ChangeDutyCycle(2.5 + 10 * k / 180) #设置转动角度 time.sleep(0....
986,421
7008dc1f4bad0bf31d9a41e445fe7488fff4f1ac
import math def solve_c(path="E:\\Users\\Neta\\Desktop\\dashyts\\googlejam.txt"): f = open(path, "r") T = f.readline() T = int(T) #path_out = "E:\\Users\\Neta\\Desktop\\dashyts\\googlejamSOL.txt" #fout = open(path_out, "w") case = 0 for i in range(T): line = f.readline() ...
986,422
21336c984053c7f4827320b54f601a315b522e02
import sys import os import numpy as np import skimage.io as skio import matplotlib.pyplot as plt import skimage as ski import math def returnRowsAndCols(image): return image.shape[0], image.shape[1] def negativefunc(originalImage): rows = originalImage.shape[0] cols = originalImage.shape...
986,423
81781d5f67f2e3fc2159c7ea7db51d4767936057
# North Sea example # ================= # # .. highlight:: python # # This example gives an overview of how to set up a tidal model of the North Sea. # # In this demo, we are working with geographic data and so need to import a number of # additional packages and configure for the right timezones and map projection. It...
986,424
91f695e2a981d21a031f1f41ee9c80da9494447e
from experience_replay import PrioritizedExperienceReplay import numpy as np from numpy import clip from numpy.random import rand, randint from atari_preprocessing import ProcessedAtariEnv from deep_q_networks import DeepQNetwork import tensorflow as tf from tensorflow import math argmax = math.argmax import time impor...
986,425
bd61fe6523c58bcc6692016d8da60f5417d5c376
def main(): print("hello my name is Matheus Guelfi") main()
986,426
bf2ddb7a6878c6875d367714181271dc624f2a55
matrix = [ [112, 42, 83, 119], [56, 125, 56, 49], [15, 78, 101, 43], [62, 98, 114, 108] ] def flippingMatrix(matrix): # Write your code here n = int(len(matrix) / 2) current_sum = _compute_sum(matrix) max_value = 0 max_value_location = (0,0) for i, row in enumerate(matrix[n...
986,427
5c599c58f29d79d7c7fd611cfbef00d0b2e193f9
# Generated by Django 2.1.7 on 2019-04-04 14:06 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("khetha", "0002_schema_sketch")] operations = [ migrations.AlterModelOptions( name="answeroption", options={"ordering": ["order"]} ), ...
986,428
7bec7793eca7a8fc621dbf5d48ca890785fcb193
from apps.users import dm_users from flask import redirect, session, jsonify from apps.users.a_schemas import UserSchema from server.connection import update from functools import wraps from apps.logs import o_logs from apps.users import m_users def user_active_required(func): @wraps(func) def wrapper(*args, ...
986,429
50b24385df344259552a593cd60c5433d500072a
import os, io, json, shutil from django.core.exceptions import SuspiciousFileOperation from cmsplugin_cascade import app_settings import tempfile try: import czipfile as zipfile except ImportError: import zipfile def unzip_archive(label, zip_ref): common_prefix = os.path.commonprefix(zip_ref.namelist()) ...
986,430
c0011ac48c4f8caa314e17b35d9e3445eb8879cb
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2019 Arne Köhn <arne@chark.eu> # # 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...
986,431
573e7c3904f02c0b7998a02497355d09d3b6c20d
# -*- coding: utf-8 -*- import unittest from typestruct import Packet, types, Endian from dataclasses import dataclass @dataclass class ExamplePacket(Packet): bool: types.Bool int8: types.int8 int16: types.int16 int32: types.int32 int64: types.int64 bool2: types.Bool uint8: types.uint8 ...
986,432
b5025289ef465e1bbe4c15232ec34a57c855a4ab
import numpy as np from sklearn import datasets iris = datasets.load_iris() iris_data = iris.data iris_labels = iris.target #print(iris_data[0], iris_data[79], iris_data[100]) #print(iris_labels[0], iris_labels[79], iris_labels[100]) np.random.seed(42) indices = np.random.permutation(len(iris_data)) n_training...
986,433
c080439d910f4c7fedb959bcfcc6adececccb867
#autor:Roberto Ortega Ortega """validarNombre: algoritmo que segun el las opciones introducidas, redireccionara las acciones a otro algoritmo, para asi continuar con el proceso de montaje""" from src.aleatorioConocido import aleatorioConocido from src.aleatorioNuevo import aleatorioNuevo from src.secuencialConocido i...
986,434
1dc68d4368d9f0f563ef26464b69b76071b0c7f0
afgelegde_km = float(input("Hoeveel km leg je jaarlijks af? ")) verbruik = float(input("Hoeveel liter verbruik je per 100km? ")) prijs_per_liter = float(input("Hoeveel kost brandstof per liter? ")) totale_kosten = afgelegde_km * (verbruik/100) * prijs_per_liter kostprijs_km = verbruik / 100 * prijs_per_liter print("D...
986,435
96dfbfd8155cbc38f5b81532613a71c26876d1d1
#!/usr/bin/env python3 import os import numpy from distutils.core import Extension, setup import distutils_pytest # seems that this will clean build every time, might make more sense to just have a lightweight wrapper & precompiled lib? cppmodule = Extension( 'humanleague', define_macros = [('MAJOR_VERSION', '2')...
986,436
10d53aade8b00306de47bef73850045478bb75bc
from django.db import models from django.conf import settings from datetime import datetime from rest_framework.reverse import reverse as api_reverse class Task(models.Model): name = models.CharField(max_length=200) user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, blank=True, null=...
986,437
28a8d81c442d6b06784b81a74b1555486043c2b1
from flask import Flask, render_template, request, redirect, session # Import Flask to allow us to create our app. app = Flask(__name__) # Global variable __name__ tells Flask whether or not we are running the file # directly, or importing it as a module. app.secret_key = 'bcxjnmkbnhbfrvsgh...
986,438
fd376c909598143d2f508b70e80c9916f508df18
from collections import Counter def function_length_frequency(func, hrange): return Counter(len(func(n)) for n in hrange).most_common() if __name__ == '__main__': from executable_hailstone_library import hailstone upto = 100000 hlen, freq = function_length_frequency(hailstone, range(1, upto))[0] ...
986,439
ef459201d8abd580093c3157d9e1800b988bb188
#calss header class _RAP(): def __init__(self,): self.name = "RAP" self.definitions = [u'a type of popular music with a strong rhythm in which the words are spoken, not sung: ', u'a statement accusing someone of a crime, or the punishment that someone is given for a crime: ', u'a judgment or a reaction: ', u'a ...
986,440
d58a662dab81e43f9ec1a3f79a6182ecd8f86836
from django.test import TestCase from .models import * import pandas as pd import requests import json # Create your tests here. def create_data(): result = pd.read_csv('../data/data_adg/지하철_교육시설포함_최종.txt', sep=",", encoding="utf-8") # result = pd.DataFrame(result,columns=["result_id","address", "gu", "dong", ...
986,441
252e5edc7a1ec8ddf53f1e632e5efbc9390181a2
x=[1,2,3,4] y=[5,6,7,8] a=0 b=0 for i in range(len(x)): if i%2==0: a=a+x[i] for k in range(len(y)): if k%2!=0: b=b+y[k] print(a+b)
986,442
bd34535000e9551e915945ed077bc43d30b77fe9
import requests import argparse from termcolor import colored import time print(colored(""" _ _ _ _ _ _ | || | |_| |_ _ __ | (_)_ _____ | __ | _| _| '_ \ | | \ V / -_) |_||_|\__|\__| .__/ |_|_|\_/\___| |_| #C0ded By Red Virus ...
986,443
e17fa09f6b9bb247c9e7483a69f8bd1bc6aa8793
#!/usr/bin/python3 pip install -r requirements.txt
986,444
4a7233b40d06d7458d450f3965f085b570e668d3
import requests #Opening file books_rest = requests.get('http://pulse-rest-testing.herokuapp.com/books') print(books_rest.json()[0]) print(books_rest.text) print(books_rest.status_code) print(books_rest.headers) #First script payload = {'title': 'Kobzar', 'author': 'Taras Shevchenko'} r = requests.post('http://pulse-...
986,445
10a448260898f39ec04501d93b6d6cfeabdb149f
print("Welcome to the rollercoaster!") height = int(input("What is your height in cm? ")) bill = 0 if height >= 120: print("You can ride") age = int(input("How old are u? ")) if age < 12: bill = 5 print(f"Children pay ${bill}") elif age <= 18: bill = 7 print(f"Youth pay ...
986,446
40a492927dd0acf8c7b1a83fa0cbf231626ed9e8
# -*- coding: utf-8 -*- """ Created on Thu May 10 16:17:20 2018 @author: HUDSON """ """ Constroi a estrutura de uma rede neural artificial """ from pybrain.structure import FeedForwardNetwork from pybrain.structure import LinearLayer, SigmoidLayer, BiasUnit from pybrain.structure import FullConnection rede = FeedForw...
986,447
8faf3b175aceece7fe3c82517b3b90be538eb16a
'''initialize''' from .shapes import tetrisShape from .gameboard import InnerBoard, ExternalBoard, SidePanel
986,448
e76f85a035659b04534e816567a748f7876dd7c5
""" Name : c12_09_roll_a_dice.py Book : Python for Finance (2nd ed.) Publisher: Packt Publishing Ltd. Author : Yuxing Yan Date : 6/6/2017 email : yany@canisius.edu paulyxy@hotmail.com """ import random def rollDice(): roll = random.randint(1,6) return roll i =1 n=10 r...
986,449
3228b74dd15ce0534c2e01f2e366376ca20d2b39
import pandas as pd import sys path = sys.argv[1] train = pd.read_csv(path + '/' + path +'.train_modified.csv',low_memory=False) test = pd.read_csv(path + '/' + path +'.test_modified.csv',low_memory=False) valid = pd.read_csv(path + '/' + path +'.valid_modified.csv',low_memory=False) train['id'] = pd.DataFrame(rang...
986,450
5ce36e8ce45e5ef5b419c5fd7db03f5edd2d87c8
from .environment import Environment class Grassland(Environment): def __init__(self, name): Environment.__init__(self, name, animal_max=22, plant_max=15) def animal_count(self): return f"This place has {len(self.animals)} animals in it" def add_animal(self, animal): try: ...
986,451
633075ea98229f72c492a97dbaa19971847b7fb4
import discord import random from discord.ext import commands from main import bot from cogs.errorhandler import rfooter class myhelp(commands.HelpCommand): def get_command_signature(self, command): return f"{self.clean_prefix}{command.qualified_name} {command.signature}" #the help command async def send_b...
986,452
71d4b2053e68b157b1b5c1bbae384b1d60e6568b
# Generated by Django 3.2.5 on 2021-07-29 08:33 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Task', fields=[ ...
986,453
c723784ceb1f0a7c699f95e1c8469ea32a4d78b2
#imports import discord from random import shuffle import configparser import random import requests import aiohttp import traceback import sys import re import json import time import asyncio import os from datetime import datetime from discord import game from random import randint from discord.ext import commands ...
986,454
39bf8f973810c62dbd32859696a1b7e3064b3298
# Generated by Django 3.0.7 on 2020-06-19 10:27 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('detalji_za_pretragu', '0001_initial'), ] operations = [ migrations.RenameField( model_name='detaljipretrage', old_name='nazi...
986,455
c422b8aea6f92106ce1fdf1f9960f04283a3821f
# -*- coding: utf-8 -*- ''' Data Quality Checking Module This module contains functions for identifying corrupt or bad quality data. ''' import numpy as np from solardatatools.utilities import local_median_regression_with_seasonal,\ local_quantile_regression_with_seasonal def daily_missing_data_simple(data_matr...
986,456
1da86ed225eed48d9f1ccd73419a290520d09f1a
import sys import re import networkx as nx known_edges = """ 1 2 2 3 3 5 5 8 8 13 """ edges = """ 1 2,7 2 1,3,14 3 5,6 4 6,8 5 3,8,10 6 1,4,10,11 7 1,2,9 8 10,13,15 9 5,7,10 10 7,11,12 11 2,3,6,9 12 4,5,7 13 8,12 14 15 15 11,16 16 13 """ edge_data = [] for a, bs in re.findall(r'(?m)^(\d+) ([\d,]+)$', known_edges + ed...
986,457
efd5a59831ecf5a488f3a73c59c93cec56414764
a=int(input('enter the value of a')) b=int(input('enter the value of b')) if a>b: print("a is greater than b") else: print("b is greater than a") dl309@soetcse:~/lekhana$ python3 pg123.py enter the value of a23 enter the value of b56 b is greater than a
986,458
7ec1ae74abde00d229d7792fc48a6c403352e980
#-Runs PCR-GLOBWB using the ERA-Interim Reanalysis over the period 1979-2010 inclusive # using mean daily temperature and daily GPCP-corrected rainfall totals as well as monthly reference # potential evapotranspiration based on Penman-Monteith # NOTE: the model is run by a generic water balance model that takes daily i...
986,459
945cdcdba30dbcf5e82f7ba8eb7c5e0b4e9d3176
# -*- coding: utf-8 -*- from . import engineering_bom_batch from . import engineering_bom from . import engineering_bom_component from . import engineering_bom_adjacency from . import engineering_bom_diff from . import engineering_part_diff
986,460
712e69b1e7f06f3e4ab351179a179514aecd1834
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None # this solution avoids extra space class Solution(object): def LCA(self, root, p, q): #base cases if not root: retur...
986,461
64fcb88d4949dfb6ae6cb237f5765766533346fb
#!/usr/bin/env python3 num = int(input()) if num % 2 == 0: num = num // 2 print(num) else: num = (num * 3) + 1 print(num)
986,462
0e04be1dfc78a91a388d0e761a5652a9ebbf9976
from django.conf.urls import url from . import views # urlpatterns是被django自动识别的路由列表变量 urlpatterns = [ # 每个路由信息都需要使用url函数来构造 # url(路径, 视图) url(r'^weather/([a-z]+)/(\d{4})/$', views.weather), ]
986,463
4b5d60b743d464a93ca041dbcd4e3db0260eb48f
# -*- coding: utf8 -*- from ffman.ffmpeg.framework.ffprobe import * from ffman.ffmpeg.framework.parameters import * class AVProb(object): """docstring for FFProbeFactory""" def __init__(self, inFile): self.input = Input('"'+inFile+'"') self.input.add_formatparam('-hide_banner', None) s...
986,464
7e85209c19785ccfbb4ef33fa2ec8e9194601e94
######################################################### ## CS 4750 (Fall 2018), Assignment #2 ## ## Script File Name: fst.py ## ## Student Name: Benxin Niu ## ## Login Name: bn2645 ## ## MUN #: 2015183...
986,465
b30fb35a4f152cb2d32ef25a4017208aabadceef
import csv import os import shutil from PIL import Image from pprint import pprint labelpath = r'C:\Users\Administrator\Desktop\Coding_stuff\facial_recognition\data\label\label.csv' imagepath = r'C:\Users\Administrator\Desktop\Coding_stuff\facial_recognition\data\image\cropped' destpath = r'C:\Users\Administrator\Desk...
986,466
ccbf8ee87a835481d6f915333d68598a0996f748
from mods import config_path config_path() from D26 import uconfig uconfig.features.train = [x for x in uconfig.features.train if not x in ["mult","nPho","nNeuHad","nChHad"]]
986,467
20c5dbd807065b4e6c3a4f8ed88fe2b0f7231dbc
# Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os from telemetry import test from telemetry.core import util from measurements import blink_perf class BlinkPerfAll(test.Test): tag = 'all'...
986,468
8c1172e38813500ece98c1370ef84bf621deb690
message = "Hello World" new_message = message.replace("World", "Universe") print(message[0:4]) print(message.count("Hello")) print(new_message) intro = "Game" outro = "Time" broadcast = f"{intro}, {outro.upper()}. Lets GO!" print(broadcast) # print(dir(outro))
986,469
64c001d0da88b9c28e3a5f51b0c20b0557c496f4
#!/usr/bin/python # -*- coding: utf-8 -*- # Coded by Rendy Andhika """ ngapai bosq? mau recode? tinggal pake aja susah amat sih?! """ try: import os, requests, time except ModuleNotFoundError: print("\nSepertinya module requests BELUM Di Install") print("$ pip install requests\n") exit() os.system('clear') c=('\0...
986,470
c4071ca13f3a2bfbbb01f5fcee8d6f0ebd883b37
import os, json from selenium import webdriver browser = webdriver.Firefox() url = r'https://free-proxy-list.net' browser.get(url) click_next = r'proxylisttable_next.click()' ip_list = {} def find_elements(browser): even_elements = browser.find_elements_by_class_name('even') odd_elements = browser.find_elemen...
986,471
9f400c3d0486fdedde3302392519832133c6ebeb
import numpy as np import matplotlib import matplotlib.pyplot as plt from random import randint from time import time def main(): # birthday paradox print(birthday_paradox_A(4000)) # birthday_paradox_B_plot_C() def birthday_paradox_A(n): numbers = set() while True: x = randint(1,n) if x in numbers: br...
986,472
29866d116c0678cb36864efec04d868e24e7d9f1
#a a,b=map(int,input().split()) if a%10==0: a=str(a) c=0 for i in range(len(a)-1,-1,-1): if a[i]=='0': c+=1 if b<=c: print(a) else: a=a[:-c] a=a+'0'*b print(a) elif 10%(a%10)==0: no=int('1'+'0'*b) while True: if no%a==0: print(no) break else: no+=int('1'...
986,473
b1c3954aaabe29dd26ba5d59496ba698ad901b08
import arcpy arcpy.env.overwriteOutput = True #sirve para sobreescribir los elementos arcpy.env.workspace ="D:/ShapesPruebasSegmentacionUrbana" arcpy.MakeTableView_management("D:/ShapesPruebasSegmentacionUrbana/ShapesFinal/zona_aeu", "zona_aeu_x") arcpy.MakeTableView_management("D:/ShapesPruebasSegmentacionUrban...
986,474
4b39cfd9888e984c49bc5bd5977661d0795c66cd
''' Сколько совпадает чисел Даны три целых числа. Определите, сколько среди них совпадающих. Программа должна вывести одно из чисел: 3 (если все совпадают), 2 (если два совпадает) или 0 (если все числа различны). ''' a, b, c = int(input()), int(input()), int(input()) if a == b == c: result = 3 elif a == b or a =...
986,475
b7bc776cf5dbd68b81add53c44c11480494dbccb
#!/usr/bin/python import json import requests from requests.exceptions import MissingSchema """ Stand alone module with all the functionality to grab geolocation data from the http://api.sba.gov site and write it into a file. """ def read_url(url): """ Tries to open a url, read its response and return it. ...
986,476
abdb59ea3afe450c12cb7748ba84cc121d7a8440
import os base_dir = '/mac/okehara/dev/keras_teset' train_dir = os.path.join(base_dir, 'train') test_dir = os.path.join(base_dir, 'test') validation_dir = os.path.join(base_dir, 'validation') # from keras import layers # from keras import models # # model = models.Sequential() # model.add(layers.Conv2D(filters=32, #...
986,477
b240ca220aaa866d44f20e6a6b10824cc8cacf17
# gearman-collectd-plugin - gearmand_info.py # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; only version 2 of the License is applicable. # # This program is distributed in the hope that it wi...
986,478
e0cf5e6ab0fc4d76e0d47d2d8072babe6cf5c54b
# -*- coding: utf-8 -*- # =========================================================================== # The waveform and spectrogram plot adapted from: # [librosa](https://github.com/bmcfee/librosa) # Copyright (c) 2016, librosa development team. # Modified work Copyright 2016-2017 TrungNT # ===========================...
986,479
44991cc0c929e66cf70d1db1fddd040cf5b4a412
from django.contrib import admin from embed_video.admin import AdminVideoMixin from .models import Song, VideoQuery, Choices, ActualSong class SongAdmin(AdminVideoMixin, admin.ModelAdmin): """Админка песен""" list_display = ("video", "name", "author", "duration_video") admin.site.register(Song, SongAdmin) cl...
986,480
0f434b71630a9cb4e4a0a3212ffdc65cf2057806
from rest_framework import routers from .api import LeadViewSet routers = routers.DefaultRouter() routers.register('api/lead',LeadViewSet,"lead") urlpatterns = routers.urls
986,481
afce968234ea595bbe32b98f12bcd1769f1dd105
#!/usr/bin/env python # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # ---------------------------------------------...
986,482
99561a17e389d817f2636345ade0bc7c63d7b85f
from django.contrib import messages from django.contrib.auth.decorators import login_required from django.core.exceptions import PermissionDenied from django.http import HttpResponse, JsonResponse from django.conf import settings from django.shortcuts import render, redirect, get_object_or_404 import logging import js...
986,483
9e90cd2c83906481156889028d06b7598f8f9260
import matplotlib.pyplot as plt import numpy as np import os import glob import mn.plot.genplotlib as genplotlib class CibData: def __init__(self, paramsfile, resultsfile): self.paramsfile = paramsfile self.resultsfile = resultsfile def Gendata(self): d = {} ...
986,484
cab7ee75ffb42e73895da865424006bbdd51d29d
prompt = ("\nPlease enter your name.") prompt += ("\nEnter q to quit.") while True: guest = input(prompt) if guest == 'q': break else: print(guest.title())
986,485
87ab31b8f156b076bb2b7c46985eb6bcef200891
import re import os import pdfplumber import codecs import pandas as pd # Массив с номерами дела number = list() # Массив с датой дела date = list() # Массив с номером суда дела court_number = list() def info_coolect(pdf_file): """Собираем массивы с № приказов, датами и № участков""" # Читаем первую страницу...
986,486
dc0fee3f9a6069ec9e76fe009462d39eb276cadf
#!/usr/bin/env python # code:UTF-8 # @Author : Sasuke import unittest,time from testfarm.test_program.app.weixin.element.main_page import HomePage from testfarm.test_program.app.weixin.element.master_page import MasterPage from testfarm.test_program.app.weixin.element.statement_page import Statement from testfarm.test...
986,487
a68f8a8f95882f62af30feb1a0aec4cd0fbcbae2
# Generated by Django 2.0.1 on 2020-01-27 04:37 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0033_auto_20200127_0428'), ] operations = [ migrations.AddField( model_name='settings', name='not_found_url'...
986,488
8d3d19e00cc922651d56112a898c885dcb2a6709
from django.http import HttpResponse from django.template.loader import get_template from Domain.models import Boda from Domain.models import Lugar from .models import FiestaEvento, AlimentoCarrito, Alimento, EntretenimientoCarrito, Entretenimiento from Ceremonia.models import CeremoniaEvento from django.contrib.auth.d...
986,489
a971489a75d066a1c5929c69ca3687c2ba99cf70
import os import cv2 import numpy as np import random # structure of the bounding boxes should be (left, top, right, bottom, label) def random_horizontal_flip(img, bounding_boxes): p = 0.5 img_center = np.array(img.shape[:2])[::-1]/2 img_center = np.hstack((img_center, img_center)) if random.random() < p: img...
986,490
dc7c5fa7226e48bdafb28845a8f608d40305c331
class P1: def m1(self): print("m1 method") class P2: def m1(self): print("m2 method") class child(P1,P2): pass obj=child() obj.m1()
986,491
1b8dc1c75cf7fa93904f4bb941f6b905d0aab1d0
from ..base import AutoEncoderBase from ..config import Config from itertools import chain import torch from torch import nn, Size, Tensor import torchvision.transforms as trans from typing import Callable, List class AutoEncoder(AutoEncoderBase): def __init__( self, input_dim: Size, ...
986,492
8250dc7a50d3f3d2c0b08d7cd61d010037f52fae
print("For equation: ax^2 + bx + c = 0: ") a = int(input("Enter a: ")) b = int(input("Enter b: ")) c = int(input("Enter c: ")) d = b**2 - 4*a*c if (d < 0): print("The equation has no solution") elif (d == 0): x = -b / 2*a print("The equation has one solution: x = ", x) else: x = (-b + d**(1/2)) / 2...
986,493
2a0f72da4883a9d5becf0c4924af1fb362a40699
# coding=utf-8 # This is part of the ProFormA Editor # # This proformaEditor was created by the eCULT-Team of Ostfalia University # http://ostfalia.de/cms/de/ecult/ # The software is distributed under a CC BY-SA 3.0 Creative Commons license # https://creativecommons.org/licenses/by-sa/3.0/ # # THE SOFTWARE IS PROVIDED...
986,494
920c7284f060a278551d1c7f8d6b125facc8a053
# -*- coding: utf-8 -*- import numpy as np from pyorderedfuzzy.ofnumbers.ofnumber import OFNumber from pyorderedfuzzy.ofmodels.ofseries import OFSeries, init_from_scalar_values __author__ = "amarszalek" def ofnormal(mu, sig2, s2, p): dim = mu.branch_f.dim minf = np.min(mu.branch_f.fvalue_y) ming = np.mi...
986,495
5a44b66013bf4b9d361062c0d0e317a4f3bcb414
import discord from discord.ext.commands import Bot from discord.ext import commands import asyncio import time import random Client = discord.Client() client = commands.Bot(command_prefix = "$") viplist = ("246993761673019394", "361888183505649664") allowlist = ("kop","munt") isresetting = False with open("coins.txt"...
986,496
6995f1f09e25013c0b627782400bef20a7b75786
class Shape(): def __init__(self, cd): self.cd = cd def area(self): return self.cd class Square(Shape): def __init__(self,cd): Shape.__init__(self, cd) self.cd = cd def area(self): return self.cd * self.cd sa = Square(3) print(sa.area())
986,497
438720c1705ac7abd457242d6001b58822da17ec
from django.urls import path from . import views urlpatterns = [ path('' , views.employee_list, name='list'), path('form/', views.employee_form, name='form'), path('<int:id>/', views.employee_form, name='edit'), path('delete/<int:id>/', views.employee_delete, name='delete'), ]
986,498
dd24b68e8e4126a74ec12984eb4a10fc67d59ab7
#!/Users/mnicolls/Documents/Work/Madrigal/bin/python import sys, os, traceback import cgi import time class madCalculatorService: """madCalculatorService is the class that allows remote access to the "madCalculator.py":../scripts/madCalculator.py.html script. Like all my python cgi scripts, madCalcula...
986,499
0d021bc30afd46fba140ee16f964eeab73cd16ba
#!/usr/bin/python # coding: utf-8 from __future__ import print_function from __future__ import division from math import sqrt from itertools import count, islice import random import math import sys #nr_of_tasks = int(raw_input()) bins = [] bins2 = [] range_small = (16384,32767) range_large = (1073741824,2147483647)...