text stringlengths 1 927k |
|---|
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
# 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/LICEN... |
from django.db import models
class Appliance(models.Model):
name = models.CharField(max_length=100, null=False)
oid = models.UUIDField(unique=True)
pid = models.CharField(max_length=50)
appliance_type = models.CharField(max_length=30)
def __str__(self):
return self.name
class Sensor(mod... |
# add path to the main package and test battery.py
if __name__ == '__main__':
from __access import ADD_PATH
ADD_PATH()
import unittest
import psutil
from battery import Battery
class TestBattery(unittest.TestCase):
""" Test battry module """
def test_Battery_constructor(self):
if not (has_b... |
from adafruit_bus_device.i2c_device import I2CDevice
from adafruit_apds9960.apds9960 import APDS9960
try:
# Only used for typing
from typing import Dict
except ImportError:
pass
class ConfigRegsAPDS:
def __init__(self, *, apds: APDS9960=None, i2c_bus=None):
if not apds:
if not i2c... |
# Flappy Bird made by Thuongton999
# Ez-ist mode
from settings import *
from objects import *
def birdCollision(bird, column):
return (
bird.positionX < column.positionX + column.WIDTH and
bird.positionX + bird.WIDTH > column.positionX and
bird.positionY < column.positionY + column.HEIGHT... |
import numpy as np
from .PCASmallestEig import pca_smallest_eig, pca_smallest_eig_powermethod
from .Withness import withness
from .CalculateAngle import get_angle
#RP1D clustering from
#Han, Sangchun, and Mireille Boutin. "The hidden structure of image datasets." 2015 IEEE International Conference on Image Processing ... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2021 The NiPreps Developers <nipreps@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... |
#-----------------------------------------------------------------------
#
# Copyright (C) 2000, 2001 by Autonomous Zone Industries
# Copyright (C) 2002 Gregory P. Smith
#
# License: This is free software. You may use this software for any
# purpose including modification/redistribution, so long as
... |
from ...shared.utils.restApi import RestResource
from ...shared.utils.api_utils import build_req_parser
from ..utils.charts_utils import (requests_summary, requests_hits, avg_responses, summary_table, get_issues,
get_data_from_influx)
class ReportChartsAPI(RestResource):
get_rule... |
from maintain_frontend import main
from flask_testing import TestCase
from unit_tests.utilities import Utilities
from maintain_frontend.dependencies.session_api.session import Session
from maintain_frontend.models import LocalLandChargeItem
from maintain_frontend.constants.permissions import Permissions
from flask impo... |
import base64
import pickle
import itertools
from scipy import linalg
from sklearn.decomposition import PCA
import numpy as np
from sklearn import cluster
from sklearn import mixture
from scipy.spatial import distance
from sklearn.preprocessing import StandardScaler
import requests
from config import mapzen_api_key... |
import os
import sys
import math
from contextlib import contextmanager
from math import isclose
import numpy as np
import pytest
import ceed
from .examples.stages import create_test_stages, make_stage, StageWrapper, \
stage_classes, assert_stages_same
from typing import Type, List, Union
from ceed.tests.ceed_app i... |
# Copyright (c) 2020 PaddlePaddle 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 appli... |
napis = str(input("Podaj napis:"))
print(napis.count('a')) |
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
import logging
import json
with open('config.json', 'r') as config:
params = json.load(config)["params"]
# par... |
# coding: utf-8
import sublime
st_version = int(sublime.version())
if st_version > 3000:
from JoomlaPack.lib.extensions.component import Component
from JoomlaPack.lib.extensions.package import Package
from JoomlaPack.lib.extensions.plugin import Plugin
else:
from lib.extensions.component import Compone... |
from .core import Kiri
from .search import ElasticDocStore, Document, ChunkedDocument, ElasticDocument, ElasticChunkedDocument, InMemoryDocStore |
# 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 marionette.by import By
from gaiatest.apps.base import Base
class NewEmail(Base):
# Write new email
_vie... |
import sys
from django.conf import settings
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
# Warm-up wsgi app on import
warmup = application(
{
"REQUEST_METHOD": "GET",
"SERVER_NAME": "127.0.0.1",
"SERVER_PORT": 80,
"PATH_INFO": "/-/alive/",... |
import tempfile
import time
from contextlib import contextmanager
from os import path
from shutil import rmtree
import pytest
from galaxy.tool_util.toolbox import watcher
from galaxy.util import bunch
@pytest.mark.skipif(not watcher.can_watch, reason="watchdog not available")
def test_watcher():
with __test_dir... |
# Licensed with the 3-clause BSD license. See LICENSE for details.
try:
from .version import version as __version__
except ImportError:
__version__ = ""
from .sbsearch import * # noqa |
project = "mklists"
copyright = "2020, Tom Baker"
author = "Tom Baker"
release = "0.2"
extensions = []
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
html_theme = "default"
github_project_url = "https://github.com/tombaker/mklists"
html_static_path = ["_static"] |
#
# Copyright (C) 2019 Databricks, 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 i... |
# import the necessary packages
from tensorflow.keras.preprocessing.image import img_to_array
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
from tensorflow.keras.models import load_model
from imutils.video import VideoStream,FileVideoStream
import imutils
import numpy as np
import time
import ... |
from dataclasses import dataclass
from enum import Enum
from typing import List, Tuple, Union, Any
VERSIONS_SUM = 0
class TypeID(Enum):
LITERAL_VALUE = 4
@dataclass
class LiteralValue:
packet_version: int
packet_type_id: int
parts: List[str]
decimal: int
@dataclass
class OperatorPacket:
... |
#!/bin/python3
import sys, string
from random import *
from timeit import default_timer as timer
def randstr(N,alphabet=string.ascii_lowercase):
l=len(alphabet)
return "".join( alphabet[randint(0,l-1)] for _ in range(N))
def timefunc(func, *args, **kwargs):
"""Time a function.
args:
iterati... |
"""
defines readers for BDF objects in the OP2 EPT/EPTS table
"""
#pylint: disable=C0103,R0914
from __future__ import annotations
from struct import unpack, Struct
from functools import partial
from typing import Tuple, List, TYPE_CHECKING
import numpy as np
#from pyNastran import is_release
from pyNastran.bdf.cards.... |
#!/usr/bin/python3
import subprocess;
import datetime;
import time;
import threading;
import argparse;
parser = argparse.ArgumentParser(description="sleep 3600 pour remise");
parser.add_argument("--destination", help='base dir destination');
parser.add_argument("--branch", help="branch to be checked out");
args = pa... |
import inspect
from pathlib import Path
from typing import Optional, Tuple, Union
from discord import Embed
from discord.ext import commands
from bot.bot import Bot
from bot.constants import URLs
from bot.converters import SourceConverter
from bot.exts.info.tags import TagIdentifier
SourceType = Union[commands.HelpC... |
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager
from approval_system import create_app
from approval_system.extensions import db
app = create_app()
manager = Manager(app)
migrate = Migrate(app, db)
manager.add_command('db', MigrateCommand)
if __name__ == '__main__':
manager.... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
## @package UR5
# Documentação para o pacote de classes UR5.
#
# Documentação do código produzido para controle do manipulador UR5 e geração e controle de suas posições.
# Cada código aqui documentado possui uma breve descrição de sua função, suas entradas e saídas.
import n... |
#!/usr/bin/env python
import gtk
import Editor
def main(filenames=[]):
"""
start the editor, with a new empty document
or load all *filenames* as tabs
returns the tab object
"""
Editor.register_stock_icons()
editor = Editor.EditorWindow()
tabs = map(editor.load_document, filenames)
... |
import sys
from typing import List
import pytest
from region_profiler import RegionProfiler
from region_profiler import reporter_columns as cols
from region_profiler.reporters import (
ConsoleReporter,
CsvReporter,
SilentReporter,
Slice,
get_profiler_slice,
)
from region_profiler.utils import SeqSt... |
import sys
from unittest import mock
flash = bytearray(8 * 1024 * 1024)
def read_data(addr, amount):
return flash[addr : addr + amount]
def write_data(addr, data):
flash[addr : addr + len(data)] = data
if "flash" not in sys.modules:
sys.modules["flash"] = mock.MagicMock(read=read_data, write=write_da... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mainwindow.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MtgBrowse(object):
def setupUi(self, MtgBrowse):
MtgBrow... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
ref: https://docs.mongodb.com/manual/reference/operator/update/
""" |
import re
from googlecloudsdk.api_lib.util import apis as core_apis
from googlecloudsdk.calliope import exceptions
import yaml
import json
class LibraryListJobs(object):
def __init__(self, dataset=None,state_filter=None):
from google.cloud import bigquery
#client = bigquery.Client(project='your_project)
... |
#!/usr/bin/python
################################################################################
# 23ae8758-5cc5-11e4-af55-00155d01fe08
#
# Justin Dierking
# justindierking@hardbitsolutions.com
# phnomcobra@gmail.com
#
# 10/24/2014 Original Construction
################################################################... |
import datetime
import json
from flask import url_for
from flask import redirect
from flask import render_template
from flask_login import login_user
from flask_login import logout_user
from . import blueprint_auth
from .forms import RegisterForm
from .forms import LoginForm
from .utils_cms import generate_code
from .... |
## @file
# process FD generation
#
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be ... |
# 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 selenium import webdriver
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.common.... |
import argparse
import io
import os.path
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from tqdm import tqdm
from tf_utils import AttrDict, attrdict_from_yaml, lazy_property_with_scope, share_variables
tfd = tfp.distributions
tfl = tf.layers
class M... |
#!/usr/bin/env python3
from .general_common import States
from Control.control_common import ButtonIndex
def getState(state, my_joystick):
# ==============================================================
if state == States.IDLE:
if my_joystick.get_button_val(ButtonIndex.SIDE_BUTTON) == 1:
r... |
import torch
import math
from torch import nn
from ..utils.utils import point_interpolate
class ROIAlign(nn.Module):
def __init__(self, output_size, spatial_scale, sampling_ratio):
"""
Args:
output_size (tuple): h, w
spatial_scale (float): scale the input boxes by this num... |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Basic string exercises
# Fill in the code for the functions below. main() is already se... |
import pytest
from aiohttp import web
def test_entry_func_empty(mocker) -> None:
error = mocker.patch("aiohttp.web.ArgumentParser.error", side_effect=SystemExit)
argv = [""]
with pytest.raises(SystemExit):
web.main(argv)
error.assert_called_with("'entry-func' not in 'module:function' syntax... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, erpnext
from erpnext import get_company_currency, get_default_company
from erpnext.accounts.report.utils import get_currency, convert_to_... |
# Copyright (c) 2019-2021, NVIDIA CORPORATION.
import os
import re
import shutil
from setuptools import find_packages, setup
import versioneer
install_requires = [
"cudf",
"dask==2021.4.0",
"distributed>=2.22.0,<=2021.4.0",
"fsspec>=0.6.0",
"numpy",
"pandas>=1.0,<1.3.0dev0",
]
extras_requir... |
# -*- coding: utf-8 -*-
import os
import io
import copy
from unittest import mock
from nbformat import validate
from .. import convert
from ..nbjson import reads
from . import nbexamples
from nbformat.v3.tests import nbexamples as v3examples
from nbformat import v3, v4
def test_upgrade_notebook():
nb03 = copy.de... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 24 11:28:50 2017
@author: dhingratul
"""
from __future__ import print_function, division
import numpy as np
import tensorflow as tf
import helpers
# hyperparams
num_epochs = 10000
total_series_length = 100
truncated_backprop_length = 5
state_size = ... |
# Copyright (c) 2018 Mengye Ren, Eleni Triantafillou, Sachin Ravi, Jake Snell,
# Kevin Swersky, Joshua B. Tenenbaum, Hugo Larochelle, Richars S. Zemel.
#
# 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 th... |
def test_instance_unit_norm_scaler():
import numpy as np
from pysad.transform.preprocessing import InstanceUnitNormScaler
X = np.random.rand(100, 25)
scaler = InstanceUnitNormScaler()
scaled_X = scaler.fit_transform(X)
assert np.all(np.isclose(np.linalg.norm(scaled_X, axis=1), 1.0))
scale... |
"""irfca_blog URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.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... |
# Copyright 2019, OpenTelemetry 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 i... |
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework import viewsets, mixins, status
from rest_framework.authentication import TokenAuthentication
from rest_framework.permissions import IsAuthenticated
from core.models import Tag, Ingredient, Recipe
from recipe... |
# -*- coding: utf-8 -*-
import os
import cv2
from scipy import misc
from PIL import Image
sample_path = 'datasets/celeb_train/lfw_trans'
dest_path = sample_path + "/../dest"
middleSize = 64
imgSize = 256
kernel_size = (5, 5)
sigma = 5
if not os.path.exists(dest_path):
os.mkdir(dest_path)
fileList = os.listdir(s... |
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2019 DataONE
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you ma... |
import sys
import click
import yaml
from freezeyt.freezer import freeze
from freezeyt.util import import_variable_from_module
@click.command()
@click.argument('module_name')
@click.argument('dest_path', required=False)
@click.option('--prefix',
help='URL where we want to deploy our static site '
... |
pokemon = {
"Fire": ["Charmander", "Charmeleon", "Charizard"],
"Water": ["Squirtle", "Warturtle", "Blastiose"],
"Grass": ["Bulbasaur", "Venusaur", "Ivysaur"]
}
print("Fire" in pokemon)
print("Electric" in pokemon) |
import httpx
from anilist.types import Anime
from pyrogram import filters
from pyrogram.types import CallbackQuery
from pyromod.helpers import ikb
from pyromod.nav import Pagination
from amime.amime import Amime
@Amime.on_callback_query(filters.regex(r"^tv_mahousj3 anime (?P<page>\d+)"))
async def anime_suggestions(... |
# coding: utf-8
from network.trainer import *
video_train_list = '/media/tuananhn/903a7d3c-0ce5-444b-ad39-384fcda231ed/UCF101/video-caffe/examples/c3d_ucf101/c3d_ucf101_train_split1.txt'
video_test_list = '/media/tuananhn/903a7d3c-0ce5-444b-ad39-384fcda231ed/UCF101/video-caffe/examples/c3d_ucf101/c3d_ucf101_test_split1... |
# encoding=utf8
import logging
import numpy as np
from niapy.algorithms.algorithm import Algorithm
logging.basicConfig()
logger = logging.getLogger('niapy.algorithms.modified')
logger.setLevel('INFO')
__all__ = ['AdaptiveBatAlgorithm', 'SelfAdaptiveBatAlgorithm']
class AdaptiveBatAlgorithm(Algorithm):
r"""Imp... |
import sys
import os
import traceback
from PIL import Image
from facenet_pytorch import MTCNN
import matplotlib.image as mpimg
import numpy as np
def detect_faces(image_path):
mtcnn = MTCNN(margin=20, keep_all=True,
post_process=False, device='cuda:0')
image = image_path
image = mpimg.im... |
# Copyright (c) 2014-present, Facebook, Inc.
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_hosts_file(host):
f = host.file('/etc/hosts')
assert f.exists
assert f.user =... |
"""Support for ASUSWRT devices."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EVENT_HOMEASSISTANT_STOP, Platform
from homeassistant.core import HomeAssistant
from .const import DATA_ASUSWRT, DOMAIN
from .router import AsusWrtRouter
PLATFORMS = [Platform.DEVICE_TRACKER, Platf... |
import os
import shutil
from pathlib import Path
import pytest
from dotenv import load_dotenv
from isimip_publisher.utils.database import (Dataset, Resource,
init_database_session)
@pytest.fixture(scope='session')
def setup():
load_dotenv(Path().cwd() / '.env')
... |
# -*- coding: utf-8 -*-
"""Console script for pyweb."""
import os
import sys
import platform
import click
from . import __version__
from .server import HTTPDaemon
from .utils import logger
@click.command()
@click.option('-b', '--bind', default=':4000', help='the address to bind, default as `:4000`')
@click.option('-r... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018 Leland Stanford Junior University
# Copyright (c) 2018 The Regents of the University of California
#
# This file is part of pelicun.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions ... |
from .. import invocations
# Enumerate some constants for the six spell colors.
SOLAR, EARTH, WATER, FIRE, AIR, LUNAR = list(range( 6))
class Spell( invocations.Invocation ):
def __init__( self, name, desc, fx, rank=1, gems=dict(), mpfudge=0, com_tar=None, exp_tar=None, ai_tar=None, shot_anim=None ):
self... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
#
# Copyright (C) 2020 Enrico Meloni, Luca Pasqualini, Matteo Tiezzi
# University of Siena - Artificial Intelligence Laboratory - SAILab
#
#
# SAILenv is licensed under a MIT license.
#
# You should have received a copy of the license along with this
# work. If not, see <https://en.wikipedia.org/wiki/MIT_License>.
# ... |
import numpy as np
import segyio
import subprocess
import os, h5py
from scipy import interpolate
from devito import Eq, Operator
from azure.storage.blob import BlockBlobService, PublicAccess
blob_service = BlockBlobService(account_name='', account_key='')
##############################################################... |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: tasking_dsz.py
import mcl.framework
import mcl.tasking
class dsz:
INTERFACE = 16842801
PFAM = 4159
PROVIDER_ANY = 4159
PROVIDER = 16... |
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/test/testcases/testIstepInvalid.py $
#
# OpenPOWER sbe Project
#
# Contributors Listed Below - COPYRIGHT 2015,2016
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you ... |
from django.test import TestCase
from django.contrib.auth.models import User
from users.forms import UserRegisterForm, UserUpdateForm, ProfileUpdateForm
class TestForms(TestCase):
def test_user_register_form_valid(self):
form = UserRegisterForm(
data = {
'username' :"user2",
'email' : "user2@email.com",
... |
from django.utils.translation import ugettext as _
from rest_framework.generics import GenericAPIView
from rest_framework.response import Response
from .serializers import PaymentInputSerializer, PaymentPatchSerializer, PaymentResponseSerializer
from .services import PaymentService
class PaymentView(GenericAPIView):... |
"""
OpenMPI support wrapper
"""
import threading
import queue
import logging
import time
import resource
logger = logging.getLogger()
try:
from mpi4py import MPI
except ImportError:
logger.warning("MPI support unavailable")
def is_parent():
return MPI.COMM_WORLD.Get_rank() == 0
CHILD_RETRY_HELLO = 6... |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# fmt: off
#
# Kats documentation build configuration file.
#
# 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
# auto... |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
import pygame, os, re, pygame.freetype
from pygame.locals import *
pygame.init()
class resource_handler(object):
def get_data_from_folder(self, data_dir, extension, iterfunc):
data = []
for file in os.listdir(data_dir):
if extension in file:
data.append({ 'name': file,... |
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = """
module: memsource_project
short_description: Manage a Memsource project
version_added: 0.0.1
description:
- Manage a Memsource project
author: 'Yanis Guenane (@Spredzy)'
options:
ui... |
"""
WSGI config for bardo2 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/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTIN... |
from matplotlib import pyplot as plt
import numpy as np
import cv2
from scipy import stats
import translate
from skimage import transform
#####################################
imgData = cv2.imread('van.jpg',0)
compressRate = 0.4
#####################################
imgData = np.array(imgData)
shape = imgData.shape
p... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `locate_trace` module."""
import unittest
import numpy as np
from hotsoss import locate_trace as lt
def test_simulate_frame():
"""Test the simulate_frame function"""
# CLEAR and plot test
assert lt.simulate_frame(plot=True).shape == (256, 2048... |
"""Emoji
Available Commands:
.adi"""
import asyncio
from telethon import events
@borg.on(events.NewMessage(pattern=r"\.(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
return
animation_interval = 0.3
animation_ttl = range(0, 15)
input_str = event.pattern_match.group(1)
... |
import os
import unittest
from checkov.cloudformation.checks.resource.aws.RDSMultiAZEnabled import check
from checkov.cloudformation.runner import Runner
from checkov.runner_filter import RunnerFilter
class TestRDSMultiAZEnabled(unittest.TestCase):
def test_summary(self):
runner = Runner()
curre... |
from tester import assertRaises
# issue 5
assert(isinstance(__debug__, bool))
# issue #6 : unknown encoding: windows-1250
s = "Dziś jeść ryby"
b = s.encode('windows-1250')
assert b == b'Dzi\x9c je\x9c\xe6 ryby'
assert b.decode('windows-1250') == "Dziś jeść ryby"
# issue #7 : attribute set on module is not available ... |
from . import layers
from . import models
from . import keras |
from pathlib import Path
import os
import numpy as np
import netCDF4
import matplotlib.pyplot as plt
from aps.util.nc_index_by_coordinate import tunnel_fast
# Creates the mask over the small regions of 20x20 km size
def create_small_regions_mask():
p = Path(os.path.dirname(os.path.abspath(__file__))).parent
nc... |
"""
WSGI config for sqrtrading 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/1.10/howto/deployment/wsgi/
"""
import os
import sys
addPath = os.path.realpath(__file__).replace('sqrtrading/wsgi.py','')
s... |
import copy
#
# Prototype Class
#
class Cookie:
def __init__(self, name):
self.name = name
def clone(self):
return copy.deepcopy(self)
#
# Concrete Prototypes to clone
#
class CoconutCookie(Cookie):
def __init__(self):
Cookie.__init__(self, 'Coconut')
#
# Client Class
#
class... |
from __future__ import absolute_import
from __future__ import print_function
import atexit
import os
import shlex
import shutil
import subprocess
import sys
import tempfile
try:
import urlparse
except ImportError:
import urllib.parse as urlparse
os.chdir(
os.path.join(
os.path.dirname(__file__),
... |
from game_management.game import Game
from game_management.tools import Phase
from log_setup import logger
"""
This file is outdated and not used in the project. Due to circular import issues, this class is now declared
(and documented) in game.py
"""
class PhaseHandler:
def __init__(self, game: Game):
... |
from procedure.problem.base import nats as base
import numpy as np
class EfficiencyAccuracyNATS(base.NATS):
def __init__(self, efficiency, **kwargs):
super().__init__(n_obj=2, **kwargs)
self.msg += efficiency + '={:.3f}, ' + 'valid-error' + '={:.3f}'
self.efficiency = efficiency
def _... |
#
# SPDX-License-Identifier: MIT
#
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.runtime.decorator.package import OEHasPackage
class GstreamerCliTest(OERuntimeTestCase):
@OEHasPackage(['gstreamer1.0'])
def test_gst_inspect_can_list_all_plugins(self):
status, output = self.target.run('gst-... |
from django.contrib import admin
from core.models import Contact, Slider
@admin.register(Contact)
class ContactAdmin(admin.ModelAdmin):
list_display = ('name', 'email')
list_filter = ('name', 'email')
search_fields = ('name', 'email')
admin.site.register(Slider) |
import logging
import argh
import pygna.command as cmd
import pygna.painter as paint
import pygna.utils as utils
import pygna.block_model as bm
import pygna.degree_model as dm
"""
autodoc
"""
logging.basicConfig(level=logging.INFO)
def main():
argh.dispatch_commands([
# network summary and graph file
... |
# Run MIL classification use pretrained CNN models
# Reference: 1.Campanella, G. et al. Clinical-grade computational pathology using weakly supervised
# deep learning on whole slide images. Nat Med 25, 1301–1309 (2019).
# doi:10.1038/s41591-019-0508-1. Available from http://www.nature.com/articles... |
import os
from PIL import Image
import argparse
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('-f', '--folder_path', type=str, help='folder with images which need a thumbnail', required=True)
args = parser.parse_args()
folder_path = args.folder_path + "/"
print("Observed t... |
"""How the variable order in a BDD affects the number of nodes.
Reference
=========
Randal Bryant
"On the complexity of VLSI implementations and graph representations
of Boolean functions with application to integer multiplication"
TOC, 1991
https://doi.org/10.1109/12.73590
"""
from dd import aut... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.