index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
995,400 | 8eaf022b1520c7f589cabeb2838cac21f68b7aa0 | import rhocoul
import sys
import os
from math import sqrt, exp, cos, sin, pi, log, log10, acos
import numpy as np
def run(tau,xkappa,z,D):
import Cusp
#du00 = Cusp.du00dBeta(tau,1./xkappa,z,D,1e-9)
#print 'du00', du00
u00 = Cusp.u00(tau,1./xkappa,z,D,1e-9)
print 0.0, u00
kmax = 10
lma... |
995,401 | 8fa814b46f70c9dd4fcb6ca5b5427f37265572b1 | from django.contrib import admin
from .models import Event, Entry
# Register your models here.
# Adds the model to the admin page.
admin.site.register(Event)
admin.site.register(Entry)
|
995,402 | 951f4c86c7b3cc9d92bb22a9e8259af2abbd5be3 | import sys
def calc_comb(items, n):
if n==0: yield []
else:
for i in xrange(len(items)):
for cc in calc_comb(items[i+1:],n-1):
yield [items[i]]+cc
readfile = "A-small-attempt1.in"
writefile = readfile + ".out"
open_read_file = open(readfile,'r')
open_write_file = open(wri... |
995,403 | af686d25dbe95010c6558396edeaf55cf7597967 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from main import main
main(revisions=["issue596-base", "issue596-v1"])
|
995,404 | f27f842f0d27371b36d73ed09f34e8be28528548 | def junta_nome_sobrenome(nomes, sobrenomes):
lista_final = []
for i in nomes:
lista_final += nomes[i] #,sobrenomes[i] |
995,405 | 4da7699eecb5027563375136a6ad364db815532e | import numpy as np
import gdal, os, sys, glob, random
import pylab as pl
def read_drainage_efficiency(self):#, PLOT, FIGURE, DISTRIBUTION):
"""
The purpose of this module is to read (input) the drainage efficiency
of each predisposed element.
If the fractional area of cohorts is > 0.0, then there will... |
995,406 | 8259820462931a9f1906181b7c803765054978a9 | import numpy as np
N=7
M=np.zeros((N,7),dtype=int)
print(M)
$( function () {
$('button#btn-json').bind('click' , function () {
$.getJSON('/background_process', {
proglang: $('input[name="proglang"]').val(),
} , function (data) {
$("... |
995,407 | b3fb6149043b55dcac9cf00aef9649c60e9020ea | """
We will hash every position on the board, this way we don't utilize too much memory as we play large games (will take too long)
RUN this to generate Hashes & replace in your zobrist.py file
"""
import random
from dlgo.gotypes import Player, Point
def to_python(player_state):
if player_state is None:
retur... |
995,408 | 422763be6bf7a10383e60934dd117b238604b3e7 |
# coding: utf-8
import pandas as pd
import datetime as dt
import requests
import time
result = pd.read_html('https://btc.com/block?date=2016-01-01')
result = pd.DataFrame(result[0])
result = result.rename({0:'Height',1:'Relayed By',2:'Tx Count',3:'Stripped Size(B)',4:'Size(B)',5:'Weight',
6:'Av... |
995,409 | b6f71f9026f34e4ce2856ea1893dd25ec2c9d6cb | import matplotlib.pyplot as plt
import numpy as np
from optmize import *
fig, axes = plt.subplots(nrows=1,ncols=2, figsize=(12,5))
all_data = loadCsv('./test.20.log')
all_data = [np.random.normal(0, std, 100) for std in range(6, 10)]
#fig = plt.figure(figsize=(8,6))
axes[0].violinplot(all_data,
sh... |
995,410 | 47cd2e23dfefc330b0b212e588047d18af507c96 | """The bluetooth integration matchers."""
from __future__ import annotations
from dataclasses import dataclass
from fnmatch import translate
from functools import lru_cache
import re
from typing import TYPE_CHECKING, Final, TypedDict
from lru import LRU # pylint: disable=no-name-in-module
from homeassistant.loader ... |
995,411 | 116e2c11c7ae1f59ba16c44db05cebae2e7bdcb3 | from django.apps import AppConfig
class DbtemplateConfig(AppConfig):
name = 'db_template'
|
995,412 | 8a45f93bbb3bfd8bbbe9cc5a7a4d4468eafb39da | from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
import time
driver = webdriver.Chrome(ChromeDriverManager().install())
driver.implicitly_wait(10)
driver.set_page_load_timeout(20)
driver.maxim... |
995,413 | aec77e3fcdd9c54e32afcfed6691d872e21f50bc |
from matplotlib.colors import ListedColormap
from numpy import nan, inf
# Used to reconstruct the colormap in pycam02ucs.cm.viscm
parameters = {'xp': [-3.4830597643097576, 0.6289831887553419, -17.483059764309758, -36.149726430976415, -10.119506350699233, -1.5386153198653005],
'yp': [-16.277777777777771,... |
995,414 | 0dd795a280628cb04f72ab0f5c90af0c9a2bbc08 | def assign(tokens_path, wiki_titles, wiki_tokens, var6, var7, var8, var9, var10, left, first=False):
import re,sys
from gensim import corpora
import math
from itertools import groupby
import multiprocessing
from nltk.stem.wordnet import WordNetLemmatizer
stemmer = WordNetLemmati... |
995,415 | aca23e70d5525c175ee243b7d19eed9aa8ec683e | from collections import Counter
import pytest
from presidio_evaluator.evaluation import EvaluationResult, Evaluator
from tests.mocks import (
MockTokensModel,
)
@pytest.fixture(scope="session")
def scores():
results = Counter(
{
("O", "O"): 30,
("ANIMAL", "ANIMAL"): 4,
... |
995,416 | 7214a82504c7352f181bbc7485e3681fcd673264 | __author__ = 'Frederik Diehl'
# Code for the NN adapted from the breze library example.
# For Breze, see github.com/breze-no-salt/breze.
import cPickle
import gzip
import time
import numpy as np
import theano.tensor as T
import climin.schedule
import climin.stops
import climin.initialize
from breze.learn.mlp impo... |
995,417 | 428b16b5cdb7360f6785e9c340abe741e21b4396 | '''
input: [array_int]
output: min_diff for 2 buckets
for each position in N inputs,
There're 2 states: in bucket 1 or not in bucket,
so run time cost will be: 2^n.
'''
class bucket_solution1:
def __init__(self, input_array):
self.array = input_array
self.total = sum(self.array)
print("to... |
995,418 | 3c0fa987e9d743c8183e3e99f8744663a5745afb | from argh import arg
from six import iteritems
__author__ = 'thauser'
from pnc_cli.swagger_client import UsersApi
from pnc_cli.swagger_client import UserRest
from pnc_cli import utils
users_api = UsersApi(utils.get_api_client())
def user_exists(user_id):
existing = utils.checked_api_call(users_api, 'get_specif... |
995,419 | a2f422ebdf558ca5cb4911d1d68045f83ae4cdcf | """
ABC048 A - AtCoder *** Contest
https://atcoder.jp/contests/abc048/tasks/abc048_a
"""
a,b,c = input().split()
print(a[0]+b[0]+c[0])
|
995,420 | 2b4306e57eda5de7755dda4d2e9349b72b8cb7f9 | # from selenium import webdriver
# driver = webdriver.Firefox(r'C:\\Users\\udos8\\Downloads\\geckodriver.exe')
# driver.get('https://www.ebay-kleinanzeigen.de/m-einloggen.html?targetUrl=/anzeigen/m-einloggen.html')
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.co... |
995,421 | 693401563a43a4f19f4737945740b42097157f42 | import pandas as pd
import numpy as np
import preproc as pre
cols = ["Date", "Open", "High", "Low", "Close", "Volume", "Name"]
names = [
"MMM",
"AXP",
"AAPL",
"BA",
"CAT",
"CVX",
"CSCO",
"KO",
"DIS",
"XOM",
"GE",
"GS",
"HD",
"IBM",
"INTC",
"JNJ",
"JPM... |
995,422 | 1fb91d88c54258bb7a479c4e87c91486388f50e7 | import numpy as np;
import scipy.linalg as linalg
def filterOutliers (Features, Dataset, numStdDevs):
NewData = Dataset[:,:]
for i in Features:
var = NewData[:,i]
avgvar = round(np.mean(var),3)
stdvar = round(np.std(var),3)
NewData = NewData[:,:][((NewData[:,i] < avgvar + (stdvar*numStdDevs)) & (New... |
995,423 | ab6b3ed2a5457fd4abb37df1771b5ade771c04e9 |
x = open("D:\PythonPracticeAgain\FileHandling\demofile.txt","r")
print(x.read(8)) |
995,424 | 86d1df702af501a47dba9a6837a2293668defbad | #!/usr/bin/python
# -*- coding: utf-8 -*-
import socket
import sys
import time
time.sleep(3) #margen de busqueda de nodos
# Creando un socket TCP/IP
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Conecta el socket en el puerto cuando el servidor este escuchando
server_address = ('127.0.0.1', 5000)
pr... |
995,425 | ec1bc87342351ddc351bc240263f32e8ea6602de | from setuptools import setup
setup(name='craves_control',
version='0.0.1',
install_requires=['gym', 'argparse', 'pyusb'] # And any other dependencies foo needs
) |
995,426 | 141806630c4251b17f4b16463c7504fcf536b90e | import random
import time
import sys
import csv
# Creates and return list of random elements
root_tree = None
root_list = None
def rand_table_creator(table_size):
random_table = []
counter = 0
while counter < table_size:
k = random.randrange(0,(table_size*10)) # it choose value in range 0 to 4 ... |
995,427 | 903ac24d4520776456e4a0aa4d88988cbb2a6cb0 | from environs import Env
from flask import Flask, jsonify, request
from flask_cors import CORS
from .campaign_queries import (create_campaign_confs, create_campaign_for_user,
get_campaign_configs, get_campaigns_for_user)
app = Flask(__name__)
CORS(app)
env = Env()
db_conf = {
"db"... |
995,428 | a1b0a3bff7d902f4e094e91dd8a0cc90c97fa3f4 | # Generated by Django 2.2 on 2019-05-08 10:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('session', '0007_auto_20190505_0342'),
]
operations = [
migrations.CreateModel(
name='Board',
fields=[
... |
995,429 | afdfaf841ed65d10dd67ad178ef9bf826003c745 | # 코드 5-2 값을 비교하는 코드
print(1 < 2)
print(2 < 1)
|
995,430 | 5fd72e1e221c32820df0b3de567cd1ac5a2c7576 | from flask import Flask, render_template ,request,url_for,escape,session,redirect,abort
import sqlite3 as sql
# import admin
from flask_bcrypt import Bcrypt
app = Flask(__name__)
app.secret_key = 'any random string'
bcrypt = Bcrypt(app)
def Convert(tup, di):
di = dict(tup)
return di
# Show PROFESSOR list
def show_... |
995,431 | a23b17a176629e582bfb344f9cefc0bfca36b160 | """===========================================
파일이름 : file_sort_day_folder.py
함수기능 : 실행시 같은 폴더 내에 있는 파일들의 목록을 텍스트 파일로 만든후 생성 날짜별로 폴더 생성후 정리
최초개발 : 2018-04-22
최종수정 : 2018-04-28
copyright ⓒ 2017 S.W.Yang All Rights Reserved
==============================================
2018-04-25
-> 파일이름 내부의 공백 문자 인식 수정
2018_04_25
-> 프로... |
995,432 | cb12f43ecc884d1af31da4d23eb3a2caa8499246 | /Users/andrewbeatty/anaconda3/lib/python3.7/abc.py |
995,433 | e7a0e9cadbc7f65eecb5f926e068cdd72feea474 | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
from selenium.webdriver.remote import mobile
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from sel... |
995,434 | 1db971ec39708916b7e4e8585d01bdf17ea28e8b | import sys
sys.stdin = open('2108_input.txt')
'''
수를 처리하는 것은 통계학에서 상당히 중요한 일이다.
통계학에서 N개의 수를 대표하는 기본 통계값에는 다음과 같은 것들이 있다. 단, N은 홀수라고 가정하자.
산술평균 : N개의 수들의 합을 N으로 나눈 값
중앙값 : N개의 수들을 증가하는 순서로 나열했을 경우 그 중앙에 위치하는 값
최빈값 : N개의 수들 중 가장 많이 나타나는 값
범위 : N개의 수들 중 최댓값과 최솟값의 차이
N개의 수가 주어졌을 때, 네 가지 기본 통계값을 구하는 프로그램을 작성하시오.
첫째 줄에는... |
995,435 | 474342fe66d842004d289e060450cba0f5d9e9b0 | '''
Proyecto GesCred
----------------
Descripcion: Gestor de Credenciales, aplicacion para la administracion
de ususarios y claves de accesos de tus cuentas personal.
El proyecto fue programado en Visual Studio 2015 Community.
Autor: Sergio Marquez (OneLog - onelog@protonmail.ch)
Fecha: 29/08/2016
Version: 1.0.... |
995,436 | 2217e60e3334f722ed8f27d149efc134a7874615 | from src.planners.planner import Planner
from src.models.task import Task
from typing import List
from math import gcd, floor , pow
from src.models.execution_matrix import ExecutionMatrix
from copy import deepcopy
import functools
class RateMonotonicPlanner(Planner):
def __init__(self, tasks: List[Task], process... |
995,437 | 262bab792d5383c0cf00124326e63bfb866d319f | from flask.ext.wtf import Form
from wtforms import TextField, BooleanField, TextAreaField, SelectField, IntegerField, validators
from wtforms.validators import Required, Length
from flask.ext.babel import gettext
from app.models import User
class LoginForm(Form):
openid = TextField('openid', validators = [Required... |
995,438 | c6d0f54656f585420c687025a0d549d3c6b2facf | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('uberjobs', '0003_auto_20150329_1936'),
]
operations = [
migrations.AddField(
model_name='econcategory',
... |
995,439 | 3121c9d19fcb839957f96f5effeb09b5167d52d6 | n=int(input(" "))
if(n<=10000000 and n>0):
print(n+1)
else:
print("invalid")
|
995,440 | f65c9df90ccefaf4e1d749f591d1f2a3cd2c353f | from .node_clustering import NodeClustering
from .edge_clustering import EdgeClustering
from .fuzzy_node_clustering import FuzzyNodeClustering
|
995,441 | 206941fc791f1e270bad65577011e6885ecb4380 | ## ## ## param.py v.0.1
## ## ## This program returns common parameters
## ## ## Created: 08/05/2012 - KDP
## ## ## Last Edited: 08/05/2012 - KDP
def lj(string):
"""
Returns common parameters for lj argon.
ntpy.param.lj(string)
Parameters
----------
string : str
A string that corresponds to a lennard jones ... |
995,442 | cc2c7cd4e737a6cc4fd8073f967ffe6519b5d488 | #!/usr/bin/python
import networkx as nx
import parser
import optparse
import os
import
def centrality(edgeList, ctype):
"""
"""
print "centrality start"
file = open(edgeList, "r")
graph = nx.read_edgelist(file, comments="#", create_using=nx.DiGraph(), nodetype=int)
file.close()
N = nx.nu... |
995,443 | 53aa2eb803e10553d3145d106d2c3fc71a888230 | def type_finder(l):
return [str(item) for item in l if (type(item) == int or type(item) == float)]
# new_list = []
# for item in l:
# if type(item) == int:
# new_list.append(str(item))
# return new_list
list_items = [1,2,3,4,(1,2,3,4,),{1:3,3:5,},'rohit','mohit',1.1,2.5]... |
995,444 | 643a56b48b2379f8ff1f69754169afdf93bb6ea6 | # -*- coding:UTF-8 -*-
"""
命令行入口文件,非IDE执行
@author: hikaru
email: hikaru870806@hotmail.com
如有问题或建议请联系
"""
import os
import sys
root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..\\.."))
if root_path not in sys.path:
sys.path.append(root_path)
os.chdir(root_path)
import steamCommon
import badges
... |
995,445 | 7414dd5d2edfa42e0b76ca902cd94f133d911ec6 | #
# @lc app=leetcode.cn id=202 lang=python3
#
# [202] 快乐数
#
# @lc code=start
class Solution:
def isHappy(self, n: int) -> bool:
cache = set()
while n!=1:
n = sum([ int(i) ** 2 for i in str(n)])
if n in cache:
return False
else:
... |
995,446 | 6ad06ca98e337a65e980c2baf81414de802bd0e7 | X = input("自分の好みのアルファベットの順番を記載してください:")
pos = {}
for i in range(26):
pos[X[i]] = i + 1
#print(pos)
N = input("国民数を入力してください:")
S = []
for n in range(int(N)):
name = input("国民の名前を入力してください:")
S.append(name)
for j in range(int(N)):
for k in range((int(N)-1), j, -1):
word_count1 = len(S[k])
... |
995,447 | 68514542c03b5276511430f06d77b5606383311e | """
This class has functions for dealing with Fibonacci numbers, and Fibonacci
sequences. For an explanation of Fibonacci numbers and Fibonacci sequences,
see https://en.wikipedia.org/wiki/Fibonacci_number
"""
from typing import Generator
class Fibonacci:
# This is a list of the first 301 Fibonacci numbers from... |
995,448 | 1d63e8fe376462c3acd128b681d20c0800e6cd1a | # Multiples of 13
"""
Write a program that reads two integer numbers X and Y
and calculate the sum of all number not divisible by 13 between them, including both.
Input
The input file contains 2 integer numbers X and Y without any order.
Output
Print the sum of all numbers between X and Y not divisible by 13... |
995,449 | 62ec0e882fd4e7a3341f9f5a8baa17360cca37f3 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('attachments', '0004_name_sanitization'),
('anonymization', '0001_attachmentnormalization'),
]
operations = [
migrati... |
995,450 | 27d4805e1fcb7dad748d94da8afc8571afd87ab8 |
# Osmel Savon
# Assignment 1
# 9/9/16
def nameYr():
first = input("What is your first name? ")
last = input("What is your last name? ")
year = input("In which year were you born? ")
print (first[0:1] + "." + last[0:1] + ". " + year[2:4])
def calcPerc():
score = input ("Ent... |
995,451 | 229285073e7d8d6f8a0f263ff2a894cba031f938 | [x1, y1, y2, x2] = map(int, input().split(" "))
if x1 + x2 > y1 + y2:
print("X")
elif x1 + x2 < y1 + y2:
print("Y")
elif x2 > y1:
print("X")
elif x2 < y1:
print("Y")
else:
print("P")
|
995,452 | 1ccb29ce04d6045a7d6cc1a6ac18833ef45c4095 | #!/usr/bin/env python
# coding: utf-8
import sys
import Image
import ImageFont
import ImageDraw
import requests
import urllib
import os
from StringIO import StringIO
info = open(sys.argv[1],'r').read().split('\n')
uid = info[0]
token = info[1]
target = info[2]
users = [i.split(' ') for i in info[3:]]
while users[-1] ==... |
995,453 | a3267e82c31b16b4e9154cbcd3fda3b946c18698 | import tensorflow as tf
def lrelu(x, leak=0.2, name="lrelu", alt_relu_impl=False):
with tf.variable_scope(name):
if alt_relu_impl:
f1 = 0.5 * (1 + leak)
f2 = 0.5 * (1 - leak)
return f1 * x + f2 * abs(x)
else:
return tf.maximum(x, leak * x)
def ins... |
995,454 | 5394495dd41b59f0b5749f87e387c31ab88b8f76 | # Generated by Django 3.1.8 on 2021-09-29 17:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('flags', '0053_downloadablepicturefilepreview_is_show_on_detail'),
]
operations = [
migrations.AddField(
model_name='downloadable... |
995,455 | 042789e4f4a884fba0795b5e5fbcc656b76c5375 | '''
Problem statement:
Write a function that takes an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight).
For example, the 32-bit integer '11' has binary representation 00000000000000000000000000001011, so the function should return 3.
Test cases passed: 600/600
Runtime: 56 m... |
995,456 | 33f7bf473d37ea8990a733e6b03d08f251e03e71 | from .pages.base_page import BasePage
from .pages.product_page import ProductPage
from .pages.login_page import LoginPage
import pytest
import time
@pytest.mark.skip(reason="no need currently to test this")
@pytest.mark.parametrize('link', ["http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/?promo=off... |
995,457 | ba677c046392c09f2b92b9d916157696a13814a4 | ID = '101'
TITLE = 'Symmetric Tree'
DIFFICULTY = 'Easy'
URL = 'https://oj.leetcode.com/problems/symmetric-tree/'
BOOK = False
PROBLEM = r"""Given a binary tree, check whether it is a mirror of itself (ie, symmetric
around its center).
For example, this binary tree is symmetric:
1
/ \
... |
995,458 | d925480e3ca9c36a57efb8e7dfcef65eded7a567 | # in this file, python style
import numpy as np
from fast_rcnn.config import cfg
def attention_refine_layer(feat, att_map):
# this function realizes channel-wise Hadamard matrix product operation.
# input shape(1,H,W,C). attention_map shape(H,W)
input_shape = feat.shape
att_shape = att_map.shape
... |
995,459 | d90a656e7099d7bce91732f6628d244c510f95ff | # -*- coding: utf-8 -*-
# Copyright(C) 2014 Bezleputh
#
# This file is part of a woob module.
#
# This woob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, ... |
995,460 | c29cd9cf111668b81eabb32ec5fb3562309400e3 | class AttnDecoderRNN(nn.Module):
def __init__(self, attn_model, embedding, hidden_size, output_size, n_layers=1, dropout=0.1):
super(AttnDecoderRNN, self).__init__()
# Keep for reference
self.attn_model = attn_model
self.hidden_size = hidden_size
self.output_size = output_si... |
995,461 | 7bd089b281e56dd73d53bb4f0e195bdadc59a887 | #-- Criar um programa para o cadastro de cliente
# Para cadastro de clientes deve pedir os seguintes dados:
#Código do cliente, CPF, Nome completo,
# data de nascimento, Estado, Cidade, CEP, Bairro, Rua, numero da casa, complemento.
# Uma funcionalidade do range colocar uma variável, mas ela tem que ser do tipo int ao... |
995,462 | c5054f4dfd72131356f71d7e6fa26e0118fcfe4a | # # Please refer to the commented section below for a short Scapy recap!
#
# # In Scapy, we will use the sniff() function to capture network packets.
# # To see a list of what functions Scapy has available, open Scapy and run the lsc() function.
# # Run the ls() function to see ALL the supported protocols.
# # Run the ... |
995,463 | df17036c533f72a0bc9ae7976ff24eebd9bd4c68 | import cv2 as cv
import math
import pathlib
import os
def face_scraper():
"""
Crops all raw images in ./rawimages/test or ./rawimages/train into usable face images for classification.
"""
base_directory = pathlib.Path(__file__).parent.absolute()
test_or_train, is_target_face = ask_for_directory()
... |
995,464 | 4d8b8badc161ea61984e22ee69d30bddf617f18a | i=1
while i<=5:
j=1
while j<=5:
print('*',end=' ')
j=j+1
i=i+1
print() |
995,465 | d3cfad24eb66d2656e12ca9ff03875efbb4762f5 | from django.contrib import messages
from django.contrib.auth import login
from django.contrib.auth.decorators import login_required
from django.db import transaction
from django.db.models import Avg, Count
from django.forms import inlineformset_factory
from django.shortcuts import get_object_or_404, redirect, render
fr... |
995,466 | 3613ce13a5ac740fb2b2ebfc6ed7cde84dea9cfa | from django.db.models.deletion import CASCADE
from django.db.models.fields import BooleanField
from django.core.validators import RegexValidator
from django.dispatch import receiver
from django.db.models.signals import post_save
from djongo import models
from django.contrib.auth.models import AbstractUser, BaseUserMana... |
995,467 | 32f14ca8e2e128499ae129e635fbcd4b4f73919e | from urllib3 import request
r = request.urlopen('http://httpbin.org')
text = r.read()
print(r.status, r.reason) |
995,468 | 9c6b96ae97a8d852349ed572e960f3ce93b15592 | from io import BytesIO
import pycurl
from collections import namedtuple
class Muti_curl():
def __init__(self, url):
self.curl = pycurl.Curl()
self.curl.setopt(pycurl.URL, url) # url
@classmethod
def deti(cls):
# cls.curl.setopt(pycurl.URL, url) # url
# self.curl.setopt(p... |
995,469 | 7447eb937600998b67df96b75598ed66f45f21c4 | newWordList = []
#Taking input string
inputstring = input("enter the words separated by comma")
words_list = inputstring.split(",")
#to strip spaces before and after each word
for word in words_list:
newWord = word.strip()
newWordList.append(newWord)
# To sort the words
newWordList.sort()
#to co... |
995,470 | 1165d931eb8904690f16af27bee5a0c00605ae0e | # 13. Write a Python program to sort a list of tuples using Lambda.
srt = lambda x:sorted(x)
print(srt([(0, 2, 3, 111), (0, 1, 6), (7, 8, 9)]))
|
995,471 | 30aaac5d9e527383127b317dd8bd1176544ca8ab | #235 二叉搜索树的最近公共祖先
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
# class Solution(object):
# def lowestCommonAncestor(self, root, p, q):
# """ :type root: TreeNode
# :type p: TreeNode
# :type q: TreeNode
# ... |
995,472 | b47abe159dd0d02569d06607a124e5a8368cd604 | from property_price_model import db
class Sale(db.Model):
id = db.Column(db.String(36), primary_key=True)
price = db.Column(db.Integer)
date = db.Column(db.Date)
postcode = db.Column(db.String(8))
property_type = db.Column(db.String(1))
new_build = db.Column(db.String(1))
free_or_leasehold... |
995,473 | d838ebaabfe6f2f1c5d10b2bf1a579d302fbeade | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# This is simple function to get the weather data from weather underground,
# and it will get the weather from 1991-01-01 to 2010-12-31 with totally
# 20 years.
#
# The URL request sample will be like:
# http:... |
995,474 | c91bd170bc805ea0cafbe0091546a39f60a8d516 | from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic import TemplateView
from lms import settings
from django.conf.urls.static import static
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url("^$", TemplateView.as_view(template_n... |
995,475 | 93ebfab49478ca734c0fa29c148f26a726b8ddee | def minCostClimbingStairs(cost: list) -> int:
"""等填坑"""
min1, min2 = 0, 0
for i in range(2, len(cost)+1):
mincost = min(cost[i-1]+min2, cost[i-2]+min1)
min1, min2 = min2, mincost
return mincost
cost = [10, 15, 20]
print(minCostClimbingStairs(cost)) |
995,476 | 6fce1ccde3b3c78c7d068e789a1a9f4824954173 | '''
Code for plotting k-mer uniqueness ratio
Assumes count.cpp has already beeen run to put data in (k, # different kmers, # unique kmers, # kmers) format
'''
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import seaborn as sns
files = ['ecoli.kmers', 'celegans.kmers', 'chr1.kmers', 'tomato.km... |
995,477 | ffc6d982391e1bb0e33c462842dd2818abcd2321 | import logging
import time
from kiteconnect import KiteTicker
logging.basicConfig(level=logging.DEBUG)
api_key = open('/home/akkey/Desktop/Django-projects/django-sockets/demo1/integers/api_key.txt', 'r').read()
access_token = "pt5vbS56ncUWLl2bqd5FjuH1oM4iJ7pp"
tokens = [5215745, 633601, 1195009, 779521, 758529, 125619... |
995,478 | 323343ffed3328c71c5ac9b282295314ea3d39f7 | # -*- coding: utf-8 -*-
import time
import datetime
from django.core.urlresolvers import reverse
from django.core.cache import cache
from django.conf import settings
from forum_integration.api import DB, forum_login, forum_logout
class LoginUserOnForum(object):
def process_response(self, request, response):
... |
995,479 | 6a74e9b1e0c69c3a55b3ee4925124cfcce8ff562 | # Generated by Django 3.1 on 2020-10-23 07:25
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('netmedsapp', '0004_auto_20... |
995,480 | f48e997053951a6b20bf9649943f21fd66437727 | from LinkedList.node import Node, DoublyNode
class LinkedList:
def __init__(self, head=None): # input head for init with other linked list
if head is None:
self.head = None
self.tail = None
else:
self.head = head
buffer = self.head
while... |
995,481 | 6b25725379bf6bea26be5ea912fc35e68083484b | from flask import Flask
from flask.json import jsonify
from subprocess import call
import os, threading, time
import requests
app = Flask(__name__)
running = True
devnull = open(os.devnull, 'w')
mongo_db_ip = "Hadoop:smartcity@143.129.39.127"
mongo_db_port = "27017"
db = "Votes"
inCollection = "Votes"
command = [os.... |
995,482 | ac6731b891430a8b480de61bc3c44efe575bc49c | from typing import Optional, Dict, Any
import pandas as pd
from bokeh.models import ColumnDataSource
from bokeh.plotting import Figure
from torch import Tensor
class Tensor2DPlot:
data_source: ColumnDataSource
def _create_2d_plot_data(self, task_size: int, data: Optional[Tensor]) -> pd.DataFrame:
if... |
995,483 | 019ffe0eeb4b5f961b608620cf23211dfe2b212e | #!/usr/bin/env python
import re
import os
#---Intersection Directory
indir1 = "/home/emma.levin/tools/Rprof5_emma/Out/Intersection"
#---Population Directory
indir2 = "/home/emma.levin/tools/Rprof5_emma/Out/Population"
#exps=["cntl2015"]
#exps=["cntl1990"]
#exps=["cntl1940"]
#exps=["cntl1860"]
#exps=["HadISST"]
#exps... |
995,484 | 4c633734c679d5b999e08028e5d01ca0fb22763b | # Reverse Linked List II: https://leetcode.com/problems/reverse-linked-list-ii/
# Given the head of a singly linked list and two integers left and right where left <= right, reverse the nodes of the list from position left to position right, and return the reversed list.
from types import Optional
# Definition for s... |
995,485 | a02e24cdf5e4b3b7a066a01d1c1784ad7d55140f | # put your python code here
hour_one = int(input())
minute_one = int(input())
second_one = int(input())
hour_two = int(input())
minute_two = int(input())
second_two = int(input())
hour = (hour_two - hour_one) * 60 * 60
minute = (minute_two - minute_one) * 60
second = (second_two - second_one)
print(hour + minute + seco... |
995,486 | bca7f1fe07da8ac1f235781d521b295d5a6b8a42 | """
Два списка целых заполняются случайными числами(использовать нужную функцию из модуля random). Необходимо:
a. Сформировать третий список, содержащий элементы обоих списков
b. Сформировать третий список, содержащий элементы обоих списков без повторений;
c. Сформировать третий список, содержащий э... |
995,487 | a52cd0da1cfae6c836e0aee1b0ff8b0d421aa49f | from flask import render_template, redirect, request, url_for, flash
from . import detail_product_raw
from .forms import SearchForm
from app.models import ProductRaw, DetailProductRaw, DetailStock, Product, User, Memorandum, DetailMemorandum
from flask_login import login_required, current_user
from ..helper.views impor... |
995,488 | 505bbaf9069408d8db8553b58e241df8b0ec8654 | import unittest
from API import ReadQueue
class TestReadQueue(unittest.TestCase):
def test_query_from_queue(self):
return None
def test_is_email(self):
return None
def test_is_shop(self):
return None
def test_is_product(self):
return None
def test_prod_to_id(sel... |
995,489 | 40c34db6d3baa01392e11352b06c59cc7ec99c53 | from flaskboiler.service import Service
from flaskboiler.users.data import UserData
class UserService(Service):
def __init__(self):
super(UserService, self).__init__(UserData())
|
995,490 | e06898887145fee0989ccde2ca213bb5f5671195 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2012 ~ 2013 Deepin, Inc.
# 2012 ~ 2013 Long Wei
#
# Author: Long Wei <yilang2007lw@gmail.com>
# Maintainer: Long Wei <yilang2007lw@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of... |
995,491 | f7fb224b17b5983aa6a5c58ec7114d42813553dc | # coding: utf-8
import time
def get_timestamp():
return str(time.time()).split(".")[0] |
995,492 | d114a7b614d359d4d93b306ccb0d0fe93446ab64 | # Copyright 2019 Atalaya Tech, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, ... |
995,493 | 7ef4b762d2643f97143bfe8d15ba6a06d2e0191c | print("Nhap so phan tu cua mang")
n = int(input())
list = []
temp = 0
print("Nhap so k")
k = int(input())
for i in range(n):
list.append(int(input()))
for i in range(n-1):
for j in range (i+1,n):
if list[i]>list[j] :
temp = list[i]
list[i] = list[j]
list... |
995,494 | 7d8c0432da1a6d391b3694bbe752c0a7670c312b | ab = raw_input()
if(ab>='a' and ab<='z'):
print("Alphabet")
elif(ab>='A' and ab<='Z'):
print("Alphabet")
else:
print("No")
|
995,495 | 5f0e214d871d09883e581ca9706878faeff511f2 | __author__ = "Nick Isaacs"
import configparser
import os
import logging.handlers
import logging
import sys
RELATIVE_CONFIG_PATH = "../config/gnip.cfg"
class Envirionment(object):
def __init__(self):
# Just for reference, not all that clean right now
self.config_file_name = None
self.confi... |
995,496 | 9ca1618510be5446a03febe6833a824696f58a88 | from django.conf import urls
from plzmore.core import views
urlpatterns = [
urls.url(
r'^video/(?P<plzid>[A-Za-z0-9\-\_]{11})/$',
views.StreamView.as_view()
),
urls.url(
r'^torrent/upload/$',
views.UploadTorrentView.as_view()
),
]
|
995,497 | 4108e709859e7391e4db1f60b9c234e1ec7d0216 | ll=[1,2,3,87,98]
ss=""
flt=[]
for i in ll:
if isinstance(i,int):
ll.append(i)
if isinstance(i,str):
ss +=i
if isinstance(i,float):
flt.append(i)
print ll
print ss
print flt
|
995,498 | 0516e6a13d93d26fe5d5cf70faf0a7f5b2b552d3 | def simpleanimation():
import vcs, cdms2, sys
x = vcs.init()
f = cdms2.open(vcs.sample_data+"/clt.nc")
v = f["clt"]
dv3d = vcs.get3d_scalar()
x.plot( v, dv3d )
x.interact()
def simplevector():
import vcs, cdms2, sys
x = vcs.init()
f = cdms2.open(vcs.sample_data+"/clt.nc")
v ... |
995,499 | 486f576ad2ffa1d4e9bacd78aa993cd237e4fe17 | '''
Packages needed in default aws slack command blueprint
'''
import boto3, json, logging, os
'''
Packages non-native to lambda
Required to by installed, zipped with app, uploaded to lambda
'''
import req
'''
Environment variable decryption
'''
from base64 import b64decode
from urlparse import parse_qs
ENCRYPTED_EXPE... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.