text
stringlengths
3.07k
12.6k
# Copyright 2021 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, ...
import pytest import numpy as np from numpy import testing as npt import pandas.util.testing as pdt import ixmp from ixmp.testing import make_dantzig, models, TS_DF, HIST_DF TS_DF_CLEARED = TS_DF.copy() TS_DF_CLEARED.loc[0, 2005] = np.nan def test_run_clone(tmpdir, test_data_path): # this test is designed to co...
#!/usr/bin/env python3 from snipsLeds import LedControl #Initialize this first in order to have the loading animation ledControl = LedControl('localhost', 1883) import time import configparser import io import queue from foodinference import FoodInference from hermes_python.hermes import Hermes import message import...
# # ~~ <NAME> ~~ # Or, Circular Interpolation of the StyleGAN Synthesis Network's Constant Layer # ~~~ aydao ~~~~ 2020 ~~~ # # Based on halcy's circular interpolation script https://pastebin.com/RTtV2UY7 # import warnings warnings.filterwarnings('ignore', category=FutureWarning) warnings.filterwarnings('i...
# -*- coding: utf-8 -*- import os import sys from ghostscript import Ghostscript import argparse from glob import glob from PIL import Image, ImageDraw import colorsys import numpy as np sys.path.insert(1, os.path.realpath(os.path.join(sys.path[0], os.pardir))) from image_graph_parser import ImageGraphParser from freq...
# Copyright 2015 OpenStack Foundation. # 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 # # Unle...
# Copyright 2020, The TensorFlow 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 agreed t...
#!/usr/bin/env python # encoding: utf-8 """ File: mpi_sate.py Author: <NAME> Created by <NAME> on 04 May 2012 15:05 PDT (-0700) Copyright (c) 2012 <NAME>. All rights reserved. Description: """ import os import sys import copy import glob import shutil import argparse import tempfile import subprocess from col...
from learn.models import Technology, Domain, Resources from collections import Counter def get_all_domains(): """ returns all the domain names """ domain_names = Domain.objects.filter(active=1).values_list('name', flat=True) return domain_names def get_all_technologies(): """ returns all t...
"""The lookin integration light platform.""" from __future__ import annotations from collections.abc import Callable, Coroutine from datetime import timedelta import logging from typing import Any, cast from aiolookin import Remote from aiolookin.models import UDPCommandType, UDPEvent from homeassistant.components.m...
from __future__ import print_function from collections import namedtuple from itertools import chain from json import loads from operator import itemgetter from os import environ from sys import version from offutils.util import iteritems, itervalues if version[0] == "2": from itertools import ifilter as filter ...
"""Representations of arXiv document metadata.""" import collections from typing import List, Optional, Iterator, Set from datetime import datetime from dataclasses import dataclass, field from arxiv import taxonomy from arxiv.base.urls import canonical_url from browse.domain.identifier import Identifier from browse.d...
from logzero import logger from BITS.seq.align import EdlibRunner from .dovetail_overlap import dovetail_alignment from ..types import Overlap er_glocal = EdlibRunner("glocal", revcomp=False, cyclic=False) def _svs_overlap_forward(boundary_read, whole_read, boundary_start, boundary_end, k_fo...
"""This module contains the general information for ConfigStorageBladeFilter ManagedObject.""" from ...ucscmo import ManagedObject from ...ucsccoremeta import UcscVersion, MoPropertyMeta, MoMeta from ...ucscmeta import VersionMeta class ConfigStorageBladeFilterConsts(): DECOMMISSIONED_FALSE = "false" DECOMMI...
# Copyright (c) Gorilla-Lab. All rights reserved. import math from typing import Optional, Union import torch import numpy as np import scipy.ndimage as ndimage import scipy.interpolate as interpolate import transforms3d.euler as euler from plyfile import PlyData from plyfile import PlyElement def elastic(xyz, gran,...
from game.common.game_object import GameObject from game.common.enums import * from game.common.stats import GameStats import math def rotate(origin, point, angle_deg): """ Rotate a point counterclockwise by a given angle around a given origin. The angle should be given in degrees, then is converted to ...
from scipy import shape, dstack, sqrt, floor, array, mean, ones, vstack, hstack, ndarray from vlfeat import vl_rgb2gray, vl_imsmooth, vl_dsift from sys import maxint """ Python rewrite of https://github.com/vlfeat/vlfeat/blob/master/toolbox/sift/vl_phow.m ### notice no hsv support atm ### comments are largely copied f...
# -*- 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...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Dec 21 14:19:48 2021 @author: nams """ import numpy as np import scipy.constants # from functools import cache from functools import lru_cache import tes_optical_stack.nk_code as nk_code nk = nk_code.load_from_materials_mat() z0 = np.sqrt(scipy.const...
# -*- coding: utf-8 -*- """ Created on Sun May 17 17:56:26 2020 @author: philtabor """ import torch as T import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import numpy as np class DeepQNetwork(nn.Module): def __init__(self, lr, input_dims, fc1_dims, fc2_dims, fc3_dims, ...
""" Virtual software representation of the Launchpad Mini MK3. """ from tests._rtmidi_dummy import MidiIn, MidiOut, API_RTMIDI_DUMMY from lpminimk3._lpminimk3 import LaunchpadMiniMk3 from lpminimk3._core.utils import MidiEvent, MidiClient,\ MidiPort from lpminimk3.midi_messages impor...
import logging import os import re from collections import Counter, defaultdict from itertools import chain import networkx as nx import pysrt import spacy from nltk.tag import StanfordNERTagger from nltk.tokenize import word_tokenize from subs2network.consts import IMDB_ID, SUBTITLE_PATH, ROLES_PATH, IMDB_NAME, STAN...
# functions for post processing datasets import glob import numpy as np import os from skimage import io import skimage.external.tifffile as skTiff import numexpr as ne # routines for the fast evaluation of array expressions elementwise by using a vector-based virtual machine # ==================================...
import tensorflow as tf import numpy as np import os from options import Option from reconstruction_model import * from data_loader import * from utils import * import argparse ############################################################################################### # training stage ##################...
import overpy import RPi.GPIO as GPIO import threading import serial import string import pynmea2 import obd import firebase_admin from firebase_admin import credentials from firebase_admin import firestore from time import sleep #connect to the usb OBD port connection = obd.OBD() #google auth stuff cred = credential...
from skimage import color, io, exposure, filters from skimage import img_as_float from PIL import Image, ImageFont, ImageDraw from skimage.transform import rescale import numpy as np import json def get_cropped_img(img, target_res): h, w = img.shape[:2] h_target, w_target = target_res h_start = (h-h_targe...
import tensorflow as tf import numpy as np import cv2 import argparse from sklearn.utils import shuffle def Dataset_preprocessing(dataset = 'MNIST', image_type = True): if dataset == 'mnist': nch = 1 r = 32 (train_images, _), (test_images, _) = tf.keras.datasets.mnist...
# Copyright 2017 Rackspace # 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 applic...
import logging import signal import typing from dbnd._core.constants import SystemTaskName, TaskRunState from dbnd._core.errors import friendly_error, show_error_once from dbnd._core.errors.base import DatabandSigTermError from dbnd._core.plugin.dbnd_plugins import pm from dbnd._core.task_build.task_context import Tas...
import os from datetime import datetime from pathlib import Path from typing import List, Tuple import pandas as pd from django.test import TestCase from cryptofeed_werks.lib import ( aggregate_trades, get_current_time, get_min_time, volume_filter_with_time_window, ) from cryptofeed_werks.models impor...
from datasets.dataset_utils import load_dataset_from_pkl, load_dataset_from_from_folder from datasets.dataset_template import ColorDatasetInMemory, ColorDatasetOnDisk import os import numpy as np def get_MiniImageNet(args_per_set, setnames=["train", "val", "test"]): """ Returns MiniImagenet datasets. """ ...
# Analyze the POS and NER results, look for correlations between them import numpy as np import matplotlib.pyplot as plt import operator class Token: def __init__(self, word, postag, gold_postag, nertag, gold_nertag): self.word = word self.postag = postag self.gold_postag = gold_postag self.nertag = nertag ...
# -*- coding: utf-8 -*- import numpy as np import math import cv2 def get_diamond_c_from_original_coords(x,y, a,b, width, height,padding =22, radius=22): """ formula is ax + by + c = 0 x = (xorig + padding - wc) / norm y = (yorig + padding - hc) / norm where x, y is in diamond space """ ...
""" Loads synthetic reaction datasets from USPTO. This file contains loaders for synthetic reaction datasets from the US Patent Office. http://nextmovesoftware.com/blog/2014/02/27/unleashing-over-a-million-reactions-into-the-wild/. """ import os import logging from typing import List, Optional, Tuple, Union import de...
#!/usr/bin/env python # -*- coding: utf-8 -*- """simple_benchmarking.py: Python SDK.""" __author__ = "<NAME>" __copyright__ = "Copyright 2015, EVARILOS Project" __version__ = "1.0.0" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" __status__ = "Development" import raw_data_pb2 import urllib2 import time import json...
import types def emptyProtocolInBuffer(): return types.SimpleNamespace(data=[], flags=-1, sent_data_size=None, device_id=-1, data_length=0) class ProtocolValsIterator: """ Useful for iterating over the values inside this buffer """ def __init__(self, buff): self._buffer = buff self._ind...
import logging import ujson as json import random from util.line_corpus import jsonl_lines, write_open from util.args_help import fill_from_args import os logger = logging.getLogger(__name__) class Config: def __init__(self): self.cell_sep_token = '*' # used to use '|' but albert doesn't have it ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #======================================================================= # # day_3.py # -------- # Solution for Advent of code 2017, day 3. # http://adventofcode.com/2017/day/3 # # Status: Done. # # <NAME> 2017 # #===========================================================...
import tensorflow as tf import numpy as np from . import sparsematrix import logging logger = logging.getLogger(__name__) def safe_inverse_one(Lambda,numstab): return safe_inverse(Lambda[None],numstab)[0] def symmetrize(Lambda): return .5*(Lambda+batch_transpose(Lambda)) def batch_transpose(Lambda): r...
# -*- coding: utf-8 -*- # Copyright 2015-2019 grafana-dashboard-builder 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 ...
# -*- coding: utf-8 -*- # This file is part of CairoSVG # Copyright © 2010-2012 Kozea # # 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 3 of the License, or (at your option...
"""This module contains simple helper functions """ from __future__ import print_function import torch import torch.nn.functional as F import numpy as np from PIL import Image import os def rgb_to_binary(input: torch.Tensor) -> torch.Tensor: if not isinstance(input, torch.Tensor): raise TypeError("Input ty...
import os import os.path as op import json import cv2 import base64 import numpy as np import code import torch from tqdm import tqdm from metro.utils.tsv_file_ops import tsv_reader, tsv_writer from metro.utils.tsv_file_ops import generate_linelist_file from metro.utils.tsv_file_ops import generate_hw_file from metro.u...
import pickle import numpy as np import random class Cifar(): def __init__(self,filename): self.filename = filename splitfile = filename.split("/") metaname = "/batches.meta" metalabel = b'label_names' if splitfile[-1] == "cifar-100-python": metaname = "...
"""Define latency predictor that predict the latency of model on devices. """ # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License" # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
from sqlalchemy import Column, Integer, Numeric, String, Boolean, ForeignKey, PrimaryKeyConstraint, \ ForeignKeyConstraint, UniqueConstraint from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship Base = declarative_base() class Team(Base): __tablename__ = 'teams' ...
#!/usr/bin/env python3.5 ''' ======================== Test_Client module ======================== Created on March.17, 2021 @author: <NAME> @Email: <EMAIL> @TaskDescription: This module provide FEd-DDM Client app that access to web service of FEd-DDM Server. ''' import logging import argparse import sys import time ...
""" ========================================== Using cloudknot to run pyAFQ on AWS batch: ========================================== One of the purposes of ``pyAFQ`` is to analyze large-scale openly-available datasets, such as those in the `Human Connectome Project <https://www.humanconnectome.org/>`_. To analyze thes...
from sqlobject import * from sqlobject.sqlbuilder import func from sqlobject.main import SQLObjectIntegrityError from dbtest import * from dbtest import setSQLiteConnectionFactory class IterTest(SQLObject): name = StringCol(dbName='name_col') names = ('a', 'b', 'c') def setupIter(): setupClass(IterTest) f...
""" This module contains utility functions. """ import numpy as np import itertools def get_numpy_strategy_from_gambit_profile(game, mixed_profile, player_id): """ Given a mixed strategy profile in gambit format, convert it to numpy array for a specific player :param game: the gambit game :param mixed...
import os from itertools import combinations import tensorflow as tf import matplotlib.pyplot as plt import numpy as np import cv2 import pandas as pd from data_augmentation import transform_batch def read_tfrecord(example_proto): face = [] hand_1 = [] hand_2 = [] video_name = [] triangle_stream_...
import matplotlib.pyplot as plt import numpy as np def plot_scores(output_path, colors): """ Make bar plot of the score metrics and save image in output_path folder. :param output_path: output path :param colors: list of colors """ # data rf_scores = [0.628099173553719, 0.7755102040816326, 0....
#coding: utf-8 import wx import threading import os import settings import lib.util as util from media_repo import MediaRepo def add_file(src_path, file_meta): repo = MediaRepo() repo.add_bookinfo(file_meta) repo.add_history(file_meta['md5'], src_path) repo.add_file(src_path, file_meta) return 1 ...
from beem import Blurt from beem.account import Account from datetime import datetime import pyrebase import base64 import json import os import random # Setup blurt nodes and account blurt_nodes = ['https://rpc.blurt.world'] username = os.environ.get('USERNAME') blurt = Blurt(blurt_nodes) account = Account(username...
import os import pathlib import sys import astrodata import gemini_instruments # noqa import numpy as np import pytest from astrodata.testing import download_from_archive from geminidr.gemini.lookups import DQ_definitions as DQ from geminidr.gmos.primitives_gmos_spect import GMOSSpect from gempy.utils import logutils...
# Copyright 2017-present 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 w...
import numpy as np from utilities.objective_functions import TSPObjectiveFunction from perm_LQUBO.form_new_LQUBO import NewLQUBO from perm_LQUBO.next_perm import NextPerm import matplotlib.pyplot as plt from matplotlib.ticker import MaxNLocator from scipy import stats ax = plt.figure().gca() class ObjectiveFunction: ...
""" usage: python3 report_atom.py <walletaddress> [--format all|cointracking|koinly|..] Prints transactions and writes CSV(s) to _reports/ATOM*.csv Notes: gaiad query txs --home /tmp/.gaia --events message.sender=<wallet_address> \ --node https://<RPCURL>:443 --limit 100 gaiad query txs --home /tmp/.gaia --...
from __future__ import print_function import os from enum import Enum import numpy as np import torch import torch.backends.cudnn from skimage import io from skimage import color from models import FAN, ResNetDepth from utils import crop, flip, get_preds_fromhm, draw_gaussian class LandmarksType(Enum)...
"""Script for creating a wheel rig This tool takes a number of shapes and add a rig for them to act as a wheel. """ from maya import cmds import dataNodeManager reload(dataNodeManager) class WheelData(dataNodeManager.NodeData): """A class to save information for this rigging process. This class inherits fr...
import contextlib import json import os.path import queue as queue_ import tempfile import traceback import pytest import trio import trio.testing import datastore from datastore.filesystem import FileSystemDatastore from tests.conftest import DatastoreTests @pytest.fixture def temp_path(): with tempfile.Temporary...
import matplotlib.pyplot import matplotlib.patches as ptch import numpy import os import inspect ## matplotlib.pyplot.rcParams['font.size'] = 14 matplotlib.pyplot.rcParams['font.serif'] = 'Computer Modern Roman' matplotlib.pyplot.rcParams['text.usetex'] = True matplotlib.pyplot.rcParams['svg.fonttype'] = 'none' matplo...
"""Config flow for Tomorrow.io integration.""" from __future__ import annotations from collections.abc import Mapping import logging from typing import Any from pytomorrowio.exceptions import ( CantConnectException, InvalidAPIKeyException, RateLimitedException, ) from pytomorrowio.pytomorrowio import Tomo...
from Player import Player import sys import time import random from pprint import pprint from board import Board INF = 1.0e100 CORNERS = [(0, 0), (0, 7), (7, 0), (7, 7)] CENTERS = [(3, 3), (3, 4), (4, 3), (4, 4)] DANGERS = [(0, 1), (0, 6), (1, 0), (1, 1), (1, 6), (1, 7), (6, 0), (6, 1), (6, 6), (6, 7), (7, ...
# Copyright 2019 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 numpy as np import pandas as pd import numba @numba.jit(nopython=True) def _adjust_sigma(acc_rate, sigma): """ Tune sigma in proposal distribution. Parameters ---------- acc_rate : float The acceptance rate. sigma : ndarray Array of standard deviations for Gaussian prop...
# Copyright 2018 Google. 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...
import tensorflow as tf import tensorflow_addons as tfa from tensorflow_probability import distributions, stats import numpy as np @tf.function def sparsemoid(inputs): return tf.clip_by_value(0.5 * inputs + 0.5, 0., 1.) def get_binary_lookup_table(depth): # output: binary tensor [depth, 2**depth, 2] ind...
# -*- coding: utf-8 -*- """ @author:XuMing(<EMAIL>) @description: This examples trains CoSENT model with the English STS dataset. It generates sentence embeddings that can be compared using cosine-similarity to measure the similarity. """ import argparse import sys import csv import gzip import time import numpy as np ...
import subprocess, os, time, socket, select import threading import re import sys if('win' in sys.platform): player="vlc.exe" else: player= "vlc" remote= "-I rc" port = 10000 hostname = socket.getaddrinfo('localhost', 10000)[0][4][0] extra = "--rc-host %s:%d" class Communicator: def __init__(self, player,...
#!/usr/bin/env python3 #-*- utf-8 -*- u""" Created at 2021.03.16 basic func """ from matplotlib import pylab from src.logger import logger def get_limited_index(num, length): u""" Created by <NAME> at 2018.12.19 Due to the original author didn't draw any element out of provided range So the scripts ...
"""Provides CrawlRunner subclasses to wrap crawl process execution and monitoring.""" import os import sys import signal from os.path import join import subprocess import time import shlex from abc import ABCMeta, abstractmethod from settings import (LANG_DETECT_PATH, CRAWL_PATH, MODEL_PATH, CO...
import os import time import re import yaml import sqlite3 from sqlite3 import Error from subprocess import check_output db_path = ".tmp/source/Public/index.db" def get_id(con, cursor, table, field, value, force_new=False): cursor.execute('SELECT rowid FROM {} WHERE {} = "{}";'.format(table, field, value)) ...
import json import discord from discord.ext import tasks from . import utils as vbu class Analytics(vbu.Cog): FOUND_GATEWAY_OPCODES = {} def __init__(self, bot: vbu.Bot): super().__init__(bot) self.post_statsd_guild_count.start() self.post_topgg_guild_count.start() self.pos...
import wxversion # wxversion.select("2.8") import wx import wx.media import itertools as IT import os IMAGE_DIR = os.path.expanduser('H:\ieee//all_functions\linux server\python GUI\Grid_on_photo/images') SOUND_DIR = os.path.expanduser('H:\ieee//all_functions\linux server\python GUI\Grid_on_photo/sounds') class Main...
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import date_diff def execute(filters=None, consolidated = False): data, columns = DelayedItemReport(filte...
#!/usr/bin/env python3 def _extended_euclidean(a, b): """Helper function that runs the extended Euclidean algorithm, which finds x and y st a * x + b * y = gcd(a, b). Used for gcd and modular division. Returns x, y, gcd(a, b)""" flip = b > a if flip: a, b = b, a if b == 0: return 1, 0, a x,...
from __future__ import print_function import struct import numpy as num import sys class KaldiParser(object): NO_OPEN_BRACKET = "found > before <" ERR_NO_CLOSE_BRACKET = "reached eof before >" ERR_BYTES_BEFORE_TOKEN = "found bytes before <" NO_SPACE_AFTER = "missing space after >" def __init__(se...
# ***************************************************************************** # Copyright (c) 2017 <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 wi...
# -*- coding: utf-8 -*- ################################################################################ # _____ _ _____ _ # # / ____(_) / ____| | | # # | | _ ___ ___ ___ | (___ _ _ ___...
import os import sys from configparser import ConfigParser from pathlib import Path import argparse user_config_path = os.path.expanduser("~") + "/.lightlab" + "/config.conf" user_config_path = Path(user_config_path).resolve() system_config_path = Path("/usr/local/etc/lightlab.conf") default_config = {"labstate": {'...
# 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 agreed ...
#!/usr/bin/env python3 # # Sample from a trained network import re import time from collections import namedtuple from math import sqrt import numpy as np import torch from uncertainties import ufloat import ising from args import args from made import MADE from pixelcnn import PixelCNN from utils import get_ham_arg...
# Copyright © 2022 Province of British Columbia # # 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 agr...
import pytest import numpy as np from awkward import JaggedArray from fast_carpenter import expressions def test_get_branches(infile): valid = infile.allkeys() cut = "NMuon > 1" branches = expressions.get_branches(cut, valid) assert branches == ["NMuon"] cut = "NMuon_not_found > 1 and NElectron ...
# -*- coding: utf-8 -*- from django.db import models from django.conf import settings from django.utils.translation import ugettext as _ from django.dispatch import receiver from django.db.models.signals import post_save from django.db.models.signals import pre_save from blockchain.wallet import Wallet # Create your m...
import requests from flask import render_template, abort, make_response, request from .utilities_db import get_all_projects, get_popular_repos, get_first_launch_ts from . import app, cache @cache.cached(timeout=300, key_prefix='binder_versions') def get_binder_versions(binders): main_versions = None for binde...
import os import json import argparse import traceback from datetime import datetime, timedelta from parallelm.mlops import mlops from slackclient import SlackClient from parallelm.mlops.stats.opaque import Opaque def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("--token", help="slack t...
# -*- coding:utf-8 -*- # @author xupingmao # @since 2016 # @modified 2020/10/02 08:57:56 # CPython运行环境使用 # minipy 不依赖这个工具 import sys import struct import os import shutil import time ARGV = sys.argv argv = sys.argv system = os.system def _repl_print(p, maxlen = 40, n = 0, depth = 2): if depth <= 0: pri...
import time import sqlite3 import xlrd import tablib xlrdCtypeMap = ["#","text","number","datetime"] openpyxlMap ={"s":"text","n":"number","d":"datetime"} """ def readXlsxFile(filePath): file = xlrd.open_workbook(filePath) table = file.sheets()[0] labelRow = table.row(0) firstRow = table.row(1) lab...
"""The module implements algorithms to transform MCNP model. Inserts end comments with information about path in STP corresponding to a cell and sets materials and densities, if specified in STP paths. """ from typing import Generator, Iterable, List, Optional, TextIO, Tuple, Union import math import warnings from...
from gurobipy import Model, GRB, quicksum from networkx import Graph, connected_components edge2var = None def callback_cycle(model, where): """ Callback inserts constraints to forbid more than one cycle in solution candidates :param model: a `gurobipy model <https://www.gurobi.com/documentation/9.1/refman/...
""" Axial Attention Block and necessary utils, taken from https://github.com/csrhddlam/axial-deeplab """ import math import torch import torch.nn as nn import torch.nn.functional as F class qkv_transform(nn.Conv1d): """ Conv1d for qkv_transform """ def conv1x1(in_planes, out_planes, stride=1): """ ...
# -*- coding: utf-8 -*- """ Created on Sun Dec 12 09:10:54 2021 @author: USER """ # DQN learn (tf2 subclassing API version) # coded by St.Watermelon import numpy as np import matplotlib.pyplot as plt from tensorflow.keras.models import Model from tensorflow.keras.layers import Dense from tensorflow.keras.optimizers ...
import json import requests import random import datetime import csv import pymongo import time from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor client = pymongo.MongoClient("192.168.0.210", 27017) categories = {} with open('docs/categories.csv') as r: rows = csv.DictReader(r) for row i...
# Manta Python # Manta Protocol Implementation for Python # Copyright (C) 2018-2019 <NAME> import argparse import asyncio from concurrent.futures._base import TimeoutError import configparser import logging import os import sys import traceback from aiohttp import web from cryptography.x509 import NameOID import inqu...
import numpy as np from gym import spaces from pettingzoo import ParallelEnv from smac.env import StarCraft2Env as sc_env from malib.envs import Environment from malib.utils.typing import Dict, AgentID, Any from malib.backend.datapool.offline_dataset_server import Episode agents_list = { "3m": [f"Marine_{i}" fo...
import base64 import logging import os import re import struct import time import functools from django.conf import settings from modeltranslation.translator import translator from resources.models import Resource, Unit, UnitIdentifier from munigeo.models import Municipality @functools.lru_cache() def get_muni(muni...
#!/usr/bin/env python3 # author : swing # mail : <EMAIL> import docker import os import platform import logging import argparse from distutils.dir_util import mkpath APPNAME = 'msl' APPAUTHOR = 'swing' SUPPORTED_UBUNTU_VERSION_LTS = [ # '14.04', Still many issues to be solved (version problems mostly) ...
# -*- coding: utf-8 -*- # # Copyright 2016 Google LLC. 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 requir...