index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
992,300
7a31ab4e4cdc315aca0656e73b8b65337bd0eef9
number=sum=0 k=int(input("Enter the value")) for i in range(0,k): number=i sum=0 while number>0: digit = number%10 sum=sum+pow(digit,3) number= int(number/10) if i==sum: print(i)
992,301
303de2fdf813e4e17bd3888a4cc2f0d92a147140
#!/usr/bin/env python # encoding: utf-8 import npyscreen class TinyForm(npyscreen.FormBaseNew): DEFAULT_NEXTRELY = 0 BLANK_LINES_BASE = 0 class TestApp(npyscreen.NPSApp): def main(self): F = TinyForm(name = "Welcome to Npyscreen", framed=False, ...
992,302
7dbfca13ced1fb25d1363fca634bbd45560025a6
def binary_search(arr, ele): start = 0 end = len(arr) - 1 while start <= end: mid = (start + end) // 2 if (arr[mid] == ele): return mid elif (arr[mid] > ele): end = mid - 1 else: start = mid + 1 return -1 print("Enter The Size Of Th...
992,303
1c7212d85d47218566c97c05cf41a248346c7a32
#!/usr/bin/env python #$ python setup.py build_ext --inplace from numpy.distutils.command import build_src # a bit of monkeypatching ... import Cython.Compiler.Main build_src.Pyrex = Cython build_src.have_pyrex = True def have_pyrex(): import sys try: import Cython.Compiler.Main sys.modules['...
992,304
09888e1e35fe7b5cecf8bf075a79715672a15cb3
from CardDetector import CardDetector import cv2 import pyfirmata import time import VideoStream import time import CardSort cardDetector = CardDetector() #cap = cv2.VideoCapture(0) #for i in(range(10)): # Capture frame-by-frame # ret, frame = cap.read() IM_WIDTH = 1280 IM_HEIGHT = 720 FRAME_RATE = 10 # vide...
992,305
e5d67862453e2e3496baac2d0ea16133b8dc38cc
import numpy as np ## Accuracy calc def accuracy(y_test, y_pred): return np.sum(y_test == y_pred) / y_pred.shape[0]
992,306
54e8a219141ca080f2e574fc92626f00b0cb19b4
import requests import urllib import urllib2 import json from urllib2 import urlopen import bs4 as BeautifulSoup import sys import re community = open("list-stable-community-larbi.txt", "w") stable = [] with open("list-community-larbi.txt") as f: userBlog = f.readlines() userBlog = [x.lower() for x in userBlog]...
992,307
699b0fb6c6a85a7e9da85563d0550dc3ee914619
""" ========================= Project -> File: leetcode -> 1306_Jump_Game_III.py Author: zhangchao ========================= Given an array of non-negative integers arr, you are initially positioned at start index of the array. When you are at index i, you can jump to i + arr[i] or i - arr[i], check if you can reach to...
992,308
fab655e8b21b0caaf6f20f95d14e058815d4e94f
import time import random def maxHeap(arr, n, i): largest = i l = 2 * i + 1 r = 2 * i + 2 if l < n and arr[i] < arr[l]: largest = l if r < n and arr[largest] < arr[r]: largest = r if largest != i: arr[i],arr[largest] = arr[largest],arr[i] ma...
992,309
dfff9db720145f45efec953a5b0c334f38bf592c
# 349. 两个数组的交集 # 给定两个数组,编写一个函数来计算它们的交集。 # 示例 1: # 输入: nums1 = [1,2,2,1], nums2 = [2,2] # 输出: [2] # 示例 2: # 输入: nums1 = [4,9,5], nums2 = [9,4,9,8,4] # 输出: [9,4] # 说明: # 输出结果中的每个元素一定是唯一的。 # 我们可以不考虑输出结果的顺序。 class Solution(object): def intersection(self, nums1, nums2): """ :type nums1: List[int] ...
992,310
ccdefc8e1d51f8fe07a9326e0a7417f6bdc1a2c6
import numpy as np import os import random import pandas as pd import configargparse as argparse import itertools from group_robustness_fairness.prediction_utils.util import yaml_write from sklearn.model_selection import ParameterGrid from group_robustness_fairness.omop.train_model import filter_cohort parser = argpa...
992,311
0736931053f71ca3d102281a00ba983d825760ba
# Generated by Django 2.0.5 on 2018-11-26 08:49 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('bo', '0010_auto_20181114_1356'), ] operations = [ migrations.CreateModel( name='Absence', ...
992,312
632d988fb2320e48ff844c499b4713c7eb643e42
from django.apps import AppConfig class AppmoviesapiConfig(AppConfig): name = 'appmoviesapi'
992,313
a8875ad54ab6dab1a18855c2c817e40465322cd7
import pytest from isic_challenge_scoring.classification import ClassificationMetric, ClassificationScore @pytest.mark.parametrize( 'target_metric', [ ClassificationMetric.AUC, ClassificationMetric.BALANCED_ACCURACY, ClassificationMetric.AVERAGE_PRECISION, ], ) def test_score(clas...
992,314
65cb5506cc12818421e62b5bf41d8d51bc849ec7
/home/hanh/anaconda3/lib/python3.7/genericpath.py
992,315
138dda6a37a0e52fdc19fcfb94d61ff3d7b375fd
#Driver Path driver_path = '/Users/[yourusername]/Documents/Scraping/linkedin/chromedriver' #Login email = '[yourusername]@gmail.com' password = '[yourpassword]' #Input Filenames company_url_path = '/Users/[yourusername]/Documents/Scraping/Linkedin/company_urls.csv' profile_url_path = '/Users/[yourusername]/Document...
992,316
63e5806ecf0695a781b6acd639cd70b9b1d67a52
''' Created on Jun 3, 2013 @author: sumanravuri ''' import sys import numpy as np import scipy.io as sp import copy import argparse from Vector_Math import Vector_Math import datetime from scipy.special import expit from RNNLM_Weight import RNNLM_Weight class Recurrent_Neural_Network_Language_Model(object, Vector_Ma...
992,317
9bddbea9642f9c090a2a077aa3827db849532e9d
# Generated by Django 2.2.6 on 2019-10-21 17:03 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] ope...
992,318
14d83079095c5e1fec9c2b16c4f1b8ad58c5e28d
#!/usr/bin/env python3 import signal import sys import time import wiringpi as pi trigger_pin = 17 echo_pin = 23 def send_trigger_pulse() -> None: pi.digitalWrite(trigger_pin, pi.HIGH) time.sleep(.0001) pi.digitalWrite(trigger_pin, pi.LOW) def wait_for_echo(value, timeout) -> None: count = timeout ...
992,319
3db0c1f7f8c6e7cddce7ab9c2fda4382caec4e2b
import AllModules as am import json as js ################################################################################################################################################################################################################ ...
992,320
e269f6746fa57fb0a45e6cc8eec06be3bed7db1e
import sys from PyQt5.QtWidgets import * class LabelItem(QLabel): def __init__(self, *__args): super().__init__(*__args) class Widget(QListWidget): def __init__(self): super().__init__() self.setItemWidget(QListWidgetItem(self), LabelItem("ttttttt")) if __name__ == '__main__': ...
992,321
28c7565cb588438c403d9c51a49e43678b3ac228
# binary search, O(log(n)) for each call pick(), overhead in __init__() is O(n) # space O(n) import random, bisect class Solution(object): def __init__(self, rects): """ :type rects: List[List[int]] """ self.bottomleft = [] # self.bottomleft[i] is the bottomleft point and the wid...
992,322
e5f452013bbbd470954fb2ef231b0192c631406f
while True: try: a = int(input('請輸入第一位數字:')) b = int(input('請輸入第二位數字:')) c = int(input('請選擇何種運算符號?\n1.加, 2.減, 3.乘, 4.除')) if c == 1: print('{} 和 {} 相加後的答案為:{}'.format(a, b, a+b)) d = input('要繼續嗎?按Q離開') if d == 'q' or d == 'Q': break elif c == 2: print('{} 和 {} 相減後的答案為:{}'.format(a, b, a-b)) ...
992,323
56b48600364b8c820f3cedcbb45ea520684e0f59
class SMSBackend(object): """Base interface for an SMS backend.""" def send(self, to, from_, body): """Send an SMS message.""" raise NotImplementedError
992,324
d5030bc033d3d3126dbe419cc6c686d0bffc3802
# -*- encoding: utf-8 -*- from enum import Enum, unique @unique class EntityScope(Enum): ''' This Enumeration: <EntityScope> is for to identify the category or scope of an entity. Esta Enumeración: <AmbitoEntidad> es para identificar la categoría, ámbito o alcanze de una entidad. ...
992,325
d6f3c46be4efbfcb402b600c336affc3803dbb1d
import math as m import numpy as np import ik, macros, hlsockets, helpers import gait_alg_test as gait_alg from time import sleep, time # 0-2 are leg 1, 3-5 are leg 2, 6-8 are leg 3, 9-11 are leg4 # 0 -> hip, 1 -> elbow, 2 -> knee angles = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] claws, body = ik.make_standard_...
992,326
7987316a1a4bb1203b0bcac3f5aeaa9372be5f7f
########################## # Author: PZmyslony # Module Name: Rectangle # Date: 10/02/2020 # Version: 0.1a ########################## import math import doctest class Rectangle: def __init__(self, width, height, color=(255,0,0)): ''' (num,num,tuple) -> None Create instance of ...
992,327
c535e1069d079f25233f9ce9cff6056101fc1053
import os import cPickle as pickle try: import xml.etree.cElementTree as ET except ImportError: import xml.etree.ElementTree as ET import numpy as np from scipy import sparse import util import xgboost as xgb def main(): print "# Loading features..." X_train, t_train, _ = pickle.load(open("../../featur...
992,328
f1a2526606ec957bac901d645742d346f82687ae
import math from utils import rgx from config import config ### CONTEXT ####################################################################### class Context: def __init__(self, tokens, weight): self.tokens = tokens self.weight = weight self.ctx = {} for token in self.tokens: ...
992,329
d0e99451068a133ae07f762552a77746cfc051fe
import string, random def make_word(string_pattern): # Returns arbitrary list of vowels and consonants based on specified format ...
992,330
c30a493a709e0db5eeaa2c3292d23182ac80b752
from pyspark.sql import SparkSession import logging.config if __name__ == "__main__": spark = SparkSession \ .builder \ .master("local[2]") \ .appName("WelcomeToPySparkSQLExample") \ .getOrCreate() logging.config.fileConfig('logging.conf') logger = logging.getLogger('Welcom...
992,331
bdcc4be519fefbc1d4771237ca8da6b2475ccb0e
#!/usr/bin/env python import os from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(here, "README.md")) as f: long_description = f.read() requires = [ 'astroid==2.2.0', 'click==6.7', 'falcon==1.4.1', 'gunicorn==19.9.0', 'jsonsc...
992,332
64770cffb0ad3aceb76a14780e7edd53a57fef03
#export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH import sys import cv2 import math import numpy as np import struct import pickle from joblib import Parallel, delayed def read_imagelist(fname, imagelist): with open(fname, 'r') as f: for line in f: imagelist.append(line) return; #extrac...
992,333
8d27703042f206f35e496b61f249f2aea84ce770
students = [1,2,3,4,5] print(students) students = [i+100 for i in students] print(students) students = ["Iron man","Thor","groot"] students = [len(i) for i in students] print(students)
992,334
b89c460755f6678558c93101a0ee67713edfde5c
import task3_2 as task3_2 # UNCOMENT THIS to change running file import task3_lyap as task3_lyap import task3_3 as task3_3 import timeit import sys from copy import deepcopy import numpy as np #================time test!==== params = { "args" : [], "kwargs": { "Omega": 0.06066, "K": 1, }, ...
992,335
c007894cc61feee745f50d90c668acaf7e29f2ef
################################################################### ### Import Python Libraries ################################################################### import sys, glob, os, re, math, time import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab import pandas as pd import pylab as p...
992,336
478ec1da0cb46ce076c624cd059d86d88ab35e8c
''' Классы Домашнее задание Вопросы по лекциям 1. Напишите название функции, которая является конструктором класса. Ответ: __init__(self) 2. На что указывает переменная self? Ответ: На сам объект(instance) 3. С помощью какой функции можно проверить, что некая строка является именем одного из атрибутов объекта? ...
992,337
4851cb0d2ef9037e1c3a30f858592688e431f439
desks=int(input("Enter the number of desks)")) Cls1= desks//2 deskcls1=(f"The remaining number of desk cls1") Cls2= desks//2 deskcls2=(f"The remaining number of desk in cls2") Cls3 = desks//2 deskcls3=(f"The remaining number of desk in cls3") stucls1=int(input("Enter the number of students in cls1")) stucls2=int(input(...
992,338
ada3c42cd76b997d8d5b95da993d6a47ef3f9597
import numpy as np import cv2 import matplotlib.pyplot as plt from skimage.feature import hog import matplotlib.image as mpimg from scipy.ndimage.measurements import label import pickle color_space = 'YCrCb' orient = 9 pix_per_cell = 8 cell_per_block = 2 hog_channel = 'ALL' spatial_size = (32, 32) hist_bins = 32 spati...
992,339
cd74d1745c1b37c63edeebe5456e56caac583938
""" Functions to check FASTA and GFF files for coding sequence (CDS) features. """ import bisect import csv import os import warnings from Bio import SeqIO import gffutils from pyfaidx import Fasta from pyfaidx import FastaIndexingError from riboviz.fasta_gff import CDS_FEATURE_FORMAT from riboviz.fasta_gff import STAR...
992,340
aa6355685afa0ee66ff1388001106681ce8930d5
import os, re import errno from django.db import models from django.contrib.auth.models import User, Group from django.template.defaultfilters import slugify from datetime import datetime from django.conf import settings # Create your models here. class Category(models.Model): name = models.CharField(max_length=50...
992,341
886c9277354006c5511299bf2b9fee396040660e
#encoding=utf8 import sys import getopt import time import re from selenium import webdriver import requests import json import openpyxl import codecs import pymysql url = 'http://mall.mengguochengzhen.cn' driver = webdriver.Chrome() driver.get(url+'/mgcz/system/index') driver.find_element_by_id('form-username').send_...
992,342
7d383029a8753c3318c0126a75b7f41929eba45a
import sys # N: コマ数 # M: 地点数 N,M,*X = map(int, open(0).read().split()) # コマ数が地点数以上の場合、各地点にコマを配置できる # よって 0 回の移動で目的を達成できる if N >= M: print(0) sys.exit() X.sort() D = sorted([abs(X[i+1] - X[i]) for i in range(M-1)], reverse=True) print(X[-1] - X[0] - sum(D[:N-1]))
992,343
a198cf51c19261b84b0181468e7dfb0649a62e5c
#!/usr/bin/env python from __future__ import print_function, division import os import time import numpy as np import theano import theano.tensor as T import lasagne import argparse import matplotlib.pyplot as plt from os.path import join from scipy.io import loadmat from utils import compressed_sensing as cs from u...
992,344
d63afae209cb80e8d1ebb1921d6d1af3694004ea
# coding: utf-8 # In[54]: import lda import lda.datasets from __future__ import division, print_function import numpy as np import string from nltk.tokenize import word_tokenize from collections import defaultdict import unicodedata from collections import Counter import math # In[62]: #function to load abstracts...
992,345
7f75922ee64ec696d14374388cd7a615625dc3db
from django.conf.urls import include, url from . import views urlpatterns = [ url(r'^$', views.post_list), url('inicio', views.inicio, name='inicio'), url('login', views.login, name='login'), url('registro', views.registro, name='registro'), url('client_dashboard', views.client_dashboard, name='cli...
992,346
18345b886f01a6f1de955e823111994bb5de8253
import torch import torch.nn as nn TOTAL_TIME_STEP = 3 FEATURE_LENGTH = annotation(1) + edge_type(C52) + FEATURE_LENGTH node_vectors = Matrix((batch_size, num_of_edges -> CN2(num_of_atom), FEATURE_LENGTH)) # input edge_type_matrix = Matrix((edge_type, num_of_edges)) # input # message passing (MP) mp_matrix = Matr...
992,347
294471587b29122e3ac9611a04e5090621e99ad3
n = 3 while n > 0: soma = 0 while True: s = input() if s == 'caw caw': print(soma) break else: s = s.replace('*', '1') s = s.replace('-', '0') soma += int(s,2) n -= 1
992,348
c25683dc416f23473be7cfdb029f03f5eaf7329c
__all__ = () from scarletio import ScarletLock, RichAttributeErrorBaseType, copy_docs from ...discord.core import KOKORO class RateLimitContextBase(RichAttributeErrorBaseType): """ Rate limit context used to handle static rate limits when communicating with top.gg. Attributes ---------- acq...
992,349
2b8bc6f425b0a5a58140e4837694f3443174f3e2
""" ---Fibonacci--- f(n) = f(n-1) + f(n-2) for n => Natural numbers start values: f(0) = 0 f(1) = 1 """ def fibonacci(n, fib_arr=[0,1]): if n <= 0: return fib_arr[0:] if n <= len(fib_arr): return fib_arr[n-1] nth_fib = fibonacci(n-1) + fibonacci(n-2) fib_arr.append(nth_fib) ...
992,350
6918c92b2a4cd0869be614360d57f3943352fce5
#coding: utf8 from django.contrib import admin from xuezhangshuo.account.models import xzsUser admin.site.register(xzsUser)
992,351
e01c8990e3eb9bb6319e49b565540f9028dfd3cb
import datetime from sqlalchemy import Column, Integer, String, DateTime, ForeignKey from models import db class SiteToRoom(db.Model): __tablename__ = "site_to_room" id = db.Column(db.Integer, primary_key=True) room_id = db.Column(db.Integer, ForeignKey("room.id")) hostname = db.Column(db.String(50)...
992,352
08d2fcaec0f15fa9629aee1395d4084b1cafe14d
import xadmin as admin from orderapp.models import OrderRecord, Order # Register your models here. @admin.sites.register(OrderRecord) class OrderRecordAdmin(object): def avg_count(self, obj): return int(obj.order_cancel / obj.order_count) avg_count.short_description = "Sum Count" avg_count.all...
992,353
e2584ab4c7523b58c1511ee43294585aea134ecd
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Event', fields=[ ('id', models.AutoField(serial...
992,354
0f804cd0db25db91c6e23beb983f9233a227e524
import numpy as np from gpmap.gpm import GenotypePhenotypeMap from gpmap import utils # Local imports from epistasis.mapping import (EpistasisMap, mutations_to_sites, assert_epistasis) from epistasis.matrix import get_model_matrix from epistasis.utils import extract_mutations_from_genotypes from epistasis.models.utils...
992,355
561c8c0f432bf386ad4e48a07da525cf3f850d81
# Generated by Django 2.2.7 on 2019-11-08 12:18 import django.contrib.sites.managers import django.core.validators from django.db import migrations, models import django.db.models.deletion import django.db.models.manager import thumbnails.fields import uuid class Migration(migrations.Migration): initial = True ...
992,356
67e2dce70002bd99f0d1bbb4d9c83fdc59bba7d0
from pymongo import MongoClient import random # CRUD class MongoDB: """ 封装的Mongodb操作方法 """ def __init__(self): client = MongoClient('localhost', 27017) self.database = client['ip_proxy'] # print(client.database_names()) self.collection = self.database['ips'] #...
992,357
d5feee75c9a10a6b6d656dd1a7926e462054fb0c
import csv import sys import random from os import listdir from os.path import isfile, join, abspath import webbrowser # from goose import Goose # import eatiht import dragnet import libextract.api from newspaper import Article import justext # try: # from boilerpipe.extract import Extractor # except: # from bo...
992,358
4342664cd81ef0ab0d49d166f07ccd1da8130f45
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010-2011 OpenStack LLC. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache...
992,359
6280c83566824243ac957ef8d21f73328bbb828d
class Company: def __init__(self, row): self.row = row @property def name(self): return f"{self.row.title} ({self.row.org})" @property def region(self): return f"Регион: {self.row.region}" @property def inn(self): return f"ИНН: {self.row.inn}" @propert...
992,360
b09675e02ef9422054809da8b520f4ea86749fc0
''' Author: Ashutosh Srivastava Python3 solution ''' import math dict_main={} def cal(N): if N in dict_main: return dict_main[N] elif N not in dict_main: if(N%2==0): dict_main[N]=0 return 0 else: flag=0 for i in range(3,int(math.sqrt(N)...
992,361
5b9b476b92732adc319721a7ef50cdf5be4859b0
#!/usr/bin/env python3 # -*- mode: python -*- # # Electrum - lightweight Bitcoin client # Copyright (C) 2011 thomasv@gitorious # # 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 restri...
992,362
4f246b7e3263063472565f06eb940556f037e3ab
# -*- encoding:utf-8 -*- # ============================================================================== # Filename: VWAPQuantAnalysisUnitTest.py # Author: Xiaofu Huang # E-mail: lanecatm@sjtu.edu.cn # Last modified: 2016-11-04 16:00 # Description: VWAPQuantAnalysis单元测试 # =============================================...
992,363
f4d0e1074d41e309ac8267884a01a1af54d1f10d
class MapRepository: def __init__(self, droneMap): self._map = droneMap self.initializeMap() def initializeMap(self): self._map.loadMap("test1.map") def getMap(self): return self._map
992,364
76dcff4e9197c12eb469cefc015a91ce40c49f32
import numpy as np import re import sys import os import pickle from sklearn.metrics.pairwise import cosine_similarity import time import io from gensim import models import threading import Queue ''' stopWord stopWords read from file, because the sklearn one is not enough. Things added: handled by NER 'january','feb...
992,365
14239218848b9fc7e17e2444da99697ede89b91d
from eregex.test.data import code lazy_set_func=""" NodeMetadata lazySet( NodeMetadata meta, { BuildOp buildOp, Color color, bool decoOver, bool decoStrike, bool decoUnder, TextDecorationStyle decorationStyle, CssBorderStyle decorationStyleFromCssBorderStyle, String fontFamily = null, String fontSi...
992,366
04a2f4f12cc2bd23777b07a4274a8ba76a5437cb
#!/usr/bin/env python # encoding: utf-8 # Copyright 2012 Herve BREDIN (bredin@limsi.fr) # This file is part of PyAnnote. # # PyAnnote is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either versi...
992,367
f1415f0dc433b222ae31b641d91d89e7e9dcfbf8
# -*- coding: utf-8 -*- """ Created on Wed Nov 4 21:34:08 2020 @author: Moritz """ """Fig 6D This script reproduces the plots seen in Fig 6D of "The biophysical basis underlying the maintenance of early phase long-term potentiation". This script requires that `numpy`,`matplotlib` and `seaborn` are installed within...
992,368
c3b33bb54f03adddfaa1530d7f49c69acd364d83
""" All data in Python program is represented by objects(types == classes).""" things = [1, 0.2, "hi", (1, "a"), {1: 4}] # e.g of good string formatting. for thing in things: print("{:>8} is: {}".format(repr(thing), type(thing))) print("{} is: {}".format(repr(things), type(things)))
992,369
de0b0ce968fb2e84e8bba99f8bfb2c4cba1af38d
import logging import json import re from datetime import datetime, timedelta import time from . import (CHANNEL_KITCHEN, BUTTON_STOP, CHANNEL_BIG_WINDOWS, BUTTON_DOWN, BUTTON_UP) import simu LOGFILE = '/var/log/simu.log' DARKNESS_JSON = '/home/mmrazik/weather/data/live_darkness_json.txt' TIME_THRESHOLD...
992,370
28e821759b6e49dee1c0f2048beae00aeb15bdef
import re input = snakemake.input with open(snakemake.output[0], "w") as out: out.write("Barcode matching: ") out.write(open(input.barcode_matching, "r").readline()) adapter_stats = open(input.adapter_stats).read() adapter_pass = int(re.search("reads passed filter: (\d+)", adapter_stats).group(1)) //...
992,371
b238c115f3efdb8e6efa02cc78d7bfe5722b01b1
from schema import Schema, And import time import re from asylum.web.core import names def validate(schema, json): try: schema.validate(json) return True except: return False def validate_register(json): try: Schema( { 'login': lambda x: re.ma...
992,372
400b77f527944825dcf6a8fcf885d8abbf4e8c79
#coding:utf-8 import time # 读取文件 def fileRead(filename): with open(filename,"r") as f: content = f.read() # print(content) return content #保存文件 def fileSave(filename,content): with open(filename,"w") as f: startTime = time.time() print("开始写内容到%s文件中!--start:%s" % (filename,startTime)) f.write(...
992,373
8bcf20536a6b3acad3df09191d422d2ab28e020f
fullBat = int(input("輸入一數字:")) recoverBat = 0 emptyBat = 0 c = 3-fullBat%3 if fullBat %3 !=0: recoverBat = (fullBat+c)//3 #16//3 =5 emptyBat = fullBat%3 #16%3 = 1 else: recoverBat = fullBat//3 #16//3 =5 emptyBat = fullBat%3 #16%3 = 1 b = recoverBat + emptyBat a = 0 if b >=3: a = b//3 total = fu...
992,374
8342388820009783a92394d2da383a64bae19aa3
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Jayesh Kariya <jayeshk@saltstack.com>` ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt Testing Libs from tests.support.mixins import LoaderModuleMockMixin from tests.support.unit import TestCase, skipI...
992,375
a9c3ff639f21c239319ee252b158ba90c65b693e
# -*- coding: utf-8 -*- from __future__ import unicode_literals import copy import os import re from collections import OrderedDict from functools import update_wrapper from urllib.parse import urlencode, urljoin from uuid import uuid4 import django from django.conf import settings from django.contrib.contenttypes.mo...
992,376
9db4cc3451f8fe7e339fad74bddb5c7a1bce3ef3
from clarifai.rest import ClarifaiApp, Image from config_reader import CLARIFAI_KEY, CLARIFAI_SECRET from hashlib import md5 def chunks(iterator, size): """ Split the image url list to n lists of size 128 :param iterator: List :param size: Integer :return: List[List] """ for index in range(...
992,377
ff0489eb13368ae1a1bdaad92629a3f4e6866903
#display the output display("new python file new new new")
992,378
adc84bd6bf67344aec1a8439b3015672d8a9b6e0
import os #设置目录的绝对路径 BASE_PATH = os.path.dirname(os.path.abspath(__file__)) DATA_PATH = os.path.join(BASE_PATH, 'data') #yaml测试用例存放位置 CASE_PATH = os.path.join(BASE_PATH, "testcase") #测试用例存放位置 REPORT_PATH = os.path.join(BASE_PATH, 'report') #测试报告存放位置 TEMP_PATH = os.path.join(BASE_PATH, 'testcase/temp') #存放临时用例位置 LO...
992,379
d9db88a593269be511c7d1cce3c1bba9b7956ec3
import matplotlib matplotlib.use('Agg') # This must be done before importing matplotlib.pyplot import matplotlib.pyplot as plt import numpy as np import math def freq(dirr, freq_orig, iters): num_files = len(freq_orig) orig_maxBD = len(freq_orig[0]) maxBD = min(21, len(freq_orig[0])) freq = np.zeros(...
992,380
0994bf7baafd895958a133d70a4249c8ee382ddb
from django.shortcuts import render from django.views.generic import DetailView, ListView from datetime import datetime, timedelta from trader.models import Trade from ticker.strategies.simple import SimpleStrategy import logging class TradeList(ListView): logger = logging.getLogger(__name__) model = Trade ...
992,381
0a97994893e1f1c9bea9eb6bd31ce6509ceda50e
import numpy as np import torch import torch.nn.functional as F from torch.autograd import Variable from torch.utils.data import Dataset, DataLoader from torchvision import datasets, transforms dev = "cpu" if torch.cuda.is_available(): dev = "cuda:0" device = torch.device(dev) class Model(torch.nn.Module): de...
992,382
d6f8d4589af7dbcdf37a85e9af726d9a2dd3f270
"""Process, blend and store images. Published under the MIT License. See the file LICENSE for details. """ import logging import os from PIL import Image, ImageEnhance from image_optimize import recursive_optimize import utils logging.basicConfig(filename='logfile.log', level=logging.INFO) def iteration_layers(...
992,383
47aaf8487010553565e9e573cdeff7e63eeb4585
import unittest from second_project import Counter class EasyTestCase(unittest.TestCase): def setUp(self): self.counter = Counter() def test_easy_input(self): self.assertEqual(self.counter.get_value(), 0) def test_easy_input_two(self): self.counter.clear() self.assertEqu...
992,384
8a83da82b58a3988377202e7d8c0a04876d120e9
print('Prueba Funcion') for i in range (10): print(i, end=' ') print('\n Fin de Programa') print()
992,385
6995ee8949f21fab5f95b0940730e2b2c7c18c69
from __future__ import print_function import PyTorch class FloatTensor(PyTorch._FloatTensor): pass # def __cinit__(self): # print('floattensor.__cinit__') # def __init__(self, tensor, _allocate=True): # print('floattensor.__init__') # if isinstance(tensor, PyTorch._FloatTensor): # ...
992,386
5d14db43acc4bbca543aa80e9098df1ae65b8e5d
#!/usr/bin/env python # coding: utf-8 # In[1]: #!/bin/python3 import math import os import random import re import sys if __name__ == '__main__': N = int(input()) if (N%2==1): print('Weird') elif (N%2==0 and (N>=2 and N<=5)): print('Not Weird') elif (N%2==0 and (N>=6 and N<=20)): ...
992,387
3fc17b4828677a19025ecf618135a79f58cf061a
ten_things = "Apples Oranges Crows Telephone Light Sugar" # creates a variable ten_things with the assigned value of "Apples Oranges Crows Telephone Light Sugar" print "Wait there are not 10 things in that list. Let's fix that." # prints "Wait there are not 10 things in that list. Let's fix that." stuff = ten_things....
992,388
12e5ed0b76580cba7a30f8805ae557c850faa1dc
import numpy as np # global parameters -------------------------------------------------------------------------------- # num_graphs = 1000 # number of samples to be generated (per geometry) N = 50 # number of nodes (per graph) Radius = 1 ...
992,389
14841bd7749fb54e7ffcce8385f1b920e93909c4
import subprocess import json import os from multiprocessing import Pool import string import random def getAccounts(node="eos"): "获取所有的账号" current_dir = os.path.dirname(os.path.abspath(__file__)) if node == "eos": accountFile = os.path.join(current_dir, "eosaccount.json") elif node == "bos": ...
992,390
c71b8c764adb911b7ffff63850369db507e2432b
import datetime import matplotlib from matplotlib.pyplot import plot from skimage.color.rgb_colors import green, red, blue from tables.idxutils import infinity from win32timezone import now from code.classifiers.MultiLOF import MultiLOF from code.classifiers.MultiMultiLOF import MultiMultiLOF from code.classifiers.Off...
992,391
745526f794af6a085c4ee0e2e1c377462c2e8127
import cv2 import numpy as np img = cv2.imread("re_esq.png") gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) h, w = img.shape[:2] mask = np.zeros((h+2, w+2), np.uint8) ret, thresh2 = cv2.threshold(gray, 10, 255, cv2.THRESH_BINARY_INV) cv2.floodFill(thresh2, mask, (350, 250), (255, 255, 0)) thresh2 = cv2.cvtColor(thres...
992,392
9c0dd85afcff05e9b7cdd2f8471a9bab5752a185
from typing import List, Callable, Union, Any, TypeVar, Tuple, Dict Tensor = TypeVar('torch.tensor') JSONType = TypeVar('json') ClassType = TypeVar('Class')
992,393
45dd1680bbd7b510de9c4bb6026d467802f5276c
def make_jump(loc, element, max): result = [] if 0 < loc + element < max: result.append(loc + element) if 0 < loc - element < max: result.append(loc - element) return result def find_nearest(seq, check, loc, places, jumps, round=1): possiblities = make_jump(loc, seq[loc], len(seq)) found_one = Fa...
992,394
af6c6c0846f77a4f1ef011e56abdaab3c7511bbd
# ActivitySim # See full license in LICENSE.txt. import logging from activitysim.core.util import assign_in_place logger = logging.getLogger(__name__) def failed_trip_cohorts(trips, failed): # now that trips['earliest'] gets reset after outbound trips are scheduled, # it becomes clear that cohorts need to...
992,395
5f5bc8d952b5aec380501fdf626be7e1d398590c
#!/usr/bin/python import sys, os from subprocess import call def get_current_folder_size(folder): # recursion total_size = os.path.getsize(folder) for item in os.listdir(folder): itempath = os.path.join(folder, item) if os.path.isfile(itempath): total_size += os.path.getsize(itempath) elif os.path.isdir(i...
992,396
c6b54693893a44bfd5f2ec463a2af4dda2457f5d
from db.db import Base from sqlalchemy import Column, String, DateTime, Integer, Float from sqlalchemy.orm import relationship import time from .associate_table import Domain_Port, User_Domain class Data(Base): __tablename__ = "data" id = Column(Integer, primary_key=True, index=True) domain = Column(Strin...
992,397
2f4afc3c8bffdd2b53ea44ac87a17a91d8ac9ece
import random as rnd import matplotlib import matplotlib.pyplot as plt from scipy.stats import beta import argparse import numpy as np parser = argparse.ArgumentParser(description='Batch frequency learning simulation using a single Bayesian agent') parser.add_argument('--observations', '-o', default=5, type=int, ...
992,398
7b6ca0c925f40b6b5ce47f6c0b92ca2a1ed5b200
from __future__ import unicode_literals from pytest_cagoule.git_parser import get_diff_changes diff1 = """diff --git a/README.rst b/README.rst index 8902dc2..9de8bf2 100644 --- README.rst +++ README.rst @@ -3,0 +4 @@ pytest-cagoule + """ diff2 = """diff --git a/README.rst b/README.rst index 8902dc2..f39170e 100644 ...
992,399
25a9dcb1675cc87c50e0adaf25becaa134837e2d
"""Test module for ip fabric snat for k8s this module contains the restart and reboot scenario based testcases to verify the behavior of the ip fabric snat with k8s """ from common.k8s.base import BaseK8sTest from tcutils.wrappers import preposttest_wrapper from tcutils.util import get_random_name, skip_because i...