index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
985,300 | 645bbfecf4fc4a74f24a4c7d4629d4171e6d5556 | # Generated by Django 3.1.1 on 2021-04-11 07:03
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('attendancess', '0009_attendanceidmodel_classroom'),
]
operations = [
migrations.AlterField(
mod... |
985,301 | 1216f129d45f40551fe2669a44119d4b8dda3dd6 | # if a statement is true, execute everything after the if statement
# if false, move on to next elif until you get to "else",
# in which case execute that statement.
# if there is no "else" or "elif" simply do nothing.
num = 55
if num >= 60:
print('Its higher than 60')
elif num >= 50 and num < 60:
print('Its ... |
985,302 | 541a5adc595d2bb5420d5c0f370cf1bb986165b4 | # coding: utf-8
from rest_framework import exceptions, viewsets, status
from rest_framework.response import Response
from fci.index import models, serializers
class ResourceView(viewsets.ModelViewSet):
serializer_class = serializers.ResourceSerializer
queryset = models.Resource.objects.all()
lookup_fiel... |
985,303 | 62269dbe78746046d865be8eee1c7e72ab456b86 | from itertools import accumulate,takewhile
numbers=list(accumulate(range(8)))
print(numbers)
print(list(takewhile(lambda x:x<=6,numbers)))
|
985,304 | 45f39ad969d8d80d3b768704cb08be4d8a76accf | #!/usr/bin/env python3
"""
measure de runtime
"""
import time
import asyncio
wait_n = __import__('1-concurrent_coroutines').wait_n
def measure_time(n: int, max_delay: int) -> float:
"""
measure de runtime
:param n: times
:param max_delay: max delay
:return: average runtime
"""
start: flo... |
985,305 | d0a571e0876b92e2fabd0907973fb155ae57b726 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn import model_selection, preprocessing
import xgboost as xgb
import geopandas as gpd
from pyproj import Proj, transform, Geod
# ----------------- Settings ----------------- #
EN_CROSSVALIDATION = True
EN_IMPORTA... |
985,306 | df1e697f49e96419c892e0b9abf28faf0c978696 | # Initialize App Engine and import the default settings (DB backend, etc.).
# If you want to use a different backend you have to remove all occurences
# of "djangoappengine" from this file.
from djangoappengine.settings_base import *
#import os
# Activate django-dbindexer for the default database
DATABASES['native'] ... |
985,307 | 929b09b120f6afdea8ce845fa4e3024f4f495b9e | import numpy as np
import matplotlib.pyplot as plt
from Archive.utilities import get_N_HexCol
from Archive.utilities import plot_ellipse
from gmm import GMM
from copy import deepcopy
from sklearn.gaussian_process import GaussianProcessRegressor
class DiscontinuousFunction(object):
def __init__(self, params):
... |
985,308 | 831f886536907d04186a212cc371bd9ad56d38a9 | import plyvel
import json
import pickle
import sys
import random
import time
heads = []
with open('header.csv') as f:
for line in f:
line = line.strip()
name = line.split('\t').pop()
heads.append(name)
db = plyvel.DB('kvs.ldb', create_if_missing=True)
with open('../../sdb/138717728.json.tmp', 'r') as f:... |
985,309 | cca7bb1c0fd70a939a5a48a03fd7c4fe6fda07b4 | import numpy as np
import json
import math
import sqlite3
def from_random(stands, mgmts, timeperiods, numvars):
# consistently generate a random set
np.random.seed(42)
# 4D: stands, mgmts, time periods, variables
stand_data = np.random.randint(4, 14, size=(stands, mgmts, timeperiods, numvars))
axi... |
985,310 | 1c6aacccea85a0c8a08c08af43518a4dfac34df5 | def fibonacci(n):
if n == 1:
return 0
if n == 2:
return 1
else:
return fibonacci(n-2) + fibonacci(n-1)
result = fibonacci(6)
print result
x = fibonacci(10)
print x
print fibonacci(9)
print fibonacci(12)
print fibonacci(24)
|
985,311 | 0ac62d7c8c6fe8e655d515f44c26d56841c8c22b | from collections import defaultdict
from nltk.corpus import cmudict
import nltk
nltk.download('cmudict')
import pyphen
def read_dict(filename):
words = []
with open(filename, 'r') as f:
for line in f.readlines():
line = line.strip()
words.append(line)
return words
def dicti... |
985,312 | bdd65ab4fad15aac94d6129cc244f4f5372bf720 | # -*- coding: utf-8 -*-
import scrapy
import random, base64
import re
import os
import json
import sys
import csv
import proxylist
import useragent
from scrapy.http import Request, FormRequest
from money2020.items import Money2020Item
class Money2020spiderSpider(scrapy.Spider):
name = 'money2020spider'
# allowed_do... |
985,313 | c136ff0c158ca9445ecabef382ff8e919b2cea08 | """
.. module:: checkin_parking.apps.reservations.admin
:synopsis: Checkin Parking Reservation Reservation Admin Configuration.
.. moduleauthor:: Alex Kavanaugh <alex@kavdev.io>
"""
from django.contrib import admin
from .models import TimeSlot, ReservationSlot
class TimeSlotAdmin(admin.ModelAdmin):
list_di... |
985,314 | c3c22eb5cb96ddbcc3bda9eb453fd4bd2866f4ce | '''
Created on Nov 12, 2017
@author: ishank
'''
from __future__ import print_function
from audioop import reverse
def dataAggregation():
ipFile = open("input.txt")
timeWindow = str(ipFile.readline()).split(", ")
startDate = (int(timeWindow[0][:4]), int(timeWindow[0][5:7]))
endDate =... |
985,315 | 26b89f759bae7fd313d2b7afc5493d0f51decba8 | # -*- coding: utf-8 -*-
from django import template
register = template.Library()
from configs.methods import get_site_config
from siteprojects.models import Project
from core.models import Page, Post
from ceilings.models import Ceiling, Filter, FilterType
def phone(context, request):
return {
# 'configs': c... |
985,316 | cf6594f792a205c4ca5d227b1f5ff7fa31f8ac93 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
QSDsan: Quantitative Sustainable Design for sanitation and resource recovery systems
This module is developed by:
Yalin Li <zoe.yalin.li@gmail.com>
This module is under the University of Illinois/NCSA Open Source License.
Please refer to https://github.com/QSD-G... |
985,317 | 048a09bcf99a28950f806bc57815a4e9d83fd819 | #!/usr/bin/python3
from Bio import SeqIO
import sys
with sys.stdin as file_handle:
sequences = SeqIO.parse(file_handle,"fasta")
print(sum([k.seq == k.reverse_complement().seq for k in sequences])) |
985,318 | 6b59fa04877acec75fcecf6484f548ee7ac5a85b | #!/usr/bin/env python3
from datetime import datetime
import io
import sys
import tkinter as tk
# sudo apt install python3-pil python3-pil.imagetk
import PIL.Image
import PIL.ImageTk
# sudo apt install python3-redis
import redis
# some const
REDIS_HOST = 'localhost'
REDIS_PORT = 6379
REDIS_KEY = 'webcam_img'
# buil... |
985,319 | ba6cdb6b1e7afdf0b469ab2ee9c9ff186e6f0c2b | #Write a Python code to print out the given sudoku puzzle matrix in the following format.
#Use not more than "control flow statement and boolean logic operators" in solving this code problem.
sudoku = [
[0, 0, 0, 0, 6, 4, 0, 0, 0],
[7, 0, 0, 0, 0, 0, 3, 9, 0],
[8, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 5, ... |
985,320 | d55304056bdf15a06403f6dba8f26dec6e44d620 | class Result:
def __init__(self, product_name):
self.product_name = product_name
self.listings = []
def to_json(self):
json_listings = ''
if len(self.listings) > 0:
for i in range(0, len(self.listings) - 1):
listing = self.listings[i]
... |
985,321 | 207328cadb3c68bfe9d16129f334c550bffc6140 | """
使用Pandas做数据分析
pip3 install -i https://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com pandas
四月,再见
五月,你好
"""
import pandas as pd
# 导入数据集
path = "./res/csv/data.csv"
# 数据集存入一个名为chipo的数据集
chipo = pd.read_csv(path, sep='\t')
# 查看前十行
print(chipo.head(10))
# 数据集中有多少列
print(chipo.shape[1])
# 打印出全部的列名
print(ch... |
985,322 | dd104c953262af0f2a441ac6d9d30c4ef34608f0 | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def sortList(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
nodes = []
while head:
nodes.appe... |
985,323 | 7557c56b36d391900e4d0398497d0eaf0d0f305d | #!/usr/bin/python
""" These functions are used to convert the photo taken on the pi into base64
and send to our API at https://6ulp.com/predict which sends to AutoML to analyze
and return a confidence score associated with a person's name. The last function,
parsejson, takes a text response from AutoML, searches for t... |
985,324 | 74dd17f02f5f8afe3dfcc017a7428f52c4b48b64 | # Most of the tests ar in test_backend, this is just for pytorch-specific
# tests that can't be made generic.
import numpy as np
import pytest
from myia import dtype
try:
from myia.compile.backends import pytorch
except ImportError:
pytestmark = pytest.mark.skip(f"Can't import pytorch")
def test_pytorch_ty... |
985,325 | 15ce0f5ff31b58f84d185d24122724afe99ef19d | import os
import pandas as pd
import matplotlib.pyplot as plt
in_prefix = "data"
out_prefix = "plots"
implementations = ["tree", "merging"]
distributions = ["UNIFORM", "EXPONENTIAL"]
scale_function_prefixes = ["K_{0}_{1}".format(x, y) for x in ["1", "2", "3"] for y in
["USUAL", "GLUED"]] +... |
985,326 | 0522b9150090c57094de25d0ee4ac1123e39007d | # Note: This file belongs to:
# https://github.com/gooli/termenu
#
# Copyright (c) 2011 Eli Finer
#
# 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 ... |
985,327 | b7f1ad99ea232acb9a313bfc4cfa5708773b549a | import config
import telebot
from telebot import types
import random
import demoji
import pyowm
# Если ты хочешь порабоать на полной версии бота - напиши мне на почту
# If you want to work on the full version of the bot - write me an email
# pv-chernov2000@yandex.ru or pv.chernov2000@gmal.com
bot = telebot.TeleBot... |
985,328 | 8227da1142c3ad63e1617c24de22749b7c340ecd | from turtle import *
color("pink","yellow")
begin_fill()
circle(50)
end_fill()
|
985,329 | 479fa0228aa8cd67e01f60000666e094ffe74730 | # file: bookstore/views.py
from django.shortcuts import render
from django.http import HttpResponse
from . import models
from django.http import HttpResponseRedirect # 重定向
# Create your views here.
# file:bookstore/views.py
# def add_view(request):
# try:
# # 方法1
# # abook=models.Book.objects.cr... |
985,330 | a785bfd03b84a8215ee5ee2824ca3d01240159aa | import numpy as np
def cross_entropy_error(y, t):
delta = 1e-7
return -np.sum(t * np.log(y + delta))
t = np.array([0, 0, 1, 0, 0, 0, 0, 0, 0, 0])
y = np.array([0.1, 0.05, 0.6, 0.0, 0.05, 0.1, 0.0, 0.1, 0.0, 0.0])
print(cross_entropy_error(y, t))
y = np.array([0.1, 0.05, 0.1, 0.0, 0.05, 0.1, 0.0, 0.6, 0.0, 0.... |
985,331 | a139ac935733081c05eb60f18adb754267e8806f | import logging
from Products.CMFCore.utils import getToolByName
from Products.CMFCore.WorkflowCore import WorkflowException
from zope.annotation.interfaces import IAnnotations
from zest.specialpaste.interfaces import ISpecialPasteInProgress
logger = logging.getLogger(__name__)
ANNO_KEY = 'zest.specialpaste.original'... |
985,332 | 4387340a913b11d6150acf92dc6798196f0ca603 | from PySide2 import QtGui,QtCore
from PySide2.QtWidgets import QWidget,QPushButton,QApplication
from PySide2.QtGui import QPalette,QImage,QBrush,QIcon
import os,PySide2,sys
from MyButton import Mybutton
dirname = os.path.dirname(PySide2.__file__)
plugin_path = os.path.join(dirname, 'plugins','platforms')
os.envi... |
985,333 | 5bce5e231f5779090c1efd40a21c3b1a2bb7c143 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class RemoveTagResult(object):
def __init__(self):
self._biz_id = None
self._error_code = None
self._error_message = None
self._success = None
@property
def biz... |
985,334 | 9d46742158cb6c4ebf1656b19c42b3906f04c00d | import os
from pydub import playback
from playsound import playsound
from simpleaudio import play_buffer
import winsound
from manuscript.tools.counter import Counter
def play_sound(sound, block=True):
if sound is not None:
prefix = "tmp"
with Counter(prefix) as counter:
tmp_file = os.... |
985,335 | 84f0c5cefeef8b273e9e3c0e7caaa301e474670a | """
A basic calculator beeware application
"""
import toga
from toga.style import Pack
from toga.style.pack import COLUMN, ROW
from functools import partial
class Calculator(toga.App):
def startup(self):
box1 = toga.Box()
box2 = toga.Box()
box3 = toga.Box()
box4 = toga.Box()
... |
985,336 | 6547d8e4a1885f959f7b4a6b81b0ae6c58ab6736 | import time
exact = time.time()
inttime = int(exact)
sod = inttime - (inttime % 86400)
print("Exact: " + str(exact))
print("Integer Time: " + str(inttime))
print("Start of Day: " + str(sod))
|
985,337 | ac2953518d3aee254b4a7d6bd0f110080ea853e2 | from setuptools import setup # , find_packages
from setuptools.extension import Extension
from Cython.Build import cythonize
import numpy
extensions = [
Extension("ce_denoise",
sources=["ce_denoise.pyx", "ce_functions.c"],
include_dirs=[numpy.get_include()]),
Extension("SplitLauncher",
... |
985,338 | aa388daf3749041984cd0dcdfacc192c8e02c5f0 | from triggers.tts.tts_module import TTSModule
import gtts
import uuid
import os
import json
class GTTSModule(TTSModule):
lang = "en"
name = "gtts"
can_generate = True
status = "INIT"
error_code = None
tts_path = None
data = []
sounds_text = []
_runtime_updated = False
enabled = ... |
985,339 | 7c469b5d22b76977b2a9926219c64f2f961d543e | import numpy as np
import cv2
import datetime
cap = cv2.VideoCapture(1)
personName = "Yichen/"
takePicture = False
if not cap:
ans = cap.open()
print(ans)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Our operations on the frame come here
if ret:
# gray = cv2.cvtColo... |
985,340 | e47358af6558fba546d55364b70983adf622ae0c | import docker
import vizier.config.app as app
import vizier.config.container as cont
client = docker.from_env()
container_image = 'heikomueller/vizierapi:container'
port = 5005
project_id = '0123456789'
controller_url = 'http://localhost:5000/vizier-db/api/v1'
container = client.containers.run(
image=containe... |
985,341 | b22be948ca532b66679ce753a063363cd036a3fd | import unittest
from test import support
from subprocess import Popen, PIPE
import sys, os
#http://www.bx.psu.edu/~nate/pexpect/pexpect.html
from pexpect import popen_spawn
from test_mqtt_subscriber import Sample_MQTT_Subscriber
from test_maze_generator import Sample_Maze_Generator
import paho.mqtt.client as mqtt
impor... |
985,342 | 24ecf6c5fa0c8e039a7a61e227a220d89f8a884c | #-*- coding:utf-8 -*-
#!/usr/bin/python2
import MySQLdb as DB
class MySQL(object):
def __init__(self,host="localhost",usr="root",passwd="root",dbase="webpy"):
self.conn = DB.connect(host,usr,passwd,dbase, charset='utf8')
# 这里让 查询结果不再是 tuple 类型 而是 字典的形式返回
self.cursor =self.conn.cursor(curso... |
985,343 | aa748b40d599ead5e68d86a5bf2e364bd908ce21 | from bitmovin_api_sdk.notifications.webhooks.encoding.encoding_api import EncodingApi
from bitmovin_api_sdk.notifications.webhooks.encoding.encodings.encodings_api import EncodingsApi
from bitmovin_api_sdk.notifications.webhooks.encoding.manifest.manifest_api import ManifestApi
|
985,344 | 9257053ad94941585ab98be4e0a54c9d26ffbafe | p = "is"
t = "Thaaaisaisaais a bookis"
result = 0
cnt = 0
def BruteForce(p, t):
i = 0
j = 0
m = len(p)
n = len(t)
while j < m and i < n:
if t[i] != p[j]: #먼저 비교
i = i-j #한칸 옮기기
j=-1 #그러기 위해서 j = -1
i = i+1 ... |
985,345 | 9e4e1cb35b23a75044fea66634f02c5a9cdba50d | # Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved
#
# 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 applic... |
985,346 | 1e78ef54201a5d153263e793e971f34e4a5235bf | #!/usr/bin/env python
# coding: utf-8
# ### Bubble chart with plotly.express
# In[1]:
import plotly.express as px
df = px.data.gapminder()
fig = px.scatter(df.query("year==2007"), x="gdpPercap", y="lifeExp",
size="pop", color="continent",
hover_name="country", log_x=True, size_max=60)
fi... |
985,347 | 84a8769e19c5339d4ddd3a60e5226a6013c597ab | # -*- coding: utf-8 -*-
import re
import time
from resources.modules.client import get_html
global global_var,stop_all#global
global_var=[]
stop_all=0
from resources.modules.general import clean_name,check_link,server_data,replaceHTMLCodes,domain_s,similar,cloudflare_request,all_colors,base_header
from resources.m... |
985,348 | 63749e7bc8eafca890f343f86befc8cbd953a7f0 | # create by: wangyun
# create at: 2020/9/30 14:26
import random
class Random:
def __init__(self):
pass
# 从某个范围中获取整数
def get_random_num_from_range(self, min, max):
try:
return random.randint(int(min), int(max))
except:
return None
# 随机字符串(默认大小写字母、数字)
... |
985,349 | 198c48b7707c3d854745cda80ae911cc86a4baa8 | import pandas as pd
import os
from sklearn import tree
from sklearn import model_selection
os.getcwd()
os.chdir("D:/Data/DataScience/Practice/Assignment1")
traindf = pd.read_csv('train.csv')
print(type(traindf))
#a. Apply random predictions/majority based prediction to each observation
#and
#find out ... |
985,350 | 169fff61148aedf6d9e9aa64df875c8f2e7b849c | import boto3
import csv
import urllib2
import urllib
import json
def topic_loader():
#client = boto3.client('dynamodb')
dynamodb = boto3.resource('dynamodb', region_name='sa-east-1')
table = dynamodb.Table('topic')
with open('topics.csv') as csv_file:
reader = csv.DictReader(csv_file, delimite... |
985,351 | 3523ffddc7bd3435cbd462ffa448651b3e14ce0b | import requests
# import hmac
# import base64
# import hashlib
# import time
def get_request_public(endpoint="", params={}, headers={}):
base_url = "https://api.kucoin.com"
try:
response = requests.get(base_url + endpoint, params=params, headers=headers)
print("response: " + str(response))
return r... |
985,352 | 6b3f16b0110c7478da994a62935e25a5b0aa2671 | from django.conf.urls import url
from django.contrib.auth import views as auth_views
from . import views
urlpatterns = [
url(r'^$', views.my_it_equipment, name='my_it_equipment'),
url(r'^user/(?P<username>[\w.@+-]+)/$', views.user_it_equipment, name='user_it_equipment')
]
|
985,353 | 68c6a30aa750a000d197891b04eb5c158e8a0eed | #this program displays the records from
#coffee.txt file
def main():
#open the coffee.txt file
coffeeFile=open('coffee.txt','r')
#read the first record's description in field
descr=coffeeFile.readline()
#read the rest of the file
while descr!='':
#read the quantity field
... |
985,354 | 7655e76f9f0844d496e46f9657352aec3c518370 | import argparse
import json
from pathlib import Path
import numpy as np
import pytorch_pfn_extras as ppe
import pytorch_pfn_extras.training.extensions as extensions
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.u... |
985,355 | 841c97b9b41852e75eec8260ea2817a07a805962 | # https://www.kaggle.com/adamhart/submission-file-generation-using-separate-threads?scriptVersionId=1501663
# https://github.com/petrosgk/Kaggle-Carvana-Image-Masking-Challenge/blob/master/test_submit_multithreaded.py
from common import *
from dataset.carvana_cars import *
from model.tool import *
import csv... |
985,356 | 1612ab07a96c9e9a421df967b69182ca9f088a80 | version https://git-lfs.github.com/spec/v1
oid sha256:4dfd9042f32213c0231a6e6b27e2e4288c9691d2b3de33e9f3fd3e9717b49f8b
size 9461
|
985,357 | 9c0523fe5ae2032cc6031765737d9a319c08f01e | import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
email = 'myaddress@gmail.com'
password = 'password'
send_to_email = 'sentoaddreess@gmail.com'
subject = 'This is the subject'
messageHTML = '<p>Visit <a href="https://nitratine.net/">nitratine.net<a> for some great <span... |
985,358 | 9110ba4821bcee0027519a412f5a0760472a9fa3 | #!/usr/bin/env python3
import argparse
import json
from asnake.aspace import ASpace
AS_REPOSITORY_ID = 2
def is_target(top_container):
"""Determines if a top container should be the target of a merge."""
if '.' not in top_container.get('barcode', ''):
return True
else:
return False
def merge_containers(cont... |
985,359 | 85cf2865160108faabaea4001ce6271beefe82d9 | #encoding=utf8
from PIL import Image
import numpy as np
import sys
import os
import shutil
def convert_image(image_path, out_image_path):
a = np.asarray(Image.open(image_path).convert('L')).astype('float')
depth = 10. # (0-100)
grad = np.gradient(a) #取图像灰度的梯度值
gra... |
985,360 | 63243e33d4296cfc7abfa426ddadafae26f374ca | # Copyright 2021 Google LLC. All Rights Reserved.
#
# 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 a... |
985,361 | b8ee90060fc1966de0dc5104dc3e9cb89ccc9239 | #!/usr/bin/env python
#-*-coding:utf-8-*-
'''
发送邮件
'''
import smtplib
# import time
from datetime import date, timedelta
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
class SendEmail(object):
def __init__(self):
self.sender = ""
self.user = ""
self.pa... |
985,362 | 52e5d99cdf26bbd75967513975129a1e6b42eb70 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'community'}
from ansible.module_utils.basic impor... |
985,363 | dab516bd7169c6541eb87aba6232f6bb8328ba36 | from ddpg import start_actor_critic_algorithm
start_actor_critic_algorithm()
|
985,364 | 92e34ac905ce3519bf228006f9311974271c580a | from helper.database import db, LowerCaseComparator
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import column_property
from mu.model.entity.event import Event
from mu.model.entity.work import Work
from mu.model.entity.agent import Agent, AgentType
from datetime import datetime
c... |
985,365 | 2353fa8276c511cf6a78fea95c153566e5f1f62a | """
Sandbox Example (main.py)
[The Echo Nest](the.echonest.com) 2011
This is a simple example demonstrating how to take advantage of the
Sandbox Assets in The Echo Nest API.
This example assumes that you have a basic understanding of Python.
"""
# This example uses the [web.py](http://webpy.org/) framework.
# Insta... |
985,366 | 21396c29c1963bdc0264221556a2a3a5e9736fce | #!/usr/bin/python
print("Hello Universe")
print("Hello omkar")
|
985,367 | 8f67df4fd5554c5a146711adb7974dc50f1d087e | from itertools import combinations_with_replacement
from functools import reduce
def find_vampires(num_digits, num_fangs):
vampires = dict()
for fangs in combinations_with_replacement(range(10 ** (num_digits // num_fangs - 1), 10 ** (num_digits // num_fangs)), num_fangs):
vampire = reduce(lambda x, y: ... |
985,368 | 52caf39877ff52186548844e7279030ff9de3a6e | #!/usr/bin/env python
import sys
import rospy
from rosplan_knowledge_msgs.srv import *
from rosplan_knowledge_msgs.msg import *
query = []
def call_service():
print "Waiting for service"
rospy.wait_for_service('/rosplan_knowledge_base/query_state')
try:
print "Calling Service"
query_proxy... |
985,369 | 8fe65d9e3940e8175042f6e4d45c6c510d2dffde | t = 90
h = 55
print(t-h) |
985,370 | ee4e07f28b1c463265c4180dde6a88ca7968b96a | from flask_wtf import FlaskForm, RecaptchaField
from wtforms import StringField, TextAreaField, SubmitField, PasswordField, BooleanField
from wtforms.validators import DataRequired, Length, Email, ValidationError, EqualTo
from app import db, models
class LoginForm(FlaskForm):
username = StringField("Username", va... |
985,371 | 14ac5d62ea42f0525712315b6a38ecfc3ec39668 | import time
import pandas as pd
import numpy as np
from sklearn.pipeline import Pipeline
from sklearn.metrics import pairwise
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from sklearn.preprocessing import Normalizer, normalize
from modules.utils.similarity_measures import SimilarityMea... |
985,372 | fa4c52d48d231d40bd99b9f802793e49c62749c7 | # 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, software
# distributed under t... |
985,373 | 15a593889b8373c1afdbf15369d0a3438dfc2964 | baseUrl = 'https://fences.wallet.ng'
new_transaction = "/transactions/new"
transaction_details = "/details"
list_providers = "/bills/airtime/providers"
buy_airtime = "/bills/airtime/purchase"
list_bank = "/transfer/banks/all"
account_enquiry = "/transfer/bank/account/enquire"
account_transfer = "/transfer/bank/account... |
985,374 | 4e3a2da19b4268c8110e23790a2f27c5fa61d0e7 | # Create your views here.
from django.shortcuts import render_to_response
from django.http import HttpResponse, HttpResponseRedirect
from grabimg.forms import SoupForm
from mysite.models import *
# tool functions
from grabimg.tools import getRandom, getHtml, getResource, taobao_lib, saveImg
# get conf
from dj... |
985,375 | eb5e2bc555335610cb77ef52b63bb2fc6d73d51b | import torch
import torch.nn as nn
from utils.func import compute_bleu
from config.config import device, MAX_LENGTH
class Seq2Seq(nn.Module):
def __init__(self, encoder, decoder):
super(Seq2Seq, self).__init__()
self.encoder = encoder
self.decoder = decoder
def forward(self, input, ... |
985,376 | 532da75dcea9480ebaa275c0bde7bd74b71ec097 | # -*- coding: utf-8 -*-
# GstBlenderSrc
# Copyright (c) 2017, Fabian Orccon <cfoch.fabian@gmail.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License,... |
985,377 | fd896e8c79b823cb8126419d48bacbb54b799919 | import flask
from requests_oauthlib import OAuth2Session
from config_director import Config
def get_google_auth(state=None, token=None):
if token:
return OAuth2Session(Config.Auth.CLIENT_ID, token=token)
if state:
return OAuth2Session(
Config.Auth.CLIENT_ID,
state=sta... |
985,378 | 72f0c88f1524fffee1961297e486915f9e2cab3e | #!/usr/bin/env python3
# coding=utf-8
from os import environ, chmod, lstat
import stat
from os.path import isfile
import yaml
default = """#settings for pubstore-client
ip: 127.0.0.1
port: 5555
user: romeo
pass: ilovejuliet
"""
user_conf_path = "%s/.pubstore-client.yml" % environ['HOME']
sys_conf_path = "%s/pubstore... |
985,379 | 3267c4cf14d3e2715f351641403af0d84a5efe4d | from torch import nn
class AutoEncoder(nn.Module):
def __init__(self, encoder, decoder):
super(AutoEncoder, self).__init__()
self.encoder = encoder
self.decoder = decoder
def forward(self, x):
return self.decoder(self.encoder(x))
# def encoder_no_update(self):
# ... |
985,380 | 8e6dd47d5592e3b5da9263d895b3fafccf5d4a8a | from flask import Blueprint, request, redirect, url_for
from flask_mysqldb import MySQL
from nodes.extensions import mysql
import requests as rqst
import datetime, calendar
mod = Blueprint('fb', __name__)
@mod.route('/fb')
def fb():
#Token Temporal
token = 'EAAIPgJKNjsgBAJHXGg2CGBJjexj7kKI1cfjAud0VVpKqCDOR... |
985,381 | a97f6fa8a1db96416614ae06909500eec9ab3ced | '''
NAME: Get Contacts
DESCRIPTION: Prints the buddy names of all the contacts in order to send iMessages
'''
import subprocess
import sys
script = '''tell application "Messages"
get the full name of every buddy
end tell'''
proc = subprocess.Popen(['osascript', '-'],
... |
985,382 | 1187e0d779487797a0fc29a71f6f114476e3af5d | #!/usr/local/bin/python evn
# coding=utf-8
import os,os.path
import zipfile
def zip_dir(dirname,zipfilename):
filelist = []
if os.path.isfile(dirname):
filelist.append(dirname)
else :
for root, dirs, files in os.walk(dirname):
for name in files:
filelist.append... |
985,383 | fa016963966a5dc39bb7bdbe91d72b539f1a3970 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: service.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_da... |
985,384 | 776b82ec9c2a2374453a41314f207389623139cb | #import sub1.test1
import sub2.test2
print('run mtest')
|
985,385 | 88169f7cb809b3bfcd41d6aa87b25e7070c93abc | from . import Player
from copy import deepcopy
import sys
from time import time
sys.path.insert(0, "..")
from game import OthelloBoard, State
# http://mkorman.org/othello.pdf
class GameState(object):
def __init__(self, board, parent=None, depth=None, player=None, move=None):
self.board = board
... |
985,386 | 8c88c6f20bcf46d5df8209463a5ad3ec093871a6 | import os
import re
def get_all_fastq_abs_path(path_lst: tuple, exp: str = '.*-(.*?)_combined_R[12].fastq.gz',
r1_end_with='R1.fastq.gz', link_rawdata=False, prefix='',
add_S_to_numeric_name=False,
replace_with_underscore=False):
# .... |
985,387 | 7c58bd9cc2bfcff60d26eac84019fce0143276b7 | from rest_framework import serializers
from crawler.models import Subject, SubjectComponent, TimetableEntry, Formation, Room, Section
class SectionSerializer(serializers.ModelSerializer):
class Meta:
model = Section
fields = ['id', 'name', 'year', 'type']
class FormationSerializer(serializers.M... |
985,388 | 47f512c3e17a4fb641934c20b0d9094f86e6ef10 | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import os
import tensorflow as tf
def read_img(name):
img_file = tf.read_file(name)
img_decoded = tf.image.decode_image(img_file, channels=3)
img_decoded.set_shape([None, None, 3... |
985,389 | 2a471caba2143e9746fcfa8f8fb63d4cd44d2811 | from tkinter import *
from tkinter import ttk
from tkinter.font import Font
import threading
import sys
sys.path.append('..')
import macro
import tkinter as tk
from PIL import Image, ImageTk
from itertools import count, cycle
root = Tk()
root.geometry("1200x700")
content_top = ttk.Frame(roo... |
985,390 | 9b7f556721211bb1b2e560e666dcf9d8ef6488b2 | class DDstack():
def __init__(self):
self.list=[] # 要注意栈底要垫一个最小/大,预防本身就是最小等情况
self.cmp = lambda a,b:a>b # 默认递增, 即栈顶最大。 用于找最近小于
def push(self, num):
while len(self.list) > 0 and (not self.cmp(num,self.list[-1])): # 当 num 不符合栈顶时 ,就出栈
self.pop()
self.list.append(num)
... |
985,391 | de624bf4145773664eae70a6e8e0b94506513de8 | import socket
class WifiConnection(object):
def __init__(self):
self.client_socket = None
self.server_socket = None
self.connected = False
def createServer(self, port = 3):
self.server_socket=socket.socket()
self.server_socket.bind(("", 5000))
self... |
985,392 | 38e247dec453443a2fef2e0534556348220fdc1c | #!/usr/bin/env python
"""
Script that calculates Cohen's Kappa (inter rater agreement) for 2 BIO files
BIO files need to be exactly the same length
Usage: python bio-kappa.py [bio file 1] [bio file 2]
"""
import sys
import re
from sklearn.metrics import f1_score
from nltk.metrics import *
bio1 = sys.argv[1]
bio... |
985,393 | ca85313318962b2b49f38e36133bede7aeaecf85 | # @Time :2022/1/27
# @Author :lyx
class Solution:
def isIsomorphic(self, s, t):
s_hash = {}
t_hash = {}
for s1, t1 in zip(s, t):
# print(s1, t1)
if s_hash.get(s1):
if s_hash[s1] == t1:
continue
else:
... |
985,394 | 3f491e5a3026214259359e5224477e9890818b16 | from init.init_driver import init_driver
from Page.Page_Main import Page_Main
import pytest
import Page as p
class Test_Search():
def setup_class(self):
self.driver = init_driver()
self.ps = Page_Main(self.driver).Search()
def teardown_class(self):
self.driver.quit()
def test_cli... |
985,395 | 925aab52e1a33a9e3c396c13e78af8d8860e8ee2 | from bin.common import AppConfigurations
from bin.common import AppConstants
from bin.exception.exception import BPLocationException, BPProjectInitializationException
from bin.utils.MongoUtility import MongoUtility
class LocationHandler(object):
def __init__(self):
try:
self.mongo_db_object = ... |
985,396 | 052a34cbb51c319eabb7b9151ab1334376367388 | from django import forms
from django.utils.translation import gettext_lazy as _
class ShowAutomationForm(forms.Form):
pass
# first_name = forms.CharField(label=_('First name'), max_length=30, required=False)
# last_name = forms.CharField(label=_('Last name'), max_length=150, required=False)
class AddAuto... |
985,397 | 1384c7f4fe657641c1fa2e808dbfbd2d74e763a5 | # -*- coding: utf-8 -*-
from odoo import models, fields, api, _
from odoo.exceptions import Warning, UserError
from datetime import datetime
import logging
_logger = logging.getLogger(__name__)
class SaleOrder(models.Model):
_inherit = 'sale.order'
@api.model
def _get_modista_domain(self):
return ... |
985,398 | 1721f77567a094b50365e4fa663adc86b47a6f10 | #! python3
import json
import os
import sys
from pathlib import Path
import function_labeling as fl
if __name__ == '__main__':
directory = r'PATH\TO\COMMENTS\JSON'
os.chdir(directory)
fl.create_folder_to_labeled_file('Labeled_file')
fl.create_file_and_header_in_file('labeled_dataset.... |
985,399 | d3d015f9e24bf44e8db6bc75048e0ae32e5166a4 | import numpy as np
from sklearn.model_selection import train_test_split
from regression_model import pipeline
from regression_model.config import config
from regression_model.preprocessing.outlier_remover import OutlierRemover
from regression_model.preprocessing.data_management import load_dataset, save_pipeline
def ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.