text
stringlengths
1
927k
import numpy as np from environment import POMDPEnvironment from rand.random_controller import RandomController class VoiceTask_random: avg_rewards = [] def __init__(self, env_file, prior): self.environment = POMDPEnvironment(env_file) self.prior = self.belief = prior self.next_acti...
""" This module lets you practice two forms of the ACCUMULATOR pattern: -- SUMMING -- COUNTING where the accumulation is done via ITERATING (i.e., looping) through a SEQUENCE. It also demonstrates the distinction between: -- an INDEX of the sequence (e.g., -5 is at index 1 in [0, -5, 12, -6]) and -- the item A...
from code.models.D_LinkNet import DLinkNet from code.models.DeepLabv3plus import DeepLabV3Plus from code.models.LinkNet import LinkNet from code.models.ResUNet import ResUNet from code.models.SegHRNet import SegHRNet from code.models.SegHRNet_OCR import SegHRNet_OCR from code.models.SegHR_LinkNet import SegHR_LinkNet f...
import json print('name : ', end = '') b = input() json_data = open('en-US.json', 'rt', encoding='utf-8').read() a_json = json.loads(json_data) json_data = open(str(b) + '.json', 'rt', encoding='utf-8').read() b_json = json.loads(json_data) for a_in in a_json: if not a_in in b_json: print(a_in + ' : ', ...
#!/usr/bin/env python """The setup script.""" from setuptools import find_packages, setup requirements = [ "xlrd>=1.1.0", "requests>=2.22.0", "click>=7.0", "click-help-colors>=0.5", "pandas>=0.20.3", "openpyxl>=2.4.8", "pendulum>=1.3.2", "pydantic>= 1.1", "ftfy>=5.5.1", ] setup_re...
# Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html # useful for handling different item types with a single interface from itemadapter import ItemAdapter class GetpdfPipeline: def process_item(s...
import pygame, random, math, queue, pdb pygame.init() clock = pygame.time.Clock() SCREEN_WIDTH = 800 COLUMNS = 100 ROWS = 100 CELL_WIDTH = 8 CELL_COLOURS = { "empty" : (128, 128, 128), "wall" : (0, 0, 0), "start" : (0, 255, 0), "goal" : (255, 0, 0), "path" : (255, 255, 255), "explored" : (0,...
import os import unittest from gen_tsne import build_grid ASSETS_DIR = os.path.join(os.path.dirname(__file__), "assets") class TestGrid(unittest.TestCase): def test_build(self): paths = [os.path.join(ASSETS_DIR, "dataset"), os.path.join(ASSETS_DIR, "model_a"), os.path.join(ASSETS_DIR, ...
"""This defines a basic set of data for our Star Wars Schema. This data is hard coded for the sake of the demo, but you could imagine fetching this data from a backend service rather than from hardcoded JSON objects in a more complex demo. """ from typing import Collection, Iterator __all__ = ["get_droid", "get_frie...
# Prirejeno po datotekah iz predavanj in vaj. import csv import json import os import requests default_headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'} # Prenos spletne strani def url_v_html(url, mapa, ime_datotek...
import os.path import re with open(os.path.join(os.path.dirname(__file__), 'VERSION')) as f: version_content = [line for line in f.readlines() if re.search(r'([\d.]+)',line)] if len(version_content) != 1: raise RuntimeError('Invalid format of VERSION file.') __version__ = version_content[0]
# # Copyright (c) 2017 Electronic Arts Inc. All Rights Reserved # from __future__ import unicode_literals import datetime from django.db import models from django.utils import timezone from model_utils.fields import MonitorField, StatusField from model_utils.models import TimeStampedModel from model_utils import C...
# 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 ...
_base_ = [ '../_base_/models/retinanet_r50_fpn.py', '../_base_/datasets/coco500_detection_augm.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] model = dict( bbox_head=dict(type='APLossRetinaHead', anchor_generator=dict(scales_per_octave=2), bbox_coder=dict( ...
import numpy as np from ..arraystep import Competence from pymc3_ext.vartypes import discrete_types from pymc3_ext.step_methods.hmc.integration import IntegrationError from pymc3_ext.step_methods.hmc.base_hmc import BaseHMC, HMCStepData, DivergenceInfo __all__ = ['HamiltonianMC'] def unif(step_size, elow=.85, ehig...
from datetime import datetime def create_game_mock( name="Dungeons & Dragons", sumary="Medieval fantasy adventures on D20 based systems", ): return { 'name': name, 'sumary': sumary, } def create_item_mock( name="Vorpal Sword", description="Pierces anything",...
""" main.py Main driver for the Linear Error Analysis program. Can be run using `lea.sh`. Can choose which plots to see by toggling on/off `show_fig` param. Author(s): Adyn Miles, Shiqi Xu, Rosie Liang """ import os import matplotlib.pyplot as plt import numpy as np import config import libs.gta_xch4 as gta_xch4 i...
# Simple Pong in Python 3 # Tutorial by @TokyoEdTech import turtle wn = turtle.Screen() wn.title("Pong by Luke Townsend") wn.bgcolor("black") wn.setup(width=800, height=600) wn.tracer(0) # Paddle A paddle_a = turtle.Turtle() paddle_a.speed(0) paddle_a.shape("square") paddle_a.color("white") paddle_a.shapesize(stre...
# Generated by Django 3.1.3 on 2020-12-01 22:02 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), ('catalog', '0003_auto_202...
from rest_framework.filters import OrderingFilter, SearchFilter from rest_framework.generics import ListAPIView from rest_framework.permissions import AllowAny, IsAdminUser from django_filters.rest_framework import DjangoFilterBackend from .models import ServiceAgentBus from .serializers import ServiceAgentSerialize...
from vnpy.app.cta_strategy import BarData class CandleEngine: """ 蜡烛图分析引擎 """ def recognitionBar(self, bar: BarData): """ 识别单个bar数据 :param bar: :return: """ candle_chart = CandleChart(bar.open_price, bar.high_price, bar.low_price, bar.close_price) cla...
""" Arquivo: classesRT.py Reune as classes utilizadas no tracamento de raios, definindo os elementos que compoem o meio onde os raios serao tracados, definindo tambem os proprios raios. """ from eqDiferencialOrdinaria import eqDiferencialOrdinaria as EDO import numpy as np class ray(EDO): """ ...
FACEBOOK_USER = "" FACEBOOK_PASSWORD = "" FACEBOOK_ID = "" AUTO_LIKE = True DB_NAME = "" DB_USER = "" DB_PASSWORD = "" WEBSERVER_FOLDER = "" NOTIFICATIONS_EMAIL = "" SMTP_SERVER = "" SMTP_PASSWORD = "" NOTIFICATIONS_IFTTT_KEY = ""
from operator import attrgetter import pyangbind.lib.xpathhelper as xpathhelper from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType from pyangbind.lib.base import PybindBase from de...
#!/usr/bin/env python2.7 # # Builds an sqlite DB containing all the rulesets, indexed by target. import glob import locale import os import sqlite3 import subprocess import sys from collections import Counter from lxml import etree # Explicitly set locale so sorting order for filenames is consistent. # This is impor...
class Solution: def minPathSum(self, grid: List[List[int]]) -> int: m = len(grid) if m == 0: return 0 n = len(grid[0]) for j in range(1, n): grid[0][j] += grid[0][j - 1] for i in range(1, m): grid[i][0] += grid[i - 1][0] for j i...
from __future__ import unicode_literals from moto.core.exceptions import RESTError class EC2ClientError(RESTError): code = 400 class DependencyViolationError(EC2ClientError): def __init__(self, message): super(DependencyViolationError, self).__init__( "DependencyViolation", message) c...
#!/usr/bin/python # import RNA seq = "AUUUCCACUAGAGAAGGUCUAGAGUGUUUGUCGUUUGUCAGAAGUCCCUAUUCCAGGUACGAACACGGUGGAUAUGUUCGACGACAGGAUCGGCGCACUA" # create fold_compound data structure (required for all subsequently applied algorithms) fc = RNA.fold_compound(seq) # compute MFE and MFE structure (mfe_struct, mfe) = fc.mfe...
"""djangoBlog URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-ba...
"""Module will not import due to invalid blahblah import.""" import blahblah.blah print("I dont do much") def arbmodinvalid_attribute(): """Can't ever run on account of how blah doesn't exist.""" blahblah.blah.blah()
# coding=utf-8 # Copyright 2021-present, the Recognai S.L. team. # # 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 ...
#!/usr/bin/python # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Checks third-party licenses for the purposes of the Android WebView build. The Android tree includes a snapshot of Chromium in order to...
import numpy as np import matplotlib.pyplot as plt blue = (0, 0, 1.0) red = (1.0, 0, 0) gray = (0.7, 0.7, 0.7) # Criterion def impurity_error(p1, p2): return min(p1, p2) def impurity_entropy(p1, p2): if p1 == 0.0 or p1 == 1.0 or p2 == 0.0 or p2 == 1.0: return 0.0 else: return -(p1 * np.l...
# encoding: UTF-8 from __future__ import print_function import hashlib import hmac import json import ssl import traceback from queue import Queue, Empty from multiprocessing.dummy import Pool from time import time from urlparse import urlparse from copy import copy from urllib import urlencode from threading import ...
# -*- coding: utf-8 -*- # 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, ...
from posthog.settings.utils import get_from_env, str_to_bool CONSTANCE_BACKEND = "constance.backends.database.DatabaseBackend" CONSTANCE_DATABASE_PREFIX = "constance:posthog:" CONSTANCE_CONFIG = { "MATERIALIZED_COLUMNS_ENABLED": ( get_from_env("MATERIALIZED_COLUMNS_ENABLED", True, type_cast=str_to_bool),...
import asyncio import logging import os import shutil import warnings from functools import partial from typing import Any, List, Optional, Text, Union import rasa.core.utils import rasa.utils import rasa.utils.common import rasa.utils.io from rasa import model, server from rasa.constants import ENV_SANIC_BACKLOG from...
import io import sys from sqlalchemy import __version__ as sa_version if sys.version_info < (2, 6): raise NotImplementedError("Python 2.6 or greater is required.") sqla_08 = sa_version >= '0.8.0' sqla_09 = sa_version >= '0.9.0' py2k = sys.version_info < (3, 0) py3k = sys.version_info >= (3, 0) py33 = sys.version...
""" ------------------------------------------------------- model.py [program description] ------------------------------------------------------- Author: Mohammed Perves ID: 170143440 Email: moha3440@mylaurier.ca __updated__ = "2018-06-20" ------------------------------------------------------- """ import csv ...
#!/usr/bin/env python # __author__ = "Ronie Martinez" # __copyright__ = "Copyright 2020, Ronie Martinez" # __credits__ = ["Ronie Martinez"] # __maintainer__ = "Ronie Martinez" # __email__ = "ronmarti18@gmail.com" class CountryCodeNotFound(Exception): pass class CountryNotFound(Exception): pass
# coding: utf-8 import os import sys from mock import patch import pytest from decouple import Config, RepositoryEnv, UndefinedValueError # Useful for very coarse version differentiation. PY3 = sys.version_info[0] == 3 if PY3: from io import StringIO else: from io import BytesIO as StringIO ENVFILE = ''' K...
#!/usr/bin/env python # coding: utf-8 from sklearn.model_selection import KFold import pandas as pd import numpy as np from keras.preprocessing.sequence import pad_sequences from skmultilearn.problem_transform import LabelPowerset from imblearn.over_sampling import RandomOverSampler from keras.models import Model f...
# Importing the Kratos Library import KratosMultiphysics as KM from KratosMultiphysics.python_solver import PythonSolver # Import applications import KratosMultiphysics.ShallowWaterApplication as SW def CreateSolver(model, custom_settings): return EmptySolverForTesting(model, custom_settings) class EmptySolverFo...
"""Redis transport.""" from __future__ import absolute_import, unicode_literals import numbers import socket from bisect import bisect from collections import namedtuple from contextlib import contextmanager from time import time from vine import promise from kombu.exceptions import InconsistencyError, VersionMisma...
# -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """ Spyder API menu widgets. """ # Standard library imports import sys from typing import Optional, Union, TypeVar # Third party imports from qtpy.QtWidgets import ...
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # 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 ...
# Python 2 compatibility from __future__ import print_function from __future__ import division import sys from .. import utils class TestUtils(object): """ """ def test_imported(self): """Ensure utils module imported. """ assert 'pyjac.utils' in sys.modules
from typing import Dict, Optional from ciphey.iface import Checker, Config, ParamSpec, registry @registry.register class HumanChecker(Checker[str]): @staticmethod def getParams() -> Optional[Dict[str, ParamSpec]]: pass def check(self, text: str) -> Optional[str]: with self._config().paus...
# Copyright © 2019 National Institute of Advanced Industrial Science and Technology (AIST). All rights reserved. # !/usr/bin/env python3.6 # coding=utf-8 import inspect import logging from functools import wraps from pathlib import Path from datetime import datetime from pytz import timezone # グローバル変数 ログ保存フォルダパス g_lo...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # filename: config.py # modified: 2019-09-10 __all__ = ["AutoElectiveConfig"] import os from configparser import RawConfigParser from .utils import Singleton from .const import CONFIG_INI class BaseConfig(object, metaclass=Singleton): CONFIG_FILE = "" ALLOW_NO...
from torch import nn import torch from ..base import LinkPredictionBase from .ConcatFeedForwardNNLayer import ConcatFeedForwardNNLayer class ConcatFeedForwardNN(LinkPredictionBase): r"""Specific class for link prediction task. Parameters ---------- input_size : int The length of inp...
from enum import Enum from unittest import TestCase from marshy import dump, load, get_default_context from marshy.errors import MarshallError from marshy.factory.enum_marshaller_factory import EnumMarshallerFactory class VehicleTypes(Enum): CAR = 'car' TRUCK = 'truck' BIKE = 'bike' class TestMarshallE...
import cupy from cupyx import jit @jit.rawkernel() def reduction(x, y, size): tid = jit.threadIdx.x ntid = jit.blockDim.x value = cupy.float32(0) for i in range(tid, size, ntid): value += x[i] smem = jit.shared_memory(cupy.float32, 1024) smem[tid] = value jit.syncthreads() ...
""" A holder for horizon extension steps inherited from `.class:Enhancer` with: - redifined get_mask_transform_ppl to thin out loaded mask - making an iterative inference to cover the holes in a given horizon. """ import gc from copy import copy from pprint import pformat from time import perf_counter import n...
import sys import numpy as np import matplotlib.pyplot as plt from ppa.ppa import prey_predator_algorithm from ppa.config import Config from acs.objective import fitness, fitness_population from acs.instance import Instance, print_instance def read_files(instance_config_filename, config_filename): if instance_co...
from typing import Optional from db.scaffold import Scaffold from telegram import models as tg_models from pyrogram import types class GetUpdatedDialog(Scaffold): def get_updated_dialog( self, *, raw_chat: "types.Chat", db_account: "tg_models.TelegramAccount", ...
""" Affine Lie Algebras AUTHORS: - Travis Scrimshaw (2013-05-03): Initial version """ #***************************************************************************** # Copyright (C) 2013-2017 Travis Scrimshaw <tcscrims at gmail.com> # # This program is free software: you can redistribute it and/or modify # it u...
# # Copyright 2020 Logical Clocks AB # # 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 ag...
# bookmark/controllers.py # Brought to you by We Vote. Be good. # -*- coding: UTF-8 -*- from .models import BookmarkItemList, BookmarkItemManager from ballot.models import CANDIDATE, MEASURE, OFFICE from candidate.models import CandidateCampaignManager from django.http import HttpResponse import json from measure.mode...
from typing import List class Solution_mine: # pass, O(N), but maybe not concise? def validMountainArray(self, arr: List[int]) -> bool: if len(arr) < 3: return False i = 0 increasing_count = 0 increasing = True while i + 1 <= len(arr) - 1: if increasin...
# Copyright 2017 Google Inc. # # 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, ...
from rest_framework import serializers from api.config import FABRIC_CHAINCODE_STORE from api.models import ChainCode from api.common.serializers import ListResponseSerializer import hashlib def upload_to(instance, filename): return '/'.join([FABRIC_CHAINCODE_STORE, instance.user_name, filename]) class ChainCo...
import ast import numpy as np import torch as torch import torch.nn as nn import torch.nn.functional as F def get_descendants(node, ls): for child in node.children: ls.append(child) get_descendants(child, ls) return ls class Node(): ''' For each node we store its parent and children n...
# -*- coding: utf-8 -*- """ tests.cache ----------- Tests cache module. """ import pytest from renoir import Renoir @pytest.fixture(scope='function') def templater_reload(): return Renoir(reload=True) @pytest.fixture(scope='function') def templater_noreload(): return Renoir() def test_norel...
import cv2 import numpy as np roi = cv2.imread('banana.jpg') hsv = cv2.cvtColor(roi,cv2.COLOR_BGR2HSV) target = cv2.imread('banana_recortada.png') hsvt = cv2.cvtColor(target,cv2.COLOR_BGR2HSV) # calculating object histogram roihist = cv2.calcHist([hsv],[0, 1], None, [180, 256], [0, 180, 0, 256] ) # normalize histog...
# Copyright 2020 The TensorFlow Probability 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...
# -*- coding: utf-8 -*- """ Base classes for writing management commands (named commands which can be executed through ``django-admin`` or ``manage.py``). """ from __future__ import unicode_literals import os import sys from argparse import ArgumentParser import django from django.core import checks from django.core....
from prometheus_client.utils import INF from typing import Dict from typing import Optional from typing import Type import prometheus_client as client import time import traceback NOERROR = "none" ERROR_GENERAL_EXCEPTION = "exception" KAFKA_ACTION = client.Counter( "kafkaesk_kafka_action", "Perform action on...
# -*- coding: utf-8 -*- """ A TestRunner for use with the Python unit testing framework. It generates a HTML report to show the result at a glance. The simplest way to use this is to invoke its main method. E.g. import unittest import HTMLTestRunner ... define your tests ... if __name__ == '__main__...
# DB Server http://192.168.0.154:8080 import face_recognition_api import cv2 import os import pickle import datetime import cx_Oracle import pandas as pd import csv def getTime(type_print): if type_print == 1: return datetime.datetime.now().strftime('%Y-%m-%d %H-%M') else: return datetime.datet...
from _setup.models import Log, Cronjob, Config, Secret import os from django.contrib.auth import get_user_model import secrets import json class SetupImport(): def __init__(self, backup_files, test=False): self.backup_files = backup_files self.test = test folders = os.listdir() fo...
import sys sys.path.append('/Users/phanquochuy/Projects/minimind/prototypes/george/build/lib.macosx-10.10-x86_64-2.7') import numpy as np import george from george.kernels import ExpSquaredKernel # Generate some fake noisy data. x = 10 * np.sort(np.random.rand(10)) yerr = 0.2 * np.ones_like(x) y = np.sin(x) + yerr * n...
"""Tests for the marketmanager API.""" from django.test import TestCase from rest_framework.test import APIClient from rest_framework import status from django.urls import reverse from api import models def check_response_items(request, response, test_object): """Check the response for missing data from the requ...
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com # # Part of "Nuitka", an optimizing Python compiler that is compatible and # integrates with CPython, but also works on its own. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complianc...
from ._ADAMSBaseReader import ADAMSBaseReader from ._ADAMSBaseWriter import ADAMSBaseWriter from ._ADAMSFilenameSource import ADAMSFilenameSource
#-------------------SOCKET PROGRAMMING------------------- #Krijimi i klient aplikacionit import socket #Importojme librarine per socket komunikim ne mes te klientit dhe serverit import sys #Importojme librarine sys import time #Importojme librarine time serverName = '127.0.0.1' #IP serverPort = ...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2017 Lenovo # # 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 ...
import requests,base64 def request_download_file_by_url(download_url, file_name): r = requests.get(download_url) with open(file_name, 'wb') as f: f.write(r.content) def request_get_rss_news(rss_url): try: r = requests.get(rss_url) # print(r.encoding) print(r.text) ...
import torch, torchvision import torch.nn as nn import torch.nn.functional as F from torchvision.models.resnet import Bottleneck, conv1x1, conv3x3 import numpy as np from functools import partial from itertools import product, chain from math import sqrt from typing import List, Tuple use_torch2trt = False use_jit = ...
from marshmallow_dumped_order.dumped_order import dumped_order
# Copyright 2020-present, Apstra, Inc. All rights reserved. # # This source code is licensed under End User License Agreement found in the # LICENSE file at http://www.apstra.com/eula import logging logger = logging.getLogger(__name__) def redacted(d): if d is None or d == '': return d h = d.copy() ...
# PyAlgoSamples # Examples using the PyAlgoTrade Library # # Copyright 2015-2017 Isaac de la Pena # # 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-...
import asyncio import tempfile import os import contextlib import pytest from postfix_mta_sts_resolver import netstring from postfix_mta_sts_resolver.responder import STSSocketmapResponder import postfix_mta_sts_resolver.utils as utils import postfix_mta_sts_resolver.base_cache as base_cache @contextlib.contextmanag...
""" Utility types and functions. """ from __future__ import annotations #: Represents a coordinate (x and y positions) in a plane. Coord2D = tuple[float, float] #: Represents a coordinate (x, y and z positions) in a 3D space. Coord3D = tuple[float, float, float] #: Represents a color (RGBA). Color = tuple[float, f...
import boto3, pickle, redis, json, logging, json_logging, sys from botocore.exceptions import ClientError from session import assume_role, s3_session from crypt import encrypt, decrypt # log is initialized without a web framework name json_logging.ENABLE_JSON_LOGGING = True json_logging.init_non_web() log = logging....
from featuretools.primitives import AggregationPrimitive from featuretools.variable_types import Numeric from tsfresh.feature_extraction.feature_calculators import \ percentage_of_reoccurring_datapoints_to_all_datapoints class PercentageOfReoccurringDatapointsToAllDatapoints(AggregationPrimitive): """Returns ...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from ... import _utilities, _tables from...
# Copyright (C) 2020 University of Oxford # # 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 t...
from crits.core.crits_mongoengine import CritsDocument, CritsSchemaDocument from mongoengine import DynamicDocument, ListField, ObjectIdField, StringField, DictField, IntField, BooleanField class SavedSearch(CritsDocument, CritsSchemaDocument, DynamicDocument): """ savedSearch class """ meta = { ...
# -*- coding: utf-8 -*- import datetime from email.utils import parseaddr from django.conf import settings from django.contrib.auth.views import INTERNAL_RESET_URL_TOKEN from django.contrib.contenttypes.models import ContentType from django.http import HttpResponse from django.test import TestCase, override_settings f...
'''OpenGL extension OES.primitive_bounding_box This module customises the behaviour of the OpenGL.raw.GLES2.OES.primitive_bounding_box to provide a more Python-friendly API Overview (from the spec) On tile-based architectures, transformed primitives are generally written out to memory before rasterization, and ...
import os, json, shutil, pickle from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score, mean_squared_log_error import pandas as pd print('installing library') os.system('pip3 install mlbox==0.8.4') from mlbox.preprocessing import * from mlbox.optimisation import * from mlbox.p...
import os import sys import time import importlib from pkg_resources import iter_entry_points from qtpy.QtCore import Qt from qtpy.QtWidgets import QApplication import qtpyvcp from qtpyvcp import hal from qtpyvcp.utilities.logger import getLogger from qtpyvcp.plugins import registerPluginFromClass, postGuiInitialiseP...
from datastructures.stack import Stack def test_isEmpty_empty_stack(): myStack = Stack() assert myStack.isEmpty() def test_isEmpty_non_empty_stack(): myStack = Stack() myStack.push(1) assert not myStack.isEmpty() def test_pop(): myStack = Stack() myStack.push(2) assert myStack.pop(...
from functools import lru_cache import numpy as np def interpolate_coordinates(old_coord, new_coord, brush_size): """Interpolates coordinates depending on brush size. Useful for ensuring painting is continuous in labels layer. Parameters ---------- old_coord : np.ndarray, 1x2 Last posit...
from .models import Profile, Group from django.contrib import admin admin.site.register(Profile) admin.site.register(Group)
#!/usr/bin/env vpython3 # Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Integration test for milestones.py""" import json import os import subprocess import tempfile import textwrap import unittest INF...
# -*- coding: utf-8 -*- """ eve-swagger ~~~~~~~~~~~ swagger.io extension for Eve-powered REST APIs. :copyright: (c) 2015 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ from .swagger import get_swagger_blueprint, add_documentation # noqa from .definitions import INFO, HOST # n...
from celery.task import task from django.core.mail import EmailMultiAlternatives @task(serializer='json') def send_email_asynchronously(subject, message_txt, message, from_email, to): """Sends an email as a asynchronous task.""" email = EmailMultiAlternatives( subject=subject, body=message_txt...
"""myproject URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-bas...