text
stringlengths
3.07k
12.6k
#!/usr/bin/env python # -*- coding: utf-8; py-indent-offset:4 -*- ############################################################################### # # Copyright (C) 2017 <NAME> <<EMAIL>> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as pub...
import os import json import datasets import collections from tflearn.data_utils import to_categorical class TwitterEmotion(object): def __init__(self, train_validation_split=None, test_split=None, use_defaults=True): if train_validation_split is not None or test_split is not None or \ ...
"""Base Class for Strategies""" import importlib import traceback from datetime import datetime from enum import Enum from typing import Dict, List, Optional, Tuple import alpaca_trade_api as tradeapi from pandas import DataFrame as df from liualgotrader.common import config from liualgotrader.common.data_loader impo...
# __author__ = 'max' # modified by michihiro import logging import sys import numpy as np import lasagne from gensim.models.word2vec import Word2Vec import gzip import theano import pickle def get_logger(name, level=logging.INFO, handler=sys.stdout, formatter='%(asctime)s - %(name)s - %(levelname)s - ...
from IPython.display import clear_output import random def display_board(board): clear_output() print(board[1]+'|'+board[2]+'|'+board[3]) print("-----") print(board[4]+'|'+board[5]+'|'+board[6]) print("-----") print(board[7]+'|'+board[8]+'|'+board[9]) print("-----") def pla...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' This module contains functions to convert between Cartesian and prolate spheroid coordinates. Prolate spheroid coordinates defines intersecting prolate spheroids and hyperboloids. Prolate spheroid coordinates ---------------------------- | x = a sinh mu cosh nu cos ...
import torch.nn as nn class Generator(nn.Module): """Full convolution generator""" def __init__(self, channels_noise, channels_img, features_gen): """ :param channels_noise: ``int``, input latent space dimension :param channels_img: ``int``, 3 for RGB image or 1 for GrayScale ...
import datetime import os import numpy as np import yaml from constants.statistics import ModelDescriptor CV_DATA_FILE = "cv_data.csv" class Config: def __init__(self, user_config_file: str): with open(user_config_file, 'r') as user_config: config = yaml.safe_load(user_config) self....
import operator import logging import pyfastaq from cluster_vcf_records import vcf_record class Error (Exception): pass def vcf_file_to_dict(infile, sort=True, homozygous_only=False, remove_asterisk_alts=False, max_REF_len=None, remove_useless_start_nucleotides=False, min_SNP_qual=None, min_dp4=None, min_GT_conf=No...
from collections import namedtuple from random import randrange from flask import abort, flash, redirect, render_template, session, url_for from num2words import num2words from requests.exceptions import HTTPError from src.blueprints import root from src.core import api from src.core.filters import date as date_forma...
# -*- coding: utf-8 -*- import base64 import cv2 from flask import Flask, render_template from flask_socketio import SocketIO, emit import multiprocessing import os import threading import types # logging from logging import getLogger, NullHandler, CRITICAL logger = getLogger(__name__) logger.addHandler(NullHandler()...
"""Sora no Aosa wo Shiru Hito yo script""" __author__ = 'Vardë' import sys from typing import NamedTuple from vsutil import core, vs, depth, get_y, join from cooldegrain import CoolDegrain from vsTAAmbk import TAAmbk import vardefunc as vdf import kagefunc as kgf import havsfunc as hvf import debandshit as dbs impor...
import tensorflow as tf import numpy as np from tensorflow.compat.v1.train import AdamOptimizer #### Create tf model for Client #### def AlexNet(input_shape, num_classes, learning_rate, graph): """ Construct the AlexNet model. input_shape: The shape of input (`list` like) num_classes: The ...
# Based on code from https://github.com/tensorflow/cleverhans # # This is the code for the paper # # Certifying Some Distributional Robustness with Principled Adversarial Training # Link: https://openreview.net/forum?id=Hk6kPgZA- # # Authors: <NAME>, <NAME>, <NAME> from __future__ import absolute_import from __future_...
import tensorflow as tf import numpy as np from typing import Tuple from modules.utils import PostNet, CBHGLayer, PreNet, PositionalEncoding from modules.attention import BahdanauAttention, CrossAttentionBLK class BasePosterior(tf.keras.layers.Layer): """Encode the target sequence into latent distribu...
################################################################################# # Copyright (c) 2018-2021, Texas Instruments Incorporated - http://www.ti.com # All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditio...
#!/usr/bin/env python # coding: utf-8 r"""Conversion procedure of a FreeCAD file.""" from __future__ import print_function, absolute_import import logging from os import remove from os.path import basename, join, splitext from shutil import rmtree import zipfile import xml.etree.ElementTree from aocxchange.brep imp...
from lxml import etree as et from copy import copy from utils import is_empty_string, SafeString from node_factory import get_ns, create_bold_hi_node, create_normal_hi_node, create_italic_hi_node def fix_morph_numbers(contents): def number_one_is_in_c0(content0): return len(content0.strip()) > 2 and cont...
import pytest from plenum.common.constants import LEDGER_STATUS from plenum.common.messages.node_messages import Checkpoint, LedgerStatus from plenum.common.startable import Mode from plenum.server.node import Node from plenum.server.replica import Replica from plenum.server.replica_validator_enums import STASH_CATCH_...
""" Basic tools for Bertran index manipulation. """ import functools import itertools import numpy from scipy.special import comb import chaospy.bertran _ADD_CACHE = {} _MULTI_INDEX_CACHE = {} def add(idxi, idxj, dim): """ Bertran addition. Args: idxi (Tuple): Index in integer nota...
#!/usr/bin/env python # Copyright 2014-2018 The PySCF Developers. 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 # # U...
import os import time import argparse import torch from collections import defaultdict from pytorch_pretrained_bert import BertTokenizer, BertModel, BertForMaskedLM import matplotlib import matplotlib.pyplot as plt import numpy as np from .utils import get_idf_dict, bert_cos_score_idf,\ get_bert_emb...
import itertools import time import cv2 import imutils as imutils import numpy as np from skimage.filters import threshold_local def order_points(pts): # initialzie a list of coordinates that will be ordered # such that the first entry in the list is the top-left, # the second entry is the top-right, the...
""" Module for manageing crontabs interface """ import datetime import time import traceback import daiquiri from dateutil.parser import parse from dateutil.relativedelta import relativedelta from fleming import fleming from .processes import ProcessMonitor import logging class Cron: def __init__(self): ...
#!/usr/bin/env python import sys import os import subprocess #import multiprocessing if sys.version_info[:2] < (2, 7) or sys.version_info[0:2] >= (3, 0): raise RuntimeError("Python version 2.7+ is required.") if sys.version_info[0] < 3: import __builtin__ as builtins else: import builtins from setuptools ...
# Copyright 2018 The TensorFlow Hub 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 app...
#!/usr/bin/env python # Copyright (c) 2018, 2019, 2020 Pure Storage, Inc. # # * Overview # # This short Nagios/Icinga plugin code shows how to build a simple plugin to monitor Pure Storage FlashBlade systems. # The Pure Storage Python REST Client is used to query the FlashBlade performance counters. # Plugin leverages...
import torch.nn as nn import torch.utils.model_zoo as model_zoo import math import torch def conv3x1(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=(3, 1), stride=(stride, 1), padding=(1, 0), bias=False) def co...
# -*- coding: iso-8859-1 -*- # """ @ 2009 by <NAME> <<EMAIL>> This file is part of the open source Akara project, provided under the Apache 2.0 license. See the files LICENSE and NOTICE for details. Project home, documentation, distributions: http://wiki.xml3k.org/Akara Module name:: collection = Defined REST entr...
# DCGAN-like generator and discriminator import numpy as np import torch from torch import nn import torch.nn.functional as F from torch.autograd import Variable from spectral_normalization import SpectralNorm channels = 6 leak = 0.1 class Generator(nn.Module): def __init__(self, z_dim): super(Generator...
# -*- coding: utf-8 -*- # # Copyright 2012 <NAME> <<EMAIL>> # # Licensed under the Apache License, Version 2.0 (the "License"); you # may not use this file except in compliance with the License. You # may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
import torch import numpy as np import scipy as sp import pandas as pd import scanpy as sc from sklearn.model_selection import train_test_split #from sklearn.preprocessing import scale class GeneCountData(torch.utils.data.Dataset): """Dataset of GeneCounts for DCA""" def __init__(self, path='data/francescon...
import numpy as np import pandas as pd import itertools from sklearn.model_selection import StratifiedKFold def get_dat_from_df(df, time_norm, jol_norm): #train l_seconds = np.array(df[['lag1', 'lag2', 'lag3', 'lag4', 'study_test_lag']]) l = l_seconds/time_norm T = l.shape[0] N = len(df['participan...
import json from elasticsearch_dsl import mapping, Text, Keyword, Nested, analysis def test_mapping_can_has_fields(): m = mapping.Mapping('article') m.field('name', 'text').field('tags', 'keyword') assert { 'article': { 'properties': { 'name': {'type': 'text'}, ...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may ...
"""Instruments which receive probe events.""" import datetime import sys import six try: from statsd import statsd except ImportError: statsd = None import diagnose from diagnose import probes omitted = object() class Instrument(object): """An instrument which receives FunctionProbe events. Attr...
# -*- coding: utf-8 -*- ######################################################################### # # Copyright (C) 2016 OSGeo # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 ...
import datetime import logging import numpy as np import os.path from PIL import Image from scipy import ndimage from lxml import etree import time from mengenali.io import read_image def classify_number(input_file, order, layers): cv_image = read_image(input_file) classify_number_in_memory(cv_image, order,...
from .common import Benchmark import numpy as np avx_ufuncs = ['sin', 'cos', 'exp', 'log', 'sqrt', 'absolute', 'reciprocal', 'square', 'rint', 'floor', 'ceil' , 'tr...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Video models.""" from functools import partial import slowfast.utils.weight_init_helper as init_helper import torch import torch.nn as nn from slowfast.models.batchnorm_helper import get_norm from timm.models.layers imp...
def chars_to_bools(chars): # assert all([c == "0" or c == "1" for c in chars]) return [c == "1" for c in chars] + [False]* (6-len(chars)) def bools_to_chars(bools): return ["1" if b else "0" for b in bools] def draw_outline(term, start_coords, end_coords, title=None, color=None): if color == None: ...
import re from enum import unique from pycsp3.classes.auxiliary.ptypes import auto, AbstractType, TypeXML from pycsp3.classes.main.constraints import ConstraintUnmergeable from pycsp3.classes.main.variables import Variable from pycsp3.tools.inspector import checkType from pycsp3.tools.utilities import flatten @uniqu...
import numpy as np import torch as to import pyrado from pyrado.algorithms.parameter_exploring import ParameterExploring from pyrado.environments.base import Env from pyrado.policies.base import Policy from pyrado.utils.input_output import print_cbt from pyrado.sampling.parameter_exploration_sampler import ParameterSa...
""" Copyright 2015 <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing...
# for data input and output: import numpy as np import os import tensorflow as tf # for deep learning: import keras from keras.models import Sequential, Model from keras.layers import Input, Dense, Conv2D, BatchNormalization, Dropout, Flatten from keras.layers import Activation, Reshape, Conv2DTranspose, UpSampling2D ...
#!/usr/bin/env python3 # SDFParse - a test utility for SDF documents # Released under the terms of the MIT license # ©2019-2020 <NAME> <<EMAIL>> import re global_tag_list = [ 'align', 'attachments', 'b', 'body', 'cell', 'code', 'document', 'fontinfo', 'h1','h2','h3','h4','h5','h6', 'head', 'header', 'hr...
# Copyright 2017 Google 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 writing, ...
# 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
########################################################################## # NSAp - Copyright (C) CEA, 2013 # Distributed under the terms of the CeCILL-B license, as published by # the CEA-CNRS-INRIA. Refer to the LICENSE file or to # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html # for details. ##########...
""" A Kik bot that just logs every event that it gets (new message, message read, etc.), and echos back whatever chat messages it receives. """ import os import socket from .kik_unofficial.datatypes.xmpp import chatting as chatting from .kik_unofficial.client import KikClient from .kik_unofficial.callbacks impo...
import os import osmnx as ox import geopandas as gpd import pandas as pd import networkx as nx import time from multiprocessing import Pool useful_tags = ox.settings.useful_tags_path + ['cycleway'] ox.config(data_folder='../Data', logs_folder='../logs', imgs_folder='../imgs', cache_folder='../cache', ...
import numpy as np from sklearn.metrics import mutual_info_score from typing import Union def get_fisher_score(X: np.ndarray, y: np.ndarray, negative_class: Union[int, float, str], positive_class: Union[int, float, str], epsilon: Union[int, float] = 1e-5) -> np.ndarray: """ Computes the F...
from operator import attrgetter class Solver: def checkvalidpuzzle(self, arr): subsquarestartingpoints = [[0, 0], [0, 3], [0, 6], [3, 0], [3, 3], [3, 6], [6, 0], [6, 3], [6, 6]] # Checking row validity of every row for row in range(9): has = set() for col in range(9...
# This file is part of the NUS M2 scorer. # The NUS M2 scorer is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # The NUS M2 scorer is d...
import torch import argparse import cv2 import numpy as np import os from skimage import transform as trans import torch.multiprocessing as mp def parse_args(): parser = argparse.ArgumentParser( description="fake add headband img generation tool") parser.add_argument('--input', dest='input_file', ...
from nt.kaldi import helper import re import os from nt.io import mkdir_p from collections import defaultdict import warnings import pandas import pickle import logging import glob import numpy as np def _build_rescale_lattice_cmd(decode_dir, hclg_dir, lmwt, word_insertion_penalty=0): ...
#!/usr/bin/env python3 import os import time import random from multiprocessing import Process, Queue # libs from warc import WARCReader import boto3 from botocore.handlers import disable_signing from common_crawl.tech_queue_in import TechResultsOutputFile from common_crawl.tech_worker import WorkerTechnologies fro...
import argparse import json import os import xml.etree.ElementTree as xml from xml.dom import minidom from PIL import Image from cvat2coco import cvat2coco from metrics_eval import print_metrics from correct_detections import correct_detections # def build_parser(): # parser = argparse.ArgumentParser() # pars...
# initialization experiments import numpy as np import matplotlib.pyplot as plt import sklearn import sklearn.datasets from init_utils import sigmoid, relu, compute_loss, forward_propagation, backward_propagation from init_utils import update_parameters, predict, load_dataset, plot_decision_boundary, predict_dec plt...
import numpy as np import scipy.spatial as spacial from math import sqrt class TspEnv: """ A Travelling Salesman Environment. Any environment needs: * An initialise (reset) method that returns the initial observations, reward, whether state is terminal, additional information. * A reset ...
""" FOREST command line application """ from pathlib import Path import typer import subprocess from typing import List, Optional import forest.db.main import forest.tutorial.main APP_NAME = "forest" BOKEH_APP_PATH = Path(__file__).resolve().parent.parent app = typer.Typer(help="Command line interface for FOREST web...
from . import ctng from . import scalarField import numpy from .surfaces import chunkify from . import surfaces from numpy.linalg import norm _max_chunks = 10000000 #TODO: should we expand this to also compute the area between neighboring nodes? def voxelize2(source, dx=0.25, xlo=None, xhi=None, ylo=None, yhi=None, ...
import numpy as np from Bio import SeqIO, Seq import cPickle as pickle import pandas as pd from util import * fs=16 alpha="ACGT-N" save_as='.fasta.gz' def hypermutation_statistics(): ''' use pre-calculated files on mutation prevalence in different reads types to produce analysis figures ''' mut_fi...
''' This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de). PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any late...
from copy import deepcopy import numpy as np from inspect import signature, getfullargspec from dcptree.data import get_variable_indices, check_data_required_fields SUPPORTED_METHOD_NAMES = {'svm_linear', 'logreg'} DEFAULT_TRAINING_SETTINGS = { 'svm_linear': { 'fit_intercept': True, 'intercept_sc...
import os from copy import copy, deepcopy from typing import TYPE_CHECKING, Dict, List, Optional, Union from funcy import first from dvc.exceptions import DvcException from dvc.render.base import ( INDEX_FIELD, REVISION_FIELD, BadTemplateError, Renderer, ) from dvc.render.utils import get_files if TY...
#!/usr/bin/env python # coding=utf-8 # Stan 2007-08-02 from __future__ import (division, absolute_import, print_function, unicode_literals) import logging from inspect import ismethod from xml.sax.saxutils import escape, prepare_input_source from .backwardcompat import * """ Отладочный выво...
""" View the status of mining and machine-payable purchases """ # standard python imports import urllib.parse import collections import logging # 3rd party imports import click # two1 imports import two1.channels as channels from two1.channels.cli import format_expiration_time from two1.commands.util import decorator...
#!/usr/bin/env python2 # coding: utf-8 from __future__ import print_function import os import shutil COV = None if os.getenv('FLASK_COVERAGE'): import coverage COV = coverage.coverage(branch=True, include='app/*') # branch分支覆盖分析 COV.start() # 从 .env 导入环境变量 if os.path.exists('.env'): print('Importing e...
# -*- coding: utf-8 -*- """ AK Client AK Protocol """ import json import toml import socket import struct import traceback #import aklib import gevent from multi_logging import get_logger #from conf import Conf #config_file = "config/ak_client.toml" #conf = Conf(config_file) #conf_fn = os.sep.join( # [o...
# vim: set ts=4 sw=4 et: coding=UTF-8 import re from subprocess import check_output from typing import Dict, List from .fileutils import open_datafile, open_stringio_spec from .rpmexception import RpmException from .rpmrequirestoken import RpmRequiresToken LICENSES_CHANGES = 'licenses_changes.txt' TEX_CONVERSIONS = ...
import ast, os, json from pprint import pprint import matplotlib.pyplot as plt import seaborn as sns def transform_str2list(file): str_contents = [] with open(file, "r") as f: for line in f: str_contents.append(line.strip('\n')) results = [] str_contents[0] = str_contents[0] + "]" ...
def main(): # pyPrint() # pyDataType() #TODO: crud on data type - https://www.programiz.com/python-programming/list pyIterator() # pyFunction() # pyClass() # pyModule() # pyPackage() # PRINT def pyPrint(): a = 10 print('hi', a, "hello") print('hi', a, "hello", sep='#', end='@\n') print('hi {} hello'.form...
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
import six from django.shortcuts import render, resolve_url from django.utils.functional import Promise from rest_framework.renderers import BaseRenderer, JSONRenderer, TemplateHTMLRenderer from rest_framework.utils import json from .app_settings import redoc_settings, swagger_settings from .codecs import VALIDATORS,...
#!/usr/bin/env python3 import argparse from os.path import expanduser import glob import json import os import re import shutil import subprocess import tempfile from termcolor import cprint, colored class TestRunner: SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) def __init__(self, options): ...
import datetime import json import multiprocessing import os import random import re import time import discum version = 'v0.01' config_path = 'data/config.json' logo = f''' ###### ### ### ## ####### ### ## ## ### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ...
# ********************************************************************************** # # # # Project: FastClassAI workbecnch # # ...
import json class _PayloadAlert: def __init__(self, title=None, body=None): super().__init__() self.title = title self.body = body def to_dict(self, alert_body=None): if alert_body is None: alert_body = self.body d = {} if self.title: ...
import sys import os import ast import jsonpickle import datetime # PyQt5 from PyQt5.QtWidgets import QApplication, QMainWindow from PyQt5.QtWidgets import QTabWidget, QTabBar from PyQt5 import uic from PyQt5 import QtCore # Own Modules from NodeManager import NodeManager from ViewManager import ViewManager from View...
# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation. # Copyright (C) 2012 <NAME> <yamahata at private email ne jp> # # 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://ww...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from typing import Generator, List, Optional, Tuple import argparse import json import os import re import subprocess import sys # Internal PACKAGE_PATH = os.path.realpath(os.path.join(os.path.join(os.path.dirname(__file__), '..'))) MESSAGE_DIR = 'messages' MESSAGE_PATH ...
# coding:utf-8 # code for week3 import torch from torch.autograd import Variable as V def generate_data(): # 本函数生成0-9,10个数字的图片矩阵 image_data = [] num_0 = torch.tensor( [[0, 0, 1, 1, 0, 0], [0, 1, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0], [0, 0, 1, 1, 0...
#!/usr/bin/env python # Stock Python modules import copy import datetime # Third-party modules import numpy # cdf extension modules from . import internal class epoch(datetime.datetime): def __new__(cls, value = None): if isinstance(value, datetime.datetime): year = value.year mo...
"""Collection of tests for unified dtype functions.""" # global import pytest from numbers import Number import ivy_tests.test_ivy.helpers as helpers # local import ivy import ivy.functional.backends.numpy import ivy.functional.backends.jax import ivy.functional.backends.tensorflow import ivy.functional.backends.torc...
from itertools import combinations import numpy as np from ..._utils._utils import _cost # from skroute._utils._utils import _cost import random as rd prueba = [1,2,3,4] def create_combinations(rnd_sol_1, start_id): """ Create pair combinations from one route Parameters ----------- rnd_sol_1: list A list of ...
# Copyright 2021 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at http://aws.amazon.com/apache2.0/ # or in the "LICENSE.txt" file accompanyin...
import cv2 import numpy as np import sys import os import glob import json def delete_file(image_path, annotations): file_name = ''.join(os.path.splitext(os.path.basename(image_path))) file_size = int(os.path.getsize(image_path)) key = file_name + str(file_size) isExist = key in annotations.keys() ...
#!/usr/bin/env python # encoding: utf-8 import base64 import logging import paramiko import pipes import random import scp import tempfile import time import winrm logging.basicConfig(level=logging.DEBUG) logging.getLogger("paramiko").setLevel(logging.INFO) class VMComms(object): sep = "/" @classmethod ...
import uuid from unittest import mock import pytest from botocore import exceptions from dagster import DagsterResourceFunctionError, In, Out, build_op_context, configured, job, op from dagster_aws.s3 import S3FileHandle, S3FileManager, s3_file_manager, s3_resource def test_s3_file_manager_write(mock_s3_resource, mo...
from dj_rest_auth.jwt_auth import unset_jwt_cookies from django.http.response import HttpResponseRedirect from rest_framework_simplejwt.views import TokenRefreshView, TokenObtainPairView from allauth.account.models import EmailAddress from dj_rest_auth.views import LoginView from django.contrib import messages from res...
from multirunnable.persistence.file.files import File, CSVFormatter, XLSXFormatter, JSONFormatter, Checking from .._data import Test_Data_List, Test_Error_Data_List, Test_JSON_Data from pathlib import Path from typing import List, Dict from openpyxl import Workbook, load_workbook import pytest import json import csv ...
# Copyright 2019 The Wallaroo 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 ...
"""UserAssist parser leveraging the YARP library.""" import struct import sys import logging from helper import utility from yarp import Registry """ MIT License Copyright (c) 2018 <NAME>, <NAME> Please share comments and questions at: https://github.com/PythonForensics/Learning-Python-for-Forensics or email <EM...
############################################################################## # # Copyright (c) 2003 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
import os import functools import ell_helper import ell def GetName(node): return node.GetId() def GetNodeIndex(index, node): return index[GetName(node)] def GetNodes(model): '''Return an array holding all the Node objects of the model. The output will we of the form [node_1, node_2, ..., node_v]''' retur...
# Xlib.ext.dpms -- X Display Power Management Signaling # # Copyright (C) 2020 <NAME> <<EMAIL>> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public License # as published by the Free Software Foundation; either version 2.1 # of the License, o...
import numpy as np import time from agents.common import * from agents.agent_minimax.minimax import get_valid_columns def generate_move_montecarlo( board: np.ndarray, player: BoardPiece, saved_state: Optional[SavedState] ) -> Tuple[PlayerAction, Optional[SavedState]]: """ generate move function employ...
"""Sphinx extension to link to source code on GitHub. This links to source code for modules, classes, etc. to the correct line on GitHub. This prevents having to bundle the source code along with the documentation, and better ties everything together. Setup ===== To use this, you'll need to import the module and de...
#!/usr/bin/env python3 import qutip as qt import numpy as np import itertools from math import factorial from scipy.special import binom N = 3 op_cap = 3 I2 = qt.qeye(2) sz = qt.sigmaz()/2 sp = qt.sigmap() sm = qt.sigmam() II = qt.tensor([ I2 ] * N) def partition_1D(indices, partition_sizes): return [ indices[...