index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
999,300
c85f683bc8894598ee5c09e9e021fecbbe5706c4
from flask_wtf import Form from wtforms import StringField class Director(Form): name = StringField('Name')
999,301
3f466a82a3d58c6f9f418bc7cee66acb81142253
from fn import * from fn2 import * a=['1','2','3'] #Row 1 b=['4','5','6'] #Row 2 c=['7','8','9'] #Row 3 i=0 print a,'\n',b,'\n',c,'\n' chance=input("enter 0 for first chance else press anything ") if chance!=0: i=1 chance=0 priority=[4,0,2,6,8,1,3,5,7...
999,302
ccc286ed03c4d36c884058a41ef2ddccb12ab542
import matplotlib.pylab as plt import numpy as np deg = np.arange(12.) * 30 b = np.radians(deg) print(b)
999,303
d96ce47b9e3c06b3a69e5410e1b1168a8a70318c
# Copyright 2020 The TensorFlow 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 applica...
999,304
dbd9da9d9cb494eb6f1ae92758b8c2a5eca928d6
import random import logging import sys import msgpack import struct from asyncio import get_event_loop, start_server, Task, coroutine, \ open_connection, IncompleteReadError, sleep log = logging.getLogger('clicky.messageio') class Connection: def __init__(self, name, reader, writer): self.live = ...
999,305
d09fb1ff8b4a75bef31550b8b5fafffdc039e13e
#일곱 난쟁이 nlist=[] for nan in range(9): nlist.append(int(input())) def find(nlist): total=sum(nlist) for i in range(9): for j in range(i+1,9): if nlist[i]+nlist[j]==total-100: return nlist[i],nlist[j] n1,n2=find(nlist) nlist.remove(n1) nlist.remove(n2) nlist.sort() for i ...
999,306
4774d42f697b676158dfd6c22d8348d8b758a145
""" Install portal via setuptools """ import sys from setuptools import setup, find_packages from setuptools.command.test import test as testcommand with open('test_requirements.txt') as test_reqs: TESTS_REQUIRE = test_reqs.readlines() with open('README.rst') as readme_file: README = readme_file.read() cla...
999,307
31ccb0c67c0f39c82970c902d8c53c7110e5803d
import platform import re import socket import sys import time import uuid from datetime import datetime from os import environ, execle, path, remove from player.helpers.decorators import humanbytes import psutil from pyrogram import Client, filters, __version__ # FETCH SYSINFO @Client.on_message(filters.command('...
999,308
47fec2e496b52eee562b49414b1c14169ec49ec9
import numpy as np from scipy.stats import rankdata import argparse import loc_utils as lut from standards import * # Column index r = RAWix() def report_analysis(analysis, outliers): n = len(outliers) if n > 0: print('{} detected {} outlier(s):'.format(analysis, n)) print(outliers) else...
999,309
306e9ba396d8a547aaa2deb9ac291960113c9e3f
__author__ = 'Jun Wang' # -*- coding:utf-8 -*- import json,urllib2,sys, MySQLdb # import pandas as pd reload(sys) sys.setdefaultencoding('utf8') # from pandas import DataFrame,Series db = MySQLdb.connect(host="localhost",user="root", passwd="wanjun", db="test", use_unicode=True, charset="utf8") cursor = db.cu...
999,310
86e8691bf6f81e7cbccbf8acbf7e830c3ce11793
num = int(input('Enter a number: ')) cpy_num = num counter = 0 while cpy_num != 0: counter += 1 cpy_num = cpy_num//10 print('The number', num, 'contains', counter, 'digits') if counter > 1 \ else print('The number', num, 'contains', counter, 'digit')
999,311
64bb870c2941b518a17d1156ab52b4c543bf6b91
''' Read input from STDIN. Print your output to STDOUT ''' #Use input() to read input from STDIN and use print to write your output to STDOUT ''' Count In Range And Specific (100 Marks) You will be given an array and a range and you need to count how many array elements lies in that range and not divisible by 3 a...
999,312
b2d085f928bdd385fce67551e491ece66ac618c4
def reverse(array, k): section = array[0:k][::-1] return section + array[k:] a = [5, 6, 7, 2, 4, 3, 8, 10] k = 3 print(reverse(a, k))
999,313
982222fc025e5b265bdcc832a048e70d508ed0e0
echo "hello"
999,314
44f45d86eb9dba8f6579cfa504aa5faa29991fd3
"""courses URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based...
999,315
37964b63f90ba2617445e667b988796ae46fc5be
from rest_framework.serializers import ModelSerializer from .models import User class UserProfileSerializer(ModelSerializer): class Meta: model = User fields = [ "username", 'address', 'mobile_number', 'first_name', 'last_name' ]
999,316
64eda1b08f263efe5cf81982b729f9a302e3cab5
""" Base Django settings for puzzlehunt_server project. """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os from os.path import dirname, abspath import codecs codecs.register(lambda name: codecs.lookup('utf8') if name == 'utf8mb4' else None) BASE_DIR = dirname(dirname(dirname(abspat...
999,317
3db2a6cc3bfb29752ac0022a10365ede8a64faa6
"""Filter that is applied on e-mail messages.""" import functools import logging import operator import re import typing as t from .message import Message from .connection import Connection from .filter_actions import mark, move _LOG = logging.getLogger(__name__) CONDITION_OPERATORS = { # '>': lambda arg: funct...
999,318
8707a4c5ba93bd364c57f5ebd6b8082f1700f772
''' Main Vagrant Provider class ''' from ..provider import Provider class VagrantProvider(Provider): ''' Vagrant Provider ''' def __init__(self, config): super(VagrantProvider, self).__init__() self.config = config
999,319
21d26fafc62882032c2245930472d2c77c92f818
from market import db class Item(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(length=30), nullable=False, unique=True) price = db.Column(db.Integer, nullable=False) barcode = db.Column(db.String(length=12), nullable=False, unique=True) description = db.Column(...
999,320
ac213834b2eb1526171161298a454c9dd63e59dd
#!/usr/bin/python3 """This is module 5-base_geometry""" class BaseGeometry: """empty class BaseGeometry""" pass
999,321
d2b4ec49da3c7a24272bec2153a2740c059a7b62
import numpy as np import matplotlib.pyplot as plt from PIL import Image from Constants import * from HuffmanDecoding import HuffmanDecoding from HuffmanEncoding import HuffmanEncoding from JPEGHelpers import * import HuffmanTree from joblib import Parallel, delayed def step1_LoadImage(debugFlag, imagePath): prin...
999,322
07ede699d51df3c547b96c9a4d8b62b229aee834
import sys from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from session import Session from matplotlib.figure import Figure from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas import yfinance as yf import datetime from functools import partial import matpl...
999,323
ff29851cf95a40950e7745ff6004f411420d21cb
x = float(input()) k = int(input()) cos = 0 somar = True for i in range(0, k+1, 2): fat = 1 for j in range(1, i+1): fat = fat * j if somar: cos = cos + x ** i / fat somar = False else: cos = cos - x ** i / fat somar = True print(f"{cos:.4f}")
999,324
790808832cc46336c1569bbad7c37701909ffa98
import os import sys path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) if not path in sys.path: sys.path.insert(1, path) import nussl def main(): # input audio file input_name = os.path.join('..', 'Input','Sample1.wav') signal = nussl.AudioSignal(path_to_input_file=input_name) ...
999,325
117518aba332ca7bcb9c4c60f8f91b4034f86bf2
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 23 10:35:46 2020 @author: luca """ import numpy as np import matplotlib.pyplot as plt import numpy.random as rnd from network4strel import BetaDistribution, LognormalDistribution, DiscreteDistribution, GammaDistribution, CategoricalDistribution, Det...
999,326
50e018bf5f285d25561798c7da733509aadb0ae9
from django.conf.urls import patterns, url from control import views urlpatterns = patterns( 'control.views', url(r'^$', 'home', name="home"), url(r'^sprinklers/', 'sprinklers', name='sprinklers'), url(r'^accounts/', 'accounts', name='accounts'), url(r'^logs/', 'logs', name='logs'), url(r'^comm...
999,327
9b326497b83f3dbe6d10eaf0ed6c8c26468bd7cb
class Polynomial: def __init__(self, n, k=None): self.degree = n if k is None: self.koef = [1 for i in range(n + 1)] else: if len(k) > n: k = k[:n + 1] elif len(k) < n: k.extend([0.0 for i in range(n - len(k))]) ...
999,328
d0a138ed4de7cc216ae453949f961971b3b3f860
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' @File : matht.py @Author: sladesha @Date : 2019/7/22 0:15 @Desc : ''' import math from .typet import is_type import sys from .listt import index_hash_map, Pi from math import log from math import e __EPS = 1.4e-45 def entropy(props, type="list", explation=False)...
999,329
265270281c1f11b1e56393b76b1638fee3d8136b
# Copyright 2019 Xilinx Inc. # # 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...
999,330
2b0574b78cf373cf83da044adc9027dc88de5cfe
input() s = input() while s != "___________": s = s[2:-1] tmp = 64 tmp2 = 0 for c in s: if c == "o": tmp2 += tmp tmp //= 2 if c == ".": tmp *= 2 # print(tmp2) print(chr(tmp2),end="") s = input()
999,331
d743f6f3174e0d4e6a9f08ddc8e1bf3679404658
import numpy as np class item(): def __init__(self, row_length, row1, row2, result): self.row1 = row1 self.row2 = row2 self.id = row_length*row1 + row2 self.result = np.array(result)
999,332
bdcb77b7b75a8d0ad8b2c440d06e8d634b2bc5b8
from pie.main import entry_point __author__ = 'sery0ga' #from rpython.jit.codewriter.policy import JitPolicy def target(driver, args): driver.exe_name = 'pie' return entry_point, None def jitpolicy(driver): from rpython.jit.codewriter.policy import JitPolicy return JitPolicy()
999,333
819d221cbae580f13071cabf0c98317418aa084b
from random import choice # These variables are used to count the comparisons # They are accessed globally in each sort function quickComparisons = 0 mergeComparisons = 0 selectionComparisons = 0 insertionComparisons = 0 def swap(Arr, j, i): tempVar = Arr[j] Arr[j] = Arr[i] Arr[i] = tempVar return(Arr)...
999,334
46c55ac1e272f0d8bd2ed41d543c0dc69f0e73ea
#!usr/bin/python # # (C) Legoktm 2008-2011, MIT License # import wikipedia, pagegenerators, catlib import re, sys from wikipedia import * #status updater #syntax: legoktm.newstatus("Status", "User:Username/Status", "[y]es/[n]o prompt) site = wikipedia.getSite() def newstatus(status, page, prompt): site = wikipedia.get...
999,335
49963945d07369c6f69ace5648b9d6da99edee62
# Generated by Django 3.0.3 on 2020-10-05 05:35 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('agreement', '0028_localarea'), ] operations = [ migrations.AlterField( model_name='site', name='site_extension', ...
999,336
acdfd063629a221fbed1df8e95840be7ce994133
""" This is a simple programme on Classes and Objects : Initializer Method in Py3""" class Point: def __init__(self, x, y, z): self.assign(x, y, z) def assign(self, x, y, z): self.x = x self.y = y self.z = z def printPoint(self): ...
999,337
37d093a9d1d3e7a63c66c4fa4ee396f04d4485e5
from django.db import models from django.db.models import DEFERRED from django.contrib.auth.models import User from django_countries.fields import CountryField class FreightCompany(models.Model): def __str__(self): return self.name @classmethod def from_db(cls, db, field_names, values): #...
999,338
92dc6e9f3e6bd324c2d50376d531d02e80a2061c
# Generated by Django 2.1.3 on 2018-11-22 09:01 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('exchange', '0001_initial'), ('simulation', '0001_initial'), ] operations = [ migrations.CreateModel...
999,339
1d592de64d6925892483627a5eed54cfb3a4d9a5
''' cms : content manager system manager group manager account manager message ''' from __future__ import absolute_import, division, print_function, with_statement # Tornado framework import tornado.web HTTPError = tornado.web.HTTPError import tornado.ioloop import tornado.auth import tornado.escape i...
999,340
3da598903397a4fdf6456f6a8fe684f5de761dfc
# !/bin/env python2 # -*- coding: utf-8 -*- def solve(): p, n = [1], 1 while True: now, delta, cnt = 0, 1, 0 while delta <= n: sign = -1 if cnt % 4 > 1 else 1 now = (now + sign * p[n - delta] + 1000000) % 1000000 cnt += 1 k = - (cnt / 2) - 1 if c...
999,341
b50eb19c43ad50d56347da86509ffb73cd63f1c5
from django.apps import AppConfig class Aik2Config(AppConfig): name = 'aik2'
999,342
114f63378a14d5231ef1c699a24bb7e81127f0df
# Evaluating ANN import pandas as pd from keras.models import Sequential from keras.layers import Dense from sklearn.preprocessing import StandardScaler from sklearn.metrics import confusion_matrix from sklearn.preprocessing import LabelEncoder, OneHotEncoder from sklearn.model_selection import train_test_spli...
999,343
1f36e14df8423b069dc099fefb94ec9411f905d3
""" 目的:将弹幕json转化为excel 作者:徐昭 """ import openpyxl import json # 新建表格 wb = openpyxl.Workbook() sheet = wb.create_sheet() # 美化表格 sheet.column_dimensions['A'].width = 10 sheet.column_dimensions['B'].width = 20 sheet.column_dimensions['C'].width = 20 sheet.column_dimensions['D'].width = 50 # 表头赋值 sheet['A1'] = '类别' sheet['...
999,344
8137345d040299cd1a1bd1ef045d1efd2e67b315
with open('food.txt','r') as f: for line in f: print(line.strip())#.strip()可除去左右空白及換行
999,345
6898968d697fafa90ae0e3fcc7af4885c3384696
from ROOT import * import os,sys gROOT.SetBatch(True) gROOT.LoadMacro("vecUtils.h+") gSystem.Load("/home/users/haweber/oxbridgelibrary/lib/liboxbridgekinetics-1.0.so") gInterpreter.AddIncludePath("/home/users/haweber/oxbridgelibrary/include/oxbridgekinetics-1.0"); gInterpreter.AddIncludePath("/home/users/haweber/oxbri...
999,346
6a48b4d05ba13e6826b4f1adb583203d5b1587fc
# 여기에 숫자를 넣으면 어떻게 되는지 알려주는 함수 def ifpung(inp): if inp == '1': print("펑하고 터졌다") def idpw_ck(userid, pwd): if userid == 'aaa' and pwd == '1234': return "로그인 되었습니다. {}님 반갑습니다".format(userid) else: return "로그인 실패. 아이디가 없거나 패스워드가 틀렸습니다"
999,347
f53074f9150dca86bc5a8ec2f19637d6e993bde9
# -*- coding: utf-8 -*- ''' Created on 2017 @author: yufengsheng ''' from maya.cmds import * import maya.mel as mel import sys if not pluginInfo('SOuP',q=1,l=1): loadPlugin('SOuP', qt=True) def yuCheckAnimatorWin(): windowName='checkAnimatorWin' if(window(windowName,exists=1)): deleteUI(windowName) window(w...
999,348
60e79cc9c8ae7d2d320e0372de31e3a1a683bd08
import json import os import traceback import requests import re import ast import logging from lxml import etree from django.conf import settings from django.shortcuts import render, redirect from django.http import HttpResponse, HttpResponseRedirect, HttpResponseBadRequest from django.utils import timezone from rhyth...
999,349
b260d6cf43cecb4eedbba5068d2d6e42c46825f3
import os from src.constants import INPUT_DIR_PATH def split_file(input_file_path, result_dir_path, n): file_name = os.path.splitext(input_file_path)[0] new_files = [ os.path.join(result_dir_path, '{}_{}.txt'.format(file_name, i)) for i in range(1, n+1) ] chunk_size = os.path.getsize(...
999,350
a15e3c6fb19f5fa92439a829a824c9f55e4937c3
n = 4 k = 3 visited = [False]*n a = [] b = [0]*n def chinhhop(i): global a, c if k <= n: for v in range(0,n): # a.append(v) if (visited[v] == False): b[i] = v + 1 visited[v] = True if i == k: c = [] ...
999,351
c46e486e0ca8fa0db3a8827d2db1e91b6776986a
"""Author: Manuel Reinbold, Maximilian Renk Date: 21/11/17 Version: 1.0 """ import glob from xml.dom import minidom # Delivers the unpreprocessed raw data for all social media comments. def get_raw_data(): data_path_positive = '../data/movieReviews/negativeFiles.txt' data_path_negative = '../data/movieReviews...
999,352
198bd2a9f460389f136602798a7674730e69759c
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright(c) 2021 The MITRE Corporation. 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/lice...
999,353
bf5f7f7dcf913e643f493ff10f3ecf4ab66417b1
# coding: utf-8 from celery import Celery app = Celery("ihome") app.config_from_object("ihome.tasks.config") # 让celery自己找到任务 app.autodiscover_tasks(["ihome.tasks.sms"])
999,354
017073eed14cb7eb8f6f07ca3d3624d5b4387a0c
__author__ = 'octowl' from collections import Counter def word_count(phrase): return Counter(phrase.split())
999,355
ff1aa112ea3cbebb68296c75e2e02abbe421e909
# Copyright (c) MONAI Consortium # 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, so...
999,356
49f50760114dfb0ee12de7893f5952ef4a8d8736
"""Test HomematicIP Cloud helper functions.""" import json from homeassistant.components.homematicip_cloud.helpers import is_error_response async def test_is_error_response() -> None: """Test, if an response is a normal result or an error.""" assert not is_error_response("True") assert not is_error_resp...
999,357
3c0d82837c75a434ecf0cb98fa8539b282a8fcd8
import socket #commented was for UDP s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) port = 8888 #ip = "192.168.56.101" s.connect(('192.168.56.101',port)) #s.bind(('',port)) #while True: data = s.recvfrom(1024) s.send(b'Hi, saya client.ty.') print(data) s.close()
999,358
a51574e4f33bd80704006175214d18ae1a4568bb
from .template import Template class Comic(Template): def __init__(self, dedup_headings=False, la_overrides=None): super(Comic, self).__init__( dedup_headings=dedup_headings, la_overrides=la_overrides ) self.footer_break = 50.0 def cleanup(self, content): ...
999,359
9e85bfd855ea6f829367711b20c2e4d2c5a94441
def hamming_distance(a, b): if sum([1 for _ in a]) != sum([1 for _ in b]): raise ValueError("strand lengths not equal") strands = [] for i in range(sum([1 for _ in a])): strands.append((a[i], b[i])) def filter_func(p): if p[0] != p[1]: return 1 return len(filt...
999,360
c571a3371f2ffd8dee3cab19ce259c8b7ea6b118
import tensorflow as tf import pandas as pd from sklearn.preprocessing import LabelEncoder AUTOTUNE = tf.data.experimental.AUTOTUNE class Data: def __init__(self, filepath='./', batch_size=512, only_rating=False, buffer_size=1024): self.batch_size = batch_size self.buffer_size = buffer_size ...
999,361
59a90a2e7c9ab99293aef895377682dab3c18044
import random money = 100 #CoinFlip Game def coin_flip(call, bet): coin = random.randint(1, 2) #RULES if bet > money: print("You dont have enough money to make that bet!") return elif bet <= -1: print("Bet must be positive!") return #Coin lands on Heads! elif coin == 1 and call == ...
999,362
9ee887af99bc2df5c3a372564cba546818f567ab
import re def swap(lst, a, b): lst[a], lst[b] = lst[b], lst[a] def push_bit(s): """Given a string like '0110100', push bits towards the right. Returns 'END' if nothing can be pushed """ end_pattern = re.compile(r'^0*1+$') if end_pattern.match(s): return "END" else: bit...
999,363
3863823fdcbae751ff687516f847cdf4f07a4d14
a = int(input()) b = int(input()) for r in range(a, b+1): if r % 2 == 0: print(r, end=' ')
999,364
56e5251ab360444ad6b7ccb2fcabe523a5d3d4db
""" This program will scrap each of the word from the wiktionary page. The starting page will be "https://en.wiktionary.org/wiki/Wiktionary:All_Thesaurus_pages". Firstly we aim at constructing the scraper with 1 table and sqlite3 database. """ from datetime import tzinfo, timedelta, datetime import sqlite3 import ti...
999,365
a920c63a3372a0bcde79fcfe08f2ca13c579807c
import asyncio import logging import re import types from collections import Counter from copy import copy from typing import Dict, List, Union import discord from redbot.core import commands from redbot.core.utils.chat_formatting import box, humanize_list, inline, pagify from redbot.core.utils.menus import DEFAULT_CO...
999,366
71c8c555ff36981026018503e04b550e40385cd0
from django.apps import AppConfig import os default_app_config = 'apps.base_info.apps.BaseInfoConfig'
999,367
9f98fbf03e50e6a9a480f9978814fb8346241ba0
from unittest import skipIf from django.conf import settings from django.contrib.gis.geos import LineString, Point from django.test import TestCase from geotrek.land.tests.test_filters import LandFiltersTest from geotrek.core.factories import PathFactory, TrailFactory from geotrek.core.filters import PathFilterSet, ...
999,368
a0ce739de2ed18a8463b7f2df2563bd58e438c27
from functools import wraps from sanic.response import redirect def jwt_required(): def decorator(f): @wraps(f) async def decorated_function(request, *args, **kwargs): json_token = request.cookies.get('lock-jwt') refresh_token = request.cookies.get('lock-rtk') ...
999,369
e1de8a813d1741fd014fc966401faa3b7775050a
import subprocess subprocess.call(["/opt/imt/robot/crob/tools/plcenter"])
999,370
b9bfa4cc40d8d30040b7fcc544351b15b66398f1
#!/usr/bin/python import sys import socket import struct from pydbg import * from pydbg.defines import * import pythoncom import struct import random import wmi import subprocess import os import time import threading from threading import Lock, Thread allchars = ( "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d...
999,371
3b3c8522a013177cbef72515373d2f9b73ec73aa
# -*- coding: utf-8 -*- import os.path import pymongo import platform from pcnile import sqlitedict as bsddb BOT_NAME = 'wolf' SPIDER_MODULES = ['wolf.spiders'] NEWSPIDER_MODULE = 'wolf.spiders' # Crawl responsibly by identifying yourself (and your website) on the user-agent USER_AGENT = 'Mozilla/5.0 (Windows NT 6....
999,372
fa932327238c16f83e1b29bf0e0698d09a21c73b
#!/usr/bin/env python # -*- coding: utf-8 -*- import os RESIZED_NEGATIVE_PATH = 'resized_negative_images' RESIZED_POSITIVE_PATH = 'resized_positive_images' def create_output_directory_for_resized_images(): """ General method to create directories for negative images. """ try: if not os.pat...
999,373
36b4a0240018e93135358622c32cd7ce01a3f989
class Solution: def isMatch(self, s, p): """ :type s: str :type p: str :rtype: bool """ table=[[False]*(len(s)+1) for _ in range(len(p)+1)] table[0][0]=True for i in range(1,len(p)+1): if p[i-1]=='*': table[i][0]=table[i-2][...
999,374
04a832f70cb08c9584e7487b3aa572fc4b700f23
from typing import Any, Dict from ....models.models import ProjectorCountdown from ....permissions.permissions import Permissions from ....shared.exceptions import ActionException from ....shared.filters import And, FilterOperator from ....shared.patterns import fqid_from_collection_and_id from ...generics.create impo...
999,375
dbae9e1ed105de239d2290afcc87abcff5a2201f
import os import random import itertools import time import numpy as np import tensorflow as tf from tensorflow.contrib import layers from tensorflow.contrib import learn from model import * #from recommendation_worker_nn import * from parser_file import * from utils import * #os.environ['TF_CPP_MIN_L...
999,376
75f02364e15680b822ddcc601c42064956edcf96
print "Age:", age = raw_input() print "Height (inches)", height = raw_input() print "Weigha (lbs):", weight = raw_input() print "So, you're %r years old, %r inches tall, and weigh %r pounds." % (age, height, weight)
999,377
303aed6d45370599c7af5924a982a4747cc9e949
# Generated by Django 3.1.7 on 2021-02-27 06:51 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('website', '0017_auto_20210227_1056'), ] operations = [ migrations.RenameField( model_name='softwares', old_name='fea...
999,378
96dfd8f1a972e7801b288a0a0656a2ab42d7c099
#!/usr/bin/python # -*- coding: utf-8 -*- # # Lacerda@Granada - 26/Nov/2014 # import numpy as np import h5py import matplotlib as mpl from matplotlib import pyplot as plt import sys from plot_aux import get_attrib_h5, density_contour, \ list_gal_sorted_by_data, calcRunningStats, \ ...
999,379
0fccf66cc28c2e85cf9ee8826eb383dd94d4d5e6
/home/student/rosws/devel/.private/roslz4/lib/python2.7/dist-packages/roslz4/__init__.py
999,380
997bfa8df1449669471173af906fbb1d4f8e6e02
from flask import Flask from flask_migrate import Migrate from flask_restful import Api from config import Config from extensions import db, jwt from resources.user import UserListResource, UserResource, MeResource, UserSheetListResource from resources.token import TokenResource, RefreshResource, RevokeResource, blac...
999,381
877f605e951145fc5e2c36ceda53f3305f760420
import pickle # 用于读取pkl文件 import numpy as np import scipy.sparse.csr import random def ReadPkl(filename: str): file = open(filename, "rb") data = pickle.load(file) # 对于邻接矩阵文件,这里可以读取到邻接矩阵形式,例如:(4, 192082) 1 # 对于特征文件,这里可以读取到ndarray形式,二维 # 对于标签文件,这里可以读取到ndarray形式,一维 # print(type(data)) # pr...
999,382
10da245f5a6120702894655446f8264fbca80d79
#!/usr/bin/python # -*- coding: utf-8 -*- # # 研修用ユーザーのリストツール # # 機能 # このプログラムは、ソフトレイヤーのハンズオン研修用などの目的で、 # 子ユーザーのリストを表示します。 # # 使い方 #  1. 初回実行時だけユーザーIDとAPI-KEYをインプットする # # 注意点 # ポータル画面に表示されなユーザーが表示される事があります。 # # 作成者 Maho Takara takara@jp.ibm.com # # 2015/5/8 初版リリース # 2015/8/13 ユーザーIDとAPI-KEYを初回実行時...
999,383
2233cfdcf1cbe8f06783c6bad39e25b77bd579c3
# -*- coding: utf-8 -*- """preprocessing _kdd Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1TJSQ9_-XH7VOkFj1jfRUyPSUakLccq2b """ import pandas as pd import numpy as np import matplotlib import matplotlib.pyplot as plt df = pd.read_csv('/content/dri...
999,384
ee1d847c961865f8348fac6607fac673a6ee2f42
__all__ = ["type", "client", "typebuilder"]
999,385
da9035186710c9264b98ed38b1f427a1c4ed37b8
while True: print(input.acceleration(Dimension.X)) if input.acceleration(Dimension.X) > 17 or input.acceleration(Dimension.X) < -17: light.show_animation(light.rainbow_animation, 100) else: light.clear()
999,386
4b3aba265888afdcf1826876a7aac25dc6e609cd
import threading import mysql.connector import datetime import urllib.request as urllib2 import time db = mysql.connector.connect( host="127.0.0.1", user="root", passwd="", database="brofistool" ) conn = db.cursor() hasil_test = [] def data(): print("Proses Dimulai") sql_apn = "SELECT apn FROM...
999,387
92844ac7a8d0441b9576e4171c9294244cb68aae
import pandas as pd import matplotlib.pyplot as plt import datetime import numpy as np from clean_data import clean_data """ Calculate state's immobility index - a single number representing how much social mobility declined during the COVID pandemic. The following mobility variables were used: retail_and_r...
999,388
5bc047e6f779204eaacc333ada241bb7d769b682
from setuptools import setup, find_packages test_dependencies = [ 'pytest', 'flake8', ] extras = { 'tests': test_dependencies, } setup( name='objconf', version='0.3.0', description='Object configuration for Python projects', long_description=open('README.md').read(), long_description_c...
999,389
9c078270a4d410d14ee2cf2e3a38cd39b3ca47e5
# -*- coding: utf-8 -*- import math def stripl(l): """ Strips all elements and removes the empty in a list. """ return filter(lambda x:x, map(lambda x: x.strip(), l)) def islice(n, m): """ An iterator splits an amount into several parts, each of which has the length of m. """ npi...
999,390
e62d5fe26b7fdc65ccc31ce8f315a2088b024ac7
# messaging/views.py from django.http import JsonResponse, HttpResponse from django.db.models import Count, Q from django.contrib.auth.decorators import login_required from django.views.decorators.csrf import csrf_exempt from asgiref.sync import async_to_sync from channels.layers import get_channel_layer from . impor...
999,391
bc446ccb204ecfd0d716125f36e7ab610c79d722
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import math import re class Solution(object): def reconstructQueue(self, people): """ :type people: List[List[int]] :rtype: List[List[int]] """ def sortPeople(p1,p2): if p1[0] == p2[0]: return cmp(p1[...
999,392
699b1fcc70928edcfdec97cfacce46947b4185c6
import sys sys.stdin = open("input.txt", "rt") input = sys.stdin.readline n = int(input()) for _ in range(n): vps = input() stack = [] for x in vps: if x == '(': stack.append(x) elif x == ')': if len(stack) != 0 and stack[-1] == "(": stack.pop() ...
999,393
de3c113674d7138a4709d0c5fa9e32a19f823d67
# Generated by Django 4.0.2 on 2022-02-27 21:20 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('client', '0001_initial'), ] operations = [ migrations.RenameField( model_name='client', old_name='created', ...
999,394
6245a367c07b01e17273997c87e1c52b4f567fbe
# Copyright 2017 Google Inc. # # 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 ...
999,395
c0b8b973e6b942d1b558f0ec3007434950cb563a
from .abstract_pdf_constructor import AbstractQuantilePdfConstructor from .cdf_spline_derivative import CdfSplineDerivative from .dual_spline_average import DualSplineAverage from .piecewise_constant import PiecewiseConstant from .piecewise_linear import PiecewiseLinear
999,396
d38c6188b0a8f5d0010efae438ac0dbd2c8206cd
import random import time print("\n Weilcom to Hangman game\n****@@@****\nCreated by: ABHISHEK SHARMA\n****@@@****") name=input("Enter your name: \n") print(f"HELLOW {name} ! BEST OF LUCK!") time.sleep(2) print("THE GAME IS GOING TO START \n LET'S PLAY......'") time.sleep(3) def main(): global count global disp...
999,397
433609a55b1e9195dccda64526b7c38de3f29bd6
#! /usr/bin/python3 # -*- coding:utf8 -*- ''' 问:正常方法和静态方法有何不同? 答:正常方法需要接受第一个self参数,但是静态方法只是嵌套在类对象中的简单函数,不需要传入实例。为了使一个方法成为静态方法,它必须可以通过特殊的内置函数运行,或者使用装饰器进行装饰。Python3.x允许通过类而不需这个步骤就调用类中的简单函数,但通过实例调用时仍需要静态方法声明。 '''
999,398
5bf7c1115c8533ea89560251bf5eaf3323eeac94
from luhyaapi.educloudLog import * from luhyaapi.hostTools import * from luhyaapi.rabbitmqWrapper import * from luhyaapi.vboxWrapper import * from luhyaapi.settings import * import time, psutil, requests, os, memcache logger = getncdaemonlogger() class nc_statusPublisher(): def __init__(self, ): logger.er...
999,399
9c00a77c36b92ebe4f6383f5f62f4b834b5780f8
# Generated by Django 3.1.2 on 2021-07-31 04:21 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('recommapp', '0009_auto_20210730_2320'), ] operations = [ migrations.AddField( model_name='review', name='email', ...