index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
987,200
b71441c671b5afc9207a3d47d5845ea90f5a66f8
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2017-08-02 08:34 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('fish', '0005_fishdetection_aquarium_id'), ] operations = [ migrations.AddFi...
987,201
133732564f8f125343a897eebfadbfbaa39b3898
from PIL import Image im = Image.open('font.png', 'r') pix_val = list(im.getdata()) pix_val_flat = [x for sets in pix_val for x in sets] w, h = im.size for i in range(len(pix_val)): pix_val[i] = int(round(sum(pix_val[i]) / float(len(pix_val[i])))) import numpy as np pix_val = np.array(pix_val) pix_val = pi...
987,202
6d590643753538b9ca7fad9162465a14c216d00d
#! /usr/bin/python3.5 import os import re from config import token import telebot from sql import Db from system_func import get_ip from system_func import is_admin from system_func import list_to_str bot = telebot.TeleBot(token) db_dir = os.path.dirname(os.path.abspath(__file__)) + "/words.db" def get_cmd_param(me...
987,203
e44a78c4ed824700a582bee0f1567e5ae8bef8ee
import numpy as np import pandas as pd from scipy import stats def sigmoid(x): return 1 / (1 + np.exp(-x)) def rvec(x): return np.atleast_2d(x) def cvec(x): return rvec(x).T def to_3d(mat): return np.atleast_3d(mat).transpose(2,0,1) def srho(x,y): return stats.spearmanr(x,y)[0] """ VECTORIZED ...
987,204
ce78dd874ffd82fd2a10a06a214eb9b3005dd1f8
''' A test simulation involving the SEIR flu model in isolation. ''' from pram.data import GroupSizeProbe, ProbeMsgMode from pram.entity import Group, Site from pram.rule import SEIRFluRule from pram.sim import Simulation rand_seed = 1928 probe_grp_size_flu = GroupSizeProbe.by_attr('flu', SEIRFluRule.ATTR, SE...
987,205
ef5d894c5edbe85c7961b9537b6f56b2eb9ac831
from .graph_node import GraphNode from .graph import Graph from .square_grid import SquareGrid, Point __all__ = GraphNode, Graph, SquareGrid, Point
987,206
dd7d8a18f8c1c27db24bb92ba7067ab01a50b452
""" This script converts CEU.BEAM.txt (which is in BEAM format: first line is 0 or 1 if subject is case or control, then one line per SNP and 0 if homozygous for the major allele, 1 if heterozygous, 2 if homozygous for the minor allele). The output is two matrices: cases and controls and a description of the implanted...
987,207
35d48342d315269a47d0facc0ec01dd8764a0cfd
import os from unittest import TestCase from musicscore.musicstream.streamvoice import SimpleFormat from musicscore.musictree.treeinstruments import Violin, Cello, Viola from musicscore.musictree.treescoretimewise import TreeScoreTimewise from tests.score_templates.xml_test_score import TestScore path = str(os.path.a...
987,208
12d65c2a577a3852b315a595a95f0b8170988c01
#!/usr/bin/env python #-*- coding:utf-8 -*- import gtk import os.path import manager import db # import shell # import terminal # import filemanager class Null(): """NULL """ def __init__(self, builder): """ Arguments: - `builder`: """ self.builder = builder ...
987,209
940b25cff6bc8c06c89e070a3b87d20c01ef3ed9
# -*- coding: utf-8 -*- """ Created on Sat Apr 13 14:56:37 2013 @author: daniel """ #programa: subcadena_1.py #ejercicio 199 y 200 #data input cadena = raw_input('Escribe una cadena: ') i = int(raw_input('Numero A: ')) j = int(raw_input('Numero B: ')) flag = 0 subcadena = '' if i < 0: i = 0 if j > len(cadena):...
987,210
5c1e1981e194ba0c252608e9fc356c0dda9d9c61
from django.contrib.auth.models import AbstractUser from django.core.urlresolvers import reverse from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ from model_utils import Choices @python_2_unicode_compatible class User(A...
987,211
70d6a3345edbfe0d8495853d8d5dd1d0173eb64e
# -*- coding: utf-8 -*- """ ECoG Channel Localization (Joseph Tseung) Trying SimpleITK Created on Sun Nov 11 16:53:26 2018 @author: josep """ # from tkinter import Tk # from tkinter.filedialog import askopenfilename # from skimage import measure import SimpleITK as sitk # from matplotlib import pyplot ...
987,212
aa60f7417e51b9ffd722f6815a0811ea69e3a4e4
#6 import functools lst=list(map(int,input("Enter the list: ").split(" "))) print ("The sum of the list elements is : ",end="") print (functools.reduce(lambda a,b : a+b,lst))
987,213
d86d20fee2a59917b6cd98a225bb909c18f0b93b
from datetime import datetime user_data = [] class User: """ model class for users """ def __init__(self, **kwargs): self._id = len(user_data)+1 self.firstname = kwargs["firstname"] self.lastname = kwargs["lastname"] self.othernames = kwargs["othernames"] self.email = ...
987,214
b09056bec6639ee7c5d658ff38be15e193511b43
import torch import torch.nn as nn import torch.optim as optim import matplotlib.pyplot as plt import seaborn as sns sns.set() torch.manual_seed(seed=0) def logistic_regression(X, y, W_init, lr, max_nsteps): N, D = X.shape # Assign bias values X_ = torch.ones(N, D+1) X_[:, 1:] = torch.tensor(X) ...
987,215
6114967a43296defe3dd21061d1443e964c016cd
#!/usr/bin/env python import uvicorn from fastapi import FastAPI, WebSocket from src.servers.config import host, port from src.servers.utils import random_greeting app = FastAPI() @app.websocket("/greeting") async def greeting(websocket: WebSocket): await websocket.accept() while True: try: ...
987,216
7b92d679b1c637d6e4515d754c7aed9f481faacf
T = int(input()) for q in range(T): N, M = map(int, input().split()) arr = [input() for _ in range(N)] result =[] tmp_1 = 0 tmp_2 = 0 num = {'0001101': 0, '0011001': 1,'0010011': 2,'0111101': 3,'0100011': 4,'0110001': 5,'0101111': 6,'0111011': 7,'0110111': 8,'0001011': 9} for i in range(N):...
987,217
6397c816cb14f76445ae4618bb2632867d235441
import logging import re from typing import Optional from pydantic import BaseModel from opennem.core.unit_single import facility_unit_numbers_are_single logger = logging.getLogger(__name__) __is_number = re.compile(r"^\d+$") __is_single_number = re.compile(r"^\d$") __is_unit_alias = re.compile(r"([A-Z|a-z]{1,6})...
987,218
c2b377558df8f5b7321ef91b295dbc745832b18e
#!/usr/bin/env python # -*- coding: utf-8 -*- # @File : test_pytest.py # @Author: yubo # @Date : 2019/12/6 # @Desc : import pytest variable_module = 0 @pytest.fixture(scope='module') def variable_to_module(): global variable_module variable_module += 1 return variable_module def test_variable_modu...
987,219
71a7389408a5620d24c9473da17b97ae1cbc0bd9
from imutils.video import VideoStream import face_recognition import argparse import imutils import pickle import time import cv2 #from live_cam import live cv2.namedWindow("Image",cv2.WINDOW_NORMAL) ap = argparse.ArgumentParser() ap.add_argument("-e", "--encodings", required=True, help="path to serialized db of faci...
987,220
8ef04a64fa9de57295da32e46b8eac88129e43d2
from time import sleep import os while(1): sleep(1) os.system("dmesg > LogFirewall")
987,221
aa5f0e999c5212472388d13fbf9f7aaca2a2fb3f
#! /usr/bin/env python from ROOT import * import sys import script_utils as script_utils sys.path.append("/home/irfulx204/mnt/tmain/Desktop/Run308_Analyse_ERA/Scripts_ERA/") import create_extrapolated_bckg as create_bckg import subprocess as subp import BDT_utils as BDT_ut import BDT_file_handler as BDT_fh import PyR...
987,222
76e7c03215f969d8635c42b931451a756f53f6a8
# coding=utf8 import pytest # coding=utf8 import pytest #如果使用autouse=True,默认所有用例都是用此装饰器,function级别的。但是如果需要yield的返回值,则需要将login方法名传入用例作为参数 @pytest.fixture(params=["tom","jerry"]) def login(request): # 相当于setup print("登录操作") # yield相当于return,也就是teardown后,return出参数 # yield ["1111","2222"] username= r...
987,223
fcc1953db017bafd949161c1decf4f25a17e0fa0
#python 3.7.0 64-bit #py -3 -m pip install numpy==1.19.3 #py -3 -m pip install spacy==2.1.0 #py -3 -m pip install neuralcoref==4.0 #py -3 -m spacy download en_core_web_sm #py -3 -m spacy download en_core_web_lg import sys import spacy import neuralcoref import re import random def get_aux_bin(sent): s...
987,224
a9997307f82838f57ee90bbc6ad4d5bab13cc31b
import time start = time.time() def compute(n): phi = [i for i in range(n + 2)] for p in range(2, n + 1): if phi[p] == p: phi[p] = p - 1 for i in range(2 * p, n + 1, p): phi[i] = (phi[i] // p) * (p - 1) for i in range(2, n + 1): if sorted(list(str(i))...
987,225
f4dac99bd494a9f202b7da1ed265f52a817775c8
# -*- coding: utf-8 -*- """ Created on Thu Sep 1 00:26:04 2016 @author: hy """ import tensorflow as tf input1=tf.constant(3.0) input2=tf.constant(2.0) input3=tf.constant(5.0) intermed=tf.add(input2,input3) mul=tf.mul(input1,intermed) with tf.Session() as sess: result=sess.run([mul,intermed]) print result
987,226
525374d02696c5f78c771fdcc6685c826023fd21
# 输入函数:input # num1 = input("num >>>") # num2 = input("num >>>") # print(int(num1)+int(num2)) # 输出函数:print # print("yuan",end="") # print("alvin") print("张三","李四",sep=":::")
987,227
50238be2d274446ab842353ed93558372911ea32
import numpy as np import torch class DataNormalizer(object): def __init__(self, dataloader): self.dataloader = dataloader self._range_normalizer(magnitude_margin=0.8, IF_margin=1.0) print("s_a:", self.s_a ) print("s_b:", self.s_b ) print("p_a:", self.p_a) print(...
987,228
efbe83307a35e9e2623d46766c86605323d3026e
from bson import ObjectId from bson.errors import InvalidId def id_generator(doctype): def id_gen(oid): if doctype is None or not oid: return None try: data = doctype.datatype.one({'_id':ObjectId(oid)}) if data: return doctype(data) re...
987,229
f3e0a17dda7c95527940d1301cd55279d816730c
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim: ai ts=4 sts=4 et sw=4 # Author: Sergio Araujo # Last Change: 2018 mai 24 17:44 # Created: qui 26 jan 2017 07:22:20 BRT # email: <voyeg3r ✉ gmail.com> # Github: https://github.com/voyeg3r # twitter: @voyeg3r # References: # the first ve...
987,230
698a0fc43f2dfa304ef5b4443bacc6ae2ab45474
import os import csv zFile = 'C:\\Users\\viresh.patel\\Documents\\Excel Docs\\global_superstore.csv' zInfo = os.stat(zFile) print(zInfo) print(zInfo.st_atime) print(zInfo.st_ctime) print(zInfo.st_dev) # print(zInfo.st_file_attributes) print(zInfo.st_gid) print(zInfo.st_ino) print(zInfo.st_mode) print(zInfo.st_mtime)...
987,231
317a112d47850fe2140b293ecca2a97bb3ca4f24
import graphene from graphene_django import DjangoObjectType from ..apps.data.models import Project class Projects(DjangoObjectType): class Meta: model = Project class ProjectQuery(graphene.ObjectType): get_all_projects = graphene.List(Projects) get_project_by_id = graphene.Field(Projects, i...
987,232
5dc3308cbc0c24fd4d562e679319a760bd5eba85
import os import gdal from glob import glob dir_with_csvs = r"C:/anhHoangKTTV/PythonScripts_DFS0/Project_NTB/" os.chdir(dir_with_csvs) def find_csv_filenames(path_to_dir, suffix=".csv"): relativePath = path_to_dir + "*.csv" print(relativePath) # filenames = glob.glob(relativePath) filenames = [os.path...
987,233
62e84c17900afdaa8ee39f5ec3d8536d8c5b02a6
# -*- coding: utf-8 -*- """ Created on Fri Nov 13 22:24:24 2020 @author: T SRIDHAR """ from TOPSIS-Divij-101816056 import topsis
987,234
e3d8d27d292ed0a9b6aa04ecf65eacb5dd3aedd8
from flask import Blueprint sample = Blueprint('sample', __name__) #profile = Blueprint('profile', __name__, # template_folder='templates', # static_folder='static') @sample.route('/hello') def hello(): # Do some stuff return "Hello , It's a sample page"
987,235
38a36d19f136d68b30d47f4090a3e481649677e5
from base.activity import Activity from base.titlelayout import TitleLayout class WebViewActivity(Activity): def __init__(self): Activity.__init__(self, self.__class__.__name__) self.scrollTest() def scrollTest(self): title = TitleLayout() self.swipeUp(n=5) title.finis...
987,236
0eda77fc4dfed7ee40ac2df8599cb6f391dde76f
#!/usr/bin/python import jinja2, json, re from functools import reduce import subprocess import nanodurationpy as durationpy import csv import time import datetime import os import shutil import glob import argparse parser = argparse.ArgumentParser() parser.add_argument('--wasmoutdir', help='full path of dir containi...
987,237
3260da175b41644aeaf00c743ae946ea0789e0b5
from KMCLib import * from .constant import * from .rate import * # rate_constant set here refers to prefactor p_des = { 'N2O':{} } p_des['N2O']['top'] = [KMCProcess( coordinates = [Origin], elements_before = ['top'], elements_after ...
987,238
f3a18dadc546cfbd3d1c0be66d55e1ed707ff860
#! /usr/bin/env python import textile import sys, os, shutil, random from optparse import OptionParser from BeautifulSoup import BeautifulSoup from Cheetah.Template import Template from xml.sax.saxutils import escape VERSION = '0.1.1' HOME = '/home/curtis/working/reptile' TEMPLATE = HOME + '/templates/reptile.tpl' # ...
987,239
6e62a834acc45b0c7e8e95beb1c45b81c7d555a7
import csv file_to_load = "Resources/budget_data2.csv" total_months = 0 total_revenue = 0 prev_revenue = 0 revenue_change = 0 max_i = ["", 0] min_d = ["", 9999999999999999999999] revenue_changes = [] with open(file_to_load) as revenue_data: reader = csv.DictReader(revenue_data) for row in reader: ...
987,240
3e141e01eb00927d090c4d10195506577f338afd
from django.shortcuts import render from django.http import HttpResponse, HttpResponseRedirect from django.conf import settings from rest_framework import viewsets from rest_framework.response import Response import datetime from .forms import DoorCombinationForm from .models import * from django.contrib.auth.decorato...
987,241
c83eaa7ba3ab76f1d31f97e449c5f5d3232379c7
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 9 20:11:21 2017 @author: ERIC """ #import the best module ever from twython import Twython #config file is in same directory from TWITTER_CONFIG import APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET #import keys from config file twit...
987,242
839d14a11451b16cfde7628eb3a9454a52279388
from suds.client import Client from nova import exception from nova import db import logging logging.getLogger('suds').setLevel(logging.INFO) def update_for_run_instance(service_url, region_name, server_port1, server_port2, dpid1, dpid2): # check region name client = Client(service_url + "?wsdl") client...
987,243
2f267c35e3b984bba50ce62bb69770324fe018c8
class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def delete_dupliate_list_elements(self, dlist): delete_indices = set() i = 0 while i < len(dlist) - 1: if dlist[i].val...
987,244
e9d05b9902f59e61461843037094d72626dfe972
#!/usr/bin/env python3 '''Extract gene nucleotide sequence in FASTA format from genbank records''' import argparse import pathlib import Bio.SeqIO FASTA_DESC_TEMPL = '>%s_%s %s' def get_arguments(): parser = argparse.ArgumentParser() parser.add_argument('--input_fp', required=True, type=pathlib.Path, ...
987,245
5ca8f1cc7a273c07e0143d63b7e414845153ad2b
TOKEN = '1772291199:AAGqhnEVGIpLHDV3xe_u1BVqgAJYn5IBlX4'
987,246
d4af0066d6125b62f9b0de6d93f3a0c709566f2d
import matplotlib as matplt matplt.use('Agg') import os, sys sys.path.insert(0, os.path.abspath('..')) sys.path.insert(0, os.path.abspath('.')) sys.path.insert(0, os.path.abspath('../easy_reg')) import tools.module_parameters as pars from abc import ABCMeta, abstractmethod from easyreg.piplines import run_one_task f...
987,247
8e625caa2db8fa2436e03422d9a4206761a8720f
# Copyright 2015-2016 NEC Corporation. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
987,248
3d83ad15a32a573bbc3e3f8f23a51544d8be923f
import json numbers = [2, 3, 4, 5, 6, 7, 11, 12] filename = 'numbers.json' with open(filename, 'w') as f_obj: json.dump(numbers, f_obj) with open(filename) as f_obj: numbers = json.load(f_obj) print numbers
987,249
90e94392faf1c9a16d856e335c23908f25899223
# Machine Learning Online Class # Exercise 7 | Principle Component Analysis and K-Means Clustering from scipy.io import loadmat import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np from featureNormalize import featureNormalize from pca import pca from projectData import * from r...
987,250
1064b303a0273a0647c11e770eb64e1a9039367d
import json from abc import ABC, abstractmethod import numpy import talib import websockets RSI_PERIOD = 14 RSI_OVERBOUGHT = 70 RSI_OVERSOLD = 30 class Watcher(ABC): """ Responsible for watching symbol candles and deciding when to order. """ def __init__(self, symbol): self.SYMBOL = symbol ...
987,251
ec80412850dbe8365a6568fa9122160678586b4c
from Query import Query import re class ParserQuery(): def parseQRY(chemin): """ Fonction permettant de parser les fichers QRY (requêtes avec leurs identifiants et leur texte) """ file = open(chemin, 'r') res = {} currentI = None currentBalise = None ...
987,252
a3eb3dc6e6a3a2f215b760cd0cdd9014b1a192eb
from genmod.commands import filter_command from click.testing import CliRunner ANNOTATED_VCF_FILE = "tests/fixtures/test_vcf_annotated.vcf" from genmod import logger from genmod.log import init_log init_log(logger, loglevel="INFO") def test_genmod_filter(): """docstring for test_genmod_annotate_models""" ru...
987,253
5370676b064e69e7eff1df1c15d04343c15f0650
# Generated by Django 2.2.7 on 2019-12-25 15:13 import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('courses', '0004_auto_20191129_1720'), ] operations = [ migrations.AlterField( model_name='course', n...
987,254
dc54c1b0aadbfecdfa743fd98e1ba0c0133fa669
# Generated by Django 3.2 on 2021-04-12 21:53 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("menu", "0005_auto_20210412_2137"), ] operations = [ migrations.AlterField( model_name="lunch", name="details", ...
987,255
385aee105ef70b0597d7b7110dd3fece93ab0f46
from string import ascii_lowercase import numpy as np from ref_optimize import ref_optimize def read_train(filename): #function to read training data mapping = list(enumerate(ascii_lowercase)) mapping = { i[1]:i[0] for i in mapping } with open(filename, "r") as f: raw_data = f.read() raw_data = raw_data.split("...
987,256
d77180854792ffd31298ff5b61b669aa721a6a30
import ROOT, sys, os import numpy as np import time start_time = time.time() opts = [opt for opt in sys.argv[1:] if opt.startswith("-")] outputTitle = "h_studyETauChannel" isData = 0 if "-b" in opts: isData = 0 if "-dj" in opts: isData = 1 isJetHTSample = 1 isSingleElectronSample = 0 if "de" in o...
987,257
ffe911b4598a8c26c2df5f53aff853789b19ceb9
import sys n, r = map(int, sys.stdin.readline().split()) r = min(n-r, r) res = 1 for i in range(1, r + 1): res *= ((n - i + 1) / (r - i + 1)) print(int(res))
987,258
f9169f47597c351594c66321ed40e2010035fd6e
import torch import os from torch.utils.tensorboard import SummaryWriter class Logger(object): def __init__(self, log_dir, comment=''): self.writer = SummaryWriter(log_dir=log_dir, comment=comment) self.imgs_dict = {} def scalar_summary(self, tag, value, step): self.wr...
987,259
ef7e100bb1425d3aaf817141b4ca2f4b896070b6
"""learn_django_pro_V_2 URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home'...
987,260
e2c01fce7ad1afb4e864ea50502cacadaa223dd4
import re # 處理繁體中文 import jieba2 as jieba import jieba2.analyse import sqlite3 import pickle from collections import defaultdict from sklearn.feature_extraction import DictVectorizer from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.sv...
987,261
72548887be201de4d8b279dcb1fff83d6ab89d33
""" crear una fucnion que muestre el nombre y el apellido """ """ def nom (name, apellido): print("Hola", name,apellido) name = input("Digite su Nombre: ") ape = input("Digite su Apellido: ") nom(name, ape) """ """ def f1(): x=100 print(x) x=+1 f1() """ """ EJERCICIOS DE CLASE 1. Solicitar al ...
987,262
d558dbaf4e20def09e7eeeae8fa522752d192bfd
import logging import tornado.ioloop import tornado.web import tornado.websocket SERVER_HOST = '127.0.0.1' SERVER_PORT = 8646 logging.basicConfig(level=logging.WARNING) class EchoWebSocket(tornado.websocket.WebSocketHandler): def on_message(self, message): self.write_message(message, binary=isinstance...
987,263
26ea434eb570d3a9ec89ba2558116a873f497617
def period(num, div): assert(div > num) idx = 0 nums = {} while num != 0: num = num % div while num < div and num != 0: num = num * 10 digit = num // div if nums.get(num) is not None: return idx - nums[num] nums[num] = idx ...
987,264
2d3fd113a5f2e91c8b10a1e0218d472bf1a05741
# Generated by Django 3.0.3 on 2020-07-21 00:54 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('users', '0004_auto_20200719_1404'), ] operations = [ migrations.AddField( ...
987,265
c25f0e08f235f4f00ac134b44fa6b50849f1e5d2
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import logging import os import jpype from future.utils import iteritems from pyathenajdbc import ( ATHENA_CONNECTION_STRING, ATHENA_DRIVER_CLASS_NAME, ATHENA_JAR, LOG4J_PROPERTIES, ) from pyathenajdbc.converter import J...
987,266
907c242c055d28432945418379fff46392a3d062
# Validate BST: Implement a function to check if a binary tree is a binary search tree. from typing import Tuple # Option 1 - do in-order traversal and copy values to array then check that array is sorted class Node: def __init__(self, val: int) -> None: self.left = None self.right = None ...
987,267
d413c43d396dd9877352570a08eab4454b999bec
nilai = [{'nim' : 'A01', 'nama' : 'Agustina', 'mid' : 50, 'uas' : 80}, {'nim' : 'A02', 'nama' : 'Budi', 'mid' : 40, 'uas' : 90}, {'nim' : 'A03', 'nama' : 'Chicha', 'mid' : 100, 'uas' : 50}, {'nim' : 'A04', 'nama' : 'Donna', 'mid' : 20, 'uas' : 100}, {'nim' : 'A05', 'nama' : 'Fatimah', 'mid' : 70, 'uas' : 100}] print("...
987,268
e68987180add0eab8abe669e0833fa63cabea811
from tkinter import * from functools import partial from Resolution.resolution_hidato import * def main_window_hidato(): root = Tk() root.title("Résolution de Hidato") root.resizable(0,0) root.geometry('150x200') button_frame=Frame(root) grid = [['','','','','','/','/','/'],['',...
987,269
58158d04182032ce4e81844993cc1cc34eb5f9da
from __future__ import division import numpy as np from pysd import functions from pysd import builder ...
987,270
2570a2cd12aea6ef848e4759441095d89ff8a5e8
import uuid from django.db import models # Create your models here. class Contract(models.Model): contract_id = models.UUIDField(primary_key=True, unique=True, default=uuid.uuid4, editable=False) client_id = models.UUIDField(editable=False) predial = models.FloatField() address = models.CharField(max...
987,271
eeac73ed8e9bfc1f6e673efab3919e4c78c95638
from __future__ import print_function, division import chronostar.component """ A script which gathers all plotting of all relevant figures into one spot to facilitate quick and simple replotting as needed. TODO: Maybe do again, but with the range buffer lowered to 0.1 (from 0.2) """ import corner import matplotlib...
987,272
a4c50e20578681884054d7be779e1ce92caf732a
#!/usr/bin/python2.4 -tt # Copyright 2008 Google Inc. All Rights Reserved. """Mimic pyquick exercise -- optional extra exercise. """ __author__ = 'nparlante@google.com (Nick Parlante)' import random import sys def A(arg1, arg2): """Returns mimic dict mapping each word to list of words which follow it.""" # +...
987,273
ccc1a7d4d895d7fe9e971ed66b1895914df8ef72
from math import * N = 8 V = 4 Z = 2 C = 1 wordSign = 1 << 11 wordMask = (1 << 12) - 1 byteSign = 1 << 7 byteMask = (1 << 8) - 1 def adder(op, a, b, cin, siz=False): if siz: sign = wordSign mask = wordMask else: sign = byteSign mask = byteMask auL = mask & a if op == ...
987,274
1a79baaf526ec0dede78ea1d4d7b105d50c3775f
#permite agrupar datos ys u comportamiento #es como seguridad por que nos prmite controlar las modificaciones #tambien es aplicada la programacion defensiva,para saver cuando y como se #mofica una calase #controla el acceso a dicho datos #previene modificaciones no autorizadas #decoradores se definesn con el simbol...
987,275
ee3aeccf4e7209f8d1da0969d38fa2a51f09fbfc
"""Evaluate models on ImageNet-A""" import os import sys import time import argparse import numpy as np from collections import OrderedDict import torch import torch.nn.functional as F import torch.utils.data import torchvision import torchvision.models import torchvision.transforms as transforms import torchvision.dat...
987,276
1dec761b5e51c20d44dc2e6d27080cc94a0a0a23
## HEADS == 1 ## TAILS == 0 import random def coin(): heads = 0 tails = 0 for x in range(1, 5001): rand = random.randint(0,1) if (rand == 0): tails += 1 print "Attempt #", x , ": Throwing a coin. . . It's a tail!.... Got ", heads, " heads and ", tails, " tails so fa...
987,277
331808d8f58c9d5329b47623788a1e08d4875831
'''attack an image classification model''' import os import argparse import random import logging import pickle as pkl from datetime import datetime from tqdm import tqdm import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms import to...
987,278
855a40fd30eff3b85a0f242608155d202abba9d7
from django.db import models from apps.gallery.models import Gallery class Section(models.Model): slug = models.CharField(max_length=100, unique=True) name = models.CharField(max_length=200, null=False) title = models.CharField(max_length=35, null=False) sub_title = models.TextField(max_length=200, nul...
987,279
7a2f856fb9cb087fd772dadaa08ce8da2acba349
# banner = list("Congratulations") # print(banner) # temperatures = [] # temperatures.append(99.6) # temperatures.append(98.4) # print(temperatures) # er_temp = [101.1, 100.8, 99.9] # print(er_temp) # total_temps = temperatures + er_temp # print(total_temps) # attendees = ["Ken", "Alena", "Treasure"] # attendees.ap...
987,280
01dc823e4501a3890df1c6a54abd8ee12f4e1bc0
import pandas as pd import numpy as np df=pd.read_csv("AAAI.csv") a=df["Topics"] b=[] for i, v in a.iteritems(): c=v.splitlines() d=set(c) b.append(d) o=0 e=np.zeros((len(b), len(b))) for x in range(150): for i in range(len(b)): for j in range(len(b)): e[i][j]=(len(b[i]...
987,281
a99019b798d5bb924f9184bf0467916ab5bf2e80
import cv2 import numpy as np from matplotlib import pyplot as plt images = ['../facedetect/images_resize/face_of_1.jpg','../facedetect/images_resize/face_of_2.jpg','../facedetect/images_resize/face_of_3.jpg'] for image in images: gray_img = cv2.imread(image, cv2.IMREAD_GRAYSCALE) cv2.imshow('1',gray_img) h...
987,282
79d580bb349669ede61ec3bdd5332dd1a89d9df8
# Generated by Django 3.1.1 on 2021-03-03 15:13 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('Post', '0025_auto_20210303_1234'), ] operations = [ migrations.AddField( model_name='post', name='citi...
987,283
ce902b5d88b54f949ed95bf1fadcbe17d8fce169
import spacy from elasticsearchapp.query_results import get_all_analyzed_data, elastic_greek_stemmer import pandas as pd import numpy as np from sklearn.preprocessing import LabelEncoder from sklearn.feature_extraction.text import TfidfVectorizer from sklearn import model_selection, naive_bayes, svm from sklearn.metric...
987,284
7467f0f21cec578f5ebc144d443199e8076dd3bd
"""Default values.""" DEFAULT_FILE = "data.csv" DEFAULT_NUM_OF_TOPICS = 3
987,285
2d7906bfd73ea52be0cb167fef239da792a1f874
# -*- coding:utf-8 -*- """ __author__ = 'lijianbin' 这个网站老变态了 """ from __future__ import unicode_literals import re import json from PIL import Image from io import BytesIO from EnterpriseCreditCrawler.common import image_recognition from EnterpriseCreditCrawler.common import url_requests from EnterpriseCredit...
987,286
bad1b8f77214b66edde61c99036b2ba971bb96eb
import re # notice the use of pipe character below bat_regex = re.compile(r'bat(man|mobile|women)') mo = bat_regex.findall("I am batman vs batwomen") print(type(mo)) for i in mo: print(i)
987,287
0442d83409b28fe8a6a3352e1ec9df222a17331b
###################################### # Time:2020/02/11 # alter: ZWQ ###################################### from flask_restplus import Api from flask import Blueprint from .views import find_task,add_task,del_task,updata_task authorizations = { 'apikey': { 'type': 'apiKey', 'in': 'header', ...
987,288
1cfb1aec0158e66ce443f68ba1667e67b698e599
# -*- coding: UTF-8 -*- ''' Task Given a positive integral number n, return a strictly increasing sequence (list/array/string depending on the language) of numbers, so that the sum of the squares is equal to n². If there are multiple solutions (and there will be), return the result with the largest possible values: ...
987,289
70b811a3323d52c40c24cf54d0692960c77a7353
# 给定一个只包含 '(' 和 ')' 的字符串,找出最长的包含有效括号的子串的长度。 # # 示例 1: # # 输入: "(()" # 输出: 2 # 解释: 最长有效括号子串为 "()" # # # 示例 2: # # 输入: ")()())" # 输出: 4 # 解释: 最长有效括号子串为 "()()" # # Related Topics 字符串 动态规划 # 👍 948 👎 0 # leetcode submit region begin(Prohibit modification and deletion) # 1. 左右括号数量相等 # 2. 任意前缀中左括号数量大于等于右括...
987,290
c18d6c124f5e0af562fccc01b13e23c9406478a8
from snippet.lazy_dict import LazyDict, lazy_property from nose import tools class Book(LazyDict): def __init__(self, book_id): super(Book, self).__init__() self.id = book_id self.__subset__ = {'review'} @lazy_property def author(self): return self._get_author() def _...
987,291
c46d64d71d4a52719af8d719961336edeff2bea3
import tensorflow as tf import DS_input as deepSpeech_input import rnn_cell from helper_routines import _variable_on_cpu from helper_routines import _variable_with_weight_decay from helper_routines import _activation_summary # Global constants describing the speech data set. NUM_CLASSES = deepSpeech_input.NUM_CLASSES ...
987,292
0ee8c0d834fe133fbb36ceece601436f24b4117f
import pygame from Settings import Settings from function import * from pygame.sprite import Group from Alien import * def run_game(): pygame.init() settings=Settings() screen=pygame.display.set_mode((settings.screenWidth,settings.screenHeight)) pygame.display.set_caption('Alien Invasion') ship=Shi...
987,293
cffdde6a558cb29c15f5b43c27ae1ff42a1b8bf1
# 39. Escrever um algoritmo que leia uma variável n e calcule # a tabuada de 1 até n. Mostre a tabuada na forma: # 1 x n = n # 2 x n = 2n # 3 x n = 3n # ............... # n x n = n2 # minha n = float(input("Digite um número, para sua tabuada: ")) contador = 0 while n * n > contador * n: contador ...
987,294
fda1bfa852936d35a3ff063e18353de011b13b91
'''클라이언트 소켓을 담당하는 서버 클래스''' class client: def __init__(self, cs, ip): self.cs = cs self.ip = ip def send_msg(self, message): self.cs.send(message.encode('utf-8'))
987,295
48fb18d2c94b1f0967e5f156975aeb53ac6b6271
# -*- coding: utf-8 -*- # Generated by Django 1.11.16 on 2019-01-08 21:32 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('lavajato_agenda', '0004_auto_20181220_1839'), ] operations = [ migrations....
987,296
ad1dd5cda6d5784284c89bba1eef0cc269e573b8
def mi(): return map(int, input().split()) def main(): N, K = mi() R, S, P = mi() T = input() pt = 0 my_choices = ['']*N for i in range(K): tmp = T[i::K] for j in range(len(tmp)): if j == 0: if tmp[j] == 'r': my_choices[i] = '...
987,297
f709aaa56f2a1514dd04b8744f18233842390ef9
# ---------------------------------------------------------- # -------- CS50 Final Project -------- # ---------------------------------------------------------- # ---------------------------------------------------------- #Name:Prince Michael Agbo #Title: Snakes and Ladders #Number of Players: 2 ...
987,298
981fec62fc686d49073c364517e78f7f8388179f
# ## Getting Perpsective Transform #Import necessary libraries import cv2 import numpy as np import matplotlib.pyplot as plt #Load/Read input image input_image2 = cv2.imread('ba.jpg') #show the original image cv2.imshow('Original', input_image2) cv2.waitKey(0) # Cordinates of the 4 corners of the original source ...
987,299
448b5460831f4a2f43094bee63894a71f04b5dae
home_page = dict( searchFieldByID="search_query_top", searchButtonByName="submit_search", cartButtonCSSSelector="a b", dressesButtonByXpath="(//a[@class='sf-with-ul'])[4]", dressesButtonActivateByXpath="(//ul[@class='submenu-container clearfix first-in-line-xs'])[2]", dressesButtonCassualDresses...