text
stringlengths
3.07k
12.6k
#!/usr/bin/env python # Copyright (c) 2013. <NAME> <<EMAIL>> # # This work is licensed under the terms of the Apache Software License, Version 2.0. See the file LICENSE for details. """ Description here """ import madsenlab.axelrod.analysis as stats import madsenlab.axelrod.data as data import logging as log import...
# Copyright (c) 2021, NVIDIA CORPORATION. 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...
import torch import torchvision import torchvision.transforms as transforms from random import Random from asyncfeddr.utils.file_io import * class Dataset(torch.utils.data.Dataset): 'Characterizes a dataset for PyTorch' def __init__(self, data, labels): 'Initialization' self.labels = torch.tensor(labels) sel...
""" Example test script. This is a complete, working example that can be run as part of the test suite. It does a simple test of a relativistic shock tube using the GR framework. There are many comments in order to make this file self-explanatory, but the actual working code is only 28 lines long. There are three fun...
import pickle import re import pytest from spacy.attrs import ENT_IOB, ENT_TYPE from spacy.lang.en import English from spacy.tokenizer import Tokenizer from spacy.tokens import Doc from spacy.util import compile_infix_regex, compile_prefix_regex from spacy.util import compile_suffix_regex, get_lang_class, load_model ...
""" """ from .baserawio import (BaseRawIO, _signal_channel_dtype, _spike_channel_dtype, _event_channel_dtype) import numpy as np from pathlib import Path try: import h5py HAVE_HDF5 = True except ImportError: HAVE_HDF5 = False def _load_sample_rate(params_file): sample_rat...
#!/usr/bin/python3 from time import gmtime, strftime import json, csv import alpaca_trade_api as tradeapi def authentication_header(): """ get's key and returns key in json format """ file_path = '../key.json' with open(file_path, 'r') as file: header = json.load(file) return header def api(...
""" Read audio stream, and play it, using installed vlc player (libvlc) """ # python standard lib import sys import os import time from typing import List import ctypes from subprocess import Popen, PIPE from multiprocessing import Process, Queue import logging # externals main_logger = logging.getLogger("main") de...
import subprocess import os import copy from collections import OrderedDict def recursively_sweep_parameters(pars_to_sweep,par_dict=OrderedDict(),swept_parameter_list=[]): cur_pars = copy.deepcopy(pars_to_sweep) # get first key and remove it cur_keys = list(cur_pars.keys()) if len(cur_keys)==0: ...
#!/usr/bin/env python # coding: utf-8 # In[1]: import time import os import numpy as np import torch import torchvision.transforms as tv from torchvision.utils import make_grid from PIL import Image from torchvision.transforms import Compose import logging import matplotlib.pyplot as plt import pandas as pd import gl...
from bs4 import BeautifulSoup import requests, TTS, time, sys from TTS import * # test game url hawks v bucks https://www.espn.com/nba/playbyplay/_/gameId/401337344 headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36'} def get...
from copy import deepcopy from typing import Optional from warnings import warn import numpy from catsim import cat from catsim.simulation import Estimator, Selector from sklearn.linear_model import LogisticRegression def _fit_log_reg( items, administered_items, response_vector, use_discriminations=T...
from dnsdumpster import DNSDumpsterAPI import socket import binascii ''' ############################################ # SUBDOMAINS # ############################################ ''' def subdomains_search(host): dnsdumpster_data = DNSDumpsterAPI.DNSDumpsterAPI().search(host) ret...
#!/bin/env python # Distributed under the MIT License. # See LICENSE.txt for details. import glob import h5py def generate_xdmf(file_prefix, output_filename, start_time, stop_time, stride): """ Generate one XDMF file that ParaView and VisIt can use to load the data out of the HDF5 files. """ h5f...
try: from collections.abc import MutableMapping except ImportError: from collections import MutableMapping from collections import namedtuple from functools import partial from sqlalchemy import PickleType, Column from sqlalchemy.orm import deferred from sqlalchemy.ext.declarative import declared_attr from sql...
from __future__ import print_function SAS_FILE_VERSION = 3 class SASTask: def __init__(self, variables, mutexes, init, goal, operators, axioms, metric): self.variables = variables self.mutexes = mutexes self.init = init self.goal = goal self.operators = so...
from time import time from random import seed, randint from argparse import ArgumentParser from pandas import read_csv from numpy import linalg, array from math import sin, cos from visualizer.visualizer import Visualizer from algo.greedy_rotate import greedy_rotate from algo.cross_path_dismantling import cross_path_d...
import os os.environ['CUDA_VISIBLE_DEVICES'] = '0' import cv2 import keras import numpy as np import matplotlib.pyplot as plt import albumentations as A # Data loader and visualization functions # helper function for data visualization def visualize(**images): """PLot images in one row.""" n = len(images) ...
from flask_classy import FlaskView, route from flask import render_template, request, redirect, url_for, flash, session, send_from_directory from flask_login import current_user from flask_mail import Message from flask_babel import gettext from itsdangerous import SignatureExpired, URLSafeTimedSerializer import app.c...
from aiothornode.env import TEST_NET_ENVIRONMENT_MULTI_1, MULTICHAIN_CHAOSNET_ENVIRONMENT, ThorEnvironment from services.lib.date_utils import MINUTE BNB_BNB_SYMBOL = 'BNB.BNB' BNB_BUSD_SYMBOL = 'BNB.BUSD-BD1' BNB_BUSD_TEST_SYMBOL = 'BNB.BUSD-BAF' BNB_BUSD_TEST2_SYMBOL = 'BNB.BUSD-74E' BNB_BTCB_SYMBOL = 'BNB.BTCB-1...
import numpy as np import pyscf from pyresponse.ao2mo import AO2MO from pyresponse.pyscf import molecules as molecules_pyscf from pyresponse.pyscf.ao2mo import AO2MOpyscf from pyresponse.pyscf.utils import occupations_from_pyscf_mol from pyresponse.utils import fix_mocoeffs_shape def test_ao2mo_hand_against_pyscf_r...
import os import time import tempfile import redis import logging import socket import shlex import shutil import atexit import subprocess log = logging.getLogger(__name__) def find_free_port(): """ Finds a free port and binds a temporary socket to it so that the port can be "reserved" until used. ....
import numpy as np import xarray as xr from ..utils.jaggedarray import flatten_jagged_array MESH_ATTRS = { "cf_role": "mesh_topology", "long_name": "Topology data of 2D unstructured mesh", "topology_dimension": 2, "node_coordinates": "x_of_node y_of_node", "face_node_connectivity": "nodes_at_patch...
# python import json import logging from datetime import datetime from typing import Dict, List, Optional, Tuple # libs import jwt from django.conf import settings from rest_framework import status from rest_framework import exceptions from rest_framework.authentication import TokenAuthentication from rest_framework.r...
import string ######## COMMON API ########## E_INTEGER = 'INT' E_STRING = 'STR' E_BIN_RAW = 'RAW' E_BLOCK = 'BLK' E_OFFSET_LABEL = 'OFF' E_BIN_CONCAT = 'BINCAT' E_BUILTIN_FUNC = 'BUILTIN' E_NEEDS_WORK = 'NEEDS_WORK' def e_needs_work(length=None): return {'len': length, 'final': False, 'type':E_NEEDS_WORK...
import numpy as np import numpy.ma as ma from numpy.testing import assert_array_equal import netCDF4 import pytest from cloudnetpy.cloudnetarray import CloudnetArray from cloudnetpy import utils from cloudnetpy.metadata import MetaData @pytest.fixture(scope='session') def fake_nc_file(tmpdir_factory): """Creates ...
"""Panda package management for Windows. DC/OS installation state descriptor type definition. """ import json from pathlib import Path from common import logger from common import constants as cm_const from common.storage import ISTOR_NODE, IStorNodes from core import exceptions as cr_exc from core import utils as cr...
# Copyright # 2019 Department of Dermatology, School of Medicine, Tohoku University # # 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/LICENS...
#! /usr/bin/python import threading import inspect from functools import wraps import sys sys.path.append('..') from rpc_core.utils import make_request from rpc_core.utils import get_host_ip from rpc_core.utils import handle_result from rpc_core.exceptions import IncorrectSignature from rpc_core.codec.rpc_encoder imp...
# The MIT License (MIT) # Copyright (c) 2018 by the xcube development team and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation...
import yaml from copy import deepcopy from pprint import pformat from pytezos.michelson.grammar import MichelsonParser, MichelsonParserError from pytezos.michelson.converter import michelson_to_micheline, micheline_to_michelson from pytezos.repl.control import do_interpret, MichelsonRuntimeError from pytezos.repl.help...
from telegram.chat.singleton_bot import bot from telegram.chat.db_session import session_scope from web.app.models import Course from telegram.chat.messages import get_message_with_course_prefix from telebot.apihelper import ApiTelegramException from api_helper.lms_api_helper import LmsApiHelper from api_helper.fauna_h...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import...
""" Test effects of construction of a pipeline manager. """ import argparse import pytest from pypiper.manager import CHECKPOINT_SPECIFICATIONS from tests.helpers import named_param __author__ = "<NAME>" __email__ = "<EMAIL>" def pytest_generate_tests(metafunc): """ Dynamic test case generation for this modul...
#Note: this script maintains a slight syntactic difference in the xml file between positive and negative examples, see line 33/34 #Note: This script takes separate filenames for gold set positive and negative examples. Because it exclusively searches for positive examples # in the positive one, and negative in the n...
import matplotlib matplotlib.use('agg') # -*- coding: utf-8 -*- """ Created on Mon Dec 4 11:31:53 2020 This script: * Produces Bcell DN * Performs reactome analysis * Plots Heatmaps ----> must initialize before import the module * Plots the DN ----> must initialize before import the module @author: ...
# Lint as: python2, python3 r"""Trainer for babelfish models. You should follow {allocator_,}trainer{,_sync}.REDACTED's instruction when training a model on REDACTED. You can also run the trainer locally on your workstation: $ REDACTED build -c opt --define=babelfish_task=speech \ learning/REDACTED/research/babel...
# -*- coding: utf-8 -*- """ Created on Wed Aug 17 16:17:24 2016 Common functions and data for News project @author: Justin """ try: import cPickle as pickle except: import pickle import ujson as json from bz2 import BZ2File from fox_1990_stoplist import fox_stoplist ghentzkow_shapiro_stopli...
# -*- coding: utf-8 -*- """Main training module for pytorch training on DCGAN model This module puts together data and model, and perform various DCGAN trainings, including train, Example: trainer = Trainer(config, args, opt) trainer.train() Todo: arithmetic operations, other functions needed for ex...
# ===-- productpipeline_list_builder.py ----------------------------------===# # # This source file is part of the Swift.org open source project # # Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See https:#swift.org/LICENSE.txt...
import re class CannotGetMiroShard(Exception): pass def choose_miro_shard(miro_id): """ Decides the shards that a Miro ID belongs to. We group the Miro IDs into per-thousand "shards". This is an organisational scheme inherited from the way Miro assets were laid out from disk in the old Mir...
#!/usr/bin/env python import numpy import scipy.ndimage import pyami.arraystats import pyami.imagefun import pyami.numpil import pyami.correlator import pyami.mrc import lattice from pyami.ordereddict import OrderedDict import targetworkflow class ImageInput(targetworkflow.ImageProducer): '''result is an image, eith...
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
"""gRPC server to receive devices state""" from concurrent import futures from queue import Queue import logging import sys import time import threading import grpc import logger import daq.proto.session_server_pb2_grpc as server_grpc from daq.proto.session_server_pb2 import ( SessionParams, SessionProgress, Sess...
# Generated from PDDLGrammar.g4 by ANTLR 4.7 # encoding: utf-8 from __future__ import print_function from antlr4 import * from io import StringIO import sys def serializedATN(): with StringIO() as buf: buf.write(u"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3") buf.write(u"\6\26\4\2\t\2\4\3\...
""" Write data to an Excel workbook. """ from datetime import datetime import os from openpyxl import Workbook from openpyxl.styles import NamedStyle, Font, Border, Side, PatternFill def usage(data): """Write data to an Excel spreadsheet.""" highlight = NamedStyle(name='highlight') highlight.font = Font(...
import atexit, os, re, sys import ctypes from ctypes.util import find_library import sysconfig import math class RTreeError(Exception): "RTree exception, indicates a RTree-related error." pass def get_windows_platform_name(): libname = 'libmgrs' try: import wheel.pep425tags name = whe...
import RPi.GPIO as GPIO import time, threading, requests, json, spidev, sys import Adafruit_GPIO.SPI as SPI import Adafruit_MCP3008 from env_setup import ENV_API_URL, ENV_LOCATION_ID GPIO.setmode(GPIO.BCM) mcp = Adafruit_MCP3008.MCP3008(clk = 21, cs = 8, miso = 19, mosi = 20) # ~~~~~~~~~ SPI SETUP ~~~~~~~ bus = 0 dev...
""" Sony .spi3d LUT Format Input / Output Utilities =============================================== Defines the *Sony* *.spi3d* *LUT* format related input / output utilities objects: - :func:`colour.io.read_LUT_SonySPI3D` - :func:`colour.io.write_LUT_SonySPI3D` """ from __future__ import annotations import nump...
import numpy as np import matplotlib.pyplot as plt import math from PIL import Image from ipywidgets import interact def Create_alloy(N, Xa, n, T, E): """ A random alloy is represented as a 2 dimensional lattice gas in which alloying atoms can exchange position with matrix atoms using the Metropoli...
#!/usr/bin/env python import sys import os import numpy as np import matplotlib.pyplot as plt import multiprocessing as mp import itertools ROOT_DIR = os.getenv('PLASTICC_DIR') MOD_DIR = os.path.join(ROOT_DIR, 'plasticc') sys.path.append(MOD_DIR) from plasticc.get_data import GetData def get_class_distributions(field...
import unittest import os.path import numpy as np import psychic from psychic.dataformats.bdf import BDFReader, BDFWriter, le_to_int24, int24_to_le, load_bdf, save_bdf from ..markers import markers_to_events, biosemi_find_ghost_markers from functools import reduce class TestConversion(unittest.TestCase): def setUp(s...
import os import sys from datetime import datetime import logging import importlib import importlib.util from configparser import ConfigParser import json import tensorflow as tf import ram tf.enable_eager_execution() def add_option_to_config_file(config_file, section, option, value): config_parser = ConfigPa...
#!/usr/bin/env python3 # Copyright (c) 2020 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """ Test addr relay """ from test_framework.messages import ( CAddress, NODE_NETWORK, NODE_WITNESS...
import os os.environ["AUTOGL_BACKEND"] = "pyg" import time import torch import torch.nn.functional as F import numpy as np import os.path as osp import random from torch_geometric.datasets import Planetoid from torch_geometric.data import Data from autogl.module.model.pyg import AutoGCN, AutoGAT, AutoSAGE import torch...
""" Handles request to the viewers redirection entrypoints """ import logging import urllib.parse from typing import Optional import aiohttp from aiohttp import web from aiohttp.client_exceptions import ClientError from models_library.services import KEY_RE, VERSION_RE from pydantic import BaseModel, HttpUrl, Validat...
# Copyright (C) 2022 viraelin # License: MIT import json from PyQt6.QtCore import * from PyQt6.QtWidgets import * from PyQt6.QtGui import * class SubCell: def __init__(self, x: int, y: int, rect: QRectF) -> None: self.state = False self.x = x self.y = y self.rect = rect ...
import codecs import json import os import sys import click import requests from requests import RequestException, HTTPError from slugs import slugify from textmenu import get_colored_enumerated_list __version__ = '0.2.0' def package_request(url, data, access_token): url = 'https://api.smartsheet.com/2.0/' + u...
#! /usr/bin/env python3 """Generate coroutine wrappers for block subsystem. The program parses one or several concatenated c files from stdin, searches for functions with the 'generated_co_wrapper' specifier and generates corresponding wrappers on stdout. Usage: block-coroutine-wrapper.py generated-file.c FILE.[ch].....
import math import matplotlib.pyplot as plt ############################################# # PROBLEM AUTONOMICZNY # ############################################# l = -1 tmin = 0 tmax = 5 dts = (0.01, 0.1, 1.0) def solution(t): return math.exp(l * t) def solve(file_name, method_name, recipe): plt.figure(0) plt...
#This script is used for the data exchange. #It pulls the actual dataset from the git repository. #We use this repository as a data exchange platform. #The reason for that is, to have a plublic place, which #we can access from everywhere. For example from the #Docker Container on the HPC-Server, from the ground trut...
""" This example uses the nRF24L01 as a 'fake' BLE Beacon .. warning:: ATSAMD21 M0-based boards have memory allocation error when loading 'fake_ble.mpy' """ import time import board import digitalio from circuitpython_nrf24l01.fake_ble import ( chunk, FakeBLE, UrlServiceData, BatteryService...
# Submit job to the remote cluster import yaml import sys import time import random import os, subprocess import pickle, datetime import socket def load_yaml_conf(yaml_file): with open(yaml_file) as fin: data = yaml.load(fin, Loader=yaml.FullLoader) return data def process_cmd(yaml_file): curre...
import os import re from io import BytesIO, IOBase from pathlib import Path from typing import Union, Optional, List import pprint import inflect # type: ignore import pandas as pd # type: ignore import requests def default_csv_path() -> str: """ return the full path to the local csv file included in the p...
import re from datetime import datetime, timedelta from enum import Enum from typing import Optional, Pattern, Union __all__ = ["EVERY", "Calendar", "Interval"] _DEFAULT = object() RE_PARSER: Pattern = re.compile(r"^(@?\d+|\*)([a-zA-Z])$") class Interval(Enum): START = "at_start" END = "at_end" class Repr...
import os from imutils import paths import numpy as np import xml.etree.ElementTree as ET from scipy import stats from xml.dom import minidom # The paramater of the function is a path that contains the predictions of the def nonMaximumSupression(detections_path): output_path = detections_path[:detections_path.rfi...
import os import tarfile import argparse import pandas as pd from tqdm import tqdm import tensorflow as tf class PersonIdAudio: def __init__(self, audio_content, sr, verbose=0): """ Constructor Arguments: audio_content: dictionary containing person_id as keys and a ...
#!/usr/bin/env python # coding: utf-8 # ## Train a character-level GPT on some text data # # The inputs here are simple text files, which we chop up to individual characters and then train GPT on. So you could say this is a char-transformer instead of a char-rnn. Doesn't quite roll off the tongue as well. In this exa...
# Halley's Skill Plugin API # @author <NAME> from halley.skills.tdl.utils import * from halley.skills.exception import * from halley.skills.tdl.operators.word import WORD from halley.skills.tdl.operator import OpDescriptor from halley.skills.tdl.preprocessor import Preprocessor class RuleCompiler(object): """ the d...
import struct from .models import config # https://truct.readthedocs.io/en/latest/#example-usage CONFIG_BYTES_FORMAT_STR = ('?' # CF00 tx_enable 1 'B' # CF01 tx_interval 8 'B' # CF02 tx_interval_downlink 8 'B' # CF03 tx_datarate ...
# Copyright (c) 2017 The Khronos Group 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 ...
## two types of PAAC: 100 = 50 + 50 from ._PseudoAAC import GetPseudoAAC as GetPAACtype1 from ._PseudoAAC import GetAPseudoAAC as GetPAACtype2 ### AACs: 820 = 20 + 400 + 400 from ._AAComposition import CalculateAAComposition as GetAAC1 from ._AAComposition import CalculateDipeptideComposition as GetAAC2 from ._AACompo...
__author__ = "<NAME> - 16600748" import string, os, json, math, random from time import time import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from tensorflow.python.keras.models import Sequential from tensorflow.python.keras import preprocessing, layers, optimizers from tensorflow.python.kera...
#!/usr/bin/env python3 import argparse import os from collections import defaultdict from enum import Enum from ts import * from isobmff import * def get_offsets(segment_file_name, initialization_segment): offsets = defaultdict(list) last_pts = {} pes_packet = None for pes_packet in read_pes(segment_...
""" Generates Refined PNG table for dicom slices in the series that have 3D segmentations This process uses dicom and mhd annotation proxy tables. The PNG table contains paths to dicom png and overlay image that combines dicom and its corresponding segmentation. """ import os, time, shutil import click from luna.co...
import codecs import os import re def read(*parts): """ Build an absolute path from *parts* and and return the contents of the resulting file. Assume UTF-8 encoding. """ here = os.path.abspath(os.path.dirname(__file__)) with codecs.open(os.path.join(here, *parts), "rb", "utf-8") as f: ...
#!/usr/bin/env python # 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. """Remove the build metadata embedded in the artifacts of a build.""" import json import multiprocessing import optparse import os impo...
import os from collections import OrderedDict from textwrap import dedent from qtpy import QtCore, QtWidgets, QtGui from qtpy.QtWidgets import QPushButton import matplotlib.backends.backend_qt5agg as backend_qtagg from matplotlib.figure import Figure import matplotlib.pyplot as plt from SiQt.dep_resolv import calcula...
""" Created on 03/03/2020 Reddit Scraper 0.2 - Scrapes Posts and comments of given subreddits, outputs a subreddit json @author: <NAME> """ from os.path import isfile import logging import praw import pandas as pd from time import sleep import csv import json import datetime as dt import os import errno import time im...
# -*- mode: python; encoding: utf-8 -*- # # Copyright 2014 the Critic contributors, Opera Software ASA # # 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...
"""Advent of Code 2018 Day 20.""" from collections import deque WALL = '#' DOOR_H = '-' DOOR_V = '|' UNKNOWN = '?' ROOM = '.' START = 'X' MOVES = ( (-1, 0), (1, 0), (0, -1), (0, 1), ) DIRECTIONS = { 'N': (-1, 0), 'E': (0, 1), 'W': (0, -1), 'S': (1, 0) } DIRECTION_TO_DOOR = { 'N': D...
#!/usr/bin/python DOCUMENTATION = """ --- module: comware_mtu short_description: Manage mtu and jumboframe of the interface description: - Manage mtu and jumboframe of the interface version_added: 1.0 category: Feature (RW) author:hanyangyang notes: - mtu can be set in interface type of ['GigabitEthernet','Te...
import math import time from pytest import approx, raises import numpy as np import torch from time import process_time from meter import Meter, MovingWindowMeter, MeterDict, timed, Timing, get_global_meter, ProgressFormatter def test_init(): d = {'a': Meter(), 'b': 1} m = MeterDict(**d) assert len(m) ...
# # Copyright 2016 The BigDL 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 to in ...
import numpy as np class Env: ##Assuming the obstacles here is the same with boundary, when agent is trying to enter obstacle or hit the wall, he will stay at the current state def __init__(self, height, width, envrand): ##Height and width is the size of the gridworld, envrand is the stochastic in this...
""" Generate routes """ import ast from ast import Attribute, Call, ClassDef, FunctionDef, Name from itertools import chain from operator import attrgetter, itemgetter from os import path from cdd import parse from cdd.ast_utils import get_value from cdd.pure_utils import filename_from_mod_or_filename, rpartial from ...
import rbs_oracle_common import click import logging import sys @click.command() @click.option('--source_host_db', '-s', type=str, required=True, help='The source <host or RAC cluster>:<database>') @click.option('--mounted_host', '-m', type=str, required=True, help='The host with the live mount to remove') @click.o...
#!/usr/bin/env python # $Id: UnittestDB.py,v 1.1 2007/03/22 15:15:04 valya Exp $ """ This creates a database for unit tests. """ __author__ = "<NAME> <<EMAIL>>" __revision__ = "$Revision: 1.1 $" # system modules #import re #from sqlalchemy import MetaData, Column, Table, Integer, ForeignKey from pyquerybuilder.tools....
"""Provide functionality to handle package settings.""" import logging from enum import Enum from os import makedirs from os.path import isdir from urllib.error import URLError from urllib.parse import urlparse from urllib.request import Request, urlopen from dynaconf import Validator, settings LOGGER = logging.getLo...
#장고 템플릿 사용 안함 #from django.shortcuts import render #APIView: 엘리멘트를 가져오고 보여주고 method 관리 #reponse : http response from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import status from . import models, serializers # Create your views here. """ requeset 에 대하여 ht...
import re import pandas as pd from keras.layers import Dense, Embedding, LSTM from keras.models import Sequential from keras.preprocessing.sequence import pad_sequences from keras.preprocessing.text import Tokenizer turkish_characters = "a|b|c|ç|d|e|f|g|ğ|h|ı|i|j|k|l|m|n|o|ö|p|r|s|ş|t|u|ü|v|y|z|0-9" data = pd.read_cs...
from requests.exceptions import ConnectionError from PyQt5.QtWidgets import QDialog, QLineEdit MAN = 1 KING = 2 FIRST = 1 SECOND = 2 WE_REQUESTED_DRAW = 1 DRAW_REQUESTED_FROM_US = 2 ALWAYS_ACCEPT = 'always' ALWAYS_DECLINE = 'never' ACCEPT_IF_LOSING = 'if_losing' DEFAULT_SERVER_URL = "http://localhost:8864" PROXY...
#%% import pandas as pd import re #from gensim.summarization import keywords #from gensim.summarization.keywords import get_graph #from RAKE import Rake from collections import Counter #import multiprocessing #from preprocess import stopwords #import (spacy) stopwords used during preprocessing. # visualizations ...
# plot_utils.py # # This file is part of scqubits: a Python package for superconducting qubits, # arXiv:2107.08552 (2021). https://arxiv.org/abs/2107.08552 # # Copyright (c) 2019 and later, <NAME> and <NAME> # All rights reserved. # # This source code is licensed under the BSD-style license found in the # L...
# @title Defining a time-dependent score-based model (double click to expand or collapse) import torch import torch.nn as nn import torch.nn.functional as F import numpy as np class GaussianFourierProjection(nn.Module): """Gaussian random features for encoding time steps.""" def __init__(self, embed_dim, sc...
# standard library imports import math import os import socket import struct import time from pathlib import Path from threading import Lock, Thread # third-party imports import cv2 import numpy as np # local imports from tmrl.config.config_constants import LIDAR_BLACK_THRESHOLD class TM2020OpenPlanetClient: de...
#! /usr/bin/env python # -*- coding: utf-8 -*- """ @Author:_defined @Time: 2018/9/20 16:58 @Description: """ import time import re import json import math from bs4 import BeautifulSoup from ..decorators import parse_decorator __all__ = ['parse_search_article_result', 'parse_total_page', 'parse_article_content', 'pa...
from cloudchef_integration.tasks.cloud_resources.commoncloud.utils import format_power_status, format_ins_status from cloudchef_integration.tasks.cloud_resources.commoncloud.response import FilterResponse class ZstackStandardResponse: @classmethod def instance(cls, resp): instances = [] resp =...
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html from scrotten_movie.models import ScrottenMovie from scrotten_member.models import ScrottenMember from scrotten_movie_to_membe...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import requests import json import re import datetime from logging import getLogger basedate = datetime.date(1899, 12, 30) basedatetime = datetime.datetime(1899, 12, 30) def ss_to_xy(s): """convert spreadsheet coordinates to zero-index xy coordina...