index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
989,400
be73ba907e252676827161d3fa8fcd8418844129
def wypisz_dane(imie, nazwisko, kurs = "Python", il_dni = 15): print(imie, nazwisko, kurs, il_dni) wypisz_dane("Bolek", "Kruszewski") wypisz_dane("Bolek", "Kruszewski", "Java") wypisz_dane("Jan", "Matejko", "malarstwo", 3567) wypisz_dane("Paulina", "K", 30) wypisz_dane("Marek", "0", il_dni=25) wypisz_dane(kurs=...
989,401
917e10920fd6e7c3e1a37c4f371993ddcb1465cf
# -*- coding: utf-8 -*- # @Start_Time : 2018/6/25 16:28 # @End_time: # @Author : Andy # @Site : # @File : 71_simplify_path_180625.py """ Given an absolute path for a file (Unix-style), simplify it. For example, path = "/home/", => "/home" path = "/a/./b/../../c/", => "/c" Corner Cases: Did you consider the...
989,402
004ce3ed6a8cae98a46821c581e21c6c047a37c1
from sqlalchemy import create_engine import mysql.connector import pandas as pd import psycopg2 #Local Imports from extract_data.get_new_nyc_borough_confirmed import get_borough_confirmed from combine.combine_nyc import combine_scraped_and_historical engine = create_engine('postgresql+psycopg2://postgres:postgres@post...
989,403
121693931cf7f72220494747443cd47063ac5dbc
"""Tags for djangos templating library"""
989,404
24bd01f625fd9eda7a7d3224b8b5328df92a20bf
# Faça um programa que calcule a soma entre todos os números # ímpares que são múltiplos de três e que se encontram no intervalo de 1 até 500. ''' soma = 0 cont = 0 for i in range(0, 501, 3): if i % 2 == 0: continue else: soma+=i cont+=1 # Para contar os números que serão soma...
989,405
0fa03899a8114fa70874d659cc413e8e39d997b3
#-*- coding: utf-8 -*- import ffn import matplotlib import matplotlib.pyplot as plt from matplotlib.dates import date2num from datetime import datetime from cycler import cycler# 用于定制线条颜色 # pip mplfinance 參考: https://pypi.org/project/mplfinance/ # 使用新 module 的說明參考 https://www.mscto.com/python/558937.html import mplfi...
989,406
e6f19bb2332c3f79f7f84f6b028c354d9ff53272
from django.shortcuts import render, get_object_or_404, redirect from .models import Products, Category, Likes from .forms import ProductForm from django.db.models import Q from django.contrib.auth.models import User from an_interesting_site import settings from reviews.models import Review from reviews.calculate_revie...
989,407
c44870fa35f9744793a24a12aa60e583f8b2b7c6
import Metodos def menu(): print("1. Ingresar nuevo contacto\n2. Buscar contacto\n3. Visualizar agenda") entrada = input("Ingrese una opción: ") if entrada == "1": Metodos.contacto() menu()
989,408
32c083cbb550845bd938ff48a66ff12571323239
#!/usr/bin/python3 import subprocess import os import timeit googletest_root = "googletest/googletest" include_dirs = [ '{}/include'.format(googletest_root), 'include', '/usr/include/OpenEXR', ] library_dirs = [ '{}/build'.format(googletest_root), 'build', ] cpp_flags = [ '-Wall', '-g', ] sources = [ 'form...
989,409
cbe3ad155b0426e54bff9fe873696c55248ae6f4
from PyQt5.QtWidgets import * import difflib import sys import json data = json.load(open('data/data.json')) class Window(QWidget): def __init__(self): super().__init__() self.setWindowTitle('Translator') self.setGeometry(50,50,350,350) self.UI() def UI(self): self...
989,410
5b6a1b52836a4d22b500787f5ff9c149e48f8b60
#!/usr/bin/python3 # Filename: Bird.py class Bird(object): feather = True reproduction = "egg" def chirp(self, sound): print(sound) def set_color(self, color): self.color = color summer = Bird() print(summer.reproduction) summer.chirp("jijiji") summer.set_color("yellow") print(summ...
989,411
919b63d322ae4172a10d338d480682abdcb9d6d3
p = input("Enter plain text: ") rows = int(input("Enter number of rows: ")) # Method 1 row_cipher_text = "" row_mat = [[] for row in range(rows)] for i in range(len(p)): row_mat[i % rows].append(p[i]) for a in row_mat: row_cipher_text += "".join(a) row_decrypted_text = "" i, count, col = ...
989,412
0bb0e8314a1ae2ecef86e48d0fd45cfb55c0c644
#!/bin/env python2 # -*- coding: utf-8 -*- """ CBMG 688P case study: 3'UTR motif analysis Keith Hughitt 2013/12/11 Overview -------- This script brings together some of the concepts we have discussed in class up to this point to complete a fairly complex and useful task: scanning a genome to look for for interesting 3...
989,413
81e93c49bebcef61175e6d64f079f1e528d3ccc8
class Solution(object): def containsNearbyAlmostDuplicate(self, nums, k, t): """ :type nums: List[int] :type k: int :type t: int :rtype: bool """ if k < 1 or t < 0: return False buckets = {} for i, num in enumerate(nums): ...
989,414
1622cdb3e36424f0a3eb393e7ef1dfff8dcf3503
string='' k=1 while len(string)<1000000: string+=str(k) k+=1 indices = [string[10 ** k-1] for k in range(0,7)] product=1 for x in indices: product *= int(x)
989,415
9cd632496c0bead4f94aaf3749461b686748f572
# -*- coding: utf-8 -*- """ Compute the integral of the following function within the given domain. Use both midpoint and trapezoidal methods! Compare your results to the exact solution of the definite integral. Evaluate integral numerically from 0 to 1 f(t) = 3*(t**2) * (e**(t**3)) integral = (e**(t**3)) """ #=====...
989,416
cfd3b3ed579e4425bdc358c1e826099d796398db
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('lacalma', '0006_auto_20141121_1349'), ] operations = [ migrations.AlterField( model_name='reserva', ...
989,417
cf8ecbfd434f43641ca52414add707cd1a011fea
from PIL import Image, ImageDraw, ImageFont import requests import matplotlib.pyplot as plt def image_add_text(img, text, left, top, text_color=(255, 0, 0), text_size=13): # 创建一个可以在给定图像上绘图的对象 draw = ImageDraw.Draw(img) # 字体的格式 这里的SimHei.ttf需要有这个字体 fontStyle = ImageFont.truetype("MILT_RG.ttf", text_size...
989,418
65ed5e86afec0d4d2f8aa96f8fb3d1fb1b23db8b
from collections import deque import sys input = sys.stdin.readline n = int(input()) q = deque() for _ in range(n): command = input().split() if command[0] == 'push_back': q.append(command[1]) elif command[0] == 'push_front': q.appendleft(command[1]) elif command[0] == 'front': p...
989,419
037322880281eb20169d0c65150624594978c65d
import subprocess import os class RaspiCameraConfig: METERING_MODE_MATRIX = 'matrix' METERING_MODE_AVERAGE = 'average' METERING_MODE_BACKLIT = 'backlit' METERING_MODE_SPOT = 'spot' ALL_METERING_MODES = [ METERING_MODE_MATRIX, METERING_MODE_AVERAGE, METERING_MODE_BACKLIT, ...
989,420
0ecb8a133260c45831e5a40d4b69254d3b148c99
# -*- coding:utf-8 -*- # Anaconda 4.3.0 環境 """ 更新情報 [17/08/16] : 検証用のサンプルデータセット生成関数を追加 [17/08/31] : クラス名を DataPreProcess → MLDreProcess に改名 """ import numpy # Data Frame & IO 関連 import pandas from io import StringIO # scikit-learn ライブラリ関連 from sklearn import datasets ...
989,421
abe5dadfa169c486ed7ce0deade64c122cd8aec3
#! /usr/local/bin/python3 -u import testencoding as enc import argparse parser = argparse.ArgumentParser() # https://stackoverflow.com/a/25513044/5719760 def aint(x): return int(x, 0) parser.add_argument('pages', type=str, nargs='+') def parse_range(txt): dash = txt.index('-') start = txt[:dash] en...
989,422
260000a8eb6c1da4f9a0705989085610d6564881
import pytest from outcome import Outcome from wheel import Wheel from binBuilder import BinBuilder wheel = Wheel() bb = BinBuilder() def test_gen_bets(): bb.gen_straight_bets(wheel) assert wheel.get(5) == frozenset([Outcome('5', 35)]) assert len(wheel.all_outcomes) == 38 #test_gen_split_bets(): ...
989,423
c549ba0843eaa565f182b424b211669a8f65e967
# Generated by Django 2.2.7 on 2019-12-14 00:02 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Profesor', fields=[ ...
989,424
0123ba18205e7868648b2162b2e5044bff788eea
from django.shortcuts import render, redirect,HttpResponse from django.contrib.auth.models import User from django.contrib import auth from django.http import JsonResponse from django.contrib.sites.shortcuts import get_current_site from django.template.loader import render_to_string from django.utils.http import urlsaf...
989,425
30468a7e78fae952b25596fa39982d767c52c598
import os import torch from tensorboardX import SummaryWriter from shutil import copy, rmtree class Logger: def __init__(self, logdir): self.logdir = logdir if not os.path.exists(self.logdir): os.makedirs(self.logdir) self.logfile = open(os.path.join(logdir, 'log.txt'), 'w') ...
989,426
73968d41e399d3db549135e3cc8e8d6124186ad8
# -*- coding: utf-8 -*- '''嵌套函数,在函数内部定义的函数''' def f1(): print('f1() running...') def f2(): print('f2() running...') f2() f1() print('---------分割线------------') '''使用嵌套函数避免重复代码''' #定义了两个函数 def printChineseName(name, familyName): print("{0} {1}".format(familyName, name)) def printEnglishName...
989,427
fc52b191a2caacd199f9b6b2918dad09ff3475d2
from django.contrib import admin from .models import Agent # Register your models here. @admin.register(Agent) class AgentAdmin(admin.ModelAdmin): pass
989,428
63e3edc8e016c9f931fe391bc47d752ba24487c9
#!/usr/bin/env python import roslib; roslib.load_manifest('guts') import rospy from guts.msg import sonar_data import serial ser = serial.Serial('/dev/ttyACM0', 9600, timeout=60) def guts_sonar_ir_pub(): pub = rospy.Publisher('guts_sonar_ir_data', sonar_data,queue_size=2) rospy.init_node('guts_sonar_ir_node')...
989,429
b89f0de6ed2676cf80abc021238f8e10e3e6becc
#code def numberofPaths(r, c): if r==1 or c==1 return 1 return numberofPaths(r-1, c) + numberofPaths(r, c-1) test_case = int(input()) for i in range(test_case): r, c = list(map(int, input().split())) numberofPaths(r, c)
989,430
3727d51bfc94664fddaa0ac7a0723f52094b9af0
import json import pika import base64 rabbit_IP = '54.144.236.23' rabbit_port= '5672' username = 'parser' password = 'parser' queue_name = 'hello' exchange_name = 'Eldar' rk = 'yogev' def sender(message): credentials = pika.PlainCredentials(username=username, password=password) connection = ...
989,431
d5fb9d4a5b7e06c574270cc8d90965689ec471b4
#-*- coding:utf-8 -*- import time,datetime from django.shortcuts import get_object_or_404, render,render_to_response from django.http import * from django.http import HttpResponse,HttpResponseRedirect from django.core.urlresolvers import reverse from django.core.paginator import Paginator,InvalidPage,EmptyPag...
989,432
e3f21a47c4836e552e7413596dd13972cfe3395a
import re from datetime import datetime sentences = [ "Am 05.06.2018 findet ein cooles Event statt", "Please follow our invitation and visit us on 2018/14/05", "Im Monat 05/2018 ist oft gutes Wetter", "Der Lottogewinn war 10.000.000€ groß. Er wurde am 04.06.2018 ausgeschüttet", "Im Monat 01/2018 wa...
989,433
b16540fe929e2f361b6db5010eb1bac0ea880cfe
import os, sys class Student(): """ A Sample Student class """ def __init__(self, firstName, lastName): self.firstName = firstName self.lastName = lastName print("student created:" + self.fullName,self.email) @property def fullName(self): return f'{self.firstName} {self...
989,434
31393275e32cb01ccd730be038701d70b93e3523
import challenge10, challenge11, challenge18 key = nonce = None counter = 0 def do(): global key, nonce if key is None: key = challenge11.getRandomBytes(16) if nonce is None: nonce = challenge11.getRandomBytes(16) data = open('25.txt').read().decode('base64') pt = challenge10.decryptECB(16, data, challenge1...
989,435
06f3eaf9e41673e2fe5e3c626394c4610d66136d
''' Created on Aug 30, 2017 @author: arnon ''' import subprocess as sp import os def cmdargs(namespace=None): import argparse filename = os.path.basename(__file__) progname = filename.rpartition('.')[0] parser = argparse.ArgumentParser(prog=progname, description="runs EventorAgent object.") pars...
989,436
51ae5a8f24b13cbd941e1cf0049edd6d9ba200c5
# -*- coding: utf-8 -*- def pico(lista): if n==3: if lista[0]<lista[1] and lista[2]<lista[1]: return 'S' else: return 'N' if n>3: if lista[0]<lista[1] and lista[1]<lista[2]: return 'S' if lista[0]<lista[1] and lista[n-1]<lista[n-2]: ...
989,437
c1690ee9a4a28457ba5df6e56c64b3bd6592c5ff
# this example will give us an idea about # the importance of logical operators (and, # or, not) and how we use them born = int(input("What year were you born? ")) if born >= 1945 and born <= 1964: print("You are a baby boomer!") elif born >= 1965 and born <= 1979: print("You are from generation X") elif born...
989,438
fe3b0f619051cdc6145d97b5d4a1a80444ef80b5
#pyhelper.py import file. Acts as a wrapper around common FinTech code #Currently has 4 classes - Finhelper, SQLhelper, PVhelper, and APIhelper #Written by toddshev, if anything is broken or you think anything can be added, let me know #Otherwise, hopefully it's helpful """ ''' Fin methods: load_and_clean, get_cov, ...
989,439
25f066caa50e440c173f3f308e8fb3039354b989
import socket import sys import os import pandas as pd import datetime from glob import glob from threading import Thread from time import sleep from pickle import PicklingError import shutil pairs = {} box = [] Lock = False # Multithreaded Python server : TCP Server Socket Thread Pool class ServerThread(Thread): ...
989,440
3551af38b67345edd6178ed4bcb698b96cf1b8a3
from django.urls import path from .views import dash, PatientCreate, PatientUpdate, PatientListView,\ CreateBill, BillListView, RequestTest, TestListView,\ CreateUser, UpdateUser, UsersListView, EditBill, UpdateTest,\ PatientDetail, BillDetail, TestDetail, U...
989,441
05632cd6515132a4f8cc7f8be733da900c76fe35
from django.conf import settings from django.contrib import messages from django.contrib.auth import update_session_auth_hash from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.views import ( PasswordResetView, PasswordResetConfirmView, PasswordResetCompleteView, Password...
989,442
dbf34eed813d67ae16b7acdfa89f1142e1c1828b
import os import websocket import json import time from kafka import KafkaProducer import kafka.errors try: import thread except ImportError: import _thread as thread import time KAFKA_BROKER = os.environ["KAFKA_BROKER"] TOPIC = "exchange-rates" START_DELAY = 30 WS_SERVER = 'wss://streamer.cryptocompare.com/...
989,443
6446448cb3bba94bdd9507b77afe7c9b9da070be
# -*- coding: utf-8 -*- from datetime import date import uuid import re def addSimple(desc, amount): return { "desc": desc, "amount": amount, "date": date.today(), "id": str(uuid.uuid1()) } def reportCategory(json): def setCat(dic): dic["category"] = getDefaultCategory(dic["desc"]) return dic return map(l...
989,444
37926df3967f485bca94e0e19ba99bc0b2171c5c
from django.urls import path from . import views urlpatterns = [ path('insert1', views.insert1, name='insert1'), path('select1', views.select1, name='select1'), path('select_m', views.select_m, name='select_m'), path('select3', views.select3, name='se...
989,445
b61431b5792f3f1b496964f09e03198eb264e8dc
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Unlicense OR CC0-1.0 import pytest from pytest_embedded import Dut @pytest.mark.esp32 @pytest.mark.esp32c2 @pytest.mark.ethernet def test_mqtt5_client(dut: Dut) -> None: dut.expect_unity_test_output()
989,446
71586444df287c4281a43a0ce8d10cc3a90838d8
import codecs unicode_decoder = codecs.getdecoder("unicode_escape") def parse_model_file_line(line): model_file_element = line.rstrip().split("\t") model_file_element[0] = [char for char in unicode_decoder(model_file_element[0])[0][::2]] return tuple(model_file_element)
989,447
5bb820a50919e15f59a8449d31b08b8d08b40bb9
from django.db import models from usuario.models import User # Create your models here. class Maceta(models.Model): tipoPlanta = models.ForeignKey('Plantas', on_delete= models.CASCADE) fechaDePlantacion= models.DateTimeField() primeraCosecha = models.DateTimeField() User = models.ForeignKey('usuario....
989,448
cd539d07cc13254a84727cd25696b8a9645199d3
# -*- coding: utf-8 -* import unittest from unittest.mock import MagicMock import richman.event as event class TestEventManaer(unittest.TestCase): def setUp(self): self.event_manager = event.EventManager() def tearDown(self): pass def test_event_manager_should_add_and_...
989,449
189704bbb214bb2f875e1e28cd1871966e1aa2b4
import sys import cProfile, pstats, io def run(): substrates = set([s for s in sys.stdin.readline().rstrip().split(" ")]) r = sys.stdin.readlines() r = list(map(lambda x: x.strip().split('->'), r)) r = list(map(lambda x: [set(x[0].split('+')), set(x[1].split('+'))], r)) ...
989,450
a11508644ae5cb0266c1201f447b8717b3234a01
import multiprocessing, time def fendian1(): while True: print("正在经营分店111111111111111") time.sleep(1) def fendian2(): while True: print("正在经营分店222222222222222") time.sleep(1) def main(): # 创建2进程 # 功能:创建进程,返回一个对象 # 参数使用和线程一样 p1 = multiprocessing.Process(target=f...
989,451
d1ce2fa292c60e7656f97d8ed451319583591946
## Dictionaries alien_0 = {'color': 'green', 'points': 5} print(alien_0['color']) print(alien_0['points']) # add variables alien_0['x_position'] = 0 alien_0['y_position'] = 25 print(alien_0) ## program alien_0 = {'x_position': 0, 'y_position': 25, 'speed': 'medium'} print(f"Original position: {alien_0['x_position']}"...
989,452
878e8cd91a225466316e4b1833662d5b8eddddd4
import socket from helpers import parse_helper from helpers import config from helpers.load_balancer import Algorithm # get the IPAddr of the Server def getServerInfo(): hostName = socket.getfqdn(socket.gethostname()) IPAddr = socket.gethostbyname(hostName) return IPAddr # establish socket connection def ...
989,453
d7add5af08be991c9996dc583df093c987aa9d69
prev_balance = float (raw_input ("Enter outstanding balance: ")) annual_interest = float (raw_input("Enter annual interest: ")) mmp = 120 months = 1 balance = mmp while months < 12: #mmp = monthly min. payment monthly_interest_rate = annual_interest/100/12.0 prev_balance = prev_balance * (1 + monthly_interest_rate...
989,454
707bd541a5c2d1e9d3692efe6663b52387450871
import logging from django.core.cache import cache from django.contrib.admin.views.decorators import staff_member_required from nms.views.response import * logger = logging.getLogger(__name__) def home(request): logger.info('bootstrap') response_dict = success_dict() return render_json(request, resp...
989,455
ca61862a865db70e85d6cc619e2f1726bcc50bf3
class Rocket(object): def __init__(self): self.pos = PVector(width/2, height/2) self.vec = PVector(0,0) self.accel = PVector(0,-1) self.heading = 0 #unit in degrees self.isPropulsion = False def show(self): if self.isPropulsion == True: fill('#F...
989,456
f13fe611288bee0934e413b99f038615f71133dd
# Write a short Python function that takes a positive integer n and returns # the sum of the squares of all the odd positive integers smaller than n. def sum_of_odd_squares(number): if number > 0: count = 0 for k in range(1, number): if k % 2 == 1: count += (k * k) ...
989,457
a08242390e865be22cde9f180b1053304fae0863
################################################################################ # # This file demonstrates an incompatibility between the MediaWiki API at # http://en.wikipedia.org and the 'requests' library since version 1.0.0 # # To run, simply execute "python test.auth.append.py" and fill in your username # and pas...
989,458
234e19f7f0a6d00679523d351e96d164cfd42538
''' Find inversion count in an unsorted array: An inversion happen when there is a number at index i greater than another number at index j where i < j input will be a list of unsorted int array Algorithm runs in nlog(n) We can break the problem into three parts An inversion can happen on the left side, right side, o...
989,459
2db91ac3b661ae8131b35bb71d45d60517b4d210
from django import forms from onboarding.apps.employee.models.documents import ModelDocumentGathering # ------------------------------------------------------------------------------- # FormDocumentGathering # ------------------------------------------------------------------------------- class FormDocumentGathering(...
989,460
76228839f5f2946ca8e2afda4fd4f6850b4ec492
import re # re.search() searches a string, and return the start index and end index for the result # return None if not find # the r char means a raw string. not regex # s = 'GeeksforGeeks: A computer science 123 portal for geeks 321' # regex = '\d+.*?' # match = re.findall(regex, s) # return a LIST # print(match)...
989,461
155da28f78b499857c72e5aac1d5b92ee2d4d2b6
import json import yaml from pathlib import Path from functools import partial NLJ = partial('\n'.join) def load_resume(format='yaml', name='resume'): return { 'yaml': yaml.safe_load, 'json': json.load, }[format]((Path.cwd() / f'{name}.{format}').read_text()) def experience_skills(job_id=No...
989,462
150b28d352ee5e494dd97a2662c002f685364a28
from board import bd from entity import Entity from config import EXPLODE_TIME import time """ This class represents a Bomb. It inherits from the Entity class. """ class Bomb(Entity): """ Constructor of Bomb class created_at => Stores the time when it was created explode_...
989,463
0072854e33f7120a417ec9eb42aa8037709f67a7
from django.apps import AppConfig class PaginaInicialConfig(AppConfig): name = 'pagina_inicial'
989,464
6fc11d54f6f6961e27d634a4d40ae8d6b6a3be49
import chapter3 as ch3 import chapter4 as ch4 import chapter5 as ch5 import chapter6 as ch6 import modern_robotics_functions as mr import math import numpy as np def cubic_time_scaling(Tf, t): a2 = 3/(T**2) a3 = -2/(T**2) return a2*t**2 + a3*t**3 def quintic_time_scaling(Tf, t): return 10 * (1.0 *...
989,465
66b02841d03c631700f72f07a0776954f943ff77
# encoding: utf-8 import unittest from spotify._mockspotify import mock_track, mock_album, mock_artist, mock_session class TestTrack(unittest.TestCase): track = mock_track(u'æâ€êþÿ', 3, mock_album("bar", mock_artist("baz", 1), 0, "", 0, 1, 1), 10, 20, 30, 40, 0, 1) ...
989,466
b72f234ad3d57920759b82ada13372aa1fa4d529
#!/usr/bin/python import os, sys sys.path.insert(1, os.path.join(sys.path[0], '..')) import challenges as c import pyqrcode # c.u1c => challenge no. 1 for urban race s=c.u1c colstr="DUTCH" msg=colstr+s.replace(' ','') cols=len(colstr) pad= len(colstr) - (len(msg) % cols) msg=msg+pad*" " s=[msg[n:n+cols] for n in rang...
989,467
75995df79af9004b1e9d21317b752a6a8901ac5c
#!/usr/bin/python3 import scrapy.crawler import test3_jb.spider import test3_jb.sqlite import scrapy # In scrapy terminology, # a "project" is a directory containing scrapy.cfg and a "crawler". # a "crawler" is a python module that contains multiple "spiders" (& optionally more) # a "spider" is a python class t...
989,468
84ad78b755d2a6834bd4283d5f13bb2b983566ed
import numpy as np from thesis_galljamov18.python import tools, settings # enables additional plots THESIS = False # ------------------------- # helper functions # ------------------------- def rad(degrees): return np.multiply(degrees,np.pi)/180 def deg(angles_in_rad): return np.divide(angles_in_rad,np.pi)*1...
989,469
b20a1be39bf1ed61f9a9635b5443cc69e7aed999
""" Created on Sat Oct 14 10:27:59 2017 @author: jmamath """ ############ 1 - Packages ############ import numpy as np import matplotlib.pyplot as plt import math import tensorflow as tf from tensorflow.python.framework import ops import time from model_utils import * from Load_data_v import load_preprocessed_datase...
989,470
004f015140d7e7d5a3a5dcb79f1c7a528dc1bd8f
''' Sentiment analyses for large dataset is slightly different. The approach to pre-process the data is very similar to what we did in small data project i.e. in the file Sentiment_Analyses.py. Here is the brief algorithm for pre-processing: 1. Get the statements sorted as positive and negative 2. Store list of posit...
989,471
cb929e617856107e661850def352b699c6bc9bb7
# Import required packages from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream import tweepy import codecs # Put your access token, access secret, consumer key, and consumer secret here (with quote) access_token = 'YOUR-ACCESS-TOKEN' access_secret = 'YOUR-ACCESS-SECRET...
989,472
faead84b37f7861891d0471c348968658af117de
# Path to the traktor installation directory where collection.nml is. TRAKTOR_PATH = '/tmp/fake-traktor' # Enable pretty stack traces and router logging DEBUG = False # Allow users to perform a live run LIVE_RUN_IS_AVAILABLE = False
989,473
d876384b223f702c127d1bbcbffd9d3e4a23cbcc
import numpy as np testA = np.array([10, 9, 8 , 7, 6, 5]) for x in testA: print(x)
989,474
91ea13e89937769830f6f8111dbb355e8925a7ac
"""waze_poi URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/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-b...
989,475
0ec94719fa1741f7c5a456b289f3032444f3b736
# __author__ = 'Irina.Chegodaeva' import os from model.contact import Contact import random import pytest def test_edit_some_contact_from_edit_form(app, db, check_ui): if len(db.get_contact_list()) == 0: with pytest.allure.step('If there is no contact I will add a new one'): app.cont...
989,476
897b070314b10581f1675ceba67760e4da4e538b
#!/usr/bin/python #-*-coding:utf-8-*- # system database engine. # # Package: SQLAlchemy # # GNU Free Documentation License 1.3 import os from sqlalchemy import create_engine from sqlalchemy import Table, Column, Integer, String, MetaData from sqlalchemy.orm import mapper, scoped_session, sessionmaker ...
989,477
cd5f8d2dbd88696b5901777daf70fb0e5c6d2e78
from PySide2.QtSql import QSqlDatabase, QSqlQuery from suwar import SUWAR_LIST AYAT_DB = "resources/ayat.ayt" TAFASIR_DB = "resources/tafasir.ayt" AYAT_DB_CON = QSqlDatabase.addDatabase('QSQLITE', "AYAT_DB_CON") AYAT_DB_CON.setDatabaseName(AYAT_DB) AYAT_DB_CON.open() DBS_CON = QSqlDatabase.addDatabase('QSQLITE') #...
989,478
de1744166c6dd4507bbc48b0f0273bbbeab883e5
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack.package import * class RHttpuv(RPackage): """HTTP and WebSocket Server Library. Provides low-level s...
989,479
dea287666a7edd17a6dec3380b5b2c4c3dc47dc9
import cv2 import numpy as np def nothing(x): pass cap = cv2.VideoCapture(0) while(1): ret,im_gray = cap.read() im_gray1=cv2.cvtColor(im_gray,cv2.COLOR_BGR2RGB) im_color = cv2.applyColorMap(im_gray, cv2.COLORMAP_JET) im_color1 = cv2.applyColorMap(im_gray1, cv2.COLORMAP_SUMMER) im_color2 = cv2.applyColorMap(i...
989,480
d988f68dfb46c2edbf55fca07e54e236ec48c0a3
#coding=utf-8 import os from flask import abort, render_template,redirect, request,url_for,flash,current_app, make_response from . import main from ..models import User, Role, Permission, Post, Comment from .. import db from .forms import FileForm, EditProfileForm, EditProfileAdiminForm, PostForm, CommentForm from flas...
989,481
c06c097289f014afa38d502534665f036a3a3510
import math import random import numpy as np import pandas as pd import matplotlib.pyplot as plt import time import pickle import sys class Utilities: def get_distance(self, vector_1, vector_2): return np.linalg.norm(vector_1 - vector_2) def generate_index(self, x, y): return str(x) + ':' + s...
989,482
e6525d0b8e1ef948ba234e54781c60495558a58d
import sys sys.path.insert(0, 'python') import cv2 import model from hand import Hand from body import Body import matplotlib.pyplot as plt import copy import numpy as np import scipy.misc from Hand_Detection import detect_hand from PIL import Image from load_image import read_image import random def parsearg(): i...
989,483
a1eab9748290d0ed11e0f7125d0a97e6db6c25fe
#!/usr/bin/env python # coding:utf-8 import argparse import glob import logging import os import sys import time import json import torch from torch.utils.data import DataLoader import torch.nn.functional as F from collections import defaultdict from pathlib import Path from typing import Dict, List, Tuple import rando...
989,484
27e3cb26c918b6b77edc45ed191d232b2400eb5a
from datetime import datetime, timedelta from typing import Union from asyncpg.exceptions import UniqueViolationError from fastapi import HTTPException, status, Security from fastapi.security import OAuth2PasswordBearer from passlib.hash import bcrypt from jose import jwt, JWTError from google.oauth2 import id_token fr...
989,485
a87c4fe31d351c1674c1d317fbbf6ac82786a4f7
''' Runtime: 52 ms, faster than 40.30% of Python3 online submissions for Search Insert Position. Memory Usage: 13.5 MB, less than 100.00% of Python3 online submissions for Search Insert Position. ''' class Solution: def searchInsert(self, nums: List[int], target: int) -> int: def binarySearch(l, va...
989,486
e06c2a98647297be711fc4c537a2f6849bbdc325
from django import template register = template.Library() from django.core.exceptions import NON_FIELD_ERRORS def error_list(value): if isinstance(value, list): return ", ".join(value) elif isinstance(value, str): return value else: return "" @register.filter(name='error_object'...
989,487
ba75d80a542335301691a51ee699bb5ddd365879
"""Tests for pib."""
989,488
533bd7d3b16685155a1c5155f1f9d7f036015daa
from __future__ import unicode_literals from django.db import models from modelcluster.fields import ParentalKey from modelcluster.models import ClusterableModel from wagtail.wagtailadmin.edit_handlers import ( FieldPanel, FieldRowPanel, InlinePanel, MultiFieldPanel, PageChooserPanel, StreamFieldPanel, ) from wa...
989,489
e66074208ab530ab182f4b3b2afaf4538370969d
#!/usr/bin/env python # coding: utf-8 # In[ ]: # GradientDescent 는 vanishing 문제가 있는데(vanishing gradient), 굉장히 큰 값을, 작은 그릇에 우겨넣다 보니까 문제가 생김. 기울기가 점점 작아지면서 # (기울기가 0에 수렴한다고 생각해봐) 기울기 찾기가 어려워짐. 그래서 나온 게 Relu - Rectified Linear Unit # hidden layer를 거치면서 미분을 거듭하고, 점점 기울기가 작아지고 수가 0에 수렴할 텐데, 그럼 backpropagation 하기가 어려워짐. #...
989,490
d37d521858eda3398bb2f6ff0adfb20ed29e3226
# -*- coding: utf-8 -*- # Copyright (c) 2020 GBC Networks Oy. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rig...
989,491
4d55e165c86487081402f5239e4363c05808a86b
import os import matplotlib.pyplot as plt from keras.models import Sequential from keras.callbacks import ModelCheckpoint from denseNetGenerator import DataGenerator from denseNet import build_denseNet def fill_infos(dataset_dir): partition = { 'train': [], 'validation' : [] } labels = { } train_dir ...
989,492
32de8e2d50d7ee6e1e614ffb1e0f2add791029f8
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-04-01 22:16 from __future__ import unicode_literals from django.db import migrations import django.db.models.manager class Migration(migrations.Migration): dependencies = [ ('service', '0004_auto_20180401_2203'), ] operations = [ ...
989,493
b7b2060adae2005b82eef8c8bcbaa57acb3875ee
#! /usr/bin/env python #! -*- coding: utf-8 -*- import re print(re.search("www", "www.alibaba.com").span()) #在起始位置匹配 print(re.search("com", "www.alibaba.com").span()) #不在起始位置匹配
989,494
e7326f752b6503fe8b55538cf7ab96c9c7f09a0c
""" 입력으로 1개의 정수 N 이 주어진다. 정수 N 의 약수를 오름차순으로 출력하는 프로그램을 작성하라. [제약사항] N은 1이상 1,000이하의 정수이다. (1 ≤ N ≤ 1,000) [입력] 입력으로 정수 N 이 주어진다. [출력] 정수 N 의 모든 약수를 오름차순으로 출력한다. """ import sys sys.stdin = open('1933.txt', 'r', encoding = 'UTF-8') N = int(input()) for i in range(1, N+1): if N % i == 0: print(i, end=' ...
989,495
e7321690434f3d1d6fcfb4f1213c6fb9830b35d9
d={"id":112,"name":"gokul","role":"senior employee", "age":27} print(d) d.copy() print(d) d.items() print(d) d1=d print(d1) print(d1["id"]) d.values() print(d)
989,496
7e09ee0388d6b931efe0d66c9327eaec396bcfa8
from lexicon import WORDS from cardbox import cardbox_quiz from matcher import * from quiz import anagram_question, anagram_quiz default_cardbox = 'evan' def judge(*words): for word in words: if word not in WORDS: return False return True def quiz_from_cardbox(*matchers, cb=dcb): ca...
989,497
bf69ffb2a9d80718afcdb1aef84cd8cc2c292108
#!/bin/python3 import sys if len(sys.argv) < 2: print("missing argument") sys.exit() target_path = '.' if len(sys.argv) == 3: target_path=sys.argv[2] G=[0b0111000, 0b1010100,0b1100010, 0b1110001] H=[0b1000111, 0b101011, 0b0011101] def codage(nbr): """compute Hamming code of a 4 bit number""" mask=1 result=0...
989,498
c403cd36e5768edfc4e460bfff60dcae7768629d
# Mejorar código para que sólo use un diccionario def longest(input_string): consecutive = {} streaks = {} streak = True for i in range(len(input_string)): if input_string[i] in consecutive and streak: consecutive[input_string[i]] += 1 elif input_string[i] not in consecutiv...
989,499
b93701890000613c50c058f0c727c6373a248c41
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.3.0 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # + [markdown] slideshow={"slide_type": "...