index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
13,300
4f0288bdc3f1b27a95392909cb3c1c8bb4cc1139
# Linear Search - going through each and every element in a list. # Binary Search - splitting the list in half and searching through the half before moving on print("Example 1: Linear Search") # find if 0 is present in the list list_a = [1,3,5,7,0,44,6,2,4] def linear_search(list): for i in list: if i =...
13,301
7cbc7525733d9319a9da875a2f841624123c7f17
# -*- coding: utf-8 -*- """ Created on Tue Apr 18 13:40:37 2017 @author: Raphael """ import random as rd import time import Batalha as btl import json import os import Save as sav import Misc as msc def Village(): TTD = ["1)Shop","2)Promote","3)Train","4)Challenge","5)Leave"] while True: with open ("C...
13,302
0ebe3298f660421e582967a274ff385af668abc5
# Launch training import argparse import logging from pathlib import Path import pandas as pd from tqdm import tqdm from lucanode.training import evaluation from lucanode import loader from lucanode import nodule_candidates # Configure tensorflow for memory growth (instead of preallocating upfront) import tensorflow...
13,303
d90a984a65a4151c4e2aae16dd136664a8eacfb3
def coroutine(f): def wrap(*args,**kwargs): gen = f(*args,**kwargs) gen.send(None) return gen return wrap @coroutine def multiplier(): counter = 1 while True: user_input = (yield) result = counter * user_input print(result) counter += 1
13,304
27155230d5a2453311a57545f0c88c397a4a9512
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import os import logging from bmc.bmc_spec import BMCSpec, InvarStatus from . import sal_op_parser from . import pwa2salconverter as pwa2sal import fileops as fops import utils as U import err logger = log...
13,305
2ddf5f77e7cc75ce0df31ad4f017e70dc60c395b
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jan 26 20:40:47 2021 @author: Justin Sheen @description: script used to create community simulations, with and without an enacted NPI intervention. """ # Import libraries and set seeds ---------------------------------------------- impor...
13,306
66f222cba8d7626a70ce45c3ab8643372b8837c8
# -*- coding: utf-8 -*- import json import logging import scrapy from scrapy import log from old_house.items import city_status_Item from scrapy.selector import Selector from scrapy.http import Request import time class shenyang_house_spider(scrapy.Spider): name = "reset" start_urls = [ "http://www.a...
13,307
0c23405b102ae3ab8a4f1ac1f473b70eda442a64
import sys, numpy from PyQt5 import QtWidgets from PyQt5.QtWidgets import QApplication from PyQt5.QtGui import QPalette, QColor, QFont from orangewidget import widget, gui from oasys.widgets import gui as oasysgui from orangewidget.settings import Setting from oasys.widgets.widget import OWWidget from orangecontrib.s...
13,308
afcc4e1b097a1de62f666a85206a32283c7404e1
from django.urls import path from . import headViews, teacherViews, studentViews from .views import index_page, login_page, login_action, GetUserDetails, logout_user urlpatterns = [ path('', login_page, name="show_login"), path('index', index_page), path('login', login_action, name="login"), path('ge...
13,309
c0776b38e9edd8d3920e274deb3f1565e348aed4
# -*- encoding: utf-8 -*- # @Contact : ynatsu233@outlook.com # @Time : 2019/5/5 19:03 # @Author : Natsu Yuki # pip install Flask-Script from flask_script import Manager # 本地文件 from flaskScript import app from dbScripts import dbManager from flask_migrate import Migrate, MigrateCommand from exts import db ...
13,310
96ca975133f41dd632af2b0c41750b9c33e52b06
from django.urls import path from bills.views import BillGenericView, BillDetailGenericView app_name = 'bills' urlpatterns = [ path('', BillGenericView.as_view()), path('<pk>/', BillDetailGenericView.as_view()) ]
13,311
02cb44770af6b2c427ed582ecfbcff9618834ebd
#!/usr/bin/env python # -*- coding: utf-8 -*- import commands,sys,os,shlex,subprocess,re,datetime,locale from multiprocessing import Process,Pool proc = 12 APK_DIR = "../test_apk2/" CHECK_SMALI_DIR = "../check_smali/" TEMP_DIR = "../temp/" OUTPUT_DIR = "./output/" def findAllFiles(directory): for root, dirs, fil...
13,312
30bea73a4f5e37309f55025145fda3880abf2020
import pandas as pd from pandas.util.testing import assert_frame_equal pd.options.mode.chained_assignment = None # warning disable from dot_function import addDot_icd9, addDot_icd10 # from multitasking import parallelize_dataframe, hello def generic_clean_2018_data(ICD_data=None, I9_desc=None, I10_desc=None, col...
13,313
27ad3944ed7db2520cf272ccc346e34256ea1287
from django.conf import settings from django.conf.urls import include, url from django.conf.urls.static import static from django.contrib import admin from .views import ( PickingbillAssignView, WaybillCompleteView, LineChartJSONView, PickingbillStatView, ) urlpatterns = [ url(r'^p...
13,314
ba28d999e3646deff88b2efbbcaf41d4124a62ba
# Generated by Django 3.1.4 on 2021-01-04 15:37 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('resume', '0003_info_profile_photo'), ] operations = [ migrations.AlterField( model_name='info', name='bio', ...
13,315
0f729cd2aba0979b5545c314e14bd2fb91543a7e
# helper class to simplify email related tasks import smtplib from email.message import EmailMessage class EmailHelper: def __init__(self): self.server = None # login to e-mail server (google gmail) def login(self, user, pwd): try: self.server = smtplib.SMTP_SSL('smtp.gmail.co...
13,316
4786bf9be19a70e6ad4595efe5a5da10071a00a6
import bnf # Language ::= "[hH]ello, [wW]orld!" class Language(bnf.Identifier): __default_regex__ = r"[hH]ello, [wW]orld!" def onMatch(self, context): print "Match", self.id
13,317
c88c80eb8f322f742a449c5ed5f046026cf75a9b
import json import redis class Semaphore(object): def __init__(self, width): self.r = redis.Redis(host="localhost", port=6378, db=0) self.r.set("semaphore", width) def __gt__(self, operand): self.r.set_response_callback("GET", int) return self.r.get("semaphore") > operand ...
13,318
672b870f3c89efcb172305a1837401d20d241895
import pydot import os os.system("cls") dot_txt = 'digraph G {\n start -> end;\n}' graph, = pydot.graph_from_dot_data(dot_txt) graph.write_png('f.png')
13,319
ec218570430c8a3a0136cfeee096e7b34fc4424a
from numba import njit, prange from time import time import numpy as np @njit(parallel=True, fastmath=True) def fast_norm(vec): return np.array([np.sqrt(np.sum(np.power(vec[i,:], 2))) for i in prange(vec.shape[0])]) class KMeansMultithreading: def __init__(self, k=4, max_iter=15, tolerance=1e-4): se...
13,320
bf4c4d2d582917b4ff4de6d40f20b1f1f5524368
import random as rnd def random_permutation(iterable, r=None): pool = tuple(iterable) r = len(pool) if r is None else r return tuple(rnd.sample(pool, r)) def random_shuffle(members): rnd.shuffle(members) return tuple(members)
13,321
f59678e9bae581ee0c533b632becb3091b91011a
#!/usr/bin/env python # # Copyright (c) 2015 10X Genomics, Inc. All rights reserved. import tenkit.safe_json from crdna.singlecell_dna_cnv import cluster_jedna import longranger.cnv.coverage_matrix as coverage_matrix import martian __MRO__ = """ stage GENERATE_CLUSTERS( in h5 normalized_singlecell_profiles, ...
13,322
4a8a83176724b888b1f5e8a89169d12d1cb964e1
import unittest import multiprocessing import selectable class CustomObject(object): pass class Proc(multiprocessing.Process): def __init__(self, pipe): self.pipe = pipe super(Proc, self).__init__() def run(self): self.pipe.use_right() msg = None while msg != 'shu...
13,323
0e09836723a5a8d685c3b799d529b12e356fd6e8
# -*- coding: utf-8 -*- """ Created on Sat Sep 12 01:34:29 2020 @author: Noah Lee, lee.no@northeastern.edu """ from pystreamable import StreamableApi from dotenv import load_dotenv import os class StreamableUpload(object): def __init__(self): load_dotenv() USERNAME = os.getenv...
13,324
d3bb5b188f1e453cba6feb5eeba0be6668d19be5
from channels.routing import route from channels.routing import ProtocolTypeRouter, URLRouter from main.routing import websockets application = ProtocolTypeRouter({ "websocket": websockets, })
13,325
05d7fb6dff824aba9bc573ee966b8881c2b32d4c
""" @generated by mypy-protobuf. Do not edit manually! isort:skip_file """ import builtins import google.protobuf.descriptor import google.protobuf.internal.containers import google.protobuf.internal.enum_type_wrapper import google.protobuf.internal.extension_dict import google.protobuf.message import pyatv.protocols....
13,326
a577f843667e2ec0c990141f7935b96bdb7f9f26
a = 5 def hi(): return 'hi' def am_i_main(): return __name__ == '__main__'
13,327
1be0c498c306cf6032e2f9b3bc7c1216caf17283
#!/usr/bin/python """ ============================================================================= ROCK MASS SLIDING ============================================================================= Calculate the factor of safety for a rock mass above a sliding surface. """ from argparse import ArgumentParser from math i...
13,328
7a00798935599b240f29e53e5b5e300bf74bf08b
"""Pytorch Lightning Sphinx theme. From https://github.com/shiftlab/lightning_sphinx_theme. """ from os import path __version__ = "0.0.28" __version_full__ = __version__ def get_html_theme_path(): """Return list of HTML theme paths.""" cur_dir = path.abspath(path.dirname(path.dirname(__file__))) return...
13,329
f9712a63277f6904c72b69c4c022ee4c9266a718
from os.path import isabs, join import sys import subprocess try: subprocess.check_output( '{} -c "import numba"'.format(sys.executable), shell=True ) print('numba available, importing jit') from numba import jit except Exception: print('cannot import numba, creating dummy jit definition') ...
13,330
8599475bbcd08c1241b5bf208f47296b05796e5d
from random import shuffle import time from random import randint import timeit import matplotlib as mpl import matplotlib.pyplot as plt def desenhaGrafico(x,y,y2, xl = "Entradas", yl = "Saídas"): fig = plt.figure(figsize=(10, 8)) ax = fig.add_subplot(111) ax.plot(x,y, label = "Tempo no caso qualquer") ...
13,331
788c6f8bf153455c77e872584842d03d32c11e1a
import numpy as np # array1 = np.random.randint(5, size=[2, 3]) # print(array1) # # axis 表示按行还是列排序 # # 0表示按列排序,1表示按行排序 # array1.sort(axis=1) # print(array1) array = np.random.randint(5, size=[4]) print(array) indexArray = np.argsort(array) # 排序后的索引数组 print(indexArray) print(array[indexArray])
13,332
3b5638ae0d57e37d813ad145efb5b385523ce42f
import sys import math maxSize = 10001 # generate a list of prime numbers aIsPrime = [True] * maxSize for i in range(2, maxSize): if not aIsPrime[i]: continue for j in range(2*i, maxSize, i): aIsPrime[j] = False primeList = [] for i in range(3, maxSize): if aIsPrime[i] and i != 5: ...
13,333
03fce57cd06a930017a4f82fe101a6b59a4c6b88
#!/usr/bin/env python PACKAGE = 'amr_localization' NODE = 'pose_likelihood_server' import roslib roslib.load_manifest(PACKAGE) import rospy import tf import numpy as np import math from sensor_msgs.msg import LaserScan from geometry_msgs.msg import PoseStamped, Pose2D from amr_srvs.srv import GetMultiplePoseLikeliho...
13,334
490a90a7dac2e2bd9fc33f153cb70e43a207090a
from typing import Any, Optional from abc import ABC from fastapi import HTTPException from fastapi.responses import JSONResponse from pydantic import BaseModel from src.api.responses.error.error import BaseErrorResponse from src.api.responses.error.r_404_not_found import BaseNotFound, UserNotFound class MyBaseHttp...
13,335
4c5d710705cba19d5566943f10fedfe61a857b8d
from __future__ import unicode_literals from wtforms import BooleanField, StringField from wtforms.fields.html5 import EmailField from wtforms.validators import DataRequired, Email from fossir.util.i18n import _ from fossir.web.forms.base import fossirForm from fossir.web.forms.validators import UsedIfChecked from ...
13,336
7861c7790728c1c11c164aee2af089961f5b38ae
#!/usr/bin/env python from flask import render_template from utility import get_mongodb_connection class Subscription(): def __init__(self, number, body, timestamp, latitude=None, longitude=None): self.number = number self.body = body self.timestamp = timestamp if latitude is None and body is not None: s...
13,337
b412c9afd05294a72414c3eb1f93e5113a2f8606
#! /usr/bin/python # -*- encoding: utf-8 -*- import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Parameter from models.ResNetBlocks import * class x_vector_model(nn.Module): def __init__(self, numSpkrs=5994, p_dropout=0.05): super(x_vector_model, self).__init__() ...
13,338
214979437405db8529eded3a47b4e3a2df3f1568
from django import template from django.utils.safestring import mark_safe register = template.Library() @register.filter(name='lookup') def lookup(d, key): return d[key] @register.filter(name='getContentFromJsonSolrResult') def getContentFromHiglights(d, key): data=d[key] return mark_safe(d[key]["content...
13,339
7062148e8e4b2237800420425a0d90fd3ef20a4e
# Generated by Django 2.0 on 2018-10-15 21:05 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('writers', '0022_auto_20181015_1216'), ] operations = [ migrations.CreateModel( name='AssignmentFi...
13,340
1dcfcbecf3380b4f3f240647596f6eb3b7098ff6
from .Spixel_single_layer import *
13,341
2f1452384511490b4edf3129e88cebf1f1194be7
import re from ansiblelater.standard import StandardBase from ansiblelater.utils import count_spaces class CheckBracesSpaces(StandardBase): sid = "ANSIBLE0004" description = "YAML should use consistent number of spaces around variables" helptext = "no suitable numbers of spaces (min: {min} max: {max})" ...
13,342
2a6cf6b77d295b7715c1b101d85da83a6e66a54a
import os from pathlib import Path def get_last_modified(folder_path: Path): ''' Findest the last modified file in a folder. :param folder_path: Path to the folder :return: newest_file: the file name of the newest_file_date: the date the file was last modified in seconds in epoch ''' files = os.listdir(fold...
13,343
11b0cf636a9591f1501b16ddd05214861c1da1d9
# -*- coding: utf-8 -*- __author__ = 'Bernard Kuehlhorn' __email__ = 'bkuehlhorn@acm.org' __version__ = '0.0.1'
13,344
fa96c5ce1dd135a16932f13023d852020fca2699
import numpy as np class LogReg: def __init__(self, param_niter=1000, param_delta=0.5): self.param_niter = param_niter self.param_delta = param_delta def sigmoid_array(self, x): return 1 / (1 + np.exp(-x)) def logreg_train(self, X, Y_): w = np.random.randn(len(X[0])) ...
13,345
136c32025878eac3df6e164d74ffdc2f376ec3e8
# Generated by Django 3.0.8 on 2020-08-13 20:19 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('recipes', '0004_auto_20200813_0848'), ] operations = [ migrations.CreateModel( name='Unit', ...
13,346
86ccc7f2c5c24de9b217110911014d8993c65c72
#-*- coding: utf-8 -*- import sys reload(sys) sys.setdefaultencoding('utf-8') import csv with open('egg.csv', 'wb') as csvfile: spamwriter =csv.writer(csvfile, delimiter=' ', quotechar='|', quoting =csv.QUOTE_MINIMAL) spamwriter.writerow(['Spam']*5+['Baked Beans']) spamwriter.writerow(['Spam', 'Lovely Spam...
13,347
7a120fa69a6b9119d6a1146c516a382959d4f9d2
# -*- coding: utf-8 -*- import ast, sys from typing import Set import astunparse def ast_error(msg: str, ast_node): print("({},{}): {}".format(ast_node.lineno, ast_node.col_offset, msg), file=sys.stderr) sys.exit(1) class CallGraphNode: def __init__(self): self.is_device = False @pr...
13,348
9e7898e3adcebc02e6d025b32e126e955d130895
import boto3 session = boto3.session.Session() #Endpoint information endpoint_url = "http://objects007.scalcia.com" access_key = "jOMpFFvMMw7un0UxBXRP2EhcVjkGza8n" secret_key = "pzdBtAhr6Ak_o7IkfSavlxfhMSVMUUaL" #Bucket, Objectname bucket = "testbucket" key = "employee_stats.txt" #Connect to your Objects endpoint. s...
13,349
c01d76f395310a27fef665e137f786cba58144c5
from pyramid.view import view_config from pyramid.httpexceptions import HTTPFound from pyramid.security import authenticated_userid from pyramid.compat import escape from phoenix.twitcherclient import generate_access_token from phoenix.esgf.slcsclient import ESGFSLCSClient class Actions(object): def __init__(sel...
13,350
38dc9e6ec8e94360a102c6c450f027b45b65fb92
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import render, get_object_or_404 from django.http import HttpResponse, HttpResponseRedirect, StreamingHttpResponse from anthony_bi.sql import Order_info, NewTable from json import dumps as encodeJSON import random from datetime imp...
13,351
6008458cba1bcb94f89353d94997724252c6220d
""" https://leetcode.com/problems/maximum-subarray/#/description Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2 , 1, -3, 4, -1, 2, 1, -5, 4], the contiguous subarray [4,-1,2,1] has the largest sum = 6. explanation: you keep on...
13,352
e031d3a4be69022d6eab74478d0257e18017da2f
import os basedir = os.path.abspath(os.path.dirname(__file__)) DB_NAME = "cuisina_db" DB_HOST = "127.0.0.1" DB_USERNAME = "root" DB_PASSWORD = "abonitalla123" SECRET_KEY = "cuisinaDB"
13,353
1a57798e4dc24856847a47e1c263de07b81f5e9b
from flask import Flask, request, render_template from flask_sqlalchemy import SQLAlchemy from sqlalchemy import update from datetime import datetime import hashlib app= Flask(__name__) app.config.from_pyfile('config.py') from models import db from models import Productos, Pedidos, ItemsPedidos, Usuarios ...
13,354
a00b946f2e56fa13c13c0efc2534840aa4093eef
""" This file will contain functions that will fetch data from and write into xml files from the "data" directory. So far the data is in the form of py modules and the functions respect that. In the future the data will be converted to xml and these functions should be modified acordingly. """ import data.characters ...
13,355
4d3ba1ca0e7a7f747e7b7f8ee359133ca12337dc
../../../lib/lv_bindings/driver/esp32/ili9XXX.py
13,356
ae5337f39611bad656682452a094c890272a81d0
import os import csv from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session, sessionmaker # Check for environment variable if not os.getenv("DATABASE_URL"): raise RuntimeError("DATABASE_URL is not set") # Set up database engine = create_engine(os.getenv("DATABASE_URL")) db = scoped_sessio...
13,357
ced2fdd8ae5bf1bbd66a1b957d77360deb006a26
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta content="text/html; charset=UTF-8" http-equiv="content-type" /> <title>Lab 5-Shruti Charu...
13,358
b8537e06f056680a409c10efb7dade229ac93a65
""" tipsy.py -- This is a Flask-based to-do list """ from flask import Flask, render_template, request import model app = Flask(__name__) @app.route("/") def index(): return render_template("index.html", user_name="Angie") @app.route("/tasks") def list_tasks(): return render_template("list_tasks.html") @app...
13,359
b460e4ca571177e3105b907114215f3be1929a66
#coding:utf-8 import urllib,urllib2 url='http://translate.google.cn' data={'sl':'zh-CN','tl':'en','js':'n','prev':'_t','hl':'zh-CN','ie':'UTF-8','text':'你好'} data=urllib.urlencode(data) header={'User-Agent':'chrome/28.0'} req=urllib2.Request(url,data,header) response=urllib2.urlopen(req).read() response=unicode(respons...
13,360
04ac93f3c9d6d2b9aa9dbe1eecc5d36d5c57d6e6
# 3 lines: For loop, built-in enumerate function, new style formatting friends = ['john', 'pat', 'gary', 'michael'] for i, name in enumerate(friends): print("iteration {iteration} is {name}".format(iteration=i, name=name))
13,361
fd8bae747c78cd62151152984122e38e51c90acd
import itertools import math def is_path(pathList): gridSize = len(pathList)//2 # start at top left x = 0 y = 0 count = 0 for step in pathList: count += 1 if step == 'R': x += 1 elif step == 'D': y += 1 if (x>gridSize) or (y>gridSize): ...
13,362
a3812e02c921b4ae707b4789491c24438d538d48
class Averages: def __init__(self, localbitcoin, yadio, dolartoday_usd, dolartoday_btc): self.localbitcoin = localbitcoin self.yadio = yadio self.dolartoday_usd = dolartoday_usd self.dolartoday_btc = dolartoday_btc
13,363
b8962adcc645768ffedc39742c4720e5e00c5f84
import os import threading import yaml import json import hashlib import datetime import shutil import argparse import socket import BaseHTTPServer import SimpleHTTPServer import httplib import logging, logging.handlers import socket from threading import Thread, Event from time import sleep from flask import (Flask,...
13,364
98d60104d98fcf64d319e9bc086866add13c53d9
import tensorflow as tf import tensorflow.contrib.layers as tcl # subpixel CNN layer (proposed in subpixel: A subpixel convolutional neural netowrk) def PhaseShift(x, r): # x: input tensor, r: magnification value bsize, h, w, ch = x.shape.as_list() assert ch%(r**2) == 0, 'input channel should be multiplies of...
13,365
4cc6420cfe25c656663578b27e464bc5da58c106
import boto3 import botocore.exceptions import json import re import datetime from decimal import Decimal from boto3.dynamodb.conditions import Key def exception(e): # Response for errors status_code = 400 return { 'statusCode': status_code, 'body': json.dumps({'errorMessage' : str(e)}) ...
13,366
82a6589efc6802b11f26c847b863b41fab209116
#!/usr/bin/python3 # # Copyright (C) 2022 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # the GNU General Public License v.2, or (at your option) any later version. # This program is distributed in the h...
13,367
8f5ede68f728f6fc160dd058ea87cb6b4e50794e
""" 给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。   进阶: 尽可能想出更多的解决方案,至少有三种不同的方法可以解决这个问题。 你可以使用空间复杂度为 O(1) 的 原地 算法解决这个问题吗?   示例 1: 输入: nums = [1,2,3,4,5,6,7], k = 3 输出: [5,6,7,1,2,3,4] 解释: 向右旋转 1 步: [7,1,2,3,4,5,6] 向右旋转 2 步: [6,7,1,2,3,4,5] 向右旋转 3 步: [5,6,7,1,2,3,4] 链接:https://leetcode-cn.com/leetbook/read/top-interview-quest...
13,368
b7846e90e59770abe009251d7232f44247a7dfa8
from django import forms from django.contrib.auth.models import User from django.utils.safestring import mark_safe from models import * class TitleInput(forms.TextInput): ''' need some magic javascript and styling to make this work: .combo-container { position: relative; height: 18px; } .combo-conta...
13,369
c0e5a617eda5eae9b47516fb2c0d65543655965a
# pyinstaller filename import speaker.cli speaker.cli.main()
13,370
b6ae65588abfd7e38c568136d34a6793c4778bc5
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : Tom.Lee # @File : bootstrap_app.py # @Docs : main from flaskapp import app if __name__ == "__main__": app.start() # app.start(port=5258, debug=False)
13,371
021dc45e12010355b1d1111aba3b102015361b82
from infi.clickhouse_orm import migrations from ee.clickhouse.sql.person import KAFKA_PERSONS_DISTINCT_ID_TABLE_SQL, PERSONS_DISTINCT_ID_TABLE_MV_SQL from posthog.settings import CLICKHOUSE_CLUSTER operations = [ migrations.RunSQL(f"DROP TABLE person_distinct_id_mv ON CLUSTER {CLICKHOUSE_CLUSTER}"), migration...
13,372
e986e68026879a41a6dbab2be1dfd650a1c3a3e0
import speech_recognition import tensorflow as tf import keras
13,373
05199c5bbd403ee17f137c3307423f2a76560daa
# Project Name: COVID-19 Care: Face Mask and Social Distancing Detection using Deep Learning # Author List: Nikhil Joshi # Filename: views.py # Functions: homepage_view(request), login_view(request), logout_view(request), register_view(request), about_us_view(request), contact_us_view(re...
13,374
0bbc094c6caad67ed138a9212b0a72b171914ade
# Assignment 4 for CSC401 Python import functools from Circle import Circle # Function One(list of strings) # Take a list of strings as a parameter and return all unique strings def function_one(string_list): unique_list = [] unique = True for x in range(len(string_list)): string_test = string_list...
13,375
9fb9ad4cc1c36b7458633e2e9da187757669166c
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2017-10-13 18:53 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('myapi', '0005_placeorder_placesearch'), ] operations ...
13,376
4d740dfcee347e030bee4dcb3af696e519b61b4a
# -*- coding: utf-8 -*- """ Created on Tue May 26 00:33:58 2020 @author: Han """ import numpy as np import scipy.optimize as optimize from tqdm import tqdm from utils.helper_func import softmax def fit_dynamic_learning_rate_session(choice_history, reward_history, slide_win = 10, pool = '', x0 = [], fixed_sigma_bia...
13,377
88c318beb64236c6d6d21e2f13b15fd42745f13b
from MicroTokenizer import dag_tokenizer dag_tokenizer.graph_builder.build_graph("知识就是力量") dag_tokenizer.graph_builder.write_graphml("output.graphml")
13,378
dcdb6c2f3d09aabc0b69018e4d311bd4b1b8cff1
print('crypto{biclique}')
13,379
d84a05157e5e5b42ef3469061241e6b59d301034
def mediapopulacao(salario,quantidadefilhos): somatorio=0.0 contador=0 for i in range(len(salario)): somatorio+=salario[i] contador+=quantidadefilhos[i] mediapopular=somatorio/contador return mediapopular def mediafilhos(quantidadefilhos,i): somatorio=0.0 for j in range (0,l...
13,380
a051adbb49e90a9474616c8a1835f96a85bc0876
''' Swap the channel of green and alpha for images exported from mali graphics debugger with texture format as rgba4444 Usage: python swapPngChannels.py ''' import os from PIL import Image if __name__ == "__main__": curDir = os.path.dirname(os.path.realpath(__file__)) processFiles = [] for (dirname, ...
13,381
2449c9e233c7bb8b5509d6fa628055d679b70e48
# *- coding: utf-8 -*- # ================================= # time: 2020.7.28 # author: @tangzhilin(Resigned) # function: 数据特征工程 # update: 8.18日 更改了数据的连接方式 # update: 9.08日 依照新的标签数据标准更改了代码 # ================================= import pandas as pd import numpy as np import re import jieba import jieba.analyse import warni...
13,382
75aa706fb750b8f3b10f85d0797ada2feac394f3
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='LogEvent', fields=[ ('id', models.AutoField(ser...
13,383
0fcf28a1944be3bce49ae820ae48de01916d6f81
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) while True: GPIO.setup(13, GPIO.OUT, initial=GPIO.LOW)
13,384
6f5977687e33ffa0280e67f8b11e0386ec4f9fe0
# coding: utf-8 # In[ ]: from torch.utils.data import Dataset, DataLoader import os import torchvision import torch import torchvision.transforms as transforms import torch.nn as nn import torch.nn.functional as F from torchvision.models import resnet18, alexnet import PIL from torchlars import LARS import cv2 impo...
13,385
87f9935695c845dc68248bd4b3d3867e3e7c3124
from django.db import models from django.contrib.postgres.fields import ArrayField, JSONField from django.conf import settings from courses.models import Section from .validators import coursebin_validator, preference_validator, setting_validator from copy import deepcopy # Create your models here. def createDefault...
13,386
232e3c2bb3bc883579acd62a1cf44d29245c27f8
import sys print("Float value information: ", sys.float_info) print("Integer value information: ", sys.int_info) print("Maximum size of an integer: ", sys.maxsize)
13,387
9e406c7065f493f987d9d8f7d4a6e3d2bff18ede
from myChecks.checkov.terraform.context_parsers.parsers import *
13,388
e32865e468a86383268583280f682a31d4f396d9
# binary route table import struct import socket def bin_iter(i, start_bit, end_bit): while start_bit > end_bit: start_bit -= 1 yield (i >> start_bit) & 1 def ip2int(ip_str): return struct.unpack('!I', socket.inet_aton(ip_str))[0] def ip6int(ip6_str): high64, low64 = struct.unpack('!QQ', ...
13,389
ffb6f2da3262c10d21621adf6f06eb2576c88800
def rope(n): if n <= 0: return 0 else: return 1 + rope(n-1) + rope(n-2) + rope(n-5) print(rope(5))
13,390
8559afa6ef9f4a3132cc80c76ae748dd24a990b4
import common lines = common.read_file('2020/05/data.txt').splitlines() lines = list(map(lambda x: x.replace('F', '0').replace('B', '1').replace('L', '0').replace('R', '1'), lines)) nums = list(map(lambda x: int(x, base=2), lines)) # part 1 max_id = max(nums) print(max_id) # part 2 for i in range(min(nums), max(nums...
13,391
5a9b816e556e0bb9b9cb95484cb271a1cbf7b66f
import numpy as np import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func from flask import Flask, jsonify engine = create_engine("sqlite:///Resources/hawaii.sqlite") # reflect an existing database into a new model Base = autom...
13,392
3149591f5d319fe87b6f1a05bbb298e33a7bbe16
from turtle import * shape("turtle") for x in range(6): for i in range(360): forward(2) left(1) left(45) speed(0) mainloop()
13,393
3a87ae5526ccd74fef89173f8c83d1730076a8a3
import sys from pizzabot.pizzabot import Pizzabot from pizzabot.map import Map from pizzabot.input_string_parser import InputStringParser from pizzabot.console_output import ConsoleOutput from pizzabot.sign_num_navigator import SignNumNavigator if __name__ == '__main__': pizzabot = Pizzabot( InputStringPa...
13,394
d036141e2a00442a5c930a5d47f445b3c0197308
kredi1 = "hızlı kredi" kredi2 = "maaşını halkbank alan" kredi3 = "mutlu emekli" print(kredi1) print(kredi2) print(kredi3) krediler = ["hızlı kredi","maaşını halkbank alan","mutlu emekli"] for kredi in krediler: print(kredi)
13,395
179d76a05387b38536fb45a3235005479ab38d5a
#============= enthought library imports ======================= #============= standard library imports ======================== import time #============= local library imports ========================== from src.scripts.core.script_helper import smart_equilibrate#, equilibrate from src.scripts.core.core_script im...
13,396
ff4a7f9d5984d7de65fc26b008011cd4da515fcc
from telegram.ext import CommandHandler from ..language import get_text def start_callback(update, context): text = get_text("start", context) update.message.reply_text(text) start = CommandHandler("start", start_callback)
13,397
2a35c2aa2a5c4df1fd11bb222f390ee2d33bf5f0
import sys def find_dist(records): x_0, y_0 = records[0] dist = 0 for i in range(1, len(records)): x_1, y_1 = records[i] dist += ((x_0 - x_1)**2 + (y_0 - y_1)**2)**(1/2) x_0, y_0 = x_1, y_1 return dist n_t = sys.stdin.readline().split() n = int(n_t[0]) t = float(n_t[1]) actua...
13,398
3da87b39e20c42601fbdcd893d2a642a65da239c
""" 把只包含质因子2、3和5的数称作丑数(Ugly Number)。例如6、8都是丑数,但14不是,因为它包含质因子7。 习惯上我们把1当做是第一个丑数。求按从小到大的顺序的第N个丑数。 """ class Solution: def GetUglyNumber_Solution(self, index): if not index: return 0 ugly_number = [1] * index next_index = 1 index2 = 0 index3 = 0 index5 =...
13,399
c34fd9577a31946e778aa665a17e238ac2a4ceeb
# adding a comment list1 = list("hello") print(list1)