index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
991,100
064366008192b23393525520a650a8d281a76419
import tensorflow as tf import pandas as pd import numpy as np import os def train(filename): y = tf.placeholder(tf.float32, [None, 10]) traindata = pd.read_csv(filename).values imagedata = traindata[:, 1:] imagedata = imagedata.astype(np.float) imagedata = np.multiply(imagedata, 1.0 / 255) ve...
991,101
2959600e7e42ec212b4823afa144660fd07ebc3e
from torch.utils.data.dataset import Dataset from data.image_folder import make_dataset import os from PIL import Image from glob import glob as glob import numpy as np import random import torch class RegularDataset(Dataset): def __init__(self, opt, augment): self.opt = opt self.root = opt.da...
991,102
34381db099044011cf4d43f4cfa374b4420d624c
import parselmouth # https://parselmouth.readthedocs.io/en/stable/ from utils.syllabe_nuclei import speech_rate from pathlib import Path import os import numpy as np import json path = Path("static/sounds/") info_dict = {} for file in os.listdir(path): if file.startswith("0") or file[0].isupper(): prin...
991,103
2930af02ce8cf5ad4186bd9a6724374a365072d6
import ocdskingfisher.util from tests.base import BaseTest class TestDataBase(BaseTest): def test_create_tables(self): self.setup_main_database() class TestUtil(BaseTest): def test_database_get_hash_md5_for_data(self): assert ocdskingfisher.util.get_hash_md5_for_data({'cats': 'many'}) == '...
991,104
9ef2d58351e41decc892bc85af74304cec6660b9
""" Introduction to the high-level contrib-learn API of TensorFlow using the Iris dataset. Will Long June 12, 2017 """ import os from urllib.request import urlopen import tensorflow as tf import numpy as np IRIS_DIRECTORY = "iris_data/" IRIS_TRAINING = "iris_training.csv" IRIS_TRAINING_URL = "http://download.tensor...
991,105
c542b1c14705ee700506c46b519dd58b429a21c4
# -*- coding: utf-8 -*- """ Created on Sun Jan 5 15:29:40 2020 @author: YANGS """ import twstock import requests import time def get_setting(): try: res=[] with open("stock.txt") as f: lists=f.readlines() print("讀入資料:",lists) for lst in lists: s...
991,106
af359a0152a22fd0f70ecd95bda992144d134cfe
'''Generates make file to generate the different plots ''' from bact2.applib.bba import commons from bact2.applib.transverse_lib.plots_makefile import main_func def main(): pickle_file_name = commons.pickle_file_name() main_func(makefile_name=commons.makefile_name(), pickle_file_name=pickle_file...
991,107
1c72c3eb62e85e50ec4c3beb7f7037307dc3a78d
""" Crie um programa que leia o nome completo de uma pessoa e mostre: - O nome com todas as letras maiúsculas e minúsculas. - Quantas letras ao todo (sem considerar espaços). - Quantas letras tem o primeiro nome. """ name = str(input('Digite seu nome completo: ')).strip() nameUpper = name.upper() nameMin = name.lower...
991,108
30a7b68e119b3be7df6d697f6f88665f8214708c
import socket import time import numpy as np import struct import atexit class PushBot2(object): def __init__(self, address, port=56000, message_delay=0.01): self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.socket.connect((address, port)) self.socket.settimeout(0) ...
991,109
890b869985f73ea270eb16721122911bfd1af3c5
s=input() l=int(input()) x='' for i in range(len(s)): if i%l==0: x+=s[i] print(x)
991,110
1bdc0edc387f7b786bbc6a4d6c40cbfb1226000c
# 3-05. 영상의 명암비 조절 (2) import sys import numpy as np import cv2 src = cv2.imread('ref/Hawkes.jpg', cv2.IMREAD_GRAYSCALE) if src is None: print('Image load failed!') sys.exit() dst = cv2.normalize(src, None, 0, 255, cv2.NORM_MINMAX) # 입력영상 src, 결과 dst None(무시), 알파(최소값) 0, 베타(최대값) 255, NORM_TYPE은 MINMAX(최소 최대...
991,111
71cd9991bc92df19d030f95a52d7b1e1c1999c8a
import os from pathlib import Path # from doc_name import functuon from FindLinks import findLinks, __make_soup from CrawlParsedData import crawlLink from Types import CountryName, EventTopic countryList = [CountryName("United States", "united-states")] topicInfoList = [EventTopic("ai", 2), EventTopic("technology", 2...
991,112
84c692400092327be8d677f99f3e4be977c1f2a3
# https://leetcode.com/problems/split-a-string-in-balanced-strings/submissions/ class Solution: def balancedStringSplit(self, s: str) -> int: L = 0 R = 0 output = 0 for i in s: if i == "L": L = L + 1 if i == "R": R...
991,113
2623b9374952761b056a470bb28cb453cd5c9c28
# coding=utf-8 from __future__ import unicode_literals import datetime from selenium.webdriver import ActionChains import time import random from helpers.waits import wait_until_extjs class Plan(object): def __init__(self, driver): self.driver = driver """ @type driver: WebDriver "...
991,114
e1c138ea539dc8364f62286c7a438d1e4d3efd10
#!/usr/bin/env python from math import sqrt class Problem7(object): def prime(self, element): prime_counter = 0 number_to_test = 1 while prime_counter < element: number_to_test += 1 if self.is_prime(number_to_test): prime_counter += 1 return...
991,115
0cc46b1e92b934bd8cebd9e8639ce963be82beb4
""" Created on Mon Dec 3 18:52:44 2018 @author: simon Project: FuturaeNetcom/4chan """ import ModelTraining import Scraping # main part of the programm def main(bool_scraping): if (bool_scraping): scraping() else: learning() return # starts using ModelTraining.py def learning(): M...
991,116
33a48df20f610aab7660715a269310ca94ffc867
import matplotlib import os from os import path from os.path import isfile,join import random import torch import torchvision import numpy as np import matplotlib.pyplot as plt import sys sys.path.insert(1, '../utils') sys.path.insert(1, '../datasets') sys.path.insert(1, '../search') import my_datasets as mdset import ...
991,117
1913095b72a41e491ae6cde2231f466123ca4924
import gdata.photos.service import gdata.media import gdata.geo import os email = 'apirakb@gmail.com' username = 'apirakb' password = 'Spid#rman' path = '/Users/apirakb/Pictures/Events' check = True # Prepare Google data gd_client = gdata.photos.service.PhotosService() gd_client.email = email gd_client.password = pa...
991,118
55edc1cec37bb820370e566a354a7964dd342c70
from PIL import Image #xa, xb = -1.773660804, -1.7736607983 #ya, yb = 0.0063128809733, 0.006312884305 xa, xb = -2, 2 ya, yb = -2, 2 imgx, imgy = 512, 512 maxIt = 256 one = Image.new("RGB", (imgx, imgy)) for y in range(imgy): cy = y * (yb-ya)/(imgy-1) + ya for x in range(imgx): cx = x * (xb-xa)/(imgx-1) + xa ...
991,119
160a3ab6a55bebe6aa4cb67679178282eeb77a9f
############################################################################## # # Copyright (c) 2001, 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # TH...
991,120
2f7c3e41f1175793825648b6616e4b8f13d47b94
#!/usr/bin/python import paramiko import multiprocessing import sys def cmd(IPS,WAR,USER='wls81',PASSWORD='Paic#234'): for IP in IPS: s = paramiko.SSHClient() s.set_missing_host_key_policy(paramiko.AutoAddPolicy()) s.connect(hostname=IP,username=USER,password=PASSWORD) s.exec_co...
991,121
2f4d4d388e2f819cff99145b327a57d1cf9adc6a
import sys import os import pygame import glob import random SIZE = 640 pjas_namn = ("torn", "hast", "lopare", "drottning", "kung", "lopare", "hast", "torn") vita, svarta = [], [] pjas_dict = {'v':vita, 's':svarta} player_side = 'v' bot1_side = 's' is_legit = lambda x, y : 0<=x<8 and 0<=y<8 def get_rel_...
991,122
d47587fe7decc58900936d0816ed93f82423857c
import sys import re def apply_mask(mask, value): set_ones_mask = int(''.join('0' if char in ('X', '0') else '1' for char in mask), 2) set_zeros_mask = int(''.join('1' if char in ('X', '1') else '0' for char in mask), 2) value |= set_ones_mask value &= set_zeros_mask return value def test(): m...
991,123
ec9403b63fd35d7aff86e244a2caca66996d72d9
import os import cv2 import numpy import requests import time from img_processing import get_list_file def download(url='https://www.tncnonline.com.vn/usercontrols/QTTJpegImage.aspx', extension='jpg', directory='img_file/', max_img=1000): if not directory.endswith('/'): directory += '/' for x in rang...
991,124
712d9b9bbc318d0e988e09b9359b1e4c96ea0dbd
#! /usr/bin/python # # Vulnserver TRUN Command Buffer Overflow Exploit POC # Created By : @Ice3man # Email : Iceman12@protonmail.com # # Common Info : # Launches Calculator on Opening. # Server Listens on Port : 9999 ( Commonly And Default ) # Pretty Simple : Neither DEP or Stack Canary Used. # # C...
991,125
331cabcc912b875487de2c3d1083e88c11cd2197
import random from typing import List, Dict from GameLogic.Players.Players import Player from GameLogic.SysConfig import SysConfig from GameLogic.Orders import Sell from GameLogic.AssetFundNetwork import Asset, Fund class Attacker(Player): def __init__(self, initial_portfolio: Dict[str, int], goals: List[str], a...
991,126
a25aa2a139c26f9f9c38d4d32c9c539338128273
import json import time import logging import os from lxml import etree from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from...
991,127
0960162ca2d403745fc46489e440c45cb5366b26
import unittest class Node(object): def __init__(self, data=None, next=None): self.data = data self.next = next def get_data(self): return self.data def get_next(self): return self.next def set_next(self, next): self.next = next def create_linked_list(arr): ...
991,128
3e2207fb3cdb1c6ddc7d0783acdbc3b9341531e1
#!/usr/bin/env python3 from socket import * import sys import signal if (len(sys.argv) != 3): print("Usage: receiver <file name> <timeout (ms)>") sys.exit(0) fileName = sys.argv[1] timeout = int(sys.argv[2]) addr = ("0.0.0.0", 0) receiverSocket = socket(AF_INET, SOCK_DGRAM) receiverSocket.bind(addr) print...
991,129
b12668f8d858a7569531327746240e548f4dc965
#!/usr/bin/env python with open('keys.txt') as my_file: testsite_array = my_file.readlines() thefile = open('test.txt', 'w') for line in testsite_array: print line; thefile.write(str(int(line,16))) thefile.write('\n\n')
991,130
0b6861c7340020c5d9a92bde55af1cfff33ddb49
def cal_array_w_v_pair(w_v_pair, hight, now_weight, now_value, limit, return_array): # pythonの配列は参照渡しであるので、return_arrayに加えることで値が追加される if hight < limit: cal_array_w_v_pair(w_v_pair, hight + 1, now_weight, now_value, limit, return_array) now_weight...
991,131
c8b81b42fc6d859d48fbd3f21ea5b0475fafec63
from my.utils.s3_1 import s3_iter from sys import argv ######################################################################################################################## if len(argv) > 1: prefix, = argv[1:] else: prefix = None for x in s3_iter(prefix=prefix): print(x.key) ########################...
991,132
f140a38c4aa97912fce0f3b6d3ae7f443553d9fb
from sanic import Sanic Sanic.test_mode = True
991,133
a4dae3c77c8b46a86bcc9b83651dcc3adbae934d
import socket, pickle from _thread import * host="10.250.86.32" port=19382 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((host, port)) print(host, port) s.listen(1) def RecieveData (conn): print(conn) print("Data recieved : ") x=conn.recv(1024) print(x.decode()) x=x.decode() while 1: if not...
991,134
29f6943aea66c04fe2793e31c2bd84e407b95bd2
''' Given the root of a binary tree, print its level-order traversal. For example: 1 / \ 2 3 / \ 4 5 The following tree should output 1, 2, 3, 4, 5. ''' class Node: def __init__(self, val, left=None, right=None): self.val = val self.left = left self.right = right def print_l...
991,135
5450b2c0100610e142d06f04fa129284f8d0504e
# coding=utf-8 from rest_framework import serializers from models import Cmd class CmdSerializers(serializers.HyperlinkedModelSerializer): class Meta: model = Cmd fields = ('id', 'name', 'cmd', 'status', 'result', 'url')
991,136
ae15ab2b1c932609813a43a5b75d0c0c095faad1
import configparser from matplotlib.patches import Ellipse import matplotlib.pyplot as plt import numpy as np import os import pandas as pd from scipy import stats import seaborn as sns from sklearn.decomposition import PCA def process_config(config_file=''): """ by default looks for config file in the same ...
991,137
0ee76a471dcfe4334222a81cf56ffa5a4d8f92df
#### ### Title: Chapter 12 Question 14 ### Author: Spencer Riley ### Python Version: 3.5.3 #### # Import Stuff from numpy import * import matplotlib.pyplot as plt import chaosmod as cm from scipy.interpolate import interp1d from matplotlib.ticker import MultipleLocator, FuncFormatter # Main input parameters (any of t...
991,138
c10f5ced9089bb8858ab1daf56727b74df65fdb6
import pygame from pygame.locals import * import time import random from pygame import gfxdraw class Point(object): """ creating point class, to determine location of all our stuff """ def __init__(self, screen_size, x, y): self.x = x self.y = y def pos(self): return self.x,...
991,139
e453e4cd1fd722d610d4eec9fd17413de9e1fd89
import math num=math.sqrt(16) area=math.pi * radius ** 2 c = math.hypot(a,b)
991,140
f927fb59f40caa196ef22d217fc8ca5dcc93c0b2
#!/usr/bin/python #\file func_in_func2.py #\brief certain python script #\author Akihiko Yamaguchi, info@akihikoy.net #\version 0.1 #\date Jan.31, 2018 class TTest(object): def __init__(self): self.x= 101 def Run(self): def RunInRun1(): print 'x is',self.x def RunInRun2(self): prin...
991,141
b372ead839e59e3351b129d29eb20ddd1c1c0d2d
# Source: https://community.plot.ly/t/python-dash-examples-with-scattergeo/7018/2 # Source: https://plot.ly/python/scatter-plots-on-maps/ import dash import dash_core_components as dcc import dash_html_components as html import pandas as pd df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/20...
991,142
266f6ad35a6ae131072613aa9cb7a139d8f804d2
import tkinter as tk from _datetime import datetime import yagmail from tkinter import ttk from tkinter import messagebox import Colors as Col import DataBaseOperation Color = Col.ColoursMainWindow() class MakeOrder: def __init__(self, master, *args): self.Make_Order = tk.Frame(master, bg=...
991,143
c7084f3ca6f554f58d4ca29bf7917a721ceadb96
matrix = [[0, 1, 1, 2], [0, 5, 0, 0], [2, 0, 3, 3]] result=zip(*matrix) sum=0 for i in result: for j in i: if j == 0: break sum+=j print sum
991,144
fc800dbd150b9a59171e64586957cf72aa9bda49
import numpy as np import matplotlib.pyplot as plt def pause_plot(): fig, ax = plt.subplots(1, 1) n = 1000 dx = 1/n dt = 1/n c = 0.4 x = np.arange(n)/n u = np.zeros(n) for i in range(n): if i < n//10: u[i + n // 2] = i/n elif i < n//10 * 2: u[i...
991,145
9835f60ae3192a2b7198e626e7de1f1bc2dfb8c4
#!/usr/bin/env python #_*_ coding:utf-8 _*_ from selenium import webdriver browser = webdriver.Firefox() browser.get('http://localhost:8000') assert 'Django' in browser.title
991,146
ec76228a6ca56a1afb5a0c33f290f19e35d49220
S, T = input().split() A, B = map(int, input().split()) U = input() print("{} {}".format(A - 1, B) if S == U else "{} {}".format(A, B - 1))
991,147
0d8fca966d285bdc51e54d428b13f69761400d76
t = int(input()) while t > 0: n = int(input()) arr = list(map(int,input().split())) l = [] yol = arr[n-1] l.append(yol) for i in range(n-2,-1,-1): if arr[i] >= yol: l.append(arr[i]) yol = max(yol,arr[i]) l = l[::-1] for i in range(len(l)): print(l[i],e...
991,148
7be3a49a0050ef86e7e373f9f0ae4a802d8282c1
from keras.applications import inception_v3,imagenet_utils from keras_retinanet import models from keras_retinanet.utils.image import read_image_bgr, preprocess_image, resize_image from keras_retinanet.utils.visualization import draw_box, draw_caption from keras_retinanet.utils.colors import label_color import cv2 imp...
991,149
6d5850567bd31c683fb2ebbf41c6a19d8d8bea8b
Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or more of the preceding element. The matching should cover the entire input string (not partial). The function prototype should be: bool isMatch(const char *s, const char *p) Some examples: isMatc...
991,150
5493ed84a57455f985d28c80777bf9e2dc10db68
import xml.etree.ElementTree as ET import uuid import httplib import logging import json import urlparse import boto.s3 as s3 import s3etag import common logger = logging.getLogger('httpxml_to_s3') def httpxml_to_s3(http_url, s3_url, region='eu-west-1', profile_n...
991,151
90388ac07b0b5ebe99a1579516625c65005aa547
from django import forms from django.contrib.auth.models import User from bootstrap_toolkit.widgets import BootstrapDateInput,BootstrapTextInput,BootstrapUneditableInput class LoginForm(forms.Form): username = forms.CharField( required=True, lable="用户名", error_messages={'requirede':'请输入用户名'}, widget=for...
991,152
42d097bcfcc71579410c20df639a6119182844ac
#emacs: -*- mode: python-mode; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- #ex: set sts=4 ts=4 sw=4 noet: """Functionality to ease generation of vbench reports """ __copyright__ = '2012-2013 Wes McKinney, Yaroslav Halchenko' __license__ = 'MIT' import os from .analysis import ConsistentlyWorse impo...
991,153
023c892f00e17858e2733331e65de0d579abbf7d
#!/usr/bin/env python3 from mine import process, play def assertEqual(x, y): try: assert x == y except AssertionError: print("{} != {}".format(x, y)) raise def test1(): with open("13_mine_cart/test_input.txt", 'r') as f: track = [[x for x in line if x!="\n"] for line in f]...
991,154
35f0f78898b7a8a246c443847e82d2e12941eb9d
#!/usr/bin/env python # -*- coding: utf-8 -*- """ mullvad.py Check if you're connected to Mullvad VPN """ import sys import requests import json def main(): """docstring for main""" try: r = requests.get('https://am.i.mullvad.net/json') json_data = r.json() if json_data['mullvad_exit_...
991,155
91d20e32e547a9be94861b4fec07802836c7a9ca
from collections import Counter class Check: def __init__(self, dataset, cldf): self.dataset = dataset self.cldf = cldf self.errors = [] def check(self): pass class CheckNotEmpty(Check): """Check if a given column in the CLDF file is all empty""" ...
991,156
53e19f1aa65a2c4362b47bd9083d7f179d6cf53a
# ReactorTools.py # # Some tools for calculating the neutrino rate from a nuclear reactor. # # Adam Anderson # 14 April 2016 # adama@fnal.gov # # Note: Convention on units: # --all masses are in kg # --all energies are in keV import numpy as np import scipy.interpolate as interp import ROOT def nuFlux(power, dis...
991,157
9b762de425648c02f0606e2669034a475db28790
import csv import re dir='/home/dgc7/ejersiciosLibros/pyaton/ejemplos/scrapin/zlibrari/descargarLIbros/descargarparte1/contraseñasYcorreos.txt' data=open(dir,'r+') usuario=[] contraseña=[] for i in range(0,200): if i%2==0 : usuario.append(data.readline()) if i%2 !=0: contraseña.append(data.readl...
991,158
5c6cd69805339080e5ae5d10df6cd631c56196bc
from download_binary_lib import download_binary_libs, BinaryLibDescription # Disclaimer: This script is called by qmake or CMake. It is not necessary to call it manually. # Same as download_external_libs but only for qt. download_binary_libs([BinaryLibDescription("qt", "qt.zip", "https://meshes.mailbase.info/libs/q...
991,159
e19c41e4fde0d7a1e53ec2a81af6eb796a2a33b4
import re import string #applies a few simple regex rules to clean up the data def proc(data): for i,d in enumerate(data): data[i]=re.sub("<.*?>"," ",data[i]) # remove html tags like : <br /> data[i]=re.sub("[0-9]+"," ",data[i]) # remove numbers # we want to keep the sentence structure #...............
991,160
708580f1479d51743b16aee3a2caf3b00cdb29be
# source https://www.geeksforgeeks.org/python-program-for-quicksort/ def partition(arr, low, high): i = (low-1) # index of smaller element pivot = arr[high] # pivot for j in range(low, high): # If current element is smaller than or # equal to pivot if arr[j] <= pivot...
991,161
20d25e6ded87a7c543186fe9695fba7328eaa701
#!/usr/bin/python import os import subprocess import time class webServerInstance(): def __init__(self,port,currentDir): self.port = port self.currentDir = currentDir self.process = None def startProcess(self): cmd = [self.currentDir+"/tax_assessor.py","--port=...
991,162
57a655e1e0403c21703df78355d44776a7e9f49b
import spotipy import sys import spotipy.util as util import webbrowser import matplotlib.pyplot as plt import simplejson as json import pandas as pd scope = 'user-top-read' TopArtistList = [] TopArtistDict = [] ArtistCount = [] continueloop = True if len(sys.argv) > 1: username = sys.argv[1] else: print("Us...
991,163
4964830b4ee747f35121ad327555b15c1ff9a7c9
import json import boto3 import uuid import pymysql import os import hashlib def lambda_handler(event, context): # TODO implement # print(event) path = event.get("path") items = json.loads(event.get("body")) print(path, items) mydb = pymysql.connect( host= os.environ["hostname"], ...
991,164
dc74d218e84736bd87287fa3baf7bc0b06187b55
from pessoa import Pessoa p1 = Pessoa('Luiz', 44) p2 = Pessoa('Otavio', 32) p1.comer('nhoque') p1.pararComer() p1.pararComer() p1.comer('banana')
991,165
06414b1d83f9fb3f4e619a2ea2d00bb4798a2184
class Node: def __init__(self): self.level = None self.gain = 0 self.value = None self.split_attribute = None self.cutting_point = None self.leaf_value = None self.children = None self.most_popular_child = None
991,166
e2155ff087b8d4d7823fd05f98b5f44eb58d7579
def search(p,s): if p in s: return(1) return(0)
991,167
e860c50b551b2b57b496351a849b3a41933b8ee8
from django.db import models from django.contrib.auth.models import User class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) sex = models.CharField(max_length=5, blank=False) subdivision = models.CharField(max_length=30, blank=False) birth_date = models.DateField(n...
991,168
83fcb7517dc8f0aac695c7195fb428dcb22485a8
import os import gym import numpy as np from datetime import datetime from stable_baselines3 import PPO def load_render(folder, timesteps=1000, render=True): ''' Loads a previously trained agent and runs it, generating a trace. Each trace in 'traces' be a pair. Trace[0] will have an ordered li...
991,169
15fbeafd6998860876a4503f8fe194a9f68bd579
# Reverse Strings # The goal is to write a fn that takes a input(string) and returns the reversed strings """ Reverse the input string Args: our_string(string): String to be reversed Returns: string: The reversed string """ def string_reverser(string): reversed_string = '' for letter in ran...
991,170
c299ebba4f4c1d053949e8ded3bd6ccd21fa1efb
from kaiju import RobotGridCalib from kaiju.utils import plotOne import numpy def test_gfaCollision(plot=False): rg = RobotGridCalib() for alphaAng in numpy.linspace(0, 360, 100): #[0, 60, 120, 180, 240, 300, 360]: for r in rg.robotDict.values(): r.setAlphaBeta(alphaAng, 0) # asse...
991,171
139b32186dc719f9f5d32c995925328ca7bf37e6
# -*- encoding: utf-8 -*- """ @File : 859-亲密字符串.py @Time : 2023/08/03 14:46:30 @Author : TYUT ltf @Version : v1.0 @Contact : 18235121656@163.com @License : (C)Copyright 2020-2030, GNU General Public License """ # here put the import lib """ 给你两个字符串 s 和 goal ,只要我们可以通过交换 s 中的两个字母得到与 goal 相等的结果,就返回 tru...
991,172
02e17ef530c2feb1d016e36710ce8dbb3db9dd09
#!/usr/bin/env python3 """ This file parses a histogram CSV file generated via get_utxo_histogram.py. """ import sys import argparse import pandas as pd if __name__ == '__main__': argparser = argparse.ArgumentParser() argparser.add_argument('folder', type=str, help='Folder holding all snapshot chunks') a...
991,173
fcccf1d3434081955ab2ab6f6a32d43056dd4f5a
for _ in range(int(input())): n,d=map(int,input().split()) a=list(map(int,input().split())) a.sort() if a[-1]<=d: print('YES') elif a[0]+a[1]<=d: print('YES') else:print('NO')
991,174
dfb889458e93f94b9385aa559ae9d45cce68a974
# -*- coding: utf-8 -*- import pandas as pd from PIL import Image, ImageMath, ImageStat import numpy as np import requests import logging # Used to make streaming silent import io import json from itertools import compress import matplotlib.pyplot as plt # Streams an image and calculate live stats from the image ...
991,175
283004b13cc2e21911c81e83f776c8a3ec8f1051
import pandas as pd import numpy as np from pprint import pprint from time import time from sklearn.linear_model import LogisticRegression from sklearn.linear_model import SGDClassifier from sklearn.model_selection import train_test_split from sklearn.model_selection import GridSearchCV from sklearn.metrics import ac...
991,176
25bc5ab782634e27dcb4022e1f8a0661bc310ea8
#!/usr/bin/python3 # -*- coding: utf-8 -*- # @Time : 2020/11/30 21:09 # @Author : Yong # @Email : Yong_GJ@163.com # @File : set_up.py # @Software: PyCharm # set_up() # 如果在TestCase 类中包含了方法setUp() ,Python将先运行它, # 再运行各个以test_打头的方法。 # set_up() 在此类中的作用 # 1、创建一个调查对象 # 2、创建一个答案列表 # 运行测试用例时,每完成一个单元测试,Python都打印一...
991,177
37efbd2c17fd4ddf52d14c517605c062255d3aa0
import unittest from IsInSolution import IsIn class TestIsInSolution(unittest.TestCase): def test_IsIn(self): """ Test string1 is in string2 """ string1 = "Hello" string2 = "Hello World!" result = IsIn(string1,string2) # Test a list of whole numbers ...
991,178
34cee1bb79aba70b540bf3f03d0c1c01223f180c
import asyncio from http import HTTPStatus from http.client import HTTPResponse from pathlib import Path from urllib.request import urlopen from typing import Any, ContextManager, Optional, Union, Tuple, cast from typing_extensions import Literal import json import socket from threading import Thread from queue import ...
991,179
88afdb99029f7abfce9ddd4a13bf80d6f10541ae
from Models import ShopModel, db, shop_fields, RoomModel from flask import Flask from flask_restful import Api, Resource, reqparse, abort,fields, marshal_with from flask_sqlalchemy import SQLAlchemy Shop_Parser = reqparse.RequestParser() Shop_Parser.add_argument("shop_id",type=int, help="Shop id", required=True) Shop_...
991,180
5cc8a32fea689d0f2de115f82e409483f2dfac19
#!/usr/bin/env python # encoding: utf-8 """ 3DCNN网络用于结节分类 """ class 3DCNN(object): def __init__(self): print 123 def last(self):
991,181
0388bdde4f3c593c63b2c4f7383b8e236bed6bd8
import sys import asyncio import random from quic_version_detector import quic, net, cli def dummy_version_packet() -> bytes: """Constructs a packet with a dummy version. Such packet makes the server return "Version Negotation Packet". Returns: quic.Packet """ connection_id = bytes([rand...
991,182
ad4327ce9860c8d2de2015f087e9c181e277e214
from sqlalchemy import create_engine from sqlalchemy.orm import Session from WateringApp.Fachwerte.URI import URI from WateringApp.config import DB_BASE_URI, DB_NAME, DB_USERNAME, DB_PASSWORD, SQLALCHEMY_DATABASE_URI from WateringApp.extensions import db, metadata # uri = URI(DB_BASE_URI, DB_NAME, DB_USERN...
991,183
ed752757eb5024eab737517477a3e7bcb832af39
from setuptools import setup, find_packages setup( name="collaps-layout", version="0.1", packages=find_packages(), install_requires=['d3-primeri>=0.1'], entry_points = { 'kod.vizualizator': ['collaps_layout_kod=collaps_layout_vizualizator.collaps_kod.collaps_layout_kod:CollapsLa...
991,184
0d2a2d3f10cded14500d2b5931a2377f4d7049e2
''' Question 2.1 Skeleton Code Here you should implement and evaluate the k-NN classifier. ''' import data import numpy as np # Import pyplot - plt.imshow is useful! import matplotlib.pyplot as plt from sklearn.model_selection import KFold class KNearestNeighbor(object): ''' K Nearest Neighbor classifier ...
991,185
af4f84e355de6ac64c8c6cd7146730ffb168ebbd
import flask as f import sqlalchemy as s from sqlalchemy.dialects import postgresql from ..entities._entity import ( Base, EntityMixin, EntitySerializer, NotNull, generate_uuid, ) class Context(Base, EntityMixin): __tablename__ = "context" id = NotNull(s.String(50), primary_key=True, defa...
991,186
f893bfbe7d2ded56f201afcafb0ae12c97ddcff7
from itertools import product import numpy as np import geometry import text def try_merge_point_groups(img, point_groups): bounds = list(reversed(img.img.shape[:2])) point_groups = set(point_groups) while True: done = True # iterate every pair of possible point groups for grou...
991,187
de91182c00e0f4ec7d148649dbc646a3bca2c2b6
import argparse import asyncio import logging import time from aiortc import RTCIceCandidate, RTCPeerConnection, RTCSessionDescription from aiortc.contrib.signaling import BYE, add_signaling_arguments, create_signaling def channel_log(channel, t, message): print("channel(%s) %s %s" % (channel.label, t, message))...
991,188
f5fdf18b35161cb6a8568d35b7c3574bd18caff7
# 3. 定义函数,判断二维数字列表中是否存在某个数字 # 输入:二维列表、11 # 输出:True def is_exists(double_list,target): for line in double_list: if target in line: return True return False double_list = [ [1,2,3,4], [5,6,7,8], [9,10,11,12], [13,14,15,16] ] print(is_exists(double_list,11))
991,189
5e8323ca2bdc93347fbcd6986635cb818aeb0292
#导入unittest框架 import unittest #导入测试用例,并实例化 from Unittest框架.testcases.完整的测试框架案例 import Test01 from Unittest框架.testcases.test04 import Test04 if __name__ == '__main__': #实例化testsuite suite = unittest.TestSuite() #调用添加用例方法 Test02类 里的test001方法 suite.addTest(Test04("test001")) #实例化TextTestRunner() 测试执行 ...
991,190
125331481c7a8727c7a739aa35d174a2a0d58517
EVENTBRITEAPI = 'https://www.eventbriteapi.com/v3/users/me/events/'
991,191
00661609cdc1541e190e5fddc10db254a12be291
#Q5 x=list(map(int,input("Enter array x: ").split(" "))) y=list(map(int,input("Enter array y: ").split(" "))) z=list(map(lambda n1,n2: n1+n2,x,y)) print(z)
991,192
bd5f795c44c01cf8dab8220b1fe408f8d371aa97
from tkinter import * class Form: def __init__(self, parent): Label(parent, text='Введіть перше число', pady=10, width=30).pack() self.entry1 = Entry(parent, width=25) self.entry1.pack() self.err1 = Label(parent, text='', fg='red') self.err1.pack() Label(parent, te...
991,193
8c35db8cdc4ea3ad086520327cb5c75ffd4a8c5c
from django.contrib.auth import authenticate, login, logout from dashboard.models import BusAndRoutes, BusRegistartion, CompanyStaff, CompanyInformation from django.shortcuts import render,redirect from django.urls import reverse from django.http import HttpResponseRedirect from django.contrib import messages from dash...
991,194
f21e03fad871b120a3827cd0c8acfc8f9397b88e
myName = input("your name: ") myAge = int(input("your age: ")) print("1. Hello World, my name is %s and I am %d years old." % (myName, myAge)) print("2. Hello World, my name is %s and I am %s years old." % (myName, myAge)) print("3. Hello World, my name is {} and I am {} years old.".format(myName, myAge)) print('4. He...
991,195
ce436f3ce06d94914d9535ac3502b79d567b254a
from PyQt5 import QtCore from PyQt5.QtWidgets import * from PyQt5 import QtGui from GraphicalTailForm import * from PyQt5.QtWidgets import QApplication, QDialog import threading class GraphicalTail(QtCore.QObject): output = None w = None textWrittenSignal = QtCore.pyqtSignal(str) def __init__(self) : QtCore...
991,196
d5e68f7776bed3745334d87f270054151be3b21b
#!/usr/bin/env python # coding=utf-8 ############################################################################## # # pyxda.srxes X-ray Data Analysis Library # (c) 2013 National Synchrotron Light Source II, # Brookhaven National Laboratory, Upton, NY. # All ...
991,197
70824c1ef5fe45cca29e3aa00d7ad278ddee0291
# 幂运算 print(2 ** 10) # 地板除 print(3 // 2) # 海象运算符 可在表达式内部为变量赋值 #a = [1,2,3] #if(n := len(a)) > 2 # print("...") # 位运算 异或 取反 a = 1 b = 1 c = a^b print(c) c = ~c print(c)
991,198
75ff50a27ffcde61a291e05ffa9ed16fa0780f5c
from django.shortcuts import render,redirect from django.contrib.auth.models import User from django.contrib import auth def register(request): if request.method=='POST': if request.POST['pword']==request.POST['pword2']: try: user= User.objects.get(username = request.POST['use...
991,199
ee68e7f046548a64d52d8a2980a5a9341711f70e
from feedparser import parse from PyQt4 import QtGui, QtCore, QtWebKit, uic import sys, os, urllib.request, urllib.parse, urllib.error from models import * from pprint import pprint from math import ceil from pluginmgr import BookStore from templite import Templite import codecs import urllib.parse import time # This ...