index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
16,700 | 445590c24cac1bb222db0268a4b07ae8acdac1b8 | from jira import JIRA
from settings import JIRA_USERNAME, JIRA_PASSWORD, JIRA_SERVER
def create_jira_backend():
return JIRA(server=JIRA_SERVER, basic_auth=(JIRA_USERNAME, JIRA_PASSWORD), validate=True)
|
16,701 | 7a33ebd29eb31b204eb50c89178028cd99854b1c | S=[int(s) for s in list(input())]
if sum(S)%9==0:
print('Yes')
else:
print('No') |
16,702 | 47538036bffee415199dd3bbdf4dd386e00c54b3 |
# -*- coding: utf-8 -*-
"""
models.py
flask
Created on 10|04
-----
20|18
@author: rdlc_Dev(alain)
@version:1.180410
"""
# Import the database object (db) from the main application module
# We will define this inside /app/__init__.py in the next sections.
from werkzeug.security import chec... |
16,703 | 3dc6b096ff1b14f52d54c0097003c059f76391fa | import unittest
from ps4a import *
# Test cases
class TestCodeEdX(unittest.TestCase):
def test_count(self):
# Only adding tests for functions that are not in tested in test_ps4a.py
self.assertEqual(calculateHandlen({'a': 3, 'b':2, 'c':1}), 6)
# Execute unit testing
if __name__ == '__main__':
u... |
16,704 | 1272b37d35d0d72d704a1e0ddc991e5ad22677cf | from logfile import filelog
|
16,705 | 5fc87dd2acd0e0f4f9b520558e66021320666f58 | import sys
def score_string(s):
skip_next = False
in_garbage = False
level = 0
score = 0
garbage_count = 0
for c in s:
if skip_next:
skip_next = False
elif c == "!":
skip_next = True
elif in_garbage:
if c == ">":
in_gar... |
16,706 | f69362c722d0c499511fbfa7cd38fe0cb69ba4ea | import torch
import torch.nn as nn
class CNN(nn.Module):
def __init__(self):
super(CNN, self).__init__()
self.conv1 = nn.Sequential(
nn.Conv2d(in_channels=1, out_channels=16, kernel_size=5, stride=1, padding=2),
nn.ReLU(),
nn.MaxPool2d(kernel_size=2),
... |
16,707 | 6997ad57bab3e1ba012c77f5e15ee7c27180ebda | from backend import app, db
from backend.models import Movie
from flask import jsonify, request
# TODO set the url for accept request
# 1. /append
# 2. /all
# 3. /search
# 4. /delete
# 5. /modify
@app.route('/append', methods=['POST'])
def append():
# title = request.form.get('title')
# year = request.form.ge... |
16,708 | bf5ee4dec04b5e7fff55c96ff5f97703790f61c1 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-10-04 14:15
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('primary_docs', '0028_auto_201... |
16,709 | 4c6b40430491cf328ff8f973ed46857619a3304d | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 19 18:43:21 2020
@author: phalinp
"""
import cv2 as cv
import numpy as np
img = np.zeros((512,512,3),np.uint8)
#img is a black image to draw a line
cv.line(img,(0,0),(511,511),(255,0,0),10)
#Creates a line starting from (0,0) to (511,511) in img,... |
16,710 | 5e65b999940cc674062de23ca0b4ef4efebc6e4a | import datetime
from Status.logList import log
from Status.updateStatus import state_json_data
def analysis(stock):
'''torxiong Form Data Analysis'''
result = ''
email_title = ''
email_html = ''
TIME = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
json_status = state_json_data["optio... |
16,711 | 9e26f40cb0dde6a5f8dd52dc162c16a53567eeee | N = int(input())
l = list(range(1, 2*N+2))
while l:
print(l.pop(0))
inp = int(input())
if inp == 0:
exit()
else:
l.pop(l.index(inp))
|
16,712 | 09458199687e103dc45d8f9ed4272af352c07062 | from django.apps import AppConfig
class DailyAttandanceConfig(AppConfig):
name = 'daily_tracker'
|
16,713 | 8d5b9825eeb7b29f4a0af0bda1db6fe7c89f990c | from django.db import models
from django.core.validators import MaxValueValidator, MinValueValidator
class Rating(models.Model):
"""
Rating model for ratings.
"""
from_user = models.ForeignKey('auth.User',
related_name="ratings_made",
... |
16,714 | 47750a7d7ad3105e637062bbda91f0745e1b88e5 |
import numpy as np
import cv2
import imutils
class Procesador(object):
def __init__(self, detectorM, detectorR, reconocedor, output_path=None):
self.detectorM = detectorM
self.detectorR = detectorR
self.reconocedor = reconocedor
self.output_path = output_path
if output_path... |
16,715 | d6c970d7a716ba70c9f8c63df2245d340b41426f | import pandas as pd
import glob
import matplotlib.pyplot as plt
import seaborn as sns
plt.rcParams["figure.dpi"] = 150
# MP2.5
df_mp25 = pd.DataFrame()
for i, file_name in enumerate(sorted(list(glob.glob('../data/*_mp25.csv')), reverse=True)):
temp = pd.read_csv(file_name, usecols=['date', 'name', 'val'])
tem... |
16,716 | bd6167d79dfea2ccb824eac5125e51a34b9f5d5f | from django.urls import path
from . import views
app_name = 'App_Login'
urlpatterns = [
path('sign_up/',views.sign_up,name='sign_up'),
path('login/',views.login_page,name='login'),
path('logout/',views.logout_user,name='logout'),
path('profile/',views.profile,name='profile'),
path('change-profile/... |
16,717 | fa5aa267f65394c7f6300d9e8f5b86c2a09cdfde | from collections import defaultdict
import numpy as np
class ImagePose():
def __init__(self):
self.img = np.empty(1) # downsampled image used for display
self.desc = np.empty(1) # feature descriptor
self.kp = [] # keypoints list in (x,y) format (not (y, x)!)
self.T = np.zeros(... |
16,718 | a08b3dc16cead67a7c1b3a67a65f70a1414859c7 | import struct
import numpy as np
import FakeSerial as serial
class TestClass:
## init(): the constructor. Many of the arguments have default values
# and can be skipped when calling the constructor.
# same time as a Serial
# same readtimeout and writetimeout as used in Nanomodem from MasterAnchor
... |
16,719 | 693d082114b0fd5374896f9232d1db22e9509d01 | # Update for the User name and Password for the
# database service
VIDEO_DATABASE_USER = "video_search"
VIDEO_DATABASE_PASSWORD = "passw0rd"
|
16,720 | 7ddaa444b7d29a7e1a85d8e528b7cfe06638221d | import random
class BernouliArm:
def __init__(self, s):
self.s = s
def pull(self):
reward = 0
if random.random() < self.s:
reward = 1
return reward
|
16,721 | 1d5bf548a98e24e4dcdad0ae77dc16980519f6b7 | #comprimento da escada
from math import sin
from math import pi
def main():
altura = eval(input("Digite a altura: "))
graus = eval(input("Digite a inclinação (graus): "))
angulo = (pi/180)*graus
comprimento = altura / sin(angulo)
print("O comprimento da escada ate a casa e: ", round(comprimento))
mai... |
16,722 | 318918145e9da48522ca18a00478d9281300e321 | import json
import logging
from datetime import datetime
# from dateutil.tz import tzlocal
from flask import Blueprint, jsonify, abort, current_app, request
# import paho.mqtt.client as mqtt
from kafka import KafkaProducer
from .models import Task, TaskType, TaskStatus
from ..database import db
from ..factory.models ... |
16,723 | 66150ad456d07e207a796347ee60a4e3ec4e2a8c | import requests
import json
import base64
import shutil
import cv2
addr = 'http://localhost:5000'
test_url = addr + '/predict'
# prepare headers for http request
content_type = 'image/jpg'
headers = {'content-type': content_type}
img = cv2.imread('pA.jpg')
# encode image as jpeg
_, img_encoded = cv2.imencode('.jpg',... |
16,724 | aebc8dae9e39bc97d5078d0ae1b5ba4d0442c1c9 | #!/usr/bin/env python3
"""
Created on Wed Feb 12 10:44:59 2020
@author: German Sinuco
Skeleton modified from
https://www.tensorflow.org/tutorials/customization/custom_training
https://www.tensorflow.org/tutorials/customization/custom_training_walkthrough
Training of an RBM parametrization of ... |
16,725 | 447d4b48cd898b06837a19f192c8b39e5ae10104 | from django.contrib import admin
from .models import *
admin.site.register(ResourceField,ResourceFieldDisplay)
admin.site.register(ReleaseCatalogue,ReleaseCatalogueDisplay) |
16,726 | bc5b1beec471d69b6264a56ed17151ca09230c55 | # coding: utf-8
import time
import datetime
import base64
from email import utils
from odoo import models, fields, api
from odoo.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT
class BlogPost(models.Model):
_inherit = 'blog.post'
@api.multi
def _compute_get_date(self):
posts = self
for p... |
16,727 | e204af9bfc1687348d1dd2b1304b9e397c91a39e | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
import os
class DaomuPipeline(object):
def process_item(self, item, spider):
directory = 'D:/novel/{}/'.format(it... |
16,728 | 0fca2d33ff189d64fc4f5c3e8c9dff7ec073394c | from django.urls import path, include
from .views import index, get_user, get_user_info , get_images
urlpatterns = [
path('', index),
path('user/', get_user),
path('search/', get_user_info),
path('images/', get_images),
]
|
16,729 | bda2c9f19b585568b6b9e8d595305d81405aabb3 | # -*- coding: utf-8 -*-
# Copyright (c) 2008-2013 Infrae. All rights reserved.
# See also LICENSE.txt
# Zope 3
from zope.location.interfaces import ISite
from zope.traversing.interfaces import IContainmentRoot
from zope.interface import implementedBy
from zope import component
from five.localsitemanager.utils import ... |
16,730 | 66d18583fbaf1de86a79b24fc6949f68ee6be838 | # coding:utf-8
import tkinter as tk
from tkinter import ttk
from tkinter import simpledialog
from MongoOperator import MongoOperator
db = MongoOperator('127.0.0.1', 27017, 'web_news', 'test_collection')
# ##
def search_action():
table_name = collection_name_text.get()
if table_name == '':
display_tex... |
16,731 | 442dba8d642c4e10d5eda84539b0008eb8c96436 | """Python Cookbook 2nd ed.
Chapter B, Bonus, recipe 5.
Raw data source: ftp://ftp.cmdl.noaa.gov/ccg/co2/trends/co2_mm_mlo.txt
Note: Output from this is used in Chapter 4 examples.
"""
from pathlib import Path
import csv
import json
from typing import Iterable, Iterator, Dict, TextIO
def non_comment_iter(source: T... |
16,732 | eef3ab20f77983c3d8470461d754ac875d122a30 | #-*- coding:utf-8 -*-
"""
@author: M.Lee
@file: Statistics_Ques_Detail.py
@time: 2018/2/20-2018/4/21(final version)
"""
import nltk
from nltk.corpus import webtext as web
from nltk import *
from nltk.tokenize import RegexpTokenizer
from nltk.corpus import stopwords
from nltk.tag import UnigramTagger
fr... |
16,733 | 8882921c26ac7732f482f3483a133e922884bfa5 | #coding=utf-8
import json
import requests
from handlers.base import BaseHandler
class view(BaseHandler):
def get(self):
return self.render("index.html")
class get_api(BaseHandler):
def post(self):
res = dict()
args = self.request.arguments
for a in args:
res[a] = se... |
16,734 | b4ede7048e2c348d31dce2dbe7d8844ded0afca1 | import heapq
stud = [['KRIS', 54, 56, 90], ['ANA', 66, 77, 88]]
new_list = []
for i in stud:
dict_stud = dict()
sum = 0
key = stud[0]
for j in i:
if type(j) is int:
sum = sum + j
else:
key = j.split()
all_list = dict_stud.fromkeys(key, sum)
new_list.ap... |
16,735 | 1fa9cebac8d2376b55490624291ab32920003a1a | #
# @lc app=leetcode.cn id=42 lang=python3
#
# [42] 接雨水
#
# https://leetcode-cn.com/problems/trapping-rain-water/description/
#
# algorithms
# Hard (48.85%)
# Likes: 977
# Dislikes: 0
# Total Accepted: 69K
# Total Submissions: 139.2K
# Testcase Example: '[0,1,0,2,1,0,1,3,2,1,2,1]'
#
# 给定 n 个非负整数表示每个宽度为 1 的柱子的高度图... |
16,736 | f4e3f0d83fd73b92c9ca69345e49eed1656b28ed |
# def 함수이름(매개변수=값):
# 코드
# ---------- 초기값 지정하기
def personal_info(name, age, address='비공개'):
print('이름: ', name)
print('나이: ', age)
print('주소: ', address)
# --------------초기값 지정되어 있더라도 값을 넣으면 해당 값이 전달됨
personal_info('홍길동',40, '서울시 용산구 이촌동')
#----------------초기값 지정된 매개변수의 위치\
# 초기값이 없는 매개변수 올 수 없다.\
#
... |
16,737 | dca71ca85cac7275a35abe7c3a47cc5b91124ec1 | import os
import argparse
from collections import defaultdict
def extnum_func(args):
dataset = defaultdict(lambda:0)
for root, dirs, files in os.walk(args.srcdir):
for srcname in files:
name, ext = os.path.splitext(srcname)
dataset[ext] += 1
print(args.srcdir)
dataset = sorted(dataset.items(), key=lamb... |
16,738 | 164a48fa11a4b9aea93b60655e870013793d20f1 | # template for "Stopwatch: The Game"
import simplegui
# define global variables
total_millisecond = 0
accept_cnt = 0
total_cnt = 0
score = 0
mode = 0
width = 300
height = 200
per_second = 1000
# define helper function format that converts time
# in tenths of seconds into formatted string A:BC.D
def format(t):
... |
16,739 | a0e3bbea30e48fbb6df79c5d41f7343021da9b2b | import time
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from bs4 import BeautifulSoup
from selenium.webdriver.chrome.options import Options
import pandas as pd
options = Options()
options.headless = True
driver = webdriver.Chrome(chrome_options=options) #Safari()
#driver = webdrive... |
16,740 | 176ff59264635e708cf2aee1af3ce7cd3b7b7f6e | class School(object):
def __init__(
self, code, name, city, state, from_m,
from_y, to_m, to_y, grad_m, grad_y):
self.school_code = code
self.school_name = name
self.school_city = city
self.school_state = state
self.from_month = from_m
... |
16,741 | 6408798a1796ddabb9e285d40046877ead8bd3c3 | import requests
import json
def getData(url):
req = requests.get(url)
return req.json()
class AttorneysRequest():
@classmethod
def getAttorneys(self):
attorneys = getData('https://www.lawyercentral.com/utils/maps.cfc?method=getAttorneysFromLatLng&lat=39.828185&lng=-98.57954&lawyerName=&stateAbb=&... |
16,742 | 883a4cc802521d73e29fdf652ef69f591d75898b | import torch
from utils import Utils
from model import GRUEncoder, Classifier, ContrastiveLoss
import torch.optim as optim
import os
import sys
from gensim.models import Word2Vec
import numpy as np
import jieba
def build_model(voc_size, emb_dim, hidden_size):
encoder = GRUEncoder(emb_dim, hidden_size, voc_size, em... |
16,743 | f6eb3b6a3eb99939ea60c701fe8a8b6233fc6494 | from django.shortcuts import render
# Create your views here.
def information(request):
""" A view to return the Public Information page """
print('Hello, world')
context = {
}
return render(request, 'information/information.html', context)
|
16,744 | 59a3c46313588a7365975b1f20a7100775dc4506 | class DayOfDead(object):
def enter(self):
print "A nice looking skeleton woman with a big dress is standing in"
print "Front of you. You can see food offerings on a table, and "
print "Grandma and grandpa's bones sitting on chairs"
print "How do you say \"dead\" in spanish?"
... |
16,745 | 5125b933ce08ef57fb284e001e4eda94b5b5c9d4 | __all__ = ['Starter']
import httplib
from multiprocessing.managers import BaseManager
import socket
import time
import urllib2
from veetwo.lib.aggregation.spider import get_spider_config_value as c
from veetwo.lib.aggregation.spider.doc_store import DocStoreS3
from veetwo.lib.aggregation.spider.model import Document
... |
16,746 | e70f11179e6c7c612cc863775adb14b385581959 | import librosa
from mir_eval.separation import bss_eval_sources
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--in_wav1', type=str, required=True,
help="input wav 1")
parser.add_argument('--in_wav2', type=str, required=True,
help="input wav 2")
args = p... |
16,747 | 0c63d8645f22a4a1296ec877bb8f9768576e1649 | import os
import sys
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
def list_files(dir):
full_path = [os.path.join(dir, f) for f in os.listdir(dir)]
files = [f for f in full_path
if os.path.isfile(f)]
return files
def read_images(filenames):
images = []
for... |
16,748 | 7608eb73ec51c816efe9b4416df6a1ccc3b30450 | # from common.Cloudscale import *
import boto.ec2
import time
from scripts.common.Cloudscale import check_args, parse_args
class EC2CreateAMI:
def __init__(self, config, logger):
self.logger = logger
self.cfg = config.cfg
self.config = config
self.key_name = self.cfg.get('EC2', 'k... |
16,749 | b2529ad5570aa174a24775e90327468bb2eaefb6 | from django.contrib import admin
from EnoteApp.models import Notes
# Register your models here.
admin.site.register(Notes) |
16,750 | 433b26bac9c1a398dc4cf8c030b377921cafa779 | # osTest02.py
# os 모듈 : Operating System(운영체제)와 관련된 모듈
# 폴더 생성, 수정, 삭제 등등
# 파일과 관련된 여러 가지 속성 정보
import os
# 폴더 구분자를 사용할 때 /는 한번만, \는 반드시 두개 ex) c:/user, c:\\user
myfolder = 'd:\\'
newpath = os.path.join(myfolder, 'sample')
try:
os.mkdir(path=newpath) # mkdir : make directory
for i in range(1, 11):
newf... |
16,751 | 2c7705eba52865f99f586e82e8c25341041a94b0 | __author__ = 'computer'
import unittest
from Lemon.class_09_17_test.MathMethod import MathMethod
class class_Test(unittest.TestCase):
def test_sum(self):
t = MathMethod()
sum = t.Sum(1,2)
print('两个数相加的值为:{}'.format(sum))
def test_sub(self):
t = MathMethod()
t.Sub(1,2)
... |
16,752 | d56a6ad837fb91dc4ebc02976835b28670c3d60c | # Copyright (c) 2007, Enthought, Inc.
# License: BSD Style.
"""
This demo shows you how to use animated GIF files in a traits user interface.
"""
from os.path \
import join, dirname, abspath
from enthought.traits.api \
import HasTraits, File, Bool
from enthought.traits.ui.api \
import View, VG... |
16,753 | 24e5bd41b63eee4b8bd98c8a7ec6c224bf656c17 | # -*- coding: utf-8 -*-
from openerp.osv import fields, osv
class ship_kind(osv.osv):
_name = 'ship.kind'
#_rec_name = 'complete_name' #显示的是name的值,没建的话重写 ------- 不能加,会不可用而显示出全部记录The field 'Name' (complete_name) can not be searched: non-stored function field without fnct_search
def name_get_full(self, cr, ... |
16,754 | 1993ed207c66820301e6919f50cb7f656c540f11 | import os
from flask import Flask, render_template, session, redirect
def create_app(test_config=None):
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(
SECRET_KEY='124sdsd'
)
if test_config is None:
# It probably fail, but it must shut up!!
app.confi... |
16,755 | f4333295cdd0b42775b94eda189c743d61b31bcf | import concurrent.futures
import logging
import mimetypes
import os
import socket
from datetime import datetime
from optparse import OptionParser
from urllib.parse import unquote
INDEX_PAGE = 'index.html'
def fill_file_info(path, need_body):
file_stat = os.stat(path)
response_headers = {
'Date': date... |
16,756 | 2a95f1c1b67ba8495ca0cab23bef64164d5116b6 | import numpy as np
from flareFind import procFlares
path = '/astro/store/gradscratch/tmp/scw7/tessData/lightcurves/gj1243/'
filenames = np.genfromtxt('gj1243_files.txt', comments='#', dtype='str')
procFlares('gj1243', filenames, path, makePlots=True, clobberGP=True)
|
16,757 | 9f0ce8d3de2c3e38338d3be6fce861518369c718 | import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GObject
from game import Player, Board, desc, pointsCal
class SumGtk(Player, Gtk.Window):
def __init__(self, data):
Gtk.Window.__init__(self, title="Eclipse GTK")
self.S = data
self.SLen = len(data)
sel... |
16,758 | d574d24bd86398efb499e2f8a11f2ed2595e9b17 | """Check Ceph overall cluster health.
This check parses `ceph status` output and generates various metrics. It is
intended to be run on all Ceph mons.
"""
import argparse
import json
import logging
import re
import subprocess
import nagiosplugin
DEFAULT_LOGFILE = "/var/log/ceph/ceph.log"
_log = logging.getLogger("n... |
16,759 | f798e6e4bdc836233feb1f8a0955d1fec5981924 | #!/usr/bin/python3
__author__ = "BaelTD"
__copyright__ = "Copyright 2019, Automatize the automator"
__credits__ = ["David Morelli"]
__license__ = "GPL"
__version__ = "1.0.0"
__maintainer__ = "BaelTD"
__email__ = "morelli.d14@gmail.com"
__status__ = "Production"
import sys
import glob
import os
from pyzbar.pyzbar impo... |
16,760 | 6f22e23f7a038ba99a85dc52fb6ae1466408bb30 | def max_two(a,b):
if a>b:
return a
else:
return b
def max_three(a,b,c):
return max_two(a,max_two(b,c))
print(max_three(50,100,30))
|
16,761 | b9e4ce56b8f1ac54afeb3f7feb9d9dcdff7c10d4 | """Tables definitions for data from the EIA bulk electricity aggregates."""
from typing import Any
RESOURCE_METADATA: dict[str, dict[str, Any]] = {
"fuel_receipts_costs_aggs_eia": {
"description": (
"Aggregated fuel receipts and costs from the EIA bulk electricty data."
),
"sch... |
16,762 | 81844f582dcdb0ca290190d71c5cb00f3f1adbc6 | #!/usr/local/bin/python3.4
import time
import csv
import urllib.request, urllib.parse, urllib.error
import xlrd
import pandas as pd
import platform
#from xlutils.display import cell_display
#from xlrd.sheet import Cell
timerStart = time.time()
# build an empty Pandas dataframe to concatenate the retrieved data into
c... |
16,763 | 9bc1633a4c90e8c638c28382dcb292e4853db24c | from hadmin.conf import QueueGenerator
from unittest2 import TestCase
class QueueGeneratorTest(TestCase):
def setUp(self):
self.root = QueueGenerator.load_dir('data/queues').generate()
self.prod = self.root.subqueue('prod')
self.dev = self.root.subqueue('dev')
self.dev1 = self.dev... |
16,764 | 75fa488b923d33d0733001b3d63a92b91848cde6 | #!/usr/bin/env python
"""
A very simple, rather ugly remote debugging client for Python, for viewing the state
of a remote Python process.
Run with ./rdb_client.py [hostname [port [passcode]]]
Author: Christopher Swenson (chris@caswenson.com)
Homepage: http://github.com/swenson/python_remote_debugger
License: MIT... |
16,765 | fa24e79723f48a9c8830698df5c87155a20fe004 | #!/usr/bin env python
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# Simple script to extract the path of the TAG outputs of Tier0 monitoring,
# open them and chain them in a single TChain
# Uses the pathExtract library to extract the EOS path
# Options:
# -r RUNNUMBER, --run RUNNUMBER ... |
16,766 | 7d491d9c4c9151c8c6754331801dae592f5573ae | from itertools import product
import json
import numpy
cube = numpy.array(range(1, 9)).reshape(2, 2, 2)
pcube = [
cube[0 ,0 ,0 ],
cube[0 ,0 ,0:2],
cube[0 ,0:2,0:1],
cube[0 ,0:2,0:2],
cube[0:2,0:1,0:1],
cube[0:2,0:1,0:2],
cube[0:2,0:2,0:1],
cube[0:2,0:2,0:2],
]
for (i, (a, b)) i... |
16,767 | 74c9254ac1ca3655e5c028179f5a0023059889b3 | import logging
from datetime import timedelta, datetime
import unicodedata
from urllib.error import HTTPError
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_CODE, STATE_UNAVAILABLE
from homeassistant.helpers.entity import Entity
import homeass... |
16,768 | de9ced14196fe38cadcde40cad107d07dc8b81f6 | import random
import string
def random_string_generator(size=15,chars= string.ascii_uppercase + string.digits):
l = ""
for i in range(size):
l += random.choice(chars)
return l |
16,769 | 509b65e6da71139b073e8a4b846c3a8e71371271 | class Employee:
def __init__(self,name,age,salary):
self.name = name
self.age = age
self.salary = salary
def getinfo(self):
print(f"The employee name is {self.name}")
print(f"The employee age is {self.age}")
print(f"The employee salary is {self.salary}")
class Pro... |
16,770 | cd4151679e91255c0af04ca1b465bdec3e9f06d0 | import time
import pyspark.sql.functions as F
sc._jsc.hadoopConfiguration().set("fs.s3n.awsAccessKeyId", AWS_ACCESS_KEY)
sc._jsc.hadoopConfiguration().set("fs.s3n.awsSecretAccessKey", AWS_SECRET_KEY)
class LoanData():
def __init__(self, config):
"""
Initialize Loan Dataset object.
Input: c... |
16,771 | 65fe7ad0d7180617b9564ba0cf71b5b82bd86542 | buah = int(8000)
jumlah = int(input("Masukan Berat Buah :"))
x = buah*jumlah
print("Harga Sebelum Diskon",x)
y = x*0.85
print("Harga Setelah Diskon",y) |
16,772 | 3b633868e02a64831b1fea473fc6cc01de2305d1 | import uuid
import jwt
class BaseAuthenticator(object):
def __init__(self, *args, **kwargs):
pass
def authenticate(self, request):
raise NotImplemented
def create_token(self):
raise NotImplemented
class JWTAuthenticator(BaseAuthenticator):
def __init__(self, *args, **kwargs... |
16,773 | 99b98e3ec03966f461d6dee05b2c441bf01c441e | import random
list_result = ['outlook is good','ask again later','yes','no','most likely no','most likely yes','maybe','outlook is not good']
q1 = input("Please ask me a question:")
print(list_result[random.randint(0,len(list_result)-1)])
q2 = input("Please ask me a question:")
print(list_result[random.randint(0,len(li... |
16,774 | 6f16229e54964d0cded97e16c497b4a42620d09e | from django.core.management.base import BaseCommand, CommandError
import time
from getpass import getpass
import tweepy
from django.conf import settings
from socialbeer.core.tasks import process_tweet
USERNAME = getattr(settings, "TWITTER_USERNAME", None)
PASSWORD = getattr(settings, "TWITTER_PASSWORD", None)
TRACK... |
16,775 | 38422fd55b7a3bfd8d58801e6109767d046a69e0 | M = int(input('Enter your full marks : '))
per = M/500*100
if(per>=90):
print('Your Grade is A')
elif(per>=80):
print('Your Grade is B+')
elif(per>=70):
print('Your Grade is B')
elif(per>=60):
print('Your Grade is C+')
elif(per>=50):
print('Your Grade is C')
else:
print('You got Grade D ') |
16,776 | cc74e55f439fbfd56a53b9b4f4583725ce1ff8d6 | ## IMPORTS ##
from tika import parser
## CLASS ##
class ReadPDF():
def __init__(self, filepath, filename, *args, **kwargs):
self.content = str(parser.from_file("%s%s" % (filepath, filename))["content"])#, "G:\\Automation\\Tika\\tika-server.jar")
def build_content_lines():
lines = []
... |
16,777 | ec19aa83e5f36531f16ccea30e2e01b1f60b02a9 | from datetime import date
from decimal import Decimal
# pylint might have a problem with this pydantic import
# add this exception in ".pylintrc" so pylint ignores imports from pydantic
# "--extension-pkg-whitelist=pydantic"
from pydantic import BaseModel
class UserBase(BaseModel):
cpf : str
private : bool
c... |
16,778 | 161319dbd4615edb0281e9e061bafa1c88b0814d | from tkinter import ttk
from tkinter import *
import pandas as pd
####################################################################################################################
# backend ##
###################... |
16,779 | e47850bc34e5a870342f78d7beffff272306f50f | #coding:utf-8
'''
数据类型
'''
import sympy
sympy.init_printing()
from sympy import I, pi, oo
# 整数符号
i = sympy.Integer(19)
print('type of i:',type(i),',i is real:',i.is_real,',i is integer:',i.is_Integer,',i is odd:',i.is_odd)
print(i ** 50)
# 浮点数符号
f = sympy.Float(2.35)
# 创建指定小数位数浮点数
f1 = sympy.Float(0.3,25)
print(f1)
... |
16,780 | 4e62d65830b97b09c82f6c82af37ac0acf5c27af | # ____ e.. _______ E..
#
#
# c_ Equality E..
# SAME_REFERENCE 4
# SAME_ORDERED 3
# SAME_UNORDERED 2
# SAME_UNORDERED_DEDUPED 1
# NO_EQUALITY 0
#
#
# ___ check_equality list1, list2
# """Check if list1 and list2 are equal returning the kind of equality.
# Use the values in the Equalit... |
16,781 | 8346e9eb14fd0b36937e260b0b334f8f787a6d63 | import math
import numpy as np
from numpy import histogram
import matplotlib.pyplot as plt
with open("sdss-stars.txt") as f:
lines = f.readlines()
vmag = [float(line.split('|')[12]) for line in lines]
j = [float(line.split('|')[9]) for line in lines]
h = [float(line.split('|')[10]) for line in lines]
... |
16,782 | 7af5b0cf0c0a37cf42b78f2be6d79d3fb6af6e01 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import Counter
def decrypt_message(lines: [str]) -> str:
"""
Decrypts the message by selecting the most frequent character at each position.
Args:
lines (list of str): The repeated message lines.
Returns:
str: The decryp... |
16,783 | c3d9c2642ef36b5ad69d7cce37bbfa4ff0944820 | from django.apps import AppConfig
class ReqresConfig(AppConfig):
name = 'reqres'
|
16,784 | 0d2aef838a2463fbbceb3ee0a8b771b753b81d51 | from aiohttp import web
from Email.EmailRestfulClass import EmailRestful
from User.UserRestfulAPIClass import UserRestfulAPI
from Config.MySqlConnector import MySqlConnector
def Main():
app = web.Application()
rst = EmailRestful()
usr = UserRestfulAPI()
# EMAILS
app.add_routes(
[web.post... |
16,785 | ecd1d8531e06fef4a15d118774e913daab41bd49 | #!/usr/bin/python3
import pytest
from common import *
filename = os.path.basename(__file__)
@pytest.fixture
def tc_setup():
'''Initializes log file in TWT log module'''
TWT_set_log_filename(filename)
@pytest.mark.parametrize("sarg, carg", [
(' -serv -cauth -msgcb ', ' -cauth -msgcb '),
])
def test_t13... |
16,786 | 9ad57a31e0e2b94cb41caa83031bbb1db0c1edd4 | # Generated by Django 3.1.7 on 2021-03-28 19:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('content', '0008_auto_20210328_1852'),
]
operations = [
migrations.CreateModel(
name='CaseGrades',
fields=[
... |
16,787 | 3d2b1492901ad48feebec39f02ac7756c4b7ef5a | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 21 11:24:24 2019
@author: 3874034
"""
#from indexerSimple import IndexerSimple
from IRModel import IRModel
from TextRepresenter import PorterStemmer
from math import log
class Okapi(IRModel):
"""
index : objet IndexerSimple
"""
def __... |
16,788 | e3bdc863c67439d88e9d7348291d544e5c266a0f | # one of them is True will com back as True
print(True or False)
print(2 or 0) # one of them is True will return True i.e 2
# one of them is False will come back as False
print(True and False)
print(2 and 0) # one of them is False will return False i.e. 0 ( Falsy value)
# not True will return False
print(not True)
... |
16,789 | 97a6274b78a916539d67eddeb0c2f6bc0e45b71c | from json import dumps as json_dumpstring
import time
class Logger:
"""
Utility class used to handle server-side logging in the event of certain actions
"""
def __init__(self):
pass
@staticmethod
def song_added(song, playlist_id):
"""
Prints server logging on success ... |
16,790 | 2529caa2bc4e8386f95a3d9d30ef98cfa897ffa2 | from django.contrib import admin
from django.utils.html import format_html
from django.core.urlresolvers import reverse
from django.db import models
from django_summernote.widgets import (SummernoteWidget)
# Register your models here.
from .models import (Venue, Event, EventRegistration)
# from django_google_maps imp... |
16,791 | 3b1d247aff186bc1b16fc599efa8de6a0ea95dbd | #!/usr/bin/env python
# Copyright (c) 2011 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Simple test suite for toolchains espcially llvm arm toolchains.
Sample invocations
tools/toolchain_tester/toolchain_teste... |
16,792 | 958a047cbfdd33091e3540c8227a0606fe702d63 | #
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
from .source import SourceBraintree
__all__ = ["SourceBraintree"]
|
16,793 | 0b444d80d55f59bd545349e0fb5c51db3087794f | import os;
pfx = os.environ["PREFIX"];
cmds_ = [
{
"name": "predict",
"description": "Gives a random response to predict what you ask.",
"type": "Misc",
"args": "<question>"
},
{
"name": "snipe",
"description": "Sends the most recently deleted message.",
"type": "Misc"
},
{
... |
16,794 | 8f1f7892c28198eb2cfe6bcdb84b269581429bbe | # -*- coding: utf-8 -*-
from zope.interface import Interface
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
class IEjnApplicants4FundingLayer(IDefaultBrowserLayer):
"""Marker interface that defines a browser layer."""
class IFundingReqBase(Interface):
"""Marker interface for funding req... |
16,795 | cfcac25b4f017b3f950bfac126ebb1227048c097 | import typing
import pytest
import requests
from apimoex import client
@pytest.fixture(scope="module", name="session")
def make_session():
with requests.Session() as session:
yield session
def test_iss_client_iterable():
assert issubclass(client.ISSClient, typing.Iterable)
def test_repr(session)... |
16,796 | 631da250a19b325cb12c47d9274aeec525b0b675 | from google.appengine.ext import webapp
from google.appengine.api import users
from google.appengine.ext.webapp import util
from google.appengine.api import memcache
from google.appengine.ext.webapp import template
import os
from models import *
import misc
import datetime
class Main(webapp.RequestHandler):
def g... |
16,797 | 024bafba4e0c03729568f62ec1609d18116dd8b9 | from sqlalchemy import create_engine, Column, Integer, String, DateTime
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.engine.url import URL
import product_crawlers.settings
DeclarativeBase = declarative_base()
def db_connect():
"""
Performs database connection using database settin... |
16,798 | b4ee1933b535458a59efe2c0e4c252fdb8afdbdc | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class AppLogicConfig(AppConfig):
name = 'app_logic'
verbose_name = _('logic')
|
16,799 | 62f74678e008225a6b48e2806c1dd3286e60ba13 | from struct import *
import warnings
import re, os, json
from WADParser.Lumps import *
import matplotlib # required for DLL not found error
from skimage import io
import networkx as nx
from WADParser.WADFeatureExtractor import WADFeatureExtractor
import itertools
import subprocess
import numpy as np
from skimage impor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.