text stringlengths 6.04k 39.5k |
|---|
import sys
def full_lockdown(e):
e.remove_all_measures()
e.add_closure("school", 0)
e.add_closure("leisure", 0)
e.add_partial_closure("shopping", 0.8)
# mimicking a 75% reduction in social contacts.
e.add_social_distance_imp9()
e.add_work_from_home()
e.add_case_isolation()
e.add_household_isolation()... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © Her Majesty the Queen in Right of Canada, as represented
# by the Minister of Statistics Canada, 2019.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ... |
"""
This file contains definitions for useful metrics in specific **REP** format.
In general case, metrics follow standard sklearn convention for **estimators**, provides
* constructor (you should create instance of metric!):
>>> metric = RocAuc(positive_label=2)
* fitting, where checks and heavy computa... |
import json
import re
from concurrent.futures.thread import ThreadPoolExecutor
from itertools import repeat
from urllib.parse import urlencode, urljoin
from mopidy_youtube import logger
from mopidy_youtube.apis.json_paths import (
deep_search,
continuationItemsPath,
# listChannelPlaylistsPath,
listPlay... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# external libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
import pandas
from dtk import process
# debugging
try:
from IPython.core.debugger import Tracer
except ImportError:
pass
else:
set_trace = Trace... |
# -*- coding: utf-8 -*-
"""Useful functions for the pke module."""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
import csv
import math
import glob
import pickle
import gzip
import json
import codecs
import logging
from collections ... |
#!/usr/bin/env python
__author__ = '<NAME>, <NAME>, <NAME>'
import ast
import os
import re
import inspect
from collections import OrderedDict, Mapping, Iterable
from pyon.util.log import log
from pyon.core.exception import BadRequest
BUILT_IN_ATTRS = {'_id', '_rev', 'type_', 'blame_'}
# Validation decorators
DECO_... |
# -*- coding: utf-8 -*-
#
from collections import deque, namedtuple
from blessed import Terminal
try:
unichr
except NameError:
unichr = chr
# "graphic" elements
border_bl = u'└'
border_br = u'┘'
border_tl = u'┌'
border_tr = u'┐'
border_h = u'─'
border_v = u'│'
hbar_elements = (u"▏", u"▎", u"▍", u"▌", u"▋",... |
# -*- coding: utf-8 -*-
""".. moduleauthor:: <NAME>"""
from dataclasses import dataclass
from typing import Dict, Callable, Tuple, Optional, Union, Type, Final, final
from bann.b_container.functions.check_arg_complex import check_arg_tuple_or_scalar_single
from bann.b_container.functions.dict_str_repr import dict_json... |
# coding=utf-8
from sys import version_info
from unittest import TestCase
import sys
from nose import SkipTest
from nose.tools import eq_, assert_raises, ok_
from six import text_type
from parsimonious.exceptions import UndefinedLabel, ParseError
from parsimonious.expressions import Literal, Lookahead, Regex, Sequen... |
from data_science_utils import dataframe as utils
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import matplotlib as mplt
import matplotlib.pyplot as plt
from sklearn.preprocessing import RobustScaler
from sklearn.preprocessing import MinMaxScaler
import mat... |
# -*- coding: utf-8 -*-
"""
Tests of neo.io.klustakwikio
"""
# needed for python 3 compatibility
from __future__ import absolute_import
import glob
import os.path
import sys
import tempfile
import unittest
import numpy as np
import quantities as pq
import neo
from neo.test.iotest.common_io_test import BaseTestIO
f... |
# -*- coding: utf-8 -*-
#
# ramstk.views.gtk3.desktop.py is part of The RAMSTK Project
#
# All rights reserved.
# Copyright 2007 - 2020 <NAME> doyle.rowland <AT> reliaqual <DOT> com
"""The RAMSTK GTK3 basebook."""
# Standard Library Imports
import locale
from typing import List, TypeVar
# Third Party Imports
# ... |
import os, sys, logging
import argparse as ap
# ------------------------------------
# Main function
# ------------------------------------
# there is a bug in add_argument(required=True), for hacking, don't set metavar='' when required=True,
# or args = argparser.parse_args() will throw bugs!!!
__version__ = '0.... |
#!/usr/bin/env python3
import copy
import os
import shlex
import shutil
import sys
import re
import time
from optparse import OptionParser
from subprocess import Popen, PIPE, TimeoutExpired
g_golden_err_msg = ""
g_golden_exit_code = 0
g_golden_runtime = 0
g_options = object
g_outfile = ""
g_tmpfile = "/tmp/ddmbt-" + ... |
#!/usr/bin/env python3
# Software License Agreement (BSD License)
#
# Copyright (c) 2021, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain... |
import numpy as np
import copy
import scipy.signal as ss
class Node(object):
def __init__(self, state):
"""
:param state: np.array nrow*ncolumn
author: weiwei
date: 20190828, 20200104
"""
self.state = copy.deepcopy(state)
self._nrow, self._ncolumn = self.sta... |
# Copyright 2014-2015 Insight Software Consortium.
# Copyright 2004-2008 <NAME>.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt
import os
import time
from . import source_reader
from . import declarations_cache
import pygccxml.declarations
from .. import utils
... |
#! /usr/bin/env python
from __future__ import print_function, division
def do_scf(inp):
'''Do the requested SCF.'''
from pyscf import gto, scf, dft, cc, fci, ci, ao2mo, mcscf, mrpt, lib, mp, tdscf
from pyscf.cc import ccsd_t, uccsd_t
import numpy as np
from .fcidump import fcidump
# sort out ... |
'''
Descripttion: test the model
version: 1.0
Author: Assassin 567
Date: 2021-11-03 10:40:02
LastEditors: Hello KG
LastEditTime: 2021-11-06 11:16:43
'''
import os
import sys
import argparse
import time
from collections import defaultdict
import numpy as np
import torch
from torch.utils.data import DataLoader
from tqd... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Utilities related to wavelength bin calculations."""
# THIRD-PARTY
import numpy as np
# ASTROPY
from astropy import units as u
# LOCAL
from . import exceptions
__all__ = ['calculate_bin_edges', 'calculate_bin_widths',
'calculate_bin_cente... |
# Copyright 2011-2015 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
# Copyright 2013-2015 <NAME>, <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 law or agreed to in w... |
# Copyright 2017 Neural Networks and Deep Learning lab, MIPT
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
"""
tf2onnx.shape_inference - shape inference function for tf2onnx
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
from distutils.ve... |
# Copyright 2019-2020 ETH Zurich and the DaCe authors. All rights reserved.
from copy import deepcopy as dc
from typing import Any, Dict, Optional
from dace.data import Array
from dace.symbolic import symstr
from dace.properties import Property
import dace.library
import dace.sdfg.nodes
from dace.transformation.pattern... |
# -*- coding: utf-8 -*-
import cachetools.func
from gatilegrid import getTileGrid
from sqlalchemy import Column, Unicode, Integer, Boolean, DateTime, Float
from sqlalchemy.dialects import postgresql
from sqlalchemy.exc import SQLAlchemyError
from chsdi.lib.helpers import make_agnostic, shift_to
from chsdi.models im... |
r"""
YOLOv5 v6.0.
Add in 2022.03.04.
Upgrade in 2022.03.22.
"""
import torch
import torch.nn as nn
from utils.log import logging_initialize
from utils.decode import parse_outputs_yolov5
from models.units import Conv, C3, SPPF
from models.model_utils import init_weights
from metaclass.metamodel import MetaModelDetect
... |
import time
import torch
import torch.distributed as dist
import numpy as np
from hparams import HParams
import torch_optimizer as optim
try:
from .schedules import LogisticBetaSchedule, NoamSchedule, \
NarrowExponentialDecay, ConstantLearningRate, GammaSchedule, LinearBetaSchedule, NarrowCosineDecay
f... |
# Copyright 2019 the ProGraML authors.
#
# Contact <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 a... |
"""
CmdStan arguments
"""
import os
import numpy as np
from numbers import Integral, Real
from typing import List, Union
from cmdstanpy.utils import read_metric
class SamplerArgs(object):
"""Arguments for the NUTS adaptive sampler."""
def __init__(
self,
warmup_iters: int = None,
sam... |
# --------------------------------------------------------------------------
# Source file provided under Apache License, Version 2.0, January 2004,
# http://www.apache.org/licenses/
# (c) Copyright IBM Corp. 2015, 2019
# --------------------------------------------------------------------------
'''Provides utility fun... |
import matplotlib.pyplot as plt
import mplfinance as mpf
import streamlit as st
#import yfinance as yf
import akshare as ak
import pandas as pd
import numpy as np
import time, os, sys
import tushare as ts
from datetime import datetime, date, timedelta
from tradingScan import TradingScan
from tradingConfig import Tradin... |
from operator import index
from utility import *
import numpy as np
import tqdm
from net import Network
import json
from joblib import Parallel, delayed
import numpy as np
import os
from collections import OrderedDict
import random
import itertools as it
# split a dataset into a train and validation set
def holdout_v... |
import re
import os
from bs4 import BeautifulSoup as bs
import json
from unidecode import unidecode
class Page:
def __init__(self, title, auto_images=False, img_class='character', source=''):
self.title = title
self.source = source
self.url = remove_articles(self.title).split()[0].lower()... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
"""Common grow utility functions."""
import csv as csv_lib
import fnmatch
import functools
import gettext
import json
import logging
import os
import re
import string
import sys
import threading
import time
import urllib
import yaml
import bs4
import html2text
import translitcodec # pylint: disable=unused-import
from... |
load("@build_bazel_rules_nodejs//internal/common:node_module_info.bzl", "NodeModuleInfo", "NodeModuleSources", "collect_node_modules_aspect")
# load("@build_bazel_rules_typescript//internal:common/compilation.bzl", "COMMON_ATTRIBUTES", "DEPS_ASPECTS", "compile_ts", "ts_providers_dict_to_struct")
# load("@build_bazel_r... |
# -*- coding: utf-8 -*-
from django.contrib import messages
from django.contrib import admin
from django.db import models
from django.http import HttpResponseRedirect, HttpRequest
from django.forms import Textarea
from django.utils import timezone as tz
from rangefilter.filter import DateRangeFilter
from app.constants... |
"""Core components of the MorphoCut processing graph."""
import inspect
import itertools
import operator
from abc import ABC, abstractmethod
from collections import abc
from contextlib import contextmanager
from functools import wraps
from typing import (
Any,
Callable,
Dict,
Generic,
Iterator,
... |
#!/usr/bin/env python
# coding:utf-8
# Code by : <NAME>
# E-mail : <EMAIL>
"""
#set:usage.py,examples.py,screenshots.md,changelog.txt
##################################################################
# USAGE :
#s
import yasserbdj96
#e
##################################################################
# EX... |
#reproducability
from numpy.random import seed
seed(1+347823)
import tensorflow as tf
tf.random.set_seed(1+63493)
import numpy as np
import os
import pandas as pd
import datetime
from matplotlib import pyplot
from sklearn.preprocessing import MinMaxScaler
from uncertainties import unumpy
gpus = tf.config.experimenta... |
from numbers import Number
from types import MappingProxyType
from typing import Any, Callable, Collection, Dict, Literal, Mapping, Optional, Sequence, Union
import numpy as np
import scanpy as sc
from anndata import AnnData
from scanpy._utils import AnyRandom
from scipy.sparse import spmatrix
def log1p(
X: Unio... |
# -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Crisis Mapping Toolkit (CMT) v1 platform is licensed under the Apache
#... |
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more informations
# Copyright (C) <NAME> <<EMAIL>>
# This program is published under a GPLv2 license
"""
Main module for interactive startup.
"""
from __future__ import absolute_import
from __future__ import print_function
import sys
import ... |
#!/usr/bin/python3
"""
Yet another bash/zsh prompt script
Here we have yet another script for Git-aware customization of the command
prompt in Bash and zsh. Unlike all the other scripts, I wrote this one, so
it's better.
Features:
- lets you know if you have mail in ``$MAIL``
- shows chroot, `virtualenv <https://vi... |
import numpy as np
import scipy as sp
import pandas as pd
import numbers
from typing import Callable, List, Union
import logging
from .base import Epsilon
from ..distance import SCALE_LIN
from ..sampler import Sampler
from ..storage import save_dict_to_json
logger = logging.getLogger("Epsilon")
class TemperatureBas... |
#<NAME> and <NAME> 2020
import abc
# import tensorflow as tf
import numpy as np
# import matplotlib as mpl
# mpl.use('TKAgg')
import matplotlib.pyplot as plt
from PIL import Image
from numpy.fft import ifftshift
import fractions
# import layers.optics_no_transpose as optics
#import optics_no_transpose as optics
from ... |
import bisect
import numpy as np
from . import orbit_plot
import os
import scipy.fftpack
import scipy.signal
import sys
import time
from . import util
import vorpy
import vorpy.pickle
import vorpy.symplectic_integration
class ShootingMethodObjective:
def __init__ (self, *, dynamics_context, preimage_qp_0=None, qp_... |
#!/usr/bin/env python
import sys
import time
import traceback
import itertools
import socket
import os
import json
import threading
from queue import Queue
import random
def randString(length=6):
st = ""
for i in range(length):
st += random.choice("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0... |
from os import listdir
from os.path import isfile, join
import os
import numpy as np
import madmom
import time
from madmom.audio.filters import LogarithmicFilterbank
from madmom.features.beats import RNNBeatProcessor
from madmom.features.downbeats import RNNDownBeatProcessor, DBNDownBeatTrackingProcessor
from madmom.... |
# Copyright (c) 2017, IGLU consortium
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice,
# this list of conditions ... |
import os
import pickle
import re
import time
def buscar_en_texto(texto, lista=[], sep=None):
"""
Determina si por lo menos un elemento de una lista de términos o \
expresiones específica está presente en un texto de entrada.
:param texto: (str). Texto en el que se desea hacer la búsqueda.
:p... |
"""
CNN & FCN models for HSI classfication
@author: lzm
"""
from __future__ import print_function
import os
import numpy as np
import h5py
import Utils
from keras.models import Sequential, Model, load_model
from keras.layers import Dense, Dropout, Activation, Flatten, Input, merge, Reshape
from keras.layers import Co... |
"""
HUMAnN2: config module
Configuration settings
Copyright (c) 2014 Harvard School of Public Health
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 limitat... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""
Auditd... |
import asyncio
import json
import logging
from inspect import isawaitable
from typing import (
Any,
AsyncGenerator,
Awaitable,
Callable,
Dict,
List,
Optional,
Sequence,
Type,
Union,
cast,
)
import graphene
from graphql import (
ExecutionContext,
ExecutionResult,
... |
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
import datetime as dt
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter, SUPPRESS
import csv
import os.path
from download import download
from tools import convert_currency, extract_hierarchical_info
from plotting import *
impor... |
# 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
__a... |
import inspect
import re
import sys
from typing import (
Any,
Callable,
Dict,
Iterable,
List,
NamedTuple,
Optional,
Set,
Type,
TypeVar,
Union,
)
from pathlib import Path
from types import ModuleType
from collections import UserDict
from importlib import import_module
from pkg... |
__author__ = 'koitaroh'
# convert_estimation_to_geojsonj.py
# Last Update: 2016-12-30
# Author: <NAME>
# <EMAIL>
import csv
import datetime
import logging
import os
import pickle
import json
import geopy
import numpy
import pandas
import geojson
from geojson import Polygon, Feature, Point, FeatureCol... |
import traceback
from collections import namedtuple
import logging
import random
import attr
from .. import entities, PlatformException, repositories, services, exceptions
from .label import Label
logger = logging.getLogger(name=__name__)
class LabelHandlerMode:
ADD = "add"
UPDATE = "update"
UPSERT = "... |
""" SNMPv2_TC
"""
from collections import OrderedDict
from ydk.types import Entity, EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YList, LeafDataList, Bits, Empty, Decimal64
from ydk.filters import YFilter
from ydk.errors import YError, YModelError
from ydk.errors.error_handler import handle_type_error as _h... |
import json
import os
import errno
from copy import deepcopy
import secrets
from datetime import datetime
from enum import Enum
import queue
from .settings import *
from .Map import *
from .Player import *
from .Logger import *
from .Bomb import *
MAX_LEGAL_MOVE = 9
class Action(Enum):
left = 0
right = 1
... |
import copy
import SimEngine.Mote.MoteDefines as d
from SimEngine import SimLog
import tests.test_utils as u
from SimEngine.Mote.rpl import RplOFBestLinkPDR
# =========================== helper functions =========================================
def check_all_nodes_send_x(motes, x):
senders = list(set([
... |
from itertools import product
import numpy as np
from numba import njit
class Reader:
'''
Model reader. The general usage pattern is to instantiate a reader with a
particular lexicon and perceptual filter, and then study how the reader
performs. The main methods are read(), test(), uncertainty(), and
p_word_gi... |
import numpy as np
import cv2 as cv
from copy import deepcopy as dp
import os
from psmnet.submission import PSMNet
class DynaSeg():
def __init__(self, iml, coco_demo, feature_params, disp_path, config, paraml, lk_params, mtx, dist, kernel, loadmodel):
self.h, self.w = iml.shape[:2]
self.coco = coc... |
import enum
import os
import lark # type: ignore
import logging
import pathlib
import subprocess
from . import configuration
from . import editor
from . import qemu
from . import store
from . import utils
from . import ssh
from typing import (
Sequence,
Callable,
List,
Optional,
TypeVar,
Type... |
# -*- coding: utf-8 -*-
import shutil
import sys
import os
import subprocess
import logging
from time import time as epoch
from datetime import datetime
from abc import ABCMeta, abstractmethod
from shlex import quote as escape
import copy
import dill
from clustertools.util import catch_logging
from .state import Pend... |
# coding=utf-8
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... |
#!/usr/bin/env jupyter-console
from sklearn.experimental import enable_iterative_imputer # noqa
from sklearn.experimental import enable_hist_gradient_boosting # noqa
from sklearn.preprocessing import OneHotEncoder, OrdinalEncoder, StandardScaler
from sklearn.pipeline import make_pipeline
from sklearn.model_selection ... |
# -*- coding: utf-8 -*-
"""This module contains all tests.
"""
import abc
from collections import defaultdict
import logging
from pailab.ml_repo.repo_objects import RepoInfo, RepoObject
from pailab import repo_object_init, MLRepo, RepoInfoKey, MLObjectType, MeasureConfiguration
from pailab.ml_repo.repo_store import ... |
import time
import random
from agentos_2048 import AgentOS2048
from agentos_2048 import Direction
def test_boardenv_random_direction():
for _ in range(50):
assert random.choice(AgentOS2048.action_space) in Direction
def test_boardenv_init():
game = AgentOS2048()
nonzero = [v for v in game.board ... |
import random
import math
import numpy as np
import cv2
import matplotlib
import matplotlib.pyplot as plt
from skimage.morphology import skeletonize
from skimage import img_as_ubyte
#key: row and column of the neighbouring pixels, value: the amount to be added to the central pixel -> h,wpl.,
delta = {(0,0): (-1,-1),... |
# -*- coding: utf-8 -*-
"""
Created on Sat May 15 09:50:24 2021
@author: <NAME> -Spatial structure index value distribution of urban streetscape
"""
import glob, os
import pickle
from database import postSQL2gpd,gpd2postSQL
import numpy as np
class feature_builder_BOW:
'''
class - 根据所有图像关键点描述子聚类建立图像视觉词袋,获取每一图... |
from fastapi.responses import HTMLResponse, JSONResponse, RedirectResponse
from sqlalchemy import select, MetaData, create_engine, Table, func, not_
from .config import ORIGINS, DATABASE_URL, ROOT_ID, HELP_PATH, SITE_URL
from fastapi import Depends, FastAPI, Request, HTTPException, Query
from fastapi.middleware.cors im... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
clean_html,
ExtractorError,
js_to_json,
base_url,
url_basename,
urljoin,
)
class RCSBaseIE(InfoExtractor):
_ALL_REPLACE = {
'media2vam.corriere.it.edgesuite.n... |
import os
import sys
CUR_DIR = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(CUR_DIR, "../CGNet"))
import numpy as np
import logging
import torch
import torch.nn as nn
import torch.nn.functional as Func
import torch.optim as optim
import argparse
import time
import datetime
import csv
from ... |
#!/usr/bin/env python3
#
# VOEvent Generator
import os
import yaml
import multiprocessing as mp
import subprocess
from queue import Empty
from time import sleep
import numpy as np
import socket
from multiprocessing.managers import BaseManager
from astropy.coordinates import SkyCoord
import astropy.units as u
import as... |
# -*- coding: utf-8 -*-
# vscode-fold=1
import dis, sys, inspect, trace
from linecache import getline
from ipdb import set_trace as st
from itertools import tee
from pathlib import Path
from types import GeneratorType
import inspect, ctypes
from pygments import highlight
from pygments.lexers import Python3Lexer
from py... |
# Copyright 2021 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... |
#!/usr/bin/env python
# Import libraries
import argparse
import json
import random
import re
import textwrap
# Global variables
name = "NN Trainer"
ver = "0.1"
sep = ""
# Parse command line arguments
def parseArgs ():
parser = argparse.ArgumentParser(
formatter_class = argparse.RawDescriptionHelpForm... |
__all__ = [
'plot_model_graph',
'plot_label_pie',
'plot_parallel_coordinates',
'plot_density',
'plot_cats_density',
'plot_confusion_matrix',
'get_metrics_df',
'get_coverage_df',
]
from typing import List, Tuple, Union
import numpy as np
import pandas as pd
from pandas.api.types import ... |
"""
Utilities for generating pdf files via Reportlab.
"""
import itertools
import six
from reportlab.platypus import Table
from reportlab.lib import colors
from testplan.common.utils.comparison import is_regex
from testplan.common.exporters import constants
# If you increase this too much Reportlab starts having... |
import sys, os, time
import numpy as np
from .mytools.MinTree import MinTree
from .._model import DMmodel
from ...util.basicutil import param_default
from ...backend import STensor
def del_block(M, rowSet ,colSet):
M = M.tolil()
(rs, cs) = M.nonzero()
for i in range(len(rs)):
if rs[i] in rowSet o... |
from PIL import Image
import os
import numpy as np
import time
import imageio
import random
###
#the 2d world model
#parses a world, supports moving within, pathfinding, and modifying the world
###
#for parsing input world
BLOCK_IND = {
(0,0,0):'wall',
(127,127,127):'stone',
(255,0,0):'iron ore',
(23... |
# -*- coding: utf-8 -*-
"""
Coordinate Transformation Functions
This module contains the functions for converting one
`sunpy.coordinates.frames` object to another.
.. warning::
The functions in this submodule should never be called directly, transforming
between coordinate frames should be done using the ``.tran... |
import math
from functools import partial
import tensorflow as tf
from tensorflow.keras import backend as K
from utils.utils_bbox import get_anchors_and_decode
def box_ciou(b1, b2):
"""
输入为:
----------
b1: tensor, shape=(batch, feat_w, feat_h, anchor_num, 4), xywh
b2: tensor, shape=(... |
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Dict, Generic, TypeVar, List, Any, Optional, get_args, Type, Union
import inspect
import time
import logging
import os
import socket
import json
from xmlrpc.client import SERVER_ERROR
import yaml
from pathlib import Path, PurePath
... |
################################################################################
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your op... |
"""
This file defines 8 mixtures that we used in the T-Zero paper:
- t0_train: T0 training mixture
- t0+_train: T0+ training mixture
- t0++_train: T0++ training mixture
- t0_eval_score_eval: T0 main evaluation mixture (Figure 4 for instance)
- t0_train_score_eval: Evaluation mixture for checkpoint selection on T0 (vali... |
from hparams import hparams
import argparse
import os
import time
import traceback
from datetime import datetime
import infolog
import numpy as np
import tensorflow as tf
from datasets import audio
from hparams import hparams_debug_string
from feeder import Feeder
from models import create_model
from utils import Value... |
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
# Copyright 2017 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.apach... |
import matplotlib as mpl
import matplotlib.pyplot as plt
import model
import numpy as np
import os
import training_data
STYLE_COMMON_RELATIVE_PATH = "styles/common.mplstyle"
STYLE_PAPER_RELATIVE_PATH = "styles/paper.mplstyle"
STYLE_PRESENTATION_RELATIVE_PATH = "styles/presentation.mplstyle"
STYLE_COMMON = os.path.join... |
# -*- coding: utf-8 -*-
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import os
import sys
from tqdm import tqdm
from modules import transformer
from modules.embedding import gen_new... |
# Construyendo el analizador léxico
import ply.lex as lex
from lex import *
from type_checker import *
lexer = lex.lex()
type_checker = TypeChecker()
# Asociación de operadores y precedencia
precedence = (
('left','CONCAT'),
('left','MENOR','MAYOR','IGUAL','MENORIGUAL','MAYORIGUAL','DIFERENTE'),
('left','M... |
# Copyright 2021 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
# -*- coding: utf-8 -*-
import os
import sys
import json
import itertools
from tqdm import tqdm
from collections import defaultdict
import numpy as np
from scipy.spatial import ConvexHull
from kanapy.input_output import read_dump, write_output_stat
def points_in_convexHull(Points, hull):
"""
Determines whet... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 5 14:44:29 2018
@author:
Dr. <NAME>
European Space Agency (ESA)
European Space Research and Technology Centre (ESTEC)
Keplerlaan 1, 2201 AZ Noordwijk, The Netherlands
Email: <EMAIL>
GitHub: mnguenther
Twitter: m_n_guenther
Web: www.mnguenther.com
"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.