text
stringlengths
8
6.05M
import logging from locust import TaskSet, task logger = logging.getLogger(__name__) class UserBehavior(TaskSet): """This class inheried from the `TaskSet` to run the a specific task in hand. -- ChangeLog: Sunday 27 May 2018 08:10:32 AM IST @jawahar273 [Version 0.1] -1- Init...
import calendar age = int(input('ENTER YOUR AGE: \n')) date = int(input('ENTER DATE OF BIRTHDAY IN FIGURES: \n')) month = int(input('ENTER MONTH OF BIRTH IN FIGURES: \n')) current_year = int(input('ENTER CURRENT YEAR: \n')) year_of_birth = current_year - age day_of_birth = calendar.weekday(year_of_birth, month, d...
import web import re def unique(seq): keys = {} for e in seq: keys[e] = 1 return keys.keys() def unique2(seqx): modlist=[ r.split(";") for r in seq if r != ''] mods=[ i for s in modlist for i in s ] # flatten return unique(mods) db = web.database(dbn='sqlite', db='modules.db') de...
# Usage: python app.py from PIL import Image from io import BytesIO from flask import Flask, request, jsonify from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.models import load_model import numpy as np import os model_path = 'model/5_model_akurasi_93_91_93.h5' model = load_model(mod...
#!/usr/bin/python from copy import deepcopy class MaxHeap: def __init__(self, arr=list()): self.arr = deepcopy(arr) if len(self.arr) == 0 or self.arr[0] is not None: self.arr = [None] + self.arr def insert(self, v): self.arr.append(v) self.swim(len(self.arr)-1) ...
from .CreateCeedlingModule import * from .OpenCeedlingFile import * __all__ = ["CreateCeedlingModuleCommand", "OpenCeedlingFileCommand"]
from contextlib import contextmanager from typing import Callable, Iterator, List, TYPE_CHECKING if TYPE_CHECKING: # prevent circular imports for type checking from simulation.state import State # noqa ValidatorMethod = Callable[['State'], None] class ValidationError(Exception): """ An error type rai...
import matplotlib.pyplot as plt import numpy.random as npr import cPickle as pickle import os import seaborn as sns sns.set_style("white") current_palette = sns.color_palette() npr.seed(42) exp_types = ["random", "flux", "redshift"] out_dir = "/Users/acm/Dropbox/Proj/astro/DESIMCMC/tex/quasar_z/NIPS2015/" for exp_ty...
#!/usr/bin/env python # -*- coding: utf-8 -*- # ˅ from abc import * # ˄ class Element(object, metaclass=ABCMeta): # ˅ # ˄ @abstractmethod def accept(self, visitor): # ˅ pass # ˄ # ˅ # ˄ # ˅ # ˄
import urllib from BeautifulSoup import* url=raw_input('Enter url:') html=urllib.urlopen(url).read() soup=BeautifulSoup(html) tags=soup('a') for tag in tags: print 'TAG:',tag print 'URL:',tag.get('href',None) print 'Content:',tag.contents[0] print 'Attrs:',tag.attrs
#!/usr/bin/env python import argparse import csv import glob import json import io import os import re try: set except NameError: from sets import Set as set import datetime from csvkit import py2 from flask import Flask, render_template, request, make_response, Response import peewee from peewee import * fr...
import os from django.db import models from django.conf import settings from django.utils import timezone from django.utils.translation import gettext as _ from django.conf import settings from django.dispatch import receiver from django.db.models.signals import post_save class Profile(models.Model): # Wrap th...
from libs.config import alias, gget from libs.myapp import send, color, print_tree from json import JSONDecodeError def get_php(file_path: str): return """$cfgs=array("cfg","config","db","database"); function filter($v,$vv){ return strstr($v, $vv); } function scan_rescursive($directory) { globa...
class Solution(object): def flatten(self, root): def _flatten(root): if root is None: return left_tail = _flatten(root.left) right_tail = _flatten(root.right) if left_tail is not None: left_tail.right = root.right ...
from xml.etree import ElementTree import adsk.core import adsk.fusion import traceback # Reads XML data from attribute returns element tree root element def get_xml_from_attribute(group_name, attribute_name, root_name): app = adsk.core.Application.get() design_ = adsk.fusion.Design.cast(app.activeProduct) ...
my_big_data = [['a001','홍길동',29,'신암동 12-4'],\ ['a001','홍길동',29,'신암동 12-4']] print(my_big_data)
import os import struct import numpy as np import matplotlib.pyplot as plt from keras.models import Sequential from keras.layers.core import Dense from keras.optimizers import SGD from keras.utils import np_utils def load_mnist(path, which='train'): if which == 'train': labels_path = os.path.join(path, 'tr...
from django.shortcuts import render from rest_framework import generics from rest_framework.decorators import api_view from rest_framework.response import Response from tweets.models import Tweet from users.models import UserAccount from tweets.serializers import TweetSerializer from users.serializers import UserSeria...
import pytest from restdoctor.utils.media_type import parse_accept def test_parse_none(): result = parse_accept(None) assert result is None @pytest.mark.parametrize( 'header,expected_version', ( ('*/*', 'fallback'), ('text/html', 'fallback'), ('application/json', 'fallback'...
name = "Sam" print("Name is :", name) lastletters = name[1:] print("LastLetters of name are : ", lastletters) print(lastletters * 4) print("I ", lastletters , "super cool") print('Sum of 2 and 3 is: ', 2+3) print(f'Sum of 2 and 3 is : {2+3}') print('Sum of 2 and 3 is: {}'.format(2+3)) print("2 concatenated w...
from PyQt5.QtWidgets import QWidget, QDialog from PyQt5.QtGui import QImage, QPalette, QBrush from PyQt5.QtCore import QSize, Qt import main_menu SCREEN_SIZE = [700, 700] class LostWindow(QDialog, QWidget): def __init__(self): super().__init__() self.setModal(True) self.initUI() def ...
import time from datetime import datetime from os.path import join as path_join from math import log, floor import click import matplotlib matplotlib.rcParams['font.family'] = 'serif' matplotlib.rcParams['mathtext.fontset'] = 'cm' import matplotlib.pyplot as plt import matplotlib.patches as mpatches import pandas imp...
import json class Store: """ A class used to represent a Store Attributes ---------- name : str the name of the town or city where the store is located postcode : str the store's postcode """ def __init__(self, name, postcode): self.name = name ...
import argparse import yaml import os from src.get_data import get_data,read_params def load_and_save(config_path): config = read_params(config_path) df = get_data(config_path) df.columns = [cols.replace(' ','_') for cols in df.columns] write_path = config['load_data']['raw_data_set'] df.to_cs...
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2017-11-21 08:09 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('booktest', '0002_auto_20171121_0755'), ] operations = [ migrations.AlterFie...
#Receba o salário de um funcionário e mostre o novo salário com reajuste de 15%. salario=float(input('digite o salario: ')) print(f'o novo salario é {salario*1.15}')
#-*- coding:utf-8 -*- import os import json import requests import webbrowser import win32api import win32con import win32gui def get_new_lecture(): try: user_agent = {'user-agent': 'Mozilla/5.0'} url = "http://www.cqupt.edu.cn/getPublicPage.do?ffmodel=notic&&nc_mode=news&page=1&rows=20" r...
import string import datetime import pandas as pd import numpy as np import os import re def path_generator(year, month, place, amedas_root): AtoZ = string.ascii_uppercase[0:27] AtoZ = str(AtoZ) zeroto_z = str(0) + str(123456789) + AtoZ fmt = "{year}_{1or2}/AM10{year_2:02d}{month_2:02d}/A{...
from django.urls import path from user_account.views import signin_view, signup_view app_name='user' urlpatterns=[ path('login/',signin_view, name='login'), path('signup/',signup_view, name='register'), ]
import socket import sys def CreateConnect(host, port, server=False): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if(server): port = socket.htons(port) s.bind((host, port)) else: addrinfo = socket.getaddrinfo(host, port, socket.AF_INET, socket.SOCK_STREAM) ...
# Description # Bruteforces the password of an given username, with a wordlist # Parameters # Parameter 1: Username # Parameter 2: Wordlist # Additional # Replace [Host] with the host import sys import requests import hashlib import signal import json from collections import namedtuple from os import system import r...
from django.conf.urls import patterns, url urlpatterns = patterns('', url(r'^$', 'intent.apps.core.views.home', name='home'), url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'core/login.html'}, name='login'), url(r'^register/$', 'intent.apps.core.views.register', name='regist...
import random import json import os from pico2d import * import GameWin import game_framework import title_state import GameOver import Sound_Manager name = "MainState2" class Field: img = None def __init__(self,x,y,state): self.x = x self.y = y self.state = state if Field.i...
# 119. Pascal's Triangle II # # Given an index k, return the kth row of the Pascal's triangle. # # For example, given k = 3, # Return [1,3,3,1]. class Solution(object): def getRow(self, rowIndex): """ :type rowIndex: int :rtype: List[int] """ result = [] if rowInde...
import numpy as np import tensorflow as tf import autokeras as ak from tensorflow.keras.datasets import mnist (x_train, y_train), (x_test, y_test) = mnist.load_data() x_train = x_train.reshape(60000, 28, 28, 1).astype('float32') / 256. x_test = x_test.reshape(10000, 28, 28, 1).astype('float32') / 256. from tensorfl...
N = int(input()) A = [int(input()) for i in range(N)] flag = False i = 0 for j in range(1,11): for k in A: if k%(10**j) == 0: pass else: print(i) flag = True break if flag == True: break i += 1
import unittest import os from ..BaseTestCase import BaseTestCase from centipede.ExpressionEvaluator import ExpressionEvaluator from centipede.ExpressionEvaluator import ExpressionNotFoundError class PathTest(BaseTestCase): """Test Path expressions.""" __path = "/test/path/example.ext" __testRFindPath = o...
from django.contrib.admin.models import LogEntry from rest_framework.views import APIView from rest_framework.response import Response from .serializers import LogsSerializer, LogEntrySerializer from .models import * class WeavedinLogsView(APIView): allowed_methods = ['GET'] serializer_class = LogsSerialize...
class Solution(object): def evalRPN(self, tokens): """ :type tokens: List[str] :rtype: int """ stack = [] for x in tokens: try: number = int(x) except: number = None if number is not None: ...
import time import shared_library from hw1_naive_bayes import NaiveBayesClassifier # Set constants iv_count = 6 # Number of features in data set validation_count = 10 prefix = "../datafiles/hw4_" # Used if data files are not in same directory as code training_set_loc = pr...
# pylint: disable=duplicate-code, too-many-statements ''' Unit test for basic commands ''' import unittest import logging from test.common import async_test, BaseTestCase # Initialize loggers logging.basicConfig(level=logging.WARNING) class TestCommand(BaseTestCase): ''' Test basic commands ''' @async_test ...
from django.conf.urls import patterns, url from apps.inicio.views import index2 urlpatterns = patterns('apps.inicio.views', url(r'^$','index_view', name="index"), url(r'^index/', index2.as_view()), )
# Generated by Django 2.0.4 on 2018-04-28 06:57 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blog', '0005_remove_blogpage_post_title'), ] operations = [ migrations.AddField( model_name='blogpage', name='banner...
import os import sys import socket import optparse import subprocess import random import select import struct import binascii import time import threading from traci import trafficlights, simulation, edge, junction import traci.constants as tc from datetime import datetime from optparse import OptionPars...
import Tkinter GM_KEYS = set( vars(Tkinter.Place).keys() + vars(Tkinter.Pack).keys() + vars(Tkinter.Grid).keys() ) class ScrolledFrame(object): _managed = False # XXX These could be options x_incr = 5 y_incr = 5 def __init__(self, master=None, **kw): self.wi...
import sys import math import pprint def next_int(iter_lines): return int(next(iter_lines)) def solve_testcases(solve_testcase): iter_lines = iter(sys.stdin.readlines()) num_testcases = next_int(iter_lines) for _ in range(num_testcases): print(solve_testcase(iter_lines)) # Dijskra's shortest...
import MySQLdb import csv class SGAEventsInfo: def __init__(self): self.db = MySQLdb.connect("localhost", "fanyu", "hellowork", "TDI") self.cursor = self.db.cursor() def findGeneName(self, geneID): query = "SELECT gene_name FROM Genes WHERE gene_id= '%s'" %(geneID) self.cursor.execute(query) results = s...
from selenium.webdriver.common.by import By from .abstract import PageElement from .abstract import PageObject class SignUpPage(PageObject): username = PageElement(By.CSS_SELECTOR, "#id_sign_up_form #id_username") email = PageElement(By.CSS_SELECTOR, "#id_sign_up_form #id_email") password = PageElement(B...
import matplotlib.pyplot as plt import numpy as np JOULE_TO_EV = 6.24E18 # [eV/J] EV_TO_JOULES = 1.6022E-19 # [J/eV] PLANCK_CONST = 6.63E-34 # [J*s] SPEED_OF_LIGHT = 3.0E8 # [m*s^-1] CHARGE_E = 1.602E-19 # [C] POTASSIUM_WORK_FUNCTION = 3.67E-19 # [J] frequencies = np.linspace(100, 300, num=600) # Filter measur...
from django.db import models # Create your models here. class Mentee(models.Model): nama_mentee = models.CharField(max_length = 255) testimoni = models.CharField(max_length = 300) # foto_mentee = models.CharField(max_length = 300) foto_mentee = models.ImageField(upload_to = 'upload') def __str__(...
#ToDo: packaged this
i = [[1,2,3],[4,5,6],[7,8,9]] i[0][0] print(i[0][0]) # go to first list and grab first item of that list j = [] for x in range(10): j.append(0) print(j) j = [0] * 10 print(j) j = [] for x in range(10): k = [0]*10 j.append(k) print(j) j = [[0]*10 for x in range(10)] print(j) for x in range(len(j)): print(*j[x]...
#!/usr/bin/env python import rospy import tf import math import numpy as np import matplotlib.pyplot as plt from ga.gasearch import GASearch from aStar.aStarSearch import aStar from nav_msgs.msg import OccupancyGrid, MapMetaData from sensor_msgs.msg import PointCloud from geometry_msgs.msg import Point32, Point # Glo...
import numpy as np import helios networkSize = 1000; positions = np.random.random((networkSize, 3)); edges = np.random.randint(0,networkSize-1,(networkSize, 2)); positions = np.ascontiguousarray(positions,dtype=np.float32); edges = np.ascontiguousarray(edges,dtype=np.uint64); speeds = np.zeros(positions.shape,dtype...
# Generated by Django 2.1.5 on 2019-02-13 00:15 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Mentee', fields=[ ('id', models.AutoField(a...
# /usr/bin/env python # -*- coding:utf-8 -*- import heapq def find_small_k_sums(alist, k): max_heap = [] if not alist or k < 0 or k > len(alist): return for ele in alist: ele = -ele if len(max_heap) < k: heapq.heappush(max_heap, ele) else: heapq.heap...
S = input() L = len(S) Q = 10**9 + 7 anum = [ 0 for _ in range(L+1)] #i番目までのAの個数の合計 cnum = [ 0 for _ in range(L+1)] #i番目までのCの個数の合計 hnum = [ 0 for _ in range(L+1)] #i番目までの?の個数の合計 for i in range(1,L+1): if S[i-1] == 'A': anum[i] = anum[i-1] + 1 cnum[i] = cnum[i-1] hnum[i] = hnum[i-1] elif ...
import datetime now = datetime.datetime.now() print("{}-{}-{}-{}.jpg".format(now.hour, now.minute, now.second, now.microsecond))
# Generated by Django 3.0.6 on 2020-06-10 08:23 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('Home', '0007_item_item_image'), ] operations = [ migrations.AlterField( model_name='item', name='item_Discount_prics...
# this folder save some global data.
import chainer class Light: pass class DirectionalLight(Light): def __init__(self, color, direction, backside=False): self.color = color self.direction = direction self.backside = backside class AmbientLight(Light): def __init__(self, color): self.color = color class S...
from django.utils.translation import ugettext_lazy as _ from rest_framework import permissions from .models import UserProfile __all__ = [ 'IsProfileOwner', 'IsNotAuthenticated' ] class IsProfileOwner(permissions.IsAuthenticated): """ Restrict edit to owners only """ message = _("Operation n...
from collections import namedtuple from multiprocessing.dummy import Pool from .scrabble_box import Rulebook from .exceptions import InvalidPlacementError import sys class Player(object): def __init__(self, id, init_tiles, rulebook, name=None): while name is None: name = input("Enter the name...
#!/usr/bin/python from OpenSSL import crypto, SSL from os.path import exists, join CERT_FILE = 'cert.crt' KEY_FILE = 'cert.key' #print CERT_FILE #print KEY_FILE def create_self_signed_cert(cert_dir): """ If cert.crt and cert.key don't exist in /etc/nginx, create a new self-signed cert and keypair and ...
name = input("enter your name : ") lst = ['a','e','i','o','u'] c = 0 for n in name: if n in lst: c+=1 print(c) print(len(list(filter(lambda x:x in lst , list(name))))) print(len(list(filter(lambda x:x in lst , name))))
# Разобраться с получением email письма. Попробуйте поискать информацию самостоятельно (IMAP или POP3 протоколы # получения писем).
import socket import subprocess import json import os # import speech_recognition as sr import base64 class Client: def __init__(self, ip, port): self.connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # here socket.AF_INET is your ipv4 and # socket.SOCK_STREAM is your tcp/ip ...
# Uses python3 import sys def optimal_sequence(n): sequence = [] while n >= 1: sequence.append(n) if n % 3 == 0: n = n // 3 elif n % 2 == 0: n = n // 2 else: n = n - 1 return reversed(sequence) def dynamic_sequence(n): all_possible_nu...
import numpy as np import torch.nn as nn from vegans.utils import get_input_dim from vegans.utils.layers import LayerReshape class MyGenerator(nn.Module): def __init__(self, gen_in_dim, x_dim): super().__init__() self.hidden_part = nn.Sequential( nn.Flatten(), nn.Linear(np....
import numpy as np from matplotlib import pyplot as plt if __name__ == "__main__": # Black/White Image (1d) image = np.array( [0, 1, 1, 1, 1, 1, 0, 0, 0, ], dtype=np.uint8, ) print(f"B/W (1D):\n{image}") plt.imshow(image.reshape((3, 3)), cmap="gray") plt.show() # Grayscale...
import FWCore.ParameterSet.Config as cms process = cms.Process("SVFitProducer") process.load("FWCore.MessageService.MessageLogger_cfi") process.load('Configuration.StandardSequences.Services_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') process.load('JetMETCorrections.Configu...
import cv2 as cv import numpy as np def detect (img, cascade): rects = cascade.detectMultiScale(img, scaleFactor = 1.1 , minNeighbors = 5, minSize=(30,30), flags=cv.CASCADE_SCALE_IMAGE) if len(rects) == 0: return [] rects[:, 2:] += rects[:, :2] return rect...
## gauss_surf.py ## Port of gauss_surf.m # From A First Course in Machine Learning, Chapter 2. # Simon Rogers, 01/11/11 [simon.rogers@glasgow.ac.uk] # Surface and contour plots of a Gaussian import numpy as np import matplotlib.pyplot as plt import matplotlib.cm from mpl_toolkits.mplot3d import Axes3D plt.ion() ## The ...
import numpy from code import baseobjects as bo from code.supports import euclidian_distance, retrieve_minimal_fleet_size from collections import deque class Importer(object): def __init__(self): self.file_lines = [] self.info = {} self.node_coordinates_list = [] self.distance_mat...
from rv.api import m def test_amplifier(read_write_read_synth): mod: m.Amplifier = read_write_read_synth("amplifier").module assert mod.flags == 81 assert mod.name == "amp" assert mod.volume == 378 assert mod.balance == -63 assert mod.dc_offset == -33 assert mod.inverse assert mod.ster...
#!/usr/bin/python # Copyright (c) 2011, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright # notice, ...
# Graphics Library from src.glTypes import V2, V3, V4, dword, newColor, word from src.glMath import barycentricCoords, camTransform, createObjectMatrix, createRotationMatrix, dirTransform, divide, cross, dot, inv, negative, norm, substract, top, transformV3 from src.objLoader import Obj BLACK = newColor(0, 0, 0) WHIT...
#####don't use remove function # list1=["swati","rani","srusti"] # i=0 # list2=[] # while i<1: # m=list1[i] # list2.append(list1[0]) # list2.append(list1[2]) # i=i+1 # print(list2)
import youtube_dl def downloadFunction(self): ydl_opts = { 'format': 'bestaudio/best', 'postprocessors': [{ 'key': 'FFmpegExtractAudio', 'preferredcodec': 'mp3', 'preferredquality': '192', }], 'outtmpl': '/home/benjamin/Music/%(title)s.%(ext)s', ...
''' @author: Bren ''' from brenpy.qt.bpQtImportUtils import QtCore from brenpy.qt.bpQtImportUtils import QtWidgets from brenpy.qt.bpQtImportUtils import QtGui from brenpy.core import bpDebug from brenpy.qt import bpQtWidgets from brenfbx.core import bfCore from brenfbx.qt import bfQtCore from brenfbx.fbxsdk.core im...
# encoding: utf-8 #@author: newdream_daliu QQ:279129436 #@file: __init__.py.py #@time: 2021-05-06 16:01 #@desc:
#!usr/bin/env python # -*- coding:utf-8 -*- """ @author:nieh @file: main.py @time: 2018/03/26 """ from __future__ import division from sklearn.feature_selection import SelectKBest from sklearn.feature_selection import f_classif from sklearn import preprocessing from utils.utils import * from Features impo...
from django.db import models from users.models import UserAccount # Create your models here. class Tweet(models.Model): user_id = models.ForeignKey(UserAccount, on_delete=models.CASCADE, related_name='tweets') content = models.CharField(max_length=5000) image = models.CharField(max_length=1000, default='',...
from dot import Dot class Dots: """A collection of dots.""" def __init__(self, WIDTH, HEIGHT, LEFT_VERT, RIGHT_VERT, TOP_HORIZ, BOTTOM_HORIZ): self.WIDTH = WIDTH self.HEIGHT = HEIGHT self.TH = TOP_HORIZ self.BH = BOTTOM_HORIZ self.LV = ...
## Mail Server details MAIL_SERVER='smtp.gmail.com' MAIL_PORT = 465 MAIL_USERNAME = 'account_id@gmail.com' MAIL_PASSWORD = 'password' MAIL_USE_TLS = False MAIL_USE_SSL = True MAIL_SENDER_EMAIL = '' MAIL_RECEIVER_EMAIL = '' ETHERSCAN_API_KEY = '' ETH_WALLET_ADDRESS = '' WEI_DIVIDER = 1000000000000000000
from keyboardlayout.key import Key KEY_MAP = { 96: Key.BACKQUOTE, 126: Key.ASCII_TILDE, 49: Key.DIGIT_1, 33: Key.EXCLAMATION, 50: Key.DIGIT_2, 64: Key.AT, 51: Key.DIGIT_3, 35: Key.NUMBER, 52: Key.DIGIT_4, 36: Key.DOLLAR, 53: Key.DIGIT_5, 37: Key.PERCENT, 54: Key.DIGI...
arr = list(map(int, input().split(' '))) for idx, _ in enumerate(arr): midx = idx while midx > 0 and arr[midx] < arr[midx - 1]: arr[midx], arr[midx - 1] = arr[midx - 1], arr[midx] midx -= 1 for i in arr: print(i, end=' ')
S = input().replace('x', '') print(700 + 100*len(S))
from bot import Bot email = '' password = '' product_codes = ['B01545GQ9O', 'B016DCAOZY', 'B07MJKHYDC', 'B016DCAOOA', 'B07571223K', 'B077ZC9D8R', 'B00EP56O0G', 'B07VBM91JB', 'B07YY9ZD7M', 'B07T3MNKKW', 'B008WX2OY2', 'B07T5V4TCV', 'B01613I79K', 'B07VYRQZ69', 'B0015R1B...
#! /usr/bin/env python """ multipart-upload. Upload large files (2+ GB) in multiple parts. """ if __name__ == '__main__': import argparse as ap import boto import math import os import sys from filechunkio import FileChunkIO from aws_keys import AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY ...
toque = (51 % 24) + 2 print(toque)
from datetime import datetime, timedelta from dateutil.relativedelta import relativedelta if __name__ == "__main__": monthstep = relativedelta(months=1) count = 0 date = datetime(1901, 1, 1) while date < datetime(2000, 12, 31): date += monthstep if date.weekday() == 6: cou...
from django.urls import include, path from . import views urlpatterns = [ path('', views.ListPassword.as_view()), path('<int:id>/', views.DetailPassword.as_view()), path('rest-auth/', include('rest_auth.urls')), ]
#!/usr/bin/env python """Remove miscellaneous expired things (Credentials, CachedFeeds, Loans, etc.) from the database. """ import os import sys bin_dir = os.path.split(__file__)[0] package_dir = os.path.join(bin_dir, "..") sys.path.append(os.path.abspath(package_dir)) from core.scripts import RunReaperMonitorsScript R...
from Pages.ContentPages.BasePage import Page from selenium.webdriver.common.by import By from magic_box.find_elements import find_element class AddContentPage(Page): def __init__(self, driver): self.driver = driver self.locators = { 'landing_add_button': {'by': By.XPATH, 'value': 'id("b...
from twisted.trial.unittest import TestCase from twisted.test import proto_helpers from twisted.internet.protocol import ClientFactory from .. import spdy_headers, c_zlib example_headers = "8\xea\xdf\xa2Q\xb2b\xe0f`\x83\xa4\x17\x06{\xb8\x0bu0,\xd6\xae@\x17\xcd\xcd\xb1.\xb45\xd0\xb3\xd4\xd1\xd2\xd7\x02\xb3,\x18\xf8Ps,...
a, b = input().split(' ') a = int(a) b = int(b) if a >= 0: if b > 0: print(a // b) print(a % b) else: b = -b print( -(a // b)) print(a % b) else: if b > 0: print(a // b) a -= b print(a % b) else: a += b print(a // b) print((a- b) - (a//b) * b)
from gym_do_not_repeat_yourself.envs.do_not_repeat_yourself_env import DoNotRepeatYourselfEnv
__author__ = 'Julia' import sys b = 0 A = [] k = 0 for line in sys.stdin: if line == 0: for word in line.strip().split(): k.append(int(word)) for word in line.strip().split(): A.append(int(word)) def merge(a, c): global b l = len(a) if l == 1: return a a1...
from intent_handling.intents.PrereqsForClassIntent import PrereqsForClassIntent class ClassRequiresStandingIntent: NAME = 'CLASS_REQ_STANDING' def __init__(self, parameters): self.parameters = parameters def execute(self, db): return PrereqsForClassIntent(self.parameters).execute(db)