index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
5,200
ee7c63f36b4720566389826680b90c6f68de85b2
#! /usr/bin/env python3 """Publishes joint trajectory to move robot to given pose""" import rospy from trajectory_msgs.msg import JointTrajectory from trajectory_msgs.msg import JointTrajectoryPoint from std_srvs.srv import Empty import argparse import time def argumentParser(argument): """ Argument parser """ pa...
5,201
8bf0141cee2832134d61e49652330c7d21583dcd
from __future__ import absolute_import from __future__ import division from __future__ import print_function from abc import ABCMeta, abstractmethod import numpy as np from deeprl.trainers import BaseTrainer from deeprl.callbacks import EGreedyDecay from deeprl.policy import EGreedyPolicy class BaseDQNTrainer(BaseT...
5,202
898ff6e38e80419d61ec4bbde827e8ca729eb19a
from cache_replacement.double_linked_list import DoubleLinkedList from cache_replacement.node import Node class LRUCache: def __init__(self, capacity): self.capacity = capacity self.size = 0 self.cache_map = {} self.cache_list = DoubleLinkedList(capacity=capacity) def get(self...
5,203
f96a7bef48e7df2899343029a2fae9697125a5b2
# Generated by Django 2.2.6 on 2020-06-18 14:16 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('gestionadmin', '0133_auto_20200618_1339'), ] operations = [ migrations.RemoveField( model_name='comprasenc', name='empleado'...
5,204
d9f08e770dacaa86a03d553afd78fdcd725efb62
"""""" import random import nbformat from textwrap import dedent from pybryt.preprocessors import IntermediateVariablePreprocessor def test_preprocessor(): """ """ nb = nbformat.v4.new_notebook() nb.cells.append(nbformat.v4.new_code_cell(dedent("""\ a = True b = False f = la...
5,205
6d543e9e24debaff7640006a3836c59ec0096255
#H############################################################## # FILENAME : rec.py # # DESCRIPTION : # Classifies text using defined regular expressions # # PUBLIC FUNCTIONS : # int processToken( string ) # # NOTES : # This function uses specific critera to classify # Criteria desc...
5,206
7346992d69250240207a0fc981d0adc245e69f87
def calcula_norma(x): lista=[] for e in x: lista.append(e**2) v=(sum(lista)**(1/2)) return v
5,207
00d2a29774a4278b1b022571b3f16c88224f08fc
import requests from lxml import html headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36'} mail_ru_link = "http://mail.ru" lenta_link = "https://lenta.ru/" req = requests.get(mail_ru_link, headers=headers).text root = html....
5,208
3596ef12ce407a8d84319daa38a27a99ed0de763
''' Author: Dustin Spicuzza Date: 3/22/2012 Description: This mode only feeds another robot, does not move or anything ''' class FeedOnlyAutonomousMode(object): # this name should be descriptive and unique. This will be shown to the user # on the SmartDashboard MODE_NAME = ...
5,209
496d52a984bb8c0e72948ab0c8db5e6035427a68
#returns true if given date is a leap year, false otherwise def is_leap_year(date): #if divisible by 400, definitely a leap year if date % 400 == 0: return True #if divisible by 100 (and not 400), not a leap year elif date % 100 == 0: return False #divisible by 4 and not by 100? leap year elif date % 4 == 0: r...
5,210
7fdddf98fc7b588e9b8816ffa22bc24f715d7efe
class Solution(object): def isIsomorphic(self, s, t): """ :type s: str :type t: str :rtype: bool """ n1 = len(s) n2 = len(t) if n1 != n2: return False else: map1 = {} map2 = {} for i in range(n1):...
5,211
03aa33861def30a46de85c5b309878a1180a760f
contador_pares = 0 contador_impares = 0 for i in range(100): numero = int(input('Digite um valor:')) if numero % 2 == 0: contador_pares += 1 else: contador_impares += 1 print('A quantidade de números pares é igual a:',contador_pares) print('A quantidade de números ímpares é ig...
5,212
e70c25ce1d61437aacfe7fad0a51e096e1ce4f5d
__all__ = ['language'] from StringTemplate import *
5,213
c52ad4040c14471319939605c400ff4d4ad982a7
# Stanley H.I. Lio # hlio@hawaii.edu # All Rights Reserved. 2018 import logging, time, sys from serial import Serial from . import aanderaa_3835 from . import aanderaa_4330f from . import aanderaa_4531d from . import aanderaa_4319a logger = logging.getLogger(__name__) # works with 3835 (DO), 4330F (DO), 4531D (DO),...
5,214
ab6c3d3c6faa2d1fe5e064dbdebd8904b9434f15
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 14 09:54:28 2020 @author: rushirajsinhparmar """ import matplotlib.pyplot as plt from skimage import io import numpy as np from skimage.filters import threshold_otsu import cv2 img = io.imread("texture.png", as_gray=True) #######################...
5,215
a53d7b4c93fa49fb0162138d4a262fe7a5546148
import requests import os from bs4 import BeautifulSoup from urllib.parse import urljoin CURRENT_DIR = os.getcwd() DOWNLOAD_DIR = os.path.join(CURRENT_DIR, 'malware_album') os.makedirs(DOWNLOAD_DIR, exist_ok=True) url = 'http://old.vision.ece.ucsb.edu/~lakshman/malware_images/album/' class Extractor(object): "...
5,216
f3b466dc5b6149be82b096791ca8445faf169380
# Generated by Django 3.2 on 2021-05-03 17:13 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('orders', '0005_alter_orderitem_price'), ] operations = [ migrations.AddField( model_name='order', name='being_delivere...
5,217
7e1dd242c60ee12dfc4130e379fa35ae626a4d63
#!/usr/bin/env python3 data = None with open('./01-data.txt') as f: data = f.read().splitlines() ss = {} s = 0 ss[s] = True def check(data): global ss global s for line in data: s += int(line) if ss.get(s, False): return s ss[s] = True return None v = chec...
5,218
73d056d4ab0d268841156b21dfc2c54b5fb2f5f1
"""Support for binary sensor using I2C abelectronicsiopi chip.""" from custom_components.abelectronicsiopi.IOPi import IOPi import voluptuous as vol from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity from homeassistant.const import DEVICE_DEFAULT_NAME import homeassistant.help...
5,219
b83310c18294def950cef6710c7644c7e8a3208f
# #Create a function that takes a text file and returns the number of words # ___ count_words filepath # w.. o.. ? ? __ file # read # strng = ?.r.. # strng_list = ?.s.. " " # r.. l.. ? # # print ? "words1.txt"
5,220
b9cce77d4d2b9ff5563d17927e21166f9c870e3d
from os.path import abspath, dirname, join, basename import numpy as np import cv2 import xiuminglib as xm logger, thisfile = xm.config.create_logger(abspath(__file__)) class EXR(): """Reads EXR files. EXR files can be generic or physically meaningful, such as depth, normal, etc. When data loaded are p...
5,221
c1374a048187807deac5d28dda4fbc7beeccf8f5
import pygame as pg screen = pg.display.set_mode((640, 380))
5,222
eedd909e777a4127b5fd55108805314b3b196dd1
import sys import memo from StringIO import StringIO import inspect alternate_dict = {} alternate_dict['cartesian_to_polar'] = ['cartesian_to_polar','cartesianToPolar','cartesion_to_polar','Polar_Coordinates'] alternate_dict['mercator'] = ['mercator','mercator_projection','mecartor','Mercator','Mercator_projection'] ...
5,223
86c03fa85ac405a148be13325efeaaf691d9ec26
#!/usr/bin/env python def get_attachment_station_coords(station): if (station == "gripper1"): coords = [0.48, 0.05, 0.161] elif (station == "gripper2"): coords = [0.28, 0.05, 0.13] elif (station == "syringe"): coords = [0.405, 0.745, 0.213] else: coords = [0.0, 0.0, 0.0]...
5,224
8640de519ebf7f95588ac40b55662da85ffc926e
import urllib from django.shortcuts import render, redirect, get_object_or_404 from django.contrib import messages from django.utils.translation import gettext as _ from .forms import CountryForm from .models import Countries from django.utils.timezone import datetime from django.contrib.auth.decorators import login_re...
5,225
bda28e5a0cb8a3dddea58c9c59a165b31274ac03
"""AOC Day 13""" import pathlib import time TEST_INPUT = """6,10 0,14 9,10 0,3 10,4 4,11 6,0 6,12 4,1 0,13 10,12 3,4 3,0 8,4 1,10 2,14 8,10 9,0 fold along y=7 fold along x=5""" def read_input(input_path: str) -> str: """take input file path and return a str with the file's content""" with open(input_path, '...
5,226
b80b997f802c7ed4f0a838030703a314f2383c9d
import pygame from clobber.constants import GREY, ROWS, WHITE, SQUARE_SIZE, COLS, YELLOW, BLACK from clobber.piece import Piece class Board: def __init__(self): self.board = [] self.selected_piece = None self.create_board() def draw_squares(self, win): win.fill(GREY) ...
5,227
bd6c72c3215265a349c5f47573063a9288f64198
from django.shortcuts import render from rest_framework import status from rest_framework.decorators import api_view, renderer_classes from rest_framework.renderers import BrowsableAPIRenderer, JSONRenderer from rest_framework.response import Response from feedback.models import Feedback from feedback.serializers impor...
5,228
ea323a8398ceff8496e7f8d0f365d50f3115e954
from django.contrib import admin # from .models import Product, Client from .models import Board admin.site.register(Board) # admin.site.register(Product) # # admin.site.register(Price) # admin.site.register(Client) # # Register your models here.
5,229
d2632461fcdc39509610b96d43dd1ec42dae362f
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt __author__ = 'alexglenday' def group(list_df: list, df_col_index: int=0, seaborn_context: str='poster'): sns.set_context(seaborn_context) df_labels = [] for df in list_df: df_labels.append(df.columns[df_col_index]) df_al...
5,230
a0a6bd5de39a7599f7872639cdf3a59b8cda5498
from processing.DLDataEngineering import DLDataEngineering from sklearn.preprocessing import OneHotEncoder import pandas as pd import numpy as np import h5py import os from scipy.ndimage import gaussian_filter #Deep learning packages import tensorflow as tf #from tensorflow import keras from tensorflow.keras...
5,231
56ed5bb22d77f4d8c061f97d832a60ed9a106549
from trac.db import DatabaseManager def do_upgrade(env, ver, cursor): """Change schema name from taskboard_schema to agiletools_version """ cursor.execute('UPDATE system SET name=%s WHERE name=%s', ("agiletools_version", "taskboard_schema"))
5,232
0cec92bbfad87020baf5ef1bd005e64bc9a6ed01
# @Author: Chen yunsheng(Leo YS CHen) # @Location: Taiwan # @E-mail:leoyenschen@gmail.com # @Date: 2017-02-14 00:11:27 # @Last Modified by: Chen yunsheng import click from qstrader import settings from qstrader.compat import queue from qstrader.price_parser import PriceParser from qstrader.price_handler.yahoo_dai...
5,233
dad78d7948fb1038f9cf66732f39c18a18f2a3c8
from microbit import * import speech while True: speech.say("I am a DALEK - EXTERMINATE", speed=120, pitch=100, throat=100, mouth=200) #kokeile muuttaa parametrejä
5,234
0926606a222e1277935a48ba7f0ea886fb4e298a
from faker import Faker from generators.uniform_distribution_gen import UniformDistributionGen from generators.random_relation_gen import RandomRelationGen from base.field_base import FieldBase from generators.normal_distribution_gen import NormalDistributionGen from generators.first_name_generator import FirstNameGene...
5,235
cdc32e7c767097a0eb0def71e55f0276982d6a96
#!/usr/bin/env python # coding: utf-8 # In[19]: import numpy as np import pandas as pd class simple_nn(): ''' This is simple nn class with 3 layers NN. In this class additional layer was added to the original layers from notebook given by Julian Stier and Sahib Julka. Moreover those functions were...
5,236
8ae64c65d6d5dc9f2a99aeceff31657deff06c15
import sys import os sys.path.append(os.pardir) from ch03.softmax import softmax from ch04.cross_entropy_error_batch import cross_entropy_error import numpy as np class SoftmaxWithLossLayer: """ x -> [Softmax] -> y -> [CrossEntropyError with t] -> out In the textbook, this class has `loss` field. """...
5,237
aa2e24d80789f2a6ebd63ec42a17499f1e79ca49
def guguPrint(n): print('*' * 30) for i in range(1, 10): print('{} X {} = {}'.format(n, i, n * i)) if __name__ =="__main__": print('Main으로 실행되었음')
5,238
7127df5515e93e27b431c57bec1709475fec8388
#!/usr/bin/env python # set up parameters that we care about PACKAGE = 'jsk_pcl_ros' from dynamic_reconfigure.parameter_generator_catkin import *; from math import pi gen = ParameterGenerator () gen.add("segment_connect_normal_threshold", double_t, 0, "threshold of normal to connect clusters", 0.9, 0.0, 1.0...
5,239
358a4948ac1f60e0966328cebf401777042c3d0e
from app.routes import home from .home import bp as home from .dashboard import bp as dashboard
5,240
9e6fd6620b4ec6a574d7948fb0d14b0a2ad0d24e
# -*- coding: utf-8 -*- u"""Hellweg execution template. :copyright: Copyright (c) 2017 RadiaSoft LLC. All Rights Reserved. :license: http://www.apache.org/licenses/LICENSE-2.0.html """ from __future__ import absolute_import, division, print_function from pykern import pkcollections from pykern import pkio from pyker...
5,241
b0064a5cd494d5ad232f27c63a4df2c56a4c6a66
# -*- coding: utf-8 -*- # Generated by Django 1.9.1 on 2016-10-28 17:50 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ ] operations...
5,242
07cce6802ab3259dbc78ab86a8dd6d6a4a617c7e
from django.db import models # Create your models here. class Remedio(models.Model): nome = models.CharField(max_length=100, unique=True, help_text='Nome') valor = models.FloatField(null=False, help_text='Valor') detalhe = models.CharField(max_length=500, null=True) foto = models.ImageField(upload_to='...
5,243
e976f7e423d75f7fc8a3d5cd597bdd9358ae317e
from flask import logging from flask_sqlalchemy import SQLAlchemy from passlib.apps import custom_app_context as pwd_context logger = logging.getLogger(__name__) db = SQLAlchemy() # flask-sqlalchemy class User(db.Model): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) username = db...
5,244
87c200796e1fac508a43e899c0ed53878b8c1d88
from Smooth import smoothing def n_grams(unigramsFile, bigramsFile, parameterization, sentences): words = [] param = [] unigrams = [] bigrams = [] with open(parameterization) as p: #Parametrization file data = p.read().split() word = data[0] param.append(data[1]) pa...
5,245
2c4eb07a32c6903ae31006f42c13c55e6cc42eb5
__version__ = "alph 1.0"
5,246
5810739300067e8f207d09bf971484a278372a9a
"""asks the user for english words to latinize""" def latinize_word(word): """performs bee latin on a word""" if word[0].lower() in 'bcdfghjklmnpqrstvwxyz': word = word[1:] + word[0] + 'uzz' else: word += 'buzz' return word.lower() def latinize_sentence(sentence): """performs bee...
5,247
1a4132358fa9bd4cd74970286ec8bb212b1857cd
from __future__ import absolute_import, print_function from django.db import models from django.utils import timezone from sentry.db.models import ( Model, BaseManager, UUIDField, sane_repr, ) class MonitorLocation(Model): __core__ = True guid = UUIDField(unique=True, auto_add=True) nam...
5,248
74dd9151195fef41862c2793621172518f1f486d
from django.shortcuts import render,redirect from .forms import UserRegisterForm, IsEmri ,TestForm,PDF_Rapor from django.contrib import messages from django.contrib.auth import authenticate, login ,logout from django.http import HttpResponseRedirect, HttpResponse ,JsonResponse from django.urls import reverse from djang...
5,249
3e8860c22ff3092304df57aa7f5dbcb6ccda7dd8
from pymongo import MongoClient from modules.linkedinSearch import SearchClass from config import Config class LinkedinSearch: def __init__(self): self.client = MongoClient(Config.MONGO_URI) db = self.client.linkedin_db self.collection = db.search self.dict = {} self.obj ...
5,250
9bd55a2f224acfa2cb34d0ca14a25e8864d644b3
import os, subprocess def greet(name): hostname = subprocess.check_output("hostname").decode("utf-8")[:-1] return "Hello, {}! I'm {}#{}.".format(name, hostname, os.getppid())
5,251
3d01910ae1c163067f4a23b3cca109a7d9e193d5
# -*- encoding: utf-8 -*- class BaseException(object): """ Common base class for all exceptions """ def with_traceback(self, tb): # real signature unknown; restored from __doc__ """ Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self. """ p...
5,252
4a09096abf073294afcf21b1eff9350329d4db33
import json import pika import urllib.request def validate_urls(): connection = pika.BlockingConnection(pika.ConnectionParameters('localhost')) channel = connection.channel() channel.queue_declare(queue='urlValidationQueue') channel.basic_consume(validate_url, queue='urlValid...
5,253
d40e1cfa2ef43f698e846c25ac9f5471d69e71a0
# Generated by Django 2.2.5 on 2020-01-05 04:05 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='News', fields=[ ('id', models.AutoField(aut...
5,254
45b56103db0a72ebbc7de340c4293e1f70552414
#Проверяем, является ли введенная пользователем строка полиндромом list_1 = input('Enter something: ') list_1_rev = list_1[::-1] if list_1 == list_1_rev: print('You entered a polindrom!') else: print('Your string is not a polindrom')
5,255
4eb3d94a5fd22fc29000ec32475de9cbae1c183a
# OpenWeatherMap API Key api_key = "078c8443640961d5ce547c8269db5fd7"
5,256
2ffd0de2888872cfa664919fcfc54b8e60b03280
#! /usr/local/env python #coding:utf-8 import urllib.request import urllib.error try: urllib.request.urlopen("http://blog.csdn.net/jo_andy") except urllib.error.URLError as e: if hasattr(e,"code"): print(e.code) if hasattr(e,'reason'): print(e.reason)
5,257
7b4c2689ad1d4601a108dd8aa6e3c4d1e9730dc5
#Merge Sort #O(nlogn) #Merge Part from __future__ import division #use for python2 def merge(A, B): #Merge A[0:m], B[0,n] (C, m, n) = ([], len(A), len(B)) (i, j) = (0, 0) #Current positions in A, B while (i + j) < (m + n): #i+j is no. of elements merged so far ...
5,258
240f5e9cbb38f319b6e03b1b7f9cae7655ac4385
""" *** Three Number Sum *** Write a function that takes in a non-empty array of distinct integers and an integer representing a target sum. The function should find all triplets. The numbers in each triplet should be ordered in ascending order, and the triplets themeselves should be ordered in ascending order with re...
5,259
6b2bd6954f188626fa857ffc37611d3f971d22e2
from command import Command, is_command, CommandException from event import Event class ItemInfo(Command): @is_command def item_info(self, player, *args): if len(args) == 0: raise CommandException(CommandException.NOT_ENOUGH_ARGUMENTS) item_id = args[0] if item_id in playe...
5,260
bfcf6e241881c4f668f926e087ab0f7dcad61dee
from django import forms from acl.models import Alert class CreateAlertForm(forms.ModelForm): class Meta: model = Alert exclude = ['role','age_analysis','Date_Uploaded','alias_name','CAMT_Reveiewer','Date_Regularised','alert_message', 'Count2']
5,261
d70d3d8eef711441ac89c2d98c72a5f95e0ab20d
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This script reads in video information frame-by-frame, and then calculates visual edge information for each frame, storing the information in a vector. This can be averaged within TRs in an fMRI analysis to 'regress out' high-frequency visual information in the video. ...
5,262
604c94e50b1fb9b5e451c4432113498410a4ac1f
#!/g/kreshuk/lukoianov/miniconda3/envs/inferno/bin/python3 # BASIC IMPORTS import argparse import os import subprocess import sys import numpy as np # INTERNAL IMPORTS from src.datasets import CentriollesDatasetOn, CentriollesDatasetBags, GENdataset from src.utils import get_basic_transforms, log_info, get_resps_tran...
5,263
9cebce7f97a1848885883692cd0f494cce6bae7f
# Copyright 2019 PerfKitBenchmarker Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
5,264
b1d8a454e590dfa4afa257ca665376c320a4acb5
# Generated by Django 3.0.8 on 2020-07-12 19:05 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('CRUD', '0001_initial'), ] operations = [ migrations.RenameField( model_name='employee', old_name='eAdddress', ne...
5,265
4b5f58d471b05428caef3ca7a3bdc0d30a7e3881
from PrStatusWorker import PrStatusWorker import threading def initialize_worker(): worker = PrStatusWorker() worker.start_pr_status_polling() print("Starting the PR status monitor worker thread...") worker_thread = threading.Thread(target=initialize_worker, name="pr_status_worker") worker_thread.start()
5,266
e4f97018567559fc2714b75654974fb7c51f770f
def phi(n): r = n d = 2 p = n while r > 1: if r % d == 0: p -= int(r/d) while r % d == 0: r = int(r/d) d += 1 return p m = (0, 1) for n in range(2, 1000000): p = phi(n) m = max(m, (n/p, n)) if n % 10000 == 0: print(n) prin...
5,267
9ba74c7ecbd20c59883aff4efdc7e0369ff65daf
# Stubs for binascii # Based on http://docs.python.org/3.2/library/binascii.html import sys from typing import Union, Text if sys.version_info < (3,): # Python 2 accepts unicode ascii pretty much everywhere. _Bytes = Text _Ascii = Text else: # But since Python 3.3 ASCII-only unicode strings are accep...
5,268
102ba5c1cb4beda6f9b82d37d9b343fe4f309cfb
#!/usr/bin/python ########################################################################### # # Copyright 2019 Dell, Inc. # # 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....
5,269
5e7a589af69a604021ed9558fcce721a8e254fee
from .context import mango from solana.publickey import PublicKey def test_token_lookup(): data = { "tokens": [ { "address": "So11111111111111111111111111111111111111112", "symbol": "SOL", "name": "Wrapped SOL", "decimals": 9, ...
5,270
8753996c90ecea685e6312020dfd31fabb366138
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models class ClassMKB(models.Model): name = models.CharField(max_length=512,verbose_name = 'Наименование') code = models.CharField(max_length=20, null=True, blank=True,verbose_name = 'Код') parent_id = models.IntegerFie...
5,271
abcefa0a3312e158517ec8a15421d1d07220da6a
count = int(input()) for i in range(1, count + 1): something = '=' num1, num2 = map(int, input().split()) if num1 > num2: something = '>' elif num1 < num2: something = '<' print(f'#{i} {something}')
5,272
6c5c07dadbe7ec70a210ee42e756be0d710c0993
#!/usr/local/bin/python import cgi import pymysql import pymysql.cursors import binascii import os from mylib import siteLines import threading def checkStringLine(ip, host, pagel, objects, title): onlyIp = ip.split(":")[0] connection = siteLines() with connection.cursor() as cursor: #...
5,273
22c2425f1dc14b6b0005ebf2231af8abf43aa2e1
from flask import Flask, flash, abort, redirect, url_for, request, render_template, make_response, json, Response import os, sys import config import boto.ec2.elb import boto from boto.ec2 import * app = Flask(__name__) @app.route('/') def index(): list = [] creds = config.get_ec2_conf() for region in config.r...
5,274
d29c8ec737b8e962d381c8fdd0999e7e01847836
import sys import psyco sys.stdin = open("/home/shiva/Learning/1.txt", "r") sys.stdout = open("/home/shiva/Learning/2.txt", "w") def compute(plus,minus,total,inp): if plus == 1 and minus == 0: print(total); return elif (plus == 1 and minus == 1): print("Impossible"); return elif (abs(plus-minus) > total): pl...
5,275
479411727de14e8032b6d01cdb844632111af688
import os import argparse from data.downloader import * from data.utils import * from data.danmaku import * from utils import * key = '03fc8eb101b091fb' parser = argparse.ArgumentParser(description = 'Download Video From Bilibili') parser.add_argument('-d', type = str, help = 'dataset') parser.add_argument('-o', ty...
5,276
754b34028780231c7eccb98cdf3e83bd615d843f
import pandas as pd import os from appia.processors.core import normalizer from math import ceil class Experiment: def __init__(self, id) -> None: self.id = id self.version = 4 self._hplc = None self._fplc = None @property def hplc(self): try: return se...
5,277
3bea4413a41a9eecb5e3184d090b646e17892b5c
from typing import List, Tuple test_string = "2 3 0 3 10 11 12 1 1 0 1 99 2 1 1 2" with open('data/day8_input.txt', 'r') as fp: my_string = fp.read() class Node: def __init__(self): self.metadata = list() self.children = list() def checksum(self): return sum([x for x in self.met...
5,278
85ac851e28dba3816f18fefb727001b8e396cc2b
# Алексей Головлев, группа БСБО-07-19 def lucky(ticket): def sum_(number): number = str(number) while len(number) != 6: number = '0' + number x = list(map(int, number)) return sum(x[:3]) == sum(x[3:]) return 'Счастливый' if sum_(ticket) == sum_(lastTicket) else 'Нес...
5,279
e732fa0e2b377a87b8b088303b277cc08cb695b3
from flask import Flask, render_template, request, redirect, flash, session from mysqlconnection import connectToMySQL from flask_bcrypt import Bcrypt import re app = Flask(__name__) bcrypt = Bcrypt(app) app.secret_key = "something secret10" DATABASE = "exam_quote_dash" EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-...
5,280
3d49d03dbc38ee37eadd603b4b464b0e2e1a33d5
import itertools def permutations(string): return list("".join(p) for p in set(itertools.permutations(string)))
5,281
a90db2073d43d54cbcc04e3000e5d0f2a2da4a55
# Generated by Django 2.1.3 on 2020-06-05 23:06 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('index', '0005_userip_serial_number'), ] operations = [ migrations.AddField( model_name='userip', name='ip_attributio...
5,282
f17ae8a44f8b032feac7c18fe39663054fea40c0
import gc import unittest import numpy as np from pydrake.autodiffutils import AutoDiffXd from pydrake.common import RandomDistribution, RandomGenerator from pydrake.common.test_utilities import numpy_compare from pydrake.common.test_utilities.deprecation import catch_drake_warnings from pydrake.common.value import Va...
5,283
50f6bcb4d2223d864cca92778ab3483a2d2c3214
__author__ = 'christopher' import fabio import pyFAI import matplotlib.pyplot as plt from matplotlib.colors import LogNorm from pims.tiff_stack import TiffStack_tifffile as TiffStack from skxray.io.save_powder_output import save_output from xpd_workflow.mask_tools import * geo = pyFAI.load( '/mnt/bulk-data/researc...
5,284
f45313e4e8f3ecba0c7dc0288d9d5ec4e26f0ba6
# Goal: Let's Review # Enter your code here. Read input from STDIN. Print output to STDOUT T = int(input()) # Iterate through each inputted string for i in range(T): even = '' odd = '' s = str(input()) for i in range(len(s)): if (i % 2 == 0): even = even + s[i] else: ...
5,285
7c82565a4184b2e779e2bb6ba70b497cc287af35
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 11 14:55:12 2019 @author: Furankyyy """ import numpy as np import matplotlib.pyplot as plt import timeit ###worst sort function### #define the function that checks whether the list is in ascending order def right_permutation(arr): if len(arr)=...
5,286
e2572b48f7183353ba2aab0500130dc8a71a0b22
# coding: utf-8 # In[50]: ## Description ## Adds the Fibonacci numbers smaller than 4 million ## Weekly Journal ## When using while True, "break" MUST be used to avoid infinite loops ## Questions ## None fib=[1,2] counter=1 while True: if fib[counter]>4000000: flag=0 break else: f...
5,287
e8f05a66c642ef3b570130a2996ca27efb8b0cb5
"""Time client""" import urllib.request import json from datetime import datetime # make sure that module51-server.py service is running TIME_URL = "http://localhost:5000/" def ex51(): with urllib.request.urlopen(TIME_URL) as response: body = response.read() parsed = json.loads(body) date = datet...
5,288
829c833866198307d7d19c4a0cbe40299ee14eb9
from botocore_eb.model import ServiceModel from botocore_eb.exceptions import ParamValidationError from botocore_eb.exceptions import DataNotFoundError from botocore_eb.exceptions import OperationNotPageableError from botocore_eb import xform_name from botocore_eb.paginate import Paginator import botocore_eb.validate i...
5,289
ac6f2287390bdad8fe20cdc73c0063f685970cfb
import sys n = int(input()) min_number = sys.maxsize max_number = -sys.maxsize for i in range(0, n): num = int(input()) if num > max_number: max_number = num if num < min_number: min_number = num print(f"Max number: {max_number}") print(f"Min number: {min_number}")
5,290
7f406c1cd4d56da3a7d5f8739e0b65b0e61cf637
import time # Returns time in seconds for func(arg) to run def time_func(func, arg): start = time.time() func(arg) return time.time() - start
5,291
46e2955756cf1aea902f31685b258ffd14b2e62b
# -*- coding: utf-8 -*- # @Time : 2021/5/12 2:48 下午 # @Author : shaoguowen # @Email : shaoguowen@tencent.com # @FileName: train.py # @Software: PyCharm import argparse from mmcv import Config import trainers # 解析传入的参数 parser = argparse.ArgumentParser(description='Train IVQA model') parser.add_argument('config',...
5,292
cb0b963c0e5aadcb67b5ee5f055fb9b6f21892fc
import pandemic as pd from typing import Sequence def save_gml(path: str, peers: Sequence[pd.Peer]) -> bool: try: with open(path, "w") as file: file.write(graph(peers)) except Exception: return True return False def print_gml(peers: Sequence[pd.Peer]) -> None: print(grap...
5,293
71a5ba520f8bc42e80d8f4ce8cf332bdd5fb96de
/Users/apple/miniconda3/lib/python3.7/sre_constants.py
5,294
a8b5cf45e5f75ae4b493f5fc9bb4555319f1a725
import pytest from moa.primitives import NDArray, UnaryOperation, BinaryOperation, Function from moa.yaccer import build_parser @pytest.mark.parametrize("expression,result", [ ("< 1 2 3>", NDArray(shape=(3,), data=[1, 2, 3], constant=False)), ]) def test_parse_vector(expression, result): parser = build_parse...
5,295
7ab9c530035185ee2250f3f6ce8cde87bdfd9803
from django.conf.urls import url from . import consumers websocket_urlpatterns = [ url(r'^account/home', consumers.NotificationConsumer), url(r'^fund/(?P<fund>[\w-]+)', consumers.NotificationConsumer), url(r'^websockets', consumers.StreamConsumer), ]
5,296
011dd579bb076ec094e9e3085aa321883c484f1c
import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from WeatherDL.data_maker import dataset_maker from WeatherDL.model_maker import model_3 # Extract data from data_maker X, y = dataset_maker(window=5, forecast_day=1) (X_train, X_test, y_train, y_test) = train_test_split(X, y, test_s...
5,297
47f88bc3836490e08f464f71351096b54118420e
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.web_perf.metrics import timeline_based_metric from telemetry.web_perf.metrics.trace_event_stats import TraceEventStats from telemetry.web_per...
5,298
836c1d2083d18c68fe551278d2df4155edc64c8c
import cv2 import numpy as np frameWidth = 640 frameHeight = 480 # capturing Video from Webcam cap = cv2.VideoCapture(0) cap.set(3, frameWidth) cap.set(4, frameHeight) cap.set(10, 150) myColors = [[20,40,40,70,255,255], [100,169,121,135,255,255], [0, 90, 90, 41, 255, 255]] color_value = [[25...
5,299
afccd33e4c6bc5b7907a6af4ab698489fc9ea70d
from meross_iot.model.http.exception import HttpApiError from logger import get_logger from typing import Dict from flask import Blueprint from authentication import _user_login from decorator import meross_http_api from messaging import make_api_response auth_blueprint = Blueprint('auth', __name__) _LOGGER = get_...