index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
6,200
2790bd80949bafe4e98ab9aca9cf80a6a0f31490
import wx from six import print_ import os FONTSIZE = 10 class TextDocPrintout(wx.Printout): """ A printout class that is able to print simple text documents. Does not handle page numbers or titles, and it assumes that no lines are longer than what will fit within the page width. Those features a...
6,201
1476d4f488e6c55234a34dc5b6182e3b8ad4f702
from django.core import serializers from django.db import models from uuid import uuid4 from django.utils import timezone from django.contrib.auth.models import User class Message(models.Model): uuid=models.CharField(max_length=50) user=models.CharField(max_length=20) message=models.CharField(max_length=20...
6,202
8adf25fbffc14d6927d665931e54a7d699a3b439
# -*- coding: utf-8 -*- ################################################## # GNU Radio Python Flow Graph # Title: channel # Author: Maria Camila Herrera Ramos # Generated: Thu Aug 2 18:09:17 2018 ################################################## from gnuradio import analog from gnuradio import blocks from gnuradio ...
6,203
ac978accc821600ad8def04b9c7423fbe6759e43
import re import datetime as dt from datetime import datetime import time import random import json import sys import requests import os import pickle import cv2 import numpy as np import cPickle import multiprocessing as mp import math root = "/datasets/sagarj/instaSample6000/" # post_dir = root + "/" videos_dir = r...
6,204
d975b74370acc72101f808e70bef64cee39a5ab8
from typing import Dict, List from .power_bi_querier import PowerBiQuerier class DeathsByEthnicity(PowerBiQuerier): def __init__(self) -> None: self.source = 'd' self.name = 'deaths by race' self.property = 'race' super().__init__() def _parse_data(self, response_json: Dict[str...
6,205
d37187f067ddff94015e639a1759dddced817945
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import numpy as np import pandas as pd import lightgbm as lgb from typing import List, Text, Tuple, Union from ...model.base import ModelFT from ...data.dataset import DatasetH from ...data.dataset.handler import DataHandlerLP from ...model.inter...
6,206
09d13fe6b090850782feb601412cf135d497136f
from catalyst_rl.contrib.registry import ( Criterion, CRITERIONS, GRAD_CLIPPERS, Model, MODELS, Module, MODULES, Optimizer, OPTIMIZERS, Sampler, SAMPLERS, Scheduler, SCHEDULERS, Transform, TRANSFORMS ) from catalyst_rl.core.registry import Callback, CALLBACKS from catalyst_rl.utils.tools.registry import Reg...
6,207
cb29ee8687b469923896ceb7d5a6cd7f54b2c34e
#!flask/bin/python import os, json import requests SENDGRID_API_KEY = os.environ.get('SENDGRID_API_KEY', default=None) FROM_EMAIL = os.environ.get('FROM_EMAIL', default=None) TO_EMAIL = os.environ.get('TO_EMAIL', default=None) if not SENDGRID_API_KEY: raise ValueError("Need to set Sendgrid API Key (SENDGRID_API_K...
6,208
cf07344808f2d91d8949cfc4beb9f923926e6851
import numpy as np import pickle as p from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as plt from numpy.random import randn from neural_network import network net = network([1,8,8,1], filename='./data/x', bias=True) # net.load_random() net.load() n = 32 x = np.array([[x] for x in np.linspace(0,1,n)]...
6,209
8fcbaf2663c22015a0c47f00c2d4fb8db6a5c308
# from models import dist_model # model = dist_model.DistModel() from os.path import join import models import util.util as util import matplotlib.pylab as plt use_gpu = True fig_outdir = r"C:\Users\ponce\OneDrive - Washington University in St. Louis\ImageDiffMetric" #%% net_name = 'squeeze' SpatialDist = models.Percep...
6,210
4a2437d3d6ba549910bc30a67bf391b9bbafd25f
from django.shortcuts import render from django.http import HttpResponseRedirect from .forms import PostForm from django.contrib.auth.decorators import login_required from django.shortcuts import get_object_or_404 from .models import Post from django.contrib import messages # Create your views here. @login_required def...
6,211
dd59f3b1d8b17defe4e7f30fec594d01475319d2
# -*- coding: utf-8 -*- """ Created on Sat May 2 21:31:37 2020 @author: Emmanuel Torres Molina """ """ Ejercicio 10 del TP2 de Teoría de los Circuitos II: Un tono de 45 KHz y 200 mV de amplitud es distorsionada por un tono de 12 KHz y 2V de amplitud. Diseñar un filtro pasa altos que atenúe la señal inter...
6,212
869bbc8da8cdb5de0bcaf5664b5482814daae53a
import requests import codecs import urllib.request import time from bs4 import BeautifulSoup from html.parser import HTMLParser import re import os #input Result_File="report.txt" #deleting result file if exists if os.path.exists(Result_File): os.remove(Result_File) #reading html file and parsing logic f=codecs.o...
6,213
774e607c693fa2d5199582302e466674f65b6449
# 다이얼 dial = ['ABC', 'DEF', 'GHI','JKL','MNO','PQRS','TUV','WXYZ'] cha = input() num = 0 for i in range(len(cha)): for j in dial: if cha[i] in j: num = num + dial.index(j) + 3 print(num)
6,214
0d6490ae5f60ef21ad344e20179bd1b0f6aa761e
n=int(input("n=")) x=int(input("x=")) natija=pow(n,x)+pow(6,x) print(natija)
6,215
a1e54a0f593149c1d97e64342c99f0ab8aa28fa9
""" Guess the number! """ import random, generic def check_answer(player_guess, guess_value): """ Compares a player's guess and the number to guess Returns True if the player guessed correctly Returns False by default """ end_game = False if player_guess > guess_value: print('guess too high!') elif playe...
6,216
63e96b41906f49f557529a0815da7314d74f6c33
width,height = int(input("Width? ")), int(input("Height? ")) on_row = 0 while on_row <= height: if on_row == 0 or on_row == height: print("*"*width) else: stars = "*" + " "*(width-2) + "*" print(stars) on_row += 1 # height = 0 # width = 0 # while True: # try: # height...
6,217
aef45cb8ea9fcaeffcca147da7637536bcc4b226
from rest_framework import viewsets from recruitment.serializers.LocationSerializer import LocationSerializer from recruitment.models.Location import Location import django_filters class LocationViewSet(viewsets.ModelViewSet): queryset = Location.objects.all().filter(deleted=0) serializer_class = LocationSer...
6,218
34ecf2bd9bc72a98aba4584880a198dd24899dbe
import os, re DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:' } } INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.admin', 'django.contrib.sessions', 'django.contrib.contenttypes', 'django.contrib.sites', 'maintenancemode'...
6,219
3ac69068db94f45bc44a8295a10603126d004b34
t = int(input()) m = 0 while(m < t): n = int(input()) arr = list(map(int, input().strip().split(" "))) s = int(input()) hash_map = {} curr_sum = 0 count = 0 for i in range(len(arr)): curr_sum += arr[i] if curr_sum == s: count += 1 if curr_sum - s in hash_m...
6,220
3da4896f368f067a339db5cc89201c93ba8166ce
from __future__ import annotations import asyncio import signal from functools import wraps from typing import TYPE_CHECKING, Awaitable, Callable import click from .utils import import_obj if TYPE_CHECKING: from donald.manager import Donald from .types import TV def import_manager(path: str) -> Donald: ...
6,221
4c0c88f46c2d4607d9ac00755bf122e847ea2f6a
"""Datasets, Dataloaders, and utils for dataloading""" from enum import Enum import torch from torch.utils.data import Dataset class Partition(Enum): """Names of dataset partitions""" TRAIN = 'train' VAL = 'val' TEST = 'test' class RandomClassData(Dataset): """Standard normal distributed feature...
6,222
fd7fe2e4ffaa4de913931e83fd1de40f79b08d98
from django.shortcuts import render from django.http import response, HttpResponse, Http404 from django.views.generic import TemplateView from django.db.models import Q # Create your views here. class Countries(TemplateView): template_name = 'home.html' def get_context_data(self, **kwargs): return Cou...
6,223
4cd1e385d18086b1045b1149d5f4573eaf9270c3
''' leetcode 338. 比特位计数 给定一个非负整数 num。对于 0 ≤ i ≤ num 范围中的每个数字 i ,计算其二进制数中的 1 的数目并将它们作为数组返回。 ''' class Solution(object): def countBits(self, n): """ :type n: int :rtype: List[int] """ out = [0] * (n+1) for i in range(1,n+1,1): if i%2==1: out[i]=o...
6,224
28eb1d7a698480028fb64827746b3deec0f66a9a
def erato(n): m = int(n ** 0.5) sieve = [True for _ in range(n+1)] sieve[1] = False for i in range(2, m+1): if sieve[i]: for j in range(i+i, n+1, i): sieve[j] = False return sieve input() l = list(map(int, input().split())) max_n = max(l) prime_l = erato(max_n) ...
6,225
82801ce564f4f29e084e6f842d7868eb60f582cb
from pymt_heat import Heatmodel heat = Heatmodel() n = heat.get_component_name() print(n)
6,226
ff6b7e2097d78b013f8f5989adee47156579cb9e
from flask import Flask from flask import request from flask import session from flask import jsonify from flask import make_response import mariadb import datetime import json import scad_utils testing: bool = True if testing: fake_datetime = datetime.datetime(2020, 8, 7, 15, 10) app = Flask(__name__) app.confi...
6,227
77b43d7d9cd6b912bcee471c564b47d7a7cdd552
from flask_wtf import FlaskForm from wtforms import StringField, SubmitField from wtforms.validators import DataRequired, Length from flask_ckeditor import CKEditorField class BoldifyEncryptForm(FlaskForm): boldMessage = StringField('Bolded Message: ', validators=[DataRequired()]) submi...
6,228
cad00f80afa142b69ced880de000b6b5b230640c
import pandas as pd import numpy as np import random import csv import pprint import datamake import dafunc_H def simulation(cnt, a, b): df, df_collist = datamake.make_df( '/Users/masato/Desktop/UTTdata/prog/PyProgramming/DA_algorithm/Mavo/csvdata/sinhuri2018.csv' ) n, m, k = datamake.stu_num() ...
6,229
58c7b405096a5fdc5eeacb5e5f314f2d1bb85af6
#!/usr/bin/python import argparse import os import subprocess import batch vmc_dir = os.environ['VMCWORKDIR'] macro = os.path.join(vmc_dir, 'macro/koala/daq_tasks/export_ems.C') exec_bin = os.path.join(vmc_dir,'build/bin/koa_execute') # arguments definitions parser = argparse.ArgumentParser() parser.add_argument("in...
6,230
86928f4358e4999a5cec8bfad1fe055c9a2778d1
""" Create all figures and Excel files that combine data from all embryos in a given genetic background Copyright (C) 2017 Ahmet Ay, Dong Mai, Soo Bin Kwon, Ha Vu 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 ...
6,231
378032a8d02bc49e5ed8ebccbeddfbb281c2cbd7
v0 = 5 g = 9.81 t = 0.6 y=v0*t - 0.5*g*t**2 print (y)
6,232
aebf1d64923c5f325c9d429be092deaa06f20963
#!/usr/bin/env python import sys def add_them(a, b): return a + b def main(): print add_them(10, 21) if __name__ == '__main__': sys.exit(main())
6,233
81a53d08ab36e85dd49cf1f3d9c22c1f18605149
#!/usr/bin/python #encoding=utf8 import sys import tushare as ts def local_main(): if len(sys.argv) != 2: print sys.argv[0], " [stock id]" return stock_id = sys.argv[1] df = ts.get_hist_data(stock_id) df.to_excel(stock_id + '_his.xlsx', sheet_name = stock_id) if __name__ == '__main__...
6,234
e3de072d6bce2ecc105306c06b9a9aa0362130ff
""" Auxiliary functions for calculating the utility of achieving a certain data rate (for a UE). Attention: The absolute reward that's achieved with different utilities cannot be compared directly (diff ranges)! """ import numpy as np from deepcomp.util.constants import MIN_UTILITY, MAX_UTILITY def linear_clipped_ut...
6,235
164665c7d037f1e4128d8227d5fc148940d5c2b8
#!/bin/python import sys arr = map(int, raw_input().strip().split(' ')) smallest = 1000000001 largest = 0 smi = -1 lri = -1 for i, num in enumerate(arr): if num < smallest: smallest = num smi = i if num > largest: largest = num lri = i smsum = 0 lrsum = 0 for i in range(len(a...
6,236
aebe749a20482636d7ed508f9cbd9cde56656b73
#!/usr/bin/env python # # This will take a snapshot and convert it into a volume. To create a volume # without any links to the old snapshot you need to convert it to a temporary # volume first, convert that into an image and convert the image back into # your final volume. Once this is all done, the temporary volume a...
6,237
6f253da5dc1caa504a3a8aadae7bce6537b5c8c6
# Exercise 3: Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error message. # If the score is between 0.0 and 1.0, print a grade using the following table: # Score Grade # >= 0.9 A # >= 0.8 B # >= 0.7 C # >= 0.6 D # < 0.6 F # Vinayak Nayak # 27...
6,238
dfee0407eaed7b1ab96467874bbfe6463865bcb4
from __future__ import absolute_import, print_function, unicode_literals import six from six.moves import zip, filter, map, reduce, input, range import pathlib import unittest import networkx as nx import multiworm TEST_ROOT = pathlib.Path(__file__).parent.resolve() DATA_DIR = TEST_ROOT / 'data' SYNTH1 = DATA_DIR ...
6,239
4d4dd451d83d8d602c6264e77f52e5e143aef307
import tensorflow as tf import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' sess = tf.Session() # 1.one-shot iterator dataset = tf.data.Dataset.range(100) iterator = dataset.make_one_shot_iterator() next_element = iterator.get_next() for i in range(100): value = sess.run(next_element) # print(value) assert i == v...
6,240
ac35672661e1dd0b97567ae4335f537dc69f98f7
########################################################### # 2019-02-07: 删除了marginalized prior # ########################################################### import sys,os import numpy as np import matplotlib.pylab as plt from scipy.linalg import eig from scipy.stats import norm, kstest, normaltest # use default col...
6,241
deeba82536d0366b3793bcbe78f78e4cfeabb612
def solution(n, money): save = [0] * (n+1) save[0] = 1 for i in range(len(money)): for j in range(1, n+1): if j - money[i] >= 0: save[j] += (save[j - money[i]] % 1000000007) return save[n]
6,242
c24be05700e5ee043d09d6f2e78cb3de1e7088f1
#!/usr/bin/env python # vim: set fileencoding=utf-8 : # Andre Anjos <andre.anjos@idiap.ch> # Sat Dec 17 14:41:56 2011 +0100 # # Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland """Run tests on the libsvm machine infrastructure. """ import os import numpy import tempfile import pkg_resources imp...
6,243
2ab6488276c74da8c3d9097d298fc53d1caf74b1
import numpy import numpy.fft import numpy.linalg import copy from astropy.io import fits from scipy.interpolate import RectBivariateSpline from scipy.signal import convolve import offset_index # some basic definitions psSize = 9 # psSize x psSize postage stamps of stars # zero padded RectBivariateSpline, if on def R...
6,244
050f060bb9d3d46f8b87c9802356bd0da8f926f8
with open('rosalind_ba3d.txt','r') as f: kmer_length = int(f.readline().strip()) seq = f.readline().strip() dict = {} for offset in range(len(seq)-kmer_length+1): prefix = seq[offset:offset+kmer_length-1] suffix = seq[offset+1:offset+kmer_length] if prefix in dict: dict[prefix].append(suffix) else: ...
6,245
e50c1ef7368aabf53bc0cfd45e19101fa1519a1f
import os from typing import List from pypinyin import pinyin, lazy_pinyin # map vowel-number combination to unicode toneMap = { "d": ['ā', 'ē', 'ī', 'ō', 'ū', 'ǜ'], "f": ['á', 'é', 'í', 'ó', 'ú', 'ǘ'], "j": ['ǎ', 'ě', 'ǐ', 'ǒ', 'ǔ', 'ǚ'], "k": ['à', 'è', 'ì', 'ò', 'ù', 'ǜ'], } weightMap = {} def g...
6,246
71e7a209f928672dbf59054b120eed6a77522dde
from springframework.web.servlet import ModelAndView from springframework.web.servlet.HandlerAdapter import HandlerAdapter from springframework.web.servlet.mvc.Controller import Controller from springframework.web.servlet.mvc.LastModified import LastModified from springframework.utils.mock.inst import ( HttpServlet...
6,247
94a3a74260fac58b4cad7422608f91ae3a1a0272
from inotifier import Notifier from IPython.display import display, Audio, HTML import pkg_resources import time class AudioPopupNotifier(Notifier): """Play Sound and show Popup upon cell completion""" def __init__(self, message="Cell Completed", audio_file="pad_confirm.wav"): super(AudioPopupNotifi...
6,248
3b71ef6c3681b8c5e6aadf2d125c35cbf3a12661
import loops class Card(): #to make a card you must type Card("Name of Card") def check_cat(self,string): if "Cat" in string: return True return False def __init__(self,string): self.type = string self.cat = self.check_cat(self.type) # self.ima...
6,249
5762271de166994b2f56e8e09c3f7ca5245b7ce0
import binascii import collections import enum Balance = collections.namedtuple("Balance", ["total", "available", "reward"]) Balance.__doc__ = "Represents a balance of asset, including total, principal and reward" Balance.total.__doc__ = "The total balance" Balance.available.__doc__ = "The principal, i.e. the total m...
6,250
f0a03f9a6dc78d01455913f7db3ab1948b19ea63
vocales = "aeiou" resultado = [] frase = input("Por favor ingrese la frase que desea verificar").lower() print(frase) for vocal in vocales: conteo_vocales = frase.count(vocal) mensaje = (f"En la frase hay {conteo_vocales} veces, la vocal{vocal}") resultado.append(mensaje) for elemento in resultado: p...
6,251
73337246bd54df53842360510148f3a6f4763ace
from .net import *
6,252
6dc7c7de972388f3984a1238a2d62e53c60c622e
from django.test import TestCase from student.forms import StudentForm class ModelTest(TestCase): def test_expense_form_valid_data(self): form = StudentForm(data={ 'student_id': 500, 'firstName': "Emre", 'lastName': "Tan", 'department': "Panama", ...
6,253
18b10a68b2707b7bfeccbd31c5d15686453b3406
# Copyright (c) 2020 Hai Nguyen # # This software is released under the MIT License. # https://opensource.org/licenses/MIT import tensorflow.keras.backend as K def dice_coef(y_true, y_pred): smooth = 1. y_true_f = K.flatten(y_true) y_pred_f = K.flatten(y_pred) intersection = K.sum(y_true_f * y_pred_...
6,254
08abb94424598cb54a6b16db68759b216682d866
#------------------------------------------------------------------------------- # Name: module1 # Purpose: # # Author: legolas # # Created: 05.03.2015 # Copyright: (c) legolas 2015 # Licence: <your licence> #------------------------------------------------------------------------------- print "T...
6,255
b46a14c821777873eb60df609d9f112c737a3635
__author__ = 'Erwin' class usuario: def __init__(self, nombre, user, pasw, permiso, foto): self.nombre = nombre self.login = user self.pasw = pasw self.permiso = permiso self.foto=foto self.database=True class medicamento: def __init__(self, nombre , descripcion...
6,256
05052e9ccbd076e71e9ec6148887ce7b82ed316d
from flask import Flask, render_template, request from distance import get_distance app = Flask(__name__) @app.route('/hello') @app.route('/hello/<name>') def hello(name=None): name = "World" if not name else name return "Hello %s" % name @app.route('/') def index(): return render_template('index.html'...
6,257
47c6f9767b97469fe7e97ab3b69650265a8021d8
import numpy as np np.set_printoptions(precision = 1) pi = np.pi def convertRadian(theta): radian = (theta) * (np.pi) / 180 return radian def mkMatrix(radian, alpha, dis): matrix = np.matrix([[np.cos(radian),(-1)*np.sin(radian)*np.cos(alpha), np.sin(radian)*np.sin(alpha), a1 * np.cos(radian)], ...
6,258
fa833e9cd1e624d9ecfb2fcc6d9e22955c9e4b1e
# -*- coding: utf-8 -*- """" Created on Saturday, January 18, 2020 @author: lieur This test case sets silver and gold to 0, which in most cases prevent the computer from buying provinces. This tests to see if the game ends when one more supply car hits 0 (since silver and gold are already at 0 and the game ends when...
6,259
c3de9e6129bcafd863cd330ac281345fb563cc8c
"""The prediction classes. Instances of the class are returned by the recommender. """ class RelationshipPrediction(object): """The prediction of the predicted_relationship appearing between the given subject-object pair. @type subject: the domain-specific subject @ivar subject: the subject ...
6,260
a520a93ed2dcd26b9470ed56e96b65a1b3550176
# -*- coding: utf-8 -*- ''' Created on 2014-03-25 @author: ZhaoJianning Modified by WangHairui on 2014-09-12 ''' import unittest import Stability import time import os,sys import runtests import re import android import datetime class TestCamera(unittest.TestCase): def setUp(self): ...
6,261
2a95a68d8570a314b2b6e5731d7a695e5d7e7b30
#This program is a nice example of a core algorithm #Remove Individual Digits # To remove individual digits you use two operations # 1 MOD: # mod return the remainder after division. 5%2 = 1. # If we mod by 10 we get the units digit. 723%10 = 3 # 2 Integer Division: # Integer division is when we divide and remove de...
6,262
6cb29ebd9c0f2660d0eb868bec87ffd97cf4d198
""" A set of constants to describe the package. Don't put any code in here, because it must be safe to execute in setup.py. """ __title__ = 'space_tracer' # => name in setup.py __version__ = '4.10.2' __author__ = "Don Kirkby" __author_email__ = "donkirkby@gmail.com" __description__ = "Trade time for space when debug...
6,263
51cd74bff5a0883a7bee2b61b152aecb2c5ccc66
import sys sys.path.append("/home/mccann/bin/python/obsolete") from minuit import * execfile("/home/mccann/antithesis/utilities.py") nobeam = getsb("cos") ebeam = getsb("bge") pbeam = getsb("bgp") import gbwkf import gbwkftau runstart = pickle.load(open("/home/mccann/antithesis/old_dotps/runstart.p")) runend = pickle....
6,264
97ff8dae060475b0efbc8d39e9fc251be8ac091b
from __future__ import annotations import ibis from ibis import _ def test_format_sql_query_result(con, snapshot): t = con.table("airlines") query = """ SELECT carrier, mean(arrdelay) AS avg_arrdelay FROM airlines GROUP BY 1 ORDER BY 2 DESC """ schema = ibis.schema({"...
6,265
6f259210cbe8969046cba1031ab42d77e913abea
# -*- coding: utf-8 -*- from celery import shared_task from djcelery.models import PeriodicTask, CrontabSchedule import datetime from django.db.models import Max, Count from services import * # 测试任务 @shared_task() def excute_sql(x,y): print "%d * %d = %d" % (x, y, x * y) return x * y # 监控任务:查询数据库并进行告警 @sha...
6,266
e52b01cc7363943f5f99b1fa74720c6447b1cfae
from setuptools import setup, find_packages __version__ = '2.0' setup( name='sgcharts-pointer-generator', version=__version__, python_requires='>=3.5.0', install_requires=[ 'tensorflow==1.10.0', 'pyrouge==0.1.3', 'spacy==2.0.12', 'en_core_web_sm==2.0.0', 'sgchar...
6,267
88109909d0c80f25373f917426c3c3634bfc8114
import numpy as np from base_test import ArkoudaTest from context import arkouda as ak """ Encapsulates unit tests for the pdarrayclass module that provide summarized values via reduction methods """ class SummarizationTest(ArkoudaTest): def setUp(self): ArkoudaTest.setUp(self) self.na = np.linsp...
6,268
bd310ab0bc193410b8f93ad5516b0731d2eba54f
''' Various tools for cleaning out nulls and imputing '''
6,269
33365d5ce5d2a7d28b76a7897de25e1f35d28855
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created for COMP5121 Lab on 2017 JUN 24 @author: King """ import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.svm import SVC import sklearn.metrics as metrics from sklearn.metrics import accuracy_score data = [[...
6,270
49d76458b8adcf6eea9db2ef127609ff96e03ad1
from django.contrib import admin from django.urls import path, include from serverside.router import router from rest_framework.authtoken import views as auth_views from . import views from .views import CustomObtainAuthToken urlpatterns = [ path('users/', views.UserCreateAPIView.as_view(), name='user-list'), ...
6,271
db140bf66f3e3a84a60a6617ea4c03cc6a1bc56d
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed Jan 31 13:42:47 2018 @author: zhan """ from scipy.spatial.distance import pdist, squareform, cdist import numpy as np import scipy.io as sci import os,sys import datetime ################################################################### # I_tr:featur...
6,272
b00c07ee3cdba55800c9701b7b8b0e3c9079e9f8
from util import * def K_step(x): if not x.shape: return S.One assert len(x.shape) == 1 n = x.shape[0] if n == 2: return x[1] return Piecewise((1, Equal(n, 1)), (x[1], Equal(n, 2)), (K(x[:n - 1]) * x[n - 1] + K(x[:n - 2]), True)) K = Fun...
6,273
ad054febac3a04c625653a2f3864506eeb672d9e
... ... model = Sequential() model.add(Conv2D(32, kernel_size=3, input_shape=(256, 256, 3)) ... ...
6,274
939011fca968d5f9250beb29a0bb700200e637df
# coding: utf-8 """ Picarto.TV API Documentation The Picarto.TV API documentation Note, for fixed access tokens, the header that needs to be sent is of the format: `Authorization: Bearer yourTokenHere` This can be generated at https://oauth.picarto.tv/ For chat API, see https://docs.picarto.tv/chat/chat.pr...
6,275
025c740813f7eea37abadaa14ffe0d8c1bedc79d
""" Design and implement a TwoSum class. It should support the following operations: add and find. add - Add the number to an internal data structure. find - Find if there exists any pair of numbers which sum is equal to the value. Example 1: add(1); add(3); add(5); find(4) -> true find(7) -> false Example 2: add(3);...
6,276
760a5a168575a0ea12b93cb58c1e81e313704e35
# Generated by Django 2.2 on 2020-10-26 15:16 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('viajes', '0001_initial'), ] operations = [ migrations.AlterModelOptions( name='viajes', options={'verbose_name': 'Movilización...
6,277
ee7efea569b685ad8d6922e403421227e9ea6922
from sklearn.linear_model import LinearRegression, LogisticRegression import numpy as np import pickle import os def Run(datasetFile): # Get file from user userFile = open(datasetFile, "r") # Starter list of all instances of the data file instanceList = [] instanceCount = 0 featureCou...
6,278
659f45d2c6c7138f26b4a8d15d1710ae60450b08
from OTXv2 import OTXv2 from pandas.io.json import json_normalize from datetime import datetime, timedelta import getopt import sys from sendemail import sendemail from main import otx import csv import pandas as pd from pandas import read_csv import os.path def tools(): search = str(input('Please enter search: '...
6,279
d5a5c6f9d483b2998cd0d9e47b37ab4499fa1c2a
import discord from discord.ext import commands class TestCommands(commands.Cog, description="Unstable test commands", command_attrs=dict(hidden=True, description="Can only be used by an Owner")): def __init__(self, bot): self.bot = bot self.hidden = True print("Loaded", __name__) as...
6,280
818e6842d4a1f8978ec14bca06981ec933c00376
import os bind = "0.0.0.0:" + str(os.environ.get("MAESTRO_PORT", 5005)) workers = os.environ.get("MAESTRO_GWORKERS", 2)
6,281
ee03263d92372899ec1feaf3a8ea48677b053676
"""API - Files endpoints.""" import os import click import cloudsmith_api import requests from requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor from .. import ratelimits from ..rest import create_requests_session from ..utils import calculate_file_md5 from .exceptions import ApiException, catch_rai...
6,282
e0e00688a75021c2f8b608d4c942f5e68f6a6a48
# -*- coding:utf-8 -*- import re # 普通字符串 匹配本身 re_str = r'abc' result = re.fullmatch(re_str, 'abc') print(result) # 匹配任意字符 一个.只能匹配一个字符 re_str = r'a.c' result = re.fullmatch(re_str, 'abc') print(result) # \w匹配字母数字或下划线 # 匹配一个长度是5的字符串并且字符串的前两位是数字字母或者下划线后面是三个任意字符串 \w中文也能匹配 re_str = r'\w\w...' result = re.fullmatch(re_str, ...
6,283
4a8663531f303da29371078e34dc7224fc4580e3
# Author: Kenneth Lui <hkkenneth@gmail.com> # Last Updated on: 01-11-2012 ## Usage: python ~/code/python/001_Fastq_Trimming.py <FIRST BASE> <LAST BASE> <FASTQ FILES....> ## Bases are inclusive and 1-based #from Bio.SeqIO.QualityIO import FastqGeneralIterator #handle = open(sys.argv[2], 'w') #for title, seq, qual in Fa...
6,284
a2a94e87bb9af1ccaf516581d6662d776caf0b0d
""" Project: tomsim simulator Module: FunctionalUnit Course: CS2410 Author: Cyrus Ramavarapu Date: 19 November 2016 """ # DEFINES BUSY = 1 FREE = 0 class FunctionalUnit: """FunctionalUnit Class to encompass methods needed for Integer, Divide, Multipler, Load, Store Functional Units in tomsim ...
6,285
549d7368d49cf2f4d2c6e83e300f31db981b62bd
#! import os import sys #get current working directory cwd = os.getcwd() ovjtools = os.getenv('OVJ_TOOLS') javaBinDir = os.path.join(ovjtools, 'java', 'bin') # get the envirionment env = Environment(ENV = {'JAVA_HOME' : javaBinDir, 'PATH' : javaBinDir + ':' + os.environ['PATH']}) env.Execut...
6,286
b739a5d359b4d1c0323c7cd8234e4fe5eb9f3fcb
# -*- coding: utf-8 -*- import logging from django.contrib.auth import authenticate, login as django_login, logout as django_logout from django.contrib.auth.models import User from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.core.urlresolvers import reverse from django.db.utils imp...
6,287
2a83bc9157e2210da46e58c56fc0b7199856f4c0
msg = "eduardo foi a feira" if 'feira' in msg: print('Sim, foi a feira') else: print('não ele não foi a feira')
6,288
adf8b52f6e71546b591ceb34a9425c28f74883fa
#!/usr/bin/env python # -*- coding: UTF-8 -*- """Project Euler: 0010 https://projecteuler.net/problem=10 Summation of primes The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. """ import math import sys PROBLEM = 10 SOLVED = True SPEED = 29.16 TAGS = ['primes']...
6,289
4a892c3532a3e3ddcd54705336dce820ff49b91b
""" Copyright (c) 2018, salesforce.com, inc. All rights reserved. SPDX-License-Identifier: BSD-3-Clause For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause Graph Search Policy Network. """ from typing import List, NamedTuple, Union import torch import tor...
6,290
31b420adebbe0d3ee6da2ed8236ece1526bdb063
for _ in range(int(input())): n = int(input()) s = input() cur = 0 for i in s[::-1]: if i==')': cur+=1 else: break print("Yes") if cur>n//2 else print("No")
6,291
c70b4ff26abe3d85e41bfc7a32cf6e1ce4c48d07
import pytest import torch from homura.utils.containers import Map, TensorTuple def test_map(): map = Map(a=1, b=2) map["c"] = 3 for k, v in map.items(): assert map[k] == getattr(map, k) for k in ["update", "keys", "items", "values", "clear", "copy", "get", "pop"]: with pytest.raises...
6,292
9efd83524ebb598f30c8fb6c0f9f0c65333578e6
#implement variable! import numpy as np class Variable: def __init__(self, data): self.data = data class Function: ''' Base class specific functions are implemented in the inherited class ''' def __call__(self, input): x = input.data #data extract y = self.foward(x) ...
6,293
e8eac1e4433eee769d317de9ba81d5181168fdca
#!/usr/bin/python3 # -*- coding: utf-8 -*- """"""""""""""""""""""""""""""""""""""""""""""" " Filename: time.py " " Author: xss - callmexss@126.com " Description: Show local time " Create: 2018-07-02 20:20:17 """"""""""""""""""""""""""""""""""""""""""""""" from datetime import datetime print('''\...
6,294
9f86ff37d3a72364b5bd83e425d8151136c07dd3
#!/usr/bin/env python # -*- coding: UTF-8 -*- # from __future__ import absolute_import, division, print_function, unicode_literals from collections import defaultdict import os import torch import numpy as np import pickle from sklearn.linear_model import Ridge, Lasso from biplnn.log import getLogger from biplnn.utils...
6,295
5a3b88f899cfb71ffbfac3a78d38b748bffb2e43
# coding=utf-8 import tensorflow as tf import numpy as np state = [[1.0000037e+00, 1.0000037e+00, 1.0000000e+00, 4.5852923e-01], [1.0000000e+00, 1.0000000e+00, 1.0000000e+00, 8.3596563e-01], [1.0000478e+00, 1.0000000e+00, 1.0000478e+00, 1.4663711e+00], [1.0000037e+00, 1.0000478e+00, 1.00000...
6,296
4d524bb4b88b571c9567c651be1b1f1f19fd3c0b
#Recursively parse a string for a pattern that can be either 1 or 2 characters long
6,297
af217d0cc111f425282ee21bd47d9007a69a6239
import math print ("programa que calcula hipotenusa tomando el valor de los catetos en tipo double---") print ("------------------------------------------------------------------------") print (" ") catA = float(input("igrese el valor del cateto A")) catB = float(input("ingrese el valor del catebo B")) def calcularHi...
6,298
fde62dd3f5ee3cc0a1568b037ada14835c327046
import tkinter as tk import tkinter.messagebox as tkmb import psutil import os import re import subprocess from subprocess import Popen, PIPE, STDOUT, DEVNULL import filecmp import re import time import threading import datetime import re debian = '/etc/debian_version' redhat = '/etc/redhat-release' def PrintaLog(tex...
6,299
596814032218c3db746f67e54e4f1863753aea06
# -*- coding: utf-8 -*- # @Time : 2019/3/21 20:12 # @Author : for # @File : test01.py # @Software: PyCharm import socket s=socket.socket() host=socket.gethostname() port=3456 s.connect((host,port)) cmd=input(">>>") s.sendall(cmd.encode()) data=s.recv(1024) print(data.decode()) s.close()