text
stringlengths
3.07k
22.1k
import sys sys.path.append('../../src/') from infinity import * from DEVS import AtomicDEVS, CoupledDEVS from math import exp T_AMBIENT = 27.0 T_IGNITE = 300.0 T_GENERATE = 500.0 T_BURNED = 60.0 TIMESTEP = 0.01 PH_INACTIVE = 'inactive' PH_UNBURNED = 'unburned' PH_BURNING = 'burning' PH_BURNED = 'burned' RADIUS = 3 TM...
from dummy import Hyper, Param, Var, Runtime, Input, Output, Inline maxScalar = Hyper() numRegisters = Hyper() programLen = Hyper() numTimesteps = Hyper() inputNum = Hyper() inputStackSize = Hyper() numRegInstrs = 13 numBranchInstrs = 2 numInstrTypes = 3 numInstructions = numBranchInstrs + numRegInstrs + 1 mutableSt...
#!/usr/bin/python import getopt import sys import copy from util.plot_3d import Fig from util.solr import Solr def usage(progname, retval=0): print("%s -c <core> -u <url> [(-s|-S)]" % progname) print("\t-c <core> \tCore to use for the queries") print("\t-u <url> \turl to the Solr serv...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import random from collections import Counter from pathlib import Path from typing impor...
import logging import os import socket from contextlib import suppress from dataclasses import dataclass, field from typing import Awaitable, Callable, Final, Optional, Union import dask_gateway import distributed import httpx from aiohttp import ClientConnectionError, ClientResponseError from dask_task_models_library...
import asyncio import collections from utilities import DotDict, recursive_dictionary_update class BaseMeta(type): def __new__(mcs, name, bases, clsdict): for key, value in clsdict.items(): if callable(value) and (value.__name__.startswith("on_") or hasattr...
import torch import torch.nn as nn def conv_bn(in_channels,out_channels,kernel_size, stride=1, groups=1): return nn.Sequential( nn.Conv2d(in_channels=in_channels, out_channels=out_channels,kernel_size=kernel_size, stride=stride, padding=kernel_size // 2, groups=groups, bias=False), ...
# Copyright 2014 Adobe. All rights reserved. """ otfpdf v1.6.3 Jul 15 2019 provides support for the proofpdf script, for working with OpenType/CFF fonts. Provides an implementation of the fontpdf font object. Cannot be run alone. """ from fontTools.pens.boundsPen import BoundsPen from fontTools.misc.psCharStrings impor...
""" Entry point for starting Galaxy without starting as part of a web server. Example Usage: Start a job/workflow handler without a web server and with a given name using. python lib/galaxy/main.py --server-name handler0 Start as a daemon with (requires daemonized - install with 'pip install daemonize'): python lib...
import numpy as np mdhLC = [("ushLine", "<u2"), ("ushAcquisition", "<u2"), ("ushSlice", "<u2"), ("ushPartition", "<u2"), ("ushEcho", "<u2"), ("ushPhase", "<u2"), ("ushRepetition", "<u2"), ("ushSet", "<u2"), ("ushSeg", "<u2"), ("ushIda", ...
from dataset import CustomDataset, CustomDataLoader from model import CustomModel import transforms import glob from src.utils import * import timm from src.config import YAMLConfig import albumentations import torch import matplotlib.pyplot as plt from albumentations.pytorch.transforms import ToTensorV2 # TODO: ToTen...
# Copyright 2020 Makani Technologies 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 applicable law or agreed to...
#!/usr/bin/python # Copyright (c) 2017, 2021 Oracle and/or its affiliates. # This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Apache License v2.0 # See LICENSE.TXT for d...
import os import numpy as np import time from collections import deque import glob import matplotlib.pyplot as plt import torch def ddpg(agent, env, n_episodes=1000, max_t=1000, scores_window=100, progress_every=2, save_every=60, folder=None): brain_name = env.brain_names[0] brain = env.brains[brain_name] ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 3/30/2018 2:01 PM # @Author : sunyonghai # @File : voc_parser.py # @Software: ZJ_AI #此程序是处理标注好的结果,包括统计商品种类及个数 # ========================================================= import json import os import pprint import cv2 import xml.etree.ElementTree as ET import...
from __future__ import print_function, absolute_import, division import warnings from astropy import units as u from astropy.io import registry as io_registry from radio_beam import Beam, Beams from .. import DaskSpectralCube, StokesSpectralCube, BooleanArrayMask, DaskVaryingResolutionSpectralCube from ..spectral_cub...
#!/usr/bin/python # Copyright (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = ''' --- module:...
# Copyright 2019 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, ...
# $Filename$$ # $Authors$ # Last Changed: $Date$ $Committer$ $Revision-Id$ # # Copyright (c) 2003-2011, German Aerospace Center (DLR) # All rights reserved. # # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions are #met: # ...
import re import copy import inspect import ast import textwrap """ Utilities for manipulating the Abstract Syntax Tree of Python constructs """ class NameVisitor(ast.NodeVisitor): """ NodeVisitor that builds a set of all of the named identifiers in an AST """ def __init__(self, *args, **kwargs): ...
import numpy as np import math def dotproduct(v1, v2): return sum((a * b) for a, b in zip(v1, v2)) def length(v): return math.sqrt(dotproduct(v, v)) def angle(v1, v2): try: if length(v1) * length(v2) == 0: radians = 0 else: radians = math.acos(dotproduct(v1, v2)...
import os import sys import re import socket import pytz import urllib.request, urllib.parse, urllib.error import json from datetime import datetime from urllib.parse import urljoin from datetime import datetime, time from flask import Flask, render_template, request, url_for, Response from flask_assets import Environm...
import collections from enum import Enum from functools import reduce from operator import mul from typing import Iterable, Tuple, TypeVar, Dict, NamedTuple, Optional, Union import warnings import logging import numpy as np import six from scipy.linalg import block_diag from scipy.optimize import OptimizeResult from c...
import pandas as pd pd.set_option('mode.chained_assignment', None) import plotly as py import plotly.express as px import plotly.graph_objects as go import plotly.io as pio import matplotlib.pyplot as plt import itertools import os import sys input_folder = '../../osemosys_global_model/OsemosysGlobal/results' output_f...
# Copyright (c) 2009-2011 <NAME>. See LICENSE for details. """ Waiting for I/O completion. """ from __future__ import absolute_import, division, print_function import sys import select as __select__ from gevent.event import Event from gevent.hub import _get_hub_noargs as get_hub from gevent.hub import sleep as _g_sle...
import os import bz2 import ast import pickle import argparse import numpy as np from core.common import List, Tuple, Union, Dict from core.common.types import StringList __all__ = ["Config", "ARGConfig", "ARG", "ParamDict"] class ParamDict(object): def __init__(self, other: Union[Dict, Tuple, List] = None): ...
#!/usr/bin/env python # CREATED: 2013-10-06 22:31:29 by <NAME> <<EMAIL>> # unit tests for librosa.decompose # Disable cache import os try: os.environ.pop("LIBROSA_CACHE_DIR") except: pass import numpy as np import scipy.sparse import librosa import sklearn.decomposition import pytest from test_core import...
from . import MagUtils from scipy.constants import mu_0 import re import numpy as np from SimPEG import utils, data from SimPEG.potential_fields import magnetics as mag class Simulation(object): """ Earth's field: - Binc, Bdec : inclination and declination of Earth's mag field ...
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import absolute_import import os from pex.dist_metadata import Requirement from pex.interpreter import PythonInterpreter, calculate_binary_name from pex.orderedset import...
import itertools import mimetypes import os import subprocess import sys import tkinter as tk from PIL import Image, ImageTk import inbac.parse_arguments as args class Application(tk.Frame): def __init__(self, args, master=None): super().__init__(master) self.master = master self.args = ...
#!/usr/bin/env python3 """ SPDX-License-Identifier: MIT Copyright (c) 2021, SCANOSS 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 restriction, including without limitation ...
import tempfile import pytest import mxnet as mx import os import numpy as np import numpy.testing as npt from gluonnlp.models import get_backbone, list_backbone_names from gluonnlp.utils.parameter import count_parameters from gluonnlp.utils.lazy_imports import try_import_tvm mx.npx.set_np() def test_list_backbone_na...
from django.contrib import messages from django.urls import reverse from django.db.models import Q from django.http import Http404, HttpResponse, HttpResponseRedirect from django.shortcuts import get_object_or_404, redirect from django.views.generic import ListView, DetailView, CreateView, UpdateView, TemplateView, Vie...
# encoding: UTF-8 ''' ccxt的gateway接入 ''' import os import json import time import traceback from queue import Queue, Empty from multiprocessing.dummy import Pool from datetime import datetime, timedelta from copy import copy from math import pow import ccxt from vnpy.trader.vtGateway import * from vnpy.trader.vtFun...
# Copyright (c) 2019-2022, NVIDIA 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...
from collections.abc import Sequence, MutableSequence from bitstring import BitArray, Bits import math def get_width(length, full_width): """ Returns the number of bits used by Minecraft to represent indices into a list of the given length. """ width = int(math.ceil(math.log(length, 2))) if w...
import bpy import copy from math import radians import pathlib import numpy as np from blendvis import DEFAULTS, MAIN_FONT, DEFAULT_GP, rcParams, DEFAULT_FONT # bpy.ops.font.open(filepath="//..\\..\\..\\..\\..\\..\\..\\..\\WINDOWS\\Fonts\\couri.ttf", relative_path=True) MM = len(bpy.data.fonts) bpy.ops.font.open(file...
from __future__ import annotations from typing import Any, Dict, List, Optional, Union from enum import Enum from pydantic import BaseModel, Extra, Field, conint, constr ################### # Package section # ################### class Package(BaseModel): class Config: extra = Extra.forbid name: s...
import pygame import pymunk import pymunk.pygame_util import os import ctypes import tkinter as tk from tkinter import * import numpy as np from scipy.optimize import newton '''initiating pygame''' pyscreen_x = 1250 pyscreen_y = 500 ctypes.windll.user32.SetProcessDPIAware() # looks that python knows wh...
import os import copy import json import typing import logging import math import random import binascii from d3m import container from d3m.metadata.problem import TaskKeyword, PerformanceMetric from d3m.metadata.pipeline import Pipeline from d3m import utils as d3m_utils from axolotl.utils import pipeline as pipelin...
# TODO move to dev from __future__ import print_function import os import shutil import gc import tensorflow as tf import numpy as np import deep_architect.core as co import deep_architect.helpers.tensorflow as htf import deep_architect.utils as ut import deep_architect.contrib.misc.gpu_utils as gpu_utils import deep...
import os from typing import List, NamedTuple, Dict import pandas as pd from artificial_bias_experiments.evaluation.confidence_comparison.df_utils import ColumnNamesInfo, \ get_df_diffs_between_true_conf_and_confidence_estimators_melted from artificial_bias_experiments.image_generation.image_generation_utils impo...
""" ================================= Combine predictors using stacking ================================= .. currentmodule:: sklearn Stacking refers to a method to blend estimators. In this strategy, some estimators are individually fitted on some training data while a final estimator is trained using the stacked pre...
""" Cog for logging info to mod-info """ import discord from discord.ext import commands import random from .utils import checks from .utils.functions import get_member from datetime import datetime class Logging(commands.Cog): def __init__(self, bot): self.bot = bot super().__init__() @comm...
# ***************************************************************** # Copyright (c) 2013 Massachusetts Institute of Technology # # Developed exclusively at US Government expense under US Air Force contract # FA8721-05-C-002. The rights of the United States Government to use, modify, # reproduce, release, perform, displ...
# -*- coding: utf-8 -*- # # Copyright (c) 2017-2018 Spotify AB # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
# Copyright 2018 <NAME>. 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 applicable law or agree...
# -*- coding: utf-8 -*- from binascii import unhexlify import gevent from gevent.lock import Semaphore from gevent.event import AsyncResult from ethereum import slogging from raiden import waiting from raiden.exceptions import DuplicatedChannelError from raiden.api.python import RaidenAPI from raiden.utils import pe...
import os import numpy as np import pandas as pd from scipy.stats import skew, kurtosis, mode # from constant import Constant from meta_feature_utils import sample_num_strategy # sample strategy import random import re import easyocr # pip install easyocr from mtcnn import MTCNN # pip install mtcnn # python -m pi...
#MIT License #Copyright (c) 2020 <NAME> #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 restriction, including without limitation the rights #to use, copy, modify, merge, publis...
import os import itertools from abc import ABC, abstractmethod from collections import namedtuple from math import log Run = namedtuple("Run", ["cross", "stats"]) def do_send(gen, past=None): """ Functions as `next' for value-accepting generators. """ try: cross = gen.send(past) except StopIt...
# Copyright 2022 IBM 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 in writing, ...
import re import logging import os import warnings import pandas as pd import torch from torch.utils.data import ( DataLoader, RandomSampler, SequentialSampler ) from torch.utils.data.distributed import DistributedSampler from torch.nn.utils.rnn import pad_sequence from torch.nn import CrossEntropyLoss fr...
from __future__ import print_function, division, absolute_import import subprocess import os import json from collections import OrderedDict import pytest from srl_zoo.utils import createFolder DEFAULT_ALGO = "ppo2" DEFAULT_ENV = "KukaButtonGymEnv-v0" DEFAULT_SRL = "supervised" NUM_ITERATION = 1 NUM_TIMESTEP = 1600...
#*- coding: utf-8 -*- import unittest from nose.tools import * from apps.oclib.client import Redis from apps.oclib.model import BaseModel from apps.oclib.model import UserModel from apps.oclib.model import TmpModel from apps.oclib.model import LogModel from apps.oclib.model import TopModel from apps.oclib.mo...
# Copyright 2015 <NAME> <<EMAIL>> # # 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...
# Copyright 2021 Northern.tech AS # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
# coding=utf-8 # Copyright 2021 The Circuit Training Team 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 ap...
# encoding: utf-8 """ @author: liaoxingyu @contact: <EMAIL> """ import torch from torch import nn import torch.nn.functional as F def normalize(x, axis=-1): """Normalizing to unit length along the specified dimension. Args: x: pytorch Variable Returns: x: pytorch Variable, same shape as input...
import sys import logging import time import shutil import string import random import copy import os import torch import torchvision from torch.utils.tensorboard import SummaryWriter from sklearn.model_selection import KFold sys.path.append('framework') from NetworkClass import Network from Pruning...
import pandas as pd def convert2plotdf(df): # convert the original spike df to one suitable for plot df_plot = df.set_index(['spike_id']).apply(pd.Series.explode).reset_index() df_plot = df_plot.apply(pd.to_numeric) #change all columns to numeric return df_plot import matplotlib.pyplot as plt impor...
import os import cv2 import glob import pickle import pandas as pd import xml.etree.ElementTree as ET from .utils import cache_result from . import config as cfg @cache_result(lambda path: 'cache/cached-' + os.path.basename(path) + '.pkl') def get_ground_truth(path): df = pd.read_csv(path) # remove acci...
import h2o from h2o.estimators import H2OGradientBoostingEstimator, H2OGeneralizedLinearEstimator from tests import pyunit_utils import os import sys from pandas.testing import assert_frame_equal TEMPLATE = """ import java.util.HashMap; import java.util.Map; import hex.genmodel.GenModel; import hex.genmodel.annotatio...
import struct def read_string(f, n=0): if n == 0: s = b'' while True: c = f.read(1) if c == b'\0': break s += c else: s = f.read(n) s = s.partition(b'\0')[0] try: s = s.decode('ascii') except: s = s.decode('latin-1') #FIXME: This is a poor fallback return s ...
# 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...
import torch, cv2 import numpy.random as random import numpy as np import dataloaders.helpers as helpers class ScaleNRotate(object): """Scale (zoom-in, zoom-out) and Rotate the image and the ground truth. Args: two possibilities: 1. rots (tuple): (minimum, maximum) rotation angle ...
# coding: utf-8 # In[134]: from __future__ import division, print_function import csv, itertools, os, sys, math from os.path import join from scipy.io import savemat, loadmat from scipy.ndimage import imread from scipy.misc import imresize from scipy.stats import entropy from experimenter.nets import caffenet, writ...
import os import re from imgaug import augmenters as iaa import imgaug as ia import tensorflow_addons as tfa import tensorflow as tf import numpy as np import argparse import yaml import shutil import cv2 from pathlib import Path try: AUTOTUNE = tf.data.AUTOTUNE except AttributeError: # tf < 2.4.0 AUTOTUNE...
# -*- coding: utf-8 -*- # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
import mmap from struct import unpack from datetime import datetime import argparse def parseTimestamp(ts_bytes): bytes_low = unpack('<L', ts_bytes[0:4])[0] bytes_high = unpack('<L', ts_bytes[4:8])[0] try: return str(datetime.utcfromtimestamp((float(bytes_high) * 2 ** 32 + bytes_low) * 1e-7 - 1164...
# -*- coding: utf-8 -*- import pytest from django.core.exceptions import ValidationError from django.apps import apps from django.db.models.fields.related import ForeignKey from django.db.models.fields.related_descriptors import ( ReverseManyToOneDescriptor, ForwardManyToOneDescriptor ) from rest_framework.se...
#!/usr/bin/env python # -*- coding:utf-8 -*- import PlayCards import itertools # 这个函数用于计算手牌中各种牌面的张数,接收一个手牌列表作为参数,返回一个记录各种牌面张数列表 def GetList_count(Cardlist=[]): list_count = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] for item in Cardlist: number = item[0] list_count[number] = list_count[num...
import json import sys import iotbx.phil from cctbx.miller.display import render_2d, scene from dials.util import Sorry from iotbx.gui_tools.reflections import get_array_description from iotbx.reflection_file_reader import any_reflection_file from scitbx.array_family import flex class MultiplicityViewPng(render_2d):...
# -*- coding: utf-8 ; test-case-name: bridgedb.test.test_persistent -*- # # This file is part of BridgeDB, a Tor bridge distribution system. # # :authors: <NAME> 0xA3ADB67A2CDB8B35 <<EMAIL>> # please also see AUTHORS file # :copyright: (c) 2013-2017 Isis Lovecruft # (c) 2007-2017, The Tor Project,...
""" Miscellaneous function (re)definitions from the Py3.3 standard library for Python 2.6/2.7. math.ceil collections.OrderedDict (for Python 2.6) collections.Counter (for Python 2.6) """ from math import ceil as oldceil from future.utils import iteritems, PY26 def ceil(x): """ Return the ceiling of ...
# ------------------------------------------------------------------------------ # Copyright IBM Corp. 2020 # # 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/licens...
# Copyright 2020-2021 Canonical 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 in writi...
# -------------------------------------------------------- # This code is modified from cuiyuhao1996's repository. # Licensed under The MIT License [see LICENSE for details] # https://github.com/cuiyuhao1996/mcan-vqa # -------------------------------------------------------- from model.modules.fusion.net_utils import ...
""" AI PROJECT 3 by <NAME> This project involves writing a genetic algorithm to find the maximum value of arbitrary functions. The functions will be represented in text files, which begin with a line with a single number, representing the number of variables in the function. Each variable is an intege...
#!/usr/bin/env python3 import argparse import configparser import copy import json import logging import os import re import sys from urllib.parse import urlparse import urllib3 from requests.exceptions import ConnectionError try: import consul except ImportError: sys.exit( """failed=True msg='python-...
# Copyright 2021 The Couler 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 applicable law or...
# -*- coding: utf-8 -*- """ Created on Tue Oct 23 11:13:23 2018 @author: XieTianwen """ import numpy as np from numpy import linalg import pdb # load vowel data stored in npy ''' NOTICE: labels of y are: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ''' x_test = np.load('x_test.npy') print('x_test\'s shape: {...
#!/usr/bin/env python # # Copyright 2007 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 o...
""" "Embed wizard" cog by GrumpiestVulcan Commissioned 2018-01-15 by Aeternum Studios POC: Aeternum#7967 (#173291729192091649) Ported to Redbot V3 by <NAME> """ __author__ = "<NAME> <<EMAIL>> (calebj#0001), Ported to Redbot V3 by <NAME>" __copyright__ = "Copyright 2018, Holocor LLC" __version__ = '1.5.2' f...
#!/usr/bin/env python # Copyright 2016 Google 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/licenses/LICENSE-2.0 # # Unless required...
# -*- coding: utf-8 -*- """Inception V1 model for Keras. Note that the input preprocessing function is different from the the VGG16 and ResNet models (same as Xception). Also that (currently) the output predictions are for 1001 classes (with the 0 class being 'background'), so require a shift compared to the other mode...
import logging import retrying import sdk_cmd import sdk_hosts from security import kerberos LOG = logging.getLogger(__name__) USERS = [ "client", "authorized", "unauthorized", "super" ] def get_service_principals(service_name: str, realm: str) -> list: """ Sets up the ap...
from __future__ import absolute_import """ Collection of physical constants and conversion factors. Most constants are in SI units, so you can do print('10 mile per minute is', 10*mile/minute, 'm/s or', 10*mile/(minute*knot), 'knots') The list is not meant to be comprehensive, but just a convenient list for every...
from Wolke import Wolke from EventBus import EventBus from Fertigkeiten import KampffertigkeitTyp class Choice(object): def __init__(self): super().__init__() self.name = "" self.wert = 0 self.typ = "Fertigkeit" self.kommentar = "" def toString(self, addEP = True): ...
from multiprocessing import Pool from functools import partial from contextlib import closing import argparse import numpy as np import pickle import glob import time import os parser = argparse.ArgumentParser() parser.add_argument('-pt', '--project_name', required=True, help='Name of the DD project') parser.add_argum...
# Copyright 2022 IBM Inc. All rights reserved # SPDX-License-Identifier: Apache2.0 # 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 ...
#! /usr/bin/env python3 # -*- coding: utf-8 -*- """ traceroute_history is a quick tool to make traceroute / tracert calls, and store it's results into a database if it differs from last call. Traceroute History user interface and API """ __intname__ = 'traceroute_history.user_interface' __author__ = '<NAME>' __cop...
import os import mariadb import pytest from ddtrace import Pin from ddtrace.constants import ANALYTICS_SAMPLE_RATE_KEY from ddtrace.contrib.mariadb import patch from ddtrace.contrib.mariadb import unpatch from tests.contrib.config import MARIADB_CONFIG from tests.utils import DummyTracer from tests.utils import asser...
#!/usr/bin/env python """WhisperDB Python Pandas Reader.""" import dataclasses import argparse from pathlib import Path from typing import List import numpy as np import pandas as pd __all__ = [ "WhisperFile", "WhisperFileMeta", "WhisperArchiveMeta", "print_meta", ] # Whisper file element formats # Se...
import copy import os import PIL import matplotlib.cm as mpl_color_map import numpy as np import torch class CamExtractor(): """ Extracts cam features from the model """ def __init__(self, model, target_layer): self.model = model self.target_layer = target_layer self.gradi...
import datetime from django.conf import settings from django.core.exceptions import NON_FIELD_ERRORS from django.utils.six import iteritems from google.appengine.api.datastore import Key, Delete, MAX_ALLOWABLE_QUERIES from google.appengine.datastore.datastore_rpc import TransactionOptions from google.appengine.ext im...
#!/usr/local/bin/python3.6 # vim: expandtab shiftwidth=4 # Copyright (C) 2019 National Institute of Informatics # # 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 own...
#!/usr/bin/env python3.7 ##### TODO ##### #? Clean up .venv and generate a decent `requirements.txt` #? Get what's worth from `wizard` branch and cherry pick these things, particularly the methods. #! UNDER NO CIRCUMSTANCES MERGE `wizard` IT"S TOO MESSY and cumbersome. #? Check if there's anything else on `single_in...
import sys import os import file_io import user_io import module_set as ms import module_info as info # Whether there is a module set currently loaded loaded = False # The currently loaded module set current_set = dict() def load_mod_set(name): # Check file actually exists filepath = file_io.get_filepath(name...
# Copyright 2019-2021 AstroLab Software # Author: <NAME> # # 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 l...