text
stringlengths
1
927k
import importlib import random import sys sys.setrecursionlimit(10000) sys.path.append('.') sys.path.append('..') import torch.multiprocessing as mp from networks.managers.trainer import Trainer def main_worker(gpu, cfg, enable_amp=True): # Initiate a training manager trainer = Trainer(rank=gpu, cfg=cfg, e...
#!/usr/bin/env python # -*- coding: utf-8 -*- import simplejson as json from alipay.aop.api.response.AlipayResponse import AlipayResponse from alipay.aop.api.domain.InsPolicy import InsPolicy class AlipayInsUnderwriteUserPolicyQueryResponse(AlipayResponse): def __init__(self): super(AlipayInsUnderwriteU...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Six-panel xcorr *and* lag Created on Thu Feb 4 18:21:08 2021 @author: lizz """ div_colors = 'RdBu' # choose divergent colormap for xcorr # lag_colors = 'PiYG' # choose divergent colormap for lag corrnorm_min, corrnorm_max = -0.3, 0.3 # lagnorm_min, lagnorm_max = -36...
#!/usr/bin/env python """Tests for `mishchenko_brf` package.""" import numpy as np from mishchenko_brf.lib.refl import brf def test_brf(): """Sample pytest test function with the pytest fixture as an argument.""" # from bs4 import BeautifulSoup # assert 'GitHub' in BeautifulSoup(response.content).title...
# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com> # Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com> # # This file is part of paramiko. # # Paramiko is free software; you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Fr...
from math import ceil t = int(input()) for _ in range(t): row, col = map(int,input().split()) print(ceil((row * col) / 2))
"""Base class for sparse matrix formats using compressed storage.""" from __future__ import division, print_function, absolute_import __all__ = [] from warnings import warn import operator import numpy as np from scipy._lib._util import _prune_array from .base import spmatrix, isspmatrix, SparseEfficiencyWarning fr...
from ants.ants import demonstrate if __name__ == '__main__': demonstrate()
""" Assertion helpers for offsets tests """ def assert_offset_equal(offset, base, expected): actual = offset + base actual_swapped = base + offset actual_apply = offset.apply(base) try: assert actual == expected assert actual_swapped == expected assert actual_apply == expected ...
import pytest import os import neighborhoods_backend @pytest.fixture(scope='session') def django_db_setup(): neighborhoods_backend.settings.DATABASES['default'] = { 'ENGINE': 'django_db_geventpool.backends.postgresql_psycopg2', 'PASSWORD': os.environ.get('POSTGRES_PASSWORD'), 'NAME': os.en...
# -*- coding: utf-8 -*- import argparse import inspect import math import os from pprint import pprint import sys from lib.collection_utils import * from lib.io_utils import * from lib.math_utils import * # input parser = argparse.ArgumentParser() parser.add_argument('-in', dest="INPUT_FILE", default="tmp/samples.cs...
import torch from torch import cat from torch.nn import Conv2d from torch.nn import Linear from torch.nn import Module from torch.nn import ConvTranspose2d from torch.nn import LeakyReLU from torch.nn import Tanh from torch.nn import MaxPool2d from torch import zeros_like class ConvMPN(Module): def __init__(self)...
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else [] PROJECT_CATKIN_DEPENDS = "robot_localization;roscpp;tf;tf2;tf2_ros;message_filters;std_msgs;std_srvs;geometry_msgs;nav_msgs;sensor_msgs;robotnik_msgs;mavros_msgs".repla...
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...
class HScrollProperties(ScrollProperties): """ Provides basic properties for the System.Windows.Forms.HScrollBar HScrollProperties(container: ScrollableControl) """ @staticmethod def __new__(self,container): """ __new__(cls: type,container: ScrollableControl) """ pass ParentControl=property(lambda self: ...
from autokeras.bayesian import * from tests.common import get_add_skip_model, get_concat_skip_model, get_conv_dense_model def test_edit_distance(): descriptor1 = get_add_skip_model().extract_descriptor() descriptor2 = get_concat_skip_model().extract_descriptor() assert edit_distance(descriptor1, descripto...
# Copyright 2015-present MongoDB, 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 wri...
import logging import os from transformers import glue_compute_metrics from transformers import glue_convert_examples_to_features as convert_examples_to_features from transformers import glue_output_modes from transformers import glue_processors from transformers.data.processors.glue import MnliMismatchedProcessor fr...
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2015-2019 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Version information for Invenio-Logging. This file is imported by ``invenio_loggi...
from flask import (render_template, url_for, flash, redirect, request, abort, Blueprint) from flask_login import current_user, login_required from flaskblog import db from flaskblog.models import Post from flaskblog.posts.forms import PostForm posts = Blueprint('posts', __name__) @posts.route("/po...
"""empty message Revision ID: ae566f24d973 Revises: 838f47fa598e Create Date: 2020-02-18 17:02:08.574872 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'ae566f24d973' down_revision = '838f47fa598e' branch_labels = None depends_on = None def upgrade(): # ...
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2017-01-24 13:39 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('dynadb', '0074_auto_20170123_1212'), ] operations = [...
import os from genomepy.plugins import Plugin from genomepy.utils import cmd_ok, mkdir_p, rm_rf, run_index_cmd class Minimap2Plugin(Plugin): def after_genome_download(self, genome, threads=1, force=False): if not cmd_ok("minimap2"): return # Create index dir index_dir = genom...
# # Copyright 2016 The BigDL 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 in ...
from flexflow.core import * import numpy as np from flexflow.keras.datasets import mnist from flexflow.onnx.model import ONNXModel from accuracy import ModelAccuracy def top_level_task(): ffconfig = FFConfig() ffconfig.parse_args() print("Python API batchSize(%d) workersPerNodes(%d) numNodes(%d)" %(ffconfig.get...
import math import unittest def get_line(arr, x, y, ln, dx, dy): ret = [] for i in range(ln): ret.append(arr[x][y]) x = x + dx y = y + dy return ret def get_square(arr, x, y, ln): if ln == 0: return [] if ln == 1: return [arr[x][y]] ret = [] ret....
# -*- coding: utf-8 -*- import netifaces from i3pystatus import IntervalModule from i3pystatus.core.color import ColorRangeModule from i3pystatus.core.util import make_graph, round_dict, make_bar def count_bits(integer): bits = 0 while (integer): integer &= integer - 1 bits += 1 return bit...
""" __new__()方法, 对象创建的过程, 1- new方法返回一个对象 2- init利用new返回的对象进行属性的添加 """ class Person(object): # 监听创建一个实例对象的过程,需要返回一个对象赋值给xiaoming # new中不return的话,那么久不会执行init方法 def __new__(cls, *args, **kwargs): print("new") print((object.__new__(cls))) return object.__new__(cls) # 构造方法...
#!/usr/bin/env python3 # Copyright (c) 2016-2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test Wallet encryption""" import time from test_framework.test_framework import BitcoinTestFramework ...
# # 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...
#!/usr/bin/env python # encoding: utf-8 """ Script for installing the components of the ArPI home security system to a running Raspberry PI Zero Wifi host. It uses the configuration file install.yaml! --- @author: Gábor Kovács @copyright: 2017 arpi-security.info. All rights reserved. @contact: gkovacs81@gm...
import os import random import numpy as np import scipy.misc as misc import imageio from tqdm import tqdm import cv2 from PIL import Image import torch import torch.nn.functional as F IMG_EXTENSIONS = ['.jpg', '.JPG', '.jpeg', '.JPEG', '.png', '.PNG', '.ppm', '.PPM', '.bmp', '.BMP'] BINARY_EXTENSIONS = ['.npy'] BENCH...
from django.test import TestCase from django.contrib.auth import get_user_model class ModelTests(TestCase): def test_create_user_with_email_successful(self): """ Test creating a new user with an email is successful""" email = 'test@example.com' password = 'testpass123' user = get_...
from django.shortcuts import render,redirect from django.http import HttpResponse,Http404 from .models import Pics,categories # Create your views here. def welcome(request): return render(request, 'welcome.html') def pictogram(request): images = Pics.objects.all() return render(request, 'pictogram.html', ...
from . import model from . import fast_nn import tensorflow as tf import numpy as np import os import unittest class FastPixelCNNPPEndToEndTest(tf.test.TestCase): def test_end_to_end(self): with self.test_session() as sess: print('Creating model') image_size = (10, 32, 32, 4) ...
""" Module containing the main model class for the dowhy package. """ import logging from sympy import init_printing import dowhy.causal_estimators as causal_estimators import dowhy.causal_refuters as causal_refuters import dowhy.utils.cli_helpers as cli from dowhy.causal_estimator import CausalEstimate from dowhy....
#!/usr/bin/env python """Tests for grr.lib.flows.cron.compactors.""" # pylint: disable=unused-import, g-bad-import-order from grr.lib import server_plugins # pylint: enable=unused-import, g-bad-import-order from grr.lib import aff4 from grr.lib import flags from grr.lib import flow from grr.lib import rdfvalue from...
""" This file contains all the methods responsible for saving the generated data in the correct output format. """ import cv2 import numpy as np import os import logging from utils import degrees_to_radians import json def save_groundplanes(planes_fname, player_measurements, lidar_height): from math import cos, ...
__all__ = ["facesync"]
import logging logger = logging.getLogger(__name__) logger.setLevel(logging.ERROR) file_log_handler = logging.FileHandler('combinator-cli.log') logger.addHandler(file_log_handler) stderr_log_handler = logging.StreamHandler() logger.addHandler(stderr_log_handler) format_string = '%(asctime)s - %(name)s - %(levelname...
""" Copyright (C) 2018-2021 Intel Corporation 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 logging import os import re import sys from scanapi.errors import BadConfigurationError, InvalidPythonCodeError from scanapi.evaluators.code_evaluator import CodeEvaluator logger = logging.getLogger(__name__) variable_pattern = re.compile( r"(?P<something_before>\w*)(?P<start>\${)(?P<variable>\w*)(?P<end>}...
# Generated by Django 3.2.5 on 2021-08-01 06:53 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('church', '0016_masstime'), ] operations = [ migrations.CreateModel( name='LinkedChurch', fields=[ ('...
# -*- coding: utf-8 -*- from app.graph.Graph import * from app.data.Client import Driver from app.config.env import MONIKER_SEPARATOR from app.entity.Transport import Transport from app.samples.graph_sample import SimpleEntity class SimpleSimulator: def __init__(self, graph): """ Constructor ...
import torch import torchvision from torchvision import models from collections import namedtuple class Vgg16(torch.nn.Module): def __init__(self, requires_grad=False): super(Vgg16, self).__init__() vgg_pretrained_features = models.vgg16(pretrained=True).features # 获取预训练vgg网络层 self.slice1 ...
# qubit number=5 # total number=43 import pyquil from pyquil.api import local_forest_runtime, QVMConnection from pyquil import Program, get_qc from pyquil.gates import * import numpy as np conn = QVMConnection() def make_circuit()-> Program: prog = Program() # circuit begin prog += H(0) # number=3 pr...
# coding=utf-8 # *** WARNING: this file was generated by the Kulado Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import json import warnings import kulado import kulado.runtime from .. import utilities, tables class ExpressRouteCircuitPeering(kula...
# -*- coding: utf-8 -*- import logging import psycopg2 from odoo import api, models logger = logging.getLogger(__name__) LARGE_OBJECT_LOCATION = "postgresql:lobject" class IrAttachment(models.Model): """Provide storage as PostgreSQL large objects of attachements with filestore location ``postgresql:lobject``....
# dircolors.pyls package """ pyls - a simple implementation of `ls` used to test python-dircolors """
#!/usr/bin/python3 -u # SPDX-License-Identifier: BSD-2 import unittest from tpm2_pytss import * from .TSS2_BaseTest import TSS2_EsapiTest class TestTCTI(TSS2_EsapiTest): def test_init(self): self.assertEqual(self.tcti.version, 2) self.assertGreater(self.tcti.magic, 0) v1ctx = ffi.cast("...
from allauth.account import app_settings as allauth_settings from allauth.account.models import EmailAddress from allauth.account.utils import complete_signup from allauth.account.views import ConfirmEmailView from django.contrib.auth import get_user_model from django.utils.decorators import method_decorator from djang...
# Copyright (c) OpenMMLab. All rights reserved. import pytest from mmdet.datasets import DATASETS def test_xml_dataset(): dataconfig = { 'ann_file': 'data/VOCdevkit/VOC2007/ImageSets/Main/test.txt', 'img_prefix': 'data/VOCdevkit/VOC2007/', 'pipeline': [{ 'type': 'LoadImageFrom...
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import itertools import os from abc import ABC, ABCMeta, abstractmethod from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, Ma...
##################################################### # Copyright (c) Xuanyi Dong [GitHub D-X-Y], 2021.04 # ##################################################### import copy from .math_dynamic_funcs import DynamicQuadraticFunc from .math_adv_funcs import ConstantFunc, ComposedSinFunc from .synthetic_env import Synthet...
import GPUtil from threading import Thread import time class GPUMonitor(Thread): def __init__(self, delay): super().__init__() self.stopped = False self.delay = delay self.data = { g.id: dict( load=[], memory=[], temperatu...
import matplotlib.pyplot as plt import numpy as np from matplotlib.widgets import Slider, Button, RadioButtons fig = plt.figure() ax = fig.add_subplot(111) fig.subplots_adjust(left=0.25, bottom=0.25) min0 = 0 max0 = 25000 im = max0 * np.random.random((10,10)) im1 = ax.imshow(im) fig.colorbar(im1) axcolor = 'lightgol...
import cv2 as cv def scale(img, scale): """scale preserving aspect ratio""" return resize(img, x_scale=scale, y_scale=scale) def resize(img, x_scale, y_scale, optimize=True): """resize image by scaling using provided factors""" interpolation = cv.INTER_LINEAR # pick an optimized scaler if asked...
from keras.preprocessing.image import ImageDataGenerator data_gen_args = dict(rescale=1./255, rotation_range=0.2, shear_range=0.2, zoom_range=0.2, width_shift_range=0.1, height_shift_range=0.1, ...
from sql.Instrucciones.TablaSimbolos.Instruccion import Instruccion from sql.Instrucciones.Sql_create.Tipo_Constraint import Tipo_Constraint, Tipo_Dato_Constraint from sql.Instrucciones.Excepcion import Excepcion class AlterTableAlterColumn(Instruccion): def __init__(self, tabla, col, strGram, linea, columna): ...
Kaboom_0=[ 0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0, 0,0,0,2,2,2,2,2,2,0,0,0,0,0,0,0, 0,0,2,2,2,2,2,2,2,2,0,0,0,0,0,0, 0,0,2,2,2,2,2,2,2,2,0,0,0,0,0,0, 0,0,2,2,2,2,2,2,2,2,0,0,0,0,0,0, 0,0,2,1,1,1,1,1,1,2,0,0,0,0,2,2, 0,0,2,1,1,1,1,1,1,2,0,0,0,0,2,2, 0,0,2,1,2,1,1,2,1,2,0,0,0,0,0,0, 0,0,2,1,1,1,1,1,1,2,0,0,0,0,0,3, 0,0,0,2,2,1,...
from flask import render_template, request, flash, redirect, url_for, session from . import app @app.route('', methods=['GET']) def create(): return render_template("worldclock/create.html")
class Users(object): def __init__(self, client): self.client = client #UNTESTED def search(self, **kwargs): """ Returns the Enrollment User's details matching the search parameters /api/system/users/search?{params} PARAMS: username={username} ...
from veroviz._common import * from veroviz._validation import * from veroviz._buildFlightProfile import buildNoLoiteringFlight from veroviz._buildFlightProfile import getTimeDistFromFlight from veroviz._utilities import privConvertDistance from veroviz._utilities import privConvertTime def getTimeDist3D(nodes=None, ...
from __future__ import unicode_literals from .common import InfoExtractor from .youtube import YoutubeIE class UnityIE(InfoExtractor): _VALID_URL = ( r"https?://(?:www\.)?unity3d\.com/learn/tutorials/(?:[^/]+/)*(?P<id>[^/?#&]+)" ) _TESTS = [ { "url": "https://unity3d.com/learn...
# These import commands make importing core classes easier, e.g. you can just import # Cathode using: # # from pybat import Cathode # # Instead of: # # from pybat.core import Cathode # from pybat.core import Cathode, LiRichCathode, Dimer, DimerNEBAnalysis
from .runner import AppError, checkInsideVenv, insideVenv, wrapMain checkInsideVenv() from .configParam import getConfigPath from .Dataset import Dataset from .export import getExportedData from .jsonTypeCheck import configStr, getDictValue, getRoot from .RecallTable import RecallTable, RecallTableConfig
from random import shuffle a1 = input('Digite o nome do Aluno 1: ') a2 = input('Digite o nome do Aluno 2: ') a3 = input('Digite o nome do Aluno 3: ') a4 = input('Digite o nome do Aluno 4: ') deck = [a1, a2, a3, a4] shuffle(deck) print('A ordem de apresentação será: {}'.format(deck))
#!/usr/bin/env python #/****************************************************************************** # * $Id$ # * # * Project: GDAL Utilities # * Purpose: Create a ISIS3 compatible (raw w/ ISIS3 label) from a GDAL supported image. # * Author: Trent Hare, <thare@usgs.gov> # * Date: June 05, 2013 # * version: 0.1 #...
from elasticsearch import Elasticsearch # type: ignore from elasticsearch.client import IndicesClient # type: ignore from elasticsearch.helpers import bulk # type: ignore import logging from config import CONFIG_DICT LOGGER = logging.getLogger(__name__) ELASTICSEARCH_NODES = [CONFIG_DICT['ELASTICS...
#!/usr/bin/env python3 # Copyright (C) 2020-2021 Andrew Trettel # # SPDX-License-Identifier: MIT import csv import math import sqlite3 import sheardata as sd import sys conn = sqlite3.connect( sys.argv[1] ) cursor = conn.cursor() cursor.execute( "PRAGMA foreign_keys = ON;" ) flow_class = sd.FC_BOUNDARY_DRIVEN_F...
# Sample module in the public domain. Feel free to use this as a template # for your modules (and you can remove this header and take complete credit # and liability) # # Contact: Brian Carrier [carrier <at> sleuthkit [dot] org] # # This is free and unencumbered software released into the public domain. # # Anyone is f...
"""Top-level package for Django Async Redis.""" __author__ = """Andrew Chen Wang""" __email__ = "acwangpython@gmail.com" __version__ = "0.1.0"
class Solution: roman_nums = { 1000: 'M', 900: 'CM', 500: 'D', 400: 'CD', 100: 'C', 90: 'XC', 50: 'L', 40: 'XL', 10: 'X', 9: 'IX', 5: 'V', 4: 'IV', 1: 'I' } def XXX(self, num: int) -> str: for (r...
# ------------------------------------------------------------------------ # Copyright (c) 2021 megvii-model. All Rights Reserved. # ------------------------------------------------------------------------ # Modified from Deformable DETR (https://github.com/fundamentalvision/Deformable-DETR) # Copyright (c) 2020 SenseT...
""" PRACTICE Exam 1, problem 3. Authors: David Mutchler, Vibha Alangar, Valerie Galluzzi, Mark Hays, Amanda Stouder, their colleagues and Myon McGee. """ # DONE: 1. PUT YOUR NAME IN THE ABOVE LINE. import rosegraphics as rg ######################################################################## # Students...
""" Matplotlib colormaps in Nilearn ================================ Visualize HCP connectome workbench color maps shipped with Nilearn which can be used for plotting brain images on surface. See :ref:`surface-plotting` for surface plotting details. """ import numpy as np import matplotlib.pyplot as plt from nilearn...
import glob, os from setuptools import setup, find_packages setup( name = 'metapub', version = '0.4.3.5', description = 'Pubmed / NCBI / eutils interaction library, handling the metadata of pubmed papers.', url = 'https://bitbucket.org/metapub/metapub', author = 'Naomi Most', maintainer = 'Nao...
import logging from pathlib import Path from typing import Any, Optional, Tuple, Union import gym import torch import pickle as pkl from rltoolkit import config, utils from rltoolkit.buffer import Memory from rltoolkit.stats_logger import StatsLogger from rltoolkit.tensorboard_logger import TensorboardWriter logger ...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ui/main-window.ui' # # Created by: PyQt5 UI code generator 5.9.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): M...
def PrintState( state ): s = "" for i in range(0, 16): s += "0x%08x" % state[i] s += " " print(s) def EaglesongPermutation( state ): N = 43 #PrintState(state) for i in range(0, N): state = EaglesongRound(state, i) return state def EaglesongRound( state, index ): ...
# Author: Leland McInnes <leland.mcinnes@gmail.com> # # License: BSD 2 clause import time import numba from numba.core import types import numba.experimental.structref as structref import numpy as np @numba.njit("void(i8[:], i8)", cache=True) def seed(rng_state, seed): """Seed the random number generator with a...
#!/usr/bin/env python import os import sys if __name__ == '__main__': os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'StreamingServer.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Dja...
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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...
# flake8: noqa from typing import Any from fugue_version import __version__ from IPython import get_ipython from IPython.display import Javascript from fugue_notebook.env import NotebookSetup, _setup_fugue_notebook _HIGHLIGHT_JS = r""" require(["codemirror/lib/codemirror"]); function set(str) { var obj = {}, wor...
import numpy as np from prnet.utils.render import vis_of_vertices, render_texture from scipy import ndimage def get_visibility(vertices, triangles, h, w): triangles = triangles.T vertices_vis = vis_of_vertices(vertices.T, triangles, h, w) vertices_vis = vertices_vis.astype(bool) for k in range(2): ...
"""mysite URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-base...
import os import fcntl from string import Template from django.core.urlresolvers import NoReverseMatch, reverse from django.db.models.loading import get_model from django.forms import ModelChoiceField, HiddenInput from django import forms from cyder.base.utils import filter_by_ctnr class DisplayMixin(object): #...
#!/usr/bin/env python """ Trolley syncs issues between CSV, Github, and Buffer with Trello. """ import csv import datetime import os import random import click import click_config import github3 from buffpy.api import API as BufferAPI from buffpy.managers.profiles import Profiles from buffpy.managers.updates import...
#!/usr/bin/python # -*-coding=utf-8 from __future__ import print_function, division import unittest from onvif import ONVIFCamera, ONVIFError CAM_HOST = '10.1.3.10' CAM_PORT = 80 CAM_USER = 'root' CAM_PASS = 'password' DEBUG = False def log(ret): if DEBUG: print(ret) class TestDevice(unittest.TestCas...
# -*- coding: utf-8 -*- """ Created on Tue Sep 8 16:31:07 2020 @author: Ashish """ def get_sum(a,b): numsum=0 for i in range(a,b+1): numsum+=i return numsum print(get_sum(0,1))
from django import template register = template.Library() @register.filter def check_if_favorited(document, user): """Returns boolean of whether or not a user favorited this document""" return document.is_favorited(user)
import unittest from pyaligner import * class TestMatrixInit ( unittest.TestCase ): def test_matrix_init_global ( self ): scorer = Scorer( 5, -1, -3, 7 ) seqh = Sequence( "ACTG" ) seqv = Sequence( "ACAAA" ) matrix = DPMatrix( seqh, seqv, scorer ) self.assertEqual( matrix...
#from visualization.deep_dream import runDeepDream from visualization.gradcam import runGradCam from visualization.guided_backprop import runGBackProp from visualization.guided_gradcam import runGGradCam from visualization.smooth_grad import runsmoothGrad #from visualization.inverted_representation import runInvRep fr...
# # Copyright (C) 2020 Codethink Limited # Copyright (C) 2019 Bloomberg Finance LP # # 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 # #...
from flask.ext.sqlalchemy import SQLAlchemy import os, sys sys.path.append(os.getcwd()) sys.path.append(os.path.join(os.getcwd(), '..')) from app import app db = SQLAlchemy(app) db_session = db.session def init_db(): # import all modules here that might define models so that # they will be registered properly ...
import argparse import logging import sys import os import wandb from configparser import ConfigParser from torch import optim from disvae import init_specific_model, Trainer, Evaluator from disvae.utils.modelIO import save_model, load_model, load_metadata from disvae.models.losses import LOSSES, RECON_DIST, get_loss...
# 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 ...
# -*- coding: utf-8 -*- # Copyright (c) 2021-2022 Intel Corporation # # 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 app...
import numpy as np import torch from scipy.spatial.transform import Rotation as Rot import pdb import math def get_camera_mat(fov=49.13, invert=True): # fov = 2 * arctan( sensor / (2 * focal)) # focal = (sensor / 2) * 1 / (tan(0.5 * fov)) # in our case, sensor = 2 as pixels are in [-1, 1] focal = 1....
''' ## using flash 1.2.11 to merge paired end reads # at combo mutant files # the sample identified is in the middle of the filename: 'D21-169', refer to ex58_config.csv for description of that # sample # each paired end read are split in the files ending in '1_sequence.fastq' and '2_sequence.fastq' "210105Lau_D21-169...