index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
985,500
07a02959748eed5b3a8f8ecb2ce6fbe5a4e4688f
import os import numpy as np def processData(datawithmissing,windowSize): train_roadList=[] for i in range(datawithmissing.shape[0]): tempdata=datawithmissing[i] if i==0: trainLabel=tempdata[tempdata>0] else: trainLabel=np.hstack((trainLabel,tempdata[tempdata>0])...
985,501
7b53eaa67a065a32a12d3b9f172a2e61b2c21160
# coding: utf-8 # octal decimal # raquel ambrozio numero_octal = raw_input() expoente = len(numero_octal) decimal = 0 for i in range(len(numero_octal)): expoente -= 1 decimal0 = int(numero_octal[i]) * (8 ** expoente) decimal += decimal0 print "%d * 8^ %d = %d" % (int(numero_octal[i]),...
985,502
5f0215c7c3ea9b07f1cd07517b1dcca0c18ca8dc
class Persona: def __init__(self,nombre,apellido,edad,sexo,nombreUsuario,contra,tele,tipo): self.nombre=nombre self.apellido=apellido self.edad=edad self.sexo=sexo self.nombreUsuario=nombreUsuario self.contra=contra self.tele=tele self.tipo=tipo # MET...
985,503
d29976adef476c2e38c80ab07607b17d366db8b2
# flake8: noqa import unittest import repour.server.endpoint.validation as validation import voluptuous class TestPrimitives(unittest.TestCase): def test_nonempty_str(self): self.assertEqual("asd", validation.nonempty_str("asd")) self.assertEqual("asd qwe", validation.nonempty_str("asd qwe")) ...
985,504
9aa2abc222c3737dcd50de134250340a79ba0ea7
##-------------------------- Example 4. Tune Activation Function --------------------------------- #The activation function controls the non-linearity of individual neurons and when to fire. #Generally, the rectifier activation function is the most popular, but it used to be the sigmoid #and the tanh functions and th...
985,505
f0dcb015c6590200b6ad909342ec31341c665f6e
#!/usr/bin/env python # -*- coding: utf-8 -*- ######################################################################## # # Copyright (c) 2018 Wan Li. All Rights Reserved # ######################################################################## """ File: pysaver.py Author: Wan Li Date: 2018/07/22 14:47:52 """ import ...
985,506
b24b284344cba95c0f31c54733d0d51b5b2f0dff
""" business days module """ import datetime import holidays def business_days() -> list[datetime.date]: start_date = datetime.date(2021, 5, 1) end_date = datetime.date(2021, 6, 1) us_holidays = holidays.US() delta = end_date - start_date print("For start date", start_date, "and end date", end...
985,507
3ac429e5f30ad111368531820df96c4114b22e71
import networkx as nx import numpy as np def sbm(sizes, prob_matrix): def get_comm_label(node): print("test") g = nx.Graph() N = np.sum(sizes) last_node_labels = np.cumsum(sizes) for source in range(N): for target in range(source+1, N): pass tst() p_matrix = n...
985,508
b74cfd1fdc81a973281dc119097ae4660410b1f9
import FWCore.ParameterSet.Config as cms from RecoEgamma.EgammaIsolationAlgos.eleTrackExtractorBlocks_cff import * eleIsoDepositTk = cms.EDProducer("CandIsoDepositProducer", src = cms.InputTag("gedGsfElectrons"), trackType = cms.string('candidate'), MultipleDepositsFlag = cms.bool(False), ExtractorPSe...
985,509
c1f3ff16569ab776a2dc62d6826db6f385e8e8e9
import unittest import numpy as np from recursive import split_matrix class TestSplitMatrix(unittest.TestCase): def test_triangular(self): a = np.array([ [1, 2, 3], [0, 4, 5], [0, 0, 6] ]) self.assertEqual(split_matrix(a), 0) a = np.array([ ...
985,510
f23a00f25f81cc6f16a881f43715db6aac90607e
import matplotlib import matplotlib.pyplot as plt from matplotlib import gridspec import numpy as np matplotlib.rc('text', usetex = True) import pylab import sys import os import pandas as pd inputfilename = sys.argv[1] outputfilename = sys.argv[2] #inputfilename = "D:/results/sampled/SampledRegression_average_0.txt...
985,511
c64993424b13e222ea226e209bef608f7a571cad
# -*- coding: utf-8 -*- # @Time : 2019-08-26 22:50 # @Author : Wei Peng # @FileName: __init__.py from flask import Flask from config import Config from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.config.from_object(Config) # print(app.config["SECRET_KEY"]) db = SQLAlchemy(app) db.create_all() db...
985,512
d167ba11cba2fa3ccb595289bca9fb671a6594e5
from aws_cdk import ( aws_ec2 as ec2, aws_iam as iam, aws_eks as eks, core ) class VpcStack(core.Stack): def __init__(self, scope: core.Construct, id: str, props, **kwargs) -> None: super().__init__(scope, id, **kwargs) # The code that defines your stack goes here self.vpc =...
985,513
69e6da22b4d79b23de17b0fd05cc05c503376c4c
''' directorPython demoPointCloud.py --interactive Listens to a point cloud topics and draws it in a UI ''' from director import segmentation from director.consoleapp import ConsoleApp from director import drcargs from director import vtkAll as vtk import vtkRosPython as vtkRos from director import applogic from dire...
985,514
8f287ea0f91f8bf411f17e717dab91a0f5dfae1c
class Person: def say_hi( self) : print( ' Hello, how are you?' ) p = Person( ) p. say_hi( ) # 前面两 行同 样可以写 作 # Person( ) . say_hi( )
985,515
4fed0034328f7259d3c4e2db3789c01e903ed7a4
import pickle import segmentation_models_pytorch as smp from tqdm import tqdm class Validator: def __init__(self, model, optimizer, loader, imgsize): self.loader = loader self.model = model self.optimizer = optimizer self.imgsize = imgsize self.results = {"thresholds": [], ...
985,516
e6b029737a1987b71aa540d682a59ffd2d312578
import glob import time import math import tkinter from tkinter import * from tkinter.messagebox import showinfo # Funktionen definieren------------------------------------------------------------------------------------------------- def save(): if not glob.glob("Drehen.csv"): ergebnisliste = open("Dreh...
985,517
a6726fe7b447fb2e6aef170fd32f5b277a1981b6
import pandas as pd list_uninsured = ["Abilene, TX Metro Area <br \/> Percent Uninsured: 13.7% <br \/> Number Uninsured: 21,000", "Akron, OH Metro Area <br \/> Percent Uninsured: 5.0% <br \/> Number Uninsured: 35,000", "Albany, GA Metro Area <br \/> Percent Uninsured: 15.2% <br...
985,518
5804e6dd9cf1dfd4c49520575639362b4eba97bc
import pygame pygame.init() class Display(): displayWidth = 800 displayHeight = 600 black = (0, 0, 0) white = (255, 255, 255) red = (255, 0, 0) gameDisplay = pygame.display.set_mode((displayWidth, displayHeight)) #Init display def text_objects(self, text, font): ...
985,519
2d27c65ac49c63f61621a0a227e0237df76d46ca
''' 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 def main(): t = int(input()) for _ in range(t): n = int(input()) integerList = list(map(int,input().split())) maxsum = 0 for i in r...
985,520
191cfb38c8a7490729741e10da938f54f4cc6aae
import numpy as np import pandas as pd import matplotlib.pyplot as plt import librosa import sklearn import warnings import data_reading import noisereduce as nr import preprocessing # A function that prevents warnings when loading in files with librosa warnings.simplefilter("ignore") # A function for calculating aut...
985,521
d6a1593b170d710ef9726610f5c824a46e9a3be0
from random import randint print("{:=^40}" .format(" JOGO DE DADOS ")) dado = randint(1, 7) opcao = 1 print('''VOCÊ GOSTARIA DE JOGAR O DADO? [ 1 ] SIM [ 2 ] NÃO''') opcao = int(input("Escolha sua opção: ")) while opcao != 1 and opcao != 2: print("OPÇÃO INVÁLIDA! Escolha uma nova opção!") opca...
985,522
53b8b16cd8940c03f2ee686c5d6978f0a7a7758a
#!/usr/bin/env python import roslib import rospy import tf import time from sensor_msgs.msg import LaserScan from geometry_msgs.msg import Twist import math #class Kinect: def turn(y_pos, lr_lim): if y_pos < -lr_lim or y_pos > lr_lim: result = math.copysign(angle,y_pos) else: result = ...
985,523
a5a954792967370f1d03543bb272372468d85f36
""" {{cookiecutter.project_label}} Setup """ import os import re from setuptools import setup, find_packages VERSION = os.getenv('VERSION', '0.0.0') # Read in the package names from requirements.txt, # all of which should be required for the package to function package_deps = None with open('requirements.txt') as ...
985,524
09537a9daf20b1d1447890012209ededc69c614b
###imports import sklearn from SVM import SVMprocess from KNN import KNNprocess from NaiveBayes import NBprocess from RandomForest import RFprocess SVMtime,SVM_kfold_acc, SVM_loo_acc = SVMprocess() KNNtime, KNN_kfold_acc, KNN_loo_acc = KNNprocess() NBtime, NB_kfold_acc, NB_loo_acc = NBprocess() RFtime, RF_kfold_acc, ...
985,525
05341b5df1ba4f1473ce8181bc29625d0a7c3beb
# Tested # Verified def bidirectional(adjList, source, target): fronts = [[source], [target]] visited = [set([source]), set([target])] cnt = [0, 0] prev = [{source: None}, {target: None}] border = [] if source == target: border.append(source) while all(fronts) and not border: ...
985,526
3f1cfdbd832c0cb0bff9b3cce7c297b1514d8bb4
#_*_coding:utf-8_*_ #统计模板 import stat_base import sconf import mysqlwrap from httpwrap import HttpWrap from sphinxwrap import sphinx import rediswrap import utils,json #-------参数配置文件-----# def get_cnf_val(k,dist): """递归取出joson配置信息值 """ if '.' not in k : return dist[k] if k in dis...
985,527
8e5df3a0943c012c7029b31cbb17caf05e426e4f
# 这是第一个注释 print("hello hello") """ 这是一个多行注释 。。。。 。。。。 。。。。 注释结束了 """ # 这是第二个注释 为了保证代码的可读性,注释和代码之间 至少要有 两个空格 print("hello world") # 输出欢迎信息
985,528
3473f3434e9abbc63f7acd4b0c1b91432e042a62
/Users/Storm/Documents/Python/anaconda2/lib/python2.7/stat.py
985,529
dd2b3773a1793938a26e60af34afeedf72aa6bb1
#coding:utf-8 import wx app = wx.App() win = wx.Frame(None,title="simple Editor",size=(410,335)) bkg = wx.Panel(win) LoadButton = wx.Button(bkg,label='Open') SaveButton = wx.Button(bkg,label='Save') filename = wx.TextCtrl(bkg) contents =wx.TextCtrl(bkg,style=wx.TE_MULTILINE|wx.HSCROLL) hbox = wx.BoxSizer() hbox.Add...
985,530
0c465968d76ba78a96830c730424dfbd17cb70bc
import os import sys import time from gooey import Gooey from gooey import GooeyParser import pafy from pytube import Playlist running = True pListUrl = [] pathToSave = None @Gooey(optional_cols=2, program_name="Youtube Downloader", dump_build_config=True, show_success_modal=False) def main(): ...
985,531
b14edc051eabf7c7cf7e69dd174009de56cfd3d1
import unittest, time from HTMLTestRunner import HTMLTestRunner import smtplib from email.mime.text import MIMEText from email.header import Header from email.mime.multipart import MIMEMultipart import os #指定测试用例为当前文件夹下的test_case test_dir='./' discover=unittest.defaultTestLoader.discover(test_dir,pattern='te...
985,532
daf3346ee9f34eb5f9abe6b0ab4ffed9368cd9a8
''' 1) Modifique o programa abaixo para exibir o que se pede: x=1 while x<=3: print(x) x=x+1 ''' # a) Exibir os números de 1 a 100. x = 1 print('Numeros de 1 a 100:\n') while x <= 100: print(x, end=' ') x += 1 print('\n') # b) Exibir os números de 50 a 100. ...
985,533
1a3052b51a4ec24437b72262c218210e5d6a4236
from kivy.app import App from kivy.core.window import Window from kivy.uix.widget import Widget from kivy.graphics import Color, Rectangle from kivy.config import Config from kivy.clock import Clock from kivy.utils import get_random_color from kivy.properties import ObjectProperty from random import * ''' obtener toda...
985,534
9472c9ba456ff7a9f4714c8d316c1fc6e23bea7e
from sys import exit,argv from os import getcwd,system from PyQt5.QtWidgets import QApplication,QMainWindow,QLabel,QLineEdit,QPushButton,QMessageBox from urllib.request import urlretrieve class Window(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle('Download İmage') self.s...
985,535
1093805058f3bf8ab3284a60fc65ce1c3d341af7
# Iterative approach def reverseList(arr, start, end): while start < end: arr[start], arr[end] = arr[end], arr[start] start += 1 end -= 1 # recursive approach def recursiveReverseList(arr, start, end): if start >= end: return temp = arr[start] arr[start] = arr[end]...
985,536
95c12f6c727e54246d40ca3a0f1b207d8dbae4fe
from django.db import models import datetime as dt from django.contrib.auth.models import User from tinymce.models import HTMLField from cloudinary.models import CloudinaryField class Tag(models.Model): name = models.CharField(max_length = 30) def __str__(self): return self.name cl...
985,537
67727abea626f8164024e5be005b50f68b7504d2
# Generated by Django 3.2.9 on 2021-12-07 21:51 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("courses", "0032_auto_20211004_1733"), ] operations = [ migrations.AddField( model_name="courserun", name="catalog_vis...
985,538
59d46db18edbaac50618dfdbf5a1d9ec05760086
def conta_bigramas(s): i = 0 a = dict() while(i < len(s)-1): bi=s[i] + s [i+1] if bi in a: a[bi]+=1 else: a[bi]=1 i+=1 return a
985,539
1c5a0ea7c0a9cbf16ac7c0c5d5660c6bfda2563b
import mathpack.MymathFunctions addres=mathpack.MymathFunctions.add(10,20) print(addres) #from mathpack.MymathFunctions import * #data=add(10,20) #print(data) #data1=sub(20,10) #print(data1)
985,540
41a3dd1a12ed1099ed054a10e6647a5dbd1718db
# -*- coding: utf-8 -*- import math f= float(input('digite f:')) l= float(input('digite l:')) q= float(input('digite q:')) delta= float(input('digite delta:')) v= float(input('digite v:')) d=(8*f*l*q**2/math.pi**2*9.81*delta)/(1/5) rey=(4*q/math.pi*d*v) k=0.25/(math.log10(0.000002/3.7*d+5.74/rey**0.9))**2 print(d) prin...
985,541
610ecf2b8e695e21164c8697898f1737b2353303
from rest_framework import generics, status, permissions from rest_framework.response import Response from rest_framework.reverse import reverse from rest_framework.throttling import ScopedRateThrottle from .models import Usuario, Conta, Cartao, Fatura, Lancamento from .serializers import UsuarioSerializer, ContaSeria...
985,542
53e1889f94c354e5dcee49dd247f60386a07a2b5
""" Add the Prime Numbers that are Anagram in the Range of 0 ­ 1000 in a Queue using the Linked List and Print the Anagrams from the Queue. Note no Collection Library can be used """ from Data_Structure_Programs.queue import Queue, Node from Data_Structure_Programs.Prime_Number import Prime obj = Queue() # creating o...
985,543
18e8d588bc49792ec2d6fd9c89c547f35608c015
import subprocess import os import shutil import unittest import shlex # testdirectory = '/Users/jibrankalia/tmp/ls-test' # testdirectory = '/tmp/ls-test' testdirectory = '~/tmp/ls-test' def buildEnv(directory=testdirectory): if not os.path.exists(directory): os.makedirs(directory) def cleanEnv(directory...
985,544
abebd29206cc59c14d8d51917a5f8c2ff95bfa7b
from PIL import Image import os import numpy as np import torch import torch.utils.data as Data from torchvision import transforms import json import aConfigration from tqdm import tqdm dataRootPath = '../datas' trainPath = '/AgriculturalDisease_trainingset' validPath = '/AgriculturalDisease_validationset' testPath =...
985,545
6542678c25c7b3cc1096e689ad476ee141aaa40a
import time import inspect from functools import partial import torch import pandas as pd from loguru import logger from sklearn.metrics import precision_recall_fscore_support def to_device(x, device): if not isinstance(x, dict): return x new_x = {} for k, v in x.items(): if isinstance(...
985,546
3ede7c9d2081e88199c5008edd784e2d8676f96b
class Config(object): DEBUG = True secret_key = 'secret'
985,547
0a03806dae46dc915bffe3d712b19c4705f693d7
# # This file is part of VIRL 2 # Copyright (c) 2019-2023, Cisco Systems, Inc. # All rights reserved. # # Python bindings for the Cisco VIRL 2 Network Simulation Platform # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obta...
985,548
c235d9533272429b5f21a13b29f23b54c137e5de
from random import randrange from tkinter import * class MainWindow(): def __init__(self, root, W=10, H=16): self.W, self.H = W, H self.root = root self.root.title = "Game" self.canvas = Canvas(root, width=self.W*30, height=self.H*30, bg="white") self.canvas.grid(column = 0,...
985,549
3f144c999c53b9796954ce04f699114dcd5ceff2
# import libraries import pandas as pd import numpy as np from sqlalchemy import create_engine import nltk from nltk.tokenize import word_tokenize, sent_tokenize nltk.download('stopwords') nltk.download('wordnet') nltk.download('punkt') from nltk.stem import WordNetLemmatizer from nltk.stem.porter import PorterStem...
985,550
fe9226da9357391b50f552e66b15a88f54f29df4
from django.contrib import admin from .models import Chapter, Recipe admin.site.register([Chapter, Recipe])
985,551
60022294439eb413e2a828ce6c4e6953133d6912
# -*- coding: utf-8 -*- """ Created on Sun Oct 08 17:16:36 2017 @author: nitin.kotcherlakota """ import pygame pygame.init() #To set a resolution. surface = pygame.display.set_mode((800,400)) pygame.display.set_caption('Helicopter') #All computer games has frames per second clock = pygame.time.Clock() game_over = F...
985,552
a4b0f9ac34dc2c544385e08e6d3b6c435c224cfd
def alphabet_position(text): import string alphanumeric_filter = filter(str.isalnum, text) tt = "".join(alphanumeric_filter) m = tt.lower() k = list(m) lst = list() for char in k: k = string.ascii_lowercase.index(char) + 1 lst.append(k) stringList = ' '.join([st...
985,553
66842081a9070fa2a0ec18537c0780ba6af98f61
import pandas as pd csv = pd.read_csv("seeds_dataset.csv") data = csv.values.tolist() import numpy as np def normalize_data(data_list): data = np.asarray(data_list) col_maxes = data.max(axis=0) return (data / col_maxes[np.newaxis, :]).tolist() splitted = [] for value in data: tmp = value[0].split("...
985,554
405806dbde04b8c55748cd8be55342344e887d72
# -*- coding: utf-8 -*- # Rodrigo - Prova 2, Correção de Texto, 3088 while True: #Repetirá o código até todos os casos forem testados. try: #Serve para evitar o erro de EOF. Frase=str(input()) #Entrada da frase a ser corrigida. i=0 #Será usado abaixo. while True: if Frase[...
985,555
696a8390c8056eb6260750d4e8f51d59e2847267
import urllib import urllib2 #python debug file ,test at python27 class Log: serverURL = "http://17ky.xyt:8080" token = 'xytschool' forbidden = False error = '' def setServer(self ,url): self.serverURL = url def setToken(self, token): self.token= token def send(self ,...
985,556
d6c3fd99692d9eeb4f68b01113811be0ee0798de
# -*- coding: utf-8 -*- """RunMain.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1kCQxSaqlZvUz19ZfPYekVR6uZCFHbtF6 """ from google.colab import drive drive.mount('/content/gdrive') import numpy as np import cv2 import matplotlib.pyplot as plt...
985,557
f25bfb8d98bd61524dfb849e2ce2ce0973208f12
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from __future__ import annotations from contextlib import contextmanager from typing import Any, Callable, Iterable, List, Optional, TYPE_CHECKING, Iterator from numpy.random import RandomState from nni.mutable import ( LabeledMutable, Mut...
985,558
c3e6b8ce467969e0755005ca97bb68efec756db6
#28. Факторизация натурального числа from collections import Counter n = int(input("Integer: ")) factors = [] d = 2 m = n while d * d <= n: if n % d == 0: factors.append(d) n//=d else: d += 1 factors.append(n) f_factors = Counter(factors) str = str(f_factors) str = s...
985,559
7e056a431af3d8f2bc67c4d161c7a6b92ae8700e
# 连接数据库和爬虫 from sqlalchemy import create_engine engine = create_engine('mysql+pymysql://tim:87654321@localhost:3306/douban') conn = engine.connect() a = conn.execute('select 1').scalar() print(a)
985,560
36ed0f31d1281f2648a0e3bd70e706ecf37d53bb
# select.py # select instances that are not consistent with the condition import sys data = [] n = int(sys.argv[1]) # get the number of instances for i in range(n): d = input() data.append(d) pos = 0 nn = 0 np = 0 j = 0 while j < n: a = data[j] cond = (a[4] == 't') if a[0] == 'p': pos = pos + 1 i...
985,561
2fab4304672cf5ae7920f00978059808e495d949
#!/usr/bin/env python3 # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in ...
985,562
9d7f60bc0b0ee686f818dfa74cac0aad955e5d07
import arrow import os from datetime import datetime, timedelta from django.db import models from django.utils.timesince import timesince from django.utils.translation import ugettext_lazy as _ from django.core.validators import RegexValidator from django.dispatch import receiver from django.db.models import Sum from d...
985,563
114b45f83d3cfbc4d40cb798dd3d74cda1f2e74e
from typing import TYPE_CHECKING, Optional, Sequence import dagster._check as check from ..execution.context.hook import BoundHookContext, UnboundHookContext from .resource_requirement import ensure_requirements_satisfied if TYPE_CHECKING: from ..events import DagsterEvent from .hook_definition import HookDe...
985,564
0a884ffe71efccb84c3b68b8ebff9b7a99dc0630
#!/usr/bin/python # -*- coding: utf-8 -*- # https://www.youtube.com/watch?v=NYJoyZHEW04 # Python 3 #2: переменные, оператор присваивания, типы данных # = - связывания объекта """ "Helo World!!" """ или """ 5 """ с переменной Х x = "Helo World!!" print(x) print(id(x)) print(type(x)) x = 5 print(x) print(id(x)) ...
985,565
d0fc2dcf2388e727557870029ad1145e41a7970c
# Copyright (c) 2017, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. # external from mixbox import fields # internal import stix import stix.bindings.stix_common as common_binding # relative from .vocabs import VocabField class Names(stix.EntityList): _namespac...
985,566
215dfed8b4d8040f02d201eb7bf02f9b280d25d1
# encoding=utf8 # coding=UTF-8 import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText def enviarEmail(destinatario, titulo, conteudo): #print destinatario me = "alertai@serpro.gov.br" you = destinatario msg = MIMEMultipart('alternative') ...
985,567
91b63dcb3e7d9ce687dd720a477a290434798dd3
#!/usr/bin/env python import numpy as np from myplot.basemap import Basemap import matplotlib.pyplot as plt import matplotlib.cm lon_0 = -116.0 lat_0 = 33.4 llcrnrlon = -118.0 urcrnrlon = -114.0 llcrnrlat = 31.0 urcrnrlat = 35.0 bm = Basemap(lon_0=lon_0,lat_0=lat_0, llcrnrlon=llcrnrlon, llc...
985,568
f67cca62dc4c153677db20d9cebd2817ec91cdf5
dictionary = dict( theta13 = r'$\sin^2 2\theta_13$', theta13_unit = '', dmee = r'$\Delta m^2_{\text{ee}}$', dmee_unit = r'$\text{eV}^2$', dm21 = r'$\Delta m^2_{21}$', dm21_unit = r'$\text{eV}^2$', dm32 = r'$\Delta m^2_{32}$', dm32_unit = r'$\text{eV}^2$', psur = r'$P_\mathrm{sur}$', ...
985,569
15a8f4f1ff842cb0087e76ee3949e35ef75e9c1d
# -*- coding: utf-8 -*- from django.shortcuts import render, redirect from .viewmodels import ContactViewModel from .forms import ContactForm Contact = ContactViewModel() # Create your views here. def view(request): contact_list = Contact.contact_list() return render(request, 'contact/index.html', ...
985,570
0ea060b1abbfc62f9ec1fa2f4c5c3caa14605607
import numpy """ 欧几里得度量 """ def EDD(l1, l2): return numpy.sqrt(numpy.sum(numpy.square(numpy.array(l1) - numpy.array(l2)))) if __name__ == '__main__': print(EDD( [1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6], ))
985,571
67be688cd594f0a405046bad52c8a15105bfa685
#!/usr/bin/env python3 # HashTable # 衝突回避 チェイン法 # 時間計算量 挿入 O(1) 検索 O(1) 削除 O(1) # 空間計算量 O(n+m) n=テーブルの大きさ m=エントリリストの数 class HashTable(object): class Cell(object): def __init__(self, key, value, next=None): self.key = key self.value = value self.next = next ...
985,572
82978c33dc0f9d621c44b5823f6e3d0f225b8859
from sys import stdin N = int(input()) arr = [] for i in range(N): arr.append(int(stdin.readline())) arr.sort(reverse=True) # 가격이 큰 것부터 처리해야 이득이다. total = 0 ct = 0 for i in arr: ct += 1 if ct % 3 == 0: # 세 번째 요소인 경우 넘어감. ct = 0 continue total += i print(tota...
985,573
363570690d68568e375e5779da8f614fe4edec4b
#!/usr/bin/env python """ pytorch_lifted_loss.py """ import torch import torch.nn as nn from torch.autograd import Variable def lifted_loss(score, target, margin=1): """ Lifted loss, per "Deep Metric Learning via Lifted Structured Feature Embedding" by Song et al Implemented in `pytorch` """ ...
985,574
61da755c9b7e936aff82abe93f2563e8be64983e
from flask import Flask from flask import jsonify, make_response from flask import request app = Flask ('the-box-library') books = [{ 'name': 'Jurassic Park', 'author': 'Michael Crichton', 'id': '554', 'category': 'Thriller' }, { 'name': 'Halo The Fall of Reach', 'author': 'Eric Nylund', 'id': '574', ...
985,575
f2545d666be324fb6fece70952b0fdb5b0cba13e
__author__ = 'aldnav' from core import admin import models admin.register(models.Person) admin.register(models.Mosquito)
985,576
eed65640954c000771eb91f1113e13a1134fd367
from kivy.app import App from kivy.uix.screenmanager import ScreenManager from Screens.CaptchaScreen import CaptchaScreen, captcha_screen from Screens.ProxyScreen import ProxyScreen from Screens.AccountsScreen import AccountsScreen from Screens.TasksScreen import TasksScreen from Screens.LogScreen import LogScreen ###...
985,577
7674b271c621e97886cbbbbee8751d26753ecb03
from imutils import paths import face_recognition import argparse import pickle import cv2 import os print("[INFO] quantifying faces...") imagePaths = list(paths.list_images('/media/nk/Work/smartglass_cloud/facedeeplearning/dataset')) knownEncodings = [] knownNames = [] # loop over the image paths for (i, imagePath) i...
985,578
35150251da81aaf7d004ca8da851da7661303d8a
""" This module generates feasible parameter settings, the settings are in a form of an ordered list """ from itertools import combinations, product from ops import * from constraints import * from core import * import copy class ParameterSampler(object): def __init__(self, df, qfn, operationList, substrThresh=...
985,579
099c1f73e539e9fae485e18bf5cd0f2d1d695e15
## FLip files rule get_flip_plus_to_forward: input: manifest = lambda wc: config["manifest"][wc.dataset] output: flipfile = "run_folder/flip/{dataset}_FORWARD.flip" shell: """ Rscript bin/format_input/update_reference.R {input.manifest} {output.flipfile} 2 """ rule g...
985,580
da2ad8c301da9e0a338676fecb72e72cf62274f6
# -*- coding: utf-8 -*- from Pages.PageObject import PageObject import time class ITProPage(PageObject): firstHandle = "" secondHandle = "" def __init__(self, driver): PageObject.__init__(self, driver) def click_picture(self): self.firstHandle = self.driver.wi...
985,581
aa2f67bcb2d532e5195adf15c6bc6fd908cf951b
from Utility.actionKeys import MakeAction from .otpForm import Otp import time class Login(object): findBy = 'xpath' findByTag = 'tag_name' fld_username = "//input[@name='email']" fld_password = "//input[@name='password']" fld_btnLogin = "//span[contains(text(), 'Log In')]" tag_for_scroll = 'b...
985,582
e6356884ee97cb896102cb0c5b3751d8a0906917
import numpy as np from keras import backend as K import warnings class ReduceLROnPlateau(): def __init__(self, model, curmonitor=np.Inf, factor=0.1, patience=10, mode='min', min_delta=1e-4, cooldown=0, min_lr=0, verbose=1, **kwargs): self.curmonitor = curmonitor ...
985,583
4bd02844f348d3aa4439f719b628eae2026ec790
# -*- coding: utf-8 -*- import os,sys import numpy as np import matplotlib.pyplot as plt import pandas as pd import datetime from prms_par import prms_par import subprocess from subprocess import PIPE, STDOUT class Prms_base(prms_par): def __init__(self, gsflow_control = None): self.exe_prms = None # To...
985,584
a806aec976813bd873964170a36dad845b1564e9
#!/usr/bin/python3 # Copyright (C) 2006-2021 Istituto Italiano di Tecnologia (IIT) # Copyright (C) 2006-2010 RobotCub Consortium # All rights reserved. # # This software may be modified and distributed under the terms of the # BSD-3-Clause license. See the accompanying LICENSE file for details. import yarp # create ...
985,585
f983c25b8b4b7e02147f56b86808bf18cb15ab7e
import bitmex_basic
985,586
79522e40b92e401f714da0ebb986547aa247a380
# A game where users attempt to guess a random number between 0 and 20 import random correctNumber = random.randint(0,20) numberOfAttempts = 1 #Takes at least 1 try print('I am thinking of a number between 1 and 20.') while True: print('Take a guess.') guess = int(input()) if guess == correctNumber: ...
985,587
b5059341c5e542c7af8cea3243bdf869e56a2fdb
# Generated by Django 2.2.2 on 2019-08-03 04:15 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Kanji', fields=[ ('id', models.AutoField(au...
985,588
5bfe08dd1f2824c2207501f47b10cdfb7a91a882
from django.core.management.base import BaseCommand from optparse import make_option from workspace.exceptions import * from microsites.exceptions import * from workspace.middlewares.catch import ExceptionManager as WorkspaceExceptionManagerMiddleWare from microsites.middlewares.catch import ExceptionManager as Microsi...
985,589
48368f574b6d1523fac82801c905955bac884ddc
# -*- coding: utf-8 -*- from keras.layers import Add, Dense, Concatenate, concatenate, multiply, Reshape, RepeatVector, Permute, add, Flatten, Lambda from keras.engine.topology import Layer from keras import backend as K import numpy as np import tensorflow as tf # from attention_layer_old import AttentionWithContext f...
985,590
a1010fcaba45f13ca3adae5bd87bf88e9c3e56fc
#!/usr/bin/env python3 # -*- coding: utf-8 -*-z import time import urllib.request import json import Adafruit_MCP9808.MCP9808 as MCP9808 sensor = MCP9808.MCP9808() sensor.begin() timestamp = lambda: int(round(time.time() * 1000)) while True: temp = sensor.readTempC() curTimeStamp = str(timestamp()) # REST API u...
985,591
9ceea996c158b3f915661d2895e87c8339c8fb03
# # 따라하며 배우는 파이썬과 데이터과학(생능출판사 2020) # LAB 12-2 판다스로 울릉도의 바람 세기 분석하기, 322쪽 # import pandas as pd import matplotlib.pyplot as plt import datetime as dt weather = pd.read_csv('d:/data/weather.csv', encoding='CP949') monthly = [ None for x in range(12) ] # 달별로 구분된 12개의 데이터프레임 monthly_wind = [ 0 for x in range(12) ] # ...
985,592
2b1265692173ece37e704fddbaf75faef233c0fc
class Solution: def dayOfYear(self, date: str): _DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] def is_leapyear(year): return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) def days_in_month(year, month): if month == 1 and is_leapyear(year): ...
985,593
978cc1dd82be1453655bb39ce2f5b8441d44de79
# coding=gbk ''' Created on 2011-8-5 测试最少时间是否为最少,最短路径是否为最短 @author: Administrator ''' import fixture from fixture import utility from navapp import navitool from navapp import autotest from navapp import xxtool import time import os def dotest(*args, **kwargs): its = True fixture.setup(its) ...
985,594
501d376eefe0c84b459f5657a1b5fe14d805f9b9
import multiprocessing as mp # from multiprocessing import Process as Process from peakME_functions_2018 import * from map_build_functions import * from sys import argv import os import pandas as pd if __name__ == '__main__': threads = mp.cpu_count() cmf_dir = argv[1] # close match files mir...
985,595
da104f315d72e99cf23c165013d3dc9b1835facb
# %% import dateutil.parser as dp import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) ds = pd.read_csv("../data/output/long_int_id.csv") # %% # only extract 3 columns that I'll use in training ds = ds[['id', 'reviews.date', 'product_id']] ds.info() # %% # convert date type to epoche time stamp ...
985,596
c900518cbc2580996b50c8c3528af0b08aba17fc
class Humano: i = 0 def __init__(self): self.edad = 23 def hablar(self,mensaje): print("Nombre %s edad %d" % (mensaje ,self.edad)) pedro = Humano() jaime = Humano() jaime.hablar("Jaime")
985,597
f1c5280c928f110e4cdc732ab606ac4650d6f27a
#import math import numpy as np size = 10 x = np.arange(size+1) print(x, x.shape) print(x[0]) print(x[2]) print(x[size]) print(x[1:size-1]) x.shape = (2,5) print(x) print(x[0:2,1])
985,598
aa03846b99c1491b6d449f9f58f0942bf25a6fe4
from datetime import datetime from django.utils.timezone import utc from django.core.management.base import BaseCommand from django.conf import settings from ui.models import Location from pysnmp.entity.rfc3413.oneliner import cmdgen class Command(BaseCommand): help = 'Record current SNMP state of all the VDI ...
985,599
103fb469e6ef93ffcacdba09e93bb53b6f132f3d
import math def calcula_distancia_do_projetil(v, an, y): return (v**2/9.807)*(1+(1+(2*9.807*y)/(v**2*math.sin(an)**2))**(1/2))*math.sin(2*an)