index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
994,900
e4b6b219c8d3d0d454dc0bb3e30d1ee3ecb7b0f5
#!/usr/bin/env python3 """ Usage: python day2-lunch-2.py fly_mapping.txt ~/data/results/stringtie/SRR072893/t_data.ctab ignore """ # Import libraries import sys # Open files mapping = open(sys.argv[1], "r") c_tab = open(sys.argv[2], "r") output = open("id_mapping_ignore.txt", "w") # Read in third argument translati...
994,901
f510bf1efbd1a53e79c34d35744a92b2c0bd6629
""" @Time : 2021/5/16 11:30 @Author : ZHC @FileName: numpy_demo.py @Software: PyCharm """ import numpy as np a = np.arange(9).reshape(3, 3) print(a) print() b = 2 * a print(b) print("水平组合 ",np.hstack((a,b))) print() print("用concatenate函数来实现同样",np.concatenate((a,b),axis=1))
994,902
4b89b05a60ff637a0de46b05c7567f86d4c24c49
class Symbol(object): def __init__(self, name): self.name = name def __str__(self): return self.name def __repr__(self): return "Symbol(%r)" % self.name def isSymbol(v): return isinstance(v, Symbol) def symbol(name, syms={}): s = syms.get(name) if s is None: s =...
994,903
d917546acc4b4729634e50b3fda27825048466aa
# Face Recognition learnt form indian # 2017-04-02 19:20:31 import cv2 import numpy as np face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') cap = cv2.VideoCapture(0) # using your own camera userId = input('Please enter the user id: ') sampleNum = 0 while True: ret, img = cap.read() ...
994,904
eedf55bbaad7883952c64d1da9a814d467eebaa4
# # @lc app=leetcode id=520 lang=python3 # # [520] Detect Capital # class Solution: def exceptUpper(self, word: str)->bool: if len(word) == 0: return True if word[0].islower(): return False return self.exceptUpper(word[1:]) def exceptLower(self, word: str)->boo...
994,905
3ce01a7ae33836d4de4e651dc9c6de037f304d0d
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ ZetCode PyQt5 tutorial In this example, we create a simple window in PyQt5. author: Jan Bodnar website: zetcode.com last edited: January 2015 """ import sys from PyQt5.QtWidgets import (QWidget, QToolTip, QPushButton, QApplication, QMessageBox, QDesktopWidget) from Py...
994,906
e667226f2272727862799c5fa382ec31ea70700b
# staff from staff_models.staffs.class_admins.staff_admin import StaffAdmin # staff phone from staff_models.staffs.class_admins.staff_phone_admin import * # staff address from staff_models.staffs.class_admins.staff_address_admin import *
994,907
4b7c0cfa3a96eec448f0f89fbd6ede1f5381ce33
#função calcula velocidade media def calcula_velocidade_media(km,h): v = km/h return v vm = calcula_velocidade_media(12,5) print(vm)
994,908
38a51b0e0c92c27bb3926320f625b2cabae5940d
from django import forms class LoginForm(forms.Form): username = forms.CharField(max_length=32) password = forms.CharField(widget=forms.PasswordInput) class NewblogpostsForm(forms.Form): title = forms.CharField(max_length=50) body = forms.CharField(widget=forms.Textarea, required=False) class...
994,909
47c9a6748420de8ff04908c36c53e02ac18d20d1
''' Init ''' from .package_name import var
994,910
2e1a979afdd3d99f064d91c2445b8385c5336462
import sys import os from adv.fgsm import FGSM from adv.jsma import JSMA from utils import load_data_for_adv, load_pretrain_model, evl_index_for_adv from config import * map_attackers = { 'fgsm': FGSM, 'jsma': JSMA, } def adv_attack(model, data_loader, max_bit, alg): attacker = map_attackers[alg](model,...
994,911
134942fb800169515e9cc0b73c464a1bf6d32703
# Generated by Django 3.1 on 2020-10-17 13:51 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('school', '0017_auto_20201002_1752'), ] operations = [ migrations.CreateModel( name='Enroll', ...
994,912
4b46a45a58755323a763a3032907c904613d019d
'''Given the names and grades for each and print the name(s) of any student(s) Note: If there are multiple students with the same grade, order their names alphabetically and print each name on a new line. Input Format The first line contains an integer, The subsequent lines describe the second line contains their grad...
994,913
374f168a0ea7c7c03c06014b7ef00a6ce8cf2779
# Generated by Django 3.0.3 on 2020-02-15 15:36 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('stock', '0002_auto_20200215_1038'), ] operations = [ migrations.RenameField( model_name='product', old_name='created_by', ...
994,914
a2e95c979db988f6119a81c45047d1d3574fb73c
import airflow from airflow import DAG from airflow.operators.bash_operator import BashOperator from datetime import timedelta default_args = { 'retries': 1, 'retry_delay': timedelta(minutes=5), 'start_date': airflow.utils.dates.days_ago(0) } dag = DAG( 'hello-world-cloud-build-test-demo-2', defa...
994,915
c21704be89cd302f26d4e2960ae9b0e0a09597b7
"""author: @pythonpips""" name = 'PythonPips' name.endswith('Pips') # outputs True
994,916
3a66fa263660e14e51b9d1779f7c88536be6afe9
import pandas as pd import requests import time import urllib from bs4 import BeautifulSoup class AppURLopener(urllib.request.FancyURLopener): version = "Mozilla/5.0" data = pd.read_excel("C:\\Users\AMasanov\\Desktop\\app_20191219_112501_659194930_2751059812.xlsx", header=None, sep=';', names=['app', '...
994,917
78224bd687949145653b9e04371c473bb04aa4e2
#!/usr/bin/env python3 # @File: person.py # --coding:utf-8-- # @Author:Schopenhauerzhang@icloud.com(Schopenhauerzhang@gmail.com) # @license:Copyright Schopenhauerzhang@icloud.com All rights Reserved. # @Time: 2019-09-23 15:00 from google.protobuf import json_format from py_protobuf.protobuf import person_pb2 import ...
994,918
b509695e7c23bb35fb853080bf47e89c6668b76c
from common.gps import gps_dist_matrix print(gps_dist_matrix([[1,2], [3,4], [5,6]]))
994,919
dede78ed01d5fc42783f4990fc1128a7c4de2099
#!/usr/bin/env python3 """Ouput the two DNA sequences with the highest number of matches, with their number of matches, from a csv.""" __appname__ = "align_seqs.py" __author__ = "Katie Bickerton <k.bickerton18@imperial.ac.uk>" __version__ = "3.5.2" __date__ = "14-Oct-2018" import sys #import csv module to allow csv fi...
994,920
78ec741487c1f204c83599e0a474cacfd70af152
import torch import argparse # import yaml # import yaml_utils from tqdm import tqdm import torch import torch.nn as nn import torch.optim as optim from torchvision import datasets, transforms,utils from torch.utils.data import DataLoader from gen_models_pytorch.gen_res_32 import Generator32 from dis_models_pytorch.dis...
994,921
bf6f828027e3dc12bbcd6c3a782fcb9551681930
from django.shortcuts import render, render_to_response, redirect, RequestContext import time from django.db import transaction, connection from django.http import HttpResponseRedirect, HttpResponse from django.conf import settings from django.conf.urls.static import static from rbmo.models import Agency, WFPData, Per...
994,922
22639e8d67ea484ba4363c34ed86bbf8996dfbeb
#! /usr/local/packages/Python-2.6.4/bin/python from sys import * from collections import defaultdict import optparse import re ############################################################################### # command line parameters usage = """find_intergenic_background_cutoff.py [options] zcontig_length_file gff3_f...
994,923
3f8ea9583311f3c4a1d672117d892bd422a276f8
class Solution(object): def maxArea(self, height): # 초기 최대값을 리스트 양끝의 2개의 숫자의 크기로 지정 pointer1 = 0 pointer2 = len(height) - 1 max_Area = (len(height) - 1) * min(height[pointer1], height[pointer2]) # 높이로 지정된 값들을 차례로 하나씩 욺겨가며 넓이를 비교 for i in range(len(hei...
994,924
d9fbd3579039ed176ad2263eeaa747598ebdff4d
def mod(a, b): while (a - b > 0): a -= b return a
994,925
074e029b6d0293022f6a45ad860e4c4860c6fdf3
"""p2 S3 Storage App Config""" from django.apps import AppConfig class P2S3StorageConfig(AppConfig): """p2 S3Storage App Config""" name = 'p2.storage.s3' label = 'p2_storage_s3' verbose_name = 'p2 S3 Storage'
994,926
e74b85a643de17712cf4863a50672666af18e43e
import os # third-party library import torch import torch.nn as nn import torch.utils.data as Data import torchvision import matplotlib.pyplot as plt from torch.autograd import Variable # Hyper Parameters EPOCH = 1 # train the training data n times, to save time, we just train 1 epoch BATCH_SIZE = 64 TI...
994,927
d6ca457cf11db98d4cd0699fec161c063c684a22
# Generated by Django 2.1 on 2018-09-03 04:49 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('onorapp', '0024_news'), ] operations = [ migrations.AddField( model_name='categorylist', name='banner_image', ...
994,928
e68b2988a5a1a09b0446850bf83c9baa2cba2df2
#!/usr/bin/env python from astropy.io import ascii,fits from astropy.wcs import WCS from astropy.table import join,vstack,Table from CSPlib.phot import ApPhot,compute_zpt from CSPlib import database from CSPlib.tel_specs import getTelIns from CSPlib import config from CSPlib.config import getconfig from matplotlib ...
994,929
a1d762cc75eebc911cf2d3699ac5b2336a2ff4b3
def answer(n): word = n[0] for letter in n[1:]: if letter < word[0]: word += letter else: word = letter + word return word with open("A-large.in") as f: with open("A-large.out", "w") as w: f.readline() question = 1 for line in f: n = line.strip() outpu...
994,930
cf7241326ab513efd09295a4a7c1ba4609a1a425
from functools import reduce import math def mygcd(*diffs): return reduce(math.gcd, diffs) ans = 0 k = int(input()) for a in range (1, k + 1): for b in range (1, k + 1): for c in range (1, k + 1): l = [a, b, c] ans += mygcd(*l) print (ans)
994,931
5b8d8576391d0ce5e27c55652c43d1fa4f6ea69e
a,b = map(int, input().split()) lcm = a*b gcd = 0 while True: gcd = max(a,b)%min(a,b) a, b = min(a,b), gcd if b == 0: gcd = a break lcm //= gcd print(gcd) print(lcm)
994,932
fdb1716c82c4456271e58744845bddc2c3fd603e
# Generated by Django 3.1.2 on 2020-11-30 13:05 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('setting', '0002_auto_20201130_1940'), ('product', '0002_auto_20201130_1646'), ] operations = [ migr...
994,933
79a6d475d17d3e6de5f5e82d28f785c90993b884
''' EJERCICIO 3 Programa hecho por Mauricio Gibrán Colima Flores Curso de Introducción a Python ''' #Importar librería para limpiar pantalla import os os.system("cls") #mensaje de bienvenida print("\n\n\t\tEste es un programa que calcula tu año de nacimiendo en base en tu edad\n") print("*Tenga en cuenta ...
994,934
ba77165cc5792319d34fd566298df2db6942998e
import socket, struct, os, binascii, base64, hashlib import telnetlib try: import psyco; psyco.full() except ImportError: pass def readline(sc, show = True): res = "" while len(res) == 0 or res[-1] != "\n": data = sc.recv(1) if len(data) == 0: print repr(res) ...
994,935
792cbb25d43c81e79869ff302b94d4332c673815
from django.core.management.base import BaseCommand, CommandError from crazyflie.models import SolvedTrajectory import decimal import random import math import time class Command(BaseCommand): help = 'Starts a process to sync the solved trajectories to the database' MIN_BENCHMARK_PITCH = 0 MAX_BENCHMARK_P...
994,936
2fc3713a2e9f9c2896ae07177433d17c573346fe
from .views import ChatListAPIView from django.urls import path app_name = 'api' urlpatterns = [ path('chat/list/',ChatListAPIView.as_view(),name='list') ]
994,937
0b251e9b81d87cf88c7c05feca4565732a7d710e
def firstten(): n=1 while n<=10: yield n n=n+1 f=firstten() for i in f: print(i)
994,938
079e5c3fd57c1cc159034c3e84174824617c42f3
#!/usr/bin/env python """ MCNPX Model for Cylindrical RPM8 """ import sys sys.path.append('../MCNPTools/') sys.path.append('../') from MCNPMaterial import Materials import subprocess import math import mctal import numpy as np import itertools import os class CylinderRPM(object): # Material Dictionaries cell...
994,939
7c8f3bc23919d7d3a66676130914f0a38feb095f
# -*-coding:utf-8 -*- # File :kaoyanbang.py # Author:George # Date : 2019/10/21 # motto: Someone always give up while someone always try! from com.android.monkeyrunner import MonkeyRunner as mr from com.android.monkeyrunner import MonkeyDevice as md print("Connect devices...") device = mr.waitForConnection() ...
994,940
d58044c24104f49dd084d32e0659c8676c2dfe6c
import Parser import Processor import Plot import numpy as np #Parse log files julLogFile = "../data/in/access_log_Jul95" augLogFile = "../data/in/access_log_Aug95" #Parser.proccessLog(julLogFile, augLogFile) #Load data timeWindow = 60 batchSize = 10 file = "../data/out/data_"+str(timeWindow)+"min.csv" data = np.load...
994,941
0a4a68e76564c6a694a0a5a3854ffd7558a7a489
import responses from django.test import TestCase from apps.utils.video import VideoHelper class VideoHelperTestCase(TestCase): def test_youtube_thumbnail(self): url = 'https://www.youtube.com/watch?v=Google123' thumbnail = VideoHelper(url).thumbnail self.assertEqual(thumbnail, 'http://im...
994,942
d4d5991e35f5580b895caa136ff004dbc0d607f8
## 서버 구동방법 # ``` $ python manage.py migrate``` # ``` $ python manage.py runserver``` # 끄는방법은 다음과 같다. # ``` $ docker stop oracle12c # ``` $ docker-machine stop``` from django.shortcuts import render, redirect from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt ##...
994,943
6bb27baeea58f8c456c79b8cd3801ae773aac497
import pickle as pickle import os import pandas as pd import torch import argparse import glob import json import time import numpy as np import random from attrdict import AttrDict from sklearn.metrics import accuracy_score from transformers import AutoTokenizer, BertForSequenceClassification, Trainer, TrainingArgume...
994,944
2f000b46fdf55d9ed9e3c06e8021facfd92fce00
#import time from rrBrowser import RenrenBrowser from rrParser import RenrenParser #from rrDB import RenrenDb from rrRecorder import RenrenRecorder storePath = 'D:/Projects/NetSci/U&I/data' rrID = input("Your Renren ID (e.g.239486743): ") rrUser = input("Your Renren Login Email: ") rrPassword = input("Your ...
994,945
7cae3d4f42e3c2cc6406b31076691dafb2740c26
from os.path import expanduser import numpy as np import pandas as pd import re import collections import time class ElapsedTimer(object): def __init__(self): self.start_time = time.time() def elapsed(self,sec): if sec < 60: return str(sec) + " sec" elif sec < (...
994,946
549795d81766a144e827d9ce9abb642074c89efc
#!/usr/bin/python import urllib import re class StockQuote: def get_quote(self, symbol): data = [] url = 'http://finance.yahoo.com/d/quotes.csv?s=' #for s in symbols: # url += s+"+" #url = url[0:-1] url += symbol url += "&f=sb3b2l1l" f = urllib.u...
994,947
a2478f843f7b07bec3066148836ce7465fd9d929
from collections import defaultdict from collections import Counter import collections import enum from re import A #import numpy as np import sys import argparse import math import random from tkinter import N # https://www.daleseo.com/python-typing/ from typing import Optional from typing import Union from typing im...
994,948
73dfb95a858941903b436b4ef50c903da0936d69
""" The server for Reddit poll """ import json from datetime import datetime import sqlite3 from contextlib import closing from flask import Flask, render_template, request, send_from_directory from flask import g, url_for from numpy import base_repr app = Flask(__name__, static_url_path="") """ create table user( ...
994,949
543bcb463041f37e84c10279ec685045e9285d4b
# finance_data.py # tutorial: https://www.freecodecamp.org/news/how-to-scrape-websites-with-python-and-beautifulsoup-5946935d93fe/ # Import libs from bs4 import BeautifulSoup as BS import requests as r from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.suppo...
994,950
a29fe86bc1b45f6beede19e51634656eaa0125c0
import app app = app.APP() app.main()
994,951
2ed85d6999f988d3023ba7d2b3b61d8b906581d5
""" shyness = [n, m, k, ...] 1) sort in ascending order of shyness 2) find first person who won't stand and add enough people to make him/her stand and iterate - accumulate number of standing people as you pass down the sorted list """ def solve(shyness_counts): "return number of friends added" n_stan...
994,952
9b4dd65e040249f1041113177aa44598574e4a9e
#!/usr/bin/env python # """ Prepare data for diffuse all-sky analysis """ import os import copy from collections import OrderedDict import yaml from fermipy.jobs.utils import is_null from fermipy.jobs.link import Link from fermipy.jobs.chain import Chain from fermipy.jobs.scatter_gather import ScatterGather from fe...
994,953
25625841dd4d653e41453f36a832d739323d4136
import sys from os.path import join from pathlib import Path import importlib import math import random import bpy sys.path.append('/work/vframe_synthetic/vframe_synthetic') from app.utils import log_utils, color_utils importlib.reload(log_utils) importlib.reload(color_utils) from app.blender.materials import colorfi...
994,954
388404e0ae54aae34178bdc22ad03b29c2f6741d
clusters = [('seq1',), ('seq2',), ('seq3',), ('seq4',), ('seq5',)] merges = (('seq3',), ('seq4',)) temp_subcluster = () for items in [merges][-1]: if type(items) is tuple: for elements in items: temp_subcluster += (elements,) # merge sub sub clusters into one else: temp_subcluster +...
994,955
ba159673fb165939df0429747f1d8edb21d9751d
from rest_framework import serializers class ProfileSerializer(serializers.Serializer): id = serializers.IntegerField() username = serializers.CharField() last_login = serializers.DateTimeField() login_count = serializers.IntegerField() project_count = serializers.IntegerField()
994,956
ba2606e8b5ea8c7a411adc9fe594316c599b19d1
### Chapter 11: Testing Your Code ## Testing a Class # A Class to Test (Cont'd) from survey import AnonymousSurvey """ Define a question and start a survey. """ question = "What language did you first learn to speak? " my_survey = AnonymousSurvey(question) """ Show the question and store responses to the questi...
994,957
2f345ddbcac1a2e6eb5cde2da7a2ce9a9535fc95
#!/usr/bin/env python3 #Name: Jasrajveer Malhi (jmalhi) """ The program PAMfinder uses a fasta file input and will output a text file containg the 20 nucleotide sequence adjacent to PAM sequence (NGG). The general flow of the program is to first run through all six reading frames to identify the 'NGG' sequence then...
994,958
5de5703137f9bd6fe9c9c192bad5700e4512a6cd
import setuptools version = '1.0.0' setuptools.setup( name='Mtns electrumX', version=version, scripts=['electrumx_server', 'electrumx_rpc', 'electrumx_compact_history'], python_requires='>=3.6', install_requires=['aiorpcX>=0.10.1,<0.11', 'attrs', 'plyvel', 'pylru', 'aiohttp >= 2'...
994,959
4de48e3bf481c00ce0107245879c0e1b79c4d0a8
from blog import app from blog.views import socketio if __name__ == '__main__': socketio.run(app, debug=True)
994,960
a7a7252cd0685c9ee7ed5989990b4aa30a5e627b
#5. Реализовать структуру «Рейтинг», представляющую собой не возрастающий набор натуральных чисел. # У пользователя необходимо запрашивать новый элемент рейтинга. # Если в рейтинге существуют элементы с одинаковыми значениями, то новый элемент с тем же значением должен разместиться после них. # Подсказка. Например, наб...
994,961
93a60102cb77330840e8df8874eccbee35892436
import math primes = {} def is_prime(n): global primes if primes.get(n, False) == True: return True if n % 2 == 0 and n > 2: return False return all(n % i for i in range(3, int(math.sqrt(n)) + 1, 2)) t = int(raw_input()) while t > 0: input_range = raw_input() start = int(i...
994,962
d96dec24cfbb34b44400996158f095a3836b5329
import random from Save import Save class Word: def __init__(self): """Initialisation: download the actual version of data.json """ d = Save("") self.dico = d.download() def getDico(self): return self.dico def pickWord(self): print("A Word is picked") ...
994,963
edfae257380c9d8dbc5c2d4814bf9a067b005afe
# MIT License # # Copyright (c) 2020 Archis Joglekar # # 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 rights # to use, copy, modify, mer...
994,964
18cad137f850c4b166ce5940b87cc68683eeed82
INSERT_DATA_NUM = 1000 # develop_modeでinsertする数 MAX_QUERY_SIZE = 500_000 # 500KB MAX_SELECT_RECORD = 500 MAX_MECAB_PARSE_NUM = 500 # 500回
994,965
b41f0aef3baed287772a5e311b9a360bf600e7aa
# -*- coding: utf-8 -*- """ Created on Sat Feb 25 21:16:25 2017 @author: User """ from docx import Document def createTable(): doc = Document() table = doc.add_table(rows=9,cols = 9) cell = table.cell(0,1) cell.text = "work" doc.save("F:/test.docx") createTable()
994,966
9f4861a026de8658bb790e5536c2c419c290587c
from homeassistant.components.hive import *
994,967
fbcb63f7b5f354b57e8806c18d163158b1d9d1ba
#Linear metadata model for testing purposes from comet_ml import Experiment import tensorflow as tf from DeepTreeAttention.trees import AttentionModel from DeepTreeAttention.models import metadata from DeepTreeAttention.callbacks import callbacks import pandas as pd model = AttentionModel(config="/home/b.weinstein/Dee...
994,968
eff7e3f450310e9c7dfb62b0d148fcffc964ffea
"""Tests for the flake8.style_guide.StyleGuide class.""" from __future__ import annotations import argparse from unittest import mock import pytest from flake8 import statistics from flake8 import style_guide from flake8 import utils from flake8.formatting import base def create_options(**kwargs): """Create an...
994,969
637c3058235ef8e34a5263f4e074fe6eb73f1c31
# -*- coding: utf-8 -*- """ Created on Wed Mar 20 10:52:29 2019 HW9 @author: tianminz """ import math #returns the alternating sum of the list def alternatingSum(lst, depth = 0): if len(lst) == 0: return 0 elif len(lst) == 1: return lst[0] return lst[0] - lst[1] + alternatingS...
994,970
618fafce5450ed0894b14de04bdf4eeb1a64a128
from django.db import models from django.contrib.auth.models import AbstractBaseUser from django.conf import settings from django.db.models.signals import post_save from django.dispatch import receiver from rest_framework.authtoken.models import Token from django.contrib.auth.models import UserManager class Tasks(mod...
994,971
1f29abbf191750ff5f1cedbd9acea7917dfc9001
import numpy as np import math import pandas as pd import matplotlib.pyplot as plt from matplotlib.patches import Circle import scipy from mpl_toolkits.mplot3d import Axes3D import time from camera_capture import get_image from velodyne_capture_v3 import init_velo_socket, get_pointcloud import socket de...
994,972
838f26df45377b837270811b0b7c4330603bafa8
from django.conf.urls import url from .import views from accounts.views import LandingPageView from django.contrib.auth.views import login, logout, password_reset, password_reset_done from django.contrib.auth import views as auth_views app_name = 'accounts' urlpatterns = [ url(r'^$', LandingPageView.as_view(), n...
994,973
2087f6e89b2aebb028bb78c7cb83812d40ed0fa6
n = int(input()) if n > 2: print(n-2) else: print(1)
994,974
904fbee2f4e53994fc86bd6f3847398dd1d3c0bb
# -*- coding: utf-8 -*- """ Created on Thu Sep 10 17:43:15 2020 @author: figonpiot """ # filtracja cyfrowa (DSP) from matplotlib.pyplot import subplots, plot, xscale, xlim, show, close from scipy.signal import firwin, chirp, lfilter from numpy import linspace,pi,random t = linspace(0,1,8001) x = chirp(t,1...
994,975
6428acd75d91e6225a1bc8664e116ba32e00d0de
import configparser import requests import sys from os import path def read_config(): """ Read a config file from ``$HOME/.profrc`` We expect a file of the following form [DEFAULT] Baseurl = https://your-prof-instance Login = username """ filename = path.join(path.expanduser('~'), '.p...
994,976
f101f8bd842d6d1d299a87a42f7a9a904a913a21
# -*- coding:utf-8 -*- # 定义多点坐标_绘出折线_并计算起始点和终点距离 import turtle import math # 定义多个点的坐标 x1,y1 = 100,100 x2,y2 = 100,-100 x3,y3 = -100,-100 x4,y4 = -100,100 # 绘制折线 turtle.penup() turtle.goto(x1,y1) turtle.pendown() turtle.goto(x2,y2) turtle.goto(x3,y3) turtle.goto(x4,y4) # 计算起始点和终点的距离 distance = math.sqrt((x1-x4)**...
994,977
1fe507cd8e5bd247528f902c37d2e50731d2302f
import random for count in range(5): id_prefix = '6245647845412' # define the card id,15 digit number id_suffix = random.randint(10000, 99999) # random number for 16-18 bankid = id_prefix + str(id_suffix) # connect the prefix and suffix sum = 0 # the count var for i in range(len(bankid) - 1, ...
994,978
3906a490b319ba6cf3867c91af26f946d38bbab6
from django.shortcuts import render from django.http import HttpResponseRedirect from django.urls import reverse from django.contrib.auth import logout,login,authenticate from django.contrib.auth.forms import UserCreationForm # Create your views here. def logout_view(request): #注销用户 logout(request) return HttpResp...
994,979
f28986fea7d05b3d0184c1f955244c8b89165bce
import collections import itertools from copy import deepcopy from gensim.models.word2vec import Word2Vec from gensim.models.callbacks import CallbackAny2Vec from ray import tune from recsys.data import ( load_recsys15, load_aotm, load_ecomm, train_test_split ) from recsys.metrics import recall_at_...
994,980
4df87e95368fbe3e8bdd3e3b70db46aecf6ef905
""" File to keep basic view classes (for instance for ajax requests, etc.) """ from django.http import JsonResponse, HttpResponseBadRequest, Http404 from establishment.funnel.encoder import StreamJSONEncoder class HTTPRenderer(object): pass global_renderer = HTTPRenderer() def default_render_error_message(re...
994,981
ea6fe88f439c48f966d3b79e0c19019bc0825f21
import math_func import pytest import sys # used to demonstrate the skipif decorator # sys give us the python version """ Add decorator "mark" before each test to allow us run a specific group of tests Here we have two marks: number and strings pytest test_math_func.py -v -m number #runs only test_add and ...
994,982
21d1b1be811d37e9b3fedd1d8962d0a6f57567ce
import hashlib #1-1 待加密的字符串 str='111111' #1-2 实例化一个md5对象 md5=hashlib.md5() #1-3 调用update方法进行加密 md5.update(str.encode('utf-8')) #1-4 调用hexdigest方法,获取加密结果 print(md5.hexdigest())
994,983
0988400ebdcd3945ef6628200f3e1dd739d6983f
import logging import time import random import tornado.ioloop import tornado.httpserver import tornado.httpclient import tornado.options import tornado.web import redis from tornado.options import define, options define("port", default=8888, help="run on the given port", type=int) logging.basicConfig(format='%(lev...
994,984
629acc1cd929c14cd8abf8409cfbe3fe6a8e05b5
from django.shortcuts import render, HttpResponse, redirect from .models import User from django.contrib import messages import bcrypt # Create your views here. def index(request): return HttpResponse("vuelve") def index(request): return render(request, "index.html") def register(request): print(reque...
994,985
c9aae5138ea1fe970a424bad21c3955553f1e463
import pandas as pandas import numpy as numpy import yfinance as yf import datetime as dt from pandas_datareader import data as pdr yf.pdr_override() stock=input("Enter a stock ticker symbol: ") print(stock) startyear=2019 startmonth=1 startday=1 start=dt.datetime(startyear,startmonth,startday) now=dt.datetime.now...
994,986
2774661464568e010658241946a3ba74f8e29bb6
from project import socketio from project import app import os debug = True if os.environ.get("ENV") == "production": debug=False if __name__ == "__main__": socketio.run(app, debug=debug)
994,987
7c42efea22fc640841df5e6e88d7003b26e47386
from __future__ import division from collections import Counter from utils import get_dset, get_test, pprint_word def get_tagged_vocab(dset): return set(w for sent in dset for w,m in zip(sent['ws'],sent['ii']) if m) def get_vocab(dset): return set(w for sent in dset for w in sent['ws']) def get_contexts(sent...
994,988
208fc1e8d46da72357639d180d4adeaf139231a0
# -*- coding: utf-8 -*- import shutil import os from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import Select def donwload(arquivo): # arq = 'C:\\caminho\\testes\\'+ arquivo diretorio = u'{}/{}'.format(os....
994,989
1950d79935bb43abd9984ed9576551eb22f5142a
import json import time import redis from Data import TemperatureLog class Database: instance = None @classmethod def getInstance(cls): if Database.instance is None: Database.instance = cls() return Database.instance def __init__(self): self.database = redis.Stri...
994,990
3252558251ef483d63cd2c24f4e9df26988428f9
# BinarySearchTree sample code class BST: def __init__(self,root,left,right): self.root = root self.left = left self.right = right def __eq__(self, other): if other == None: return False else: return self.root == other.root and self.left == othe...
994,991
473ea953d017dcb6b3288e4587ae7843cea28be3
#!/usr/bin/python #-*- coding: utf-8 -*- class Product: def __init__(self): self.ID = None self.Name = None def Add Product(self, ): pass def Remove Product(self, ): pass
994,992
f44be79d296a3780ed6a0893f8f40928862a3582
# Licensed to Modin Development Team under one or more contributor license agreements. # See the NOTICE file distributed with this work for additional information regarding # copyright ownership. The Modin Development Team licenses this file to you under the # Apache License, Version 2.0 (the "License"); you may not u...
994,993
c80d97a218a4e2b60893b333f96a1526398a47c2
''' Input1: 3 26 40 83 49 60 57 13 89 99 Output1: 96 ''' import sys input_size = int(sys.stdin.readline()) accumulated = [0]*3 for i in range(input_size): r, g, b = sys.stdin.readline().split(' ') r = int(r) g = int(g) b = int(b) r += min(accumulated[1], accumulated[2]) g += min(accumulate...
994,994
8035f3956c6a71b11b72fdd1e7029f83b55ff91f
import math import random import feedback as fb class AdPublisher( fb.Component ): def __init__( self, scale, min_price, relative_width=0.1 ): self.scale = scale self.min = min_price self.width = relative_width def work( self, u ): if u <= self.min: # Price below min: n...
994,995
f62bc97442a463046a8304cd9b13f637a7e20c15
from django.http import HttpResponse from django.shortcuts import render from django.core.exceptions import PermissionDenied from django.shortcuts import redirect from team.models import * from django.db.models import Q def userIsTeamLeader(function): def wrap(request, *args, **kwargs): team = Team.objects.get(team...
994,996
b07a81276863e7cd0fac8e2ad78d131e0f30ed0b
# ---------------------------------------------------------------------- # initial # ---------------------------------------------------------------------- # Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- # Third-party modules ...
994,997
f852fbdfcfa0f8b4565618740c4f5677630bd3b8
from ED6ScenarioHelper import * def main(): SetCodePage("ms932") CreateScenaFile( FileName = 'T0601 ._SN', MapName = 'Rolent', Location = 'T0601.x', MapIndex = 17, MapDefaultBGM = "ed60016", Flags ...
994,998
89d2b75ea3d9cfa5a92408c18636ce21dde0e534
# Generated by Django 2.0.2 on 2018-05-24 08:58 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('report_data_extract', '0055_auto_20180524_1153'), ] operations = [ migrations.AddField( model_name='fielddesc', name...
994,999
9bd800ab25a2f431decfcc8ae2fbbeca3541db2c
from collections import deque from math import sin, cos, floor, pi, log10 from numbers import Number from util import NamedDescriptor, NamedMeta, configable, clamp import operator _tau = 2*pi class SpaceTimeContinuumError (Exception): pass class Signal (metaclass=NamedMeta): """ Signals normally operate over [...