text
stringlengths
3.07k
22.1k
# This tests Pmw option and component handling. import tkinter import Test import Pmw Test.initialise() """ Definitions: initialisation option: an option that can be set in the call to the constructor but not in configure() configuration option: an option that can be set in the call...
import argparse import json import logging import os from os import listdir from os.path import isfile, join from collections import Counter from nlp.data import load_text_file from nlp.preprocessing import prepareText, frequencies from echr.utils.folders import make_build_folder from echr.utils.logger import getlogg...
''' Diamond wing ''' import numpy as np from scipy.interpolate import interp1d from cst_modeling.basic import BasicSection, BasicSurface, plot3d_to_igs from cst_modeling.foil import dist_clustcos, cst_foil def base_shape(x_ref: np.ndarray, x_LE: float, x_TE: float, l_LE: float, l_TE: float, h: float...
# import torch import re import os import sys import json import nltk import argparse import numpy as np from rouge import Rouge from tqdm import tqdm from collections import Counter from nltk.translate.bleu_score import sentence_bleu, SmoothingFunction from nltk.translate.meteor_score import single_meteor_score from u...
# Copyright (c) <NAME>, 2007 __docformat__ = 'reStructuredText' __all__ = ['GaussianProcess','GPEvaluation','GPSubmodel'] import pymc as pm import copy import numpy as np from .Realization import Realization __all__ = ['GaussianProcess', 'GPEvaluation', 'GPSubmodel'] def gp_logp(x, M, C, mesh, f_eval, M_obs, C_ob...
# -*- coding: utf-8 -* # 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 # #...
import sys sys.path.insert(0, "../../python") from log_util import LogUtil import os.path import mxnet as mx import config_util # from config_util import get_checkpoint_path, parse_contexts from stt_metric import STTMetric # tensorboard setting from tensorboard import SummaryWriter import socket import json import nu...
# Copyright 2015 Cloudera 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, so...
import traceback from itertools import chain import shutil, os, re from hashlib import sha1 import psutil import ctypes ASTERISKS = r'**********' user32 = ctypes.WinDLL('user32') SW_MAXIMISE = 3 window_titles = [] GetWindowText = ctypes.windll.user32.GetWindowTextW GetWindowTextLength = ctypes.windll.user32.GetWindow...
import logging import time from modules.base_module import Module from client import Client import common ACTIONS = ["danceBoy1", "danceBoy2", "danceBoy3", "danceBoy4", "danceBoyKoreanStyle", "danceBoyIreland", "danceBoyDisco", "danceBoyGrooveJam", "danceGirl1", "danceGirl2", "danceGirl3", ...
import logging import pymel.core as pymel from omtk.core.classModule import Module from omtk.libs import libPython from omtk.libs import libPymel from omtk.libs import libRigging from omtk.modules import rigFK from omtk.modules import rigFKAdditive ''' class Finger(Module): """ Finger rig are similare to the A...
#!/usr/bin/env python3 import os import sys os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'models/research/slim')) import time import datetime import logging from tqdm import tqdm import numpy as np import cv2 import simplejson as json from sklearn.met...
from flask import Flask, request, abort import os import noti_db import noti_purchase.get_amazon_url amazon = noti_purchase.get_amazon_url from linebot import ( LineBotApi, WebhookHandler ) from linebot.exceptions import ( InvalidSignatureError ) from linebot.models import ( CarouselColumn, CarouselTemplat...
"""Control API.""" from flask import Blueprint, render_template, request import json from TopsidesGlobals import GLOBALS control_api = Blueprint("control_api", __name__) topsidesComms = None rotateCam1 = 0 rotateCam2 = 0 def controlAPI(comms): global topsidesComms topsidesComms = comms return control_a...
# -*- encoding: utf-8 -*- """ keri.help.helping module """ import base64 import dataclasses import datetime from collections.abc import Iterable, Sequence, Mapping import pysodium from multidict import MultiDict # base class for mdict defined below from orderedset import OrderedSet as oset # Utilities def isign(i)...
#------------------------------------------------------------------------------ # Name: pychrono example # Purpose: # # Author: <NAME> # # Created: 1/01/2019 # Copyright: (c) ProjectChrono 2019 #------------------------------------------------------------------------------ print ("Example: Load a STE...
import torch import torchaudio import numpy as np import torch.nn as nn import torch.nn.functional as fu import torchaudio.functional as func torchaudio.set_audio_backend('sox_io') def create_mel_filterbank(sample_rate, frame_len, num_bands, min_freq, max_freq): """ Taken from https://github.com/f0k/ismir2015...
#!/usr/bin/env python # -*- encoding: utf-8 -*- """This module contains the knowledge of how to take the metadata produced during construction of the SciPy conference proceedings and functions for generating valid DOIs and produces an xml file containing all of the necessary metadata to submit DOIs to CrossRef. The Xr...
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np from osgeo import gdal, ogr, osr from pyhdf.SD import SD, SDC import h5py import pyproj import os import re from geoedfframework.utils.GeoEDFError import GeoEDFError """ Helper module implementing various processing operations on HDF4 and HDF5 f...
# # create_tfrecords_format.py # # This script creates a tfrecords file from a dataset in VOTT format. #%% Imports and environment import os from PIL import Image from tqdm import tqdm import glob import numpy as np import argparse import sys if sys.version_info.major >= 3: from utils.create_tfrecords_py3 import ...
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) Copyright 2018 SUSE 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.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
import datetime import json import lzma import os import os.path import platform import sys # for DataVisitor import ast, inspect from collections import OrderedDict from importlib import util from lxml import etree from pycsp3.dashboard import options from pycsp3.problems.data import parsing from pycsp3.tools.aggre...
# coding=utf-8 import json import os from util import read_json import copy import sys def opt_area_json(path): json_data = json.load(open(path, 'r')) new_json_data = [] for data in json_data: if data['label'] == '': new_data = data new_data['id'] = data['id'] + 1 ...
"""Compute a grid of values for Wright's generalized Bessel function and save the values to data files for use in tests. Using mpmath directly in tests would take too long. This takes about 10 minutes to run on a 2.7 GHz i7 Macbook Pro. """ from functools import lru_cache import os from time import time import numpy ...
from option import args from model import Model import utility from dataloader import DATALOADER from keras.utils import generic_utils import os import cv2 import numpy as np import math def train(args, model, log_manager, img_preprocessor, train_dataloader, val_dataloader) : model_path_manager = utility.Model_p...
import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import LogNorm # from matplotlib.ticker import FormatStrFormatter import librosa import librosa.display # original_sample = 'Real Test/full_train_test_true.wav' # ds_sample = 'Real Test/full_train_test_ds.wav' # reco_sample = 'Real Test/full_tr...
# -*- coding: utf-8 -*- import os import sys import re from bs4 import BeautifulSoup from ghostscript import Ghostscript import PyPDF2 from PIL import Image, ImageDraw import colorsys import numpy as np import shutil sys.path.insert(1, os.path.realpath(os.path.join(sys.path[0], os.pardir, os.pardir))) from measurement...
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Tests for implementations of L{ITLSTransport}. """ from __future__ import division, absolute_import __metaclass__ = type from zope.interface import implementer from twisted.python.compat import networkString from twisted.python.filepath im...
""" Basic avalon integration """ import os import contextlib from collections import OrderedDict from pyblish import api as pyblish from openpype.api import Logger from openpype.pipeline import ( schema, register_loader_plugin_path, register_creator_plugin_path, deregister_loader_plugin_path, dere...
import gzip import json from pathlib import Path import shutil import branca.colormap as cm import geopandas as gpd from ipyleaflet import ( basemaps, Choropleth, GeoJSON, Icon, LayerGroup, LayersControl, LegendControl, Map, Marker, Popup, WidgetControl, ) from ipywidgets im...
# Copyright 2020 Xanadu Quantum Technologies 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 agre...
# -*- coding: utf-8 -*- """ Created on Sun Oct 15 00:38:55 2017 @author: soumi """ from random import * from RectUtils.Rect import Rect import copy #import Utils.ImageUtil as ImageUtil MAX_AREA_SCAN = 1000 class CColor: White= (255,255,255) Black = (0,0,0) Gray = (190,190,190) ...
from torch.nn.modules.loss import _Loss import torch import math import numpy as np from scipy.optimize import linear_sum_assignment import torch.nn.functional as F def loss_calculation( pred_cent, pred_ref,pred_foot_ref, pred_rot, pred_num, pred_mode, target_s,points, w, target_mode): bs = 1 ...
#!/usr/bin/env python3 """ Dependencies required to run program. - python3.6+ - argparse - pandas >= 0.22.4 - pysam==0.15.2 """ import sys import pandas as pd from primer_tk import constants def add_tabix_subparser(subparser): """ Get commandline arguments Args: subparser (?): Subpar...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 15/08/18 22:14 # @Author : <NAME> # @Site : # @File : pythonCalculator.py # @Software: PyCharm """ 开发一个简单的python计算器 实现加减乘除及拓号优先级解析 用户输入 1 - 2 * ( (60-30 +(-40/5) * (9-2*5/3 + 7 /3*99/4*2998 +10 * 568/14 )) - (-4*3)/ (16-3*2) )等类似公式后, 必须自己解析里面的(),+,-,*,/...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
# emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- # ex: set sts=4 ts=4 sw=4 noet: # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the datalad package for the # copyright and license terms. # # ## ### ##...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ For Binance.com Hand made client could be easy extend """ __author__ = 'Zagfai' __date__ = '2020-12' import time import hmac import logging import hashlib import requests import socket import websocket import threading import queue from urllib.parse import urljoin from...
""" Build all the conda recipes in the given directory sequentially if they do not already exist on the given binstar channel. Building is done in order of dependencies (circular dependencies are not supported). Once a build is complete, the distribution will be uploaded (provided BINSTAR_TOKEN is defined), and the nex...
from __future__ import division import numpy as np import os import cv2 import itertools as it project_path = "redraw/" data_path = os.path.join(project_path, "data/") image_path = os.path.join(project_path, "images/") image_width = 720 image_height = 720 BLANK_PROPORTION = 0.1 ORIGIN_IMGWIDTH = 960 ORIGIN_IMGHEIGHT...
# -*- test-case-name: txdav.who.test.test_cache -*- ## # Copyright (c) 2014-2015 Apple Inc. 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/lice...
import matplotlib as mpl mpl.use('Agg') # noqa import argparse import os import json import pickle import yaml import numpy import hashlib from jinja2 import Environment, FileSystemLoader from ann_benchmarks import results from ann_benchmarks.datasets import get_dataset from ann_benchmarks.plotting.plot_variants impo...
from __future__ import print_function, unicode_literals import RPLCD.common as C import sys if sys.version_info < (3,): text_type = unicode binary_type = str else: text_type = str binary_type = bytes from .codec import hitachi_utf_map class HwException(BaseException): pass def test(val, insn_m...
#!/usr/bin/python # # Copyright (c) 2017 <NAME>, <<EMAIL>> # # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Support for host policies. This contains the main unique functionality for this package. .. $Id$ """ from __future__ import print_function, unicode_literals, absolute_import, division __docformat__ = "restructuredtext en" logger = __import__('logging').getLogger(__n...
from __future__ import print_function from builtins import zip import os import numpy as np from flarestack.shared import plot_output_dir, catalogue_dir from flarestack.utils.catalogue_loader import load_catalogue agncores_dir = os.path.abspath(os.path.dirname(__file__)) agncores_cat_dir = agncores_dir + "/catalogues/...
# Copyright 2019 The TensorFlow 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 applica...
#!/usr/bin/env python # -*- coding: latin-1 -*- ''' Prepare a summary for different datatypes for ENCODE3 ''' import os.path import argparse import encodedcc from encodedcc import get_ENCODE EPILOG = ''' The output of this program is for consumption by a googlesheet. ''' def getArgs(): parser = argparse.Argument...
# -*- coding: utf-8 -*- """ Common JS/CSS includes @copyright: (c) 2010-2021 Sahana Software Foundation @license: MIT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without ...
import time,os,re,csv,sys,uuid,joblib from datetime import date from collections import defaultdict import numpy as np import pandas as pd from sklearn import svm from sklearn.model_selection import train_test_split, GridSearchCV from sklearn.ensemble import RandomForestRegressor, ExtraTreesRegressor from sklearn.metri...
import pandas as pd import warnings import os import sys import codecs import torch from modules import BertNerData as NerData from modules import NerLearner from modules.models.bert_models import BertBiLSTMAttnNMT from modules.data.bert_data import get_bert_data_loader_for_predict from modules.train.train import valid...
# encoding: utf-8 import py from pypy.interpreter.error import OperationError from pypy.interpreter.module import Module class TestModule: def test_name(self, space): w = space.wrap m = Module(space, space.wrap('m')) w_m = w(m) assert space.eq_w(space.getattr(w_m, w('__name__')), w(...
#!/usr/bin/env python # -*- coding: utf8 -*- # ***************************************************************** # ** PTS -- Python Toolkit for working with SKIRT ** # ** © Astronomical Observatory, Ghent University ** # ***************************************************************** ##...
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from collections import defaultdict, deque from time import perf_counter from typing import List, Mapping, Optional, Tuple impo...
import os import random import decimal import string import hashlib import sha3 import pyqrcode from deprecated import deprecated # Number of PIP in 1 BIP PIP = 1000000000000000000 # Prefixes PREFIX_ADDR = 'Mx' PREFIX_PUBKEY = 'Mp' PREFIX_CHECK = 'Mc' PREFIX_TX = 'Mt' @deprecated("Use 'to_bip...
"""This module defines all possible functional forms of harmonization methods and the default decision tree for choosing which method to use. """ import pandas as pd import numpy as np from bisect import bisect import pyomo.environ as pyo from aneris import utils def harmonize_factors(df, hist, harmonize_year='201...
import os import tqdm import cv2 import multiprocessing import torch import math import argparse import numpy as np import utils import shutil from PIL import Image TARGET_DIR = "data/fdf_new" shutil.rmtree(TARGET_DIR) IMAGE_TARGET_DIR = os.path.join(TARGET_DIR, "images") os.makedirs(IMAGE_TARGET_DIR) BBOX_TARGET_DIR...
# Copyright 2016 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,...
import torch import torch.nn as nn from collections import namedtuple Genotype = namedtuple('Genotype', 'normal normal_concat reduce reduce_concat') OPS = { 'none': lambda C, stride, affine: Zero(stride), 'avg_pool_3x3': lambda C, stride, affine: nn.AvgPool2d(3, stride=stride, padding=1, count_include_pad=Fals...
# Copyright 2020 Google 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
#!/usr/bin/env python3 import sys from os.path import join,exists,dirname import random from datetime import datetime import time import numpy as np from numpy.random import randint from sklearn.datasets import load_svmlight_file from torch.autograd import Function, Variable import torch.nn as nn import torch.optim as...
# Copyright 2019 California Institute of Technology # ------------------------------------------------------------------ import numpy as np from scipy.interpolate import interp1d import math import proper from wfirst_phaseb_proper import trim # wavefront: current wavefront structure # polfile: rootname of file cont...
"""Perform GPR Active Learning where Bayesian optimization is used to select a new calculation as soon as one calculation completes""" from funcx import FuncXClient from colmena.task_server.funcx import FuncXTaskServer from colmena.thinker import BaseThinker, agent from colmena.redis.queue import ClientQueues, make_que...
# encoding: utf-8 import os import json import random from olipy.randomness import WanderingMonsterTable from olipy import corpora countries = [ country for country in corpora.geography.countries['countries'] if not ' ' in country ] us_states = corpora.geography.us_states['states'] class Grammar(object): ...
import errno import signal import time from JumpScale import j from .utils import printInDebugMode from .server import MessageServer class MessageServerConfig(object): def __init__(self, name, address=None, forwardAddresses=None, storeLocally=True): self._name = name address = address or '127.0....
import asyncio import concurrent.futures import logging import multiprocessing import time from enum import Enum, auto import cv2 from .aruco_marker import ArucoMarker MAX_READ_FAILURES_PER_INIT = 3 LOOPBACK_DEV_PATH = "/dev/video21" class CapComm(Enum): """For communication between ArucoDetectionProcess and A...
"""Sonarr Common Models.""" # pylint: disable=invalid-name, too-many-instance-attributes, too-few-public-methods from __future__ import annotations from dataclasses import dataclass from .base import APIResponseType, BaseModel from .common import _CommonAttrs @dataclass(init=False) class _SonarrCommon6(BaseModel): ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Compare all fitted models to each other using Bayes factors from admixture_graph """ __author__ = "<NAME>" __copyright__ = "Copyright 2018" __email__ = "<EMAIL>" __license__ = "MIT" import argparse import glob import itertools import os import re import sys from collec...
#!/usr/bin/python # Copyright 2015 Couchbase, 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 appl...
import future # -- Standard lib ------------------------------------------------------------ import http.client as httplib # -- Project specific -------------------------------------------------------- from . import singleton class ExceptionInfo: """ Exception information to show useful responses to user wh...
import numpy as np import openpyxl import pandas as pd from tkinter import * from PIL import ImageTk, Image from openpyxl.workbook import Workbook from tkcalendar import * from openpyxl import load_workbook from tkinter.font import Font from tkinter import ttk from tkinter import messagebox from tkinter.messagebox impo...
# BSD-3-Clause License # # Copyright 2017 Orange # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the followi...
# # # # # # # # # # # # # # # # # # Self-Care Bot 0.3a # # Designed by <NAME> # # Programmed by <NAME> # # # # # # # # # # # # # # # # # # """ TODO: Update code to reflect new Telegram API 2.0 Update code to reflect new version of telepot Remove threading, replace with asynchronous calling """ import telepot fr...
import datetime import json import os import re import subprocess from shutil import copyfile import yaml from buildtest.config import SiteConfiguration from buildtest.defaults import console from buildtest.exceptions import BuildTestError, ConfigurationError from buildtest.schemas.defaults import custom_validator, sc...
# segmentation then classification approach to ACE # feature extraction: use librosa's cqt, chromagram (https://github.com/librosa/librosa) # segmentation: use hmmlearn (http://hmmlearn.readthedocs.io/en/stable/), which has a sklean interface # classification: use keras - theano/tensorflow backend (https://keras.io/) ...
# 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...
import logging from typing import List, Tuple import torch import torch.nn as nn class LayerInfo: """ A class to record the layer attributes. """ def __init__(self, name: str, layer: nn.Module, scale: float = 1.0, scale_layer: bool = False) -> None: """ layer_name: name of the layer ...
import tensorflow as tf # loss weight LAMBDA = 10 class InstanceNormalization(tf.keras.layers.Layer): """Instance Normalization Layer (https://arxiv.org/abs/1607.08022).""" def __init__(self, epsilon=1e-5): super(InstanceNormalization, self).__init__() self.epsilon = epsilon def build(s...
""" Utils ----- Functions to help read and write data to disk in a variety of formats. """ from __future__ import absolute_import, division, print_function, unicode_literals import bz2 import gzip import io import itertools import os import re import warnings import zipfile try: # Py3 import lzma except ImportE...
""" Experiment: 1. Objective: Generate adversarial examples. 2. Context: zero-knowledge model and optimization-based white-box model. 3. Dataset: CIFAR100. @author: <NAME> (y(dot)meng201011(at)gmail(dot)com) """ from __future__ import absolute_import, division, print_function, unicode_literals import sys ...
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
import re, sys import os, json CURRENT_FOLDER = os.path.dirname(os.path.abspath(__file__)) import numpy as np import random UNKNOWN_TOKEN = '<unnown>' PADDING_TOKEN = '<padding<PASSWORD>>' def extract_text_from_line_numb(line): match = re.search('\d+ your persona:', line) if match is None: match = re.s...
import os import shapely from affine import Affine import rasterio from rasterio.warp import transform_bounds from ..utils.geo import list_to_affine, _reduce_geom_precision from ..utils.core import _check_gdf_load from ..raster_image.image import get_geo_transform from shapely.geometry import box, Polygon import pandas...
#!/usr/bin/env python # Copyright 2016 Hewlett Packard Enterprise Development Company 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 # # Unl...
""" Note: - the move_to_dpp moves things .to(device) """ from argparse import Namespace from typing import Optional, Any import torch from torch import nn from torch.optim import Optimizer from torch.optim.lr_scheduler import _LRScheduler from uutils.torch_uu.checkpointing_uu import resume_from_checkpoint from u...
import json import copy import torch import numpy as np import contextlib from distutils.dir_util import mkpath from tqdm import tqdm def make_new_tensor_from_list(items, device_num, dtype=torch.float32): if device_num is not None: device = torch.device("cuda:{}".format(device_num)) else: ...
""" Shared utility functions """ import boto.s3 import os import pyprind from ..utils.exceptions import ETLInputError from .s3_path import S3Path CHUNK_SIZE = 5242880 PROGRESS_SECTIONS = 10 def get_s3_bucket(bucket_name): """Returns an S3 bucket object from boto Args: bucket_name(str): Name of the...
#!/usr/bin/env python from ansible.module_utils.hashivault import hashivault_argspec from ansible.module_utils.hashivault import hashivault_auth_client from ansible.module_utils.hashivault import hashivault_init from ansible.module_utils.hashivault import hashiwrapper ANSIBLE_METADATA = {'status': ['stableinterface'],...
# Copyright 2020 Huawei Technologies Co., Ltd # # 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...
from asteval import Interpreter import multiprocessing as mp from multiprocessing import Pool import numpy as np import astropy.units as u from specutils.spectra import Spectrum1D from specutils.fitting import fit_lines __all__ = ['fit_model_to_spectrum'] def fit_model_to_spectrum(spectrum, component_list, expre...
from inventory import Handler import unittest class FakeShopifyAPI: @classmethod def get_locations(cls): return [{'active': True, 'address1': '1111 Spring Garden St.', 'address2': '', 'admin_graphql_api_id': 'gid://shopify/Location/48794762', 'city': 'Philadelphia', 'country': 'US', '...
# Licensed under a 3-clause BSD style license - see LICENSE.rst """The sncosmo registry is used to load and return instances in memory based on string identifiers.""" from astropy.utils import OrderedDict from astropy.extern import six __all__ = ['register_loader', 'register', 'retrieve', 'get_loaders_metadata'] _lo...
import decimal from dataclasses import asdict, dataclass from math import isclose from typing import List, Optional, Union import numpy as np from lhotse.utils import Seconds @dataclass class Array: """ The Array manifest describes a numpy array that is stored somewhere: it might be in an HDF5 file, a c...
import lark class NType: def __init__(self, name): self.name = name def __hash__(self): return hash(id(self)) def __eq__(self, other): return self is other class NGenericType(NType): def __init__(self, name): super(NGenericType, self).__init__(name) def __repr_...
# python3: CircuitPython 3.0 # Author: <NAME> (@gpshead) <<EMAIL>> # # Copyright 2018 Google 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 # # https://www.apache.org/licenses/LICEN...
from copy import deepcopy from django.conf import settings from django.contrib.auth import get_user_model from django.db import models # from django.db.models.signals import post_save from django.utils.translation import gettext as _ from spid_cie_oidc.entity.abstract_models import TimeStampedModel from spid_cie_oid...
# from data_utils.ModelNetDataLoader import ModelNetDataLoader # from data_utils.OFFDataLoader import * import argparse import numpy as np import os import torch import logging from tqdm import tqdm from sklearn.metrics import confusion_matrix import sys import importlib from path import Path from data_utils.PCDLoader ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse from tensorpack import * import os import tensorflow as tf import numpy as np from tensorpack.utils import logger import tensorpack.tfutils.symbolic_functions as symbf BATCH_SIZE = 32 NUM_POINTS = 1024 N_TRANSFORM = True @layer_register() def Transform...
import argparse from datetime import datetime import torch import torch.nn as nn import torch.optim as optim from torch.optim import lr_scheduler from torch.autograd import Variable import torch.backends.cudnn as cudnn from torchvision import datasets, models, transforms import matplotlib matplotlib.use('agg') import ...
import cPickle as pickle import os import shutil import sys import warnings import rope.base.fscommands from rope.base import exceptions, taskhandle, prefs, history, pycore, utils from rope.base.resourceobserver import * from rope.base.resources import File, Folder, _ResourceMatcher class _Project(object): def ...