index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
995,200 | bb8d6c952e97e66ffcd6e123470c597de9a1bfaf | #!/usr/bin/python
# -*- coding: UTF-8 -*-
from logicbit.logic import *
from logicbit.clock import *
from logicbit.utils import *
from logicbit.keyboard import *
class Reg8bTris12b:
def __init__(self):
self.__reg = Register8b()
self.__tristate = TristateBuffer()
def Act(self, Bus, EIn, EOut, R... |
995,201 | 44b01679ef55f9e976312d3cfae62a8fda757380 | # with open("student.csv", "w", encoding='utf8') as file:
# file.write ("이름,성별,나이,성적\n김일수,남,23,90\n이이수,여,24,95\n박삼수,여,30,85\n현사수,남,35,50\n부오수,남,15,70\n고육수,여,27,60\n양칠수,남,25,55\n남팔수,남,22,88\n오구수,여,45,99\n유영수,남,11,40\n")
# file=open("student.csv", "r")
# with open("student.csv", "r", encoding='utf8') as file:
cla... |
995,202 | a3cf4434e04c1c8c6dcd31cbc874589ddcce074e | """
Unit tests for the mccscontroller.releaseresources module
"""
from ska_tmc_cdm.messages.mccscontroller.releaseresources import ReleaseResourcesRequest
def test_releaseresourcesrequest_object_equality():
"""
Verify that two ReleaseResourcesRequest objects with the same allocated elements are
considered... |
995,203 | 4bb0bc8ad21c6168704a2d869047ba5da8f3824b | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import random
import sorting_algorithms
class Test (unittest.TestCase):
""" Tests for Sorting Algorithms """
array_size = 1000
sort = sorting_algorithms.SortingAlgorithms()
random_items = [random.randint(1, array_size) for num_items in r... |
995,204 | cc345e61ccc04c3e001f311e4262ae281b9a4a9e | '''
@author: shylent
'''
from texpect.mixin import ExpectMixin
from twisted.conch import telnet
from twisted.internet.protocol import ProcessProtocol
class TelnetExpect(telnet.Telnet, ExpectMixin):
"""A ready-made combination of L{Telnet} and L{Expect}, that lets you
utilize L{Expect}'s functionality to autom... |
995,205 | 8eaeda17007acff8d3be25b24ce87b03ec9c473f | from django.db import models
from django.core import checks, exceptions, validators
class Creditos(models.Model):
referencia = models.CharField(max_length=255, blank=True, null=True)
montoentregado = models.DecimalField(max_digits=20, decimal_places=2, blank=True, null=True)
fechaactivacion = models.DateF... |
995,206 | cb26e3ac3c3c6353c5deac2bbed72ed5b4cdb0cb | import requests
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
import time
import json
import re
import datetime
##########################################################################################... |
995,207 | fffee74b2071a10a598e32cf4ffb639300047ac4 | #COMP 123-04 HW 1
#,richard_graham>
#PART ONE
width = 75
height = 125
area = width*height
print(area)
#PART TWO
width = int(input("Enter a width"))
height = int(input("Enter a height"))
area2 = width*height
print(area2)
#PART THREE
import turtle
bob = turtle.Turtle()
win = turtle.Screen()
bob.color('red')
bob... |
995,208 | 484dd1ec82c070301890c0a698ef917a492d4b6d | import json
import re
from dataclasses import dataclass
from pathlib import Path
from shutil import rmtree
from typing import Callable
import processor
import pytest
CONFIG_NAME = ".defects4cpp.json"
@dataclass
class TestDirectory:
project: str
checkout_dir: Path
fixed_target_dir: Path
fixed_output_... |
995,209 | 6a499487e07c79f28776afe70cb5cbd991168159 | import json
import tensorflow as tf
flags = tf.flags
FLAGS = flags.FLAGS
# main operation argument
flags.DEFINE_string('op', None, '[REQUIRED] Operation code to do')
flags.mark_flag_as_required('op')
# create pretrain data
flags.DEFINE_string("input_file", None, "Input raw text file (or comma-separated list of fi... |
995,210 | 9746b03696523da8da7aa397e04eddd5a93a7b97 | from django.test import TestCase
# Create your tests here.
with open("img/1.jpg", 'rb') as file:
file_data = file.read()
print(file_data)
|
995,211 | 754775495d2574cf5529a632d632ce8497a153a1 | # Create your views here.
from django.shortcuts import render, get_object_or_404, redirect
from django.urls import reverse_lazy
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from django.views.generic.list import ListView
from django.views.generic.edit import CreateView, UpdateView, De... |
995,212 | 01db578bd5d3dbc86a3238c9341d552c61c6be6c | # -*- coding: utf-8 -*-
# filename: handle.py
import web
import reply
import receive
class Html(object):
def GET(self, action):
try:
render = web.template.frender('templates/'+action)
return render();
except Exception as Argument:
return Argument
def POST... |
995,213 | 51325c56cdb9f253d1dcd7edca621a8c76700416 | #encoding:utf-8
#服务端
#导入socket模块
import socket
#创建socket对象
s = socket.socket()
#绑定端口
s.bind(("127.0.0.1",4700))
#等待客户端连接
s.listen(5)
while(True):
#建立客户端连接
c,addr =s.accept()
print('连接地址:',addr)
c.send(str.encode('s'))
#关闭连接
# c.close()
|
995,214 | 492f15e894e337d6f6fd6a93535725c094fac946 | import logging
from utils.db_base import *
from common import config
TABLE_NAME = 'roles'
LOG = logging.getLogger(__name__)
def set_complete(role_name):
update_table(TABLE_NAME,
{'state': 'completed'},
{'roleName': role_name,
'src_cloud': cfg.CONF.SOURCE.os_cl... |
995,215 | c557503ae959fb2f4136cf5b09001e4113136528 | class Solution:
def largestSumAfterKNegations(self, A: List[int], K: int) -> int:
A[A.index(min(A))] *= -1
if K == 1:
return sum(A)
else:
return self.largestSumAfterKNegations(A, K-1)
|
995,216 | f78920d6f477abbe6e5149676a27d31a87952f17 | class Valuable():
def __init__(self, v=0):
self.val = v
def getValue(self):
return self.val
def setValue(self):
self.val = int(input('Enter an integer: '))
def adder(x, y):
return (x + y)
if __name__ == "__main__":
val1 = Valuable()
val2 = Valuable()
val1... |
995,217 | f427f556404c0afb5affb271d99f78b4a1273418 | XSym
0094
6b1a75c1ea9bf35b8046d391ebef7d19
/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/abc.py
... |
995,218 | 47c9989c69707f38331b2520d03adc406f22e718 | from django.apps import apps
from django.conf import settings
import logging
from urllib.parse import quote
import random
import os
import json
logger = logging.getLogger(__name__)
def find_action_cls(app_name: str, action_codename: str):
"""
Get the PlatformAction subclass that has the specified codename
... |
995,219 | c0c603e43b92328eadccb66bcb4ce830175f0e9b | # Original Dimensions
dimensions = (500,20)
for dimension in dimensions:
print (dimension)
# Save another Dimension
dimensions = (400,100)
# Another dimensions
for dimension in dimensions:
print(dimension)
|
995,220 | 316d5b37d80c476574a581255f17b55e9ab4dc87 | #! /usr/bin/env python
import hashlib
import json
from apkcli.plugins.base import Plugin
from apkcli.lib.utils import get_urls, get_intent_filers, convert_x509_name
class PluginJson(Plugin):
name = "json"
description = "Extract information on the APK in JSON format"
def add_arguments(self, parser):
... |
995,221 | 35f5085c009a3d66829f71ac41ba3f2c1cb748a0 | import re
from rest_framework.exceptions import ValidationError
from rest_framework import serializers
from .models import User
from django.utils.translation import gettext_lazy as _
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('id', 'username', 'first_nam... |
995,222 | bac54e603321dc9b57748b18295fe6bae312112e | #coding=utf-8
"""
test paramiko lib
"""
import paramiko
import os
#RSA密钥授权登录
a = paramiko.SSHClient()
a.set_missing_host_key_policy(paramiko.AutoAddPolicy())
a.connect(hostname='192.168.64.129',port=22,username="root",key_filename="C:\\Users\\22950\\skey")
b,c,d = a.exec_command("ls")
print c.readlines()
e = a.open_s... |
995,223 | d3d895c0b30aadcfdaff7287ec1902bf9f461235 | import os
import json
from book import Book
import pymongo
from ast import literal_eval
#Initialize DB connection
client = pymongo.MongoClient("mongodb://localhost:27017")
db = client["library"]
books_db = db["books"]
def clear_screen():
os.system('clear')
def print_options():
print("Choose your option")
... |
995,224 | 4993ff1522405ec7541157afc38fa2f169a9e708 | # Generated by Django 2.0.3 on 2018-12-10 22:05
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
995,225 | 37b4d1cf7471d347db710a8181ea84cd413787a5 | import numpy
import collections
import SimpleITK as sitk
import RadiomicsPlatform.RadiomicsImageArrayLib
import pdb
class LoGFeatures:
def __init__(self, imageFilePath, labelFilePath, binwidth, pixelSpacing):
self.sigmaValues = numpy.arange(5.0, 0.0, -0.5)[::-1]
self.imageFilePath = imageFilePat... |
995,226 | f926f01cc7b5adf98fa900495b623375a9716c04 | from time import sleep
from typing import List, Callable, Dict
from functools import wraps
from dataclasses import dataclass
from collections import defaultdict
from utils.courses.courses import HighSchoolCourse, CollegeCourse
import shutil
import pandas as pd
import os
import sys
from selenium.webdriver.support.ui im... |
995,227 | e35ff969594564b5e4324866f02d44a086c9461e | from privacy_evaluator.attacks.attack import Attack
from privacy_evaluator.classifiers.classifier import Classifier
from privacy_evaluator.models.train_cifar10_torch import data, train
import math
import numpy as np
import torch
import tensorflow as tf
from sklearn.svm import SVC
from art.attacks.evasion import FastGr... |
995,228 | 42f1b4ee7578ec5a04b14759c25d66442351b333 | # https://leetcode.com/problems/integer-to-english-words/
import random
class Solution(object):
THOUSANDS = ["Thousand", "Million", "Billion"]
HUNDRED = "Hundred"
SINGLE_DIGIT_IN_ENG = ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"]
DOUBLE_DIGIT_IN_ENG = ["Ten", "Twenty", "Th... |
995,229 | 249b1d6940022569ad58b24cfa46f46e62bcf1a9 | import bs4
import requests
from urllib import request
url = request.urlopen("http://www.sina.com")
WebsiteData = url.read()
# print(WebsiteData)
result = bs4.BeautifulSoup(WebsiteData,"html.parser")
for body in result.find_all('a'):
print(body)
|
995,230 | e54163ba8d2a1d8a17c2e4c13c0da70a1db95322 | import yaml
from shelf.cloud.cloud_exceptions import ArtifactNotFoundError
class PermissionsLoader(object):
def __init__(self, logger, cloud_factory):
"""
Args:
logger(logging.Logger)
cloud_factory(shelf.cloud.factory.Factory)
"""
self.cloud_fact... |
995,231 | 674e83978f3d8b1652948a11a84b26c4475a2b74 | import sys
import multiprocessing
import windows.alpc
from windows.generated_def import LPC_CONNECTION_REQUEST, LPC_REQUEST
import windows.generated_def as gdef
import ctypes
import tempfile
PORT_NAME = r"\RPC Control\PythonForWindowsPORT_2"
PORT_CONTEXT = 0x11223344
def full_alpc_server():
print("server pid =... |
995,232 | 0164ecbcef801abb260951c425730593102749fb | import os
import pytest
from docker.errors import NotFound
from intervaltree import Interval, IntervalTree
from mexca.container import (
AudioTranscriberContainer,
BaseContainer,
FaceExtractorContainer,
SentimentExtractorContainer,
SpeakerIdentifierContainer,
VoiceExtractorContainer,
)
from me... |
995,233 | 9f0965f28a532888a49063a5719aea1b30ba72a3 | from sys import maxsize
from itertools import permutations
matriks = [
[0, 5, 9, 14, 16, 11, 21],
[5, 0, 17, 18, 12, 13, 8],
[9, 16, 0, 6, 23, 28, 20],
[14, 18, 6, 0, 31, 40, 37],
[16, 12, 23, 31, 0, 33, 19],
[11, 13, 28, 40, 33, 0, 4],
[21, 8, 20, 37, 19, 4, 0],
]
totalKota = len(matriks... |
995,234 | cb9e15e9e867eb4d9441defcce7475415528a04d | def even_number_of_evens(numbers):
if isinstance(numbers, list):
evens = sum([1 for num in numbers if num % 2 == 0])
return evens and evens % 2 == 0
else:
raise TypeError("A list was not passed into the function")
if __name__ == '__main__':
print(even_number_of_evens([1, 2, 4]))
|
995,235 | b47acfa160807ab3d4cd9a3b9cfd4d70a74586b6 | import nltk
from nltk.corpus import gutenberg
print(gutenberg.fileids())
words=gutenberg.words('bible-kjv.txt')
words_filtered=[e for e in words if len(e) >= 3]
stopwords=nltk.corpus.stopwords.words('english')
word=[w for w in words_filtered if w.lower() not in stopwords]
fdistPlain=nltk.FreqDist(words)
fdi... |
995,236 | 179db4a6d3c73bfd88fce8c1f04c58c949180ece | import requests
url = "https://www.fast2sms.com/dev/bulk"
def send_sms():
message = "BUDDY >> Unauthorized User tried to access your data."
number = '9162945996'
payload = "sender_id=FSTSMS&message=" + message +"&language=english&route=p&numbers="+ number
headers = {
'authorization': 'D... |
995,237 | 81cef82d19708060a30c2791a005b006bd59d119 | ''' Triangle I '''
def main():
''' Pythagorus's Theorem '''
num1 = float(input())
tilted = num1
base = num1
num2 = float(input())
tilted = num2 if num2 > num1 else num1
base = num2 if num2 < num1 else num1
num3 = float(input())
tilted = num3 if num3 > num2 and num3 > num1 else num1 i... |
995,238 | a93faef5987e835204e5af686d968accd4710a67 | import numpy as np
from math import ceil, floor
class stat_record_class:
def __init__(self, lba_size_dist, lba_size_idx):
self.lba_size_dist = lba_size_dist
self.lba_size_idx = lba_size_idx
def lba_size_dist2(traces, access_type, options=1):
'''
Local Variables: lba_idx, b, cmd_id, acces... |
995,239 | 4526f9eb950ebbdc72e0c2c475994733e13b4501 | import argparse
import pandas as pd
parser = argparse.ArgumentParser()
parser.add_argument("-p","--promoter", help="please provide a file containing promter tfbs", action = "store")
parser.add_argument("-t","--tf", help="please provide filename containing all tfbs", action = "store")
parser.add_argument("-o","--output... |
995,240 | c4c2f761609e45a9118b8bffca52694c716b6195 | # -*- coding: utf-8 -*-
from nipy.algorithms.registration.affine import Affine
import nibabel
def save_nifty(filename, data, origin=(0,0,0), vox_scale=(0,0,0),
angles=(0,0,0) ):
"""
save_nifty: write data to given file in nifty format, taking
care of the affine transform.
Inputs
------
filename ... |
995,241 | 0acf422452c429c4272e852aa1c509e0d9aea3ee | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
995,242 | baa769d87f7ac0d89e5f78229234c8405073ee5e | import logging
from typing import Any
import darq
from aiohttp_example import signals
log = logging.getLogger(__name__)
async def startup_services(ctx: dict[str, Any]) -> None:
ctx['_services'] = []
for init_async_gen in signals.get_cleanup_ctx_factories():
async_gen = init_async_gen(None)
a... |
995,243 | 4004a5c6e204cac80858102dfe81869a77b03a4d | import tkinter as tk
import json
class Models(tk.StringVar):
def __init__(self, *args, **kwargs):
self.template_custom = {
'UNTREATED': {
'0': tk.StringVar(),
'1': tk.StringVar(),
'2': tk.StringVar(),
'3': tk.StringVar(),
... |
995,244 | 87fdd8475ed7adc0495792c3a86d31a8f2826447 | from django.contrib import admin
from django.utils.html import format_html
from .models import pacientes,areastrabajo,domicilios,acompanantes,metanticonceptivos,edocivil,tipoconsultas,valoraciontanner,expedientes,consultagral,antescolares,antfamiliares,antpatheredofam,antrecreathab,antsex,exploracionfisica,personalidad... |
995,245 | a73e104c4b357486af5ab19dd51dc04ec796c473 | 11) WPP to enter principle amount, rate of interest, and no of years. Create simple_interest(principle,rate,time). To calculate simple interest.
Solution:
p=int(input("Enter principle amount : "))
r=int(input("Enter rate of interest : "))
y=int(input("Enter number of years : "))
amount = 0
def compint (p,r,y) :
... |
995,246 | 00a84a1f17a92c81cc265fd98d13fd915d9022b7 | class Solution(object):
def strStr(self, haystack, needle):
if not needle:
return 0
return self.KMP(haystack, needle)
def getPrefix(self, pattern):
prefix = [-1]*len(pattern)
j = -1
for i in xrange(1, len(pattern)):
while j > -1 and pattern[j+... |
995,247 | 75ab7c990f6b93fb1dcde15f7dbaf60a6e7f91ae | """
File: SplitDataset
Author: Emre Sülün
Date: 20.04.2019
Project: Sign_Language_Detector
Description: Splits images into train and test folders. Split ratio is determined by TRAIN_SIZE variable
"""
import os
import shutil
import string
source = '../../samples'
trainDestination = '../../samples/train'
testDestination... |
995,248 | 62959220ec5893b47cf711945611d2228a0b41c1 | __version__ = '0.1.1'
from django.contrib.auth.hashers import make_password
class LogonMixin(object):
def get_user(self):
from django.contrib.auth.models import User
return User.objects.create(
username='admin',
password=make_password('password'),
)
def setUp(... |
995,249 | f417d6095cd1e36f8b2989b0f43f12083e317648 | import numpy as np
import itertools
from matplotlib import pyplot as plt
from os import listdir
from os.path import join, isfile
import Utils
from Sampling import PermSampling
class PermAnalysisTool(object):
def __init__(self, dirs, dispFiles):
# Add dirs and temps as class variables
assert dirs # make sure th... |
995,250 | 95519c580450664e0f474778d485acad4b288b0e | import xgboost as xgb
import numpy as np
# feature = 2
RETRAIN = True
TEST = False
submissions = []
for feature in range(3):
x = None
y = None
bst = None
x = np.load('./data/X_train.npy', mmap_mode='r')
y = np.load('./data/Y_train.npy', mmap_mode='r')
y = y[:,feature]
param = {'booster':'g... |
995,251 | 753d6e514f1854df4c1722275ac8057edcbb8f05 | """
В единственной строке записан текст. Для каждого слова из данного текста подсчитайте, сколько раз оно встречалось в этом
тексте.
Задачу необходимо решить с использованием словаря.
"""
s = "Einstein excelled at math and physics from a young age, reaching a mathematical level years ahead of his peers."\
"The 12 y... |
995,252 | cd602a8be8c7ee254115322d16a1073f13966f87 | from setuptools import setup
setup(name="slackalarmforwarder", packages=["slackalarmforwarder"], package_dir={'': 'lib'})
|
995,253 | b79214eec2d827445451f075293e7fd8e006869a | """
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
# @param {TreeNode} root the root of the binary tree
# @return {List[str]} all root-to-leaf paths
def binaryTreePaths(self, root):
def helper... |
995,254 | 393ade8334ac8acd1f77b11fb4f27bf24dd079f3 | import sys
import os
currentdirectory = os.path.dirname(os.path.realpath(__file__))
sys.path.append(currentdirectory+"/packages/setuptools/")
currentdirectory = os.path.dirname(os.path.realpath(__file__))
sys.path.append(currentdirectory+"/packages/z3/python/")
from z3 import *
init(currentdirectory+"/packages/z3")
tr... |
995,255 | 214fa7e6869280d6bb2d9e6d019d9db38aa3b2aa | # Copyright 2019, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
995,256 | ab1e219df44fd1e70e7ebafd171722b60b57c999 | # Generated by Django 3.2.4 on 2021-06-16 09:39
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='crop',
field... |
995,257 | cfe652544d5b776725be43b10cf987aef73f91c6 | alt = float(input('Digite a altura das paredes da sala, em metros: '))
compr = float(input('Digite o comprimento da sala, em metros: '))
larg = float(input('Digite a largura da sala, em metros: '))
print(f'A área do piso é de {compr * larg:.2f} metros quadrados.')
print(f'O volume é de {alt * compr * larg:.2f} metr... |
995,258 | 760ce6e88071259d82894c7cf21564d64a372ccc | from django.contrib.auth.decorators import login_required
from django.views.generic import TemplateView
from django.views.generic.base import RedirectView
from django.conf.urls import url
urlpatterns = [
url(r'^$', RedirectView.as_view(url='dashboard'), name='home'),
url(r'^dashboard',
login_required(... |
995,259 | 33a253ca2f7f19c3f653e1ad5cff59f92ea83eef | from pyner.named_entity.dataset import converter
from pyner.named_entity.dataset import DatasetTransformer
from pyner.named_entity.dataset import SequenceLabelingDataset
from pyner.named_entity.recognizer import BiLSTM_CRF
from pyner.vocab import Vocabulary
from pyner.util import parse_inference_args
from pyner.util im... |
995,260 | 3f4a23fb6d1fd96a1dcd3b114d3c36a7e117bf77 | """
Multi-layer Perceptron for Newsgroup data set
"""
import os
import sys
import pandas as pd
import numpy as np
import random
import csv
import matplotlib.pyplot as plt
from sklearn.preprocessing import OneHotEncoder
import torch
from torch import nn
from torch.autograd import Variable
import torch.utils.data as dat... |
995,261 | 986d147b65f523e399317cff7b599fc31f8059b1 | #[on_true] if [expression] else [on_false]
def Factorial(inp):
return 1 if inp == 0 else inp*Factorial(inp-1)
print(Factorial(5))
|
995,262 | 6237913ba8c0e6bd8f1ff6f729902f0befb6e695 | print('====== DESAFIO 66 ======')
cont = 0
soma = 0
while True:
valor = int(input('Digite um valor: '))
if valor == 999:
break
cont += 1
soma += valor
print(f'A quantidade de números digitados foi: {cont}')
print(f'A soma de todos os valores é: {soma}') |
995,263 | a632f016e1c97e630c09b1a869128c0cea79af37 | # Generated by Django 2.2.5 on 2021-03-14 13:17
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('poem', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Theme',
fiel... |
995,264 | 5bb5efd248d672161310fa2b22409ff05b9f6bda | # Import the Tkinter module
from tkinter import *
# Initialize the window
root = Tk()
# Create the title
root.title("Simple Calculator")
# Create and size the entry window
e = Entry(root,width=30,borderwidth=5)
e.grid(row=0,columnspan=3)
def button_click(number):
'''This function makes it possible for the Entr... |
995,265 | f10de17267f1744e2127e74fb30a1ecd6e0bf5ac | import numpy as np
from neupy.core.properties import NumberProperty
from .backpropagation import Backpropagation
__all__ = ('MinibatchGradientDescent',)
class MinibatchGradientDescent(Backpropagation):
""" Mini-batch Gradient Descent algorithm.
Parameters
----------
batch_size : int
Setup ... |
995,266 | 2694d8d3f1709dd8686c1f9c045c5eca240c41c0 | version https://git-lfs.github.com/spec/v1
oid sha256:3c44e7225014a288ee2f1fdd1282b4a45f8baa0fa8200cdb5d51759d93a4e5dd
size 126
|
995,267 | e4dd478a75553155b42bec914abe1976b091806e | # 将谷歌地图转换为卫星图
from numpy import load
from numpy import zeros
from numpy import ones
from numpy.random import randint
from keras.optimizers import Adam
from keras.initializers import RandomNormal
from keras.models import Model
from keras.models import Input
from keras.layers import Conv2D
from keras.layers import Conv2D... |
995,268 | 22a39ea204a00e2276e25a3b37361d512d6b9ff6 | # players = ['kobe','allen','T-mac','lebron','KD']
#
# print('Here are the retired basketball players list:')
# for player in players[:3]:
# print(player.title())
# cars = ['lamborghini','ferrari','mclaren','rolls-royce','mercedes','porsche','dodge']
# print('The first three items in the list are:')
# for car i... |
995,269 | e0792d26b2ec3f7cfe5c4b9e8b18b6331bc7a0ef | from django.conf.urls import include, url
from django.contrib import admin
from graphene_django.views import GraphQLView
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^accounts/login/', admin.site.login),
url(r'^graphql/', GraphQLView.as_view(graphiql=True)),
url(
r'^taskmanager/',
... |
995,270 | ca12ee155f004ec547db17b422649b9a6c7ee070 | class {{class_name|camel}}Test(unittest.TestCase):
def setUp(self):
pass
def test_{{function_name|snake}}<cursor>(self):
self.assertEqual(<cursor>)
|
995,271 | f437ba345abfca86d377eea7d80ef58b7f9163fc | import math
def citire(nume_fisier="retea2.in"):
n=0
la=[]
with open(nume_fisier) as f:
linie=f.readline()
c, b, m = (int(z) for z in linie.split())
lista = []
coord = []
for i in range(c+b):
x,y=(int(a) for a in f.readline().split())
coord.a... |
995,272 | fdcdf09b6b4cc35884cf5af113ea75abef2b84e6 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('jobs', '0026_auto_20151004_0422'),
]
operations = [
migrations.AlterField(
model_name='job',
... |
995,273 | 05e5ea31e9691d3199ec08814b31098f041b8386 | # Python program to explain cv2.imread() method
# importing cv2
import cv2
# path
path = r'geeksforgeeks.png'
# Using cv2.imread() method
# Using 0 to read image in grayscale mode
img = cv2.imread(path, 0)
# Displaying the image
cv2.imshow('image', img)
|
995,274 | 4e996aaf604db3998419312a10deca7a8e74f880 | import unittest
from main import *
class TestearFormato(unittest.TestCase):
def setUp(self):
self.archivo = open("mensaje_marciano.txt", "r")
self.lineas = self.archivo.readlines()
self.texto = "".join(self.lineas).replace('\n', '')
self.codigo = self.texto.split(" ")
def test... |
995,275 | aae124d10678e4e89ca34d18c62761281851440c | import re
from ..core.comics import BaseComics
class ReadComicOnline(BaseComics):
"""
class for http://readcomiconline.to/
"""
def __init__(self, url):
self._issue_number_regex = r'[(\d)]+'
self._image_regex = r'stImages.push\(\"(.*?)\"\)\;'
self.antibot = True
super(... |
995,276 | d35f3fc1e069d5018205282ae99a194caa5b3ac0 | a, k, b, m, n = map(int, input().split())
l, r, ans = 1, n, 0
while (l <= r):
mid = (l + r) // 2
day = mid * a - (mid // k) * a + mid * b - (mid // m) * b
if (day >= n):
r = mid - 1
ans = mid
else:
l = mid + 1
print(ans) |
995,277 | 83c4eca139543658d890c222d16dc6feb4f9f8d5 | #!/usr/bin/python
import requests
import string
import time
import _thread
debug = True
target_url = "http://mentalmath.tamuctf.com/ajax/new_problem"
headers = {
"User-Agent": "Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US);",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"... |
995,278 | 94d5dac3980cbf4ed0af5196303e6dc01b9e40b4 | # -*- encoding:utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import render, redirect
from django.urls import reverse_lazy
from django.utils.decorators import method_decorator
from django.views.generic import TemplateVi... |
995,279 | a1cd53ed840fd8ab3ae7e293ea6d7347bde6d03d | #-----------------------------------------------------------------------
# potentialgene.py
#-----------------------------------------------------------------------
import sys
import stdio
#-----------------------------------------------------------------------
# Return True if string dna corresponds to a potential ... |
995,280 | 3e883ba708039e577444479971d2e0bf4aef4790 | # http://www.runoob.com/python/python-func-type.html
# TODO;Python type() 函数
"""
描述
type() 函数如果你只有第一个参数则返回对象的类型,三个参数返回新的类型对象。
isinstance() 与 type() 区别:
type() 不会认为子类是一种父类类型,不考虑继承关系。
isinstance() 会认为子类是一种父类类型,考虑继承关系。
如果要判断两个类型是否相同推荐使用 isinstance()。
语法
以下是 type() 方法的语法:
class type(name, bases, dict)
参数
name --... |
995,281 | 456f609dea564b9355bd908cc8628538343db633 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: vita
import re
from collections import OrderedDict
from django.conf import settings
from django.utils.module_loading import import_string
from django.urls import URLResolver, URLPattern
from django.urls.resolvers import RegexPattern, RoutePattern
def check_url_ex... |
995,282 | 387c0b8d8816c6bb045b0b4537a980264568c666 | # ### 2. Write a function power(a,b) to calculate the value of a raised to b.
# * Function: power()
# * Summary: Finds a^b
# * Input: a and b
# * Output: a^b
# In[16]:
def power(n,p):
if p==0:
return 1
elif p==1:
return n
else:
return n*power(n,p-1)
print(power(... |
995,283 | b58594af85b9860074984c7ef963f03dd500d0bb | class Solution:
# @param prices, a list of integer
# @return an integer
def maxProfit(self, prices):
if len(prices) < 2 : return 0
ret = [ prices[i+1] - prices[i] for i in range(len(prices)-1)]
sumRet = ret[0]
maxRet = max(ret[0], 0)
minRet = min(ret[0], 0)
fo... |
995,284 | 51fb747f73e3bcdc0d4c27f78c830064192428c1 | import numpy as np
import pandas as pd
from pandas import Series, DataFrame
import tushare as ts
import os
# 得到000001近三年的数据
# ts.get_hist_data 相关数据 index为date+时间
# open high close low volume price_change p_change涨跌幅 ma5 ma10 ma20 v_ma5 v_ma10 v_ma20 turnover换手率
open('000001_Month.csv','w')
df=ts.get_hist_data('000001'... |
995,285 | aa545cb29f3ecaec6d90b1b635fca2c5edbe156b |
string1 = input()
string2 = input()
if string1 == string2 :
print("are equal")
else:
print("are not equal")
if string2 in string1 or string1 in string2 :
print(" is a substring")
else:
print("is not a substring")
|
995,286 | 18a633bc4aae37694afe182b10fcc72d0c0b8e1a | # Modified by Wei Jiacheng
#
#
# Originally written by Hugues THOMAS - 11/06/2018
#
# ----------------------------------------------------------------------------------------------------------------------
#
# Imports and global variables
# \**********************************/
#
# Basic l... |
995,287 | defa108950f1689d0ce15a28db2a2913582a4b95 | # pylint: disable=missing-docstring
"""
The test module for Prime Factors
"""
|
995,288 | f7ea86207459f8e1cc25a40e3c124abf840f0a8c | from os.path import join as pjoin
import os
from glob import glob
import random
import pandas as pd
import cv2
import numpy as np
import json
from tqdm import tqdm
from random import randint as rint
element_map = {'0':'Button', '1':'CheckBox', '2':'Chronometer', '3':'EditText', '4':'ImageButton', '5':'ImageView',
... |
995,289 | fbd111da9f4c634ebde88235a4488ac6b346b802 | import unittest
from cloudrail.knowledge.context.aws.resources.redshift.redshift_logging import RedshiftLogging
from cloudrail.dev_tools.rule_test_utils import create_empty_entity
from cloudrail.knowledge.context.aws.resources.redshift.redshift import RedshiftCluster
from cloudrail.knowledge.context.aws.aws_environme... |
995,290 | 02f170b446322585f8ba0dcaf44f193a88f603ad | s=input()
leng=len(s)
a=0 #0101
b=0 #1010
for i in range(leng):
if i%2==0:
if s[i]=="1":
a+=1
if s[i]=="0":
b+=1
if i%2==1:
if s[i]=="0":
a+=1
if s[i]=="1":
b+=1
if a>=b:
print(b)
else:
print(a) |
995,291 | 8c84184a09a1abd3fe3bc8b0dc785799e012519c | import random
polynomials = {
1: [1, 0, 0, 1, 1],
3: [1, 1, 1, 1, 1],
5: [1, 1, 1]
}
def can_correct(R, max_err):
start = 0
no_more = False
while True:
i = R.find('1', start)
if i == -1:
break
elif no_more:
return False
else:
... |
995,292 | 5f2e71045c6ae3c70e89c08fc760f9f886116e88 |
# TODO: support mongo or mysql
class MongoDB:
def __init__(self):
self.host = '127.0.0.1:27071'
|
995,293 | 07e479b7808a8d3069b85bc2f6e967789349c4e7 | """Development settings and globals."""
from os.path import join, normpath
from base import *
########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG = DEBUG
########## END D... |
995,294 | 2f515c197907d0df648b66a19a20632ec9e99318 | from django.db import models
import uuid
# TYPE
STATUS = [("AE", "Active"), ("IE", "Inactive")]
TYPE = [("HL", "Hospital"), ("PN", "Person")]
TAG = [("BD", "Bed"), ("ONRL", "Oxygen Refill"), ("EYCR", "Empty Cylinder"),
("FLCR", "Full Cylinder"), ("NL", "NULL")]
class AddressModel(models.Model):
entity_id = m... |
995,295 | 31deeb2e59f128050da92eea79538019161e8315 | # __init__.py
from array_summing.array_summing import ArraySumming
__all__ = ['ArraySumming', ]
|
995,296 | 9b9b531559b9620f4b82aa57cd8f1c5159cbdca8 | #!/usr/bin/env python3
"""Upload to database.
Should eventually be combined with categorize tool.
"""
import collections
import getpass
import pymysql
import sys
DownloadSample = collections.namedtuple(
'DownloadSample',
'file ymd hhmm downloads downloads_sha downloads_sig'
' product version arch os ... |
995,297 | d3685083d4086a42511f589fed02b94fe83d20b2 | from django.db import models
from django.utils.translation import gettext_lazy as _
from base.models import BaseModel
class Category(BaseModel):
owner = models.ForeignKey('users.User', related_name='owner_categories', verbose_name=_('Owner'),
on_delete=models.CASCADE)
title = mo... |
995,298 | 84eaf3937054c3cd250c524b92caac50dfce9ab1 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017-2020 The Project X-Ray Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
import json
from prjxray.segmaker im... |
995,299 | 1dcc5e10f5526d89d1e0a43b122aab26f268fbc8 | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^signup/$', views.signup, name='signup'),
url(r'^success/$', views.success, name='success'),
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.