content
stringlengths
5
1.05M
import threading import time import schedule import yaml from reddit_monitor import RedditMonitor from state import State def run_threaded(job_func): job_thread = threading.Thread(target=job_func) job_thread.start() def main(): config = yaml.safe_load(open("config.yml")) state = State(config) ...
#!/usr/bin/env python3 import json import sys import os import subprocess output_dir = sys.argv[1] files = sys.argv[2:] files = [f for f in files if f.endswith('.json') and os.path.basename(f).count('_') == 1] files.sort(key=os.path.basename) out = {} def process_file(f): with open(f) as fp: obj = json.lo...
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from flask import session from indico.modules.users import user_management_settings def can_manage_pers...
import argparse import sys from mmt import utils from mmt.checkpoint import CheckpointRegistry from mmt.decoder import MMTDecoder, ModelConfig def main(argv=None): # Args parse # ------------------------------------------------------------------------------------------------------------------ parser = ar...
# --- # jupyter: # jupytext: # formats: py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.4.2 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # # Credit default swaps # # Co...
import socket import sys import cv2 import pickle import numpy as np import struct #Tela from PIL import Image from PIL import ImageTk import tkinter as tki import threading import datetime import imutils import cv2 import os # Definicoes HOST = '127.0.0.1' PORT = 8083 #Classe da tela class Tela: def __ini...
# -*- coding: utf-8 -*- """ * TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-蓝鲸 PaaS 平台(BlueKing-PaaS) available. * Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except in co...
from pymongo import MongoClient from src.config import config from src.job import job_utls from src.experiment import FeatureSelector from collections import Counter import json client = MongoClient(config.mongodb_conn, connectTimeoutMS=config.mongodb_timeout) db = client.calp events_collection = db.events jobs_collec...
import pickle, random import math, time, platform from pathlib import Path import torch import numpy as np from PIL import Image from skimage import color from torch import tensor from torchvision import transforms from torchvision.transforms import functional as tvF from torch.utils.data import DataLoader from torch...
########################################################################## # MediPy - Copyright (C) Universite de Strasbourg # Distributed under the terms of the CeCILL-B license, as published by # the CEA-CNRS-INRIA. Refer to the LICENSE file or to # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html # for de...
# This program shows bubble sort array = list(map(int, input().split()))#input in single line and spacing between characters t = input("Do you want this in ascending or decending order(A/D):")#ascending or decending #iterating through loops for i in range(len(array)): for j in range(len(array)-1): ...
from intake.tests.base_testcases import ( IntakeDataTestCase, ALL_APPLICATION_FIXTURES) from user_accounts import models, exceptions from user_accounts.tests import mock class TestOrganization(IntakeDataTestCase): fixtures = ALL_APPLICATION_FIXTURES def test_has_a_pdf(self): self.assertTrue(self...
from py4j.java_gateway import JavaObject from pyspark.sql import SparkSession def test_spark_session_fixture(spark_session: SparkSession) -> None: sdf = spark_session.createDataFrame([{"k": "1", "v": 42.0, "e": "foo"}]) assert sorted(sdf.columns) == ["e", "k", "v"] import stoys assert isinstance(stoy...
from lib.mongoLib.mongoOperations import findUser findUser("fHtTaujcyKvXglE33Z5yIw")
# Generated by Django 2.2 on 2020-08-03 07:59 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('challenge', '0014_remove_c...
import pytest import floto.decider from floto.specs.task import ActivityTask from floto.specs import DeciderSpec @pytest.fixture def task(): return ActivityTask(domain='d', name='activity2', version='v1') @pytest.fixture def decider_spec(task): activity_tasks = [task] decider_spec = DeciderSpec(domain='d...
from absl import logging class OverwriteLog(): # overwrite logging for kaggle kernel def info(self, msg): print(msg) logging = OverwriteLog() # logging.set_verbosity(logging.INFO) logging.info('Hello')
import sys def main(): input = sys.stdin.readline A = list(map(int, input().split())) return (A[0] * A[1]) * 2 + (A[1] * A[2]) * 2 + (A[2] * A[0]) * 2 if __name__ == '__main__': print(main())
""" Simple shim for running the client program during development. """ import ga4gh.cli.client as cli_client if __name__ == "__main__": cli_client.client_main()
import rustapi_module.misc def test_issue_219(): # Should not deadlock rustapi_module.misc.issue_219()
from graphql import graphql_root_field from graphql import graphql_union from graphql.executor.test.star_wars import SwCharacterFactory from ship import SwShip class SwSearch(object): """Provides the ability to search for objects.""" @staticmethod @graphql_union('SearchResult', 'An object located in a se...
import argparse import h5py import napari from napari_covid_if_annotations.layers import get_layers_from_file from napari_covid_if_annotations.gui import connect_to_viewer from napari_covid_if_annotations._key_bindings import on_layer_change def initialize_from_file(viewer, path, saturation_factor, edge_width): ...
# Generated by Django 3.2.8 on 2021-10-31 23:12 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('library', '0001_initial'), ] operations = [ migrations.AlterModelOptions( name='library', ...
from . import evaluate_fit
''' https://leetcode.com/contest/weekly-contest-182/problems/count-number-of-teams/ ''' class Solution: def numTeams(self, rating: List[int]) -> int: def nt(r): n = len(r) p = [0] * n for j in range(n - 2, -1, -1): for k in range(j + 1, n): ...
def max_difference(a): n = len(a) if n == 0: return None max_after = a[n-1] max_delta = 0 i = n-2 while i >= 0: max_after = max(a[i], max_after) max_delta = max(max_after - a[i], max_delta) i -= 1 return max_delta def test(): a = [0,1,2,3,2,3,4,5,6,-3,4...
from __future__ import absolute_import # Copyright (c) 2010-2015 openpyxl """Write worksheets to xml representations.""" # Python stdlib imports from io import BytesIO from openpyxl.compat import safe_string, itervalues, iteritems from openpyxl import LXML # package imports from openpyxl.utils import ( coordina...
default_app_config = "apps.lms.apps.LMSConfig"
import os import re from urllib import parse import requests class SharedBase(object): def __init__(self, url): self.url = url def get_site_name(self): if re.match(r'http://(www|en).(dm5|dm9).com/.+?', self.url): return 'dm5' if re.match(r'http://comic.ck101.com/comic/\d+...
from twython import Twython CONSUMER_KEY = "" CONSUMER_SECRET = "" OAUTH_TOKEN = "" OAUTH_TOKEN_SECRET = "" twitter = Twython( CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET) id_of_tweet = 387164512995930113 tweet = twitter.show_status(id=id_of_tweet) print(tweet['text'])
# Copyright 2020 Braden Bagby, Robert Stonner, Riley Hughes, David Gray, Zachary Langford # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/L...
from dataclasses import dataclass from venafi_vcert_gitlab_integration import utils import envparse import requests import urllib.parse import logging import sys import os @dataclass(frozen=True) class DownloadPrevCertConfig: gitlab_api_v4_url: str project_path: str branch_name: str requester_job_name...
import des_oop cust_entry = des_oop.GenerateEntityUniformDistribution(low=0,high=3) cust_counter = des_oop.EntityCounter() cust_leave = des_oop.TerminateEntity() cust_entry.set_target(cust_counter) cust_counter.set_target(cust_leave) simulation = des_oop.Simulation([cust_entry]) simulation.run(stop_after=(cust_leave...
import csv import nltk import pandas as pd import numpy as np import spacy from nltk.tokenize import word_tokenize import string def load_book(book_path, lower=False): ''' Reads in a novel from a .txt file, and returns it in (optionally lowercased) string form Parameters ---------- book_path ...
import time import app.memory_utils as mu # DMA physical addresses: DMA_BASE_PHYS = 0x20007000 DMA_BASE_CH15_PHYS = 0x20E05000 # DMA register offsets (from the base address of a channel) DMA_CS = 0x0 DMA_CB_AD = 0x4 DMA_TI = 0x8 DMA_DEBUG = 0x20 # DMA CS register bits DMA_CS_RESET = 1 << 31 DMA_CS_ACTIVE = 1 << 0 D...
""" VQA2.0 dataset class """ import os import pickle from PIL import Image import numpy as np from random import randint import torch.utils.data as data from Utils.util import pad_sentence def default_loader(path): return Image.open(path).convert('RGB') class WordMatchDataset(data.Dataset): def __init_...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import skfmm import numpy as np import matplotlib.pyplot as plt from scipy import ndimage as ndi from branch import find_branch_points from skimage.segmentation import random_walker, watershed from skimage.transform import resize from skimage.exposure import equalize_ad...
# ### local version __version__ = "v0.0.1"
import discord from random import choice from redbot.core import commands from redbot.core import Config from redbot.core.utils.chat_formatting import pagify class ToDo(commands.Cog): '''Manage your ToDo list''' def __init__(self): self.config = Config.get_conf(self, identifier=847265238) def...
from __future__ import division import numpy as np from functools import partial import warnings from menpo.feature import no_op from menpo.base import name_of_callable from menpofit.visualize import print_progress from menpofit.base import batch from menpofit.builder import (scale_images, rescale_images_to_reference...
# AUTOGENERATED, DO NOT EDIT from .const import ThreadNodeCapabilities, ThreadStatus from .structs import ( SelectedRTPStreamConfiguration, StreamingStatus, SupportedAudioStreamConfiguration, SupportedRTPConfiguration, SupportedVideoStreamConfiguration, ) characteristics = { "000000A6-0000-100...
# -- coding: utf-8 -- # Copyright (c) 2011-2015 Andrew Hankinson, Alastair Porter, and Others # 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 limita...
""" Copyright 2018 Rackspace Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
import Assoc as As class DictList(): def __init__(self, elem = None): """ :type elem: As.Assoc """ if elem is None: elem = [] for i in range(len(elem)): if not isinstance(elem[i], As.Assoc): raise ValueError('The value o...
import mysql.connector as conn import pandas as pd import datetime def helpadmin(): print(""" <<<<<<<<<<<<ADMIN COMMAND HELP PAGE>>>>>>>>>>>>> ================================================ ================================================ 1) ADD BOOKS -- add book username password 2) UPDATE --: (a)... update ...
from collections import defaultdict from dae.person_sets import PersonSetCollection def get_family_pedigree(family, person_set_collection): return [ ( p.family_id, p.person_id, p.mom_id if p.mom_id else "0", p.dad_id if p.dad_id else "0", p.sex....
#!/usr/bin/env python3 # @Date : 2022/1/17 # @Filename : 1220.py 统计元音字母序列的数目 # @Tag : 动态规划 # @Autor : LI YAO # @Difficulty : Hard from heapq import * from typing import List, Optional from collections import defaultdict, deque from itertools import product,combinations,permutations,accumulate fro...
from rest_framework import pagination class SyarpaAPIPagination(pagination.LimitOffsetPagination): # PageNumberPagination): # page_size = 20 default_limit = 10 max_limit = 20 # limit_query_param = 'lim'
import os from quart import Quart, abort, jsonify, request from alttprbot.alttprgen.mystery import get_weights, generate_random_settings from alttprbot_discord.bot import discordbot from alttprbot_srl import nick_verifier from alttprbot_srl.bot import srlbot sahasrahbotapi = Quart(__name__) @sahasrahbotapi.route('...
# __init__.py from .environment import * from .health import * from .population import * from .tools import *
from datetime import datetime import backtrader as bt # Create a subclass of Strategy to define the indicators and logic class SmaCross(bt.Strategy): # list of parameters which are configurable for the strategy params = dict( pfast=5, # period for the fast moving average pslow=10 # period f...
# -*- coding: utf-8 -*- #: Operation ids ops = [ "transfer", "limit_order_create", "limit_order_cancel", "call_order_update", "fill_order", "account_create", "account_update", "account_whitelist", "account_upgrade", "account_transfer", "asset_create", "asset_update", ...
import hashlib from .models import Student def md5(pwd): md5_pwd = hashlib.md5(bytes('MyLib', encoding='utf-8')) md5_pwd.update(bytes(pwd, encoding='utf-8')) return md5_pwd.hexdigest()#返回加密的数据 def update_Data(): ''' hash密码储存 ''' for stu in Student.objects.all(): stu.pwd = md5(stu.p...
class ixbrlFormat: def __init__(self, format_, decimals, scale, sign): if decimals.lower() == "inf": self.decimals = None else: self.decimals = int(decimals) self.format = None if format_: format_ = format_.split(":") if len(format_) ...
#################################### # Import libraries #################################### from flask import ( Flask, render_template, jsonify, request, redirect ) from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine #CHANGE TO FI...
# -*- coding: utf-8 -*- # (c) Copyright IBM Corp. 2010, 2021. All Rights Reserved. # pragma pylint: disable=unused-argument, no-self-use """ Helpers for AWS GuardDuty """ import json import os import io import re import datetime as dt import time import fnmatch import logging from fn_aws_guardduty.util import const fro...
''' This file contains the important function that is imported within the module ''' import numpy as np import matplotlib.pyplot as plt from time import time import os import glob from astropy.io import fits from functools import reduce from scipy.interpolate import LSQUnivariateSpline as spline from scipy.interpolat...
from app import app, modelo import dash_html_components as html import dash_bootstrap_components as dbc from dash.dependencies import Input, Output from Elements import dash_table import numpy as np from Pages.StaticModelPageData import fields, fields_categorical, example_data cards = dbc.Row([ dbc.Col(h...
# -*- coding: utf-8 -*- { 'name' : 'Crypto-currencies', 'version' : '1.0', 'summary': 'Manage crypto-currencies and convert', 'description': """ Core mechanisms for the managing crypto-currencies. Allow a higher decimal precision. Track the current value of all your assets """, 'category': 'Acco...
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
import cv2, threading, time, sys, queue, os import numpy as np from pywfom.devices.utils import * """ import win32com.client wmi = win32com.client.GetObject ("winmgmts:") for usb in wmi.InstancesOf ("Win32_USBHub"): print usb.DeviceID """ def find_cameras(): cameras = [] # OpenCV for i in range(10...
""" testing dependabot """ # from github_linter.tests.dependabot import load_file # def test_load_file(): # """ tests loading the dependabot file """ # load_file(None, {}, {})
# Copyright (c) 2019 CNES # # All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. import pickle import unittest import numpy as np import pyinterp.core as core MERCATOR_LATITUDES = np.array([ -89.000000, -88.908818, -88.809323, -88.700757, -88.58...
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft # Licensed under the MIT License. # Written by Ke Sun (sunk@mail.ustc.edu.cn) # ------------------------------------------------------------------------------ import os import cv2 import numpy as np import torc...
import RPi.GPIO as gpio import time class servo_class: def __init__(self): self.init_servo() self.pwm = None self.init_pwm() def init_servo(self): gpio.setmode(gpio.BOARD) gpio.setup(36, gpio.OUT) #servo signal sw PWM def init_pwm(self): sel...
# puzzle6b.py from utils import * from pprint import pprint, pformat # Strategy: # Due to performance considerations the strategy from part 1 doesn't work for # part 2. So we must take a different approach. # Consider that fish can be in one of 9 possible "states": 0, 1, 2, ..., 7, 8. # On each iteration, we simply ne...
import numpy as np import cv2 from Finding_Lane import fit_polynomial from Binary_Img import threshold_binary def show_warp_lane(img, warp_lane): ### img => undistort image # Combine the result with the original image and return return cv2.addWeighted(img, 1, warp_lane, 0.3, 0) def warp_lane(img, mat...
from itertools import product import csv particles = { "0": "None", "1": "Back of hand", "2": "Fingers", "3": "Tools", "4": "Wire", "5": "Dust protected", "6": "Dust tight", "X": "Unspecified" } water = { "0": "None", "1": "Dripping water", "2": "Dripping water, object tilt...
GITHUB_SLEEP_TIME_MIN = 0.001 GITHUB_SLEEP_TIME_MAX = 0.002
""" Copyright 2021 Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redist...
import torch import torch.nn as nn from torchvision.utils import make_grid from datasets import event_loader from models.unet import UNet from losses import multi_scale_flow_loss import utils.event_utils as event_utils from utils.viz_utils import flow2rgb import pytorch_ssim import radam import pytorch_utils from p...
import sys import time import Quartz class Mouse(): down = [Quartz.kCGEventLeftMouseDown, Quartz.kCGEventRightMouseDown, Quartz.kCGEventOtherMouseDown] up = [Quartz.kCGEventLeftMouseUp, Quartz.kCGEventRightMouseUp, Quartz.kCGEventOtherMouseUp] [LEFT, RIGHT, OTHER] = [0, 1, 2] def position(self): ...
from logtacts.settings import * SANDSTORM = True DEBUG = False SECRET_KEY = get_env_variable("LOGTACTS_SECRET_KEY") STATIC_URL = '//logtacts.s3.amazonaws.com/assets/' INSTALLED_APPS += ( 'gunicorn', ) ADMINS = () MANAGERS = ADMINS ALLOWED_HOSTS = ['*'] TEMPLATES[0]['OPTIONS']['context_processors'].append('...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import time import json import pickle import random import numpy as np import torch class TextColors: HEADER = '\033[35m' OKBLUE = '\033[34m' OKGREEN = '\033[32m' WARNING = '\033[33m' FATAL = '\033[31m' ENDC = '\033[0m' BOLD = '\033[...
# pylint: disable=line-too-long # pylint: disable=missing-docstring import binascii import unittest from collections import namedtuple from chewie.message_parser import SuccessMessage from chewie.radius import Radius, RadiusAccessAccept, RadiusAttributesList, \ InvalidResponseAuthenticatorError, RadiusAccessChal...
#!/usr/bin/env python import unittest import sys sys.path.append('../../bin') target = __import__('tf_readme_validator') main = target.main cfg = target.cfg class Test1(unittest.TestCase): def test(self): result = main() self.assertEqual(result, 1) self.assertEqual('ok' in cfg['readme']...
import urllib.request, urllib.error, urllib.parse from random import randint from bs4 import BeautifulSoup num = randint(1,150) old_poems = 'http://www.literaturepage.com/read/shakespeare_sonnets-%d.html' % (num) old_poems2 = 'http://www.literaturepage.com/read/shakespeare_sonnets-%d.html' % (num) def fetch...
import sys import py py.test.skip("threading is broken") import thread from pypy.translator.llvm.test.runtest import * def test_lock(): def fn(): l = thread.allocate_lock() ok1 = l.acquire(True) ok2 = l.acquire(False) l.release() ok2_and_a_half = False try: ...
#!/usr/bin/env python3 ''' Runs the HTTP Server application. This Python wrapper was written by Shreyas Ramesh <shreyas2@vt.edu> The program REQUIRES basic Python3 and package -- `sockets` and `os` ''' # ----------------- # # Generic Imports # # ----------------- # # Server Version __version__ = "1.0.0" import...
import unittest import numpy as np from psyclab.neural import stimulus class TestStimuli(unittest.TestCase): n = np.arange(-1, 2) def test_step_stimuli(self): stim = stimulus.StepStimulus(center=0, width=2, duration=0.1) self.assertEqual((stim.step(self.n) - np.array((0.0, 1.0, 0.0))).sum(...
GOOGLE_SEC = "" allow_type = ['jpg', 'png', 'gif', 'jpge', 'bmp'] VERIFY_MAX = 5 INTERVALS = 1800 RSA_BIT = 2048
# import necessary libraries: # Flask, render_template, redirect from flask # PyMongo from flask_pymongo # import your scrape file. # --------------------------------------------------------- # create instance of Flask app # Use flask_pymongo to set up mongo connection # -----------------------------------...
"""Example of a listing service for testing.""" # pylint: skip-file from typing import List, Optional from browse.domain.listing import NewResponse, ListingResponse, ListingItem, \ ListingCountResponse from browse.services.listing import ListingService import datetime class FakeListingFilesService(ListingServi...
# -*- coding: UTF-8 -*- from flask import Blueprint api = Blueprint('api', __name__) from . import errors, person
from typing import Any, Dict from IPython.core.interactiveshell import ExecutionResult from autoplot import Plotter from autoplot.utils.constants import DF_COLUMN_FORMAT_STRING VAR = "var" DF = "df" COL = "col" COL_ALT = "col alt" DF_COL = DF_COLUMN_FORMAT_STRING.format(DF, COL) DF_COL_ALT = DF_COLUMN_FORMAT_STRING....
import tensorflow as tf import model3 as M import numpy as np import resnet import cv2 class FaceResNet(M.Model): def initialize(self): self.resnet = resnet.ResNet([64,64,128,256,512], [3, 4, 14, 3], 512) def forward(self, x): feat = self.resnet(x) return feat tf.keras.backend.set_learning_phase(True) mo...
#!/usr/bin/env python import numpy as np import healpy as hp def draw_from_mask(n, mask_map, nest=False): nside = hp.pixelfunc.npix2nside(mask_map.size) mult = 2 n_points = 0 lon_chunks, lat_chunks = [], [] while n_points < n: # Draw points from sphere lon = np.random.random(n...
import torch from torch import nn from torch.nn import functional as F import math def get_nonlocal_block(block_type): block_dict = {'fft': FFTBlock, 'cgnl': SpatialCGNLx, 'nl': NonLocal, 'a2': DoubleAttention, 'cc': CCAttention, 'lo': LOBlock} if block_type in block_dict: return blo...
class Stack: def __init__(self): self.__items = [] def size(self): return len(self.__items) def __bool__(self): return bool(self.size()) def peek(self): if not self.__items: raise IndexError('Stack is Empty') return self.__items[-1] def pop(sel...
""" This module is the unittest for the count_processing function UnitTests(unittest.TestCase) -- framework for functions testing Exports 'OK', 'FAIL', or 'ERROR' """ import unittest import pandas as pd from src import count_processing as cp import pan...
import pickle import numpy as np class AdaBoostClassifier: '''A simple AdaBoost Classifier.''' def __init__(self, weak_classifier, n_weakers_limit): '''Initialize AdaBoostClassifier Args: weak_classifier: The class of weak classifier, which is recommend to be sklearn.tree.Decision...
import pandas as pd from collections import Counter import random import numpy as np train_clean = pd.read_csv('/workspace/mnt/storage/zhangjunkang/gldv2/data/train_labels/train_labels/train_clean.csv') landmark_ids = train_clean['landmark_id'] images = train_clean['images'] COUNT_LIMITED = 16 train_list_land_id = ...
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from __future__ import unicode_literals class_handlers = [] def register_method_handler(cls, method, parser_args, arg...
# Create a variable called user_name that captures the user's first name. user_name = input("What is your name? ") # Create a variable called friend_name that captures the name of the user's friend. friend_name = input("What is your friend's name? ") # Create variables to capture the number of months the user has bee...
# Copyright (c) 2020 Jonas Thorsell import sys n=[] for l in sys.stdin: n.append(int(l)) n.sort() d = [n[0]] + [b-a for a,b in zip(n, n[1:])] + [3] p = d.count(1) * d.count(3) print(p)
"""Remove filterconfig enums Revision ID: 92b582acebc6 Revises: fa3bc78eb17b Create Date: 2020-02-14 11:42:32.464331 """ # revision identifiers, used by Alembic. revision = "92b582acebc6" down_revision = "fa3bc78eb17b" branch_labels = None depends_on = None from alembic import op import sqlalchemy as sa from sqlalc...
#!/usr/bin/env python # -*- coding:utf-8 -*- # Author: qiujiarong # Date: 01/04/2018 from __future__ import print_function from __future__ import absolute_import from __future__ import division import os import tensorflow as tf import numpy as np from video.utils import show_tensor import PIL.Image as Image import c...
""" Copyright 2020 Mike Pawlowski Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db.models import Model, ForeignKey, CASCADE, PositiveIntegerField from django.db.models.signals import post_save, post_delete from django.dispatch import receiver from guardian.models ...
import math import numpy as np def calculate_quantiles(num_quantile_groups, quantiles): len_quant = len(quantiles) if not (num_quantile_groups and 0 < num_quantile_groups <= (len_quant + 1)): num_quantile_groups = 4 quant_multiplier = (len_quant + 1) / num_quantile_groups # quantile is one le...