text
stringlengths
3.07k
12.6k
#!/usr/bin/python3 import pandas as pd import matplotlib.pyplot as plt from matplotlib.patches import Patch import numpy as np # Menu def main(): while(True): choice = int(input("Escolha a questão a exibir {1, 2, 3, 4, 5, 6, 7} \n0 para sair:\n")) if choice == 1: questOne() eli...
import hashlib import logging import json from datetime import timedelta from django.conf import settings from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist from django.db import models from django.utils import timezone from django.utils.timezone import now from channels...
# -*- coding: utf-8 -*- from typing import Tuple from aiida.orm import Data class EnvironCharge: def __init__(self, **kwargs): self._charge = None self._position = None self._spread = None self._dim = None self._axis = None if "environ_charge" in kwargs: ...
import math from math import cos, sin import numpy as np def servo_angles_to_xyzlines(a1, a2, r=0.5): alpha, beta = math.radians(a1), math.radians(a2) x1, y1, z1 = r * cos(alpha), 0, r * sin(alpha) transform = np.array([[cos(alpha), 0, -sin(alpha), x1], # DH matrix [0, 1, 0, y1...
"""Plots classifier ambiguity against compactness. <NAME> <<EMAIL>> Research School of Astronomy and Astrophysics The Australian National University 2017 """ import logging import astropy.io.ascii import astropy.io.fits import astropy.visualization import astropy.visualization.wcsaxes import astropy.wcs import matpl...
import pytest from .js_helper import TestCase, _do_test_raw from validator.testcases.javascript.jstypes import JSWrapper from validator.testcases.javascript.actions import _get_as_num def test_array_destructuring(): """ Make sure that multi-level and prototype array destructuring don't cause tracebacks....
# -*- coding: utf-8 -*- import tensorflow as tf import numpy as np import time from PIL import Image import random import os from sample import sample_conf os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = "0,1" import backbone import common class TestError(Exception): pass class...
# -*- coding: utf-8 -*- """Tools for coloring text in ANSI terminals. """ #***************************************************************************** # Copyright (C) 2002-2006 <NAME>. <<EMAIL>> # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as par...
# coding=utf-8 import json from unittest import TestCase from coverage.plugin import FileReporter from coverage.python import PythonFileReporter from coverage.misc import NotPython from coveralls.control import coveralls from coveralls.report import CoverallsReporter from httpretty import HTTPretty, httprettified from ...
"""File Helpers.""" import os import shutil import string import time from pathlib import Path from typing import Any, List import yaml from beartype import beartype from loguru import logger # ---------------------------------------------------------------------------------------------------------------------- # Ge...
# 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...
import os import numpy as np import pandas as pd import pygrib from tqdm import tqdm import logging import datetime ######################### ###### Definitions ###### ######################### abs_base_path = os.path.dirname(os.path.abspath(__file__)) '''/home/collin/visibility-China/time_series_analysis/src/data'''...
"""Diff parsing functions and classes.""" from __future__ import absolute_import, print_function import re import textwrap import traceback from lib.util import ( ApplicationError, ) def parse_diff(lines): """ :type lines: list[str] :rtype: list[FileDiff] """ return DiffParser(lines).files ...
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017, 2018. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
from hashlib import sha256, md5 import json import magic import os from girder.utility import hash_state, ziputil, JsonEncoder from ..license import WholeTaleLicense class HashFileStream: """Generator that computes md5 and sha256 of data returned by it""" def __init__(self, gen): """ This cla...
import os, logging, json, posixpath from airflow import configuration as conf from airflow.www.security import AirflowSecurityManager from flask import abort, make_response, redirect from flask_appbuilder.security.manager import AUTH_OID from flask_appbuilder.security.views import AuthOIDView from flask_appbuilder.vie...
import numpy as np import matplotlib import matplotlib.pyplot as plt #%matplotlib inline import csv import pickle import os import colour exp_id = '2019_07_27_14_04_36' #original #exp_id = '2019_07_27_14_04_25' #seed sampling #exp_id = '2019_07_27_14_39_13' #seed sampling tlow, thigh = 80, 100 # task ID range # se...
# -*- coding: utf-8 -*- # Author: Harold.Duan # This module is sbo windows service implements. from typing import List __version__ = '0.0.1.dev' __author__ = 'Harold.Duan' __all__ = ['conf', 'database', 'new_mcp'] import sys import json import os from os import path from datetime import datetime, date f...
from tweepy import API from tweepy import Cursor from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream from tweetsent.nlp import Sentiment, SentimentCustom import os import numpy as np import pandas as pd import re import altair as alt # # # # TWITTER CLIENT # # # # ...
""" Logger Formatter """ from datetime import datetime import django import logging import json import os import socket import traceback import platform from ozp import version BUILTIN_ATTRS = { 'args', 'asctime', 'created', 'exc_info', 'exc_text', 'filename', 'funcName', 'levelname', ...
import numpy as np from .utils import aryule_levinson, arburg from logging import getLogger logger = getLogger('ChangeFinder') class SDAR_1D: def __init__(self, r, k, is_yule=True): """Train a AR(k) model by using the SDAR algorithm (1d points only). Args: r (float): Discounting pa...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sqlite3 from rapidfuzz import process import unicodedata import re import discord.ext.commands from discord.ext import commands # Connect to the local sqlite database `rocbot.sqlite` and generate a list of # ship names from the `ship` table def get_ships(): #...
""" Adapted from https://github.com/pybind/cmake_example """ import fileinput import os import platform import re import subprocess import sys import sysconfig from distutils.version import LooseVersion from pathlib import Path from typing import Any, Dict, List from setuptools.command.build_ext import build_ext from ...
# -*- coding: utf-8 -*- import numpy as np import multistreamcache import multistreamworkers import Utils class BatchGen_Single: ''' Batch generator for individual, unpaired samples from audio streams. ''' def __init__(self, model_config, audio_list, ...
# Copyright 2016 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...
# BSD 3-Clause License # # Copyright (c) 2017 xxxx # All rights reserved. # Copyright 2021 Huawei Technologies Co., Ltd # # 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 th...
import os import mne import numpy as np import time import pandas as pd import itertools from plipy.ddl_sto import StoDeepCDL1Rank from scipy.optimize import linear_sum_assignment from scipy.signal import correlate from joblib import Memory from tqdm import tqdm mem = Memory(location='.', verbose=0) N_EXAMPLES = 10 ...
# -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """ Internal Console Plugin. """ # Standard library imports import logging import os # Third party imports from qtpy.QtCore import QObject, Signal, S...
"""Validate branding configuration variables.""" # Standard Library from typing import Union, Optional, Sequence from pathlib import Path # Third Party from pydantic import ( HttpUrl, FilePath, StrictInt, StrictStr, StrictBool, constr, validator, root_validator, ) from pydantic.color i...
import os import codecs import json import kindred import bioc import six def convertKindredCorpusToBioCCollection(corpus): assert isinstance(corpus,kindred.Corpus) collection = bioc.BioCCollection() for kdoc in corpus.documents: assert isinstance(kdoc,kindred.Document) biocDoc = bioc.BioCDocument() collect...
#!/usr/bin/python3 # -*- coding: utf8 -*- # Copyright (c) 2021 Baidu, Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE...
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Utilities for dealing with builder names. This module obtains its attributes dynamically from builder_name_schema.json. """ import json import os # ...
#!/usr/bin/env python3 # 用于处理用户上传的图片 import os import sys import json as JSON from PIL import Image import threading from time import sleep next_id = 0 def near_value(i): if i < 64: return 0 elif i < 64*2: return 1 elif i < 64*3: return 2 else: return 3 def restore_value(i): return i*85 def decimal...
import logging import pandas as pd import tldextract from libs.customExceptions import NoMatch, UnexpectedFBComment, Ignore, UnexpectedFBPost, NothingToDo def dropByPercentageJSON(data, percentage): assert(percentage>=0 and percentage<=1) stopIndex = int((1-percentage)*len(data)) droppedData ...
# Python import time import logging import argparse import pygame import os import sys import numpy as np import subprocess import signal CONFIDENCE_THRESHOLD = 0.5 # at what confidence level do we say we detected a thing PERSISTANCE_THRESHOLD = 0.25 # what percentage of the time we have to have seen a thing os.en...
import torch import torch.utils.data import pathlib import collections from matplotlib import pyplot as plt NPRegressionDescription = collections.namedtuple( "NPRegressionDescription", ("query", "target_y", "num_total_points", "num_context_points") ) class GPCurvesReader(object): def __init__(self, batc...
# Copyright The PyTorch Lightning team. # # 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 i...
import numpy as np from numpy.linalg import pinv, inv from constants import WINDOW_HEIGHT, WINDOW_WIDTH from carla import image_converter def calc_projected_2d_bbox(vertices_pos2d): """ Takes in all vertices in pixel projection and calculates min and max of all x and y coordinates. Returns left top, righ...
import csv import glob import os import pprint from bs4 import BeautifulSoup import markdown2 import pandas as pd def get_links_from_md(file_path, markdowner=markdown2.Markdown()): with open(file_path) as f: md = f.read() html = markdowner.convert(md) soup = BeautifulSoup(html, 'html.parser') ...
""" Loads discussion section PDFs output by fetch_discussions.py. Extracts tables to Pandas DataFrames with tabula-py and outputs to /data/discussions/parsed_csvs """ import argparse from os import listdir from typing import Dict, Tuple import tabula from ferry import config from ferry.crawler.common_args import ad...
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
from collections import Counter from operator import itemgetter import math import os import pickle import re import sys from typing import Any, Dict, Optional, List, Tuple import typing import spacy # type: ignore from spacy import attrs, symbols from spacy.tokens import Doc, Span, Token # type: ignore Span.set_ex...
# -*- coding: utf-8 -*- # Copyright 2011 Fanficdownloader team, 2018 FanFicFare team # # 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...
import time import gym import numpy as np import tensorflow as tf from stable_baselines import logger from stable_baselines.common import explained_variance, tf_util from BPG.grf_policy import Actor, Critic from BPG.base_class import ActorCriticRLModel, SetVerbosity, TensorboardWriter from stable_baselines.common.run...
import logging import pytest from ophyd.sim import make_fake_device from ..sample_delivery import (HPLC, PCM, CoolerShaker, FlowIntegrator, GasManifold, Selector) logger = logging.getLogger(__name__) @pytest.mark.timeout(5) def test_sds_init(): logger.debug('test_sds_init') F...
""" A module for handling the files and directories from an illumina run """ import os import glob from scilifelab.illumina.index_definitions import BASIC_LOOKUP from scilifelab.utils.string import hamming_distance from scilifelab.bcbio.flowcell import Flowcell from scilifelab.bcbio.qc import FlowcellRunMetricsParser ...
"""test program for grid utility functions <NAME> 25 april 2014""" # grid utility routines import util # run test def run_test (test): if test == 0: grid = [] util.create_grid (grid) print (len(grid)) print (len(grid[0])) print (len(grid[1])) print (len(grid[2])) print...
""" TeX renderer slave microservice thing. Send a POST request to /render with a JSON payload of the format: { "format": "png", // string, default "png", one of "pdf", "svg" or "png" -- the format of the resulting payload "header_includes": [], // list of string, optional; extra lines to add to the beginning ...
from flask import json, jsonify from authlib.integrations.flask_oauth2 import ResourceProtector, current_token from authlib.integrations.sqla_oauth2 import create_bearer_token_validator from .models import db, User, Client, Token from .oauth2_server import TestCase from .oauth2_server import create_authorization_server...
'''Use this code to execute a portfolio optimization model. This code will select the portfolio with the maximum Sharpe Ratio. The parameters are set to use 180 days of historical data and rebalance every 30 days. This is the code used in the following article: https://blog.enigma.co/markowitz-portfolio-op...
"""Scraper specification for https://www.green-acres.gr/""" import re from datetime import datetime from typing import Any, Dict, List, Optional, Type from selenium.webdriver.common.by import By from selenium.webdriver.support.expected_conditions import presence_of_element_located from real_estate_scrapers.items impo...
# 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, software # d...
"""Contain utils for fastapi based services. This contains: * optimized logging using Loguru * optimized exception handling by additional exception handler log_exception handler * usage of a config.yml-file to configure the service * usage of environment-variables (Environment variable overwrites config-value) to...
import numpy as np from code.pytorch.LAMPO.core.model import sum_logs_np from sklearn.cluster import KMeans from scipy.stats import multivariate_normal as scipy_normal from sklearn.covariance import ledoit_wolf def stable_cov(cov, reg): reg_new = np.copy(reg) cov_new = np.copy(cov) while True: try...
from typing import Union import numba import numpy from gensim.models.basemodel import BaseTopicModel from spec2vec.Document import Document def calc_vector(model: BaseTopicModel, document: Document, intensity_weighting_power: Union[float, int] = 0, allowed_missing_percentage: Union[fl...
# This script prints a list of all in-use devices in an organization # to sdtout or a file (Devices which are part of a network are considered in-use). # The fields printed are 'serial', 'model' and 'lanIp' separated by a comma (,). # # You need to have Python 3 and the Requests module installed. You # can down...
import json from flask import request, g, jsonify from sqlalchemy import or_ from server import redis_client from server.model.organization import Organization, ReUserOrganization from server.model.user import User from server.model.group import ReUserGroup from server.model.permission import Role, ReUserRole from serv...
# coding: utf-8 from pathlib import Path import luigi import numpy as np import xarray as xr from ....utils.transforms import offset_gal from . import ExtractField3D from .base import ( NumpyDatetimeParameter, XArrayTarget, _get_dataset_meta_info, get_workdir, ) class Single3DShiftedCrop(luigi.Task)...
from base.torchnlp_dataset import TorchnlpDataset from torchnlp.datasets.dataset import Dataset from torchnlp.encoders.text import SpacyEncoder from torchnlp.utils import datasets_iterator from torchnlp.encoders.text.default_reserved_tokens import DEFAULT_SOS_TOKEN from torch.utils.data import Subset from nltk.corpus i...
# -*- coding: utf-8 -*- ''' Load devices from `NetBox <https://github.com/digitalocean/netbox>`__, and make them available for salt-ssh or salt-sproxy (or any other program that doesn't require (Proxy) Minions running). Make sure that the following options are configured on the Master: .. code-block:: yaml netbo...
import zipfile from datetime import date, timedelta from io import StringIO import numpy as np import re import argparse from pathlib import Path import pandas as pd from ploomber import DAG, SourceLoader from ploomber.products import File, GenericProduct from ploomber.tasks import (PythonCallable, ShellScript, Uploa...
# -*- coding: utf-8 -*- # Copyright 2018, IBM. # # This source code is licensed under the Apache License, Version 2.0 found in # the LICENSE.txt file in the root directory of this source tree. """ A two-ways dict that represent a layout. Layout is the relation between virtual (qu)bits and physical (qu)bits. Virtual ...
from collections import namedtuple from games import (Game) class GameState: def __init__(self, to_move, board, label=None, maxDepth=5): self.to_move = to_move self.board = board self.label = label self.maxDepth = maxDepth def __str__(self): if self.label == None: ...
import yaml import Queue import argparse import threading import lib.constants as const import subprocess32 as subprocess from lib.node import Node from lib.helper import Helper from lib.environment import Environment # queue to store all nodes node_q = Queue.Queue() # data structure to setup dhcp agent and metadata...
import NN_part2 import numpy as np import random as rd import graph_part2 import time beta = 0.2 gamma = 0.1 n = 10 tau = 25 X = [] T = [] def computeX(nb): x = [1.5] for i in range(nb): if i - tau >= 0: x.append(x[i] + (beta * x[i - tau])/(1 + x[i - tau]**n) - gamma * x[i]) else:...
# Copyright (c) 2019, <NAME> # # All rights reserved. # # The MIT License (MIT) # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the right...
# -*- coding: utf-8 -*- import os import six import pytest import odin import odin.exceptions from odin.codecs import csv_codec FIXTURE_PATH_ROOT = os.path.join(os.path.dirname(__file__), "fixtures") class Book(odin.Resource): title = odin.StringField(name="Title") num_pages = odin.IntegerField(name="Num Pag...
# coding: utf-8 # Copyright (c) 2018 ubirch GmbH. # # 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 pandas as pd import numpy as np import copy import time #load dataset with pandas and put them in numpy arrays def load(): train = "diabetes_train_features.csv" train_label = "diabetes_train_labels.csv" test = "diabetes_test_features.csv" test_label = "diabetes_test_labels.csv" df ...
__doc__ = "a module that houses the priors for our inferences" __author__ = "<EMAIL>" #------------------------------------------------- import numpy as np import healpy as hp ### non-standard libraries from gpr_isotropy.utils import (TWOPI, LOG2PI) #------------------------------------------------- class RoPrior(...
""" Signal Processing and Time Series(신호처리와 시계열)(1) """ ## 1. statsmodels 모듈 import pkgutil as pu import numpy as np import matplotlib as mpl import scipy as sp import pandas as pd import pydoc import statsmodels as sm from matplotlib.pylab import rcParams rcParams['figure.figsize'] = 15, 6 print("Statsmodels versio...
import csv import scipy.optimize import matplotlib.pyplot as plt import numpy as np from matplotlib import cm import matplotlib.colors as colors from colorsys import hsv_to_rgb import datetime as dt def running_mean(x, N): cumsum = np.cumsum(np.insert(x, 0, 0)) return (cumsum[N:] - cumsum[:-N]) / float(N) def...
# Copyright 2017 SAS Project 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 requ...
#!/usr/bin/env python # coding: utf-8 import os import pprint import pandas as pd from collections import OrderedDict def get_parameters(): # Read Data try: df_363 = pd.read_excel( io=os.path.join(os.path.dirname(__file__), 'data', 'tab_dd_363.xlsx'), sheet_name='dd_363', ...
""" Test postprocessing utilities """ import sys sys.path.append('/Users/aleaf/Documents/GitHub/flopy3') import numpy as np import flopy from flopy.utils.postprocessing import get_transmissivities, get_water_table, \ get_gradients, get_saturated_thickness mf = flopy.modflow def test_get_transmissivities(): ...
#!/usr/bin/env python3 """ SPDX-License-Identifier: BSD-3-Clause This file is part of pyocd_remote, https://github.com/patrislav1/pyocd_remote Copyright (C) 2020 <NAME> <<EMAIL>> """ from paramiko import SSHClient, SSHConfig from scp import SCPClient from sshtunnel import SSHTunnelForwarder import argparse import sys...
#!/usr/bin/python3 from adb_get_data import * from os import environ from os.path import dirname def print_output(output): if len(output) > 0: print(output) class device: def __init__(self,dev): self.dev = dev self.name = adb_get_name(dev) self.abi_support = adb_get_abis(dev...
import os import json import gzip import random import itertools import argparse import transcripts def dump(by_group, splits, subset_name, gz = True): for split_name, transcript in by_group.items(): input_path = os.path.join(splits, f'{subset_name}_{split_name}.json') + ('.gz' if gz else '') with (gzip.open(in...
import sublime import sublime_plugin import base64 import os import re import urllib.parse import urllib.request from . import get_image_size from PIL import Image, ImageSequence import threading from io import BytesIO import time IMAGE_FORMATS = 'jpg|jpeg|bmp|gif|svg|png|' g_gif_thread = None def on_hide_func(): ...
# Copyright 2020 The FedLearner 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...
""" Everynet.io endpoint. You must declare environment variable EVERYNET_URL to activate this plugin. """ import os import json import base64 import logging import datetime import pytz import re import random from django.conf import settings from django.conf.urls import url from django.http import HttpResponse from ...
import atexit from time import sleep from random import choice from typing import Sequence, Tuple from sense_hat import SenseHat Cordinate = Tuple[int, int] Shape = Sequence[Tuple[int, int]] Color = Tuple[int, int, int] rotation = { 'up': 0, 'down': 1 } movement = { 'left': -1, 'right': 1 } pieces...
from collections import defaultdict import sys from SPARQLWrapper import SPARQLWrapper, JSON from csv import reader import pandas as pd import sqlite3 class TripleReader: def __init__(self, triples_file): self.baseuripred = "http://www.wikidata.org/prop/direct/" self.baseuriobj = "http://www.wiki...
import os import sys import argparse import logging from tqdm import tqdm from boat_prediction_model import * from boat_prediction_dataset import * import torch from torch import optim import torch.nn as nn import torch.nn.functional as F from torch.utils.tensorboard import SummaryWriter from torch.utils....
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Mar 3 10:39:32 2017 @author: gtucker """ from landlab import RasterModelGrid from landlab.components import (DepthDependentTaylorDiffuser, ExponentialWeatherer) import numpy as np from numpy.testing import assert_array_...
import os from requests.exceptions import RequestException import pytest from unittest.mock import create_autospec, Mock from pyquil.api import WavefunctionSimulator, ForestConnection, QVMConnection, get_benchmarker from pyquil.api._errors import UnknownApiError from pyquil.paulis import sX from pyquil import Program...
# MIT License # Copyright (c) 2019 <NAME> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish,...
import abc import os from typing import Any, Dict, List import inflection import torch import torch.nn as nn from torch import Tensor from .data import DataNode from .node import Node, TensorDict from .optim import OptimNode from ..util.args import Args from ..writer import EpochWriter, ExecWriter Metrics = Dict[str...
# coding=utf-8 """Drawing a Quad via a EBO""" import glfw from OpenGL.GL import * import OpenGL.GL.shaders import numpy as np __author__ = "<NAME>" __license__ = "MIT" # We will use 32 bits data, so floats and integers have 4 bytes # 1 byte = 8 bits SIZE_IN_BYTES = 4 # A class to store the application control cla...
import os os.chdir(os.path.dirname(os.path.abspath(__file__))) path = os.path.abspath("../..") import os import sys import json sys.path.append(path + "/lib/others") from API_method import get, post, put from info_print import printout import base64 import requests import datetime #パラメータの設定時の出力 def set_parm(param_n...
testMsgList = ['!AIVDM,1,1,,B,15MWKF0000rvJ>DHvVU:uJ8>0L0I,0*39\r\n', '!AIVDM,1,1,,A,33ci1b1000rvU90HvmUVa6BJ0000,0*29\r\n', '!AIVDM,1,1,,A,15MWKF0300rvJ>DHvVTruJ8R0H9t,0*2C\r\n', '!AIVDM,2,1,0,B,53ci1b02??ShT<DJ221H4hhF08T4p<622222221@B`R8H6T10ID3lU30CQ:5,0*36\r\n', '!AIVDM,2,2,0,B,DhJH8888880,2*09\r\n', '!AIVDM,1,1,...
# Copyright 2013-2019 The Meson development team # 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...
"""Demonstrate Network CloudRF API.""" import argparse import configparser import csv import os import textwrap from pathlib import Path from cloudrf import CloudRFAPI class CloudRFNetwork(CloudRFAPI): """Network API class""" endpoint = '/API/network/' api_id = 'network' file_types = ['chart', 'kml...
# # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # # Credits to <NAME> for the Squashed normal and TanhTransform # https://github.com/denisyarats/pytorch_sac import torch import torch.nn a...
from dataclasses import dataclass import time import requests import logging logging.basicConfig(level=logging.INFO, format='[%(levelname)s] %(message)s') logger = logging.getLogger() logger.addHandler(logging.FileHandler('bottango_python_api.log', 'a')) @dataclass class Effector: name: str live: bool i...
# Copyright (c) 2015, Danish Geodata Agency <<EMAIL>> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND T...
from __future__ import print_function, absolute_import, division import numpy as np def load_obj_data(filename): """load model data from .obj file""" v_list = [] # vertex coordinate vt_list = [] # vertex texture coordinate vc_list = [] # vertex color vn_list = [] # vertex normal f_list = [...
import discord from discord.ext import commands import os import asyncio import json import random from aiohttp import ClientResponseError from dotenv import load_dotenv from blagues_api import * load_dotenv() KEY = os.getenv("jokes") jokes = BlaguesAPI(KEY) SCRIPT_DIR = os.path.dirname(__file__) FILE_PATH = os.pat...
from shlex import split from subprocess import check_call from charms.docker import Compose from charms.docker import DockerOpts from charms.reactive import is_state from charms.reactive import set_state from charms.reactive import remove_state from charms.reactive import when from charms.reactive import when_any fro...
""" adapted from https://github.com/openai/spinningup/blob/master/spinup/algos/pytorch/vpg/vpg.py """ import torch import carla.agents.core as core import numpy as np from collections import deque from PIL import Image from torch.utils.data import Dataset class MultipleWorkerBuffer: """ A buffer for storin...