index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
2,100 | 881d0c0808d8c0e656cdbf49450367553c100630 | # ეს არის კოდი, რომელიც ქმნის აბსურდს
import random
def get_all_words():
words = [] # ეს არის ლისტი ყველა ისეთი სიტყვის
with open("poem.txt") as poem: # რომლის ასოების სიმრავლეც 6-ზე ნაკლებია
for line in poem: # გრძელ სიტყვებთან თამაში რთულ... |
2,101 | d24bbfc3587a2a79891a11e00ec865498c01c286 | from Crypto.PublicKey import DSA
from Crypto.Signature import DSS
from Crypto.Hash import SHA256
import os
import time
kB = 1024 # 1kB
with open('small_file.txt', 'wb') as f:
f.write(os.urandom(kB))
mB = 10485760 # 1GB
with open('large_file.txt', 'wb') as f:
f.write(os.urandom(mB))
Begin = time.time()
key = ... |
2,102 | 6fc43919f521234d0dc9e167bb72f014e9c0bf17 |
import sys
from PySide6.QtCore import *
from PySide6.QtWidgets import *
from PySide6.QtGui import *
from simple_drawing_window import *
class simple_drawing_window1( simple_drawing_window):
def __init__(self):
super().__init__()
def paintEvent(self, e):
p = QPainter()
p.begin(self)
"""
p.setPen(Q... |
2,103 | 4f15e2743b33e2f672cd258172da852edb7e4118 | from utils import *
EvinceRelation("different from")
|
2,104 | 9d8c4bf9f9279d5e30d0e9742cdd31713e5f4b9e | from app import app
from flask import request
@app.route('/')
@app.route('/index')
def index():
return 'Hello world'
@app.route('/api_post', methods = ['POST'])
def postJsonHandler():
print (request.is_json)
content = request.get_json()
print (content)
return 'JSON posted'
|
2,105 | 166520ab5b9fd5a55dd2aa30b4d62f55096ce6cb | #!/usr/bin/env python
import sys
import typer
from cupcake import version_callback
from cupcake.sequence import GFF
app = typer.Typer(
name="cupcake.sequence.get_gffs_from_list",
help="Get records from a GFF file from a list",
)
def get_gff_from_list(gff_filename, listfile, partial_ok=False):
seqs = [l... |
2,106 | e6884afaae15e903c62eecb3baec868548998080 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-03-31 17:58
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('words', '0004_auto_20180330_0647'),
]
operations = [
migrations.AddField(
... |
2,107 | 1a42892095d820f1e91ba5e7f2804b5a21e39676 | from tkinter import *
from math import *
#Raiz
root=Tk()
root.title('Calculadora LE-1409')
root.iconbitmap('calculadora.ico')
root.geometry('510x480')
root.config(bg='gray42')
root.resizable(False, False)
#Pantalla
screen=Entry(root, font=("arial",20, "bold"), width=22, borderwidth=10, background="CadetBlue1", justi... |
2,108 | 4545d9756d1f396ead0b0c75d319fb6a718375cd | sentence = input()
check_list = ["U", "C", "P", "C"]
check = True
for i in range(len(check_list)):
if check_list[i] in sentence:
check = True
idx = sentence.find(check_list[i])
sentence = sentence[idx+1:]
else:
check = False
break
if check == True:
print("I love UCP... |
2,109 | c71e367ad320d7eadabbbfda728d94448db6441d | #!/usr/bin/python
# Point of origin (connector J3, pad 1, net 3V3)
x = 0.0
y = 0.0
drillDiameter = 1.0
padWidth = 1.6
from os.path import exists
from pad import *
filename="iCEstick.kicad_mod"
header = ""
footer = ""
if exists(filename):
# Read existing footprint
f = open(filename)
footprint = f.read... |
2,110 | 463f50567c9dd4b7b47a84eea715541cec5d3cb5 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Dang Kai
# @Date: 2018-10-30 15:52:57
# @Last Modified time: 2018-11-10 09:09:21
# @E-mail: 1370465454@qq.com
# @Description:
from time import sleep
import sys
sys.path.append('../')
from common.encapsulation import BasePage
class IndexPage:
def login(self... |
2,111 | 7ee5779625d53ff1e18f73b20ba5849666f89b55 | #/usr/bin/env python3
"""Demonstrates how to do deterministic task generation using l2l"""
import random
def fixed_random(func):
"""Create the data"""
def _func(self, i):
state = random.getstate()
if self.deterministic or self.seed is not None:
random.seed(self.seed + i)
... |
2,112 | 270dba92af583e37c35ed5365f764adfdc2f947d | #!/usr/bin/env pytest
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: TopJSON driver test suite.
# Author: Even Rouault
#
###############################################################################
# Copyr... |
2,113 | 6c641ace8f1e5e8c42fa776bd7604daf243f9a41 | import torch
import torchvision.transforms.functional as F
import numpy as np
import yaml
from pathlib import Path
IGNORE_LABEL = 255
STATS = {
"vit": {"mean": (0.5, 0.5, 0.5), "std": (0.5, 0.5, 0.5)},
"deit": {"mean": (0.485, 0.456, 0.406), "std": (0.229, 0.224, 0.225)},
}
def seg_to_rgb(seg, colors):
i... |
2,114 | d373d283a622262e2da974549907bdd8f61e89ec | from flask import Flask, render_template, redirect, request, session, flash
from data import db_session
from data import users, products
import os
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField, BooleanField, SelectField, IntegerField
from wtforms.fields.html5 import E... |
2,115 | ce12ede15f4ca4a085e38e455515d8a028da8fd2 | import FWCore.ParameterSet.Config as cms
class StageOneCustomize():
"""
Customizaton class for STXS stage 1 analysis
"""
def __init__(self, process, customize, metaConditions):
self.process = process
self.customize = customize
self.metaConditions = metaConditions
se... |
2,116 | cc703690151acd17430b5a9715e71a694fdeca10 | '''
Can you print numbers from 1 to 100 without using any loop.
'''
# Use Recursion |
2,117 | ea3b8fe602357fa3d1de4daefce1e71a7de6e010 | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 31 16:55:33 2018
@author: GEAR
"""
'''
在OpenCV中有超过150中进行颜色转换的方法,但我们经常用到的一般只有两种:
BGR <-> Gray 和 BGR <-> HSV
我们需要用到的函数有:cv2.cvtColor(input_image, flag),其中flag是转换类型
对于BGR <-> Gray,我们用到的flag为cv2.COLOR_BGR2GRAY,但我们要注意在OpenCV
中HSV格式中H 色彩/亮度 的取值范围是[0 179], S 饱和度 和 V 亮度的取值范围是
[0... |
2,118 | d7876a078af8572e44b4eb16f3ec0898db73724d | a = (5, 1, 3, 5, 3, 1, 0, 9, 5, 3, 8, 6, 5, 7)
b = []
for index, elements in enumerate (a):
if elements == 5:
b.append(index)
print(b) |
2,119 | 977841e0bb73cec879fbb1868f1e64102c6d8c1a | import requests
import os
import numpy as np
from bs4 import BeautifulSoup
from nltk import word_tokenize
from collections import Counter
import random
from utils import save_pickle
root = 'data'
ratios = [('train', 0.85), ('valid', 0.05), ('test', 0.1)]
max_len = 64
vocab_size = 16000
data = []
path = os.path.joi... |
2,120 | cc924892afe179e55166ea9b237b2bfe8ea900df | from tkinter import *
from tkinter import messagebox
from tkinter import ttk
from PIL import Image, ImageTk
import time
import socket
import threading
root = Tk()
root.title("Tic-Tac-Toe")
root.geometry('600x600')
winner = False
def start_thread(target):
thread = threading.Thread(target=target)
... |
2,121 | 2af590ad11704ecf21489a5d546e61f40dcceee6 | from django.contrib import admin
from .models import Cliente, Pack
# Register your models here.
admin.site.register(Pack)
admin.site.register(Cliente)
|
2,122 | 92317996f884befd646138cd3a3dc3f8345679f4 | import sys
import os
import numpy as np
import math
sys.path.append("../")
from sir.improveagent import *
import numpy as np
import numpy.linalg as la
import matplotlib.pyplot as plt
#from sklearn.neighbors import BallTree
from scipy.spatial import KDTree
from scipy.spatial import cKDTree
from scipy.spatial.distance im... |
2,123 | cffcfa08cd919f93dfe2ab8dc676efc76feafab3 | # coding=utf-8
"""
PYOPENGL-TOOLBOX UTILS
General purpouse functions.
MIT License
Copyright (c) 2015-2019 Pablo Pizarro R.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, inc... |
2,124 | 817d7259b3607f3a94d2f363c9684f733ee87d37 | from django.db import models
# Create your models here.
class Author(models.Model):
AuthorID = models.IntegerField(primary_key=True)
Name = models.CharField(max_length=200)
Age = models.IntegerField(max_length=50)
Country = models.CharField(max_length=100)
class Book(models.Model):
ISBN = models.C... |
2,125 | 2a8032c23e3c7aa3a7b0593c79db7adbc0353f93 |
import pygame
import os
from time import sleep
screen = pygame.display.set_mode((900,700))
screen.fill((255,255,255))
pygame.display.set_caption("NTUFOODIERECOMMENDSYSTEM")
'''
###########################
──╔╗────╔╗
──║║───╔╝╚╗
╔═╝╠╦══╬╗╔╬╦══╦═╗╔══╦═╦╗─╔╗
║╔╗╠╣╔═╝║║╠╣╔╗║╔╗╣╔╗║╔╣║─║║
║╚╝║║╚═╗║╚╣║╚╝║║... |
2,126 | ee91e8c9dcb940882733b2d23b74a76d0392f4fe | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import, unicode_literals
import os
from qtpy.QtCore import *
# from qtpy.QtGui import *
from qtpy.QtWidgets import *
from six import string_types
from ..widgets import PathParamWidget, RelPathParamWidget, FilePath... |
2,127 | 8f1ec65ca60605747f46f596e0b5848922bcd0b5 | from day6input import *
groups = input.split('\n\n')
count = 0 #1
groupanswers = [] #2
for group in groups:
allananswers = set(list('abcdefghijklmnopqrstuvwxyz')) #2
answers = set() #1
people = group.split('\n')
for person in people:
allananswers = allananswers & set(list(person)) #2
... |
2,128 | 542bd52e3d5bc79077277034234419983005f78e | from paypalcheckoutsdk.core import PayPalHttpClient, SandboxEnvironment
from paypalcheckoutsdk.orders import OrdersCaptureRequest, OrdersCreateRequest
from django.conf import settings
import sys
class PayPalClient:
def __init__(self):
self.client_id = settings.PAYPAL_CLIENT_ID
self.client_secret ... |
2,129 | d71ec86f68cc81c93a39f15c785c75c2a1023f14 | import numpy as np
import pandas as pd
def fetch_data(faultNumber, position):
df1 = pd.read_csv("./data/TEP_CaseStudy_Fault_" + str(faultNumber) + "_Pos_" + str(position) + "%.csv")
df1.set_index(df1.columns[0])
df1 = df1.drop(columns=[df1.columns[0]])
df2 = pd.read_csv("./data/TEP_CaseStudy_Fault_" ... |
2,130 | fcb13b087b9c967ab16b64885411cc4aae98583c | from django.contrib import admin
from .models import Invite
class InviteAdmin(admin.ModelAdmin):
list_display = ('invitee', 'inviter', 'created_on',
'approved', 'rejected','used')
admin.site.register(Invite, InviteAdmin)
|
2,131 | 07dc058ecef323ffd41299245e4fcafdc9e41506 | from django.http import HttpResponse
from polls.models import Pregunta
from django.template import loader
def index(request):
preguntas = Pregunta.objects.order_by('-fecha')[:5]
template = loader.get_template('polls/index.html')
context = { 'listado': preguntas,}
return HttpResponse(template.render(c... |
2,132 | 8fe45332ce09195beabb24c8cbb56868c564ded4 | from golem import actions
from projects.golem_integration.pages import golem_steps
description = 'close_window_by_partial_title action'
def test(data):
actions.navigate(data.env.url + 'tabs/')
actions.send_keys('#title', 'lorem ipsum')
actions.click('#goButtonCustom')
actions.assert_amount_of_window... |
2,133 | d45ca839a24093266c48e5f97164b160190b154d | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-29 03:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_otp', '0001_initial'),
]
operations = [
migrations.AddField(
... |
2,134 | b2b961c6ff1d975d80a84be361321ab44dc026a0 | from queuingservices.managers.queue_lifecycle_manager import QueueLifecycleManager
from queuingservices.managers.queue_publisher_manager import QueuePublisherManager
from queuingservices.managers.queue_subscriber_manager import QueueSubscriberManager
class QueueMaster(QueueSubscriberManager, QueuePublisherManager, Qu... |
2,135 | 302634b93725ceb9333e236021cbb64e023ff798 | import curses
from zeep import Client
from zeep import xsd
from zeep.plugins import HistoryPlugin
import time
from datetime import datetime
import os
LDB_TOKEN = 'NULLTOKEN'
WSDL = 'http://lite.realtime.nationalrail.co.uk/OpenLDBWS/wsdl.aspx?ver=2017-10-01'
if LDB_TOKEN == '':
raise Exception("Please configure y... |
2,136 | 3314ffdbc2f10170176c590aebf49c416bcc8856 | import os
import mysql.connector
import time
from flask import Flask, render_template
app = Flask(__name__)
def dbconnect():
return mysql.connector.connect(user= , password= , host="mysqlshereen.mysql.database.azure.com", port=3306, database='test')
@app.route('/result', methods=['POST', 'GET'])
def query():
... |
2,137 | c632c50028fee2f19fb65458f0b55ec228b8006f | #This is a module which implements Naive Set Theory in Python.
#It will be useful for Unions, Intersections, Mutual Exclusion, and more.
#ideas: print(sum([[[1],[2]], [[3],[4]], [[5],[6]]], [])) Monoid - abstraction on +
trial = [1, 2, 3]
trial2 = [3, 4, 5]
def recursiveUnioniser(set):
if isinstance(set[0], int)... |
2,138 | 17ac827d181650cd8bd6e75ca7ff363d70d3c4a7 | import collections
import cPickle as pickle
import os
import shutil
import warnings
import numpy as np
import theano
import theano.tensor as T
import tables
#theano.config.compute_test_value = 'warn'
class SGD_Trainer(object):
"""Implementation of a stochastic gradient descent trainer
"""
#{{{ Properties
... |
2,139 | f5b18673dd5a3ba3070c07e88ae83a531669311a | """
Tests for `sqlalchemy-cql` module.
"""
import pytest
from sqlalchemy import create_engine
from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey
metadata = MetaData()
users = Table('users', metadata,
Column('id', Integer, primary_key=True),
Column('name', String),
Column('fullname... |
2,140 | eb890c68885cbab032ce9d6f3be3fd7013a2788b | import pandas as pd
import os
import re
main_dir = r'C:\Users\Username\Desktop\Python\End-to-End-Data-Analysis\1. Get the Data\table'
file = 'CMBS Table.csv'
os.chdir(main_dir)
cmbs = pd.read_csv(file, encoding='ISO-8859-1')
# Delete extra Loan & Seller columns
loan_seller_cols = [val for val in cmbs.co... |
2,141 | 0e03a3b3401075384e580bc2bb8af1a106f1d238 | from __future__ import unicode_literals
from functools import partial
from django.contrib.auth import get_user_model
from .default_settings import settings
from . import signals
class AuditMiddleware(object):
"""
middleware to add the user from requests to ModelChange objects.
This is independent of req... |
2,142 | f5f1a4db33cea8421cb4236606dfb288efee7621 | # coding: utf-8
from flask import Blueprint, make_response, render_template, request
from flask_restful import Resource
from flask_security import login_required
from ..clients.service import list_clients
from ..roles.service import list_roles
from ...models import Client, Role
admin = Blueprint('admin', __name__, u... |
2,143 | 9db1887c5379623687d1dea343d72122bab66303 | from django.urls import path
from . import views # 현재 패키지에서 views 모듈을 가져옴
urlpatterns = [
path('', views.home, name='home'),
path('ppt1',views.ppt1,name='ppt1'),
path('ppt2',views.ppt2,name='ppt2'),
] |
2,144 | b30e6af035b589d5f4bd1bc6cccdd53c157861a0 | #!/usr/bin/env python
# including libraries
import roslib
import sys
import rospy
import cv2
import math
from std_msgs.msg import String
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import numpy as np
import matplotlib.pyplot as plt
MAP = np.array([[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,... |
2,145 | ba2f8598ec7e107ac71786cf9191777a93ae2c7a | import os
import sys
import csv
import math
for i in sys.stdin:
i = float(i)
key = math.floor(i*10)
print('%s\t%s' % (key, i))
|
2,146 | d296e528d399ee772039777d139a1d8271711ee9 | from django.conf import settings
from django.contrib import messages
from django.shortcuts import redirect, render
from django.urls import reverse
from django.views.generic import DetailView, ListView, View
from assessments.models import (Mine, Company,
QuestionCategory, Question, Assessment, Response)
class Home... |
2,147 | 64368679aa2e387e25a36b2f3d0312a99b819e95 | #!/usr/bin/env python
from xrouter import api
api.main()
|
2,148 | 49995e60b817e2c5a2ea7e85e4fe96ca95363cb2 | '''
Created on 2018-9-8
@author: weij
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os.path
import sys
import time
import numpy as np
from numpy import shape
from scipy import linalg
from sklearn import datas... |
2,149 | 16215ee42c4ea284dca0ebb7372fef04c0cc54b9 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 3 17:16:12 2019
@author: Meagatron
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from collections import defaultdict
import math
import itertools
from dtw import dtw
import timeit
from helper_functions import normalize,alphabetize_ts,hammin... |
2,150 | 9aee715e976db632f0829a06cb9e0101c90512be | # -*- coding: utf-8 -*-
"""
VorRun
Runs Vorlax and plots wireframe output from Vorlax
(https://github.com/GalaxyHobo/VORLAX)
NOTE! Type: "%matplotlib auto" in iPython console to
switch to interactive plots, or "%matplotlib inline"
to switch to inline, in the console.
NOTE! Reads path to Vorlax .exe in "... |
2,151 | aa15f684d23d97a45a416b1fdcfb192710ebb56f | # https://www.hackerrank.com/challenges/bon-appetit
n, k = map(int, input().split())
prices = [int(temp) for temp in input().split()]
taken = int(input())
if (sum(prices) - prices[k]) // 2 == taken:
print("Bon Appetit")
else:
print(taken - (sum(prices) - prices[k])// 2)
|
2,152 | 3553fa72cb831f82a1030b9eadc9594eee1d1422 | from datetime import datetime
class Guest:
def __init__(self, Name, FamilyName, Car, controlboard,
CarRotationManager, ID=0, linkedplatform=None,Start=0): # --Initializing Guest credentials/info---
self.Name = Name
self.FamilyName = FamilyName
self.Car = Car
... |
2,153 | 879f7503f7f427f92109024b4646d1dc7f15d63d | K = input()
mat = "".join(raw_input() for i in xrange(4))
print ("YES", "NO")[max(mat.count(str(i)) for i in xrange(1, 10)) > K*2]
|
2,154 | 076e10b3741542b7137f6ac517dba482f545b123 | """
Name: Thomas Scola
lab1.py
Problem: This function calculates the area of a rectangle
"""
'''def calc_area():'''
def calc_rec_area():
length = eval(input("Enter the length: "))
width = eval(input("Enter the width: "))
area = length * width
print("Area =", area)
def calc_rec_vol():... |
2,155 | 0e3bf0ddd654b92b2cd962a2f3935c639eeb0695 | import sys; input = sys.stdin.readline
from collections import deque
from itertools import combinations
from copy import deepcopy
n, m = map(int, input().split())
graph = [list(map(int,input().split())) for i in range(n)]
virus_lst = []
for i in range(n):
for j in range(n):
if graph[i][j]==2:
g... |
2,156 | ef57f0dfea261f022ced36ef9e27a07d63c21026 | # Generated by Django 3.2.4 on 2021-06-18 01:20
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('eCom', '0014_auto_20210617_1503'),
]
operations = [
migrations.RemoveField(
model_name='order',... |
2,157 | 43b9d308bb8d2b38c5f539e8700f5c2d8fe2287d | from selenium import webdriver
from bs4 import BeautifulSoup
from selenium.webdriver.common.action_chains import ActionChains
import time
import json
import re
import os
import datetime
###########################################################################
driver_path = "/home/arnab/Codes/00_Libs/chromedriver_lin... |
2,158 | 06848ec0e327fed1da00446cec6392c6f42130af | '''Given a range of 2 numbers (i.e) L and R count the number of prime numbers in the range (inclusive of L and R ).
Input Size : L <= R <= 100000(complexity O(n) read about Sieve of Eratosthenes)
Sample Testcase :
INPUT
2 5
OUTPUT
3'''
x,y=map(int,input().split())
count=0
for i in range(x,y+1):
if i>1:
for... |
2,159 | e9918f4fac2e13b36d9b20ffc28dc6508aad6f9b | class Solution:
# complexity: 2*n^2 + 4*n^2 -> 8*n^2
def numSmallerByFrequency(self, queries: List[str], words: List[str]) -> List[int]:
# complexity: n*2*l where l is the length of the word -> 2*n^2
words_freq = {
word: word.count(min(word)) for word in words
}
quer... |
2,160 | a718949ed95b7d78f091b1e0f237eed151b102ae | from .most_serializers import * |
2,161 | e1172cadeb8b2ce036d8431cef78cfe19bda0cb8 | #Program to convert temp in degree Celsius to temp in degree Fahrenheit
celsius=input("Enter temperature in Celsius")
celsius=int(celsius)
fah=(celsius*9/5)+32
print("Temp in ",celsius,"celsius=",fah," Fahrenheit")
|
2,162 | 0ad529298f321d2f3a63cde8179a50cf2881ee00 | from __future__ import print_function
from __future__ import division
import os
import sys
import time
import datetime
import os.path as osp
from collections import defaultdict
import numpy as np
import math
from functools import partial
from tqdm import tqdm
import glog as log
import torch
import torch.nn as nn
impo... |
2,163 | 6cba431650ee8b74baa8310c144321b2e587155e | list_1 = ['color','white','black']#taking the colors of t-shirts as input
list_2 = ['short','medium','large','xl']#taking sizes of t-shirts as input
for color in list_1:
for size in list_2:
#using cartesien product asking to give output as the combinations of color and size of t-shirts we ... |
2,164 | 810017cd5814fc20ebcdbdf26a32ea1bcfc88625 | from collections import deque
from etaprogress.eta import ETA
def test_linear_slope_1():
eta = ETA(100)
eta._timing_data = deque([(10, 10), (20, 20), (30, 30), (40, 40)])
getattr(eta, '_calculate')()
assert 100 == eta.eta_epoch
assert 1.0 == eta.rate
assert 1.0 == eta.rate_unstable
def tes... |
2,165 | 013189cd67cc44efd539c75ed235a0753d95f54e | import pandas as pd
import tensorflow as tf
import autokeras as ak
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import tensorflow as tf
from numpy import concatenate
from pandas import read_csv, DataFrame, concat
from sklearn.preprocessing import MinMaxScaler
np.set_printoptions(... |
2,166 | 957e18b2536cda69ba1db571d0308d5e392fe488 | from config import Config
import numpy as np
from itertools import product
from sklearn.utils import shuffle
from sklearn.metrics import precision_recall_fscore_support
from keras import callbacks, regularizers
from keras.models import Sequential
from keras.layers import Dense, InputLayer
from keras import backend as K... |
2,167 | 9a9fdf0f3cfb876a384059f3dcf2508f960168c2 | # hi :)
import numpy as np
import random
from copy import deepcopy
# initialization....
# see also prepare.sh
header = np.loadtxt("header.txt", dtype=int)
TIME = header[2]
CARS = header[3]
STARTPOINT = header[4]
GRAPH = np.loadtxt("links.txt",dtype=int)
number_of_links = GRAPH.shape[0]
N = len(GRAPH[:,1])
VOI... |
2,168 | bd179fda18551d4f3d8a4d695a9da38ee607ef1d | import datetime
import json
from dateutil import parser
import mock
from python_http_client.exceptions import ForbiddenError
from rdr_service import clock, config
from rdr_service.api_util import open_cloud_file
from rdr_service.clock import FakeClock
from rdr_service.dao.database_utils import format_datetime
from rd... |
2,169 | e00cbe6e177ee841c6e64de842e5b8f95463b3a8 | import rpy2.robjects as robjects
from rpy2.robjects.packages import importr
ts=robjects.r('ts')
forecast = importr("forecast", lib_loc = "C:/Users/sand9888/Documents/sand9888/R/win-library/3.3")
import os
import pandas as pd
from rpy2.robjects import pandas2ri
pandas2ri.activate()
train = os.path.join('C:/DAT203.3x/... |
2,170 | 188f82b0fb04d6814d77617fa9148113d0e6ef01 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, hidden_size, encoder_layer=2, step=4, is_bidir=False, **kw):
super(Model, self).__init__()
fc_embedding = []
# First, we should convert the 1 dim data to ... |
2,171 | 9d22a90835f5cf293808ab359244fe1bde81f3e1 | from urllib.parse import urlencode
from urllib.request import urlopen, Request
from datetime import datetime
#пользовательские переменные
period=7 # задаём период. Выбор из: 'tick': 1, 'min': 2, '5min': 3, '10min': 4, '15min': 5, '30min': 6, 'hour': 7, 'daily': 8, 'week': 9, 'month': 10
start = "01.01.2021" #с какой д... |
2,172 | 285ca945696b32160175f15c4e89b3938f41ebf4 | """This module defines simple utilities for making toy datasets to be used in testing/examples"""
##################################################
# Import Miscellaneous Assets
##################################################
import pandas as pd
###############################################
# Import Learning Ass... |
2,173 | b9eeccbed63aa42afa09fe7ef782066f300255a1 | from sense_hat import SenseHat
import time
sense = SenseHat()
b = (0, 0, 204) #Blue
w = (255, 255, 255) #White
e = (0, 0, 0) #Empty
y = (255, 255, 0) #Yellow
r = (255, 0, 0) #red
prenume = [
e, e, e, e, e, e, e, e,
e, e, e, e, e, e, e, e,
e, b, e, y, y, e, r, e,
b, e, b, y, e, y, r, e,
b, b, b, y,... |
2,174 | 609071fc3af1b526fbd4555ced2376f56ae0f3c3 | import time
import json
import pygame
from pygame.locals import *
import urllib.request
from pygame.color import THECOLORS
pygame.init()
Brack=[0,0,0]
White=[255,255,255]
Green=[0,255,0]
Red=[255,0,0]
Gray=[169,169,169]
button_text=["开 始","开 始","开 始","开 始","开 始"]
line=['http://localhost:5050/mixer/000','http://localhos... |
2,175 | 10723f703f40b5db2b7c9532cda520b2ae078546 | #! /bin/env python3
"""
Lane Emden Python interface.
Main routine:
lane_emden_int(dz, n)
"""
import numpy as np
from . import _solver
def test():
"""
A simple test.
"""
n = 3.
dz = 2.**(-14)
_solver.lane(dz,n)
out = _solver.laneout
n = out.ndata
t = out.theta
return t,n
d... |
2,176 | e4bfa0a55fe0dbb547bc5f65554ef96be654ec7a | import pytest
from django.utils.crypto import get_random_string
from django.utils.timezone import now
from respa_exchange import listener
from respa_exchange.ews.xml import M, NAMESPACES, T
from respa_exchange.models import ExchangeResource
from respa_exchange.tests.session import SoapSeller
class SubscriptionHandle... |
2,177 | 91cf6d08be2ad86c08de4dd48b2f35dedc55b4bb | """GI on fast."""
import logging
from mpf.core.utility_functions import Util
from mpf.platforms.interfaces.gi_platform_interface import GIPlatformInterface
class FASTGIString(GIPlatformInterface):
"""A FAST GI string in a WPC machine."""
def __init__(self, number, sender):
"""Initialise GI string.
... |
2,178 | 93ec15a37bd5f022e8f6e226e3bf0e91cc0457c6 | # Definition for a Node.
class Node:
def __init__(self, val, children):
self.val = val
self.children = children
class Solution(object):
def postorder(self, root):
"""
:type root: Node
:rtype: List[int]
"""
if not root:
return([])
if no... |
2,179 | d4683d055ca70f31b050f0d84cb93c030feb4593 | import twitter
def twitter_authenticate():
return;
def identify_dupes():
return;
def remove_dupes():
return;
def get_tweets():
return;
|
2,180 | 445bb8ad8dadd207a3546f4623de583fc47a2910 | # Exercício Python 20: O mesmo professor do desafio 19 quer sortear a ordem de apresentação de trabalhos dos alunos. Faça um programa que leia o nome dos quatro alunos e mostre a ordem sorteada.
import random
aluno1 = input('Primeiro aluno: ')
aluno2 = input('Segundo aluno: ')
aluno3 = input('Terceiro aluno: ')
... |
2,181 | 74be250df785590ecf45e048b0d6189e2b445889 | print("HELLO3")
|
2,182 | 351963bee76ecaa9fa5c8d659f6d7c6ca9b22531 | from django.urls import path
from django.conf.urls.i18n import urlpatterns
from . import views
urlpatterns = [
path('signup/', views.signup, name='signup'),
path('home', views.home, name='home'),
path('collab/', views.collab, name='collab'),
] |
2,183 | a05c94ae0ee41cfef5687f741e07a54ae793e40d | import os
import numpy as np
import pandas as pd
import random
import platform
import subprocess
import shlex
import teradata
from joblib import dump
import shutil
from tqdm import tqdm
def get_session(db, usr, pwd):
"""Функция устанавливает соединение с ТД и возвращает сессию"""
if platform.... |
2,184 | 30b07e57737ac29643769c4773591199b2ba8656 | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 9 18:52:17 2021
@author: lewis
"""
import csv
import pandas as pd
import re
import statistics
import matplotlib.pyplot as plt
import numpy as np
from bs4 import BeautifulSoup
from urllib.request import urlopen
#Creating a function that groups by, co... |
2,185 | fb64003c1acbddcbe952a17edcbf293a54ef28ae | """
This module is an intermediate layer between flopy version 3.2
and the inowas-modflow-configuration format.
Author: Ralf Junghanns
EMail: ralf.junghanns@gmail.com
"""
from .BasAdapter import BasAdapter
from .ChdAdapter import ChdAdapter
from .DisAdapter import DisAdapter
from .GhbAdapter import GhbAdapter
from .L... |
2,186 | 4cc138016cb1f82e12c76c185be19188d3e38bf9 | # Generated by Django 3.0.5 on 2020-04-25 12:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0006_order_date'),
]
operations = [
migrations.RemoveField(
model_name='order',
name='product',
),
... |
2,187 | 77b7a0ae115aa063512ea7d6e91811470a4cf9d0 |
str = 'Hello world'
print ("字符串长度 : %d" %(len(str)))
print("字符串的长度 444:",len(str))
print (str)
print (str[0])
print (str[1:5])
print (str[:len(str)])
print (str[1:]*3)
print (str[1:]*5)
print ('字符串拼接')
print ("Hello" + "world")
#print ("python : str.join Test")
str1 = "-"
print (str1.join(str))
list = [1,2,3... |
2,188 | cdb07241e08f8ac85a427c5b2bc3effca3917c85 | # -*- coding: utf-8 -*-
"""
Project Euler - Problem XX
...
"""
# Imports
import time
# Global variables
# Lamda functions
# Functions
# Main functions
def main():
print('Output')
# Execute code
start = time.time()
if __name__ == "__main__":
main()
end = time.time()
print('Run time: {}'.format(end - start... |
2,189 | b1b478965ad939a98478b19b4a94f3250167e25a | from glob import glob
from PIL import Image
import numpy as np
from tqdm import tqdm
import cv2
import os
import matplotlib.pyplot as plt
np.set_printoptions(precision=3, suppress=True)
def get_index(path):
"""
get the length of index for voc2012 dataset.
path: the index of train,val or test path
"""... |
2,190 | 11a31d3276201105ca7485fa4e4eb711012accd5 | import pandas as pd
from pandas import DataFrame
myencoding = 'utf-8'
chikenList = ['pelicana', 'nene', 'cheogajip', 'goobne']
# chikenList = ['pelicana']
newframe = DataFrame()
for onestore in chikenList:
filename = onestore + '.csv'
myframe = pd.read_csv(filename, index_col=0, encoding=myencoding)
# pr... |
2,191 | 78037d936ee5f9b31bf00263885fbec225a4f8f2 | n = int(input())
if n % 10 == 1 and (n < 11 or n > 20):
print(n, "korova")
elif n % 10 > 1 and n % 10 < 5 and (n < 11 or n > 20):
print(n, "korovy")
else:
print(n, "korov")
|
2,192 | a0cce8d48f929dd63ba809a1e9bf02b172e8bc1b | from barista.sensor import CarafeLevel, CarafeTemp
class Carafe(object):
def __init__(self):
self.level = CarafeLevel()
self.temp = CarafeTemp()
# TODO add callback for when the temperature or level are too low. |
2,193 | f0444676d28be27ad2f0f7cdaa58a96b7facc546 | # -*- coding: utf-8 -*-
from optparse import make_option
from django.core.management.base import BaseCommand, LabelCommand, CommandError
from open_coesione import utils
import sys
import logging
import csv
import os
class Command(LabelCommand):
"""
Task to extract data related to a sample of all projects.
... |
2,194 | b218f5e401510f844006cb6079737b54aa86827b | """
stanCode Breakout Project
Adapted from Eric Roberts's Breakout by
Sonja Johnson-Yu, Kylie Jue, Nick Bowman,
and Jerry Liao
YOUR DESCRIPTION HERE
"""
from campy.gui.events.timer import pause
from breakoutgraphics import BreakoutGraphics
FRAME_RATE = 1000 / 120 # 120 frames per second.
NUM_LIVES = 3
def main():
... |
2,195 | 53c874fbe14031c323f83db58f17990f4e60bc58 | from outils import Outils
class BilanComptes(object):
"""
Classe pour la création du bilan des comptes
"""
@staticmethod
def bilan(dossier_destination, subedition, subgeneraux, lignes):
"""
création du bilan
:param dossier_destination: Une instance de la classe dossier.Dos... |
2,196 | 9e3f4484542c2629d636fcb4166584ba52bebe21 | # -*- coding: utf-8 -*-
from LibTools.filesystem import Carpeta
from slaves import SentinelSat
import settings
if __name__ == '__main__':
carpeta = Carpeta(settings.folder_sat)
sentinela = SentinelSat(carpeta)
sentinela.start_Monitoring()
|
2,197 | 1d0730e8fd120e1c4bc5b89cbd766234e1fa3bca | import pandas as pd
import numpy as np
import os
import matplotlib.pyplot as plt
from datetime import datetime
import statsmodels.api as sm
from quant.stock.stock import Stock
from quant.stock.date import Date
from quant.utility_fun.factor_preprocess import FactorPreProcess
from quant.utility_fun.write_excel import Wri... |
2,198 | 3c88e13e8796c5f39180a9a514f0528a074460a6 | from collections import OrderedDict
class LRU_Cache(object):
def __init__(self, capacity):
# Initialize class variables
self.size = capacity
self.jar = OrderedDict()
pass
def get(self, key):
# Retrieve item from provided key. Return -1 if nonexistent.
if key not ... |
2,199 | e12c397ca1ae91ce314cda5fe2cd8e0ec4cfa861 | from django.db import models
from private_storage.fields import PrivateFileField
class PrivateFile(models.Model):
title = models.CharField("Title", max_length=200)
file = PrivateFileField("File")
class PrivateFile2(models.Model):
title = models.CharField("Title", max_length=200)
file = models.FileFi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.