index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
984,700 | 080ebe5bc2786436664018612e3064856dd65b4e | #
# Imports
#
from wolfulus import *
from ..util.player import *
from ..util.chat import *
from ..util.timer import *
import random
#
# Command
#
class MataMataCommand(Command):
# Constantes... nao mexer
UP = 1
DOWN = 2
# Constructor
def __init__(self):
self.register('/chamar', self.command_chamar)
self.reg... |
984,701 | 2ee486df42029d9fcf824f02fb6b31fc1d02a49a | from setuptools import setup, find_packages
from pip.req import parse_requirements
import os
# hack for working with pandocs
import codecs
try:
codecs.lookup('mbcs')
except LookupError:
utf8 = codecs.lookup('utf-8')
func = lambda name, enc=utf8: {True: enc}.get(name=='mbcs')
codecs.register(func)
# in... |
984,702 | 6855a0376a00531e0099e67229773569e1845d5d | from django.template import add_to_builtins
add_to_builtins('globaltags.get_menu')
|
984,703 | a2003aa6d39cb3f43b92f434408afe4eabe365f0 | inp = input()
tmp = inp[2:len(inp) - 2]
nums = tmp.split('],[')
n = len(nums)
lst = []
moves = []
for num in nums:
lst.append(int(num[0]))
lst.append(int(num[2]))
moves.append(lst)
A = [0] * 8
B = [0] * 8
l = len(moves)
for n in range(l):
if n % 2:
B[moves[n][0]] += 1
B[moves[n][1] + 3]... |
984,704 | 615463f98aca6b9cbe0b821dc1b3e2322fb30c87 |
# 回调函数 (扩展)
# 函数定义
def f1(n, fn): # fn = callback
print("n =", n)
a = n*n
fn(a) # callback() 回调
# 函数调用,
# 回调函数
def callback(a):
print("callback, a =", a)
# 正向调用
f1(2, callback)
# 进程:正在运行的软件
# 线程:进程中的多个分支
# 同步:在同一个线程中执行
# 异步:在不同的线程中执行
|
984,705 | 7bcd31e3d0f549975eeddffafb413c54126bff85 | # import csv
import numpy as np
from sklearn import mixture
import scipy
from scipy.stats import multivariate_normal
from sklearn import metrics
from copy import deepcopy
f = open('rank.txt', 'r')
b=f.read()
a=eval(b)
# b=b.split('\n')
# a=[]
# for x in b:
# a.append(eval(x))
# print (a)
# b=[]
# for x in a:
# y=x
# ... |
984,706 | 7927ca404d5ac505b49b975d44e6aa2ac0f69628 | #!/usr/bin/env python
import requests
import datetime
from BeautifulSoup import BeautifulSoup
import urlparse
from termcolor import colored
def request(url):
try:
return requests.get("http://"+url)
except requests.exceptions.ConnectionError:
pass
target_url = "adityatekkali.edu.in... |
984,707 | 0e73297ad988b8dbb3b15f5a78759c4975a2f351 | try:
import pip
except:
import roman
else:
try:
import roman
except:
pip.main(["install","roman"])
import sys
size = 30000
cells = [0]*size
pointer = 0
try:
with open(sys.argv[1]) as file:
nScript = [line.strip(" ") for line in file]
except:
get = input("Code: ")
nScript = get.split()
#p... |
984,708 | 8b2b4e314a2f7e0bf2addafdf2880f2832b091dc | from mcpi.minecraft import Minecraft as mcs
mc = mcs.create()
|
984,709 | 124e654889603a1b3b2dc88340c1b55477e4d8b0 | # Assignment 3
# 010123102 Computer Programming Fundamental
#
# Assignment 3.3
# Given a number n, return True if n is in the range 1..10, inclusive.
# Unless "outsideMode" is True, in which case return True if the number is less or equal to 1, or greater or equal to 10.
#
# Phattharanat Khunakornophat
# ID 59010126100... |
984,710 | 36b2281d07c4dbddaa6e204b8c003d29c01ebfe4 | import hashlib
import time
import uuid
import requests
url = 'https://openapi.youdao.com/api'
APP_ID = '45a132825a61cef4'
APP_KEY = 'coTBoQjo3vi6tHwpDs1JDlMpslml98z2'
def get(form, to, word):
data = {}
data['from'] = form
data['to'] = to
data['signType'] = 'v3'
curtime = str(int(ti... |
984,711 | e518bca0e64666aa16bb1abb1c11e3f96f983dcf | from .models import Faturamento
from rest_framework import serializers
class FaturamentoSerializer(serializers.ModelSerializer):
class Meta:
model = Faturamento
fields = '__all__' |
984,712 | 078b8019936c332a5dcda95543de7a56bd7aa58e | import urllib2
from xml.etree.ElementTree import XML, SubElement, tostring
url = 'https://polokelo-bookings.appspot.com/externalbookings'
# get a new collection number
xml = """
<testgenerator>
<action>generate collection number</action>
</testgenerator>
"""
req = urllib2.Request(url, xml, headers={'Content-Type... |
984,713 | 8a777e5145c63ca5f1f314cd60e4ca482ee5c474 | from. createAnimals import WalkingAnimal, Snake, SwimmingAnimal, Llama |
984,714 | 39d23e82d798b368977ff2300b6c580b8590e0d4 | '''
给定一个三角形,找出自顶向下的最小路径和。每一步只能移动到下一行中相邻的结点上。
例如,给定三角形:
[
[2],
[3,4],
[6,5,7],
[4,1,8,3]
]
自顶向下的最小路径和为 11(即,2 + 3 + 5 + 1 = 11)。
说明:
如果你可以只使用 O(n) 的额外空间(n 为三角形的总行数)来解决这个问题,那么你的算法会很加分。
'''
# class Solution(object):
# def minimumTotal(self, triangle):
# """
# :type triangle: List[Li... |
984,715 | aeb966e0ac9dfca2024bfd305754ffceaf4bf21b | import numpy as np
import os
import cv2
import pandas as pd
from torch.utils.data import Dataset
from tqdm import tqdm
import SimpleITK
import scipy.ndimage as ndimage
import SimpleITK as sitk
UPPER_BOUND = 400
LOWER_BOUND = -1000
def load_ct_images(path):
image = SimpleITK.ReadImage(path)
spacing = image.G... |
984,716 | 726503040deb67c2b3e5652d26441b3c01dd26d2 | import json
import subprocess
from flask import Flask
def _exec(cmd):
process = subprocess.Popen(cmd.split(' '), stdout=subprocess.PIPE)
return process.communicate()[0]
app = Flask(__name__)
@app.route("/")
def hello():
running_containers = _exec('docker ps -aq').split('\n')
inspect = json.loads(_exec('docker in... |
984,717 | 4c4e26d24401ee371810cdd7f666d144a0f9704b | # -*- coding: utf-8 -*-
import logging
import os
import gettext
from ask_sdk_core.dispatch_components import AbstractRequestInterceptor, \
AbstractResponseInterceptor
from ask_sdk_core.handler_input import HandlerInput
from ask_sdk_model import Response
from ask_sdk_core.skill_builder import SkillBuilder
from ask_s... |
984,718 | f09150e569941bd8bebe45b3941f6badb3d1fc6e | import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.compose import ColumnTransformer
from sklearn.pipeline import Pipeline
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import OneHotEncoder
from sklearn.preprocessing import StandardScaler
from xgboost import XGBC... |
984,719 | c8c2a66700f78d63d579d6176c1d4e9a09c14dae | n=int(input())
a = [0]*(n+1)
a[0] = [0, 0, 0]
for i in range(n):
a[i+1]=list(map(int,input().split()))
flag = True
for i in range(n):
if abs(a[i+1][1]-a[i][1])+abs(a[i+1][2]-a[i][2]) > (a[i+1][0]-a[i][0]):
flag=False
elif (abs(a[i+1][1]-a[i][1])+abs(a[i+1][2]-a[i][2])-(a[i+1][0]-a[i][0]))%2==1:
... |
984,720 | 3363cde533b04af460ad80303f104163a18fc974 | import requests
import uuid
import getpass
import hashlib
import base64
from globals import *
# Logs in using a username and password
# The password is appended with a salt retrieved from the server and hashed
def login():
global userToken
global loggedIn
global baseURL
username = raw_input("Enter your username > "... |
984,721 | be1af26f932a6251da984de2f31f7ca9c1196af9 | import nose
from nose.plugins.attrib import attr
# nose decors and attr
def copy_attrs(source, to):
for attr in dir(source):
if attr.startswith('_'):
continue
if attr.startswith('func_'):
continue
to.__setattr__(attr, getattr(source, attr))
def one(func):
def created_in_one():
pr... |
984,722 | 64cc5ce01544d6e1df80eb56287498cd348a542a | '''
implements packing problem approximation how for a set of rectangles choose the rect which will best cover them.
'''
from utils import transpose, findfirst
from rect import Rect
class AlgorithmError(RuntimeError): pass
class PackingAlgorithm:
'''
base class for algorithms
finding a rects arrangeme... |
984,723 | 0395d5bb03f8fb431375ca7eb282eb33b042acb0 | '''
8) Um valor inteiro positivo n é chamado de quadrado perfeito se existir
uma sequência de ímpares consecutivos a partir do valor 1 cuja soma seja
exatamente igual a n.
Exemplo: para o valor 16 temos 16 = 1 + 3 + 5 + 7.
Assim sendo, 16 é um quadrado perfeito.
Logo, um quadrado perfeito tem a seguinte propriedade: ... |
984,724 | 1ec1b75609817b7a3d52c68ae5cc0b029c76204e | from collections import defaultdict
from collections import deque
from heapq import *
def ImportGraph(graph):
# Import a graph from a adjacency list
v = open(graph,'r')
Graph = defaultdict(list)
# distance = []
for line in v.readlines():
VerDis = []
d = deque(x for x in line.sp... |
984,725 | 868d022c03ac8df07b29d0a4eec215218844c7ed | # MIT License
# Copyright (c) 2018-2020 Dr. Jan-Philip Gehrcke
# 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, including without limitation the rights
# to use, copy, m... |
984,726 | 9f1529aa0a3c40b22a575a70552e1c616256a6cc | from flask import Flask
from flask import render_template
from flask import url_for
from flask import request
from flask_bootstrap import Bootstrap
import sqlite3 as sql
app = Flask(__name__)
Bootstrap(app)
@app.route('/')
def hello_world():
return "Hello World"
@app.route("/index/")
def index_page():
ret... |
984,727 | e6874a5d09ffc8f714108a3bf7a33faf0ca95155 | /home/cliffordten/anaconda3/lib/python3.7/bisect.py |
984,728 | 629c76a7195ea83fd17d84831777226732f3ea54 |
# -*- coding: utf-8 -*-
# @Date : 2018-10-13 10:45:50
# @Author : raj lath (oorja.halt@gmail.com)
# @Link : link
# @Version : 1.0.0
from sys import stdin
max_val=int(10e12)
min_val=int(-10e12)
def read_int() : return int(stdin.readline())
def read_ints() : return [int(x) for x in stdin.readline().spli... |
984,729 | 7e21701461435459326e47199bf7f9bbc19bd406 | # 325. 和等于 k 的最长子数组长度
# https://leetcode-cn.com/problems/maximum-size-subarray-sum-equals-k/
class Solution(object):
def maxSubArrayLen(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
if not nums:
return 0
tmpSum = {0:0}
... |
984,730 | 4d62685b10422a4835e01b32ede9e069b22dcb95 | /home/Ritik-Gupta/anaconda3/lib/python3.7/os.py |
984,731 | e339418ede6f09a031b5ccb0b2ba96d6381c8400 | from pwn import *
import re
from base64 import b64decode
context.log_level = 'error' # Disable non error related messages
host, port = 'tasks.aeroctf.com', '44323'
def oracle(salt=''):
while True:
try:
r = remote(host, port)
r.recv(4096)
r.sendline('3')
r.re... |
984,732 | bb7e88bb311d6aac13f27c7709311bf237a8f024 | '''
376. Wiggle Subsequence
A sequence of numbers is called a wiggle sequence if the differences
between successive numbers strictly alternate between positive and
negative. The first difference (if one exists) may be either positive
or negative. A sequence with fewer than two elements is trivially a
wiggle sequen... |
984,733 | 3fa94e83881b5b6f7898815fd8490abaf76a5cc8 | # a program to divide excel sheets columns in seperate excel sheets.
import openpyxl
sal_workbook = openpyxl.Workbook()
salary_head_list = ['PR_AIDA','PR_IBASIC','PR_IBONUS','PR_ITS','PR_IDA','DAY_AMT','DAY_OFF','PR_IDIRTY','EL_AMT','PR_EL','PR_DELEC','PR_DEPF','PR_IHRA','HRS_AMT','PR_DIT','PR_DLWPVAL','PR_LWB','PR_DM... |
984,734 | 9b10015004590e367767ca7f6ed8b1a4ca78fbb8 | import pandas as pd
import os
import sys
import random
from mq.celery import app
from .models import Employee, AsyncResults
from django.http import HttpResponse
from django.conf import settings
@app.task(bind=True)
def createCSV(self, amount):
columns = ['id', 'gender', 'education_level', 'relationship_status', 'g... |
984,735 | 7bf3170866a846c96ec45efa575e4a7ee53b4503 | from django.conf.urls import patterns, include, url
from django.contrib import admin
from .settings import DEBUG, MEDIA_ROOT, STATIC_ROOT
admin.autodiscover()
urlpatterns = patterns('',
# drive app
url(r'^', include('drive.urls')),
# auth-related URLs
url(r'^login/$', 'django.contrib.auth.views.login... |
984,736 | c4ea0e506051c8635eb107c5bdbb58f22be91588 | from django import forms
from customer.models import Contact, Exchange
class ContactForm(forms.ModelForm):
class Meta:
model = Contact
fields = '__all__'
class ExchangeForm(forms.ModelForm):
class Meta:
model = Exchange
fields = '__all__'
|
984,737 | 8bdb856694537ca832a11c552975de6cc6883e25 | from django.views.generic import ListView
from .models import Course
class ListCourse(ListView):
model = Course
template_name = 'index.html'
context_object_name = 'courses'
|
984,738 | fce885fefec190a1a2fe44aeb4879845cf6f80da | from django import forms
from django.contrib.auth.models import User
from django.core.validators import validate_email, RegexValidator
from models import *
from django.forms import FileInput, TextInput, Textarea
MAX_UPLOAD_SIZE = 2500000
class EditForm(forms.ModelForm):
class Meta:
model = UserProfile
... |
984,739 | 7a5780c6b994f53baa31113ada4f86a7f85dc4a3 | class Solution:
def sol(self, mat, first):
mat, move = [i.copy() for i in mat], 0
for j in range(len(mat)):
for i in range(len(mat[0])):
if (j and mat[j - 1][i]) or (not j and 1 << i & first):
move += 1
if j > 0:
... |
984,740 | 3fe1c87f3134db2ee0d5bd2f073e6bec34d4e8ae | from application.extensions.admin.views.base import BaseView
from application.extensions.admin.views.index import AdminIndexView
from application.extensions.admin.views.user import UserView
|
984,741 | f7f67df80189c4ca13025541501baaef9233959b | #!/usr/bin/env python
#coding=utf-8
"""
pipline input
"""
#from __future__ import absolute_import
#from __future__ import division
#from __future__ import print_function
#import argparse
import shutil
#import sys
import os
import json
import glob
from datetime import date, timedelta
from time import time
import rando... |
984,742 | b44310f43ccae1be9896e7509d88aba3508b9e6e | from . import auth
from webapp import db, bcrypt
from flask_login import login_user, logout_user, current_user, login_required
from ..models import User, Post
from flask import render_template, url_for, flash, redirect
from .forms import blog_form, registrationForm, loginForm
@auth.route('/signup', methods=['POST', 'G... |
984,743 | 1b844f6e02166119f3c5cfb490ef5d26299e1373 | import cv2
import matplotlib.pyplot as plt
order =22
img = cv2.imread('C:\\Users\\39796\Desktop\Ambient Occlosion Paper\Experiment\\%s-nnao.png' % order)
img_median = cv2.medianBlur(img, 3)
# cv2.imwrite('C:\\Users\\39796\Desktop\Ambient Occlosion Paper\Experiment\\%s-nnao_blur.png' %order, img_median)
# img_mean ... |
984,744 | a29be1112ca807540277046c1a9dda6aad3aed11 | import engine
import history
import ds18b20
import config
import json
import utils
from flask import Flask, request
from flask.ext.restful import Resource, Api
from flask import render_template
__author__ = 'Tom'
app = Flask(__name__)
api = Api(app)
@app.route('/')
def index():
CONFIG = config.load()
return... |
984,745 | d5ea315775614bf6872b0ceaa27b3fa6a6695733 | import random
import numpy as np
from args import *
class Q_Agent():
def reset(self):
self.Q = np.zeros((4, 2))
def get_action(self, s):
if random.random() < eps:
return random.randint(0, 1)
else:
return np.argmax(self.Q[tuple([s])])
def update_Q(self, s, ... |
984,746 | d34096397277153406164c54d52f290260cb1bf0 | print("code for Assignment 1 :")
disp= dict()
for i in range(0,3):
name=input("Enter Name :")
usn= input("Enter Usn :")
disp[usn]=name
print(disp)
#for key,value in disp.items():
#print(key,':',value)
|
984,747 | f5cc6d43057bf4be41fa82b040ea6f70a359b05a | first_x14=[[5.733508782899592e-07, -9.792499896753948e-13, -9.978517529264487e-14, 2.110890707154146e-12, -7.144083544313336e-11, -8.836524221634837e-16, 4.414569062938014e-17, 9.509915939077591e-06, -1.8710838555912812e-07, -2.5905015053998637e-09, 5.6124679052430716e-11, 1325127513898.5303, 3285474337242.722], [6.759... |
984,748 | 90b717056df8cb9daa4164d3dd0cbde4cbbbb4d5 | employees_happiness = list(map(int, input().split()))
factor = int(input())
factored_happiness = list(map(lambda n: n * factor, employees_happiness))
average_happiness = sum(factored_happiness) / len(factored_happiness)
filtered_employees = list(filter(lambda n: n >= average_happiness, factored_happiness))
h... |
984,749 | e5140cc2bb8893a30329cec80550765bc78cbc9e | from Utilities.util import Util
from Utilities.filegenerator.CAMT053InputData import CAMT053InputData
from Utilities.filegenerator.CAMT053Tags import CAMT053Tags
from datetime import date
from datetime import datetime
from xml.etree.ElementTree import ElementTree
from xml.etree.ElementTree import Element
import xml.etr... |
984,750 | 20b4b86b56ece6759de5b482b41597db7e183e8e | import requests
from bs4 import BeautifulSoup as soup
import requests
from log import log as log
import time
from datetime import datetime
import random
import sqlite3
from bs4 import BeautifulSoup as soup
from discord_hooks import Webhook
from threading import Thread
from datetime import datetime
from datetime import ... |
984,751 | 983d6a10b5cb73d6ae3ca4bedd4c98dc888ebf33 | def start():
"""Start the task"""
pass
def pause():
"""Pause the task"""
pass
def finish():
"""Finish the task"""
pass
def status():
"""Status of the task"""
pass
def abort():
"""Abort the task"""
pass
def remove():
"""Remove the task"""
pass
|
984,752 | 2cbb4a21b86f06a490ae1a39a542983874ee09dd | # 元祖就是"一个不可变的列表" type
# 1、作用:按照索引/位置存放多个值,只用于读不用于改
# 2、
t = (10) # 单独一个括号代表包含的意思
print(type(t))
t = (10,) #如果元祖只有一个元素,必须加逗号
print(type(t))
# 元祖里面的元素如果是列表,则列表内的值可更改,列表不可更改
# 3、类型转换:但凡能够被for循环遍历的类型都可以当作参数传给list()转换成列表
res = tuple({'k1': 111, 'k2': 222, 'k3':333})
print(res)
aa = tuple('hello')
print(aa[1])
# 内置方法
# 4.1... |
984,753 | da14b42ab333a9971963268b5e8c579c88541f04 | class StringCursor:
def __init__(self, string):
self.string = string
self.cursor = 0
def end(self):
return self.cursor == len(self.string)
def read(self):
return self.string[self.cursor:]
def read_one(self):
return self.string[self.cursor]
def increment(se... |
984,754 | 3fcea78258217134e08780e604b35544626b4d97 | print(hi!11)
|
984,755 | 68da5643e77b356814fd833de7d420fcd83257ba | # -*- coding: utf-8 -*-
# -*- python 3 -*-
# -*- hongzhong Lu -*-
import os
os.chdir('/Users/luho/PycharmProjects/model/model_correction/code')
exec(open("./find_subsystem_Yeast8_using_code.py").read())
#it can be found that the reaction in different software is different in some formats
#thus the reaction list will be... |
984,756 | 3a724b31b6af979167139e393478e58315a945af | #Henry Nolan-Clutterbuck
#23/09/14
#Spot check 1
width = int(input("Please enter the width of the pool:"))
depth = int(input("Please enter the depth of the pool:"))
length = int(input("Please enter the length of the pool:"))
recvolume = (length*width*depth)
circleradius= width/2
circlearea=(3.14*(circlera... |
984,757 | fff039c169c2b38236a9f7c891ecadd127d4422a | import unittest
from tests.question_test import QuestionTest
from tests.topic_test import TopicTest
from tests.user_topic_test import UserTopicTest
from tests.quiz_test import QuizTest
from tests.difficulty_test import DifficultyTest
if __name__ == "__main__":
unittest.main()
|
984,758 | e900fc4d87f7e89f7407da811d654c16bbc14676 | import math
from time import sleep
def obj(params):
x = params['x']
sleep(3)
return math.sin(x) |
984,759 | 7f601310d4ea025ec9c0671c30e9283994db6717 | from django.shortcuts import render
from django.views import generic
import os
from datetime import datetime
from subway.models import MapPrep
# View render requests
def index(request):
"""View function for main page of site"""
mp = MapPrep()
currentYear = datetime.now().year
context = {
'cu... |
984,760 | 5070b0d7bd45adb0626249fb41421eaaa6af55ea | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
import cv2
from scipy.misc import imread
import time
import os, random
import warnings
slim = tf.contrib.slim #For depthwise separable strided atr... |
984,761 | eb3eba8f1b82f4f9776df7ad4d89ce0acd48f373 | from bs4 import BeautifulSoup
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
botFiles = []
midFiles = []
topFiles = []
botSoups = []
midSoups = []
topSoups = []
somasBot = []
somasMid = []
somasTop = []
somasAcostamento = []
#[cima: [valor0, ..., valor 5]]
#index = [vehAcostamento1, vehAcost... |
984,762 | 8cc0f616a49ee9a2a53d9cc566eb9f014e041b6e | '''
Day: 17
File: conway_cubes.py
Author: Rishabh Ranjan
Last Modified: 12/17/2020
'''
import copy
class Cube:
neighbors = {}
def __init__(self, coordinates, active):
self.coordinates = coordinates
self.active = active
def populate_neighbors(self, cubes, expa... |
984,763 | f0b1db42d29a3975774297975b3ca1bc87f69ba3 | from django.db import models
from django.contrib.auth.models import User
from datetime import time, datetime
from django.core.exceptions import ValidationError
from django.db.models.signals import post_save
def timediff(t1,t2):
diff = (t1.hour-t2.hour)*60+t1.minute-t2.minute
if (diff<0):
diff += 24*60
... |
984,764 | 718c0252fba23a82c001f309a5af01654c6fca42 | from flask import Flask, render_template, request, redirect
from datetime import datetime
app = Flask(__name__)
@app.route('/')
def index():
return render_template("index.html")
@app.route('/checkout', methods=['POST'])
def checkout():
print(request.form)
def suffix(day):
if 4... |
984,765 | 1358de69aaa209fb62d0cdef313bf6a6aeb244eb | import torch
import numpy as np
import cv2
import network
GENERATOR_WEIGHTS = './model/generator-1000.pt'
IMG_FILEPATH = './street.jpg'
RESULT_FILEPATH = './result.png'
RGB_MEAN = np.array([0.4560, 0.4472, 0.4155])
generator = network.Generator()
generator.load_state_dict(torch.load(GENERATOR_WEIGHTS))
generator.cuda... |
984,766 | 7bfa2950cdca99a077d51ecd12dc8d25af092e49 | print('hey git') |
984,767 | 999e0ad22b70c46ca29125a7d0e5071a3de6c519 | import os
if __name__ == '__main__':
from PyInstaller.__main__ import run
opts=['webApi2doc.py','-D']
run(opts)
|
984,768 | 0d75fade2f1d623f5e0b737fd4b5b5ceb13472af | import django
import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'pincodesearch.settings'
django.setup()
from searchapp.models import PincodeRecord
file1 = open('pincode.csv')
lines = set(file1.readlines())
file1.close()
dbdata = set()
dbvals = PincodeRecord.objects.all().values()
for val in dbvals:
d... |
984,769 | f824f2f42746b43fd31af87a3b5f3d892ec42248 | #work without numpy, bc we cannot download numpy
import time
import busio
import board
import adafruit_amg88xx
import pickle
i2c = busio.I2C(board.SCL, board.SDA)
amg = adafruit_amg88xx.AMG88XX(i2c)
#shared = {"arr":amg.pixels}
#fp = open("shared.pkl", 'wb') #pickle to share amg.pixels array
#f = ope... |
984,770 | b6b9ff5896b60889f35cbccf91635b65c6bfb7a4 | custDB = [["0796299991","yang",0,1234]]
def output(sender_id,reciver_id,amountsent,transation,db):
global custDB
custDB = db
sender(amountsent,reciver_id,transation)
reciver(amountsent,sender_id,transation)
def sender(amount,reciver_name,transation):
print(custDB[reciver_name][1],"has recived",amou... |
984,771 | a707284f893f91491f312ef471ef93878d3919f7 | """
Methods and object to generate alignments between datasets
"""
from fcm.alignment.align_data import DiagonalAlignData, CompAlignData, FullAlignData
from fcm.alignment.cluster_alignment import AlignMixture
__all__ = ['DiagonalAlignData',
'CompAlignData',
'FullAlignData',
'AlignMixt... |
984,772 | 32ccd2c3647e9adda01d9fd03bb758a211b3e8b2 | '''
equation module
'''
from __future__ import print_function, division, unicode_literals
import re
import six
import argparse
import sys
import os
from sympy import sympify, simplify
from collections import Counter
DESCRIPTION = '''
canonicalize equations
Transform equation into canonical form.
An equation can be... |
984,773 | 9bf81ec9c9012f26f76b817ad008edcf5d91174e | # """
# This is BinaryMatrix's API interface.
# You should not implement it, or speculate about its implementation
# """
#class BinaryMatrix(object):
# def get(self, row: int, col: int) -> int:
# def dimensions(self) -> list[]:
class Solution:
def leftMostColumnWithOne(self, binaryMatrix: 'BinaryMatrix') -> ... |
984,774 | ad84044f97f0ed27b02b9c123de79f1b8563209a | # -*- coding: utf-8 -*-
def main():
import sys
input = sys.stdin.readline
n, k = map(int, input().split())
mod = 998244353
left = [0 for _ in range(k)]
right = [0 for _ in range(k)]
dp = [0 for _ in range(n + 10)]
dp[1] = 1
imos = [0 for _ in range(n + 10)]
for i in range(k)... |
984,775 | f4f256e8a69283fb567df0fd6abe9c411ded396b | from .elf_int_8_bitmask import ElfInt8BitMask
from .elf_int_16_bitmask import ElfInt16BitMask
from .elf_int_32_bitmask import ElfInt32BitMask
from .elf_int_64_bitmask import ElfInt64BitMask
from .elf_int_n_bitmask import ElfIntNBitMask |
984,776 | 5a2583d08d1262cd9097dacf2582b7d92d8a616e | from src import app, mongo
from flask import render_template, jsonify, json, request
from flask_restplus import Resource, fields
from bson import json_util, errors
from bson.objectid import ObjectId
from .user import namespace
post_fields = namespace.model("Post", {"title": fields.String, "content": fields.String })
... |
984,777 | f74e1eb645de6b8cb596875bbda3f6c3cbec9766 | # Generated by Django 3.1.4 on 2021-05-01 17:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('submissions', '0011_submission_status'),
]
operations = [
migrations.SeparateDatabaseAndState(
database_operations=[
... |
984,778 | 87517b13da7cf809b6c204c1a5b4ac7a56816ccd | import pylab
import random
def showDiscreteUniform(a,b,numPoints):
points = []
for m in range(numPoints):
points.append(random.randint(a,b))
pylab.figure()
pylab.hist(points,100,normed=True)
pylab.title('Discrete Uniform distribution with ' +str(numPoints) +" points")
pylab.sh... |
984,779 | 0ac0ba7019cdf8dfea4b4c571df6ba3005fe4f29 | """
Run additional tasks around dataset anonymization.
A framework for running additional tasks using the datasets that will be
anonymized. Like Unix commands, a pipeline consists of a list of Filters.
A Filter is a single part of the pipeline that has an opportunity to act
1. before any datasets are anonymize... |
984,780 | 6a0d5a957e47dc7cfaf12c365a3e39b3285138c8 | """
This module contains some utility functions for the SetAPI.
"""
import os
import re
from installed_clients.DataFileUtilClient import DataFileUtil
def check_reference(ref):
"""
Returns True if ref looks like an actual object reference: xx/yy/zz or xx/yy
Returns False otherwise.
"""
obj_ref_reg... |
984,781 | bcb9987bae2ef20f825da03711dee64927985015 | import re
wiki = open("Indonesia.txt", "r")
teks = wiki.read()
wiki.close()
print(re.findall(r'me\w+', teks.lower()))
|
984,782 | cdc662d244e082473a6d898d9463efb2b2368075 | # cravings
from setting import *
from food import *
if __name__ == '__main__':
# run with "python3 cravings.py"
print('-'*80)
set = setting()
ingr,exclude = find_food(set)
recipe = recipe(ingr, exclude)
describe(set, recipe)
# print(recipe.get_label()) |
984,783 | c30953900abc6e490e8d23f2f099fa81f9260e48 | # -*- coding: utf-8 -*-
"""HW4Q2.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1sK_3UgHBi2zRe1ARdHn2wpy24xKljFhC
"""
!pip install syft
! pip install prettytable
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.o... |
984,784 | 71daa5c1c0825fcaab48eb6d7d9171664c893c79 | #!/usr/bin/env python
import commands
import sys
def gcd(a,b):
"""Compute the greatest common divisor of a and b"""
while b > 0:
a, b = b, a % b
return a
def lcm(a, b):
"""Compute the lowest common multiple of a and b"""
return a * b / gcd(a, b)
# Execute txt file
def faile_check(fail):
... |
984,785 | 9982450d70d9f4804421e937f923ca504cbaf115 | str = str(input("Enter string to be manipulated: "))
output = ''
i = 0
while i < len(str):
if i + 1 < len(str):
output = output + str[i + 1]
output = output + str[i]
i = i + 2
print('Given String: ' + str)
print('Swapped String: ' + output) |
984,786 | 12271b94a8e66e0f4f0aea8388604b6a74632daa | from flask import request, jsonify
from robot import application as app
from robot import motion_control
actions = {
'forward': motion_control.forward,
'stop': motion_control.stop,
'left': motion_control.left,
'right': motion_control.right,
'reverse': motion_control.reverse,
'forward_steer': ... |
984,787 | 2a6a1f1947a6e82ea6d2ffb20b60c4c9bb738d59 | import pygame
W = 25
Wpadded = W + 6
hor = 15
ver = 15
HEIGHT = hor * Wpadded
WIDTH = ver * Wpadded
finished = False
WHITE = (255, 255, 255)
GRAY = (51, 51, 51)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
def makeGrid(x, y):
grid = []
for row in range(y):
grid.append([])
for column in range(x):
... |
984,788 | 44d9f363fba172d9a7af07a21b19f229a561a2b7 | from django.test import TestCase,Client
from .models import Lamp_historique, Lamp
from datetime import datetime
class LampTest(TestCase):
def setUp(self):
lamp = Lamp.objects.create(name='LTY F', station='station1',coord_X_Y='POINT(-95.3385 29.7245)')
lamphistorique1 = Lamp_historique.objects.crea... |
984,789 | 005433db247850157bd0aa860e9b614758dd9756 | '''Write a Python program to get a string made of the first 2 and the last 2 chars from a given a string. If the string length is less than 2, return instead of the empty string.'''
#Print out program purpose
print("This program will ask you to enter a string and then will print out the first 2 characters and the la... |
984,790 | 6456c912cea1159b4a364af161c66a9573ae1236 | import urllib.request
import urllib.parse
import json
import pandas as pd
import requests
import io
import tqdm
from pathlib import Path
import os
import shutil
from hievpy.utils import *
# ----------------------------------------------------------------------------------------------------------------------
# Generic... |
984,791 | 3c861967cc443a9881c688bc26923d150f265d5c | # Generated by Django 3.1.2 on 2020-11-01 19:33
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
984,792 | a25c70b086e30d5453a6b2028947b60a2489d0ec | # -*- coding: utf-8 -*-
import os
import time
import speech
class Study:
def __init__(self):
while True:
print("请您选择,提示:请输入序号1或者2")
print("1. 学习30分钟")
print("2. 学习60分钟")
self.choice = input("您的决定: ")
print("")
if self.... |
984,793 | fd79ffb783b7f41d68c9c894e49c50a7cd6fa9b9 | '''Example script to generate text from Nietzsche's writings.
At least 20 epochs are required before the generated text
starts sounding coherent.
It is recommended to run this script on GPU, as recurrent
networks are quite computationally intensive.
If you try this script on new data, make sure your corpus
has at le... |
984,794 | cf48837b63b8858deb874c5ae27f37b9e0fdfd9c | import numpy as np
import pickle, os
import sklearn
from sklearn.linear_model import SGDRegressor
from sklearn.kernel_approximation import RBFSampler
import sklearn.pipeline
import virl
class RbfFunctionApproximator():
"""
Q(s,a) function approximator.
it uses a specific form for Q(s,a) where seperate f... |
984,795 | aefb65304169846f353a32edc7ac7f8548f9bae5 | #Python program to print Highest Common Factor (HCF) of two numbers
n1,n2 = 12,8 #4
n1,n2 = 9,21 #3
n1,n2 = 7,5 #1
n1=int(input('first num: '))
n2=int(input('second num: '))
if(n1>n2):
l,h=n1,n2
else:
l,h=n2,n1
gcd = 1
for i in range(1,h):
if(h%i==0 and l%i==0):
gcd=i
print("gcd is {}".f... |
984,796 | 0193c5bc8814e3738a19753d09b45545954a6d8d | import cvxpy as cp
import numpy as np
class System:
devices = {}
requests = []
resources = ['power_cost', 'comfort', 'security']
resource_weights = [-1, 5, 10]
time = 0
rounded_time = 0
target_temperature_present = 20
target_temperature_absent = 20
power_limited = Fals... |
984,797 | ef3184ea862e86c135515a367099b0d034ba99a9 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import smbus # use I2C
import math
from time import sleep # time module
### define #############################################################
DEV_ADDR = 0x68 # device address
PWR_MGMT_1 = 0x6b # Power Management 1
ACCEL_XOUT = 0x3b # Axel X-a... |
984,798 | eab51efc4c5c003d31d69c3b8a769b76cbe0abc7 | #coding=utf-8
import sys,pathlib # *.py /qgb /[gsqp]
gsqp=pathlib.Path(__file__).absolute().parent.parent.absolute().__str__()
if gsqp not in sys.path:sys.path.append(gsqp)#py3 works
from qgb import py
U,T,N,F=py.importUTNF()
import numpy # as np
#True False array。
def test():
a = (a < 255).astype... |
984,799 | 08ca229f3141a342a94e75013dc9efb42420848f | # Copyright 2022 The Google Earth Engine Community 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.