text stringlengths 3.07k 22.1k |
|---|
from __future__ import print_function
import argparse
import os
from functools import reduce
# import cv2
import torch
import torch.nn as nn
from PIL import Image
from torch.autograd import Variable
from torch.utils.data import DataLoader
from torchvision import transforms
from data import get_eval_set
from dbpn_ite... |
import argparse
import functools
import os
import numpy as np
import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data as data_utils
import torchvision
from torchvision import transforms
import tqdm
from tartangan.models.blocks import (
DiscriminatorInput, DiscriminatorBlock,
... |
'''Train CIFAR10 with PyTorch.'''
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
import numpy as np
import torchvision
import torchvision.transforms as transforms
import os
import argparse
from models import *
from utils import prog... |
import logging
import shutil
import tempfile
from os import makedirs, path
from typing import List, Any
import numpy as np
from keras import backend
from keras.callbacks import Callback, EarlyStopping, ModelCheckpoint
from keras.layers import Dense, Dropout
from keras.layers.normalization import BatchNormalization
fro... |
'''
This file is written by <NAME> (@quantumjim).
=== Dependencies ===
To run this file you'll need MicroQiskit. This is a minimal version of the 'Qiskit' framework for quantum computing.
It just needs you to download the microqiskit.py from the following link
https://github.com/qiskit-community/MicroQiskit/blob/mast... |
"""
pytcc is a very simple wrapper around
libtcc, using ctypes.
"""
from __future__ import print_function
import ctypes, sys
__all__ = ['TCCState', 'TCC_OUTPUT_MEMORY', 'TCC_OUTPUT_EXE', 'TCC_OUTPUT_DLL',
'TCC_OUTPUT_OBJ', 'TCC_OUTPUT_PREPROCESS']
# constants for TCCState.set_output_type()
TCC_OUTPUT_MEMORY = 0
TC... |
# coding=utf-8
# Copyright (C) 2019 ATHENA AUTHORS; <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... |
import os, secrets
import subprocess
import glob
from pathlib import Path
import logging
""" default key id and key value """
DEFAULT_KEY_ID = "<KEY>"
DEFAULT_KEY = "<KEY>"
logging.basicConfig(level=logging.ERROR)
""" ||||||||||||||||||||||||||||||||||| """
""" Create dash content from .mp4 files """
""" ||||||... |
import sys
import os
import re
from pathlib import Path
def get_line_contains_idx(substr, lines):
idx = -1
for line in lines:
if line.startswith(substr):
idx = lines.index(line)
return idx
def convert_wight_section(text, isSop):
orderings = []
lines = text.split("\n")
... |
import numpy as np
import mxnet as mx
import pytest
from numpy.testing import assert_allclose
from gluonnlp.models.transformer import\
TransformerEncoder, TransformerDecoder, \
TransformerModel, TransformerNMTInference,\
transformer_cfg_reg
from gluonnlp.attention_cell import gen_mem_attn_mask, gen_self_att... |
import click
import os
from azure.datalake.client.sample.datalake_tool_manager import DatalakeClientFactory, DatalakeToolManager
@click.group()
@click.option('-a', '--account', required=True, type=str, help="storage account name")
@click.option('--auth_type', type=click.Choice(['environment', 'identity', 'service_pri... |
import random
# random.seed(42)
import math
class Character:
def __init__(self, health, power):
self.health = health
self.power = power
self.name = self.__class__.__name__.lower()
def alive(self):
return self.health > 0
def attack(self, defender):
print(f"\nThe {se... |
# -------------------------------------------------------------------#
# Written by <NAME>
# Contact: <EMAIL>
# Copyright 2016, <NAME>
# -------------------------------------------------------------------#
import tensorflow as tf
class Decoder(object):
"""A Decoder class to decode examples.
Args:
feature_k... |
import os
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.metrics import recall_score, precision_score, accuracy_score, f1_score
from sklearn.metrics import classification_report
from sklearn.metrics import auc, roc_curve
from sklearn.metrics import confusion_matrix
class class... |
"""Retrieve and build dependencies of C extensions."""
import ctypes
import hashlib
import os
import shutil
import subprocess
import sys
import tarfile
try:
import urllib2
except ImportError:
import urllib.request, urllib.error, urllib.parse
urllib2 = urllib.request
try:
import cysignals
except ImportE... |
import argparse
import configparser
import datetime
import os
import subprocess
import sys
import lbann
import lbann.contrib.args
import lbann.contrib.launcher
import numpy as np
from data import make_data_reader
from model import make_model
root_dir = os.path.dirname(os.path.realpath(__file__))
# -----------------... |
# @Author: <NAME> <valle>
# @Date: 27-Jun-2018
# @Email: <EMAIL>
# @Last modified by: valle
# @Last modified time: 29-Jun-2018
# @License: Apache license vesion 2.0
import websocket
import json
from datetime import datetime
from django.db.models import Q, Count, Sum, F
from django.db.models.fields import DecimalF... |
import os
import sys
import pandas
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import statsmodels.api as sm
import statsmodels.formula.api as smf
from glob import glob
from scipy import stats
from scipy.io import loadmat, savemat
from dateutil.parser import parse
from nilearn import plottin... |
# Copyright 2019 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" file accompa... |
import math
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, Button, RadioButtons
from mpmath import *
from lmfit import *
import manfit as mf
GHz = 1e9
MHz = 1e6
kHz = 1e3
Hz = 1
Pi = np.pi
bare_freq = 7.3740*GHz
dressed_freq = 6.68073*GHz
f01 = 5.732*GHz
f12... |
#!/usr/bin/python
import os
import sys
import glob
import imageio
import tempfile
import argparse
import PIL.Image as pil
class Image(object):
def __init__(self, path):
self.path = self._validate_path(path)
self.image = pil.open(path)
def _validate_path(self, path):
path = os.path.rea... |
#!/usr/bin/python
# API Gateway Ansible Modules
#
# Modules in this project allow management of the AWS API Gateway service.
#
# Authors:
# - <NAME> <github: bjfelton>
# - <NAME> <github: mestudd>
#
# apigw_domain_name
# Manage creation, update, and removal of API Gateway DomainName resources
#
# MIT License
#
#... |
import string
import sys
import argparse
import re
import os
from os import path
from collections import defaultdict
from utils import *
from grammar_processing_utils import *
from PYAG_utils import *
'''
Function to insert "+" in word count times. Returns every solution that does not have an empty stem.
'''
def i... |
import os
import pandas as pd
import pdftotext
from nltk import pos_tag
from nltk.corpus import stopwords
from nltk.corpus import wordnet
from nltk.stem import WordNetLemmatizer
from nltk.tokenize import RegexpTokenizer
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer, TfidfVectorizer
de... |
import os
import warnings
from tempfile import TemporaryDirectory as InTemporaryDirectory
import numpy as np
import numpy.testing as npt
import pytest
from fury import actor, window, io
from fury.testing import captured_output, assert_less_equal, assert_greater
from fury.decorators import skip_osx, skip_win
def test_... |
from collections import defaultdict
from typing import List, Set
from sovtoken.exceptions import UTXONotFound, UTXOError, UTXOAddressNotFound
from sovtoken.types import Output
from storage.kv_store import KeyValueStorage
from storage.optimistic_kv_store import OptimisticKVStore
from stp_core.common.log import getlogge... |
# -*- coding: utf-8 -*-
import xml.etree.ElementTree as ET
from Tools import *
import random
from copy import copy
def print_grid(grid):
for row in grid:
line = ""
for elt in row:
line += str(elt[0]).ljust(4)
print(line)
build = {"roads":lambda grid, r, *values: grid_append_... |
import argparse
from CNNSpecNetwork import *
from DataLoader import *
import tensorflow.keras.utils as KU
from DataManager import *
from tqdm import tqdm
# ritorna un vettore di indici che sono quelli da scartare
EPOCHS_PER_TRAIN_F = 3
EPOCHS_PER_TRAIN_S = 18
def self_verify(labels, verified, predict, class_stat, ma... |
#! /usr/bin/env python3
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... |
from colorsys import hls_to_rgb, rgb_to_hls, hsv_to_rgb
def RGBA(R: int, G: int, B: int, A=1):
'''
Returns RGB(A) Color as formatted rgba string
Parameters
----------
R, G, B : 0 > 255
A : 0 > 1
Returns
-------
String
e.g Color.RGBA(245, 123, 123, 0.2)
>>> 'rgba(... |
#!/usr/bin/python
# Copyright: (c) 2020, DellEMC
"""Ansible module for managing storage pool on Unity"""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': ... |
# Copyright 2020 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 a... |
#!/usr/bin/env python
from .node import *
from PIL import Image
import moderngl as gl
from .prefab import *
from .defs import *
import cson
from glm import ivec2, vec2, vec4
from .sprite import *
from .util import *
from .shaders import Shader
from copy import copy
from os import path
import struct
class MeshResource... |
"""
The __init__ method for the wappsto module.
Stores the Wappsto class functionality.
"""
import inspect
import logging
import os
import signal
from threading import Event
from .connection import seluxit_rpc
from .connection import communication
from .errors import wappsto_errors
from .connection import event_sto... |
# -*- encoding: utf-8 -*-
# Template language benchmarks
#
# Objective: Generate a 1000x10 HTML table as fast as possible.
#
# Author: <NAME> <<EMAIL>>
from __future__ import print_function
import cgi
import sys
import timeit
import StringIO
import cStringIO
try:
import genshi
from genshi.builder import tag
... |
import collections
import copy
from dataclasses import dataclass
import numpy
import pandas
from typing import List
import warnings
from .constants import Messages
from .utils import Helpers
from .utils import OwnDict
@dataclass
class ParameterMapper():
"""
Maps global parameter names to loca... |
#!/usr/bin/env python
"""
MOP API Base class to handle API token generation from credentials.json file.
"""
import json
import sys
from base64 import b64encode
from os import R_OK, access, environ, path
from urllib import parse, request
import jwt
import keyring
from jwt import PyJWKClient
class NFAPIClient:
"""... |
#!/usr/bin/env python3
"""
@author: <NAME>
"""
from __future__ import print_function
from termcolor import colored
from tqdm import tqdm
import math
import os
import random
import time
#-------------------------------------------------------------------------------------------------------------------------------------... |
"""
Process a big data EEG resource (TUH EEG Corpus)
================================================
In this example, we showcase usage of the Temple University Hospital EEG Corpus
(https://www.isip.piconepress.com/projects/tuh_eeg/html/downloads.shtml#c_tueg)
including simple preprocessing steps as well as cutting o... |
#!/usr/bin/python
# All code provided from the http://gengo.com site, such as API example code
# and libraries, is provided under the New BSD license unless otherwise
# noted. Details are below.
#
# New BSD License
# Copyright (c) 2009-2015, Gengo, Inc.
# All rights reserved.
#
# Redistribution and use in source and bi... |
#!/usr/bin/env python2
# coding: utf-8
from __future__ import print_function, unicode_literals
"""unbork.py: Filename fixer"""
__version__ = "1.2"
__author__ = "ed <<EMAIL>>"
__license__ = "MIT"
__copyright__ = 2015
import struct
import base64
import zlib
import json
import sys
import os
import re
try:
from urll... |
# -*- coding: utf-8 -*-
import ctypes
uint8_t = ctypes.c_ubyte
char = ctypes.c_char
uint32_t = ctypes.c_uint
uint64_t = ctypes.c_uint64
uint16_t = ctypes.c_ushort
guid_t = char * 16
FIRMWARE_VOLUME_GUIDS = {
"FFS1": "7a9354d9-0468-444a-81ce-0bf617d890df",
"FFS2": "8c8ce578-8a3d-4f1c-9935-896185c... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 katrin <<EMAIL>>
#
# Distributed under terms of the MIT license.
import numpy as np
import argparse
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
def get_seq2hw_hworder():
"""
Provides the positions... |
import pygame
import random
import math
import time
pygame.init()
#Hello and welcome to my first game!
screen = pygame.display.set_mode((800, 600))
pygame.display.set_caption('Fish Game')
icon = pygame.image.load('animalright.png')
pygame.display.set_icon(icon)
background = pygame.image.load('ocean.png')
playerFISHr... |
# Imports for the strategy
import pandas_ta as ta
# Importing these to be able to run this example
# from the main pyjuque folder
from os import getenv
from os.path import abspath, pardir, join
import sys
curr_path = abspath(__file__)
root_path = abspath(join(curr_path, pardir, pardir))
sys.path.append(root_path)
#... |
import argparse
import numpy as np
import os
import torch
import random
from collections import defaultdict
from utils.data_util import *
from utils.corruption import *
from utils.lib import *
from utils.pgd_attack import LinfPGDAttack
from utils.cw_attack import CW
from sklearn.model_selection import train_test_split... |
import pandas as pd
import numpy as np
from datetime import datetime
from fbprophet import Prophet
from tqdm import tqdm
import time
from multiprocessing import Pool, cpu_count
from multiprocessing.pool import ThreadPool
from utils.stdout_silencer import suppress_stdout_stderr
import plotly.graph_objs as go
import plot... |
#! /usr/bin/env python3
import os
import sys
import select
import socket
import pickle
import getpass
import threading
import time
from datetime import datetime
from tkinter import *
# Adding APIs directory to python system path
# sys.path.insert(-1, os.path.join(os.path.dirname
# (os... |
# Copyright 2017 Google 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-2.0
#
# Unless required by applicable law or a... |
#!flask/bin/python
import datetime
from flask import Flask
from flask import flash, redirect, render_template, request
from flask_wtf import CsrfProtect, FlaskForm
from google.appengine.ext import ndb
from google.appengine.api import users
from wtforms import (FieldList, FormField,
HiddenField, ... |
'''
The main script for accessing our datatypes
Read custom netcdf data files into ArcGIS using an ArcGIS toolbox python
script
Design the script to run from ArcGIS, or standalone using sys.args.
For now, do lots of work here. Some of this will migrate/separate later
@author: <NAME> (retoomey)
'''
# Syst... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# author: <NAME> 2020
# email: <EMAIL>
import math
import sys
import numpy as np
from sklearn.model_selection import RepeatedStratifiedKFold
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
from sklearn.discriminant_analysis import Line... |
import KratosMultiphysics
import KratosMultiphysics.ConstitutiveModelsApplication as KratosMaterials
import importlib
def Factory(custom_settings, Model):
if(type(custom_settings) != KratosMultiphysics.Parameters):
raise Exception("expected input shall be a Parameters object, encapsulating a json string")
... |
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from distributed import reduce_tensor
from CookieTTS.utils.audio.stft import STFT
from CookieTTS.utils.audio.audio_processing import window_sumsquare, dynamic_range_compression, dynamic_range_decompression
class MultiRes... |
"""
Utilities for Jupyter notebooks.
Note that the utilities here have simple fallbacks to make them also work outside of
Jupyter notebooks. For example, a :py:class:`SimpleProgressBar` would display a graphical
progress bar inside a Jupyter notebook, but inside a python script executed on the
console, it would simp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
How to use the progression package will be demonstrated in the following examples. If you are solely interested
usage it should suffice to go through the following. If you are searching for the actual doc
look :doc:`here </progression>`.
The function t... |
#!usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from operator import itemgetter
from collections import Counter
from sklearn.preprocessing import LabelEncoder
from sklearn.feature_extraction import DictVectorizer
from keras.utils import np_utils
import numpy as np
from model import... |
from microbit import *
import time, music, radio
from key_status import KeyStatus
class Clock:
# all modes
ScreenOn = 1
AdjustHour = 2
AdjustMinute = 3
AdjustSecond = 4
ScreenOff = 5
def __init__(self):
self._chip_base_ts = time.ticks_ms()
self._realworld_base_sec = 0
... |
"""
Muziekweb music fragment importer
"""
import json
import trompace as ce
from trompace.connection import submit_query
from trompace.mutations.audioobject import mutation_update_audioobject, mutation_create_audioobject, mutation_merge_audioobject_exampleofwork
from trompace.mutations.musiccomposition import mutation... |
"""
Helpers functions for the euxfel_h5tools package.
Copyright (c) 2017, European X-Ray Free-Electron Laser Facility GmbH
All rights reserved.
You should have received a copy of the 3-Clause BSD License along with this
program. If not, see <https://opensource.org/licenses/BSD-3-Clause>
"""
import fabio
import h5py
... |
from torch.nn.functional import avg_pool2d, pad
from torch import pow, sqrt, clamp, mean
from torch.nn import Module, L1Loss
import torch
from torch import nn
from torchvision import models
from CX import CX_loss
def std_weight_map(image):
# calculate std. of target local patch
padded_rgb_images = pad(input=i... |
"""
The main module of explorer.
"""
import time
from typing import Any, Dict, Generator, List, Optional
from .algorithmfactory import AlgorithmFactory
from ..evaluator.evaluator import Evaluator
from ..logger import get_algo_logger
from ..database import Database
from ..parameter import DesignPoint, DesignSpace, gen_... |
import matplotlib.pyplot as plt
import numpy as np
import cv2
import pandas as pd
from sklearn.metrics import jaccard_score
from pathlib import Path
import os
import shutil
import re
import argparse
import pytesseract
import pdf2image
from tqdm import tqdm
from test import *
parser = argparse.ArgumentParser(descript... |
"""
Created by <NAME>
Github: https://github.com/josephedradan
Date created: 4/22/2021
Purpose:
Using hashes to solve the N Queens problem
Details:
Description:
Notes:
Time Complexity:
If n == length of row and m == length of column
~ Time Complexity:
O((n*m) * (p) * (1 + 1 + 1 + 1))
... |
import discord #python3 -m pip install -U https://github.com/Rapptz/discord.py/archive/rewrite.zip#egg=discord.py
import asyncio
import turtlecoin
import json
import sys
import time
import random
import hexdump
import http
import logging
from collections import deque
ENABLE_DEBUG_LOG = False
if ENABLE_DEBUG_LOG:
lo... |
import threading
import requests
import datetime
import logging
import time
from urllib.parse import urlparse
import esppy.espapi.tools as tools
from xml.etree import ElementTree
class EventSources(object):
def __init__(self,connection,delegate = None):
self._connection = connection
self._delega... |
# for backend and site building
from flask import Flask, render_template, request
from flask import redirect, jsonify, url_for, flash
# for database operations
from models import Base, Category, Item, User
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
# for oauth login
from flask import s... |
import argparse
import datetime
import math
import os
import random
import time
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.utils.data import Dataset, DataLoader
from tqdm import tqdm
from tensorboardX import SummaryWriter
from network.generate import generate
from network.helper... |
# -*- coding: utf-8 -*-
import os
import argparse
import time
import math
import torch
import torch.optim as optimizer
from data import load_dataset, collate_fn
from models import Encoder, Decoder, PCRNN
pparser = argparse.ArgumentParser()
# ==========================================================================... |
import sys
import plotly.offline as py
import plotly.graph_objs as go
import plotly.figure_factory as ff
import pandas as pd
import os
import numpy as np
class DataWrapper:
def __init__(self, data_file):
self.df = self.fetch_data(data_file)
self.compounds = self.get_compounds()
self.sample... |
"""
Custom implementation of wsse (without Timestamp) for TBK Webservices.
based on py-wsse suds
"""
from uuid import uuid4
import xmlsec
from .utils import create_xml_element
SOAP_NS = 'http://schemas.xmlsoap.org/soap/envelope/'
DS_NS = 'http://www.w3.org/2000/09/xmldsig#'
WSS_BASE = 'http://docs.oasis-open.org/... |
"""
Sentech_camera_control.py
<NAME>, 2020/03/22
Modified from "derricw/pysentech/pysentech/examples/low_level_cv2.py"
Dependency:
StCamUSBPack_EN_190207.zip (https://sentech.co.jp/en/products/USB/software.html)
Test environment:
Sentech STC-TB33USB-AS, GPIO IO0 receives triggers
Install:
1. Downloa... |
# coding: utf-8
"""
cairocffi.patterns
~~~~~~~~~~~~~~~~~~
Bindings for the various types of pattern objects.
:copyright: Copyright 2013 by <NAME>
:license: BSD, see LICENSE for details.
"""
from . import ffi, cairo, _check_status, constants, _keepref
from .matrix import Matrix
from .surfaces imp... |
import re
import http.server
import socketserver
import json
import os
import sys
import io
import gzip
import ssl
from urllib.parse import urlparse, unquote
import mimetypes
from collections import defaultdict
from .builder import Builder
class Response(object):
def __init__(self, status_code=200... |
#!/usr/bin/env python3
import dbus
import sys
import os
import xml.etree.ElementTree as etree
DBUS_OBJECT = 'org.freedesktop.UDisks2'
DBUS_PATH = '/org/freedesktop/UDisks2/block_devices'
g_bus = dbus.SystemBus()
def comm_get_device_info(info):
str_info = info['label']
if str_info == '':
obj = g_bus.g... |
"""Fixer that tranlslates unittest assertions to python assertions.
https://github.com/dropbox/dbx-unittest2pytest
E.g.
self.assert_(x) -> assert x
self.assertEquals(x, y) -> assert x == y
"""
from __future__ import absolute_import
from lib2to3.fixer_base import BaseFix
from lib2to3.fixer_util import Name, Co... |
import random
random.seed(12345)
import pytest
import numpy as np
import warnings
from GPdoemd.models import SurrogateModel
from pdb import set_trace as st
"""
SET UP MODEL ONCE
"""
x_bounds = np.array([[10., 20.], [5., 8.], [0, 1]])
p_bounds = np.array([[ 2., 4.], [3., 5.]])
def _f (x, p):
return x[:2] * p * ... |
from torch.utils.tensorboard import SummaryWriter
writer = SummaryWriter()
import os.path as osp
from pathlib import Path
import numpy as np
import argparse
import time
import logging
import torch
import torch.nn as nn
import torchvision.transforms as transforms
from torch.utils.data import DataLoader
import mobilen... |
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
#
# 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... |
from datetime import datetime
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.safestring import mark_safe
from django.utils.tra... |
import math
import random
from functools import partial
rand = partial (random.randint)
entradas=[[1,1,1,1,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,1,1,1,1],#0
[0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0],#1
[1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1],#2
[1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,0,0,0,0,1,1,1... |
from intervaltree import Interval
import os
import pytest
import random
import subprocess
from unittest import mock
import pyfastaq
from viridian_workflow import detect_primers, minimap, primers
this_dir = os.path.dirname(os.path.abspath(__file__))
data_dir = os.path.join(this_dir, "data", "detect_primers")
def te... |
"""
Tests for the operations module
"""
import pytest
import numpy as np
from functools import reduce
from ..operations import *
def test_mode_n_product():
""" Tests for the `mode_n_product` function """
I, J, K = 2, 3, 4
I_new, J_new, K_new = 5, 6, 7
array_3d = np.arange(I*J*K).reshape((I, J, K))
... |
"""
The ``random_word`` module houses all classes and functions relating to the
generation of single random words.
"""
import random
import re
import enum
from typing import Optional, List
from . import assets
try:
import importlib.resources as pkg_resources
except ImportError:
# Try backported to PY<37 `imp... |
'''Pre-activation ResNet in PyTorch.
Reference:
[1] <NAME>, <NAME>, <NAME>, <NAME>
Identity Mappings in Deep Residual Networks. arXiv:1603.05027
'''
# based on https://github.com/kuangliu/pytorch-cifar/blob/master/models/preact_resnet.py
import torch
import torch.nn as nn
import torch.nn.functional as F
from mod... |
""" Schema to represent a knowledge base to build models of prokaryotes
:Author: <NAME> <<EMAIL>>
:Author: <NAME> <<EMAIL>>
:Author: <NAME> <<EMAIL>>
:Author: <NAME> <<EMAIL>>
:Author: <NAME> <<EMAIL>>
:Date: 2018-09-10
:Copyright: 2018, Karr Lab
:License: MIT
"""
from wc_kb import core
from wc_onto import onto as k... |
import contextlib
import csv
import gzip
import os
from datetime import datetime, timedelta
from os import path
from typing import Sequence, Tuple, List, Callable
import logging
import discord
from kaztron.utils import datetime as utils_dt
from kaztron.cog.userstats.core import EventType, list_stats_files, \
init... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Utility functions to send emails with SMTP protocol
"""
__author__ = '<NAME>'
__email__ = "<EMAIL>"
__license__ = "MIT License"
__copyright__ = "Copyright Quentin Comte-Gaz (2017)"
__python_version__ = "3.+"
__version__ = "1.0 (2017/04/19)"
__status__ = "Usable for a... |
#!/usr/bin/env python3
import os
import datetime
import io
import traceback
import sys
import requests
import yaml
import json
dcrdata_api_url = "https://dcrdata.org/api/"
dcrdata_api_tinfo = dcrdata_api_url + "tx/{}/tinfo"
dcrdata_api_best = dcrdata_api_url + "block/best"
pi_api_url = "https://proposals.decred.org/... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @copyright © 2010 - 2018, Fraunhofer-Gesellschaft zur Foerderung der
# angewandten Forschung e.V. All rights reserved.
#
# BSD 3-Clause License
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the fol... |
import torch
import torch.nn as nn
import functools
class UnetWithEmbeddingsGenerator(nn.Module):
"""Create a Unet-based generator with embeddings"""
def __init__(self, input_nc, output_nc, num_downs, ngf=64, nef=0, norm_layer=nn.BatchNorm2d, use_dropout=False,p=0.2):
"""Construct a UnetWithEmbeddings... |
import os
import timm
import torch.hub
from torch.nn import Dropout2d
from torch.utils import model_zoo
encoder_params = {
"resnet34": {
"decoder_filters": [48, 96, 176, 192],
"last_upsample": 32
}
}
default_decoder_filters = [48, 96, 176, 256]
default_last = 48
import torch
from torch impor... |
"""
Grid-World Markov Decision Processes (MDPs).
The MDPs in this module are actually not complete MDPs, but rather the
sub-part of an MDP containing states, actions, and transitions (including
their probabilistic character). Reward-function and terminal-states are
supplied separately.
Some general remarks:
- Edg... |
# Copyright 2020 <NAME>
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistr... |
import numpy as np
import matplotlib.pyplot as plt
from skimage.measure import label, regionprops
import skimage.io as io
import skimage.filters as filt
import skimage.morphology as morph
from skimage.draw import disk
import amglib.imageutils as amg
import pandas as pd
from skimage.feature import match_template
def ge... |
from django.contrib.auth import authenticate, login, logout
from django.db import IntegrityError
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from django.urls import reverse
import datetime
from annoying.functions import get_object_or_None
from django.contrib.auth.decor... |
# -*- coding: utf-8 -*-
import logging
import multiprocessing
import os
import wx
from wx.lib.dragscroller import DragScroller
import process
import processannoy
from wxmainframe import MainFrame
from isv import isv
THUMBNAIL_MAX_SIZE = process.THUMBNAIL_MAX_SIZE
def scale_bitmap(bitmap, width, height):
image... |
import numpy as np
import pandas as pd
import pytest
from sid.shared import boolean_choices
from src.create_initial_states.create_initial_immunity import (
_calculate_endog_immunity_prob,
)
from src.create_initial_states.create_initial_immunity import (
_calculate_exog_immunity_prob,
)
from src.create_initial_... |
import json
import logging
import os
from hashlib import md5
from typing import Dict, Optional
import attr
import google.auth
from google.api_core.exceptions import GoogleAPICallError, RetryError
from google.cloud import tasks_v2
from typing_extensions import TypedDict
from accession.file import GSFile
from accession... |
from contextlib import contextmanager
import json
import logging
from pymel.core import cmds, delete, getAttr, objExists, orientConstraint, pointConstraint, select, setAttr, traceback
import pdil
from ... import cardRigging
from ... import util
from ... import node
from ..._core import find
from ..._core import ski... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.