text
stringlengths
6.04k
39.5k
# Copyright 2022 # Author: <EMAIL> (<NAME>) from io import TextIOWrapper import pygame, os from pygame.locals import * from pylsl import StreamOutlet, StreamInfo from datetime import datetime import numpy as np from time import sleep import liesl from sys import exit # "The Doctor with 2 Hands" vertigo stimulus presen...
#! /usr/bin/env python # -*- coding: utf-8 -*- """Module for reading 3D dicom data""" from loguru import logger from typing import Union # import numpy as np # import h5py from pathlib import Path import os.path import sys from .image import DataPlus, transform_orientation, transform_orientation_voxelsize import p...
from typing import Tuple, List import gin import tensorflow as tf from scipy.special import owens_t from tensorflow_probability import distributions as tfd import numpy as np import gpflow from gpflow import Parameter from gpflow import set_trainable from gpflow.utilities import positive from tf_agents.environments.tf...
import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk, GObject import math modes = ["Year", "Array", "Date"] hijri_entry_modes = ["Enter Hijri Year", "Enter Start Year", "Enter Hijri Day"] gregorian_entry_modes = ["Enter Gregorian Year", "Enter End Year", "Enter Gregorian Day"] def int_part(floatN...
from typing import Sequence, Optional import torch import torch.nn as nn import numpy as np import torch.nn.functional as F from typing_extensions import Literal def one_hot(targets, num_classes, dtype=torch.float32, device=None): """ Encode the targets (an tensor of integers representing a class) as one...
"""Auxiliary functions for the quadratic GQTPAR trust-region subsolver.""" import math from collections import namedtuple import numpy as np from scipy.linalg import cho_solve from scipy.linalg import solve_triangular from scipy.linalg.lapack import dpotrf as compute_cholesky_factorization from scipy.optimize._trustre...
class SDL_SubSystem: SDL_INIT_TIMER = 1 SDL_INIT_AUDIO = 16 SDL_INIT_VIDEO = 32 SDL_INIT_JOYSTICK = 512 SDL_INIT_HAPTIC = 4096 SDL_INIT_GAMECONTROLLER = 8192 SDL_INIT_EVENTS = 16384 SDL_INIT_EVERYTHING = 6201 class SDL_EventType: """SDL EventType. See: https://wiki.libsdl.org/...
import rasterio import numpy as np from numpy import copy import os, shutil import fiona import json from fiona.crs import from_string from rasterio.features import shapes from pprint import pprint from rasterio.warp import calculate_default_transform, reproject, Resampling from rasterio import crs from rasterio.tools....
import json import pandas as pd import numpy as np import os from os import path from collections import defaultdict from ortools.constraint_solver import routing_enums_pb2 from ortools.constraint_solver import pywrapcp import argparse import pickle Infinity = int(2 ** 31) - 1 def get_solution(manager, routing, solu...
# -*- coding: utf-8 -*- """ Copyright (C) 2017 <NAME> (plugin.video.netflix) Copyright (C) 2018 Caphm (original implementation module) Remember and restore audio stream / subtitle settings between individual episodes of a tv show or movie Change the default Kodi behavior of subtitles according to user c...
from typing import Dict, List, Optional import torch import torch.nn as nn from fairseq import utils from fairseq.incremental_decoding_utils import with_incremental_state from fairseq.modules import LayerNorm from fairseq.modules.fairseq_dropout import FairseqDropout from torch import Tensor import torch.nn.functional...
# -*- coding: utf-8 -*- """ @author: <NAME> """ from __future__ import annotations from typing import Callable import math import torch import torch.nn as nn import torch.nn.functional as F from functools import partial from einops import rearrange __all__ = [ 'TongueFormer' ] class PositionalEncoding(nn.Modul...
#%% import os import sys try: os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') print(os.getcwd()) except: pass # %% import sys sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/maggot_models/') sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') fr...
""" Contains methods for making choices. """ import numpy as np import pandas as pd from patsy import dmatrix from .wrangling import broadcast, explode from .sampling import get_probs, get_segmented_probs, randomize_probs, sample2d def binary_choice(p, t=None): """ Performs a binary choice from a series of...
import itertools import sys if sys.version_info >= (3,0): import pycosat else: #import pycosat.pycosat import pycosat import json import copy import time import collections ### XXX working to make not global? var_map = dict() num_to_var = dict() # Adapting the version written to my standard to work for x...
from itertools import groupby, chain from collections import Counter import networkx as nx from .utils import normalise_counters import numpy as np from itertools import combinations, permutations from collections import defaultdict import pandas as pd from scipy.linalg import eigh def local_role_den...
# GLOBAL !!! -------GLOBAL !!! -------GLOBAL !!! -------GLOBAL !!! -------GLOBAL !!! -------GLOBAL !!! ------- nodes = 0 # GLOBAL !!! -------GLOBAL !!! -------GLOBAL !!! -------GLOBAL !!! -------GLOBAL !!! -------GLOBAL !!! ------- def ebf(nNodes, depth, precision = 0.000001): left = 1 right = nNodes if nNodes =...
#! /usr/bin/env python # Copyright 2012-2015 <NAME> <<EMAIL>> and collaborators. # Licensed under the MIT License. """Compute diagnostics regarding the quality of gain/phase calibration. NB. The GainCal class should be generically useful. """ from __future__ import absolute_import, division, print_function, unicode_...
#!/usr/bin/env python # coding: utf-8 # # Decision Trees (with GINI) for Predictive Maintenance # Supplementary Jupyter Notebook for the seminar paper of <NAME> and <NAME>. # # This Notebook implements the procedure to build a decision-tree based on Gini-index metric. # It has been setup to build a Decision-Tree fo...
#!/usr/bin/python3 # -*- coding: utf-8 -*- import unittest, tempfile import dungeon class VertexBuilderTest(unittest.TestCase): def test_floor(self): vb = dungeon.VertexBuilder() v, t, c = vb.floor(4, 5, 6, 3.0, 2.0) self.assertEqual(len(v), 4) # square floor in xz-p...
import logging import os import traceback import discord from discord.ext import commands import fftbg.event_stream import fftbg.server import fftbg.twitch.msg_types as msg_types import fftbg.bird.memory from pathlib import Path import asyncio from fftbg.bird.msg_types import BIRD_GOING_ALL_IN LOG = logging.getLog...
import casadi as cas def mass_hpa_wing( span, chord, vehicle_mass, n_ribs, # You should optimize on this, there's a trade between rib weight and LE sheeting weight! skin_density, n_wing_sections=1, # defaults to a single-section wing (be careful: can you disassemble/t...
import decimal import hashlib import json import logging import os import re import uuid from functools import reduce, lru_cache import time import http.client from collections import OrderedDict from typing import Union, List, Optional, Dict, Any, Tuple, Pattern from contextlib import contextmanager from base64 import...
#!/usr/bin/env python3 import sys, os, argparse, shutil import signal, time import multiprocessing as mp import extract_kmers # build_db.py implements a pipeline for building GT-Pro customized database # it requires a list of paths to species folders as the main input # details and guidelines about preparing such a s...
import struct import ctypes from ctypes import byref import codecs import functools import windows import windows.native_exec.simple_x86 as x86 import windows.native_exec.simple_x64 as x64 from generated_def.winstructs import * from windows.winobject import process from windows import winproxy from winproxy import Nee...
import os import numpy as np import six import mrcfile as mrc rhd = [ ("nx", "i4"), # Number of columns ("ny", "i4"), # Number of rows ("nz", "i4"), ("mode", "i4"), # Types of pixels in the image. Values used by IMOD: # 0 = unsigned ...
import os import sys import time from argparse import ArgumentParser import math import numpy as np import time import torch from torch.optim.lr_scheduler import MultiStepLR import torch.utils.data.distributed from torchsummary import summary from ncnnqat import merge_freeze_bn, register_quantization_hook,save_table ...
import sys import os import subprocess import random import math import numpy import sfpy from .arithmetic import evalctx from .arithmetic.canonicalize import Canonicalizer, Condenser from .arithmetic import native, np from .arithmetic import softfloat, softposit from .arithmetic import ieee754, posit from .fpbench i...
""" Cosmology routines: A module for various cosmological calculations. The bulk of the work is within the class :py:class:`Cosmology` which stores a cosmology and can calculate quantities like distance measures. """ from dataclasses import dataclass, asdict import numpy as np # Import integration routines from scip...
# coding: utf-8 import os from io import StringIO from typing import TYPE_CHECKING, Any, BinaryIO, Dict, List, Optional, Union from .constants import UP_AMAZON_S3 from .exceptions import InvalidBatch from .utils import guess_mimetype if TYPE_CHECKING: from .endpoint import APIEndpoint # Base classes class Mod...
#!/usr/bin/env python ''' print_all.py - a script to print a MRT format data using mrtparse. Copyright (C) 2016 greenHippo, LLC. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apac...
# These are all the modules we'll be using later. Make sure you can import them # before proceeding further. from __future__ import print_function import matplotlib.pyplot as plt import matplotlib.image as mpimg import random import numpy as np import os import sys import tarfile from IPython.display import display, Im...
# -*- coding: utf-8 -*- """ Global configuration file for TG2-specific settings in tracim. This file complements development/deployment.ini. Please note that **all the argument values are strings**. If you want to convert them into boolean, for example, you should use the :func:`paste.deploy.converters.asbool` functi...
import socket import select import argparse import logging import time import random import ctypes import os import pyrtma.internal_types import pyrtma.constants from pyrtma.internal_types import Message, MessageHeader from typing import Dict, List, Tuple, Set, Type, Union from dataclasses import dataclass from coll...
#!/usr/bin/env python3 # coding:utf-8 import open3d as o3d import os import numpy as np import copy import math import json color = [[0.95, 0.95, 0.95], [0.3, 0.5, 0.8], [0.9, 0.9, 0.6], [0.5, 0.2, 0.3], [0.9, 0.9, 0.9], [0.8, 0.8, 0.8], [0.7, 0.7, 0.7], [1, 0.5, 0], [0, 1, 1], [1, 0, 0], [0...
from __future__ import absolute_import import os import copy import getdist from getdist import types, plots, IniFile from getdist.types import BestFit from matplotlib import rcParams, rc from matplotlib import pyplot as plt from paramgrid import batchjob import numpy as np # common setup for matplotlib params = {'bac...
import numpy as np import pandas as pd import os, sys import pickle from tqdm import tqdm import matplotlib.pyplot as plt import nibabel as nib import json from ipywidgets import widgets, interactive sys.path.append("../../") from bpreg.preprocessing.nifti2npy import * from bpreg.settings import * from bpreg.inferenc...
# Copyright 2021 Jij 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, softwar...
import ot import numpy as np import torch from copy import deepcopy from tqdm import tqdm import pandas as pd from scipy.spatial.distance import cdist from math import ceil from apex import amp import os,sys,inspect current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) urbangan_dir =...
"""Sequence generation framework.""" from abc import ABCMeta, abstractmethod from six import add_metaclass from theano import tensor from blocks.bricks import Initializable, Identity, MLP, Random from blocks.bricks.base import application, Brick, lazy from blocks.bricks.parallel import Fork, Distribute from blocks.br...
import pytest # Mock the import of carla. import sys sys.modules['carla'] = __import__('mocked_carla') from collections import namedtuple import numpy as np # Import the mocked_carla as carla for the purposes of this test file. import mocked_carla as carla from pylot.utils import Location, Rotation, Transform, Vecto...
""" Basic classes and functions for working with words and patterns. Classes: Word, GeneralizedPattern, PatternExample, Pattern, PatternIndex Functions: is_equivalent, is_equivalent_ascending, subwords, find_instances """ import re from itertools import combinations, chain from collections import Counter, Order...
import ijson import pickle import csv import os import sys import gc import time from numpy import random # Path to the 12gb arxiv dataset path_dataset = "..\data\dblp.v12.json" path_dataset_cities = "..\data\cities15000.txt" # Path were we will store the dataset as a python dict #path_pickled_dataset = "..\data\dbl...
# Chapter 7 Exercises # Review Questions (True/False) # 1. True. # 2. False. It is written as '!='. # 3. True. # 4. False. It is implemented by using 'if-else'. # 5. True. # 6. False. It requires multiple except statements. # 7. False. It may be handled with if-elif-else. # 8. False. # 9. True. # 10. False. I...
import matplotlib.pyplot as plt from matplotlib.pyplot import savefig import matplotlib.patches as mpatches import pandas as pd import numpy as np from numpy import dtype from matplotlib.pyplot import ylabel import math import re import sys sys.path.append(f'./common') from argparse import ArgumentParser parser = Ar...
from time import * from tqdm import tqdm import random import json import requests def bv_av_interchange(input_data, Force=None): table='fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF' tr={} for i in range(58): tr[table[i]]=i s=[11,10,3,8,4,6] xor=177451812 add=8728348608 ...
from __future__ import print_function import os import copy import time import torch import torch.nn as nn import torch.nn.functional as F import matplotlib.pyplot as plt import numpy as np import argparse from torch.utils.data import DataLoader from data.dataset_s2 import DFC2020 from models.resnet impor...
import functools import json import logging import os import re import sys import warnings from dataclasses import dataclass, field from typing import Dict, List, Optional, Union import numpy as np import torch import torchaudio import datasets from datasets import DatasetDict, load_dataset, load_metric, set_caching_e...
from augment import augment_images from datetime import datetime from helpers import get_files, log_dir_or_None, write_log, LINE import numpy as np import os import pandas as pd from pathlib import Path import re import skimage.filters as filters from skimage.measure import regionprops from skimage.morphology._util imp...
import pdb import numpy as np import scipy as sp import scipy.optimize as op import util import matplotlib.pyplot as plt import time # Laplace Inference ----------------------------------------------------------- def negLogPosteriorUnNorm(xbar, ybar, C_big, d_big, K_bigInv, xdim, ydim): xbar = np.ndarray.flatten...
"""This module implements the core Scheme interpreter functions, including the eval/apply mutual recurrence, environment model, and read-eval-print loop. """ from scheme_primitives import * from scheme_reader import * from ucb import main, trace ############## # Eval/Apply # ############## def scheme_eval(expr, env)...
import unittest import os import numpy as np from common_wrangler.common import capture_stdout, capture_stderr, DIHES, silent_remove from gaussian_wrangler.gausslog_unique import main, compare_gausslog_info, print_results, DEF_OUT_NAME from gaussian_wrangler.gw_common import process_gausslog_file, CONVERG_ERR, TS, CONV...
# -*- coding: utf-8 -*- #------------------------------------------------------------------------------- # Name: zos.py # Purpose: COM interface class for easy ZOS-API # Licence: MIT License # This file is subject to the terms and conditions of the MIT License. # For further det...
''' Automatically Generate <fractal networks>. Author: <NAME> E-mail: <EMAIL> Feb, 2017 ''' import sys import os, math from gen_hourglass import * def main(): hourglass_net_str = fractal_net_full() with open("../prototxt/fractal_train.prototxt", "w") as f: f.write(hourglass_net_str) ''' S...
'''Functionality for the Runa type system. The core types are outlined in this file: - void - bool, byte - i8, u8, i32, u32, int, uint, float - function - iter - tuple (as a `build_tuple()` constructor) - owner, ref, opt Actual implementations attached to these types are mostly contained in the core library. Additio...
# --- UI-Widgets for the Editor Panel --- # from typing import Callable, List, Optional, Tuple, Union import pygame as pg from helpers import V2, Direction, clamp, draw_aacircle, draw_chevron, draw_rectangle, rect_union, render_text_centered_xy, render_text_left_justified from constants import EDITOR_WIDGET_SPACING, ...
"""GitHub API module. This module contains the :py:class:`GitHubAPI` class, which is meant to be the prime means of interacting with the GitHub API in ``repobee``. The methods of GitHubAPI are mostly high-level bulk operations. .. module:: github :synopsis: Top level interface for interacting with a GitHub instan...
#!/usr/bin/env python import os import re import sys import locale import signal import select from enum import IntEnum, unique from PyQt5.QtWidgets import QApplication, QWidget from PyQt5.QtCore import Qt, QTimer, pyqtSignal, QSocketNotifier, QObject, QPointF, QLineF from PyQt5.QtGui import QPainter, QColor, QFont, Q...
#!/usr/bin/env python3 ''' This script parses the following four files and generates the HTML that can then be added to the program page on the website: - order.txt - authors.csv - session-chairs.csv - anthology-mapping.csv Note that: 1. `dos2unix` must be run on the order file before processing. 2. The order file...
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import time import argparse import numpy as np from scipy.sparse import csr_matrix import pandas as pd import logging from sklearn.decomposition import TruncatedSVD from sklearn.linear_model import LinearRegres...
import pytest from math import inf as infinity from src import collatz from src.collatz import _CC, _ErrMsg, _KNOWN_CYCLES _REGEX_ERR_P_IS_ZERO = f"^{_ErrMsg.SANE_PARAMS_P.value}$" _REGEX_ERR_A_IS_ZERO = f"^{_ErrMsg.SANE_PARAMS_A.value}$" # Test def function(n:int, P:int=2, a:int=3, b:int=1) def test_function(): ...
import pretty_midi as pyd import numpy as np import os import sys sys.path.append('./util_tools') from chordloader import Chord_Loader def expand_chord(chord, shift, relative=False): # chord = np.copy(chord) root = (chord[0] + shift) % 12 chroma = np.roll(chord[1: 13], shift) bass = (chord[13] + shift)...
__author__ = '<NAME> <<EMAIL>>' __contributors__ = "<NAME>, <NAME>, <NAME>" __version__ = "0.91" # Copyright (c) 2016, Hong Kong University of Science and Technology (HKUST) # All rights reserved. # =============================================================================== # GLOBAL IMPORTS: import random import op...
"""Classes for management of hamster and virtual robots.""" import time from collections import namedtuple from sys import platform import numpy as np # Select Hamster communication interface depending on operating system. OS X supports # BLE over the Hamster communication API, while other systems require use of a US...
import json from .fastrank import lib, ffi from typing import Dict, Set, List # Keep in sync with fastrank/src/model.rs : fastrank::model::ModelEnum _MODEL_TYPES = ["SingleFeature", "Linear", "DecisionTree", "Ensemble"] def _handle_rust_str(result) -> str: """ This method decodes bytes to UTF-8 and makes a n...
"""GPT Synapse - Initial stem consists of a combination of token encodings and positional encoding. - Basically, a uniform sequence of Transformer blocks. - Each transformer is a sequential combination of a 1-hidden layer MLP block and a self-attention block. - all blocks feed into a central re...
from __future__ import division from __future__ import print_function import argparse import numpy as np import os.path as osp import sys import pickle from pathlib import Path from collections import namedtuple ROOT_DIR = osp.abspath('../') if ROOT_DIR not in sys.path: sys.path.append(ROOT_DIR) from utils impo...
import numpy as np from numpy import linalg as npl from meshpy import triangle from mesh_sphere_packing import logger, ONE_THIRD, GROWTH_LIMIT from mesh_sphere_packing.area_constraints import AreaConstraints # TODO : change nomenclature. Segment is used in geometry to refer to an # : edge connecting two points. ...
#!/usr/bin/python3 """ @copyright: Copyright (C) Mellanox Technologies Ltd. 2014-2020. ALL RIGHTS RESERVED. This software product is a proprietary product of Mellanox Technologies Ltd. (the "Company") and all right, title, and interest in and to the software product, including all associated intellec...
""" posedart.py: Provides the class for performing smart darting moves during an NCMC simulation. Authors: <NAME> Contributors: <NAME> """ import mdtraj as md import numpy as np import simtk.unit as unit from simtk.openmm import * from simtk.openmm.app import * from simtk.unit import * from blues.ncmc import SimNCMC...
import tensorflow as tf import keras.backend as K import numpy as np import pandas as pd import openpyxl from openpyxl import load_workbook from sklearn.metrics import confusion_matrix, accuracy_score, f1_score, matthews_corrcoef, mean_squared_error import matplotlib.pyplot as plt from skopt import gp_minimize from sko...
import random import inspect import mmcv import numpy as np from numpy import random import torchvision as tv import torchvision.transforms.functional as TF from ..builder import PIPELINES @PIPELINES.register_module() class Resize(object): """Resize images & bbox & mask. This transform resizes the input im...
import os import struct import zipfile import logging log = logging.getLogger(__name__) __all__ = ['read_roi'] def read_roi(roi_path): """Read ROI files .zip or .roi generated with ImageJ. Specifications and code is largely inspired from: http://rsb.info.nih.gov/ij/developer/source/ij/io/RoiDecoder.java...
""" Plot waveforms in dataframe """ import datetime as dt from typing import List, Union, Optional import matplotlib.pyplot as plt from matplotlib.figure import Figure import numpy as np import pandas as pd from redpandas.redpd_plot.parameters import FigureParameters as FigParam # PLOT_WIGGLES AUXILIARY FUNCTIONS def...
import torch from efficientnet_pytorch import EfficientNet # import onnx # 环境问题 from torchvision import datasets, models, transforms import json from PIL import Image import cv2 import numpy as np from timeit import default_timer as timer import time import onnxruntime from ghost_net import ghost_net # mydataset class...
import numpy as np from math import pow, atan2, sqrt, cos, sin, atan, asin import dubins # physical/external base state of all entites class EntityState(object): def __init__(self): # physical position self.p_pos = None # physical velocity self.p_vel = None # physical angle ...
from modulos.utils import * def sistema_nome(): # função para mostrar junto ao sistema os nomes dos personagens sistema_nome = f'''🚻- ° S̶i̶s̶t̶e̶m̶a̶ d̶e̶ N̶o̶m̶e̶s̶ ° -🚻』 →: O que são "Nomes de PP"? Como devem saber, o RPG é de criação, onde fazemos do 0 nossos personagens. Nisso vem os No...
# # Copyright (c) 2012-2021 Snowflake Computing Inc. All right reserved. # from __future__ import division import base64 import xml.etree.cElementTree as ET from datetime import datetime from io import IOBase from logging import getLogger from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, Tuple,...
#%% """ Created on July 05 2021 The SZHW model and implied volatilities This code is purely educational and comes from "Financial Engineering" course by <NAME> The course is based on the book “Mathematical Modeling and Computation in Finance: With Exercises and Python and MATLAB Computer Codes”, by <NAME> and...
import sys #import traceback import os import errno from os import linesep as newline import time import datetime from multiprocessing import Process, Value import socket import re import json from enum import Enum from agent import UCSAgentWrapper import const from const import (loop_iterations, st...
import os import collections import torch import copy import numpy as np from tensorboardX import SummaryWriter from utils import set_random_seed, test, load_model, weights_init from utils import make_idx_dict, get_layer_from_idx from models.model_builder import Model_Builder from spectral_compression impo...
#!/usr/bin/env python """ Copyright 2016 ARM Limited 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 ...
# -*- coding: utf-8 -*- # @Author: <NAME> # @Date: 2021-05-25 11:11:53 # @Last Modified by: <NAME> # @Last Modified time: 2021-07-29 11:00:44 ## Determine the consistency of the uncertainty estimate as a function of the number of forward passes ## general libraries import argparse import time import torch import ...
import tensorflow as tf # import hyperparams as hyp import os import numpy as np from os.path import isfile from scipy.misc import imread, imsave, imresize EPS = 1e-6 # do not import any other utils! def print_shape(t): print( t.get_shape().as_list()) def normalize_single(d): dmin = tf.reduce_min(d) dmax ...
# -*- coding: utf-8 -*- import re import string import pkg_resources from pathlib import Path import os from src.helpers.Errors import * from src.helpers.mergers_and_convertors import merge_topology_dicts from src.helpers.entity_type_checker import is_mac, is_ip_address static_folder = 'static' constants_path = pkg_...
#!/usr/bin/env python # pylint: disable=W0613 # type: ignore[union-attr] from cgi import print_arguments import os import logging import logging.config from pickle import FALSE, TRUE # from typing import Tuple, Dict, Any import datetime import re from dotenv import load_dotenv config = load_dotenv(".env") from tele...
# -*- coding: utf-8 -*- import numpy as np import tensorflow as tf import logging import os import matplotlib.pyplot as plt from PIL import Image from scipy.spatial.distance import cdist from patchwork._util import compute_l2_loss from patchwork.feature._generic import GenericExtractor from patchwork.feature._text_tr...
from pyrtl.core import set_working_block import unittest import pyrtl from pyrtl import transform class NetWireNumTestCases(unittest.TestCase): def setUp(self): pyrtl.reset_working_block() def assert_num_net(self, num, block=None): block = pyrtl.working_block(block) self.assertEqual(l...
# -*- coding: utf-8 -*- import mock import pytest from pyramid import testing from pyramid.config import Configurator from h.schemas import ValidationError from h.search.core import SearchResult from h.views import api as views class TestIndex(object): def test_it_returns_the_right_links(self, pyramid_config,...
import bpy import bmesh import math from bpy.props import BoolProperty, IntProperty, FloatProperty, PointerProperty, StringProperty import functools from uuid import uuid4 from . ops import initialize_default_collections, link_to_collection, unlink_from_collection, clone_object, delete_object from . draw import copy_...
from __future__ import print_function import numpy as np import torch import torch.nn as nn from pytorch_points.misc import logger from pytorch_points.network.layers import Conv1d, Linear from pytorch_points.network.pointnet2_modules import PointnetSAModuleMSG from pytorch_points.network.operations import scatter_add, ...
from appium.webdriver.common.mobileby import MobileBy appPackage = { 'fake_location': 'com.lerist.fakelocation', 'chrome': "com.android.chrome", 'settings': 'com.android.settings', 'gmail': 'com.google.android.gm', } appActivity = { 'fake_location': '.ui.activity.MainActivity', 'chrome': "com...
# election/views_admin.py # Brought to you by We Vote. Be good. # -*- coding: UTF-8 -*- from .controllers import election_remote_retrieve, elections_import_from_master_server, elections_sync_out_list_for_api from .models import Election from .serializers import ElectionSerializer from admin_tools.views import redirect...
import numpy as np import cv2 import math import matplotlib.pyplot as plt video = cv2.VideoCapture('Traffic2.mp4') def radian_to_degree(angle): return angle*180/np.pi def order_points(pts): ''' The function returns the 4 corner points in a set of points and returns the rectangle formed by the four ...
# Demo for Vissim+ # This demo is programmed to verified the COM interface of Vissim. # 2017.1.16 # silverHugh import win32com.client as com from xlrd import open_workbook from tkinter.messagebox import * from tkinter.filedialog import * # Macro VISSIM_VERSION = 'Vissim.Vissim-64.700' # User Interface class UI: ...
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ @Email: <EMAIL> \ @Copyright: go-hiroaki @License: MIT Modified from https://github.com/richzhang/PerceptualSimilarity """ from __future__ import absolute_import import os import torch import torch.nn as nn from collections import namedtuple from torchvision i...
from .utils import * from .result import * from collections import deque import multiprocessing import threading import numpy as np import sys import io import os import subprocess import psutil import sys import tempfile import shlex from sys import platform as _platform is_linux = _platform.startswit...
import ast from collections import namedtuple from embedvm import asm from embedvm.util import joining from embedvm import bytecode deduplicate = lambda iterable: reduce(lambda a, b: a if b in a else a+[b], iterable, []) def raising_int(n): if not isinstance(n, int): raise ValueError("Unsupported type for...
import sys import utp.utp_socket as utp import types import socket from cStringIO import StringIO from zope.interface import implements from twisted.python import failure, log from twisted.python.util import unsignedID from twisted.internet import abstract, main, interfaces, error, base, task from twisted.internet imp...
# Copyright by <NAME> """ Layers module within the eztorch4conv library. It contains the basic class blueprint for constructing new layers for DCNN and MC-DCNN models, and 3 of the most common implementations: conv3d that includes all the elements that may be needed for a 3D convolutional layer, dense that includes al...