index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
985,400
e4684923aef4e6953771a7fd1eb8b1759b40f82a
import os #To find out what files we are using import numpy as np import cv2 filename = 'video.mp4' frames_per_seconds = 30; my_res = '720p' def change_res(cap,width, height): cap.set(3, width) cap.set(4,height) STD_DIMENSIONS = { "480p": (680, 480), "720p": (1280, 720), "...
985,401
cd32651c6cecdc419533e377e44ad4a2aa4ec8cd
from .response_related_utils import * from .response_related_utils import __all__ as response_all from .vector_utils import * from .vector_utils import __all__ as vector_all __all__ = response_all + vector_all
985,402
0311608764e16d1d17c41d17f669eb2e45f7ddab
nested_list = [list(range(1,4)), list(range(4,7)), list(range(8,10))] print(f'{nested_list =}') print(f'{[[single_list for single_list in nested_list] for single_list in nested_list] =}') print(f'{[["X" if num % 2 == 0 else "O" for num in range(1,4)] for num in range(1,4)] =}')
985,403
c7cdb24f635479bf0c24490965866a21520bb061
# Program to determine square root of any given number # Programmer: Mukul Dharwadkar # Date: Apr 15 2020 # Python version 3 def get_number(): response = None while response is None: response = float(input("Please choose a number to find a square root of: ")) return response def create_guess(inp):...
985,404
8f92411cc26a028037a833757c486e5a78c17108
from flask import Flask, render_template, request, url_for from utils import get_prediction, preprocess app = Flask(__name__) @app.route('/', methods=['GET']) def home(): return render_template('index.html') @app.route('/predict', methods=['POST']) def predict(): try: if request.method == 'POST': ...
985,405
ae9752bade86a65f347b33ffbb5c871c68159652
import math #inputFile = open("test.txt", "r") inputFile = open("A-small-attempt1.in","r") output = open("Round1AAsmall.txt","w") cases = int(inputFile.readline()) for case in range(1,cases+1): r, p = map(int, inputFile.readline().strip().split(" ")) m = (r + 1) / 2.0 n = math.floor((0.25 * (m...
985,406
5a100b392f50b9904204d08bbfe5af4c23b2af58
''' 通过sqlite引擎,读取数据库数据 ''' import jieba import pandas import wordcloud import json from sqlalchemy import create_engine path = '/Users/lawyzheng/Desktop/Code/' # 连接数据库 engine = create_engine('sqlite:///' + path + 'spider.db') df = pandas.read_sql('tb_toutiao_hot', con=engine, index_col='index') # 获取文章abstract数据 abst...
985,407
5ff249f8520a70dc07130e36a8020193404072eb
biggest=0 for i in range(999): for j in range(999): product = i*j mystring = str(product) if mystring==mystring[::-1]: if product > biggest: biggest = product print biggest
985,408
2d82ddb4a635293e80d349c2b38b27951e04e590
# https://www.acmicpc.net/problem/2851 문제 제목 : 슈퍼 마리오 , 언어 : Python, 날짜 : 2019-08-14, 결과 : 성공 import sys total_num = 0 last_num = 0 mode = 0 for _ in range(10): total_num += int(sys.stdin.readline()) if mode == 0 and abs(total_num-100) > abs(last_num-100): mode=1 if mode==0: last_num = tota...
985,409
426f221847b24fa4b63984ee95b39e0f9efaf4fb
# Code adapted from Tensorflow Object Detection Framework # https://github.com/tensorflow/models/blob/master/research/object_detection/object_detection_tutorial.ipynb # Tensorflow Object Detection Detector import numpy as np import tensorflow as tf import cv2 import time class DetectorAPI: def __init__(self, pat...
985,410
ca186385bd8da0661118def7d68ad478860b28eb
''' Input: [-2,1,-3,4,-1,2,1,-5,4], Output: 6 Explanation: [4,-1,2,1] has the largest sum = 6. Contiguous subarray (containing at least one number) For ex: [-2, 1], [-3,4,-1] ''' # https://dev.to/13point5/maximum-subarray-3c5l ''' Brute Force Method def maxSubArray(nums): # case SubArray Length = 1 ans = ...
985,411
10a03547d26d9e1161d1728347a8a13b4aa2eb6d
class Solution: def maximum69Number(self, num: int) -> int: s = str(num) if "6" not in s: return num else: i = s.index("6") return num + 3 * (10 ** (len(s) - i - 1)) if __name__ == "__main__": print(Solution().maximum69Number(9669)) # 9969 print...
985,412
e23082acd24f78253cb82995ec563c764655c137
# -*- coding: utf-8 -*- """ The :class:`Control` object is the central part of pyMolDyn. It is responsible for initiating the calculation process and visualizing the results. It contains instances of :class:`core.calculation.calculation.Calculation` and :class:`visualization.visualization.Visualization` and manages the...
985,413
e938e8642dec45bbfb3fbbde2a6951a368b66c29
import pygame from math import * from random import * import numpy as np import sys from time import time from ctypes import * gravity = cdll.LoadLibrary("fGravity.so") calc = gravity.calcAndUpdate calc.argtypes=[POINTER(c_float),c_int] calc.restype=POINTER(c_float) SCREEN_WIDTH, SCREEN_HEIGHT = 600,600 BG_COLOR = 150,...
985,414
e203856afc0123a7b3c410c72aaa9f4520bcc2a0
#!/usr/bin/env python # coding=utf-8 """ Description ===================== Main application file. Runs a program for deciding who has chores today and then emails them with their list. Requirements ==================== Raspberry Pi with SENSE HAT Joystick Functionality ============...
985,415
d7a080d522be62d0a45f6ee4a50dbeb2d69123f2
from django.contrib import admin from .models import UserCreateNews, CategoriesNews # Register your models here. admin.site.register(UserCreateNews) admin.site.register(CategoriesNews)
985,416
e1fa99065e6ee7ae15f2bfe51a9c3f019632fe84
#! /usr/bin/env python # Copyright (c) 2019 Uber Technologies, 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.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
985,417
7f4bdd42b2ecbc386b3078642b5004781c1e883a
#!/usr/bin/env python3 import time import timeit import gym import ptan import os import sys sys.path.append(os.getcwd()) from lib import common import torch import torch.nn as nn # Results: # Original sync, number=100, cuda=True, speed=7634.508 runs/s # Original sync, number=1000, cuda=True, speed=8606.037 runs/s ...
985,418
cb5d0bfcc390f49c4a5d09e1ad7bc71ac0542411
# Generated by Django 2.2.6 on 2019-12-02 18:20 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('project_core', '0088_organisation_mandatory_fields'), ] operations = [ migrations.RenameField( model_name='personposition', ...
985,419
4d970a14bd2f7763b30dc87bb1cecc84607932e6
import re from pygments.lexer import RegexLexer, words from pygments.token import * class PCFLexer(RegexLexer): name = 'PCF' aliases = ['pcf'] filenames = ['*.pcf'] tokens = { 'root': [ (r'\d+', Number), (words(('else','in','ifz','fun','fix','let','then'), suffix...
985,420
d661fb1049e11cbf456f1cd6878daf742a5103e5
#%% 'Curve fitting input code' 'Uses the Lmfit module to fit the data' from NewFitAll import NewFit # 1 Gaussian from NewFitAll import NewFit2 # 2 Gaussians from NewFitAll import NewFit3 # 3 Gaussians from NewFitAll import NewFit4 # 4 Gaussians from NewFitAll import NewFit5 # 5 Gaussians from NewFitAll...
985,421
29987e450cb0cd01f2a6ade2a7e214bfeb68baaf
from django.urls import path from school.views import ( ClassroomListView, StudentListView, TeacherListView, SubjectListView ) urlpatterns = [ path('classrooms/', ClassroomListView.as_view(), name='classroom-list'), path('students/', StudentListView.as_view(), name='student-list'), path('teachers/', ...
985,422
5b2168cfac5df9878c3d6b423d7a79f08d409de4
def solution(n, computers): answer = 0 network = [[] for _ in range(n)] visited = [False] * n for i in range(len(computers)): for j in range(len(computers[0])): if computers[i][j] == 1 and i != j: network[i].append(j) for i in range(n): if df...
985,423
06577e1e64aa7dbcb91b12d16f7bb46b2d50bab3
import os from collections import deque import PIL.Image as Image import erdos from erdos import Message, ReadStream, Timestamp, WriteStream import numpy as np from pylot.perception.messages import LanesMessage class PerfectLaneDetectionOperator(erdos.Operator): """Operator that uses the simulator to perfectl...
985,424
6aff1fd9d68f9153ae403200d7fc8166ef036139
##============================================================================== ## Yining Song (20675284) ## CS 116 Spring 2017 ## Assignment 01, Problem 2 ##============================================================================== import math import check ## normal_distribution(x, mean, std_dev) p...
985,425
3ccb9b83b1ca5536a4d440ce85184b10881b3991
#!/usr/bin/python # # # I saw these in some other protocol thing.. im assuming they're required from lib.transports import * from lib.bruters import * global MASTER_DATAFLOW SPIPE_VERSION1 = int(0x10000001) SPIPE_VERSION2 = int(0x20000001) SPIPE_VERSION3 = int(0x30000001) SPIPE_VERSION4 = int(0x40000001) KEY_PAC...
985,426
9e936aab0cd7b4fa7ba2c635286a61e2595b0947
#!/usr/bin/env python # # This script just takes the scan settings as command line args. You will need to hardcode your API keys and scanner name below. # The way the script works is by kicking off a scan and waiting for the results to download them in '.nessus' format. # If you launch with '&', it will put it into the...
985,427
eb1f34d86d836b08dffa439fc25754ebee2d7833
# class Solution: # def check(self, height, k): # if k == 0 or max(height[0:k]) <= height[k]: return False # if k == len(height) - 1 or max(height[k:]) <= height[k]: return False # return True # def trap(self, height): # tot = 0 # n = len(height) # if n == 0 or n...
985,428
8b42cfcc91499a3f99c29245ae339f292b0e362e
def main(): import sys import time start=time.time() K=int(sys.stdin.readline()) if K%2==0: print(-1) return L=[7%K] L2=[7%K] if L[0]==0: print(1) return idx=0 while True: L2.append((L2[idx]*10)%K) L.append((L[idx]+L2[idx+1])%K) ...
985,429
084b3394533007fb147c2494dce47bdd3f81069b
""" all operations of api are in app.py file """ import json import uuid from aiohttp import web from models import ( save_new_agent, get_agent, update_agent, delete_agent, add_system, get_system, delete_system, ) class AgentMethods(web.View): """ ALL METHODS OF AGENT ARE IMPLEMENT...
985,430
327736f07000a0aef9533a5d24ccfebbf705835d
import os from paste import deploy from oslo.config import cfg from openstack.common import excutils from openstack.common.gettextutils import _ from openstack.common import log as logging import webob import eventlet import eventlet.wsgi import greenlet import socket # Raise the default from 8192 to accommodate lar...
985,431
685090be2915d6307c0d5225daebec3391f5e626
import pickle import pandas as pd from resources.functions import print_with_time import os def extract_metrics(analysis_directory:str, level0_results_path:str, structured_results_path:str, ensemble_results_path:str, balanced_test_set_results:str=None): metrics = ["w_fscore", "w_precision", "w_recall", "ma_fscore...
985,432
174a7724281d340aff8ec5afc0ddf7e92c99798d
""" Polynomial Curve Fitting Dataset - Univariate_Dataset.csv Single variable input """ import pandas as pd import numpy as np import matplotlib.pyplot as plt import random from sklearn.model_selection import train_test_split,KFold class polynomial_regression: """ A class used to cal...
985,433
a12fcb1b2dd8521ff3d0f547cc2997caa53bc783
"""mysite URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-bas...
985,434
8d7566c7831cb056da4b429ffd980f014ffe4bae
from setuptools import find_packages from setuptools import setup setup( name='pms', version='1.0', packages=find_packages(), package_data={'pms': ['config/deep_model.yaml']}, include_package_data=True, install_requires=["google-cloud-storage"] )
985,435
1fce097dfdfe45e12bbff15cf6dd2f8cc85e3bba
## TOPICS ## ''' Hey, it's a CMS! Title/slug/description will be used to create the list page at /topics/ Title/description will also be used to create the header on the detail page at /topics/{{ slug }}/. The contents of an individual page should go inside {{ template_name }}, which belongs in /templates/topics. S...
985,436
e2cab9c536b95274594ad57290b790757e3d1096
n1 = input() n2 = input() n3 = input() print(f"{n1}{n2}{n3}")
985,437
c6233177ea0d1260db06a1f5d6719c8898f4c17c
default_app_config = 'datacenter.apps.DatacenterConfig'
985,438
1eb195efe4cfcfc574f6215894e9ae4179e25850
import socket as sk def communicate(host, port, request): s = sk.socket(sk.AF_INET, sk.SOCK_STREAM) s.connect((host, port)) s.send(request) response = s.recv(1024) s.close() return response
985,439
59bf5f3d545882c90bccadaabc4b45fa4b496867
import unittest from base import Base from selenium.webdriver.common.by import By class Homework3(Base): def test_challenge2(self): self.driver.get("https://www.doterra.com/US/en/product-education-blends") oils = self.driver.find_elements(By.XPATH, "//*[@id=\"content\"]//a/span[@class=\"title\"]...
985,440
e4b53266fcd85758346484d464b5bd3365d3c162
from .manage import app
985,441
8ab7755b97807128417bac4f094d911412b42748
length=int(input("enter the length of rectangle:")) breadth=int(input("enter the breadth of rectangle:")) area=length*breadth perimeter=2*(length+breadth) print("/n area of rectangle is:%2d",%area) print("/n perimeter of rectangle is:%2d" %perimeter)
985,442
9fa01a0fb87f28e09baf72824570ab1a0dd2853b
# -*- coding: utf-8 -*- # @Time : 2020/4/21 16:18 # @python : python 3.7 # @Author : 水萍 # @File : 调整奇数位于偶数前面.py # @Software: PyCharm def exchange(nums): i = 0 j = len(nums)-1 if len(nums) == 1: return nums if nums == []: return nums while i != j: if nums[i] % 2 != 0: i += 1 else: if nums[j]...
985,443
0f9fa44976d006eff7cf4a3ae2f6854cfb47ce60
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 11 16:44:47 2018 @author: nguyentran IoTSE defines 3 types of entity: IoTContent: represent a named IoT content, encapsulating ID, metadata, and content Query: represent a named query, encapsulating query_ID, query_content (a dictionary) ...
985,444
746c24da79f6137c4a1ffaff3a015be7c2af5600
from rest_framework import serializers from evaluador_peso import models as model_pesos class PersonaSerializer(serializers.ModelSerializer): class Meta: model = model_pesos.Persona fields = "__all__"
985,445
0bc5f0e0545b298535898003d0f58088d781b143
import tkinter as tk from ui.captcha_ import Captcha from ui.private_entry import PrivateEntry from tkinter import messagebox from tkinter import ttk from ui.window import Window from security.password_strength import PasswordStrength import itertools class MasterDialogBase(Window): def __init__(self, parent, db...
985,446
afcc92a4eb91aabd934051d5b765425c77f02ab8
# Zip # This is our known way of combining a list L1 = [1, 2, 3] L2 = [3, 4, 5] L3 = [] print('{}\n{}'.format(L1, L2)) for i in range(len(L1)): L3.append(L1[i] + L2[i]) print(L3) # Here is the zip function, which combines the lists items, but in tuples L4 = list(zip(L1, L2)) print(L4) # Here is combining them like ...
985,447
1040ab555209f0257aeb5e945a256b17f485376c
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 OpenStack LLC # # 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 ...
985,448
f1788b07f39b8a58e1a5f69566aa08aa07953ead
# import asyncio import logging import traceback import argparse import subprocess import sys import schedule from rpi2mqtt.config import Config from rpi2mqtt.binary import * from rpi2mqtt.temperature import * from rpi2mqtt.ibeacon import Scanner from rpi2mqtt.switch import Switch from rpi2mqtt.thermostat import Hesti...
985,449
16b68558d9f97e236a3f48478353ba1ae0a5c886
print() # The following block of code shows a nested dictionary containing data on three pet owners and their pet's information. pets= { 'rover': { 'ownername': 'doug', 'pettype': 'dog', 'color': 'black', }, 'jessica': { 'ownername': 'danielle', 'pettype': 'rab...
985,450
9a743839166573159779706ce2c82f28aed6eea2
#!/usr/bin/env python # -*- coding: utf-8 -*- import wot.io import wot.ot def main(argv): parser = wot.ot.OptimalTransportHelper.create_base_parser('Compute transport maps between pairs of time points') parser.add_argument('--format', help=wot.commands.FORMAT_HELP, default='loom', choices=wot.commands.FORMA...
985,451
ff2c5c5883828a83d1fd3e35461cb5e799b828eb
import logging __author__ = 'Eric' if __name__ == "__main__": logging.basicConfig(filename="Networking.log", level=logging.INFO)
985,452
0341446572c31d3c120cbe47ca917d494a6e6f5a
# <<BEGIN-copyright>> # Copyright (c) 2016, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # Written by the LLNL Nuclear Data and Theory group # (email: mattoon1@llnl.gov) # LLNL-CODE-683960. # All rights reserved. # # This file is part of the FUDGE package...
985,453
84db940c7e24aef489410e745ec97e09c5daf78c
''' -Medium- *Bit* A character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules: For 1-byte character, the first bit is a 0, followed by its unicode code. For n-bytes character, the first n-bits are all one's, the n+1 bit is 0, followed by n-1 bytes with most significant 2 bits being 10. Thi...
985,454
ccfe1d80e3735c313e9046eb76994709cb10c3e4
import json import os from datetime import datetime import sys sys.path.append("../") from causal_graphs.graph_visualization import visualize_graph from causal_graphs.graph_export import load_graph from causal_graphs.graph_real_world import load_graph_file from causal_graphs.graph_definition import CausalDAG from caus...
985,455
058cdf51492156857a66df71fbb9b3a4c06c20dd
def is_encoding(char): return not ((char.isalpha()) | (char.isdigit()) | (char == ' ') | (char == '<') | (char == '>') | (char == '\r') | (char == '\n')) def decode(message): bin_string = get_binary(message) split = [bin_string[8*i:8*(i+1)] for i in range(len(bin_string)//8)] bytes = [int(i, 2) for i in split] ...
985,456
9f453bfc6f960ab02713acdbd73c7f4e32be3a3e
numbers={"one","two","three","four","five","six"} print("\nprint the original set") print(numbers) print("\nadding other numbers to the set") numbers.add("seven") print("\nprint the modified set") print(numbers) print(type(numbers)) print("looping through the set elements...") for i in numbers: print(i)
985,457
42508630be0a03dad234feafc7fbcba1bf9fb5d0
import pyOcean_cpu as ocean # Type casting applied to tensor objects a = ocean.asTensor([1,2,3]) print(a) b = ocean.int8(a) print(b) ocean.float(a, True) print(a)
985,458
20779e26bc30bef5afb8703f9c575407301892ed
import sys from PyQt5.QtWidgets import QMainWindow, QWidget, QPushButton, QLabel, QApplication, qApp, QHBoxLayout, QVBoxLayout from PyQt5.QtGui import QPalette, QColor from MainWindow import MainWindow if __name__ == "__main__": app = QApplication(sys.argv) main_window = MainWindow() qApp.setSt...
985,459
19c1cdbc7fc8078fc0bed27568fa0acfd02f7be0
# Generated by Django 3.1 on 2020-08-31 16:52 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('main', '0006_auto_20200831_0924'), ] operations = [ migrations.AlterField( model_name='maritalsta...
985,460
56401e733e18c4e72b82c850c6c9244e14adeb3f
TOKEN = '1371826061:AAE2JwCB2R3f8wsGYI_ose5sCmo6GZNiuAU' #Токен бота admin = 449261488 #Chat_id админа 1 db = 'db.db'
985,461
99c368323fdd674bd7c10df9496954c399eb21cf
import sys assert sys.version_info >= (3, 5) # make sure we have Python 3.5+ from pyspark.sql import SparkSession, functions as sf, types, Row spark = SparkSession.builder.appName('NYC TAXI').getOrCreate() assert spark.version >= '2.3' # make sure we have Spark 2.3+ spark.sparkContext.setLogLevel('WARN') sc = spark.spa...
985,462
1e0fa7330c5ccf2351e436952a0bbfe465f9b1bc
for batch_idx, data in enumerate(data_loader): # Fetch graphs of one batch_size; e.g. 32 graphs input_node_f_unsorted = data['input_node_f'].float() # Dim: BS * N_max * INF raw_node_f_unsorted = data['raw_node_f'].float() # Dim: BS * N_max * NF edge_f_unsorted = data['edge_f'].float() #...
985,463
a2b64528419b1111ff180157f318aaa5b90d9190
""" Created on Sun Nov 19 16:35:26 2017 @author: Malte """ # Notes on a hierachical regression model (see http://twiecki.github.io/blog/2014/03/17/bayesian-glms-3/) # for prediction of behavioral, cognitive and self-report data import matplotlib.pyplot as plt import numpy as np import pymc3 as pm import pandas as p...
985,464
765a880eb989734ef2962e70091c1c3494128190
"""Tests for _sketches.py.""" import numpy as np from numpy.testing import assert_, assert_equal from scipy.linalg import clarkson_woodruff_transform from scipy.linalg._sketches import cwt_matrix from scipy.sparse import issparse, rand from scipy.sparse.linalg import norm class TestClarksonWoodruffTransform: """...
985,465
cdd0e8191c86cda0b84e69fca03ec699879fd5cf
from django.contrib import admin from .models import * class HorarioAdmin(admin.TabularInline): model = Actividad class ActividadAdmin(admin.ModelAdmin): inlines = (HorarioAdmin,) admin.site.register(Horario,ActividadAdmin)
985,466
e9e27d24dbefc052135fcec91feafb63ac13d2cb
nome = input() salario = float(input()) vendas = float(input()) resultado = (vendas * 0.15) + salario print("TOTAL = R$ %.2f" %resultado)
985,467
e7be459b73437dbab245bda45e8a57cb4ab86bf6
import http.server import socketserver import webbrowser as web from urllib.parse import urlparse import serial import time alertMsg = bytearray([2,0,0,0]) path = "C:\\code\\GpioPlayground\\UsbReadWrite\\" # need trailing slash class GetHandler(http.server.BaseHTTPRequestHandler): def do_GET(self): p...
985,468
ae60d13758059235caa776f28278e8542fecbe53
from import_export import resources from libs.models import t_payment from django.db.models import Count from django.db import * class DailyTransactions(resources.ModelResource): class Meta: model = t_payment fields = ('purpose', 'currency', 'amount', 'commitment', 'timestamp')
985,469
7cab02f81a48e8620dd5efb031e09405d624091e
class Element: """ Класс - элемент односвязного списка. Каждый экземпляр класса хранит: - данные - ссылку на следующий эл-т """ def __init__(self, value=None, next=None): self._value = value self._next = next class LinkedList: """ Класс - односвязный спи...
985,470
b27300a5ab69a8c89976c8ed6b28b726939922af
import requests import time from bs4 import BeautifulSoup url = 'https://bj.lianjia.com/ershoufang/' page=('gp') headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11', 'Accept':'text/html;q=0.9,*/*;q=0.8', 'Accept-Charset':'ISO-8859-1,utf-8;q=0.7...
985,471
f6b0910bc8a5af6a00be65dc1c964b23f9d141f8
#!/usr/bin/env python import time import sys import roslib roslib.load_manifest("gesture_rec") import rospy import tf import math import scipy.stats from numpy import dot import matplotlib import matplotlib.mlab as mlab import matplotlib.pyplot as plt from std_msgs.msg import Header, String, Float32MultiArray from tf...
985,472
bff14e7bacbc4a372659c410d12cbaceed704436
# Generated by Django 3.1 on 2021-03-16 04:38 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('job', '0009_renderplan_admin_only'), ] operations = [ migrations.AddField( model_name='renderplan', name='deadline_pri...
985,473
6a76789a3df7ef37f25e5ef61e9aeb3e663f4dc3
from flask import Flask, request, url_for, render_template, abort from flask_sqlalchemy import SQLAlchemy from sqlalchemy.sql import text app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////home/pi/flask/sqlitest/test.db' db = SQLAlchemy(app) class Student(db.Model): id = db.Column(db.Intege...
985,474
e37a5c5e7cbab364e7b653255d7ac6418718cb91
def rev(x): x = x[::-1] print(x) x = raw_input() rev(x)
985,475
d7db1bac945402f886c88eca115a09fbea4e2752
from optparse import OptionParser parser = OptionParser() parser.add_option("--xAxis", dest="xAxis", default='', type="string", action="store", help="[moniker:filname.zpkl for x-axis") parser.add_option("--yAxis", dest="yAxis", default='', type="string", action="store", help="[moniker:filname.zpkl for y-axis]") parser....
985,476
8e56fa74320eca3f0d667822cdc3a6474003f721
from __future__ import absolute_import import shutil import os.path from tempfile import mkdtemp from celery import shared_task from django.conf import settings from django.core.mail import EmailMessage from maja_newsletter.mailer import Mailer from maja_newsletter.models import Newsletter from maja_newsletter.util...
985,477
bb6ca5428dbfac9711b2d1cb5418b92d3fc4c6fe
print('Welcome to the Caesar Cipher, enter a sentence to be ciphered') string = str(input()).lower() print('And how many spaces you want to cipher it') cipherconstant = int(input()) # string = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq r...
985,478
b9a82f8af07bad907cb623b70a96dff46f0cf83d
from django.db import models class CrudUser(models.Model): name=models.CharField(max_length=200) address=models.CharField(max_length=200) phone=models.IntegerField() def __str__(self): return self.name
985,479
0617f7494a88575834f30f19f89bc9ef6c76a96f
# -*- coding: utf-8 -*- """ Created on Mon Jul 29 21:38:12 2019 @author: crdea """
985,480
16121736eef6e49cf07d3bfbe45610fd8c260646
from pszt_neural_network.neuron import Neuron class Layer: def __init__(self, type, number_of_inputs, number_of_neurons): """Create layer. :param type: type of apply function, if 1 then activation function is sigmoid, if 0 then activation function is linear :param number_of_input...
985,481
26a1c19ada359f907d0a5eb169222d707445cdc5
import climate import collections import lmj.cubes import lmj.plot import matplotlib.colors import numpy as np import pandas as pd COLORS = { 'marker00-r-head-back': '#9467bd', 'marker01-r-head-front': '#9467bd', 'marker02-l-head-front': '#9467bd', 'marker03-l-head-back': '#9467bd', 'marker07-r-sh...
985,482
ce886db663dd4715f70342b8d34150565832dd10
import functools import math import operator import os import traceback from datetime import datetime from xml.etree import ElementTree from pipeline.hpc.cmd import ExecutionError from pipeline.hpc.logger import Logger from pipeline.hpc.resource import IntegralDemand, ResourceSupply, FractionalDemand from pipeline.hpc...
985,483
b8629abf6139035bccde9ed0b2459d8ebcaceac3
"""Representation of VOI Nearest Scooter Sensors.""" from datetime import timedelta import logging from geopy.distance import distance import requests import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import ( ATTR_ATTRIBUTION, ATTR_BATTERY_LEVEL, ...
985,484
1e2013984ed94e71f48fcd844d584585b5b3d59d
""" Parsing of C expressions. """
985,485
95de726eefdaa534d7f75fc46b7e543a73354612
from sys import stdin # Carlos Arboleda - ADA - Camilo Rocha # Potentiometers.py hecho en clase # Se utilizo la clase segmentation tree para poder hacer las operaciones y luego ir partiendo de a dos en dos y luego devolverme operando para arriba # Se discutio con la clase y fue hecho en clase class segtree(object):...
985,486
9ec9e613d8070197d46b4568ed9bf341d2b91d46
#coding:utf8 from __future__ import unicode_literals from django.db import models # Create your models here. class Questions(models.Model): class Meta(): verbose_name_plural = 'Вопросы от посетителей' verbose_name = 'Вопросы от посетителей' name=models.CharField(max_length=255,verbose_name=u'...
985,487
60a7a5bc0648aac5dddfb36e5d071689e5b66730
from fastai.vision import Path, ImageDataBunch, cnn_learner, get_transforms, imagenet_stats, models, error_rate import numpy as np path = Path('/usr/local/airflow/data/') np.random.seed(42) data = ImageDataBunch.from_folder(path, train=".", valid_pct=0.2, ds_tfms=get_transforms(), size=224, num_workers=0).norm...
985,488
f5281884bcf267ca26c3d43d7e0aa9df645b0917
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.common.exceptions import NoSuchElementException import time ACCOUNT_EMAIL = "your-email" ACCOUNT_PASSWORD = "your-password" PHONE = "your-phone" chrome_driver_path = "/Users/dorukhanuzun/chrome-driver/chromedriver" driver = w...
985,489
b7a74d755e6ce41510001e6a8ee9d812b4184b75
import options import glob import json import os import random import sqlite3 import string from base64 import b64decode, b64encode from hashlib import blake2b from Cryptodome.Cipher import AES from Cryptodome.Random import get_random_bytes from bismuthclient import bismuthutil __version__ = '0.0.1' config = options....
985,490
cc76f341e1d3ca275d07296f68be5a18fe8b8477
# Copyright 2021 Google LLC. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # # 2...
985,491
554c3aed5e2105c0b33fdc79b568e88a5449ff99
class Solution: def wiggleSort(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ if not nums: return less_equal = True for i in range(len(nums) - 1): if less_equal: if nums[i] > nums[i...
985,492
ea44cee1bb396a3650ae83257a40d712aa604fe4
import sys import os import csv import mgmnet.ranRxn_nets as rn import mgmnet.topo_measure as tm ranRxn = rn.ranRxn() topo = tm.topoMeasure() # level level = ranRxn.level[sys.argv[1]] # group group = ranRxn.group[sys.argv[2]] # species species = int(sys.argv[3]) system_name = '%s_%s'%(level, group) dr = '' for ds i...
985,493
e0f6c29b74ad6805e8ec8541b5b40805fe00a5b2
# 1003474 # Alex W import pytest from present import sBoxLayer, pLayer, present_round, present_inv_round, genRoundKeys class TestKey: def test_one(self): key1 = 0x00000000000000000000 keys = genRoundKeys(key1) keysTest = { 0: 32, 1: 0, 2: 1383505805528...
985,494
a552ecf50adf2fbd3004bacc20c7781b5cdb4acc
from naoqi import ALProxy Class FaceRecognition(): def __init__(self, ip, port): self.ip = ip self.port = port # start speech recognition within a given time in sec, return reconized words def speech_recognize(self, time): with sr.Microphone() as source: self.r.adjust...
985,495
1e20d9545b8a796671c4c7a8d1523293746554a9
import argparse import os.path import types parser = argparse.ArgumentParser(description='File wrapper.') parser.add_argument("-f", "--file", dest="filename", required=True, help="REQUIRED. input file") parser.add_argument("-n", "--name", dest="cvarname", help="name of the generated C string variable") options = par...
985,496
01079f40a488f69f309499350c816ae54ce36bc0
import pandas as pd import numpy as np import os import dash_core_components as dcc import dash_html_components as html import dash_table from datetime import datetime, timedelta from urllib.request import urlopen import json import plotly.graph_objects as go from dash.dependencies import Input, Output import flask fr...
985,497
c02583a2e94b81c328766391c8405ecdb93709e0
import codecs N = 150000 file = codecs.open("data/wiki-news-300d-1M.vec", "r", encoding='utf-8', errors='ignore') file1 = codecs.open("data/wiki-short1.vec", "w", encoding='utf-8', errors='ignore') ct = 0 for i in range(N): try: line = file.readline() file1.write(line) except: print("Er...
985,498
48d9d41de8eb1f1db64ae4046d1894c60e22ef8f
#!/usr/bin/env python # -*- coding: utf-8 -*- # # openpose_utils.py import os import json import re import numpy as np from collections import Counter import logging logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) def read_openpose_json(openpose_output_dir, idx, is_debug=False): if...
985,499
4027344d12c5864376ca621aae3638fc1fc52938
import cv2 import os data_path = '../data' #os.remove(data_path +'/.DS_Store') image_paths = os.listdir(data_path) print('image Paths=',image_paths) face_recognizer = cv2.face.LBPHFaceRecognizer_create() face_recognizer.read('modelo/modeloLBPHFace.xml') cap = cv2.VideoCapture('../test2.mov') face_classif = cv2.Casc...