index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
997,600 | 425dc6f120334a6a92afc53278b331db1d6d5d21 | _offset_main_0:
BeginFunc 4 ;
_tmp0 = 0 ;
Return _tmp0 ;
EndFunc ;
f_main:
main:
BeginFunc 24 ;
_tmp1 = 1 ;
IfZ _tmp1 Goto _L1 ;
_tmp2 = 1 ;
PushParam _tmp2 ;
LCall _PrintInt ;
PopParams 4 ;
Goto _L0 ;
_L1:
_tmp3 = 2 ;
PushParam _tmp3 ;
LCall _PrintInt ;
PopParams 4 ;
_L0:
_tmp4 = 3 ;
PushParam _tmp4 ... |
997,601 | eb31053918e28ee0a4c0c74aa2e4080851844b2c | import os
import json
import numpy as np
import tqdm
from PIL import Image
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.keras.utils import Sequence
from utils import transform_targets, preprocess_image , yolo_anchors, yolo_anchor_masks, load_fake_dataset
class COCODataset(Sequence):
IMA... |
997,602 | f15082af78abff1e4f20d96c48408258238db24d | import h5py
import math
import random
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
"""
Created by Mohsen Naghipourfar on 9/2/18.
Email : mn7697np@gmail.com or naghipourfar@ce.sharif.edu
Website: http://ce.sharif.edu/~naghipourfar
Github: https://git... |
997,603 | 600be341e7dfed4f58ae3867f3a265bc13b41229 |
import sys
#TODO: auto convert component __init__ into initialize_variables()
def convert():
"""A crude converter for OpenMDAO v1 files to OpenMDAO v2"""
cvt_map = {
'.add(' : '.add_subsystem(',
'.add_param(' : '.add_input(',
'.params': '._inputs',
'.unknowns': '._output... |
997,604 | e042b7821ceb2fbee5305b0a5fe86ab8284b8d5b | from sqlalchemy import ForeignKeyConstraint
from sqlalchemy.orm import relationship, backref
from sqlalchemy.ext.associationproxy import association_proxy
from application import db
class StationBase(object):
def refuel(self, liters, kilometers):
self.liters += liters
self.kilometers += kilometer... |
997,605 | 80d322a5d3d0385ffce474aeefa1928c11d713c8 |
TC = int(input())
for tc in range(1, TC+1):
N, M = map(int, input().split())
v = list(map(int, input().split()))
sum = 0
for i in range (M):
sum += v[i]
minv = maxv = sum
for i in range(1, N - M + 1):
sum = 0
for j in range(i, i + M):
sum += v[j]
... |
997,606 | abf96d9b253e00b3150b44e9bac4500e7a2daff3 | from rest_framework.views import APIView
from django.views.decorators.csrf import csrf_exempt
from rest_framework.response import Response
from rest_framework import status
import json
from django.core import serializers
from .models import *
from .serializers import *
from rest_framework import parsers
from collection... |
997,607 | 1bcdd37ce6ef6398c074a67550bbd9be6abeafe6 | from . import account_move
from . import sale_order
from . import sale_order_line
|
997,608 | 0d8a7510a7699c667a21cd94ce8b1059e0ae3768 | # 使用python代码解决生产中排产的可能组合的问题。该问题先以没有人员约束为起点,为任意数量
# 的釜来排产,举例来说排两个釜,可选择不同产品种类组合,每个釜只可以选择一个种类。起始版
# 本为列表版。
'''此版本不需要输入开多少条生产线,会根据生产线条数自动算所有情况。'''
import itertools
def sumoftuple(tuple):
sum = 0
for i in tuple:
sum = sum + i
return sum
#各条生产线生产不同种类产品时的不同CRF,来源:capacity review表
crfR1 = [4,5.7,3.8]
crfR2 = [2]
... |
997,609 | 3a23dd3fbfb57779754d7780b650e856b53936f4 | class CustomList(object):
def __init__(self):
self.custom_list = []
def add(self, node):
index = self.get_index(self.custom_list, node) # hitta den plats där den ska sättas in
self.custom_list.insert(index, node)
def delete(self, node):
index = self.bin_search(self.cus... |
997,610 | e92dc3498786ace17fc6ffaae97fd6de8d82c759 | import numpy as np
import pandas as pd
from datetime import datetime
import matplotlib.pyplot as plt
import seaborn as sns
from google.cloud import language_v1
from google.cloud.language_v1 import enums
from google.cloud import storage
#Initialize Storage Client and download tweets csv file
storage_client = storage.C... |
997,611 | ba0bc1633f6097d74e8d006b9b626600239a001b | import math
import random
from collections import namedtuple, deque
import gym
import numpy as np
import gym_minigrid
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.distributions.categorical import Categorical
from IPython.display import clear_output
import ... |
997,612 | daa21e83ae8358e4492542d923c7ea815b247721 |
from xai.brain.wordbase.adjectives._stocky import _STOCKY
#calss header
class _STOCKIEST(_STOCKY, ):
def __init__(self,):
_STOCKY.__init__(self)
self.name = "STOCKIEST"
self.specie = 'adjectives'
self.basic = "stocky"
self.jsondata = {}
|
997,613 | 334e7733cc2e88c3184694d5f623572f2d7aefac | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-07-03 11:57
from __future__ import unicode_literals
import ckeditor_uploader.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('pages', '0004_lunchsteps_title'),
]
operation... |
997,614 | 54989e91287ed43f72b0f2804c98c7217dc4e7e5 |
def is_in_request_parameters(request, param_name):
result = False
try:
if not request:
raise Exception('Request object not provided')
if not param_name:
raise Exception('Parameter name not provided')
if request.method == 'GET':
if param_name in reques... |
997,615 | c960764e12f2651019d4cb896b88856a76b81ff8 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import urllib
from xml.etree import ElementTree as ET
from .define import *
import time
def parse_xml(web_data):
if len(web_data) == 0:
return None
xmlData = ET.fromstring(web_data)
msg_type = xmlData.find('MsgType').text
... |
997,616 | 7989156af279028f5973b1b04d3c3ca738751f34 | import json
import sys
class Scenario:
"""
A class used to represent an attack scenario
Attributes
----------
probabilty : float
probability of scenario occurring, 0-1
nodeKeys : [str]
list of node keys, each key represented by a string
Methods
-------
combine(sce... |
997,617 | 93d06de5390dbb5d40342f7434724a2b50fbbadf | from django.db import models
from foodpool.v1.core.models import TimestampedModel, CanadaAddressModel, AvailabilityModel
class MenuManager(models.Manager):
def create(self, **required_fields):
menu = self.model(**required_fields)
menu.save()
return menu
class Menu(TimestampedModel):
... |
997,618 | 9d18c4c5b8ee4edd580302b889440d2b806aa4e3 | from db import db
from datetime import datetime
class Address(db.Model):
id = db.Column(db.Integer, primary_key=True)
firstName = db.Column(db.String(80), nullable=False)
lastName = db.Column(db.String(80), nullable=False)
city = db.Column(db.String(80), nullable=False)
address = db.Column(db.Strin... |
997,619 | 1ec803224b1356341a84dd42b566718775f2bb47 | from get_partial_match import get_partial_match
def kmp_search(full_str, sub_str):
"""finds all beginning index of sub_str occurred in full_str
search faster by skipping already known matched positions
runs in O(n)
"""
n, m = len(full_str), len(sub_str)
result = []
pi = get_partial_match(... |
997,620 | 7e92f962049dc397d6171770405644fb8ea5b292 | from unittest import TestCase
import mock
from robust_urls.utils import locale_context, try_url_for_language
from django.core.urlresolvers import Resolver404
class LocaleContextTestCase(TestCase):
@mock.patch('robust_urls.utils.translation')
def testWillCallTranslationActivateBeforeCallingBlock(self, ... |
997,621 | 05a9cbad06470ae56f81d99ab8fd91303b5e8daf | from flask import render_template, flash, redirect, url_for
from ...utils.flash_errors import flash_errors
from ...utils.zelda_modelo import ZeldaModelo
class FuncionalidadeListarNegocio:
def exibir():
funcionalidades = ZeldaModelo.lista_funcionalidades()
return render_template('funcionalidade_lis... |
997,622 | bea1cdedec2b076888e99216e137886bd66da3f1 | __author__ = 'liu.xingjie'
#BFS
class Solution:
# @param beginWord, a string
# @param endWord, a string
# @param wordDict, a set of string!!!wordDict is a set type!!!
# @return an integer
def ladderLength(self, beginWord, endWord, wordDict):
wordDict.add(endWord)
aplha = 'abcdefghijk... |
997,623 | bf1751628a0df1e07e43a8a5ee350d96acad3191 | import os
print("Hello from aayushi, in 2019")
|
997,624 | f3023b7368fab2870f9db9122bf0038f446622cf | CMD = """
SELECT
a1.*, a2.s_dq_adjfactor
FROM
(SELECT * FROM AShareEODDerivativeIndicator WHERE trade_dt = '{date}') AS a1 INNER JOIN
(SELECT * FROM AShareEODPrices WHERE trade_dt = '{date}') AS a2 ON
(a1.s_info_windcode = a2.s_info_windcode)
WHERE
LEFT(a1.s_info_windcode, 2) IN ('60', '00', '30')
"""
cols =... |
997,625 | 10c3a1f6933583f9e4b90b11148881f93e30d866 | from collections import deque
m, n = map(int, input().split())
mat = [list(input()) for _ in range(n)]
check = [[False] * m for _ in range(n)]
w, b = 0, 0
dx = [-1, 1, 0, 0]
dy = [0, 0, -1, 1]
def bfs(x, y):
q = deque()
q.append((x, y))
cnt = 1
check[x][y] = True
while q:
x, y = q.pople... |
997,626 | bf198836faf4716e9d118ca08e7f983808a7948d | from django.db import models
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
from django.contrib.contenttypes.models import ContentType
# Create your models here.
class Client(models.Model):
userid = models.IntegerField(primary_key=True)
username = models.CharField(max_length=... |
997,627 | 13017394df56d2d97e3388605359b89267a8faaf | import pandas as pd
import sqlite3
import os
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import numpy as np
dirname = "D:/Users/mgcha/Downloads"
# fpaths = [os.path.join(dirname, "41467_2018_7746_MOESM7_ESM.txt")]
con = sqlite3.connect(os.path.join(dirname, "41467_2018_7746_MOESM.db"))
# for ... |
997,628 | dea171d6ea141f6f3628d00afcb4d134ad95b3ad | # Jake Burton
# 40278490
# SET11508 Emergent Computing for Optimisation.
# Import relevant libraries.
import pandas as pd
import numpy as np
from deap import algorithms
from deap import base
from deap import creator
from deap import tools
# import matplotlib.pyplot as plt
# from scipy.stats import shapiro, ttest_ind,... |
997,629 | 267d5ed158875ec23d720946d4927a642357c28a | import math
import wx
class SuShu(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "SuShu Frame")
self.shu = []
self.sushu = []
self.panel = wx.Panel(self)
size = wx.FlexGridSizer(0, 2, 10, 10)
ShuStaticText = wx.StaticText(self.panel, -1, "Shu")
... |
997,630 | 643a2187ff6fb6ba22d62dbadc43b6b1d1b8a7b4 | #! /usr/bin/env python
from pylab import plot, show, savefig, grid, gca, legend, figure, title, \
xlabel, ylabel, ylim
import silver_uniformpfem50
import silver_uniformpfem4
import silver_pfem
import silver_hpfem
def do_plot(x, y, n, l, color="k", label=""):
n_r = n - l - 1
if n_r == 0:
plot(... |
997,631 | 3d2373630ca6a384eb6e4fa2132bf0e141d5216a | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 18 14:18:27 2019
@author: Guest Group
"""
from ._free_property import metaProperty, FreeProperty
__all__ = ('PropertyFactory',)
# %% Property Factory
def PropertyFactory(fget=None, fset=None, clsname=None, doc=None, units=None,
slots=None):
"""... |
997,632 | 5bd4def52345c5d7a97d7c6d35e81834b0ea4a90 | #!/usr/bin/python2.7
import codecs
import re
import json
import os
import argparse
from snifferCommons import *
def main():
# input: allTopicTweets = [(tweet 1 id, tweet 1 text, tweeter user id, mentioned screen_names, hashtags, tweet class), ...],
# histories = [(user 1 id, [tweet 1 text, tweet 2 ... |
997,633 | e278d344f4a98e6fbcea1031d91e458b781a3855 | n=int(input())
s=list(map(int,input().split()))
leftL=[0]
rightS=[0]*n
for i in range(n):
if i==0:
leftL[i]=0
else:
leftL.append(max(leftL[i-1],s[i-1]))
for i in range(n-1,-1,-1):
if i==n-1:
rightS[i]=float('inf')
else:
righ... |
997,634 | 4177f6fca2b6a01300696852dc81ada0890e0909 | #!/usr/bin/python3
""" a simple script of I/O"""
def read_file(filename=""):
"""is a function to print the content of a file"""
with open(filename, 'r', encoding='utf-8') as fl:
print(fl.read(), end='')
|
997,635 | d1faacaf71f3766058e6c5739cb92d7c49ff70ce | """A simple Naive-Bayes classifier designed to train on any number of features,
and then classify documents into one of two mutually exclusive categories.
Implements the algorithm described for spam filtering here:
http://en.wikipedia.org/wiki/Naive_Bayes_classifier#Document_classification
"""
from collections import ... |
997,636 | 2b1b9fa5db1a864e0353fced311113efb30982e4 | '''
author: faraz mazhar
descri: A PySpark script.
MapPartition on DataFrame.
DataFrame structure:
+-------+----------+
| years | salary |
+-------+----------+
| 1.1 | 39343.00 |
| 1.3 | 46205.00 |
| 1.5 | 37731.00 |
| ... | ... |
+-------+----------+
Answer on 'salary_mini.csv':
+-----+--------+
|yea... |
997,637 | 59328e2e084846d57151f208bca26f9c3f472fb7 | from django.contrib.sitemaps import Sitemap
from plumbaker.apps.press.models import Release
from plumbaker.apps.inventory.models import Good
import datetime
class NewsSitemap(Sitemap):
changefreq = 'monthly'
priority = 0.5
def items(self):
return Release.live.all()
def lastmod(self, obj):
retu... |
997,638 | f28ac7d47bd2987c813e575347525fb196d6a425 | from pprint import pprint
import datetime
from Google import Create_Service
CLIENT_SECRET_FILE = 'credentials.json'
API_NAME = 'calendar'
API_VERSION = 'v3'
SCOPES = ['https://www.googleapis.com/auth/calendar']
service = Create_Service(CLIENT_SECRET_FILE, API_NAME, API_VERSION, SCOPES)
now = datetime.datetime.u... |
997,639 | 46862fa411015afaa2cabc40b863503edb0a38ab | from typing import Optional, List
from base64 import urlsafe_b64decode
import iso8601
from .extensions import broker, APP_QUEUE_NAME
from . import procedures
@broker.actor(queue_name=APP_QUEUE_NAME)
def create_formal_offer(
payee_creditor_id: int,
offer_announcement_id: int,
debtor_ids: List[i... |
997,640 | aec5b62cbcf55a1c05716cf4fba5442256c0fb88 | import uuid
import pytest
from .pages.product_page import ProductPage
from .pages.login_page import LoginPage
from .pages.basket_page import BasketPage
from .pages.main_page import MainPage
import time
# @pytest.mark.parametrize('link', ["http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/?promo=offe... |
997,641 | 2111a72d2f61d601bc91f6fd7cbf1d176e100e01 | from entity_linkage.normalization.entity_normalization import EntityNormalization
from entity_linkage.normalization.sgtb import read_data
from entity_linkage.normalization.sgtb.structured_gradient_boosting import StructuredGradientBoosting
import gzip, time, os, sys
from sklearn.externals import joblib
class Structur... |
997,642 | 694baf50fa6a67c166a4ae7fadaaa5bdffdaed0d | from scrapy import cmdline
# 免认证
#上海厚崇资产-投资顾问
#cmdline.execute(['scrapy', 'crawl', 'FundNotice_PingAnDaHua', '-a', 'jobId=0L'])
#cmdline.execute(['scrapy', 'crawl', 'FundNotice_PingAnDaHua', '-a', 'jobId=0L'])
#中邮证券-券商资管净值
#cmdline.execute(['scrapy', 'crawl', 'FundNav_zystock', '-a', 'jobId=0L'])
#渤海证券-券商资管净值
#cmdline... |
997,643 | 23119007af7ace382e6e58ff48d48be6089c6b17 | from lib.boogie.ast import stmt_changed, AstAssignment, AstId, AstHavoc, \
AstAssert, AstTrue, replace
from lib.boogie.z3_embed import Or, And, Int, And, stmt_to_z3, \
AllIntTypeEnv, satisfiable, model
from lib.boogie.bb import BB
from lib.boogie.ssa import SSAEnv, is_ssa_str
from lib.boogie.predicate_t... |
997,644 | 37b18f5ee7c926135cc0b8c75f53e82b81c003d5 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import sys, os, glob
if len(sys.argv) < 3:
print('Usage:')
print(' python3 {} <input file> <solution prefix>'.format(sys.argv[0]))
sys.exit(0)
input_file = sys.argv[1]
sol_file = sys.argv[2]
with open(input_file,... |
997,645 | 3b61f16f8063b29b01d139b8447479c7db86f301 | '''
Fornecido um número inteiro n (n≥10), exibir o valor correspondente aos dois
dígitos mais à direita de n, sem utilizar o operador de resto.
'''
n = int(input("n: "))
print(n - (n // 100 * 100))
|
997,646 | 918352b49a5db2011d01ac5bfedc18d61db13563 | #!/usr/bin/env python
import sys
import platform
import serial.tools.list_ports
import time
from dronekit.mavlink import MAVConnection
from pymavlink import mavutil, mavwp
from dronekit import connect
import classes
import threading
from threading import Thread
from subprocess import Popen
CLOSE_MSG = "1"
INIT_MSG =... |
997,647 | a02759df6c42560a50357e9301bf01bde3fcd8fa |
import pytestemb as test
def case_01():
test.assert_true(1==1, "1==1")
test.assert_true(1==2, "1==2")
def case_02():
test.assert_true(1==1, "1==1")
test.assert_true(1==2, "1==2")
def case_03():
test.assert_true(1==1, "1==1")
test.assert_true(1==2, "1==2")
def case_04():
test... |
997,648 | d2bca9d5c528f22fc793fc16e5621fe2a7ba09f0 | import re
def change_variable_to_asn_style(variable):
return re.sub("_", "-", variable)
def change_variable_to_python_style(variable):
return re.sub("-", "_", variable)
def get_supported_messages_in_modules(file):
supported_msgs_in_modules = {}
lines = []
with open(file, "r") as fd:
for... |
997,649 | a9a27a892fd39ec05738649bc02db00d7970e959 | from __future__ import print_function, division
from typing import Optional
import numpy as np
from .augmentor import DataAugment
class CutNoise(DataAugment):
r"""3D CutNoise data augmentation.
Randomly add noise to a cuboid region in the volume to force the model
to learn denoising when making... |
997,650 | a1b52d906b1d86ecff4a697ba361c5a9e1816fd7 | import re
class Solution:
# @param {string} s
# @return {boolean}
def isPalindrome(self, s):
letters = map(lambda x: x.lower(), re.findall('[a-zA-Z0-9]', s))
count = len(letters)
if count <= 1:
return True
i = 0
j = count-1
... |
997,651 | 5ffb98855e4faa2401ea0077e317574683dadc3d | import numpy as np
from torch.utils.data.dataset import Dataset
from torchvision import transforms
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
import matplotlib.pyplot as plt
def stat(light):
print(light.max(), light.min(), light.mean(), light.var())
# light = np.genfromtxt('20180827_Mouse1... |
997,652 | 5f28a55b88622b64c5483e6880153dd921a6685e | from django.shortcuts import render
from concept_the_register.titles.models import Title
from rest_framework import viewsets
from concept_the_register.titles.serializers import TitleSerializer
# Create your views here.
class TitlesViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows Titles to... |
997,653 | ffb8938d639475b7476c32a696d15fd9e41f5e74 | import os
# 변환할 파일 경로 정의
import re
global path
path = "/Users/leewoojin/Desktop/isoi-opti"
global sourceFileList
sourceFileList = []
# 디렉토리 리스트
global directoryPathList
directoryPathList = []
# 변환시킬 파일 확장자명 리스트 정의
global __AllowFileExtensionList
__AllowFileExtensionList = ["js", "JS", "txt", "TXT"]
def scanDirec... |
997,654 | 86896de4828822a7b6fe226ec1e98e7b4b15a9e6 | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 22 16:17:01 2018
@author: bmpatel
"""
sum=0
for i in range(0,5):
ino=int(input("Enter Number="))
sum=sum+ino
avg=sum/5
print(avg) |
997,655 | 141e856043e725189007cc990a939a9362457b69 | from flask import Blueprint
from . import forms
auth = Blueprint('auth',__name__)
from . import views |
997,656 | 8458126a0b2d428a65f981f8f5dad097bd44527f | """Panda package management for Windows.
DC/OS installation state descriptor type definition.
"""
import json
from pathlib import Path
from common import logger
from common import constants as cm_const
from common.storage import ISTOR_NODE, IStorNodes
from core import exceptions as cr_exc
from core import utils as cr... |
997,657 | 853563b1dda5099cc893d715737863348d62c778 | #!/usr/bin/env python
"""
_Step.Executor.StageOut_
Implementation of an Executor for a StageOut step
"""
from __future__ import print_function
import logging
import os
import os.path
import signal
import sys
from WMCore.Algorithms.Alarm import Alarm, alarmHandler
from WMCore.FwkJobReport.Report import Report
from W... |
997,658 | d2a54510389f90498da93dc355339e2d168e068e | import os
import re
import nltk
import numpy as np
from numpy.random import seed
seed(1)
import sys, gensim, logging, codecs, gzip
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize as wt
from nltk.tokenize import sent_tokenize as st
from gensim.models import Word2Vec
from numpy import argmax
fro... |
997,659 | c66344dd52921124076283c662b0554b2290b7e0 | # -*- coding: utf-8 -*-
'2019-06-18 Created by zhulk'
import unittest
import os
from config.url import caseDir
from HTMLTestRunner_cn import HTMLTestRunner
from public.common import NOW
from config.url import reportDir
from email.mime.text import MIMEText
from email.header import Header
from email.mime.multipart impo... |
997,660 | 6df1c0b2654f60627eed6fa4b961118098f42180 | # -*- coding: utf-8 -*-
"""
@author: Wei, Shuowen
https://leetcode.com/problems/squares-of-a-sorted-array/
"""
class Solution(object):
def sortedSquares(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
"""
if nums[0] >= 0: # [0, 1, 2, 3]
retu... |
997,661 | fc5603cbdd4d1a9e6646bc6515fdb5763b8b9cf7 | import pygame, sys
from pygame.locals import *
import math
import random
import Queue
# Define some colors
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
MAGENTA = (255, 0, 255)
RED = (255, 0, 0)
BLUE = (0, 0, 255)
YELLOW = (255, 255, 0)
DARKGRAY = (64, 64, 64)
GRAY = (128, 128, 128)
d... |
997,662 | 8a34f011763da0f0774e7ca69792c2f151503642 | from eve import Eve
from flask import request
from oauth2 import BearerAuth, oauth
from flask.ext.bootstrap import Bootstrap
from eve_docs import eve_docs
app = Eve(auth=BearerAuth)
oauth.init_app(app)
Bootstrap(app)
app.register_blueprint(eve_docs, url_prefix='/docs')
@app.route('/oauth/authorize', methods=['GET', ... |
997,663 | d60d2f536b1164dfcecad790b484cb247c044f2f | S = input()
def f():
if S == "keyence":
print("YES")
else:
n = len(S)
for i in range(n):
for j in range(i, n):
T = ""
for k in range(n):
if i <= k <= j:
continue
else:
... |
997,664 | f2e264c97437d38d1c0a2de5afe1ce2ecfeb787b | """
Formulário usado para apenas como facade para permitir o carregamento
e configuração async dos opcionais.
"""
from django import forms
class ProductForm(forms.Form):
pass
class ServiceForm(forms.Form):
pass
|
997,665 | 77f5212a84cf02c24a5212ac2c7eb302a5e5d203 | from board import Board
import copy
import random
import time
static_eval_count = 0
minimax_calls = 0
total_branches = 0
cutoffs = 0
def minimax(game_state, alpha, beta, depth_bound):
global minimax_calls
global total_branches
global static_eval_count
global cutoffs
if depth_bound == 4:
static... |
997,666 | 283455d301b21992204a7119c59c91f1bb13294a | #!@Author : Sanwat
#!@File : .py
import numpy as np
a= np.array([1,2,3,4])
b= a
print (b)
a[2]=0
print ("修改a后,副本b为:\n",b)
c= a[0:2]
print (c)
a[0]=0
print (c)
A=np.array([1,2,3,4])
d= A.copy()
print (d)
A[0]=0
print (d)#副本保留不变 |
997,667 | 40c1ab3c3b8ff2715910504b2d8997b9940f363c | from setuptools import setup, find_packages
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
# Arguments marked as "Required" below must be included for uploa... |
997,668 | b105e4a167eb02e76b0a3750384bd64a702a4561 | from django.utils.translation import ugettext_lazy as _
from models import Link
from cms.settings import CMS_MEDIA_URL
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from cms.plugins.link.forms import LinkForm
class LinkPlugin(CMSPluginBase):
model = Link
form = LinkForm
... |
997,669 | b40c468c8e36509e88895f90cc71a2098ca62a83 | import types
import time
import ujson
from stepist.flow import utils, session
from .next_step import call_next_step
class StepData(object):
flow_data = None
meta_data = None
def __init__(self, flow_data, meta_data=None):
self.flow_data = flow_data
self.meta_data = meta_data
def get... |
997,670 | 1cae88040ff3a88cdf4b0da91d5626e46726f0a4 | a, b = map(int, input().split())
if b<a or b == a:
print(1)
else:
#if (a*2)>b or (a*2) == b:
# print(2)
#else:
print((b//a)+1)
|
997,671 | 2c3c35956dc9cb639c206800ccc1111636926047 | # THIS FILE IS GENERATED FROM KIVY SETUP.PY
__version__ = '1.11.0'
__hash__ = '2c77434d845a97764a9255bc9b80b1803239f3dd'
__date__ = '20190615'
|
997,672 | 24cac047c09ca72f83d6ce017a01dc8bb0da3a83 | # -*- encoding: utf-8 -*-
# Copyright 2008 Agile42 GmbH, Berlin (Germany)
# Copyright 2007 Andrea Tomasini <andrea.tomasini_at_agile42.com>
# Copyright 2011 Agilo Software GmbH All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complia... |
997,673 | 627a498f9078a41e5700b6594ded67393a847e46 | import sys
from datetime import datetime
import numpy as np
import pandas as pd
# STATIC VARIABLES
# common month between time ranges used for stitching
STITCHING_MONTHS = (1, 7) # january and july
# common word between keyword sets used for scaling
CROSS_SET_KEYWORD = 'ozone'
def scale_monthly_data(unscaled_month... |
997,674 | 71699af219e0a6831df93a7456e69f247a6febf2 | from starlette.testclient import TestClient
from starlette_auth.tables import User
from app.main import app
def get_user():
user = User(email="ted@example.com", first_name="Ted", last_name="Bundy")
user.save()
url = app.url_path_for("user_update", user_id=user.id)
return user, url
def test_respons... |
997,675 | 52662ae9745928ced550606374f903f5d0ee40dd | #!/usr/bin/env python
import sys
op = sys.argv[1]
for line in sys.stdin:
if line[0] != "#" and op == "INS":
vals = line.split()
vals[2] = str(int(vals[1])+1)
line = "\t".join(vals) + "\n"
sys.stdout.write(line)
|
997,676 | 6ca18aaa265a4e3ca11aec6b56544f64492d91a4 | import logging
log_format = "%(asctime)s | %(name)s | %(levelname)s | %(message)s"
log_activity = "activity_log"
logging.basicConfig(filename="sample_container1.log", level=logging.DEBUG, format=log_format)
# log data
logger = logging.getLogger(log_activity)
logger.setLevel(logging.DEBUG)
# "application" code
logger.... |
997,677 | 0b988b7483a8bdd6a087ea30ccbdfbf91a1a11d4 | """ Purpose: A Flask server that serves the Summarizer service, integrated to the BigBlueButton client
Source Code Creator: Soniya Vijayakumar
Project: WILPS Hamburg University
Term: Summer 2021
M.Sc. Intelligent Adaptive Systems """
from __future__ import unicode_literals
from flask import Flask, render_template, u... |
997,678 | bd6657cd9b05e0712aa2247265c7caf533482b66 | # coding: utf-8
import pickle
import bz2
def compress(data, compressed, compress_level):
return bz2.compress(data, compress_level) if compressed else data
def decompress(data, compressed):
return bz2.decompress(data) if compressed else data
def serialize(data):
return pickle.dumps(data)
def deserialize(... |
997,679 | 18fa6677f3e607cb74d2681f7ba5b80dec931f55 | '''
Example Data Type
x = "Hello World" str
x = 20 int
x = 20.5 float
x = 1j complex
x = ["apple", "banana", "cherry"] list
x =... |
997,680 | 903783fac5ac01b8b18db7c33b984e3d091a7ceb | import matplotlib.pyplot as plt
from termcolor import colored
import matplotlib.transforms
import numpy as np
import pandas as pd
def plot_graphics(graph, MAX_ITR, name_save=""):
log_itr = list(map(list, zip(*graph.log_itr)))
best_ger, avg_ger, median_ger = log_itr[0], log_itr[1], log_itr[2]
fig, (ax1, ax2, ax3) ... |
997,681 | a95b7bf7b2c3b90073be418b8a726f09eac0b7b4 | from sys import stdin
from itertools import accumulate
def main():
#入力
readline=stdin.readline
n=int(readline())
a=list(map(int,readline().split()))
s1=list(accumulate(a))
s2=list(accumulate(reversed(a)))
ans=float("inf")
for i in range(n-1):
x=s1[i]
y=s2[n-i-2]
... |
997,682 | 40395d4ca5b6cf40557f634e8f3422b4b2573dd3 | from kivy.base import runTouchApp
from kivy.lang import Builder
runTouchApp(Builder.load_string('''
Label:
Button:
text:'Hello'
pos:root.x,root.top - self.height
Button:
text:'World!'
pos:root.right-200,root.y
''')) |
997,683 | 148736d586a0e4cb3feefa5f18a6c7b3a7d19a6c | def reverse(text):
return (text[::-1])
|
997,684 | e6d1f32ef39100eaa119842196cb660e7ec7fb85 | # -*- coding: utf-8 -*-
# @Author: aaronlai
# @Date: 2016-10-07 15:03:47
# @Last Modified by: AaronLai
# @Last Modified time: 2016-10-07 17:30:26
import numpy as np
def initGame(width=19):
"""Initialize width x width new game"""
state = np.zeros((width, width, 2))
available = np.zeros((width, width))... |
997,685 | 4c5425f4ab34a5149d32008cab152123e051787d | t=int(input())
while(t>0):
size=int(input())
arr=[]
for a in range(0,size):
arr.append(list(map(int,input().split())))
index=-1
for val in range(0,size):
if(val+1!=arr[0][val]):
index=val+1
check=[0]*index
for val in range(1,index):
if(val!=1 and ... |
997,686 | 3407328316395486c31e6fb5344c6b8f785bfcda | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: ScaleKent
import os
import pydicom as dicom
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from PIL import Image
file_path = "C:\\Users\\ScaleKent\\Desktop\\MRI\\MRI_python\\dicom_file\\" # Dicom文件之主路径
pi... |
997,687 | ee66e272bfe768b21958d618b2c2d0395788216b | # Pretty printed json Serialization
import json as simplejson
from django.core.serializers import json
from tastypie.serializers import Serializer
class PrettyJSONSerializer(Serializer):
json_indent = 2
def to_json(self, data, options=None):
options = options or {}
data = self.to_simple(dat... |
997,688 | 68cb3c3d3a6c548a8d174ca044542ef0718ac05a | box = 'Box'
category_s = 'Categoria'
category_p = 'Categorias'
cast_s = 'Elenco'
cast_p = 'Elencos'
character_s = 'Personagem'
character_p = 'Personagens'
collection_s = 'Coleção'
collection_p = 'Coleções'
creator_s = 'Criador'
creator_p = 'Criadores'
delete = 'excluir'
director_s = 'Diretor'
director_p = 'Diretores'
e... |
997,689 | 2a7e2e3dd0927242a51e22d3245e76d2696c6ac1 | from django.apps import AppConfig
class CodeAuditConfig(AppConfig):
name = 'code_audit'
|
997,690 | 2dbb514e803e8232bd03d58b2dbae22b62ee8a3d | import cgi
from app_base import AppBase
class UwsgiHello(AppBase):
"""A sample hello world testbed"""
def __init__(self, environ, start_response):
AppBase.__init__(self, 'UwsgiHello', environ, start_response)
def application(self):
self.start_response("200 OK", [("Content-Type", "t... |
997,691 | 0e3e3d3878f3f5f1fa2cbf7dd2146be1e5841014 | from tkinter import *
import cv2
top = Tk()
top.title("Irregular motion detector")
top.geometry("1080x720")
def fun():
cap = cv2.VideoCapture(0)
frame_width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
frame_height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
fourcc = cv2.VideoWriter_fourcc('X', 'V', 'I', ... |
997,692 | 59f262832900a39ac7c97ff1b33b2360a017d63f | import numpy as np
from chainer.utils.conv import col2im_cpu, get_deconv_outsize
from test.util import generate_kernel_test_case, wrap_template
from webdnn.graph.axis import Axis
from webdnn.graph.graph import Graph
from webdnn.graph.operators.col2im import Col2Im
from webdnn.graph.order import OrderNHWC, OrderNCHW, O... |
997,693 | afb15e0b535a761eda6513e01409ab5f5d5664bb | from pathlib import Path
import xarray as xr
import numpy as np
from .utils import make_sentinel_dataset_name, make_hrsl_dataset_name, load_sentinel
from typing import cast, Tuple, Union
class Engineer:
def __init__(self, data_dir: Path) -> None:
self.raw_folder = data_dir / "raw"
self.processe... |
997,694 | ac24a257564a2bafe0a44975b4a2bbe258314a42 | from app import db
from .base import BaseModel
class WritingBaseModel(BaseModel):
title = db.Column(db.String(120))
text = db.Column(db.Text)
|
997,695 | 365ed16675ff00e1b1c7488ed0ce375cc871babb | # -*- coding: utf8 -*-
"""
Dialogflow plugin ocnfiguration
Author: Romary Dupuis <romary@me.com>
"""
from lifoid.config import Configuration, environ_setting
class DialogflowConfiguration(Configuration):
"""
Configuration for the web server to run an admin UI.
"""
access_token = environ_setting('DIALO... |
997,696 | ac472a886e57e9d55aa61db7b9adb02db9af022b | import copy # for deepcopy function
class Matrix(object):
'''This is the main class for all 2x2 and 3x3 matrices.
It contains all functions that can be used commonly for both the types of matrices that we deal with in this project.
It serves as the parent class for the classes: twoBytwo and threeBythree.
'''
def... |
997,697 | 39b94bd03467495e065f8c8f40647d6a63d7dafa |
user_sec = int(input("Введите секуны: "))
hours = user_sec // 60**2
minutes = (user_sec % 60**2) // 60
seconds = (user_sec % 60**2) % 60
print(f"{hours:02d}: {minutes}: {seconds}")
|
997,698 | f4158be88f433b4ecc6f3afae17d5182502539ec | from qqq.ccc import n
def add3(param):
print("Hello")
return param + 3
|
997,699 | 75b5c58349b159d8e5a32c3ecd4fb09db3d00597 | """
Check if it is a triangle
"""
t = int(input())
while(t>0):
a,b,c = [int(x) for x in input().split()]
if a + b <= c or a + c <= b or b + c <= a:
print("NO")
else:
print("YES")
t-=1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.