index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
997,900
98b5b340249219200457eb0d55f1c6d67775f5b1
#! /usr/bin/env python from tensorflow.contrib import learn import tensorflow as tf import numpy as np def tokenizer(iterator): """Tokenizer generator. Args: iterator: Input iterator with strings. Yields: array of tokens per each value in the input. """ for value in iterator: yield value def ...
997,901
02ff5bb01e006b5a0e9993ec7c2a8faf138ca06a
import random import names from itertools import cycle, islice, chain import time initial_decks = 3 initial_players = 4 initial_hand = 7 game_suits = ["Spades", "Hearts", "Clubs", "Diamonds"] special_values = { "A": 15, "2": 20, "8": 30, "J": 10, "Q": 10, "K": 10, "Joker": 50 } class Card: def __init__(self,...
997,902
06791723f14d09a0b40ca6789b419e6a19669e82
# Given an array nums of n integers where n > 1, return an array output such that # output[i] is equal to the product of all the elements of nums except nums[i]. # # Example: # # Input: [1,2,3,4] # Output: [24,12,8,6] # Constraint: It's guaranteed that the product of the elements of # any prefix or suffix of the arra...
997,903
927edb138e5a55ba0f1bf8a3386aceb77c6d9153
class ContextSplitterStatus: NotStarted = 1 Started = 2 Ended = 3 class ContextSplitter: def __init__(self, context): self.status = ContextSplitterStatus.NotStarted self.context = context def start(self): self.status = ContextSplitterStatus.Started return self.con...
997,904
e31d9ed50c35902d66be2cb39f91803ea9454963
# -*- coding: utf-8 -*- """ The Epilepsy Ecosystem's data has dropout; intervals in which the sensors failed to pick up signals. They are identified by all sensors reading 0 (which was numerically mapped to 0.034). This script extracts uninterrupted segments which we can draw images from safely @author: Bananin """ im...
997,905
fccb6c7b9a9d4211d4e69aa1ebecbdc63e3fa5db
from django.urls import path from .import views app_name = "lists" urlpatterns = [ path('', views.lists, name='lists'), path('create/', views.list_create, name='create'), path('<slug:slug>/', views.list_detail, name='list_detail'), ]
997,906
3f59271ddf5bb5ca7210debe63aae261a7f4c199
""" You've built an inflight entertainment system with on-demand movie streaming. Users on longer flights like to start a second movie right when their first one ends, but they complain that the plane usually lands before they can see the ending. So you're building a feature for choosing two movies whose total runtime...
997,907
2f1a830e83c80bcb5e57a46890aa07638305f91d
""" class Phone: def __init__(self, height, display, camera, version): self.height = height self.display = display self.camera = camera self.version = version oppo = Phone(6, 5.7, 13, 7) vivo = Phone(5.5, 5.8, 20, 8) print(f"This is vivo display =>",vivo.display) ...
997,908
d6232c22f119b8c6edfcc7747f13c5999944a8cb
import datetime import random import uuid from locust import HttpUser, task, between from locust.contrib.fasthttp import FastHttpUser class RealityTubeUser(FastHttpUser): wait_time = lambda *args, **kwargs: 0 userId = None email = '' headers = None host = 'https://reality-tube.net/' def _inde...
997,909
71eb2555faf009114c984c2cfc92bb407170fb42
"""Fixtures for testing mip app""" import string from typing import List import pytest from cg.apps.mip import MipAPI @pytest.fixture def valid_fastq_filename_pattern(): """the pattern MIP file names should match""" # 'xxx_R_1.fastq.gz and xxx_R_2.fastq.gz' return r"^.+_R_[1-2]{1}\.fastq.gz$" def _ful...
997,910
1592f15714eafd518c2944b7b32abc795c47aadb
import re import enchant dictio = enchant.Dict("en_US") def get_binary(mystring): out = [] foo = len(mystring) num = "" for i in range(0,foo): num += "0" out.append(num) while "0" in num: num = bin(int(num,2) + 1)[2:] while len(num) < foo: num...
997,911
835b67ffb0534a463b18ffcc01affb6434903cd8
#takes a list of words and returns numbers corresponding to the words' lengths def idk(lst): numbers = [] for x in lst: f = len(x) numbers.append(f) return numbers i = ["hi", "westside", "just", "later", "opposite"] print(idk(i))
997,912
599e9f50e2805cb123265cd1caadc27117096252
APP_ENV = 'local' DEBUG = True SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/food' SQLALCHEMY_TRACK_MODIFICATIONS = False APP_NAME = 'NUTRITION_CHECK' APP_SECRET = 'fghjkl23456fcgvhbjnkmlrtyuio456723456'
997,913
c2a7661f5a1888930192a1ceb916ba01cfb6a29f
from swampy.TurtleWorld import * from polygon import * def flower(turtle, petals, radius, angle): for i in range(petals): petal(t, radius, angle) lt(t, 360.0/petals) def petal(turtle, radius, angle): for i in range(2): arc(turtle, radius, angle) lt(turtle, 180-angle) world =...
997,914
5451b0059d7cfb6ce31e017b3be2947cf083513d
# streamlit app demo # from collections import namedtuple import streamlit as st import pandas as pd import numpy as np import tensorflow as tf from googletrans import Translator st.title("IChiba Category Wizard") DATA_URL = "data/ichiba_test_strict_100316_more.tsv.gz" LABEL_CSV = "data/labels.csv" Lab_name = namedtu...
997,915
1ef29d08abef2ecf246cd6bfbbab0077f4a55e08
import math def func(n, arr): delta = 0 for i in range(len(arr)): for j in range(len(arr)): if i == j: continue sum_before = arr[i] + arr[j] d2 = (arr[i] + arr[j]) * (arr[i] + arr[j]) - 4 * arr[i] * arr[j] # print(f"d2 = {d2}") ...
997,916
16061d2153892f72e010cc99ed5c30f464ddbb59
import random import string import time def random_string_generator(size=10, chars=string.ascii_lowercase + string.digits): return ''.join(random.choice(chars) for _ in range(size)) current_time_milli = lambda : int(round(time.time() * 1000))
997,917
b6c94c34952b4d3595d5de032a3d58b0aa3f3afd
import pandas as pd import numpy as np import matplotlib.pyplot as plt import operator df = pd.read_csv('http://web.mta.info/developers/data/nyct/turnstile/turnstile_180630.txt') df.columns = df.columns.str.strip() df['real_entries'] = df['ENTRIES'].diff() df['real_exits'] = df['EXITS'].diff() df.loc[df['real_entri...
997,918
75d421d04b665eb92406d486d214c25bd76d4834
import re import numpy as np import gensim import requests import json from scipy import spatial data = [] with open('./avas_list.txt') as inputfile: for line in inputfile: data.append(line) print("Loaded function data") model = gensim.models.KeyedVectors.load_word2vec_format('./GoogleNews-vectors-negati...
997,919
a4fd04facdc2e0bef0d84215724b4f393d919b03
import copy import torch import pytest from transformers import AutoModel from allennlp.common import Params from allennlp.modules.transformer.attention_module import T5Attention from transformers.models.t5.configuration_t5 import T5Config from transformers.models.t5.modeling_t5 import T5Attention as HFT5Attention ...
997,920
5cbb3bf73b4f83885b6c5e22369680c7e5eaa815
import hdf_pull import netCDF_build as netcdf from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import csv files = hdf_pull.file_path("\Aqua") #print files """plotting frp with frp intensity colour for single hdf file""" def plot_fire(FP_da...
997,921
e68fccf24607b81344e350c18565fe43e4f364fe
## Randy: This run took about 4 hours, as it is set up now. """ Module to set up run time parameters for Clawpack. The values set in the function setrun are then written out to data files that will be read in by the Fortran code. """ import os from pyclaw import data import numpy as np #--------------------------...
997,922
f465bcc50bd3cb5bfc28b1d3466c52f4a13d7761
#!/usr/bin/python # -*- coding: UTF-8 -*- import ConfigParser import os import datetime import random def gen_dates(base_date, days): """ Generate days list :param base_date: start date :param days: how many days to generate the list :return: days list """ day = datetime.timedelta(days = 1...
997,923
b6984e396ee93d1afb8dceb9c2e7397ca1217c76
################## ### original author: Parashar Dhapola ### modified by Rintu Kutum ################## import numpy as np import sys import os import matplotlib.pyplot as plt import matplotlib as mpl from scipy import ndimage import math ######################### chrom_indices = {} chrom_lens = [] bin_size = 1000 with...
997,924
e6e73ef7f06588ab788a0e17deb9676564519012
#!/usr/bin/env python3 import argparse, sys, numpy, os import matplotlib.pyplot import datetimelib import photometrylib import generallib import astropy import subprocess if __name__ == "__main__": parser = argparse.ArgumentParser(description='Loads a FITS file bins it.') parser.add_argument('inputfile', type=str, n...
997,925
5703b52b97e054c50e5561188bf815367434807b
from curtain import Curtain, frame_length import sys from plugin import Plugin import time, os, math import midi plugins = [] for filename in os.listdir('plugins'): name, extension = os.path.splitext(filename) if extension == '.py' and name != '__init__': module = __import__('plugins.' + name).__dict_...
997,926
8a2fec0cf510431b7b6a4cb7f9916452ec64ecbc
import Tkinter import tkMessageBox import gridbutton top = Tkinter.Tk() top.withdraw() class Run(): def _init_(self,fona): self.fona = fona self.screen_lock = False def make_call(self): if Entry.get() > (1+1+1+1+1+1+1+1+1+1): self.valid_call=True if self.valid_c...
997,927
db9b5e89312b3b3ac8875c431046aea5d947c424
import sys """ This function take the sequence input and output the complementary sequence in 5' to 3' fashion. output[complementary] = wcc[input_sequence] Example: wcc('TAGCTACTCAGACGACCAGTAGATAAAAG') will give "CTTTTATCTACTGGTCGTCTGAGTAGCTA" """ def comp(base): if base == 'A': baseC = 'T' if base == 'G': ...
997,928
b292ff349c00b8de5db9e8a4fa485669ff32c750
from bs4 import BeautifulSoup import requests import re from django.db import models class ScrapeLinkdin(models.Model): location = None fieldToSearch = None url = None jobPosting = [] def __init__(self,searchTerm): # This is just a variable I set to test it, however the website should hav...
997,929
e754829a029427a0e65ab21e55f6dc8bce76b282
import numpy as np import matplotlib.pyplot as plt from fkpp_vect1D import main_FD_Solver N = 1000 # resolution L = 1000 # box size units (m) dt = .001 # time step size gamma = 1.0 # growth rate tend = 1000 # tending time in (s) t_trans = 50 saves = False verbose = False save_freq = 1000 D_arr = np.linspace(0.01...
997,930
44c3a86c579a0637cdceb16537d535b7971b609a
import math def solution(progresses, speeds): answer = [] N = len(progresses) now_day = -1 cnt = 1 for i in range(N): progress = progresses[i] speed = speeds[i] DONE = 100 remain = math.ceil((DONE - progress) / speed) if now_day == -1: now_d...
997,931
0ffb656967a1c903ca2289973f35cc0245a09368
def main(): import csv from itertools import islice reptotal=0 demtotal=0 demlist=(1961,1962,1963,1964,1965,1966,1967,1968,1977,1978,1979,1980,1993,1994,1995,1996,1997,1998,1999,2000,2009,2010,2011,2012,2013) replist=(1969,1970,1971,1972,1973,1974,1975,1976,1981,1982,1983,1984,198...
997,932
9b8328094fd054eb4f989e976d7a70d1e02d05a8
import random from bottle import Bottle, template, static_file, request, redirect, HTTPError import model import session app = Bottle() # get the css file and apply to all the html @app.route('/static/<filename:path>') def static(filename): return static_file(filename=filename, root='static') # this is for ind...
997,933
a4b2f0dd236722c61b37dde913d05573e6d635d4
import pandas as pd import numpy as np import math import copy import QSTK.qstkutil.qsdateutil as du import datetime as dt import QSTK.qstkutil.DataAccess as da import QSTK.qstkutil.tsutil as tsu import QSTK.qstkstudy.EventProfiler as ep import sys import csv def bollinger_value(price_array, ldt_timestamps, bollinge...
997,934
36719a627701d3baeedf29460088f2835acdeecc
# Generated by Django 3.1 on 2021-08-12 06:32 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('dataapp', '0013_auto_20210812_0848'), ] operations = [ migrations.AlterField( model_name='delivery', name='year', ...
997,935
fb93cb9321c4536ab8d2cfa5a6b0f044247c4d6e
from difflib import * class Op(object): def __init__(self, delete=False, insert=[]): self.delete=delete self.insert=insert def rep(self): return (self.delete, tuple(self.insert)) def __repr__(self): return "Op({0})".format({'delete':self.delete, ...
997,936
77e1de7e2eb393dfcb6bd14c708faab6c9086ef2
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 VMware Inc. # 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/lice...
997,937
504e061bcd80fcbd66d098f8966587c4d957dc51
import re, string import sys, math, operator from collections import defaultdict from decimal import Decimal import numpy as np import mixem import matplotlib.pyplot as plt import itertools alphabet = "qwertyuiopasdfghjklzxcvbnm0. #" all_trigram = [''.join(i) for i in itertools.product(alphabet, repeat = 3)] #Remove ...
997,938
058e8c63290a4c4d029971b03c36422030b9ec32
from django.contrib.auth.backends import ModelBackend from .models import CashierProfile from django.contrib.auth.models import User class PasswordlessAuthBackend(ModelBackend): """Log in to Django without providing a password, just a cashier code/login number """ def authenticate(self, request, rest_id, ...
997,939
b4407e499f9583f1e0a5dd118d465fe18fe7e38a
import os import torch import numpy as np from scipy.spatial import distance_matrix dataset = 'diab' model_info = 'lstm+tanh' dirname = '../outputs/' + dataset + '/' + model_info dirs = [d for d in os.listdir(dirname) if 'enc.th' in os.listdir(os.path.join(dirname, d))] # print(dirs) distance_matrices = [] ...
997,940
05943fdff745512181fdcf90ac271b5d56a6697a
# -*- coding: utf-8 -*- """ Created on Fri Jul 19 10:50:22 2019 @author: Manuel """ def calcular_mochila(peso_maximo, *monton): numobj=0 numobjquedarse=0 valpess=[] mochila=[] quedarse=[] descartes=[] dejar=[] for objeto in monton: valpes=objeto["valor"]/objeto[...
997,941
cf5975dd2e67a00515c1256c2bf277ae67fd8802
import logging from dataclasses import dataclass, field, asdict from datetime import datetime from typing import Callable, Optional, Dict, Tuple, Any, Type, List, Union import yaml import torch import torch.nn as nn import torchvision from action_recognition import models # Initiate Logger logger = logging.getLogg...
997,942
691ceb833dd3f0d6591a9773820d261052276553
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', }, } SECRET_KEY = 'ishalltellyouonlyonce' INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messa...
997,943
25f13848f9f55c6114521dcca043d43e2fe233f7
from datetime import datetime from flask import render_template, redirect, url_for, flash, abort, request, jsonify from flask_login import logout_user, login_required, login_user from autoP.models import User, load_user, query_results from forms import LoginForm, RegistrationForm, SearchForm from . import app @app.r...
997,944
18d25718ec8d10097b4c9d0a54a03b783d240270
# set up relays from gpiozero import OutputDevice import time import sys # devices specified by GPIO number # gpiozero.OutputDevice(pin, *, active_high=True, initial_value=False, pin_factory=None) air_pump = OutputDevice(18, False) nutrient_pump = OutputDevice(23, False) solenoid = OutputDevice(24, False) l_board = Ou...
997,945
a6bbf5eb88d39c1519d258ce16f0af99236f162f
from django.db.models.signals import post_save from djblets.extensions.hooks import SignalHook from djblets.integrations.integration import Integration from djblets.integrations.manager import IntegrationManager from djblets.integrations.tests.models import IntegrationConfig from djblets.integrations.tests.testcases i...
997,946
e2bd5a633e4a63b23968441999cf1599f754a3e0
from chunk import make_all_sentences_chunks_list import pydot_ng as pydot F_NAME = "neko.txt.cabocha" """ びにおもちろいわと 名詞,一般,*,*,*,*,* 云う 動詞,自立,*,*,五段・ワ行促音便,基本形,云う,イウ,イウ のようなものもちゃんと管理する """ def _45(): contents = make_all_sentences_chunks_list(F_NAME) verb_case_patterns = [] for sente...
997,947
eb536f14768417698ae24195bbf1684852dc7299
special.gdtr(a,b,x)
997,948
55497f19f059c7a12b13501ceb1afe5b05f08df0
# Isabella Gomez A15305555 # ECE143 HW5 # imports: import re def get_average_word_length(words): ''' This function takes in a list of words and computes the average length of the words in the list. :param words: list of words :return: average length of the words in the list ''' # check t...
997,949
502fe5eebd8e47ddc93500420a165e1117782882
#!/usr/bin/python3 class MyInt(int): def __eq__(self, val2): return self - val2 is not 0 def __ne__(self, val2): return self - val2 is 0
997,950
3ed6dc7fc0b4136e4f1aa5f8d999f11b8c85d00c
import json import traceback from db_utils import DB from kafka import KafkaConsumer, TopicPartition from random import randint from time import time, sleep from field_validations import apply_field_validations from chained_rules import run_chained_rules from producer import produce from business_rules_api import ap...
997,951
6103bfe71f3902e7aecf01904c4a375a20713a47
#syntax: num = 20 if num < 10: print("less than") elif num > 10: print("greater than") else: print("equal to") #None returns false #empty objects (string, etc) return false #Any non-empty object returns true string = "" if string: print("string is non-empty") else: print("string i...
997,952
c249104133c1defa2d08e44347762ed8d011890f
import time,threading """ 多线程 """ def loop(): thread_name = threading.current_thread().name print('Thread %s is running...' % thread_name) n = 0 while n < 5: n += 1 print('Thread %s >>> %d' % (thread_name, n)) print('Thread %s ends.' % thread_name) thread_name = threading.current_t...
997,953
48adabe462019ee5c264a8450be820aa147ca697
# -*- coding: utf-8 -*- import time import pika def callback(channel, method, properties, body): print("****** received: %r" % body) time.sleep(body.count(b'.')) connection = pika.BlockingConnection(pika.ConnectionParameters(host="localhost")) channel = connection.channel() channel.queue_declare(queue="hel...
997,954
f5e9503aa86286a887c1d0b137b9f05edbbce624
import player # required to make imports work properly import sys sys.path.append("../") from game import ChessGame def main(): play_game() def play_game(): p1 = player.RandomComputer() p2 = player.BasicMinimax() game = ChessGame(p1, p2) game.play() if __name__ == "__main__": main()
997,955
319a8a297bfcaf203c0b15af46a4d3376db93f4f
import pygame import constants import objects class Level(): entities = None enemy_list = None camerafocus = "" background = None def __init__(self, player, game): self.game = game game.entities = pygame.sprite.Group() game.enemygroup = pygame.sprite.Group(...
997,956
211b30794b165ac5728a5dbae3d1ef6838e82511
# Generated from visualg.g4 by ANTLR 4.8 from antlr4 import * from io import StringIO from typing.io import TextIO import sys def serializedATN(): with StringIO() as buf: buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2?") buf.write("\u0249\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t...
997,957
04a744b251db17927d1fe8bbf0f3a06d3f72d046
def pytest_configure(config): config.addinivalue_line( "markers", "profile_databricks_cluster" ) config.addinivalue_line( "markers", "profile_databricks_sql_endpoint" ) config.addinivalue_line( "markers", "profile_apache_spark" )
997,958
eec04b5a5ab371d5a12797031fb9bc4f37cf11b9
''' Created on Aug 3, 2016 @author: YLin2 ''' import sys import os from xml.dom import minidom def fix_class(class_node): valid_lines = 0 covered_lines = 0 for lines_node in class_node.getElementsByTagName('lines'): for line in lines_node.getElementsByTagName('line'): if not line.hasA...
997,959
899d859db131b32ea251b6a03cf7743f57e721f1
# -*- coding: utf-8 -*- # ridgeRegression.py import numpy as np import matplotlib.pyplot as plt def rssError(yArr, yHatArr): """ 函数说明:求平方误差 """ return ((yArr-yHatArr)**2).sum() def loadDataSet(fileName): ''' 函数说明:数据导入函数 参数:fileName: 数据存放的路径 返回:dataMat: 数据特征集 labelMat: 数据标签...
997,960
0d52a5764b5f9bb3a04a48414f00c1ebc9c8fc5f
import pygame as pg import numpy as np import sys from SoundManager import SoundManager from MainMenuUI import MainMenuUI from SettingsUI import SettingsUI from GameUI import GameUI from GameController import GameController def main(): WIDTH = 1186 HEIGHT = 964 sm = SoundManager("sounds/") pg.init() ...
997,961
cc5aa39b0f2c6d2da5e25b08f812ce9d46ae34bd
import RPi.GPIO as GPIO import threading interval = 0.01 class Key: def __init__(self, eventCallback, shutdown): GPIO.setmode(GPIO.BCM) GPIO.setup(4,GPIO.IN,pull_up_down=GPIO.PUD_UP) self.timerStart(interval=interval) self.eventCallback = eventCallback self.shutdown = shutdown self.pressed = ...
997,962
cc476955321c42bc083811469fc42858ac5cdda9
# coding=utf-8 # Copyright 2022 Meta Platforms authors and The HuggingFace Team. 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/LI...
997,963
c237f3aa5fe6051647480a1a4d5af2a8bc8801e5
from django.urls import path,re_path from .views import * urlpatterns = [ re_path('^register/',register_views), re_path('^logout/',logout_views), re_path('^login/',login_views), ]
997,964
5d36f91fa11951340e82e4f2d063bb1d6e703526
#This program looks at the string Repetition Operator (*) str1="Hello " print(str1*300)
997,965
7623b5dd5577bde6522289a45b857b13717c87cf
from numpy import * from collections import Counter import torch import pickle device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') def build_vocab(texts, n=None): counter = Counter(''.join(texts)) # char level char2index = {w: i for i, (w, c) in enumerate(counter.most_common(n), start=4)} ...
997,966
c47f5485b92ce610ed5321025dae35b2074b6a8d
from clarifai.rest import ClarifaiApp import json # name, grade, 3 bullet points, source dictionary = {'Pepsi': {0: 'D', 1: 'PepsiCo has managed to decrease its total climate footprint from 2014 to 2017.' 'PepsiCo scores poorly because the brand remains secretive in i...
997,967
01bb8d5af7d73c86604f15b33ec6f9e0eb692ce0
#!/bin/python3 import unittest2 as unittest from jumping_on_the_clouds import jumpingOnClouds """ https://www.hackerrank.com/challenges/jumping-on-the-clouds/problem Jump 1 or 2 steps on the cloud ( marked by 0). The thunder clouds (marked by 1) have to be avoided. """ class Test_jumping_on_clouds(unittest.TestCa...
997,968
46e20fc640690c09ff6fb889ce1d43eb0bda0417
from pathlib import Path, PurePosixPath import fnmatch import hashlib from cw.directory_walk import directory_walk from io import StringIO import os import re from typing import Union class DirectoryChecksum: """ Class used to generate a file containing the sha256 hashes of all files in a directory and i...
997,969
fd1d33b3febc12d1a74421bd522b5d81483ccfa7
from xlutils.copy import copy import xlrd import xlwt import time class Excel_dx(): def du (self,h,l): #path = 'F:/untitled/我的坚果云/git/zentao/comm/case.xls' path = './comm/case.xls' workbook = xlrd.open_workbook(path) data_sheet = workbook.sheets()[0] ss =data_sheet.cell_val...
997,970
9a53f7d6601c42b0fe4216c202d5e0abeeefd993
""" Import the datas from the json dataset file and return the big array that contains it """ import simplejson as json datasetPath = '../../find\ relationships/dataset/yelp_academic_dataset_business.json' heatMapData= open("heatMapData.html", "w") with open(datasetPath) as fin: for business in fin: line_...
997,971
d7557c330cf64c830e270314d5d0c21d02da9881
import tensorflow as tf from tensorflow.contrib import learn from tensorflow.contrib.learn.python.learn.estimators import model_fn as model_fn_lib class SampleArchitecture2(object): height = 32 width = 32 channels = 3 learning_rate = 0.002 @classmethod def get_model(cls, features, labels, mode...
997,972
cf4ab6bf374ca62c3356a4efff69683d890c7f62
class Employ: def __init__(self, empno, name, sal): self.empno = empno self.name = name self.sal = sal def __str__(self): return "Empno %d, Name %s, Salary %d " %(self.empno, self.name, self.sal) emp = Employ(1, "Satish", 88555) print(emp)
997,973
142a0b26fcc0a5a799f6b488c430c6f340060d0c
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def leftLeavesSumRec(root, isLeft, summ): if root is None: return #Check whether this node is a leaf node and is left if root.left is None and root.right is None and isLeft == True...
997,974
0576bb7bba6319c9ce6a1e5f8c8e83802a52e694
""" http ~~~~ A module to handle making HTTP requests. """ import requests # Exceptions. class AuthenticationError(RuntimeError): """The request received a 401 error from the server.""" class NotFoundError(RuntimeError): """The request received a 404 error from the server.""" class ServerError(RuntimeError...
997,975
9e5c5809380697d4fb91d89c4875185934319a7b
#Create Cluster import sys import os sys.path.append(os.path.abspath(__file__ + '/../../')) from Utils.utils import Utils import pprint class CreateCluster: def __init__(self): print('Create Clusterr') self.utils = Utils(sys.argv) self.hostname = sys.argv[1] def create_cluster(self): ...
997,976
d7547c21b0af5cb982c0ee22922d8872cede91af
# Generated by Django 3.1.7 on 2021-06-28 16:01 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('vdapp', '0001_initial'), ] operations = [ migrations.AlterField( model_name='index', name='thumbnail', f...
997,977
5f48880739e6f88724874f34104a445f72aca9bc
## Create acceptance uncertainties for the ggH QCD uncertainties (i.e. the so called 9NP scheme) ## by renormalizing the default inputs by total-xsection variation: ## ## acc_variation = variation.Scale( sum_of_weights_nominal / sum_of_weights_variation ) ## ## where sum_of_weights_nominal and sum_of_weights_variatio...
997,978
f72c29d04287f930ac9c5163771c7d2ff9cbf9b7
import sys import os import shutil import re def delete_files(directory, file_type): regex = "[.]" + file_type for dir_name, folders, dir_files in os.walk(directory): for files in dir_files: if re.search(regex, files): print("directory: ", dir_name) print("...
997,979
8b8242e8c578d62c4cef8dc410f721064c4d9224
import ROOT from ROOT import TGraph,TColor from array import array import CMS_lumi from operator import itemgetter ROOT.gROOT.SetBatch() hexcolor=["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"] intcolor=[TColor.GetColor(i) for i in hexcolor] x_13,y_th_13,y...
997,980
65859cb79891dc1caf4dd0ac428569c4d94300d1
"""Tool used to generate a signal according to the model chosen. Also extracts measurements and parameters for the DCS-AMP framework to run with. """ from typing import List, Tuple import numpy class SignalGen: def __init__(self, **params): """Initialize a set of signal parameters for later generation."...
997,981
dc009dee1a4284bf16e96572971bda5157446677
# This is an auto-generated Django model module. # You'll have to do the following manually to clean this up: # * Rearrange models' order # * Make sure each model has one field with primary_key=True # * Remove `managed = False` lines for those models you wish to give write DB access # Feel free to rename the mode...
997,982
a9fb5c229e72d086f976c014a516d4de1f15d3a0
from urllib.request import quote from django.conf import settings from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.core.urlresolvers import reverse from django.db import models from django.db.models.signals import p...
997,983
7b1e2894c30e9bc9b7d74af96b404a563eb00989
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ui_sublayersdialog.ui' # # Created by: PyQt5 UI code generator 5.9.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_SublayersDialog(object): def setupUi(self, SublayersDialo...
997,984
aa62987f1ef2b3e511fc5e64673eb9d63017183e
import numpy as np from config_loader import config class Block: def __init__(self, spawn_point): self.FIELDWIDTH = config['FIELD-WIDTH'] self.FIELDHEIGHT = config['FIELD-HEIGHT'] p_shapes = self._possible_shapes() self.shape_id = np.random.randint(0, len(p_shapes)) self.sh...
997,985
4978e75295e4f0f545b6565ca73863ef80d259fe
#!/usr/bin/env python import re import sys import time import requests import logging import hookio.keys from six.moves.html_parser import HTMLParser from six.moves.html_entities import name2codepoint from six import unichr log = logging.getLogger(__name__) max_retries = 3 class RolesParser(HTMLParser): roles = ...
997,986
1eabe6a9b2439b90e81235744a5f50faf8d51be0
import functools import logging import os import pandas as pd import time from dotenv import load_dotenv from luigi import Target from pathlib import Path from pymongo import MongoClient, ASCENDING, DESCENDING from utils.constants import ENV_PATH, TRENDS_DIR load_dotenv(dotenv_path=ENV_PATH) MONGO_SERVER = os.envir...
997,987
0af39d5277243cb274a959f2ccd3fec7ae374600
from nose.tools import assert_equal from pbfalcon import gen_config import pprint def test_get_falcon_overrides(): text = 'three=four; one = two;' overrides = gen_config.get_falcon_overrides(text, 'foo') got = pprint.pformat(overrides) expected = "{'one': 'two', 'three': 'four'}" assert_equal(expec...
997,988
39b5a9b3786d9e263dccb10622850ad6165b398f
import os import argparse import utils.drive_utils as drive_utils def main(params) -> None: service = drive_utils.build_service("ro") if params.init: return if params.all: drive_utils.download_all(service, params.out_dir, verbose=not params.silent) return print(str(...
997,989
bce41a3d9031305c227db03b0a6be07943b9fa3e
#!/usr/bin/python import os print ("Hello Fuck") os.system('ipconfig')
997,990
5732c007daae78bb0b6e3103345ccd3c60331372
from flask import Flask, render_template, json, request, redirect from flaskext.mysql import MySQL from werkzeug import generate_password_hash, check_password_hash from flask import session app = Flask(__name__) mysql = MySQL() #MySql configurations app.config['MYSQL_DATABASE_USER']='root' app.config['MYSQL_DATABASE_P...
997,991
bb5c574e9480773b787bbbd7a75416fa6cc1ba24
import numpy as np np.random.seed(2020) from multiprocessing import Pool from tqdm import tqdm import time from controller.Controller import * from settings import * from controller.ES_trainer import ES_abstract from scipy import stats class NES_trainer(ES_abstract): def __init__(self, loss_function, pop_size, le...
997,992
b9ca62d26862f952dcf88d5b507485dad74434cc
import tensorflow as tf import pickle import numpy as np import datetime from Match_LSTM import MatchLSTM from Rnet import Rnet import json import os import DataUtils from nltk.tokenize import word_tokenize from tqdm import * from sklearn.metrics import accuracy_score import random tf.flags.DEFINE_string("mode", "pr...
997,993
afb3d765608ea9cc654f6f0bfd516c01c0a4c2c5
#json模拟数据库 #在文本文件中保存json字符,通过文件读写来操作数据 import json #创建文本文件(数据库文件) # with open(r"user.txt","w") as f: # users='[{"uname":"zhangsan","upwd":"123"},{"uname":"lisi","upwd":"123"},{"uname":"wangwu","upwd":"123"}]' # f.write(users) #读数据(查询) def readData(): with open(r"user.txt","r") as f: jsonData=f.read() usersList=...
997,994
a01cbbbb7c1c0df31fb7abfe04731fa0debbc234
from math import sqrt, atan import numpy as np import matplotlib.pyplot as plt def mans_atan (x): count = 0 a = 1. sum = a while count < 500: count+=1 k = 1.*((2*count-1)**2)/(2*count*(2*count+1))*(x**2)/(1+(x**2)) a = a * k ...
997,995
20711aee91f0832fdd080b9faa4f9c41f616fc52
''' Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz” and for the multiples of both 5 and 3 print 'FizzBuzz' ''' # My Solution: for i in range(1,101): if i % 5 == 0 and i % 3 == 0: print('Fizzbuzz') elif...
997,996
7739a3cb19d1cf3fb597b7d763e3905c04ee5d10
import numpy as np from sklearn import datasets import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from 机器学习.逻辑回归.LogisticRegression import LogisticRegression iris = datasets.load_iris() x = iris.data y = iris.target x = x[y < 2, :2] y = y[y < 2] x_train, x_test, y_train, y_test = trai...
997,997
f02553385cce3676ff5c63051a76f91acb6ab05f
from collections import Counter from typing import List class Solution: def isNStraightHand(self, hand: List[int], groupSize: int) -> bool: hand.sort() s = Counter(hand) for v in hand: if s[v] > 0: ck = 0 while ck < groupSize and s[v + ck] > 0: ...
997,998
ca7c59c44c1e44fb614eb60d6a7ac243430ab7b8
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting model 'Object' db.delete_table('core_object') # Adding model 'Miracle' db.create...
997,999
83a9ff3168c7f5bb2c20122a9027dd3cb161dc34
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup, find_packages setup( name='selectel_cloud_api', version='1.2', packages=find_packages(), install_requires='selectel_cloud_api', url='https://github.com/RustoriaRu/SelectelCloudApi', license='MIT', author='vir-mir', ...