index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
16,400
4a2a5bda4aea75c02f3e8c5a721591285ed70fa1
__all__ = ( "__version__", "ResourceGroup", "ArrayMapper", "MappedMatrix", "RandomIndexer", "SequentialIndexer", "CombinatorialIndexer", "Proxy", ) from .version import version as __version__ from .array_mapper import ArrayMapper from .mapped_matrix import MappedMatrix from .resource_gr...
16,401
5d49cc8e9a01edc1f0a85fb5bf44c5b1c1612175
# Generated by Django 2.2.1 on 2019-05-14 21:12 from django.db import migrations, models import django.db.models.deletion import sovabi.models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Lieu', ...
16,402
c0dd2843d0687bcff6a252ecb7cf16a51de3b50e
import requests import boto3 import os import json # base_url = "http://192.168.1.3:5000" base_url = "http://18.116.114.15:5000" def call_signin(world, username,pw): data = { "username": username, "pw": pw } try: response = requests.post(base_url+'/signin', json=data)...
16,403
fc43d7dc132bbbd191eefda86ee31f4d4cfe07d7
bottle, k = map(int, input().split()) answer = 0 while True: count = 0 now_bottle = bottle while now_bottle > 0: if now_bottle % 2 != 0: count += 1 now_bottle = now_bottle // 2 if count <= k: break bottle += 1 answer += 1 print(answer)
16,404
c51f1d8ed5a93edd1cb8d1b6bf2aaa8a1dbcc9e1
from django.contrib import admin from django.urls import include, path urlpatterns = [ path('frigg/', include('frigg.urls')), path('admin/', admin.site.urls), ]
16,405
c2071a046fa47c8ee8517872686e82d5ac0c25ed
from netCDF4 import Dataset import sys import numpy as np ind = 'goddard_merged_seaice_conc_monthly' ind1 = 'seaice_conc_monthly_cdr' base_year = 1979 sic_data = 999*np.ones((32,332,316)) for year in range(1979,2010+1): with Dataset(f'{year}.nc') as data: sic_data[year-base_year,:,:] = data[ind][:][0,:,:]...
16,406
e3c9b4b6325a51e409fff0acc3042f7fb964f9ac
''' Created on Dec 10, 2017 @author: antonina Description: Make a two-player Rock-Paper-Scissors game. (Hint: Ask for player plays (using input), compare them, print out a message of congratulations to the winner, and ask if the players want to start a new game) Remember the rules: Rock beats ...
16,407
d463f04beabcfaa6cacbb3185e1ed4b5d9bc4918
from django.contrib import admin from algorithm.models import * admin.site.register(AlgorithmTypes) admin.site.register(CipherInstructions)
16,408
8af8401fc3071e7866efd1f46c9f6418b6c4c9aa
#!/usr/bin/python # -*- coding:utf-8 -*- #dependence: paho-mqtt (pip install paho-mqtt) # XBee (pip install XBee) # PyYAML (pip install PyYaml) # pyserial (pip install pyserial) import os import sys import time import logging import yaml from serial import Serial from factory import *...
16,409
1f58ef1758501a50cc13fa826a321cfa884fb251
import boto3 import boto3.session # from botocore.exceptions import ClientError def main(): session = boto3.session.Session() s3client = session.client( 's3', use_ssl=False, endpoint_url='http://192.168.99.100:8080', aws_access_key_id='UEF4ZL22-B2YKBJ0QZBL', aws_secret_...
16,410
cc7960896e143ae52f27c2e82e6f2e588c354ec9
from django.urls import path from . import views app_name = 'control_panel' urlpatterns = [ path('', views.dashboard, name='dashboard'), path('newsletters/', views.newsletter_list, name='newsletter_list'), path('newsletter/create/', views.create_newsletter, name='create_newsletter'), path('newsletter/detail/<in...
16,411
59ae56f532adc05036663851cf7c6bccc1d55c0b
a = int(input()) b = int(input()) c = int(input()) x = int(input()) answer = 0 for i in (a + 1): for j in (b + 1): for k in (c + 1): if i * 500 + j * 100 + k * 50 == x: answer += 1 print(answer)
16,412
c5537179b330c10cba24ecd84a097ebb5ccca930
#!/usr/bin/env python import math import multiprocessing import gym from gym import spaces, logger from gym.utils import seeding import numpy as np # import tf # import tf.msg from std_msgs.msg import Float64 import rospkg,rospy import xml.etree.ElementTree as ET # rospy.init_node('fiver_gym',anonymous=True) # theta...
16,413
83ad3f387fa0b86a90061d4361da52feae35b21f
class Solution: """ 合并两个有序数组 """ def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """ 双指针/从后往前 参数: nums1:待插入整形数组 nums2:插入的整形数组 m:nums1存储数据数量 n:nums2存储数据数量 返回值: 时间复杂度: ...
16,414
b2ccf2b88f0673aa692f35d230ecb88694d83db2
# coding: utf-8 # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def kthLargest(self, root, k): """ :type root: TreeNode :type k: int :rtype: int ...
16,415
c17b3e7e29dd1454d5f1b40bfcd07365df77d3d5
import base64 MESSAGE = 'GksfEA0ABAdLEhAPEBUGHgkEGkRNVB9WX1lcVwALGQBJQ1tUH1BDQVVXDAkIQkJDRhFeU19HREFG TFZFSQoPF0pQVFxSXgRLQEVJAgIcUVBGUF1XDxhLRVRDRgFWWV9WW1cFS0BFSREAFlpcREYXEltM SxYPBQRTFBUXU19dRkxWRUkUCBoZEk0=' KEY = 'allencat850502' result = [] for i, c in enumerate(base64.b64decode(MESSAGE)): result.append(c...
16,416
9ff46483c3a99ae2d6574dbeb377187c71b6a057
"""Conway's Game of Life Simulation Started: August 6th 2020 @author: Samuel T. Siaw""" # Objective: Draw a canvas # Draw grids on the canvas to represent cells # Mouse click on a cell highlights the cell from tkinter import * from tkinter import ttk from gol_algo import GameOfLife as gol from Constants im...
16,417
e3b7297b0f913b768f66a30cd7ee5468ea6135a6
class User: def __init__(self, name, email, int_rate, balance=0): self.name=name self.email=email self.account=BankAccount(int_rate, balance=0) def make_deposit(self, amount): self.account.deposit(amount) def make_withdrawal(self, amount): self.account.withdraw(amount...
16,418
36a16da09683d7106724f1909e67efaff8c9c560
restarting... pointer... server into vps wait/"linux","cantos","windows","PrankBots","vultra"/import PRANKBOTS or PB expel thrift=11 into file microscofe.txt for database prank import wait poin.services prank import database.server from..prank, ranger, response, thrift, ttyps, rangerv2, PrankBots_v.04 import updater fr...
16,419
80a3c76ada165f9a373b3d1582a14e41b17cead1
# coding: utf-8 # In[3]: import copy class TreeNode(object): def __init__(self,x): self.val = x self.left = None self.right = None self.parent = None class Solution(object): def insert(self, root, val): cur = root while (cur != None): p = cur ...
16,420
eceae9e847b2e9d7fc0b3ac2d3df4a2e2eadf8f4
from django.db import models from django.utils.encoding import python_2_unicode_compatible class ItemModel(models.Model): name = models.TextField() name_slug = models.SlugField(blank=True) pic = models.ImageField() #Description of item unique = models.TextField(blank=True) notes = models.TextField(blank=True) ...
16,421
6b3ac149cba53eb764600efc12e96c10e51a8e85
from ._utility import ( rolling_train_test_split, get_features, adf_test, flatten_x_train, flatten_x_test, denoising_func ) # noqa __all__ = ( 'rolling_train_test_split', 'get_features', 'adf_test', 'flatten_x_train', 'flatten_x_test', 'denoising_func' )
16,422
65fda8d6119881c4550e165194588452497226d1
{ "cells": [ { "cell_type": "code", "execution_count": 24, "metadata": { "scrolled": true }, "outputs": [], "source": [ "import folium as fm\n", "import pandas as pd\n", "import json\n", "\n", "df=pd.read_csv(\"in.csv\")\n", "list_lat=list(df[\"lat\"])\n", "list_lng=...
16,423
31c0bea725645082dc5e55a07d3a53eb58bf40ad
from Tkinter import * import tkMessageBox #import time import plotly.plotly as py import plotly.tools as tls from plotly.graph_objs import * class MainLoop: def __init__(self, master,streamID, txt): self.root = master self.root.protocol("WM_DELETE_WINDOW", self.on_closing) #Message box ...
16,424
848acfcef760ce6c3c9b156f83a5d79992290c70
# -*- coding: utf-8 -*- """ Created on Fri Jan 26 15:51:47 2018 @author: toti.cavalcanti """ #https://www.hackerrank.com/challenges/30-scope/problem class Difference: def __init__(self, a): self.__elements = a # Add your code here def computeDifference(self): max_diff = 0 for i in...
16,425
0d3b244ecf0ae69a2fd2cb02672d73889378eefa
import math import threading from tensorflow.python.keras.utils import data_utils import MF_RP_mat import utils from utils import synchronized_open_file class RP_Sequence(data_utils.Sequence): """ for multi-channel RP mats, RP autoencoder """ def __init__(self, n_samples, batch_size, RP_mats_h5array...
16,426
bac0d9d4214c1e3eb8e036f3a700214d914cdf3d
recipes = { 'Бутерброд с ветчиной': {'Хлеб': 50, 'Ветчина': 20, 'Сыр': 20}, 'Салат Витаминный': {'Помидоры': 50, 'Огурцы': 20, 'Лук': 20, 'Майонез': 50, 'Зелень': 20} } store = { 'Хлеб': 250, 'Ветчина': 120, 'Сыр': 120, 'Помидоры': 50, 'Огурцы': 20, 'Лук': 20, 'Майонез': 50, 'Зелень': 20 } def che...
16,427
3a654e8f68501c5f4c6c903c2628ba1d49f9dd34
# -*- coding: utf-8 -*- """ Created on Tue Mar 3 19:11:13 2020 @author: Henning """ import enum class attack_types(enum.Enum): #Specific attacks APACHE2 = ["apache2"] BACK = ["back"] BUFFER_OVERFLOW = ["buffer_overflow"] FTP_WRITE = ["ftp_write"] GUESS_PASSWD = ["guess_passwd"] HTTP...
16,428
7665985c4f409a577e0c4273069f6d342df4b04d
# from test import test from senti19.senti19.test import test_name # test.test_name() # Tests().test_print_name()
16,429
cb3f0cc8e3876db3ee3c4766ca5f4213ebb6d22b
from django.apps import AppConfig class DjangoAppConfig(AppConfig): name = 'django_app' verbase = 'Django url name学习'
16,430
3a380fc79e2091d4ef25facfb81f113dbaecc655
from PyQt5.QtCore import QDate, QDateTime, QFile, QTime, Qt from PyQt5.QtGui import QFont, QTextCursor, QTextListFormat, QFont from PyQt5.QtWidgets import QTextEdit class EditorProxy: """ The editor class is a helper class that handles a lot of the manipulations and relieves the main class from these task...
16,431
79bf50600eeff55853f79c66c1a53e483444b84c
from torch.utils.data import Dataset,DataLoader import numpy as np from PIL import Image from torchvision import transforms,utils # 数据加载预处理 def default_loader(path): im = Image.open(path).convert('RGB') im = np.asarray(im.resize((224,224))) # print("im.shape",im.shape) return im class MyDataset(Datase...
16,432
871a2d7f8b7aeff6299ff38493e1d4266a2eb198
from sqlalchemy import * from migrate import * from migrate.changeset import schema pre_meta = MetaData() post_meta = MetaData() post = Table('post', pre_meta, Column('id', INTEGER, primary_key=True, nullable=False), Column('body', VARCHAR(length=140)), Column('timestamp', DATETIME), Column('user_id',...
16,433
91ace0fbd499111ba72b33ac98cc06691daec829
import requests, prettify from bs4 import BeautifulSoup page = requests.get('http://www.cricbuzz.com/cricket-match/live-scores') soup = BeautifulSoup(page.text, 'html5lib') head_line = soup.findAll("h1", {"class": "cb-schdl-hdr cb-font-24 line-ht30"}) print(head_line[0].text) print("------------------") ...
16,434
1958eb14e5565dd5e45aff9f8c33f238880c2c02
"""Core Explore Exampe Type App Settings """ from django.conf import settings if not settings.configured: settings.configure()
16,435
0e8f23c50b612f62863490a63cfee09f596c4ab0
class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def rotateRight(self, head: ListNode, k: int) -> ListNode: if not head: return nums=[] root=head while head: nums.append(head.val) head=head.n...
16,436
3c9ac92ced4f605d49815a2defee6d2a7352356c
# square the numbers in a list and store it num = [1,2,3,4,5,6,7,8,9] nums = [] for ele in num: nums.append(ele*ele) print(nums)
16,437
bd2240e48294ed591a728371eff962a160dddcd0
from nerodia.browser import Browser br = Browser(browser="firefox") br.goto("https://www.w3schools.com/html/html_form_elements.asp") br.element(css="textarea[cols='30']").send_keys("hello world") br.element(css="textarea[cols='30']").send_keys([COMMAND + 't']) browser.close()
16,438
f726a43754f906218fe5467fc61cf2749871ab1b
# Test section of audio_core class # Last Modificication from D3Rnatch import sys import time sys.path.insert(0, 'src/') from audio import * # creating and starting the audio core system. # has record mode. audio = audio_core() frames = [] # we get 500 chunks from audio input device # but first enable continuous re...
16,439
e63c54abe64f1ef466ee982635b40555f121b800
# format_a = "{}".format(10) # format_b = "{} {}".format(10,20) # format_c = "파이썬 열공하여 첫 연봉 {}만원 만들기".format(5000) # print(format_a) # print(format_b) # print(type(format_b)) # print(format_c) # output_a ="{:010d}".format(-30) # output_b="{:010f}".format(3.141592) # Pi= 3.141592 # output_c = "{:g}".format(52.000) # ...
16,440
5546f2c6ca672c4806001830043d34050cd8a354
''' Description: Editor's info in the top of the file Author: p1ay8y3ar Date: 2021-03-31 22:56:03 LastEditor: p1ay8y3ar LastEditTime: 2021-04-01 13:44:17 Email: p1ay8y3ar@gmail.com ''' # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'pks_signup.ui' # # Created by: PyQt5 UI code generator 5...
16,441
e191718a5605aa22fefa23209b80ce90a7066c80
Regex: (alt\=\"[A-Z0-9]*\_[A-Z]*\") Match: alt="F1000025_square" Regex: (\(ID\: ([0-9]{7})\)) Match: (ID: 1234567)
16,442
d563fd7c670c33428a5a624f24ffdeb7e254b9f2
import argparse import re parser = argparse.ArgumentParser(description= "", add_help=False) parser.add_argument('-l', metavar='lamp', help='LAMP primers from laval software') parser.add_argument('-p', metavar='csv', help='position in a csv file') args = parser.parse_args() p...
16,443
62e0d5bee6e7136057404706360c6bc365f7d526
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from sklearn.metrics import accuracy_score, f1_score, roc_auc_score, precision_score, recall_score ## Part 1: read/load data def read_data(fn, filetype = "csv"): if filetype == "csv": return pd.read_csv(fn) i...
16,444
86e286b264daae5b06ca4eb995de4702c1eb8da2
#change the first character occurence in a string to "$", except the first character itself my_str = input("Enter the string: ") print((my_str.replace(my_str[0], "$")).replace("$", my_str[0], 1))
16,445
f926fe0fccc24e95074f12812041b58a27e4e34b
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 26 10:39:41 2019 @author: antoineleblevec Programme utilisé avant la découverte de Panda Pas sur qu'il soit encore utile """ # ============================================================================= # Modules à importer # ====================...
16,446
6f524701371748eae5bf9800a3008b8b84da69f6
# Copyright 2008-2015 Nokia Networks # Copyright 2016- Robot Framework Foundation # # 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 ...
16,447
df97c1ed468bc7b3cacf5901d80a5695af8ee361
# -*- coding:UTF-8 -*- import numpy as np import collections X1D = { 0: '1', 1: '2', 2: '3' } X2D = { 0: 'S', 1: 'M', 2: 'L' } YD = { 0: '-1', 1: '1' } X1E = { '1': 0, '2': 1, '3': 2 } X2E = { 'S': 0, 'M': 1, 'L': 2 } YE = { '-1': 0, '1': 1, } def deco...
16,448
c9caf0bd2dc98377d49c0ce9df4c82da7e8d3427
from django.urls import path from . import views app_name = 'contact_app' urlpatterns = [ path('contacts/', views.contact_view,name='contact_view'), ]
16,449
011ea7e4b23a81483bce122e8b85cef500f1441f
import re import json from json import JSONDecodeError from typedpy.structures import ImmutableStructure, Structure from typedpy.fields import String, AnyOf, Array class ErrorInfo(ImmutableStructure): field = String value = String problem = AnyOf[String, Array] _required = ["problem"] display_type_...
16,450
85520715c879d8e9909a31ef8f448dcd8f9fec0c
""" 先看当前点属于那个窗口,如果都不属于,就输出IGNORED 如果属于某一个,很简单,最上面的置于顶层 done ok """ n,m=list(map(int,input().strip().split())) martrix=[] points=[] for i in range(n): martrix.append(list(map(int,input().strip().split()))) for j in range(m): points.append(list(map(int,input().strip().split()))) getIndex=m...
16,451
1f8176b69bdddea8c115ba7aff391aad7aaef600
import keras from sklearn.metrics import roc_auc_score import sys import matplotlib.pyplot as plt from keras.models import Model import numpy as np from keras import backend as K class DecayLearningRate(keras.callbacks.Callback): def __init__(self, startEpoch): self.startEpoch = startEpoch def on_tr...
16,452
1d5db796e507b22d3c3fba956977ea6bbbae5fc3
from bs4 import BeautifulSoup import requests import time headers = { 'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36', 'Referer':'http://tieba.baidu.com' } # 抓取网页的方法 def get_html(url): try: res = requests.get(url,headers = head...
16,453
4a3d41315ef0bfde76fc997175f8c6f08d85dee9
n,m=input().split() n=int(n) m=int(m) for x in range(n+1,m+1): if(x%2==1): print(x,end=" ")
16,454
806817e1c2df64fc6c0d847e6e038cc029934f25
class A: def m1(self): print("m1.....") print(id(self)) print(self.x) a=A() a.x=100 a1=A() a1.x=200 print(a.x) print(a1.x) print(id(a)) print(id(a1)) a.m1() a1.m1()
16,455
3c6610b3538149b959786da6474d01793917d95d
def l(): pass def I(): pass class X: def O(self): pass def x(): pass
16,456
3da2637e171352270e4068e7464909e2fb35e648
#!/usr/bin/env python # -*- coding: utf-8 -*- import os, sys, string import MySQLdb import cus_os import cus_login cus_login.connect() cus_os.connect() #1.check all orders of a customer cus_id = cus_login.cus_log_in("happygirlzt@gmail.com","123") result = cus_os.get_all_orders(cus_id) #2.search flight #choose departur...
16,457
2294d614e8a67641c489840f2b12bd95482b14e2
from django.contrib import admin from .models import contact,Post # Register your models here. admin.site.register(contact) admin.site.register(Post)
16,458
b0450bdd63b452b28a34bd35ed836b2d981a95b3
# # Copyright (C) 2009-2021 Alex Smith # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS A...
16,459
a5645083ed70836806cf387c01789980dc9cc113
from django.db import models from django.core.validators import MinValueValidator import datetime class Wojewodztwo(models.Model): numer = models.IntegerField(unique=True, validators = [MinValueValidator(0)]) nazwa= models.CharField(unique=True, max_length=50) def __str__(self): # Wyświetlaj nazwe...
16,460
dd8b7c5648980849352850ccf574b40ae9447344
from django import forms from django.forms import fields from .models import Order, Room from django.conf import settings class OrderForm(forms.ModelForm): class Meta: model = Order fields = "__all__" # rooms = Room.objects.all() # choices = [] # for room in rooms: ...
16,461
dd8617a2886cb1dd90806325014c3a247633fb81
from rest_framework import permissions from rest_framework.permissions import IsAuthenticated, AllowAny SAFE_METHODS = ['GET', 'POST', 'HEAD', 'OPTIONS'] OBJECT_METHODS = ['GET', 'HEAD', 'OPTIONS'] class LoginPermission(permissions.BasePermission): def has_permission(self, request, view): if (request.me...
16,462
c1e2c68606cb2224a5e8ae987d55012f28def2c0
# MIT License # # Copyright (c) 2021 DTOG # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish...
16,463
43e00753887291665c87f1110bc8a77def681f8c
from django.shortcuts import render, get_object_or_404, redirect from django.contrib import messages # Create your views here. from .models import * from django.http import JsonResponse import json import datetime from .utils import cookieCart, cartData from validate_email import validate_email # Create your views here...
16,464
405d74a9506e7c7ec88c82a1a218b7c3366adad3
import numpy as np import cv2 import argparse import os """ Saving frames from a video """ #construct the argument parser and parse the arguments ap = argparse.ArgumentParser() ap.add_argument("-i", "--inputFilePath", required=True, help="Where is your video") ap.add_argument("-o", "--outpuFilePath", required=True, he...
16,465
296b52e1af55067ff281eaee765e70bdb60573f9
import turtle import math pen = turtle.Turtle() '''for i in range(3): pen.fd(100) pen.lt(360/3) for i in range(4): pen.fd(100) pen.lt(90)''' def nbianxing(n, p, l): for i in range(n): p.fd(l) p.lt(360/n) #nbianxing(n = 614, p = pen, l = 3) def yuanxing(p, ...
16,466
6ec0dd7aa30768c30e40b3d0c90ace8f9ceba245
from averager import Averager from simulation import Simulation class Control: """Runs bias simulations based on "Male-Female Differences: A Computer Simulation" from the Feb, 1996 issue of American Psychologist. http://www.ruf.rice.edu/~lane/papers/male_female.pdf""" def __init__(self, promotion_bias...
16,467
81c348d600008d85e9c5d7aa36ec4ddf05d50ffd
''' @Author:Sailesh Chauhan @Date:2021-06-06 @Last Modified by:Sailesh Chauhan @Last Modified time:2021-06-06 @Title:Clinic Management Application ''' import json import logging from decouple import config FILE_PATH_LOG=config('log_File_Path') FILE_PATH_JSON=config('JSON_File_Path') logging.basicConfig(filename=FILE...
16,468
2770a9faf6b1a995fcdf7f1ab19300aee26334d2
# -*- coding: utf-8 -*- """ Created on Mon Nov 07 13:59:24 2016 @author: yangz """ #!/usr/bin/python #-*- coding:utf-8 -*- import re import requests import sys import urllib import time import socket import os import codecs os.chdir('C:\Users\yangz\Desktop\pacong3') reload(sys) sys.setdefaultencoding("utf-8") def html...
16,469
a6e37b139b2e96b2f3e7470350a50680c9723bb5
#https://projecteuler.net/problem=4 product = [] for i in range(100,1000): for j in range(100,1000): if str(i*j) == str(i*j)[::-1]: product.append(i*j) print(max(product))
16,470
b08ac829ecc925c7b40e3cd7cb73311459ae8736
import numpy as np import math class DATA(object): def __init__(self, n_question, seqlen, separate_char, name="data"): self.separate_char = separate_char self.n_question = n_question self.seqlen = seqlen def load_data(self, path): f_data = open(path , 'r') user_to_q_sequ...
16,471
e7e80e66794381044ad29d994dc852953b45a569
__author__ = 'Matt Fister'
16,472
9fb026a1377ed7a92c9876a1cc2cb103bed1a9cb
from unittest import TestCase from models.item import ItemModel class ItemTest(TestCase): def setUp(self) -> None: self.item = ItemModel("Test", 10.99) def test_create_item(self): self.assertEqual("Test", self.item.name, "Item name after creation is not correct!") self.assertEqual(10....
16,473
f780b4f008309f6b55dff77f8ed0c41d44a4bced
from django.urls import path from . import views as search_views urlpatterns = [ path('addDB/' , search_views.addDB , name = 'search-addDB'), path('queryDB/' , search_views.queryDB , name = 'search-queryDB'), path('results/',search_views.results, name = 'search-results') #path('download-csv/' , views....
16,474
5e326515b058adf60436f8c9c2c8cb17d0932525
import tensorflow as tf from tensorflow import keras from keras.models import Sequential, Model from keras.layers import Input, Dense, Activation, Dropout, LSTM, \ Flatten, Embedding, Multiply, Lambda from keras.layers.convolutional import Convolution2D, MaxPooling2D, ZeroPadding2D import h5py def vqa_model(embed...
16,475
1027dfce7172e82e502d0f26dac3812671930f37
import os from FTPserver.core import Config def run(cwd, path, sk_obj, userid=None): if path == 'server': cwd = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sk_obj.sendall(bytes('chdir successfully!', 'utf8')) return cwd elif path == 'user': cwd = os.path.join(Co...
16,476
472d0799c30c098a81bc8b46f1d63ecbddede1c0
from dataclasses import dataclass import sys import os INPUT = open(os.path.join(sys.path[0], 'input')).read() @dataclass class Node: id: str parents: [] children: [] depth: 0 def tree_from_input(input: str): edges = input.split('\n') tree = {} for edge in edges: parent_child =...
16,477
a35d6858a892939206623aaed380ad4b17f338a7
try: a = int(input()) b = int(input()) r = a / b except (ValueError, TypeError): print("Problema de tipos de dados") except ZeroDivisionError: print("Não é possivel dividir por Zero") except KeyboardInterrupt: print("Não tivemos dados informados") except Exception as erro: # Podem ha...
16,478
0b94c47f166e3570e183d5166ecd2d590f538c39
import requests import random import time from urllib.parse import urlencode import cv2 from PIL import Image import os import code import pytesseract class WenJuanXing(object): def __init__(self, q_num, q_data): self.base_url = 'https://www.wjx.cn/jq/%s.aspx' self.base_submit = 'https://www.wjx.c...
16,479
d416a81a098daf6ea84cfb6475d78830f34a09ef
from django.shortcuts import render def chatbot(request): return render(request,'rage_app/index.html') # Create your views here.
16,480
c5891416c64b11c67f2b6d9e954e5d21f4e1c4c3
class initialisation: ''' In this class will be method with initialisation ''' def make_initialisation(self): ''' Method with initialisation ''' name = input("Please, enter your name: ") print("Greatings, ", name, ",you are now in program that cal...
16,481
5d1ff5fda7b82d5a6b2dec2171095f1ff52bed71
import rhinoscriptsyntax as rs xCoordinateList = [51.0918130155,35.9607337,45.5405031,33.4499993,51.0355914,33.6713751,43.6643776,43.7129464,33.4481059352,40.4414214,43.862484,43.6641249,33.4798071,45.5180358,51.0918572,51.0424689,45.507699,36.1783477,36.1883858514,36.1922841,36.2608162,41.4999894,33.4952976,43.681327...
16,482
4616da7ab86f39e6aade85dfe4180e569cda1be9
import base64 import numpy as np import io from PIL import Image import keras import tensorflow as tf import cv2 from keras import backend as K from keras.models import Sequential from keras.models import load_model from keras.preprocessing.image import ImageDataGenerator from keras.preprocessing import image from kera...
16,483
c354920818ca548bf52af2f19bd640295d762ddd
n=int(input()) A=list(map(int,input().split())) ans4 = 0 ans2 = 0 for a in A: if a % 4 == 0: ans4 += 1 elif a % 2 == 0: ans2 += 1 ans2 = ans2-(ans2%2) if (n-ans2)//2 <= ans4: print("Yes") else: print("No")
16,484
197e5c050b2b926fb05fc869f3c90f2c6583ad63
# 주어진 도시들의 도로망에서 불필요한 도로를 제거하여 새로운 도시망을 구축한다. roadRegister = [[False, True, True, False, False, False], [True, False, False, True, False, False], [True, False, False, False, False, False], [False, True, False, False, False, False], [False, False, False, ...
16,485
05cb7fe13b409069a436f7a2813227083d93f611
from log_into_wiki import * import re site = login('me','zelda') # Set wiki summary = 'Rename Modules' # Set summary limit = 10 #startat_page = 'asdf' lmt = 0 for p in site.allpages(namespace=828): if limit == lmt: break lmt += 1 print(p.name) text = p.text() text_table = text.split('\n') newlines = [] for l...
16,486
c7e52bc8bb648d69f6bfcd3795454f052788bdfa
from craigslist import CraigslistForSale cl_e30 = CraigslistForSale(site='boston', category='cta', filters={'make': 'bmw', 'auto_transmission': ['manual'], 'min_year': 1987, 'max_year': 1991, 'search_distance': 1000}) for result in cl_e30.get_results(sort_by='newest'): print(result)
16,487
49e38b2fb9b8826f6e614f2aa97308214e462267
# Copyright 2019, The TensorFlow Federated Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
16,488
d247fc129c5e9c988be362ec8b46b02908cae0d9
######## Cylinder ######### import math class Cylinder: def __init__(self,radius,height): self.radius=radius self.height=height def get_radius(self): return self.radius def set_radius(self,radius): if radius>0: self.radius=radius def get_height(self): ...
16,489
95bb5dc2deb50db37922413ac045c1ab65d5e249
# print("Shalom") # input('What is your name?') # name = input("What is your name?") # print( "Hello " + name) # x = "Python is" # y = " awesomPiee" # z = x + y # print(z)P
16,490
5359a8c4d5777c325d63110db7180467def68297
import json class Config: def __init__(self, file): self.__config = {} self.__openFileToJSON(file) # Opens a configuration file # return a JSON object def __openFileToJSON(self, file): self.__config = json.load( open(file) ) def getRoomX(self): ...
16,491
c116c40862ba3c822538d5aba0dfb7409e7cab9c
import sys, os, django sys.path.append("d:\\Python\\Django") #here store is root folder(means parent). os.environ.setdefault("DJANGO_SETTINGS_MODULE", "web.settings") django.setup() from transport.models import Bus_stop, Bus_route, Route_way import json import requests #from transport.models import Bus_stop, Bus_rout...
16,492
a9576fecb50291b60d6c42b2ec34687ec05abc34
''' Created on 2021-08-07 @author: wf ''' from corpus.quality.rating import EntityRating class EventRating(EntityRating): ''' a rating for an event ''' def __init__(self,event): super().__init__(self,event,event.eventId,event.source,"Event") class EventSeriesRating(EntityRating):...
16,493
9f21103c02a7fdff37298f1da562d90c69d74777
from .models import Item, ItemImage, ItemTag, ImportItem, ImportImage import xml.etree.cElementTree as eTree from django.conf import settings import os.path import requests from django.core.files import File from django.core.files.temp import NamedTemporaryFile from slugify import UniqueSlugify def save_image_from_ur...
16,494
78860c45e4f1a2ee6797d8ca9a15154e685cb266
from rest_framework.viewsets import ModelViewSet from .models import Fact, Post, Project from .serializers import FactSerializer, PostSerializer, ProjectSerializer # JWT Auth from rest_framework.permissions import IsAuthenticated class FactViewSet(ModelViewSet): permission_classes = (IsAuthenticated,) query...
16,495
8d81808876f56ae176302e485272b419e411d2c4
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from os.path import splitext, basename, dirname import ctypes import argparse import logging import csv from csv import DictWriter, DictReader import sys try: csv.field_size_limit(int(ctypes.c_ulong(-1).value // 2)) except: csv.field_size_limit(int(ctype...
16,496
431a11acee5fd58316600ea9081c8c0162eca7e1
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # https://docs.scrapy.org/en/latest/topics/items.html import scrapy class ScrapperItem(scrapy.Item): link = scrapy.Field() address = scrapy.Field() description = scrapy.Field() image_url = scrapy.Field(...
16,497
c9103e889ff76efc8db2973c8a855b02fc1af06e
# Generated by Django 3.2.6 on 2021-08-29 12:13 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('th', '0001_initial'), ] operations = [ migrations.RenameField( model_name='thpic', old_name='ThPic_CODE', ...
16,498
67d6bb326a9815f2f28cafae2a39f409d0225060
import string caption = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj" new_string = "" for letter in caption: #{ found_position = string.ascii_lowercase.find( ...
16,499
85e45b2a82604f564368f307c76ce604614aa7ad
#Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None def subtreeWithAllDeepest(root): def depth(root, d): if not root: return (d, None) l, r = depth(root.left, d + 1), depth(root.right, d...