text
stringlengths
1
927k
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.base import MIMEBase from email import encoders from datetime import datetime def sending(message): date_hour_now = datetime.now() date_hour_now_format = date_hour_now.strftime(f" data: %d/%m...
import string import types from module_info import * from module_triggers import * from module_dialogs import * from process_common import * from process_operations import * speaker_pos = 0 ipt_token_pos = 1 sentence_conditions_pos = 2 text_pos = 3 opt_token_pos = 4 sentence_consequences_pos = 5 sentence_voice_over...
from ...configuration.configuration import Configuration from ...exceptions.executorexceptions import CommandExecutionFailure from ...interfaces.batchsystemadapter import BatchSystemAdapter from ...interfaces.batchsystemadapter import MachineStatus from ...utilities.utils import async_run_command from ...utilities.util...
import torch from torch import Tensor, nn from torch.nn.functional import mse_loss from simulation.utils.machine_learning.data.image_pool import ImagePool from simulation.utils.machine_learning.models.helper import set_requires_grad from .base_model import BaseModel from .cycle_gan_stats import CycleGANStats class ...
# Copyright 2021 The NetKet Authors - 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.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
from os import startfile from base_functions import base_functions from markdown import markdownFromFile class markdown_functionality(base_functions): """Seperate Class to hold markdown methods""" def __init__(self): super(markdown_functionality, self).__init__() def compileAndDisplayMarkdown(self, label_index)...
# -*- coding: utf-8 -*- """ Django settings for app project. Generated by 'django-admin startproject' using Django 1.9.1. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/setting...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
#!/usr/bin/env python2 # From: https://gist.github.com/hauptmech/6b8ca2c05a3d935c97b1c75ec9ad85ff # Needs to install: sudo pip2 install opencv-contrib-python # Runs video capture and locates aruco markers from the given dictionary. import numpy as np import cv2 cap = cv2.VideoCapture(1) #dictionary = cv2.aruco.getPre...
#!/usr/bin/env python # -*- coding: utf-8 -*- # The duplyaml YAML processor. # The yconst.py file. # Common constants used in YAML. # First, get the Python version import sys PY_VER = sys.version # These are the constants used to define the Node kinds used with YAML nodes YAMLNODE_DEF = 0 # Used with the YAMLNode ...
from django.conf.urls import url,include from rest_framework import routers # router = routers.SimpleRouter() # router.register(r'^profile/$' ,ProfileView.as_view(),base_name='profile')
import os config = { "MAX_LIVE_AGE": int(os.environ.get("GK_MAX_LIVE_AGE", 60)), "DATA_PATH": os.environ.get("GK_DATA_PATH", "/data/") }
# Generated by Django 3.2.10 on 2021-12-09 14:28 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blog', '0011_post_tags'), ] operations = [ migrations.AddField( model_name='post', name='Type_Food', fi...
#!/usr/bin/env python # The MIT License (MIT) # # Copyright (c) 2013 Bartosz Zaczynski # # 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...
# -*- coding: utf-8 -*- # # Copyright 2018 Bartosz Kryza <bkryza@gmail.com> # # 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 requir...
# Copyright 2017 Neural Networks and Deep Learning lab, MIPT # # 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 applicab...
from Crypto import Random from Crypto.PublicKey import RSA DEFAULT_PRIAVTE_KEY_FILE_NAME = 'private_key.pem' DEFAULT_PUBLIC_KEY_FILE_NAME = 'public_key.pem' def main(): random_generator = Random.new().read rsa = RSA.generate(2048, random_generator) private_pem = rsa.exportKey() with open(DEFAULT_PRIAVTE_KEY_FIL...
from typing import Union, Optional from slack_sdk.models import JsonObject class SocketModeResponse: envelope_id: str payload: dict def __init__( self, envelope_id: str, payload: Optional[Union[dict, JsonObject, str]] = None ): self.envelope_id = envelope_id if payload is No...
import mido import cv2 #Color library using dictionary from RGB to velocity value of the Launchpad MK2 from ClearLaunchpad import RemoveNotes, ClearScreen from FirstMido import FillNotes cap = cv2.imread("Velocity2RGB.png") Complete = cap.copy() while(True): Mat = cv2.inRange(cap, (0, 0, 0), (254, 254, 254)) ...
a = int(input('Digite um número: ')) print(f'O antecessor de {a} é {a-1}\nO sucessor de {a} é {a+1}')
import uuid from os import getenv from boto3utils import s3 from cirruslib import Catalog, get_task_logger # envvars CATALOG_BUCKET = getenv('CIRRUS_CATALOG_BUCKET') def lambda_handler(payload, context): catalog = Catalog.from_payload(payload) logger = get_task_logger("task.pre-batch", catalog=catalog) ...
# Generated by the protocol buffer compiler. DO NOT EDIT! # sources: cosmos/bank/v1beta1/bank.proto, cosmos/bank/v1beta1/genesis.proto, cosmos/bank/v1beta1/query.proto, cosmos/bank/v1beta1/tx.proto # plugin: python-betterproto from dataclasses import dataclass from typing import Dict, List, Optional import betterprot...
""" ========================================================================== Phi_test.py ========================================================================== Test cases for functional unit Phi. Author : Cheng Tan Date : November 27, 2019 """ from pymtl3 import * from pymtl3.stdlib.test import Tes...
# Copyright (c) 2014 The Bitcoin Core developers # Copyright (c) 2014-2015 The Dash developers # Copyright (c) 2015-2017 The PIVX developers # Copyright (c) 2017-2018 The Domino developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-lic...
#!/usr/bin/env python # Copyright 2016 gRPC authors. # # 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 o...
from __future__ import print_function from collections import Counter import string import re import argparse import json import sys import os '''KorQuAD v1.0에 대한 공식 평가 스크립트 ''' '''본 스크립트는 SQuAD v1.1 평가 스크립트 https://rajpurkar.github.io/SQuAD-explorer/ 를 바탕으로 작성됨.''' def normalize_answer(s): def remove_(text): ...
#!/usr/bin/env python """ test_ssh_connect: verify ssh connectivity test_config_mode: verify enter config mode test_commit_base: test std .commit() test_commit_confirm: test commit with confirm test_confirm_delay: test commit-confirm with non-std delay test_no_confirm: test commit-confirm with no confirm test_commit_ch...
import time import board from analogio import AnalogIn from adafruit_crickit import crickit import neopixel print("Peltier Module Demo") pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, auto_write=False) def show_value(time_val): # Show time on NeoPixels on CPX num_pixels = int(10-time_val) for i in ra...
# -*- coding: utf-8 -*- """ Created on Wed Jul 21 15:13:07 2021 @author: pvrma """ """ This is the script for voxelising the ellipsoidal super quadric particle data. """ import voxelization zmax = -0.003 #removes particles above this height, to avoid heaping effect par_data = voxelization.import_ms_data('ms_coffee_de...
import datetime from decimal import Decimal from django.contrib.humanize.templatetags import humanize from django.template import Context, Template, defaultfilters from django.test import SimpleTestCase, modify_settings, override_settings from django.utils import translation from django.utils.html import escape from d...
import sys import pickle import numpy as np from PIL import Image, ImageOps from richlog import get_logger from . import util from . import imgops from . import item from . import minireco from . import resources from .util import any_in LOGFILE = 'log/drop-recognition.html' class RecognizeSession: def __init__...
# -*- coding: utf-8 -*- """The app module, containing the app factory function.""" from flask import Flask, render_template from dashboard import commands, public, user from dashboard.extensions import bcrypt, cache, csrf_protect, db, debug_toolbar, login_manager, migrate, webpack def create_app(config_object='dashb...
"""HPC preprocessor for an HPC demo job Example of an HPC preprocessor which takes a file and a text input and creates the necessary parameters for the HPC service. """ import os import logging from spyne import Application, srpc, ServiceBase, Unicode from spyne.protocol.soap import Soap11 from spyne.model.fault impo...
from datetime import datetime from airflow.models import Variable def read_export_dag_vars(var_prefix, **kwargs): """Read Airflow variables for Export DAG""" export_start_date = read_var('export_start_date', var_prefix, True, **kwargs) export_start_date = datetime.strptime(export_start_date, '%Y-%m-%d') ...
from .__init__ import * from ..__init__ import Generator def binaryComplement1sFunc(maxDigits=10): question = '' answer = '' for i in range(random.randint(1, maxDigits)): temp = str(random.randint(0, 1)) question += temp answer += "0" if temp == "1" else "1" problem = questio...
from compas_cem.elements import Edge class TrailEdge(Edge): """ A trail edge. Notes ----- If a plane is defined, it will override the absolute length of the trail edge. However, the sign of the length (e.g. the combinatorial state) is preserved. TODO: addexplicit combinatorial state to t...
# Copyright 2016 The Kubernetes Authors. # # 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 ...
# uri: https://adventofcode.com/2021/day/4 from typing import Optional from base import get_input file_path = get_input(4, ".txt") INPUT = """7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1 22 13 17 11 0 8 2 23 4 24 21 9 14 16 7 6 10 3 18 5 1 12 20 15 19 3 15 0 2 22 9 18 13 17 ...
############################################### # This is an example for the OC05 8-channel # servo driver. # # A servo on channel 1 is positioned according # to a desired degree of rotation. ############################################### import streams from xinabox.oc05 import oc05 # create a serial console...
# noinspection PyUnresolvedReferences from .meson import MesonToolchain
import base64 from io import BytesIO import matplotlib.pyplot as plt from matplotlib.ticker import ScalarFormatter from calculators.bridge import calculate_blend_cumulative, SIZE_STEPS, theoretical_bridge from classes.product import Product from controllers.products import products_get def bridge_plot(products: dic...
import collections import functools import mxnet as mx import numpy as np import scipy import pytest from mxnet.gluon import nn, HybridBlock from numpy.testing import assert_allclose from gluonnlp.sequence_sampler import BeamSearchScorer, BeamSearchSampler mx.npx.set_np() @pytest.mark.parametrize('length', [False, Tr...
# Test hashlib module # # $Id$ # # Copyright (C) 2005-2010 Gregory P. Smith (greg@krypto.org) # Licensed to PSF under a Contributor Agreement. # import array from binascii import unhexlify import hashlib import itertools import os import sys try: import threading except ImportError: threading = None import...
""" Plot raster across session ========================== Example of how to plot scatter plot of spike depths vs spike times with colour and size of scatter points scaled by spike amplitude """ import numpy as np from brainbox.ephys_plots import scatter_raster_plot from brainbox.plot_base import plot_scatter from onei...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
coordinates_7F0030 = ((137, 134), (137, 136), (138, 133), (138, 136), (139, 132), (139, 134), (139, 136), (140, 132), (140, 134), (140, 135), (140, 137), (141, 131), (141, 133), (141, 134), (141, 135), (141, 137), (142, 131), (142, 133), (142, 134), (142, 135), (142, 136), (142, 138), (143, 130), (143, 132), (143, 13...
# Tai Sakuma <tai.sakuma@gmail.com> ##__________________________________________________________________|| def merge_in_order(map_, id_, data): ## merge to prev idx = list(map_.keys()).index(id_) idx_prev = idx - 1 if idx_prev < 0: map_[id_] = data else: data_prev = list(map_.value...
""" Relating Gender and IQ ======================= Going back to the brain size + IQ data, test if the VIQ of male and female are different after removing the effect of brain size, height and weight. """ import pandas from statsmodels.formula.api import ols data = pandas.read_csv('../brain_size.csv', sep=';', na_valu...
from django.db import models from django.db.models.query import QuerySet from model_utils.managers import PassThroughManagerMixin from .signals import publisher_pre_delete from .middleware import get_draft_status class PublisherQuerySet(QuerySet): def drafts(self): from .models import PublisherModelBas...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
# Generated by Django 3.1.4 on 2021-10-27 18:01 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('roomate', '0011_auto_20211027_1651'), ] operations = [ migrations.AlterField( model_name='contactus', name='id', ...
""" Tasks for maintaining the project. Execute 'invoke --list' for guidance on using Invoke """ import platform import webbrowser from pathlib import Path from invoke import call, task from invoke.context import Context from invoke.runners import Result ROOT_DIR = Path(__file__).parent DOCS_DIR = ROOT_DIR.joinpath("...
import torch import torch.nn as nn import numpy as np from lib.models.core import BaseSequentialModel from lib.distributions import Normal class CTVAE(BaseSequentialModel): name = 'ctvae' # conditional trajectory VAE policy model_args = ['state_dim', 'action_dim', 'z_dim', 'h_dim', 'rnn_dim', 'num_layers'] ...
#!/usr/bin/env python data_in = '../inputs/set01/aoc10.in' def load(file): with open(file) as x: output = x.read() return output.replace('\n', '') def look_say(start): (current, counter) = ('', 0) new = '' for digit in start: if current != digit: if current: new = '{}{}{}'.format(new, counter, cu...
import torch.nn.functional as F import torch def CondorOrdinalCrossEntropy(logits, levels, importance_weights=None, reduction='mean'): """Computes the CONDOR loss described in CONDOR TBD. Parameters ---------- logits : torch.tensor, shape(num_examples, num_classes-1) Outputs of the CONDO...
# -*- coding: utf-8 -*- """ colorthief ~~~~~~~~~~ Grabbing the color palette from an image. :copyright: (c) 2015 by Shipeng Feng. :license: BSD, see LICENSE for more details. """ __version__ = '0.2.1' import math from PIL import Image class cached_property(object): """Decorator that create...
""" :mod:`textacy.vsm.vectorizers`: Transform a collection of tokenized documents into a document-term matrix of shape (# docs, # unique terms), with various ways to filter or limit included terms and flexible weighting schemes for their values. A second option aggregates terms in tokenized documents by provided grou...
# !/usr/bin/env python3 # Copyright (c) 2019 The PIVX developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' Covers the scenario of two valid PoS blocks with same height and same coinstake input. ''' from copy import deep...
import numpy, copy import scipy.constants as codata from srxraylib.util.data_structures import ScaledArray, ScaledMatrix from wofry.propagator.wavefront import Wavefront, WavefrontDimension from wofry.propagator.util.gaussian_schell_model import GaussianSchellModel1D # needed for h5 i/o import os import sys import ...
import numpy as np import multiprocessing import utility import numpy import os import itertools import logic import graphs import sympy import time import ilp import random import csv import gurobipy from gurobipy import GRB import stochastic import subprocess from enum import Enum import pickle import dill from patho...
# MIT License # # Copyright (c) 2016 Olivier Bachem # # 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, merg...
from tests.models import Test from datetime import datetime # To check and return test and participant def check_test_participant(request, test_code): test = Test.objects.filter(test_code=test_code, deadline__gte=datetime.now()) participant = request.session.get('participant') return {'test': test, 'p...
#!/usr/bin/python3 '''Prepare Filelists for Semantic3D Segmentation Task.''' from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import math import random import argparse from datetime import datetime def main(): parser = argparse.ArgumentParser...
__all__ = [ 'UNSET', 'Diff', 'Slotinit', 'get_closest_parent', 'get_document_type', 'document_type_to_class_name' ] import inspect from typing import Type, Iterable, Optional, NamedTuple, Any from mongoengine import EmbeddedDocument from mongoengine.base import BaseDocument from .flags import...
# -*- coding: utf-8 -*- from datetime import datetime from parser import Model from parser.cmds.cmd import CMD from parser.utils.corpus import Corpus from parser.utils.data import TextDataset, batchify import torch class Predict(CMD): def add_subparser(self, name, parser): subparser = parser.add_parser...
__author__ = 'Chris Jones' import numpy as np from scipy.integrate import quad import heat_xfer as hx # Values for default parameters default_rrr = 150 default_I = 200. default_res_increase = 0. default_rho_273 = 1.71e-6 linspace_num = 500 def get_kr_ave1(u_l, u_h): """ Returns the average k*r value from u...
# # 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 # ...
import tensorflow as tf def make_chatspace_training_dataset( lookup_table: tf.lookup.StaticHashTable, space_skip_prob: float, ): """ Chatspace 모델에 넣을 Input을 만드는 함수를 반환합니다. 정상 문장을 입력으로 받아 랜덤하게 띄어쓰기를 지웁니다. :param lookup_table: Vocab 정보로 초기화된 ``tf.lookup.StaticHashTable`` :param space_skip_p...
"""Generated message classes for cloudasset version v1p4alpha1. The cloud asset API manages the history and inventory of cloud resources. """ # NOTE: This file is autogenerated and should not be edited by hand. from __future__ import absolute_import from apitools.base.protorpclite import messages as _messages from a...
# Author: Alejandro M. BERNARDIS # Email: alejandro.bernardis@gmail.com # Created: 2019/11/22 14:13 # ~ from os import path from io import open from setuptools import setup, find_packages import aysa.docker.registry.__version__ as registry here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'readme...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (c) 2014,掌阅科技 All rights reserved. 摘 要: database.py 创 建 者: WangLichao 创建日期: 2015-01-26 """ # pylint: disable=invalid-name, bare-except from lib.db.retrydb import MyRetryDB from peewee import Model as _Model from peewee import DoesNotExist from peewee impo...
# MIT License # # Copyright (c) 2015-2021 Iakiv Kramarenko # # 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, modif...
from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score from scipy.spatial import distance import random def euc(a, b): return distance.euclidean(a, b) # random classifier class ScrappyRandom: def fit(self, x_train, y_train): self....
#!/usr/bin/env python # Copyright 2014-2018 The PySCF Developers. 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.org/licenses/LICENSE-2.0 # # U...
import time import sys import argparse import datetime import pathlib import numpy as np import torch import torch.nn as nn from torch.autograd import Variable # Set seed torch.manual_seed(0) # Where to add a new import from torch.optim.lr_scheduler import StepLR # from torch.utils.tensorboard import SummaryWriter ...
import numpy as np import pandas as pd import os import sys sys.path.insert(0, "../../../ctg/core") #from fit_ac_fc import * from fit_ac_fc2 import Counts from config import config abundance_file = os.path.join(config.A549_test, "A549_abundance_thresholds.txt") counts_file = os.path.join(config.A549_test, "A549_time...
from ROAR.planning_module.mission_planner.mission_planner import ( MissionPlanner, ) from pathlib import Path import logging from typing import List, Optional from ROAR.utilities_module.data_structures_models import Transform, Location, Rotation from collections import deque from ROAR.agent_module.agent import Agen...
""" WSGI config for delicate_forest_30319 project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault...
# -*- coding: utf-8 -*- import json from datetime import datetime import sqlalchemy as sa from aiopg.sa.result import ResultProxy from .db import TLE, insert_tle from .log import logger from .utils import audit, send_pg_notify __all__ = ( 'get_tle_dt', 'nasa', 'space_track', ) @audit(logger=logger) asy...
import subprocess #Windows - ping 127.0.0.1 #Linux - ping 127.0.0.1 -c 4 # arg0 arg1 arg2 arg3 proc = subprocess.run( ['ping', '127.0.0.1', '-c', '4'], capture_output=True, text=True ) saida = proc.stdout saida = saida.replace('icmp_seq', 'Dwolter') print(saida)
''' parse country case counts provided by ECDC and write results to TSV this should be run from the top level of the repo. Will need to be integrated with other parsers once they become available. ''' import xlrd import csv import json from urllib.request import urlretrieve from collections import defaultdict from da...
# Copyright 2012 OpenStack Foundation # # 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...
import time from absl import app, flags, logging from absl.flags import FLAGS import cv2 import tensorflow as tf from yolov3_tf2.models import ( YoloV3, YoloV3Tiny ) from yolov3_tf2.dataset import transform_images from yolov3_tf2.utils import draw_outputs flags.DEFINE_string('classes', './data/face.names', 'path ...
# -*- coding: utf-8 -*- __version__ = "1.10.0"
#!/usr/bin/env python # -*- coding: utf-8 -*- import rospy, os import SimpleHTTPServer def kill(): os.system("kill -KILL " + str(os.getpid())) os.chdir(os.path.dirname(__file__)) rospy.init_node("webserver") rospy.on_shutdown(kill) SimpleHTTPServer.test()
"""Bernoulli MLP Regressor based on MLP with Normalized Inputs.""" from dowel import tabular import numpy as np import tensorflow as tf from garage.tf.distributions import Bernoulli from garage.tf.misc import tensor_utils from garage.tf.models import NormalizedInputMLPModel from garage.tf.optimizers import ConjugateGr...
""" Implements a factory for view classes """ from abc import ABC, abstractmethod from blog.views.about_us import AboutUs from .posts import PostDetail, PostList, PostListAlgorithms, PostListMathematics from .contact import ContactUs from .about_us import AboutUs class ViewsFactory(ABC): """ Generates view ob...
""" https://www.ianlewis.org/en/kubernetes-health-checks-django """ import logging import os import redis from django.http import HttpResponse, HttpResponseServerError logger = logging.getLogger("django") r = redis.Redis(host=os.environ.get("REDIS_SERVICE_HOST")) class HealthCheckMiddleware(object): def __init...
#!/usr/bin/env python # Utility functions to spawn an editor to edit a file import os import stat import tempfile class FileNotFoundError: pass default_editor = "vi" def edit_file (filename): "Spawn an editor to edit the specified file." if not filename: raise FileNotFoundError, "Could not open file (%s)" % fi...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the...
from os.path import abspath, join, dirname import random from math import floor from enum import Enum def full_names_path(filename: str): return abspath(join(dirname(__file__), 'data', filename)) FILES = {} for t in ['first', 'last']: for gdr in ['.m', '.f']: # Years for y in range(1891, 202...
# pylint: disable=missing-docstring, invalid-name """2016 - Day 1 Puzzle Part 2 tests.""" import sys from mod import solve, in_between, Point print(solve, in_between, Point, sys)
from . import extension from torchaudio._internal import module_utils as _mod_utils from torchaudio import ( compliance, datasets, kaldi_io, utils, sox_effects, transforms ) from torchaudio.backend import ( list_audio_backends, get_audio_backend, set_audio_backend, save_encinfo, ...
import os, sys, time, sqlite3 from collections import defaultdict as dd from lxml import etree import argparse ################################################################################ # TO DO ################################################################################ # - warn if requested docs do not exis...
import os import numpy as np import matplotlib.animation as animation import matplotlib.colors as colors import matplotlib.patheffects as pe import matplotlib.pyplot as plt from matplotlib.animation import ArtistAnimation from mpl_toolkits.mplot3d import Axes3D from Quaternions import Quaternions def animation_plot(...
# import pymysql # # pymysql.version_info = (1, 4, 14, "final", 0) # pymysql.install_as_MySQLdb()
import os import traceback from uuid import uuid4 import cv2 from cvlog import log from cvlog.config import Config from cvtest.csv_reporter import CsvReporter class Reporter: def __new__(cls): if not hasattr(cls, 'instance') or not cls.instance: cls.instance = super().__new__(cls) ...
from typing import Callable from chocs.http_request import HttpRequest from chocs.http_response import HttpResponse from chocs.middleware.middleware import MiddlewarePipeline from chocs.routing import Route from .aws import AwsServerlessFunction from .serverless import IS_AWS_ENVIRONMENT, ServerlessFunction def cre...
# -*- coding: utf-8 -*- class Solution: def longestWord(self, words): wordsSet = set(words) result = [] for word in words: if all(word[:i] in wordsSet for i in range(1, len(word))): result.append(word) return min(result, key=lambda el: (-len(el), el)) ...