text stringlengths 6.04k 39.5k |
|---|
#!/usr/bin/env python3
from __future__ import annotations
import logging
import multiprocessing
import os
import re
import shutil
import subprocess
import tempfile
import time
from dataclasses import dataclass
from os.path import join as pjoin
from pathlib import Path
from types import TracebackType
from typing impor... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import importlib
import json
import requests
import re
import collections
import os
import copy
from django.db import models, router, connections
from django.conf import settings
from django.contrib.auth.models import User
from django.db.... |
# Copyright 2017-2019 TensorHub, 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 writ... |
# coding=utf-8
# Copyright 2020 The Tensor2Tensor 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... |
import _pickle
import os
import numpy as np
DEFAULT_PADDING_LABEL = '<pad>' # dict index = 0
DEFAULT_UNKNOWN_LABEL = '<unk>' # dict index = 1
DEFAULT_RESERVED_LABEL = ['<reserved-2>',
'<reserved-3>',
'<reserved-4>'] # dict index = 2~4
DEFAULT_WORD_TO_INDEX = {DE... |
import os
import re
from abc import ABCMeta
from contextlib import contextmanager
from collections import defaultdict
from io import BytesIO, StringIO
try:
from urlparse import urlparse, parse_qs
except ImportError:
from urllib.parse import urlparse, parse_qs
try:
import pathlib
from pathlib import _... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Run a YOLO_v3 style detection model on test images.
"""
import colorsys
import os
from timeit import default_timer as timer
from tqdm import tqdm
import tensorflow as tf
from keras.backend.tensorflow_backend import set_session
config = tf.ConfigProto()
config.gpu_op... |
# Copyright 2016-2017 FUJITSU LIMITED
# 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 requi... |
#!/usr/bin/python
# Copyright (c) 2020, 2022 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 traceback
from PIL import Image, ImageEnhance, ImageFont, ImageDraw
import time
import sys
from ImageCreator.core.utils import *
from ImageCreator.core import assets_directory
sys.path.append(assets_directory)
try:
from Assets.fonts._fonts import *
except ModuleNotFoundError:
pass
class Cr... |
#!/usr/bin/env python
"""gevent build & installation script"""
from __future__ import print_function
import sys
import os
import re
import shutil
import traceback
from os.path import join, abspath, basename, dirname
from subprocess import check_call
from glob import glob
PYPY = hasattr(sys, 'pypy_version_info')
WIN =... |
from __future__ import absolute_import
import hyperopt
import mjolnir.spark
import mjolnir.training.hyperopt
from mjolnir.training.tuning import make_cv_objective, ModelSelection
import numpy as np
import py4j
import pyspark
import pyspark.sql
from pyspark.sql import functions as F
import tempfile
def prep_training(d... |
########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... |
#!/usr/bin/env python3
#
# Copyright (c) 2013-2016, ETH Zurich.
# All rights reserved.
#
# This file is distributed under the terms in the attached LICENSE file.
# If you do not find this file, copies can be found by writing to:
# ETH Zurich D-INFK, Universitaetstr. 6, CH-8092 Zurich. Attn: Systems Group.
# Import gra... |
#!/usr/bin/python3
#
# Copyright (c) 2015, Intel Corporation
#
# 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 condit... |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team. 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/LI... |
import os
from torch.utils.data.sampler import SubsetRandomSampler
from torch.utils.tensorboard import SummaryWriter
import random
random.seed(0)
from random import shuffle
import json
import copy
import torch
import time
import argparse
import torch.optim as optim
from torch.nn.utils.rnn import pad_sequence
from auto... |
#!/usr/bin/env python
import argparse
import glob
import itertools
import seaborn as sns
import matplotlib; matplotlib.use('agg')
import matplotlib.pyplot as plt
import os
import pandas as pd
import argparse
def parse_results(file_content, sp_idx, method_name):
results = []
lines = file_content.split('\n')
... |
import itertools
import os
import typing
from abc import ABC, abstractmethod
import cfg_exporter.tables.base.rule as rule
import cfg_exporter.util as util
from cfg_exporter import AnyType, Iter
from cfg_exporter.const import DataType, DATA_TYPE_DETAIL_SPLIT
from cfg_exporter.tables.base.rule import KeyRule, ConstRule,... |
import abc
from collections import defaultdict
from dataclasses import dataclass, field, replace
from typing import ClassVar, Dict, List, Optional, TypeVar
from .error import DecompFailure, static_assert_unreachable
from .flow_graph import (
ArchFlowGraph,
BaseNode,
FlowGraph,
InstrRef,
Instruction... |
import warnings
from datetime import datetime
from typing import Any, Callable, List, NamedTuple, Optional, Union, cast
import pendulum
from dagster import check
from dagster.core.definitions import GraphDefinition, PipelineDefinition
from dagster.core.definitions.sensor_definition import (
DefaultSensorStatus,
... |
import rl
import keras
from keras import backend as K
import matplotlib.pyplot as plt
import matplotlib.animation
import cv2
import numpy as np
import os
import json
import time
import enum
import tempfile
from .common import InputType, LstmType, LoggerType
class ConvLayerView(rl.callbacks.Callback):
def __init... |
''' FSL IO '''
from __future__ import with_statement
import os
from os.path import join as pjoin
from subprocess import Popen,PIPE
import numpy as np
import numpy.linalg as npl
from numpy import newaxis
from scipy.ndimage import map_coordinates as mc
from scipy.ndimage import affine_transform
from dipy.io.dpy impor... |
import argparse
import configparser
import datetime
import logging
import os
import os.path
import re
import shutil
import sys
import time
from logging.handlers import RotatingFileHandler
from mimetypes import guess_type
import requests
from requests.compat import urljoin, quote_plus
from requests_toolbelt import Mult... |
#!/usr/bin/env python
"""
Utility for identifying the transform between different
channels in a multi-channel data set.
This assumes that each channel is it's own movie and
that the localizations in the channel have been
identified with a tool like 3D-DAOSTORM.
This only identifies a first order mapping between the
... |
import sys
from threading import Lock
#from typing import Union
from ._cffi_ppmd import ffi, lib
__all__ = (
"Ppmd7Encoder",
"Ppmd7Decoder",
"Ppmd8Encoder",
"Ppmd8Decoder",
"PpmdError",
"PPMD8_RESTORE_METHOD_RESTART",
"PPMD8_RESTORE_METHOD_CUT_OFF",
)
PPMD8_RESTORE_METHOD_RESTART = 0
PPMD... |
import json
import web3
import solc
import math
from web3 import Web3, HTTPProvider, TestRPCProvider
from solc import install_solc, compile_source, compile_files
# Note: py-solc only supports up to 0.4.17
# Note: Below line will install Solc v0.4.17
# install_solc('v0.4.17')
from web3.contract import ConciseContract
fr... |
# encoding: utf-8
"""Unit test suite for docxx.image.tiff module"""
from __future__ import absolute_import, print_function
import pytest
from docxx.compat import BytesIO
from docxx.image.constants import MIME_TYPE, TIFF_TAG
from docxx.image.helpers import BIG_ENDIAN, LITTLE_ENDIAN, StreamReader
from docxx.image.tif... |
from datetime import datetime
from dateutil.tz import tzlocal
from collections import Iterable
from warnings import warn
import copy as _copy
from .form.utils import docval, getargs, fmt_docval_args, call_docval_func, get_docval
from .form import Container
from . import register_class, CORE_NAMESPACE
from .base impor... |
import os, sys, random, time
import pygame as pg
import colors
import constants
import sounds
import graphics
""" Initialize the pygame engine """
pg.mixer.pre_init(44100, -16, 2, 512) # Solved sound delay issue
pg.mixer.init()
pg.init()
""" Create window and render Screen surface """
clock = pg.time.Clock()
flags ... |
import ivy
import inspect
import importlib
import functools
import numpy as np
from types import ModuleType
from typing import Callable, Optional, List, Union
wrapped_modules_n_classes = []
NON_WRAPPED_FUNCTIONS = [
"copy_nest",
"current_backend",
"current_backend_str",
"set_backend",
"get_backend... |
# Passwordmanager with tkinter-GUI
# Version: 30.09.2021
# author: fredsta
import time
from tkinter import *
from tkinter import messagebox, filedialog
from passwd_gen import *
from cryptography.fernet import Fernet
from transfer import transfer
key_string, fernet = None, None
# Class for the whole application
clas... |
import numpy as np
import sys
import os
import torch
import floris.tools as wfct
# To import the model, need to append the main folder to the run
# i.e. sys.path.append(path_to/acse20-acse9-finalreport-acse-jtb20)
# This works automatically on every system
sys.path.append(os.path.abspath(
os.path.dirname(os.path.a... |
# -*- coding: utf-8 -*-
# Copyright © 2012-2013 <NAME>, <NAME> and others.
# 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 t... |
from __future__ import division
from __future__ import print_function
import time
import numpy as np
from scipy.ndimage.filters import gaussian_filter1d
import dsp
import led
import microphone
from config import CONFIGS
_time_prev = time.time() * 1000.0
"""The previous time that the frames_per_second() function was... |
import numpy as np
from pathlib import Path
import pandas as pd
import pytest
import time
import xarray as xr
from repurpose.img2ts import Img2Ts
from qa4sm_preprocessing.nc_image_reader.readers import (
DirectoryImageReader,
XarrayImageStackReader,
XarrayTSReader,
GriddedNcOrthoMultiTs,
)
from qa4sm_... |
import uuid
from django.shortcuts import get_object_or_404
from projects.models import Bus, AssetType, Scenario, ConnectionLink, Asset
import json
from django.core.exceptions import NON_FIELD_ERRORS, ValidationError
from projects.forms import AssetCreateForm, BusForm, StorageForm
# region sent db nodes to js
from proje... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
import argparse
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torchvision.transforms as transforms
from torch.autograd import Variable
from data import WIDE... |
# 'branches.py' finds and measures the length and shapes of branches in from a
# given constructed MST.
import os
import sys
dir_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(dir_path[:-3] + '/coordinates/')
import numpy as np
import coordinate_utility
def get_branch_index(edge_index, edge_deg... |
import gym
import numpy as np
import itertools as it
import matplotlib.pyplot as plt
from gym import spaces
from gym.utils import seeding
from mdp_extras import *
from unimodal_irl.sw_maxent_irl import maxent_path_logprobs
class ElementWorldEnv(gym.Env):
"""ElementWorld Environment
- The actions are (up, ... |
from django.utils.translation import pgettext_lazy
from enumfields import Enum
class Classification(Enum):
"""
In Finnish: Julkisuusluokka
"""
PUBLIC = 'public'
CONFIDENTIAL = 'confidential'
OFFICIAL = 'official'
class Labels:
PUBLIC = pgettext_lazy('Classification', 'Public')
... |
import os
import tempfile
import mock
from . import utils
from hotsos.plugin_extensions.kernel import (
summary,
memory,
log_event_checks,
)
from hotsos.core.config import setup_config
from hotsos.core.issues.utils import IssuesStore
from hotsos.core.plugins.kernel import SystemdConfig
from hotsos.core.y... |
"""
Programming Project 17
<NAME>
15863
"""
from cmath import exp
from math import sqrt, pi
from random import choices, randint
from time import perf_counter
import matplotlib.pyplot as plt
import numpy as np
import scipy.sparse as sp
t1 = perf_counter()
N = 15
xnos = 6
znos = 2
dnos = 7
data_qubits = np.ndarray((d... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import contextlib
import numpy as np
import numexpr
import tables
from Chandra.Time import DateTime
from astropy.table import Table, Column
from .paths import default_agasc_dir, default_agasc_file
from .supplement.utils import get_supplement_t... |
import tensorflow as tf
import cv2
import numpy as np
import random
import tensorflow.contrib.slim as slim
import math
def dense(x, W, b, activation = 'relu', use_bn = False):
x = tf.matmul(x, W)
if b is not None:
x = tf.add(x, b)
if use_bn:
try:
is_training = tf.get_default_gr... |
# -*- coding: utf-8 -*-
# file: yolov3.py
# brief: JDE implementation based on PyTorch
# author: <NAME>
# date: 2020/4/8
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class YOLOv3SingleDecoder(torch.nn.Module):
'''single YOLOv3 decoder layer.
Args:
in_size: networ... |
#!/usr/bin/python3
import smbus, socket, json, yaml, threading, time, math, mysql.connector
import Jetson.GPIO as GPIO
from threading import Thread
from bmp180 import bmp180
from mpu6050 import mpu6050
with open('Telescope.yaml') as f:
data = yaml.load(f, Loader=yaml.FullLoader)
#----------Constants----------
#So... |
""" Implements Spatial Reasoning as Verbal Reasoning, with cardinal directions.
"""
import ccobra
import random
CLASSES = {"north": {"north", "north-east", "north-west"},
"north-east": {"north-east", "north", "east"},
"east": {"east", "north-east", "south-east"},
"south-east": {"so... |
import gzip
from common.utils import *
from common.metrics import *
from aad.aad_base import *
from aad.query_model import *
from aad.aad_loss import *
from aad.forest_aad_detector import *
from aad.loda_aad import *
from aad.precomputed_aad import *
def get_aad_model(x, opts, random_state=None):
if opts.detect... |
import os
import json
import time
import tensorflow as tf
import tensorflow.contrib.slim as slim
from tensorflow import flags
from tensorflow import gfile
from tensorflow import logging
FLAGS = flags.FLAGS
import losses
import frame_level_models
import video_level_models
from eval_utils import calculate_hit_at_one, ca... |
#############################################################################
# $Id: formatters.py,v 1.3 2013/07/23 21:12:52 reids Exp $
# $Revision: 1.3 $
# $Date: 2013/07/23 21:12:52 $
# $Author: reids $
# $State: Exp $
# $Locker: $
#
# PROJECT: IPC
#
# FILE: formatters.py
#
# DESCRIPTION: Functions... |
import streamlit as st
import pandas as pd
import altair as alt
from ml_model import *
#### Title ####
st.title("How To Get Away With Murder: Data Edition")
st.write("If Batman were to study data visualization, it might look something like this.")
st.markdown("<p>Data taken from the <a href='https://data.cityofchicag... |
"""
Flow past cylinder
"""
import numpy as np
import os
from pysph.base.kernels import QuinticSpline
from pysph.sph.equation import Equation
from pysph.base.utils import get_particle_array
from pysph.solver.application import Application
from pysph.tools import geometry as G
from pysph.sph.wc.edac import EDACScheme
fr... |
# pylint: disable=no-self-use,missing-docstring
import json
import pytest
from jwkest.jwk import SYMKey
from oic.oauth2.message import sp_sep_list_deserializer
from oic.oauth2.message import json_serializer
from oic.oauth2.message import json_deserializer
from oic.oauth2.message import Message
from oic.oauth2.messag... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from gym.spaces import Box
import numpy as np
import logging
import ray
import ray.experimental.tf_utils
from ray.rllib.agents.ddpg.ddpg_model import DDPGModel
from ray.rllib.agents.ddpg.noop_model import Noop... |
# In this file server side FIDO2 operations are defined
# Copyright (C) 2019 <NAME>
#
# 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 3 of the License, or (at your option)
# an... |
"""
Quantiphyse - ROI builder tools
Copyright (c) 2013-2020 University of Oxford
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 ... |
#-*- coding: utf-8 -*-
import threading, time
from urllib import request, parse
import requests
import os
import sys
import glob
import hashlib
import ssl
# 忽略 https 警告
ssl._create_default_https_context = ssl._create_unverified_context
requests.packages.urllib3.disable_warnings()
class DLWorker:
def __init__(sel... |
# 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... |
# Copyright (c) 2011 The University of Sydney
from __future__ import print_function
import copy
import functools
import itertools
import numpy as np
import os
import sys
import warnings
if sys.version_info.major < 3: from itertools import izip
else: izip = zip # todo! watch performance! it's reported python3 zip is so... |
"""Summarise network-hazard intersections
Purpose
-------
Collect network-hazard intersection attributes
- Combine with boundary Polygons to collect network-hazard-boundary intersection attributes
- Write final results to an Excel sheet
Input data requirements
-----------------------
1. Correct paths to all... |
import tensorflow as tf
from encoder import feature_extractor
slim = tf.contrib.slim
_LOGITS_SCOPE_NAME = 'logits'
_MERGED_LOGITS_SCOPE = 'merged_logits'
_IMAGE_POOLING_SCOPE = 'image_pooling'
_ASPP_SCOPE = 'aspp'
_CONCAT_PROJECTION_SCOPE = 'concat_projection'
_DECODER_SCOPE = 'decoder'
# DECODER_END_POINTS = 'ent... |
#Authors: @eldinsahbaz @rohitkulkarni93
import pandas as pd, numpy as np, tensorflow as tf, re, time, sys, contractions, _pickle as pickle, os, nltk, random
from numpy import newaxis
from tensorflow.python.ops.rnn_cell_impl import _zero_state_tensors
from nltk.stem.wordnet import WordNetLemmatizer
from tensorflow.... |
import math
import random
import warnings
import os
from scipy import spatial
from utils import *
from settings import Settings
# from src.utils import *
# from src.settings import Settings
s = Settings()
def calculate_metrics(shapes: [Shape]) -> ([Shape], {}):
"""
For each shape of the batch, it calculates... |
from __future__ import division
from __future__ import print_function
import os
import numpy as np
import tensorflow as tf
from md_lstm import multi_dimensional_rnn_while_loop
my_path = os.path.abspath(os.path.dirname(__file__))
os.environ['TF_ENABLE_COND_V2'] = '1'
class ModelValues:
"""
Metrics for the ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Utility program to scan the Slater-Koster potential files and
extract the metadata from them.
"""
import hashlib
import json # noqa: F401
from pathlib import Path
import xmltodict
def parse_file(filename):
with open(filename, "r") as fd:
lines = fd.read... |
#
# Copyright 2013 Intel Corp.
#
# 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... |
import gym
from gym import error, spaces, utils
from gym.utils import seeding
import asyncio
import struct
import math
import logging
import numpy as np
import os
import os.path
import subprocess
import signal
import sys
import xml.etree.ElementTree as ET
import psutil
import time
import configparser
import json
logger... |
# from https://github.com/amdegroot/ssd.pytorch
import torch
from torchvision import transforms
import cv2
import numpy as np
import types
# from numpy import random
import random
import pdb
import math
from PIL import Image
def intersect(box_a, box_b):
max_xy = np.minimum(box_a[:, 2:], box_b[:,2:])
min_xy ... |
# -*- coding: utf-8 -*-
"""
Copyright © 2021 Wacom 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
Un... |
#!/bin/python3
"""
Copyright kubeinit contributors.
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... |
#coding: utf-8
import nest
import time
import random
import numpy as np
import matplotlib.pyplot as plt
class AddSTDP():
""" Additive STDP rule """
def __init__(self, **params):
if len(params) > 0:
self.load_params(**params)
def load_params(self, **params):
self.__dict__.update... |
#!/usr/bin/python
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unit tests for cros_portage_upgrade.py."""
import exceptions
import mox
from chromite.lib import cros_test_lib
from chromite.... |
"""
Train InceptionV3 Network using the CUB-200-2011 dataset
"""
import pdb
import os
import sys
import argparse
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import math
import torch
import numpy as np
from analysis import Logger, AverageMeter, accuracy, binary_accuracy
from CUB import... |
# Copyright 2018-2021 The glTF-Blender-IO authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
import argparse
import os
import random
from datetime import datetime
import numpy as np
import torch
from torch import optim
from torch.optim.lr_scheduler import MultiStepLR, StepLR
from torch.utils.data import DataLoader
from tqdm import tqdm
from datasets import get_image_batches
from utils import BASE_DIR, eval... |
import abc
import asyncio
import asyncio.subprocess
import functools
import logging
import math
import os
import random
import re
import select
import shutil
import socket
import string
import subprocess
import time
from typing import Optional
import yaml
from threading import Thread
__all__ = (
'TarantoolInstan... |
import sys
import os
import time
import importlib
import argparse
import numpy as np
import torch
import torch.utils.data
from torch import optim
from modules import ResNetEncoderV2, BNResNetEncoderV2, PixelCNNDecoderV2
from modules import VAE
from logger import Logger
from utils import calc_mi
clip_grad = 5.0
deca... |
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from matplotlib import gridspec
from matplotlib.patches import Rectangle
from matplotlib.collections import PatchCollection
from matplotlib.colors import BoundaryNorm
import numpy as np
import time
def setColData(plotOpt,colData,mainBranchID... |
##########
# Code modified from: https://github.com/alshedivat/lola
##########
import json
import os
from ray import tune
from marltoolbox.algos.lola.corrections import *
from marltoolbox.algos.lola.networks import *
from marltoolbox.algos.lola.utils import *
from marltoolbox.envs.matrix_sequential_social_dilemma imp... |
# TO DO
# 1. Fair probability
# 2. Hedge opportunities
# 3. Datapane map
# 4. Change since prior poll
# Import modules
import json
import requests
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import pandas as pd
pd.set_option('display.max_rows', None) #print all rows without truncatin... |
"""
MIT License
Copyright (c) 2020 tdbowman-CompSci-F2020
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,... |
""" Weighted ResBlock for compositional networks.
"""
import tensorflow as tf
from tensorflow.python.keras import regularizers
from lib import weighted_layers_v2 as wl
class ResBlockTemplate():
"""Custom residual block template class.
Stores the templates of weighted expansion, depthwise convolution and
projec... |
import sqlite3
import re
from finalb import FunctionalDependencySet
from abc import ABC, abstractmethod
# This is the main file, all functions here relate to the program and are not methods
# https://stackoverflow.com/questions/7844118/how-to-convert-comma-delimited-string-to-list-in-python
# https://stackoverflow.com... |
"""
used to cache data that is read from the api. CKAN objects can have relationships
to other objects. For example a group or organization relates to different users,
or a package can be owned by an organization
This class is developed on an as needed basis to help store and retrieve these
relationships.
Us... |
import argparse
import torch
import numpy as np
import random as rnd
import os
import json
from torch.utils.data import DataLoader
from torchvision import datasets, transforms
from torch.utils.data import Subset
import torch.nn.functional as F
import loss_utils
import models
import bilevel_coreset
from cl_streaming imp... |
# Futu Algo: Algorithmic High-Frequency Trading Framework
#
# 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 appli... |
import os
import numpy as np
import pandas as pd
import pickle as pkl
from copy import deepcopy
from sklearn.datasets import load_iris, make_blobs
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import adjusted_rand_score
from matplotlib import pyplot as plt
from matplotlib.patches import Ellipse... |
'''
prepare the triples for few-shot training
'''
import numpy as np
from collections import defaultdict
import json
from time import time
# def build_vocab(dataset):
# rels = set()
# ents = set()
#
# with open(dataset + '/path_graph') as f:
# lines = f.readlines()
# for line in lines:
# ... |
'''
Utility mesh function for training
'''
import argparse
from datetime import datetime
import numpy as np
import tensorflow as tf
import socket
import importlib
import os
import sys
import batch_prep
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = BASE_DIR
sys.path.append(BASE_DIR)
sys.path.appen... |
import pya
from math import pi
from siepic_tools.utils.geometry import rotate, rotate90
EX = pya.DVector(1, 0)
class objectview(object):
""" Basically allows us to access dictionary values as dict.x
rather than dict['x']
"""
def __init__(self, d):
self.__dict__ = d
def place_cell(paren... |
import pickle
import traceback
def stringfyNode(root):
#print(root.getTreestr())
if root.name == 'LocalVariableDeclaration' or root.name == 'VariableDeclaration':
typestr = ""
idenname = ""
mod = ""
for x in root.child:
if x.name == 'type':
typestr = s... |
import discord
from discord.ext import commands
from datetime import timedelta
from discord.ext.commands import BucketType
from discord.ext.commands import cooldown
import datetime
import time
import sys
import asyncio
import math
from Utils import main
def convert_size(bytes):
if bytes == 0:
... |
# -*- coding: utf-8 -*-
'''
@author: <NAME>
'''
from collections import deque
from itertools import permutations
import networkx as nx
from .arggraph import ArgGraph, get_very_complex_arggraph
class RelationSet(object):
def __init__(self, preserving, inverting):
"""
A set of argumentative rel... |
from copy import deepcopy
import datetime as dt
import json
import marshmallow
import pandas as pd
import pytest
import uuid
from sfa_api import schema, ma
@pytest.fixture()
def iso_schema():
return marshmallow.Schema.from_dict({'isodt': schema.ISODateTime()})
@pytest.mark.parametrize('inp,out', [
(dt.d... |
#
# Copyright <NAME>, 2012-2014
#
#
# This file contains io command
# First input file is read once before mining command execution to
# validate its existance, check its correctness and detemine record variables
# In general file format is determined from the extension:
# .qbl - coals records
# .csv - c... |
# @author: <EMAIL>
import tensorflow as tf
import os
import json
from typing import List
import numpy as np
from tensorflow.keras import backend as K
from transformers.modeling_tf_bert import TFBertPreTrainedModel, TFBertEncoder, TFBertPooler
from transformers.configuration_bert import BertConfig
from transformers.mode... |
import sys, os
sys.path.insert(0, os.path.abspath(os.path.realpath('./')))
# import query
try:
from exceptions import EOFError
except ImportError:
pass
# import collections as cx
TYPEDEF_TAG, TERM_TAG = "[Typedef]", "[Term]"
GraphEngines = ("pygraphviz", "pydot")
def after_colon(line):
# macro for ge... |
# Author: <NAME> (<EMAIL>)
from parsers.sexp import sexp as sexpParser
from exprs import exprs
from core import grammars
from semantics import semantics_core
from semantics import semantics_lia
from semantics import semantics_bv
from semantics import semantics_slia
from semantics import semantics_types
from core impor... |
from __future__ import annotations
import pandas as pd
from dat_analysis.dat_object.attributes import transition as T
import dash_bootstrap_components as dbc
from singleton_decorator import singleton
import dash_html_components as html
from typing import List, Tuple, TYPE_CHECKING
import numpy as np
from OLD.Dash.DatS... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.