index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
986,300
9cd75d5f61d86ff86d69a30adac273d5dbedbae2
import networkx as nx from pylab import * from statistics import mean from itertools import groupby from tqdm import tqdm from os.path import join G = #networkX graph pos = nx.spring_layout(G) def initialize(): global G, nextG, pos, stepaverageopinion for node in G.nodes(): G.nodes[node...
986,301
ef4f10319a39ea6d51686799ef7645415b846906
# -*- coding: utf-8 -*- from mock import patch, MagicMock from django.test import TestCase from sender.factories import SmsAPIGateFactory from sender.sms_handlers import SmsHandler class SmsHandlerTestCase(TestCase): def setUp(self): self.gate = SmsAPIGateFactory() self.data = { 'te...
986,302
2b5c57a76dca1a46adeea6b41230a5edb96d39e1
""" 约翰·沃森(John Watson)多年来一直在为福尔摩斯(Sherlock Holmes)工作,他从未理解如何能够如此轻易地猜出谁是杀手。 然而,在某个特定的夜晚,Sherlock醉得太厉害了,他告诉约翰这个秘密是什么。 “基本亲爱的沃森”,福尔摩斯说。“它绝不是最可疑的,但却是第二个最可疑的”。在他得到这个秘密之后,约翰决定自己解决一个案件, 只是为了测试Sherlock说的是否正确。 给出一个包含N个整数的列表,表示每个人的怀疑程度,帮助John Watson决定谁是杀手 Input 将有几个测试用例。每个测试用例有一个整数开始 N (2 ≤ N ≤ 1000),表示嫌疑人的数目。 下面会有N个不同的整数,其中第 i ...
986,303
d508554581bed52a056604afcce9dd9a0fe2d131
# credit: Olha Babich, Data Scientist at WiserBrand # changelog by Valentyna Fihurska # # added option to use requests library for # function _get_text_list i.e. user can choose # whether to use webdriver or requests from difflib import SequenceMatcher from bs4 import BeautifulSoup from selenium import webdriver imp...
986,304
f6a6dcc9cb50a5bac406ac629732a66d4f92fceb
# -*- coding: utf-8 -*- # ============================================================================= # module : pulses/base_sequences.py # author : Matthieu Dartiailh # license : MIT license # ============================================================================= from atom.api import (Int, Instance, Str, Dict...
986,305
d515f953200f41fc303cf76b266e6d26eff8e7b4
from django.conf.urls import include, url from django.views.generic import TemplateView from misago.conf import settings from misago.core.views import forum_index app_name = 'misago' # Register Misago Apps urlpatterns = [ url(r'^', include('misago.legal.urls')), url(r'^', include('misago.users.urls')), ...
986,306
6674527269b68e274c5bc4a15125ecd198309983
## w^3.py # Next, we review our notation for ω^3. TEMPLATE=''' TEMPLATE=""" X=\'''___\''' while True: output(X) X='output(\\\"""' + escape(X) + '\\\""")' """ X=\'''***\''' while True: output(X) X = TEMPLATE.replace('___', escape(X)) ''' X="" while True: output(X) X = TEMPLATE.replace('***', esca...
986,307
beefaf63099eb538b8fc8755a83e9456812d8c16
def bar_fn(): print " executing bar_fn()"
986,308
72ebcf0565a9470b62eeeb72f18223164fa95ee8
#!/usr/bin/env python3 import os.path as path from datetime import datetime import tensorflow as tf from tensorflow.keras.applications.vgg16 import VGG16 from tensorflow.keras.callbacks import * from tensorflow.keras.datasets import cifar100 from tensorflow.keras.layers import * from tensorflow.keras.models import Mo...
986,309
4680a2c237f74d8c1f3b0fde8431e7c883882280
#!/usr/bin/python3 import sys def decibinary(x): if x == 1 or x == 2: return x - 1 total = 2 value = 4 while total < x: total += value value += 4 value = int((value-4) / 2) if x >= total-(value/2): total -= value*2 value += 1 q = int(inp...
986,310
3e7762768c90f3dc1f5c8202ebd39ff1b8edb32d
""" Project: python_class Author:柠檬班-Tricy Time:2021/8/24 21:23 Company:湖南零檬信息技术有限公司 Site: http://www.lemonban.com Forum: http://testingpai.com """ import time def login(driver,name,passwd): driver.get("http://erp.lemfix.com/login.html") username = driver.find_element_by_id("username").send_keys(name) driv...
986,311
e80c7ed5793b013276a4541c2af9ee5493c091cd
from abc import ABCMeta, abstractmethod def main(): book_shelf = BookShelf(4) book_shelf.append_book(Book(name='A')) book_shelf.append_book(Book(name='B')) book_shelf.append_book(Book(name='C')) book_shelf.append_book(Book(name='D')) it = book_shelf.iterator() while it.has_next(): ...
986,312
d0af23df74f1071449ff6ebb63bd8fc490791273
from Tkinter import * import tkMessageBox import trainer as tr import pandas import main root = Tk() frame = Frame(root) frame.pack() bottomframe = Frame(root) bottomframe.pack(side=BOTTOM) L1 = Label(frame, text="Enter the URL: ") L1.pack(side=LEFT) E1 = Entry(frame, bd=5, width=150) E1.pack(side=RIGHT) def submit...
986,313
1bad7f8f038c98bb64cf8bc8519f3ba5aefe4608
import google_vision import analyze import classification import sys import numpy as np if __name__ == '__main__': model = classification.Classifier() filename = sys.argv[1] json_labels = google_vision.getJson(filename) selected_labels = analyze.toDataFrame(json_labels) # print (selected_labels) ...
986,314
32126558e8b284e79391df4625628245935c9719
from django.core.urlresolvers import reverse from django.shortcuts import render_to_response, get_object_or_404, redirect from django.template import RequestContext from webshop.forms import MyUserCreationForm, MyAuthenticationForm, MyUserChangeForm, MyPasswordResetForm, MyPasswordChangeForm, AddressForm from webshop.m...
986,315
67d93e68ee89e0680a23faa936f39034ff83bd00
import base64 from datetime import datetime import io import itertools import os import pandas as pd from selenium import webdriver from selenium.webdriver.common.keys import Keys import sys from textwrap import dedent import time try: from urlparse import urlparse except ImportError: from urllib.parse import u...
986,316
5070f438200364275581621a7161a1fbb2785ab6
import numpy as np from tiramisu import * import keras import sys import argparse import os import glob import datetime from PIL import Image from scipy.misc import imresize from preprocessing import load_image from params import * parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter...
986,317
1618e7038777b22e00613f92fa0effda903ee141
import pytest import numpy as np import torch import torch.nn as nn from alpaca.utils import model_builder import alpaca.nn as ann @pytest.fixture(scope="module") def simple_model(): net = nn.Sequential(nn.Linear(10, 10), ann.Dropout()) return net @pytest.fixture(scope="module") def nn_simple_model(): ...
986,318
614687bdd3b9ba7a73161515558dc125d99e9f56
# arm_curve.py (c) 2011 Phil Cote (cotejrp1) # # ***** BEGIN GPL LICENSE BLOCK ***** # # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) an...
986,319
409a41a2405bc2f45c7460f39761f7b1c428ab3f
# -*- coding: utf-8 -*- from __future__ import print_function from config import get_config import tensorflow as tf import numpy as np __AUTHOR__ = "kozistr" __VERSION__ = "0.1" cfg, _ = get_config() # configuration # set random seed np.random.seed(cfg.seed) tf.set_random_seed(cfg.seed) _init = tf.contrib.la...
986,320
a8c0146e8db20b993b5978c07790035bbf3cfbc2
# coding: utf-8 # In[4]: import tensorflow as tf # 创建一个常量 m1 = tf.constant([[4,4]]) # 创建一个常量 m2 = tf.constant([[2],[3]]) # 创建一个矩阵乘法,把m1和m2传入 product = tf.matmul(m1,m2) # 打印结果 print(product)
986,321
b82fbe6f7a4dfba010fd1ebe6d31ff8a161410ad
""" procedure triInsertion(entier[] tab) entier i, k; entier tmp; entier k; pour (i de 2 à N en incrémentant de 1) faire tmp <- tab[i]; k <- i; tant que (k > 1 et tab[k - 1] > tmp) faire tab[k] <- tab[k - 1]; k <- k - 1; fin tant que tab[k] <- tmp; fin pour fin procedure """ # ...
986,322
0eb5e97da16806b0e412a50480e1c47af3792c6c
import os import pathlib from pandas import Timestamp from wrfhydropy.core.job import Job from wrfhydropy.core.namelist import Namelist def test_job_init(): job = Job( job_id='test_job_1', model_start_time='1984-10-14', model_end_time='2017-01-04', restart=False, exe_cmd=...
986,323
24ad2d32bbfde26e8c817e00162bb4864cdc062e
import math T = int(raw_input()) for i in xrange(T): x = int(raw_input()) a = math.log10(math.sqrt(2 * math.pi * x)) b = math.log10(x / math.e) * x print int(a + b + 1)
986,324
952f2387c4d07acb74357de4f588f0b9e0c81ffa
import requests import numpy as np import conf import os import time import matplotlib.pyplot as plt import matplotlib.dates as mdates import datetime as dt import binance def build_ticker(all_symbols, tickers_raw): backup_coins = ['BTC', 'ETH', 'BNB'] tickers = {'USDT' : 1, 'USD' : 1} tickers_raw = {t['s...
986,325
bb7c45f01d7bd8ed1fbf3f1e3886a7493bdd214e
# coding: utf-8 import logging from flask.ext.admin.contrib.sqla import ModelView from flask.ext.admin.babel import gettext from flask.ext import login from flask import flash from wtforms import TextAreaField from utils import form_to_dict from models import SystemMessage class SystemMessageView(ModelView): "...
986,326
fa752d9456a8eba441e2649d9db5924cbcfa2cfb
import Supplier class Order(Supplier): def __init__(self, full_name, email, category, membership, note, quantity, description, price, order): super().__init__(full_name, email, category, membership, note, quantity, description, price) self.__order == order def get_order(self): return ...
986,327
1da31410d725e5615570b388a2d1f58cc901ab89
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # # Serves content for current directory # # Author: Thomas Frössman ( thomasf@jossystem.se / http://thomas.jossystem.se ) # Updates to this file will probably be available at https://github.com/thomasf/dotfiles/ # import sys import BaseHTTPServer from SimpleHTTPServer i...
986,328
a3c5802f7977299b3fe4afa0a3dc380081caa4ed
from django.contrib import admin from .models import Reporter from .models import Statement from .models import Tip from .models import Photo admin.site.register(Reporter) admin.site.register(Statement) admin.site.register(Tip) admin.site.register(Photo)
986,329
9a14ee0beb4383df99adca4118784c09a6f47e04
## Script created by Jenny Holder, Innovate! Inc. November 2016 ## ## Had to install pypyodbc, requests and copied here: ## C:\Python27\ArcGISx6410.4\Lib\site-packages import arcpy, sets, pypyodbc, requests, ftfy ## Create connection to SQL Server database and open a cursor #connection = pypyodbc.connect('Driver={SQ...
986,330
5c02d5a74715827c62bf0091c0464c24c984fa5d
import tensorflow as tf import keras new_model = tf.keras.models.load_model('keras_model_test.model') predictions = new_model.predict([[153,256,99,0,86,65]]) print(predictions)
986,331
08c79da664edb6aff20a70ad0f8d84d09e92944b
''' Created on 25.09.2013 @author: Sven, Christian, Collin Just a small test utility to initialize a game and make some moves ''' from TEAMengine import NoTipping import pdb import sys A = NoTipping() A.display() print A.to_move print A.phase Player_before = -1 #pdb.set_trace() while True: if A.to_move == 1: ...
986,332
076f2488504981643e90107ef8ba94963f2d43ec
from collections import deque def find_set(x): if parent[x] != x: parent[x] = find_set(parent[x]) return parent[x] def make_set(x): parent[x] = x rank[x] = 0 def union(x, y): root1 = find_set(x) root2 = find_set(y) if root1 != root2: if rank[root1] > rank[root2]: ...
986,333
91b1a168591d56266bf7d8688e4fdf2a6dcbcc2c
import main crypto = main.get_platform_command_code('telegram', 'crypto') def run(bot, chat_id, user, keyConfig, message, totalResults=1): return crypto.run(bot, chat_id, user, keyConfig, message, totalResults)
986,334
7596504b94e790377b3c6af8de579a3346fd2f32
#import modules import redis r = redis.Redis(host="192.168.2.8", port=6379, db=0, password="password") r.set("openTrades", "4") r.set("simulatedSum", "0.12") r.set("sumResult", "0.01") hello = "yeye" + r.get('openTrades').decode('utf-8') print(hello)
986,335
54e6842cdb40522c8a002e71e850c714e5a441bd
import utmpaccess import utmp from UTMPCONST import * import time from netaddr import * import collectd PLUGIN_NAME = 'session' collectd.debug('session : Loading Python Plugin' +PLUGIN_NAME) Domains= None def config_func(config): global domains domains = [] for node in config.children: ...
986,336
6d88326ea1afbea5f8d34a4c6b552d57b09df198
from django.shortcuts import render from . import util from markdown2 import Markdown from django import forms from django.urls import reverse from django.http import HttpResponseRedirect markdowner = Markdown() # display a list of all wiki entries def index(request): return render(request, "encyclopedia/index...
986,337
dfc1369f98a1abe0d22e28942a51013cf2588ca1
from django.apps import AppConfig class RockclimbersConfig(AppConfig): name = 'rockClimbers'
986,338
fe9fd5508d80ea734191ac21fe0d3477d428d20d
from math import sqrt def puzzles_reader(input_file): puzzle_list = list() puzzleId = 1 with open(input_file, 'r') as file: for each in file: puzzle = dict() parts = (str(each).split(' ', 4)) puzzle['size'] = int(parts[0]) puzzle['max_d'] = int(part...
986,339
626091793a089011025bd77f7e58db1e6825ef4e
# Generated by Django 2.2 on 2019-05-10 04:02 from django.db import migrations, models import exchange.util class Migration(migrations.Migration): dependencies = [ ('exchange_app', '0019_trader_credit_limit'), ] operations = [ migrations.AlterField( model_name='order', ...
986,340
9c439805f818b2120a73622f985c9fa9cebaa817
import sys import csv from collections import OrderedDict def main(): # Produce error message if incorrect number of inputs passed in if len(sys.argv) != 3: print("Error. Incorrect Input") sys.exit(1) # Read the database and the individual sample files as lists dbReader = list(csv.rea...
986,341
5327e9838c35c8b2362c952ee25d03f99c4d92e0
# curl -O -L ftp://ftp.cyrusimap.org/cyrus-sasl/cyrus-sasl-2.1.26.tar.gz # tar xzf cyrus-sasl-2.1.26.tar.gz # cd cyrus-sasl-2.1.26 # sudo ./configure && sudo make install # sudo pip install sasl # sudo pip install pyhive # sudo pip install pycrypto import sys from pyhive import hive from Crypto.Cipher import AES imp...
986,342
bb449fb3ac177bf29e63f9afff3704abfc6f77ef
#!/usr/bin/env python3 """ Lesson 3: String Format Lab Course: UW PY210 Author: Jason Jenkins """ def format_string_1(file_num, float_num1, int_num, float_num2): """ Task 1 Format the string :param fileNum: value a filenumber :param floatNum1: display it with 2 decimal places :param intNum: ...
986,343
448ef5f26146ac8b99622a9636440d77ddb5990d
# Problem 298 # Easy # Asked by Google # # A girl is walking along an apple orchard with a bag in each hand. She likes to pick # apples from each tree as she goes along, but is meticulous about not putting # different kinds of apples in the same bag. # # Given an input describing the types of apples she will ...
986,344
c56d5af94251ac0e0b9608034a63cc2a9c2a8a42
class ConfigModel(): pass
986,345
0c23806ba512002eb6c7d9a2eddfb2c88270dcbe
from pydantic import BaseModel from typing import List import inspect from uuid import uuid4 import json from json import JSONEncoder import requests from enum import Enum class MyEnum(str, Enum): a = "bb" b = None class M(BaseModel): x: List[str] print(type(MyEnum)) x = 1 assert list(x) == [x] l = li...
986,346
0ef76c4d514b63a69c8ca3ff5020278148e3a634
import os import pandas as pd import numpy as np from DataGenerator import DataGenerator class SanDiskGenerator(DataGenerator): def __init__(self, path='../SanDisk/', do_standardize=True, take_last_k_cycles=-1, train=True, n_features=11): self.path = path if train: prefix = '...
986,347
69cb6a052352dd434d71c7da3d25a03a1a81326f
from random import * offline = randint(4, 28) print("오프라인 스터디 모임 날짜는 매월 " + str(offline) + " 일로 선정되었습니다.\n")
986,348
53914881c6228b20088fe28f6b70c93864895981
from rl.env.random_jump import RandomJumpEnv from rl.standalone.tf.gaussian_policy_tf import GaussianPolicyTF from rl.standalone.tf.value_estimator_tf import ValueEstimatorTF from rl.featurizer.rbf_featurizer import RBFFeaturizer # import numpy as np import tensorflow as tf import matplotlib.pyplot as plt import iterto...
986,349
d81b027a0d3efddb4c224bff88a3a63ef3eaceeb
#!/bin/python3 from motor.model.pwm_motor import PWMMotor class PWMFourWheelDrive: def __init__(self, pin_1, pin_2, pin_en_1, pin_3, pin_4, pin_en_2, pin_5, pin_6, pin_en_3, pin_7, pin_8, pin_en_4): self.motor_f_r = PWMMotor(pin_1, pin_2, pin_en_1) self.motor_f_l = PWMMotor(pin_3, pin_4, pin_en_2)...
986,350
42a1a880e86def1e0dc62abdfc5335c705fdf436
# Generated by Django 2.2.12 on 2020-08-18 14:27 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('hogist', '0005_auto_20200818_1350'), ] operations = [ migrations.AddField( model_name='useripdetails', name='time',...
986,351
4da9edc4bef7ec679c25a3fda1ae863b92832198
# -*- coding: utf-8 -*- """Implementation of the core game loop.""" import random import logging import pygame from airportgame.colors import RED, GREEN from airportgame.textinput import TextInput from airportgame.pgtext import PgText from airportgame.player import Player from airportgame.airfield import Airfield ...
986,352
bd14f2eeff3e22afa18466e7939d396f1ceda251
import sys import csv import matplotlib.pyplot as plt from datetime import * from ggplot import * import matplotlib.dates as dt f = open(sys.argv[1]) reader = csv.reader(f,delimiter = ',') NYPD = {} TLC = {} DPR = {} count = 0 next(reader) start_date = datetime.strptime('06/01/2013 00:00:00 AM', '%m/%d/%Y %H:%M:%S %...
986,353
ffe0fecac8fe4c647e9aaf8d5a6804ca23f91bde
import os import numpy as np import configparser import math import struct from photogrammetry_importer.file_handlers.image_file_handler import ( ImageFileHandler, ) from photogrammetry_importer.utility.os_utility import get_subdirs from photogrammetry_importer.file_handlers.utility import ( check_radial_disto...
986,354
072f0bedb0068408160886456907e04e011fe17a
class Figura: def __init__(self, podstawa, bok, wysokosc, promien): self.podstawa = podstawa self.bok = bok self.wysokosc = wysokosc self.promien = promien class Kwadrat(Figura): def __init__(self): super().__init__(int,0,0,0) self.podstawa = int(input(...
986,355
a6eb88b453e44886e5899adb84298771982114a4
import sys print(sys.path) print(__file__)
986,356
dc2ccc9aff3649b06d1ea7b046c7a41c98e15ad2
from .contact import ContactForm from .news import NewsCommentForm from .product import * from .subscriber import SubscriberForm
986,357
bc146fe407a125523710255e483a790a78f31632
# Generated by Django 3.2.5 on 2021-07-13 11:05 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='FoodItem', fields=[ ...
986,358
79bf8f881c9e0495c8fa54a2cd7cd1cc3b59ec08
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import NoArgsCommand from django.db import models from TopicalRSS.rss import models from TopicalRSS.rss.models import Feed import elementtree.ElementTree as ET import urllib2 class Command(NoArgsCommand): help = "Upd...
986,359
3887b5309900796dd9db097fbd2be821463faf56
import wx from Shape import Shape from Tetrominoes import Tetrominoes class Board(wx.Panel): BoardWidth = 10 BoardHeight = 22 Speed = 300 ID_TIMER = 1 def __init__(self, parent): wx.Panel.__init__(self, parent) self.initBoard() def initBoard(self): self.timer = wx.Time...
986,360
de5dcbc74a3b73db03156d81c03aaaf39965865e
def icd_chapter_section(condition_code): try: icd_section = int(condition_code.split('.')[0]) except: return 0, 0 if icd_section >= 1 and icd_section <= 139: chapter = 1 elif icd_section >= 140 and icd_section <= 239: chapter = 2 elif icd_section >= 240 and i...
986,361
69405caea8231c1b1c210a3463c1173cbb8c3566
import requests from bs4 import BeautifulSoup from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager import time import os import re f = open("../data/johnson.txt", "w") chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--headless') driver = webdriver.Chrome(C...
986,362
704e77294eb932ee71af7ee6d8d15c7b3f37a40a
import requests import random from retrying import retry from torent.fake_user_agent import headers from lxml import etree # 随机选择请求头 可根据不同需求进行改写 def user_agent(): UA = { "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9", "User-Agent": random.choice(headers) } ...
986,363
0f0fafcf1c269c681b7e880fbb3e681ce8779012
''' Created on Apr 6, 2016 @author: dj ''' from flask import Flask, render_template, request app = Flask(__name__, static_folder='.', static_url_path='') @app.route('/') def home(): message = "Hello, World!" print("message =", message) return message @app.route('/index') def index(): '''/index'''...
986,364
6d61bd789514057a5aca8465143f64bfacfb7249
from random import * c=randint(100,999) print('Получено число',c) print('сотни:',c//100) print('десятки:',c//10%10) print('единицы:',c%10)
986,365
692cf4e37647ebc38f67f0f1db54669677ef6e6f
import pytagcloud # with와 같이 사용하면 close를 안해도 된다 with open('count.txt', 'r', encoding='utf-8') as f: input_data = f.readlines() data = [] for d in input_data: d0, d1 = d.split() # do: 단어 d1:갯수 if len(d0) > 1: # 2글자 이상 data.append((d0, int(d1))) print(data) tag_list = pytag...
986,366
90dec008232379bf8cfdb21791fb6eb03512b675
from . import faceid_source
986,367
dea4bf0bc079d5bab1fdd9709eba2fe8a431be9d
#!python3 import os import json import requests from pprint import pprint base_folder = os.path.dirname(__file__) filename = os.path.join(base_folder, 'mount-data.json') # https://stackoverflow.com/questions/37228114/opening-a-json-file-in-python with open(filename, 'r', encoding='utf-8') as fin: #data = list(js...
986,368
10ac119a13af729ea52dcb203945c44093fca104
# from core import schedule, makespan, Event, insert_sendrecvs from .core_heft import schedule, makespan, Event, insert_sendrecvs
986,369
bb5cf1ba51f77eb0d905c3cdf724efc72a746063
from ..utils.objects.metrics import Metrics import torch import time from ..utils import log as logger class Train(object): def __init__(self, step, epochs, verbose=True): self.epochs = epochs self.step = step self.history = History() self.verbose = verbose def __call__(self, ...
986,370
dd48ecb7e0ee12d8ff875a16ea5457b296b201c7
#!/usr/bin/env python # coding: utf-8 # In[3]: from flask import Flask,redirect,url_for,render_template,request import os import shutil import tensorflow as tf import numpy as np import pandas as pd import matplotlib.pyplot as plt from pycontractions import Contractions import re import scipy.stats as st from ge...
986,371
58b1bb735826a4192c440bdedaca5f62a7978751
#!/usr/bin/python3 """ 4-append_write.py """ def append_write(filename="", text=""): """ appends a string at the end of a text file (UTF8) and returns the number of characters added: Args: filename (str, optional): file to add. Defaults to "". text (str, optional): str to add to fil...
986,372
9f118f942d63bf862a0439dd57d25ab95c6b465c
from ART2 import ART2 import numpy as np input_data = np.array([0.8, 0.6]) nn = ART2(n=len(input_data), m=2, rho=0.9, theta=0.1) nn.start_logging(to_console=True, to_file=False) nn.learning_trial(idata=input_data) nn.stop_logging()
986,373
12be5dafa9832e92ca1edcce3097ee4965d67e39
print("__main__.py")
986,374
5706d11374baccfb691504352becd52d21e2f7b1
import urllib.request import requests import PyPDF2 from bs4 import BeautifulSoup import datetime url = 'https://www.icsi.edu/JOBOPPORTUNITIES.aspx' page = urllib.request.urlopen(url).read() soup = BeautifulSoup(page, "lxml") job_opportunity_for_members = soup.select( '#dnn_ctr13100_HtmlModule_lblContent > table...
986,375
edb66a1cea2afbf08d30c68b070979236e1cb68a
class Iterateur: def __init__(self): pass def __iter__(self): pass return self def __next__(self): … return xx #la valeur suivante … raise StopIteration for i in iterateur(x):
986,376
30d3ab4d6f4c2df09caae68c8ea93e953fd71f69
"""Implementation of ``cookbot`` script.""" from optparse import OptionParser from settings import ConfigParserReader from context import Context class Command(object): """Command class.""" def __init__(self): """Constructor.""" self.cmd = None # The command to invoke. self.cmd_args ...
986,377
ffb222ce2d8f87481725c378acc2649dfdbcff5e
from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from helpers import db app = FastAPI() origins = ['*'] app.add_middleware( CORSMiddleware, allow_origins=origins, allow_methods=["*"], allow_headers=["*"] ) @app.get("/") async def root(): return { "messa...
986,378
296694ad5c10e9323575d0cbd8a79c7beca6a275
import requests import json import time import threading from collections import deque import os class MatchFetcher: RANKED_PARAM = "?rankedQueues=TEAM_BUILDER_DRAFT_RANKED_5x5&beginTime=" # These are all of the LoL regions. Deleting from this list and the corresponding # SUMMONERS_BY_REGION dictionary ...
986,379
e476b3c6173e080832fd5b4e86d089915221055c
#!/usr/bin/env python3 # encoding: utf-8 import settings print("You are about to make a Test List. Choose an option.") def get_input(): inputt = input(f"\nPress {settings.OKGREEN}enter{settings.ENDC}" f" {settings.OKGREEN}to make a List.{settings.ENDC}\n" f"Type:\n{settings....
986,380
40a9374b3649f4f141fe2500266797c050c9269a
import BuildSimHubAPI as bsh_api import BuildSimHubAPI.postprocess as pp import os from sklearn.model_selection import cross_val_predict from sklearn import linear_model from plotly.offline import plot import plotly.graph_objs as go project_api_key = 'f98aadb3-254f-428d-a321-82a6e4b9424c' model_api_key = '60952acf-bde...
986,381
b59cefba669ddf1688b1c7be7b226ee6573d1d49
from django.apps import AppConfig class UnitTestAppConfig(AppConfig): name = 'tests' verbose_name = "Unit test app"
986,382
495c447fb9797ca6f9182fcfb6b1227dc97ef7fb
class Device: apl_support: bool viewport_profile: bool def __init__(self, viewport_profile): if viewport_profile is None: self._set_default_session_variables() elif str(viewport_profile) == 'ViewportProfile.HUB_LANDSCAPE_LARGE': self.apl_support = True elif s...
986,383
ff8f901fad6379764fb523d2dcc9eeb9c775a3ad
"""""" # Standard library modules. import sys import subprocess # Third party modules. # Local modules. import psutil # Globals and constants variables. def create_startupinfo(): if sys.platform == "win32": startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOW...
986,384
a7161798861759300bfa29e3d432109f3e878407
from matplotlib import pyplot as pp from pymongo import MongoClient import json import pprint import numpy as np import datetime client = MongoClient() walmart = list(client["inventory"]["walmart"].find({})) target = list(client["inventory"]["target"].find({})) safeway = list(client["inventory"]["safeway"].find({})) ...
986,385
781e04e07f57e58d3a9cc34417571680001724ca
from adj_stf.config.model_args import T5Args from adj_stf.t5.t5_model import T5Model
986,386
23c5c749d46cb22d2e06c4bf536cbb860c0840c5
# -*- coding: UTF-8 -*- ''' Created on 2017年1月4日 @author: superhy ''' from matplotlib.ticker import MultipleLocator, FormatStrFormatter from numpy import float64 import matplotlib.pyplot as plt import numpy as np from interface import fileProcess from matplotlib.pyplot import subplot def transTrainingHistStrIntoL...
986,387
2aacbcbe31bdb9000bb0d097687c656f28db6517
"""440. Backpack III """ class Solution: """ @param A: an integer array @param V: an integer array @param m: An integer @return: an array """ def backPackIII(self, A, V, m): # write your code here ## Practice: n = len(A) dp = [[float('-inf')] * (m + 1) for _ i...
986,388
15fc1f68f0cbfee2d768393e7b57f994e7eab3de
## ## EPITECH PROJECT, 2021 ## B-MAT-200-PAR-2-1-110borwein-jean-baptiste.debize ## File description: ## calc_fonc ## from math import sin from math import pi def fonc_eval(n, x): result = 1 if x == 0: return 1 for k in range(n + 1): result *= sin(x / (2 * k + 1)) / (x / (2 * k + 1)) r...
986,389
e5c1c634f4057b981b6ab49304570961aced40d6
""" Created by Juraj Lahvička, xlahvi00 """ from definitions import * first = {} def init_first(): for non_terminal in non_terminals: first[non_terminal] = [] def check_first(non_terminal, line): split_line = line.split(' ') if terminals.__contains__(split_line[0].strip()): first[non_t...
986,390
f7fe9c73fea1d64d80fd92d6b9c03ee0787bd56e
#!/usr/bin/env python # -*- coding: utf-8 -*- """Find and delete Movies that have been watched by a list of users. Deletion is prompted """ from __future__ import print_function from __future__ import unicode_literals from builtins import input from builtins import object import requests import sys import os import ...
986,391
fcea5f66c57924a9b1e2762a1240769aba94371d
size = int(input("Enter the no of items you want to add in Dictonary: ")) diction = dict() for i in range(size): key = input("Enter the key for item " + str(i + 1) + " in dictonary: ") value = int(input("Enter the value for item " + str(i + 1) + " in dictonary: ")) diction[key] = value print("The secon...
986,392
f57ef34d896c7b832a94cca87f91ab425144a7d7
""" 归并排序 """ def merge(left, right): """ 将左右两个列表进行比较添加 :param left: :param right: :return: """ result = [] while left and right: if left[0] < right[0]: result.append(left.pop(0)) else: result.append(right.pop(0)) if len(left) > 0: res...
986,393
a2415072fb341976dbf516a3eeb1a3936440ffb1
import pandas as pd import numpy as np from pandas import DataFrame from scipy.stats import spearmanr from texttable import Texttable from CNN_processing import get_ref_and_cand from bleu import BLEU df = pd.read_csv('../data/demo.tsv', sep='\t') n_gram = 4 candidate_corpus, reference_corpus, human_scores = get_re...
986,394
331d7783f49328eaccaad5fffea5b411b8616584
import _thread import debugging from machine import Pin from time import sleep_ms from maintenance import maint class LEDs(object): # These must be hard-coded to prevent a recursion issue where # config_class.py cannot load the config file and throws an error. # TODO Do I need this now? I don't think I'm r...
986,395
768dd4b4a9799600a6da33c8925d8d9ebd5aa16f
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-01-17 14:24 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("photography", "0002_auto_20160114_1613"), ] operations = [ migrations.RenameField(mode...
986,396
9c1a7528213ac3e9ffe85f20f8ddc2b99d59eee3
# from __future__ import print_function import sys, datetime from multiprocessing import Pool from clone_simulation_hpc2hpc import clone_simulation_hpc2hpc from COMPS import Client from COMPS.Data import Experiment, SimulationFile, QueryCriteria, Configuration, Simulation from COMPS.Data.Simulation import Simul...
986,397
e6e9e95c41dcb5a0e59be5247c83162e572cee01
import random def get_randomized_9_hands(): deck = shuffle_a_deck_of_cards() hands, deck = deal_two_cards_to_each(deck) return hands, deck def shuffle_a_deck_of_cards(): deck = [] for i in range(2, 15): for j in range(1,5): deck.append([i, j]) random.shuffle(deck) retur...
986,398
ac2e5ad8a8667ca5d1e49f009092c6dcd4671973
from .base import BaseModel import numpy as np import scipy as sp import GPy from GPy.util.linalg import pdinv, dpotrs from scipy.optimize import fmin_l_bfgs_b class GPModel(BaseModel): """ Modified based on the GP model in GPyOpt. :param kernel: GPy kernel to use in the GP model. :param noise_var: v...
986,399
8920524e92917641ce0ca919d48a28a7fa620be6
# -*- coding: utf-8 -*- import csv from prepaid_agreements.models import PrepaidAgreement def write_agreements_data(path=''): agreements_fieldnames = [ 'issuer_name', 'product_name', 'product_id', 'agreement_effective_date', 'agreement_id', 'most_recent_agreement', 'created_date', 'curr...