Ejemplo n.º 1
0
#!/usr/bin/env -S python3 -W ignore
# coding: utf-8
################################################################################
from __future__ import print_function
import tbvaccine as tb
tb.add_hook(isolate=False, show_vars=False)
import numpy as np
from qiskit import (IBMQ, QuantumRegister, ClassicalRegister, QuantumCircuit,
                    Aer, execute, transpile)
################################################################################

##################################################
################### Token auth ###################
##################################################
token_path = "../IBMQ_token"
with open(token_path, "r") as file:
    token = file.read()
IBMQ.save_account(token, overwrite=True)


################################################################################
##################################### Main #####################################
################################################################################
def main():
    ##################################################
    ################## Make circuit ##################
    ##################################################
    q_alice = QuantumRegister(2, "q(alice)")
    q_bob = QuantumRegister(1, "q(bob)")
    c0 = ClassicalRegister(1)
    c1 = ClassicalRegister(1)
Ejemplo n.º 2
0
import os
import sys
try:
    import ConfigParser
except ImportError:
    import configparser as ConfigParser

import click
import yeelight  # noqa
from yeelight import transitions as tr

try:
    import tbvaccine
    tbvaccine.add_hook()
except:
    pass

try:
    from . import __version__
except (SystemError, ValueError):
    from __init__ import __version__

BULBS = []


def hex_color_to_rgb(color):
    "Convert a hex color string to an RGB tuple."
    color = color.strip("#")
    try:
        red, green, blue = tuple(int(color[i:i + 2], 16) for i in (0, 2, 4))
    except:
Ejemplo n.º 3
0
import colorama
from colorama import Fore, Style
import invoke
from invoke import run, task  # requires invoke >= 0.13
from joblib import Parallel, delayed
import minchin.text
import requests
import winshell

try:
    import tbvaccine
except ImportError:
    pass
else:
    tbvaccine.add_hook(
        isolate=True,
    )


__version__ = '4.0.2'
colorama.init()

#######################
### Global Settings ###
#######################

COPYRIGHT_START_YEAR = 1987
ADAM_LINK = "http://gigatrees.com/"
ADAM_FOOTER = "<p><strong>Are we related?</strong> Are you a long lost cousin? Spotted an error here? This website remains a work-in-progress and I&nbsp;would love to hear from you. Drop me a line at minchinweb [at] gmail [dot] com.</p>"
INDENT = " "*4
GITHUB_FOLDER = Path("C:\\Users\\William\\Documents\\Code\\genealogy-gh-pages")
Ejemplo n.º 4
0
from keras.models import Model
from keras.layers import Input, LSTM, CuDNNLSTM, Dense, Masking, TimeDistributed, Bidirectional, Embedding
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras.utils import to_categorical
from keras.backend import sparse_categorical_crossentropy
from keras.callbacks import TensorBoard, EarlyStopping
from functools import partial
from sys import exit
from os.path import exists
from os import environ
import tensorflow as tf
import keras
import numpy as np
import tbvaccine
tbvaccine.add_hook(isolate=True, show_vars=False)

mode = "inference"  # "train" or "inference"

WEIGHTS_FILE = "weights/iranaiyo12.h5"
PRETRAINED_VEC_FILE = "data_set/GloVe/glove.6B.300d.txt"
tensorboard_logdir = None  #"tfboard_logs/weights_512_s_10000_w_10000_l2_2nd"
SAVE_WEIGHTS = False
ONLY_CPU = True

if mode == "train" and SAVE_WEIGHTS and exists(WEIGHTS_FILE):
    print("Error: Specified WEIGHTS_FILE already exists.")
    exit(1)

if ONLY_CPU:
    NUM_CORES = 8
Ejemplo n.º 5
0
    # set up colored prompt
    #
    # consider numbering these lines; do this by create a function to generate
    # ps1 and ps2
    sys.ps1 = "{}>>> {}".format(colorama.Fore.GREEN, colorama.Style.RESET_ALL)
    sys.ps2 = "{}... {}".format(colorama.Fore.YELLOW, colorama.Style.RESET_ALL)
    del colorama

# colored tracebacks
try:
    import tbvaccine
except ImportError:
    pass
else:
    tbvaccine.add_hook(isolate=False)
    del tbvaccine

# nicer display of printed objects
try:
    import rich
except ImportError:
    pass
else:
    from rich import pretty
    pretty.install()
    del pretty

print()
# http://www.wiseoldsayings.com/python-quotes/
print("Python is executable pseudocode. Perl is executable line noise.")