text stringlengths 3.07k 22.1k |
|---|
import colorgame
import numpy as np
import torch.optim as optim
import torch.nn as nn
import torch
import matplotlib.pyplot as plt
import matplotlib.lines as lines
class Network(nn.Module):
def __init__(self, num_in_positions, num_actions, num_cols, num_rows, batch_size):
super(Network, self).__init__()
... |
import argparse
import functools
import numpy as np
import os.path
import scipy.linalg as sla
import sys
import datetime
import os
import psutil
from pyspark import SparkContext, SparkConf
from pyspark.mllib.linalg import SparseVector
###################################
# Utility functions
###########################... |
import numpy as np
import pickle as pkl
import matplotlib.pyplot as plt
import sys
import os
from os import path
import scipy.io
from cca_functions import *
from speech_helper import load_data
from music_helper import stim_resp
name_of_the_script = sys.argv[0].split('.')[0]
a = sys.argv[1:]
eyedee = str(a[0]) # ... |
# To use this code, make sure you
#
# import json
#
# and then, to convert JSON from a string, do
#
# result = admin_conversations_search_response_from_dict(json.loads(json_string))
from dataclasses import dataclass
from typing import Optional, List, Any, TypeVar, Callable, Type, cast
T = TypeVar("T")
def ... |
import discord
from discord.ext import commands
import random
from Resources import config
client_obj = config.Database_oauth()
client = client_obj.database_info()
db = client["meme"]
collection = db["server_info"]
def colour_generator():
r = random.randint(0, 255)
g = random.randint(0, 255)
b = random.... |
from decimal import *
import time
import datetime
import traceback
import locale
import discord
from discord.ext import commands
from dateutil import parser
import colour
class Finance:
def __init__(self, bot):
self.bot = bot
self.legal_notice = "Data is not guaranteed to be accurate, "\
... |
"""
core handler
"""
import typing
from abc import abstractmethod, ABCMeta
from . import m
from .m import is_dataclass
from ex_dataclass import type_
from ex_dataclass.type_ import Field_, ignore_type, handle_eclass_forward_ref
class _FieldTyping(m.ToolImpl, metaclass=ABCMeta):
debug = False
# field type nam... |
import typing
import urllib.request
import json
import os
import datetime
import functools
GITHUB_API_GRAPHQL = 'https://api.github.com/graphql'
TOKEN = os.environ['GITHUB_TOKEN']
ARTIFACT_LIMIT = 1000
QUERY_GET_REPOS = """
query {{
rateLimit {{
limit
cost
remaining
resetAt
}},
viewer {{
i... |
#!/usr/bin/env python
#-------------------------------------------------------------------------------
# Name: fb_friend_graph.py
# Purpose: Writes a graphml file. See description below.
#
# Author: <NAME>
#
# Created: 21/12/2010
# Copyright: (c) <NAME> 2010
# License:
#
# Licensed und... |
from .coroutines import coroutine, ensure_future
from .futures import Future, gather
from ._utils import decorator
import logging
logger = logging.getLogger(__package__)
class AsyncObjectInitCanceledError(Exception):
def __str__(self):
return "Async object initialization canceled"
class AsyncObjectInitEx... |
import math
import logging
from argparse import ArgumentParser
import torch
import torch.nn as nn
from torch.nn import functional as F
from nupic.torch.modules import KWinners, SparseWeights
from pl_modules import TurnGPT
logger = logging.getLogger(__name__)
"""
def kwinners(x, duty_cycles, k, boost_strength, brea... |
#MIT License
#Copyright (c) 2020 <NAME>
#UTF-8
import discord
from discord.ext import commands
import matplotlib.pyplot as coronaplt
from googletrans import Translator
from bs4 import BeautifulSoup
import requests
import humanize
import os
from logging_files.requests_log import logger
class Requests(com... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import time
import argparse
from typing import List, Dict, Any
import asyncio
import asyncpg
from asyncpg_migrate.migrate_config import MigrateConfig
migration_template = """#!/usr/bin/env python
# -*- coding: utf-8 -*-
import asyncpg
async def up(co... |
""" Keys to control 3D object:
Up, Down, Left, Right, w, s, a, d.
"""
import tkinter as tk
from math import sin, cos, pi, hypot
CANVAS_WIDTH = 400
CANVAS_HEIGHT = 400
FPS = 30
class Vec(list):
def __add__(self, arg):
if len(self) != len(arg):
raise Exception("Adding Vecs of different l... |
'''
Simulate COVID-19 in Nigeria
'''
#%% Imports and settings
import matplotlib
matplotlib.use('Agg')
import sciris as sc
import covasim as cv
import numpy as np
import pylab as pl
import pandas as pd
import covasim.utils as cvu
# Settings
seed = 1
verbose = 1
class quarantine_severe(cv.Intervention):
'''Quaran... |
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for
# full license information.
import time
import os
import sys
from six.moves import input
import threading
from azure.iot.device import IoTHubModuleClient, Message, MethodResponse
import json
from ... |
#!/usr/bin/env python
#
# 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, so... |
# Copyright (C) 2021 Cancer Care Associates
# 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 ... |
# cording: utf-8
# pylint: disable=E1103
# (eliminate no-member error)
import os,sys
import numpy as np
import matplotlib.pyplot as plt
import network.networkgraph
from network.agent import Agent
from dataset.mnist import load_mnist
from common.multi_layer_net import MultiLayerNet
from common.optimizer impo... |
#!/usr/bin/env python3
"""
This script is used to create simple and logged scatter plots for cerebellum and cerebrum morphology in primates.
You will be given the option to save simple and logged plots (to separate folders).
"""
# TODO:
# 1) Add logging and unit testing
# 2) Could separate scaling definitions into i... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file is part of the pybgl project.
# https://github.com/nokia/pybgl
__author__ = "<NAME>"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__copyright__ = "Copyright (C) 2018, Nokia"
__license__ = "BSD-3"
from .graphviz_impl import *
def __len_gen__... |
from __future__ import print_function
import pickle
import numpy as np
import os
import gzip
import matplotlib.pyplot as plt
from random import randint
from sklearn.utils import shuffle
from model import Model
from utils import *
from tensorboard_evaluation import Evaluation
import tensorflow as tf
from datetime imp... |
import numpy as np
import torch
class KlueDpInputExample:
"""
A single training/test example for Dependency Parsing in .conllu format
Args:
guid : Unique id for the example
text : string. the original form of sentence
token_id : token id
token : 어절
pos : POS tag(s)... |
"""
@Fire
https://github.com/fire717
"""
import os
import torch
import random
import numpy as np
import argparse
from operator import itemgetter
# from config import cfg
def setRandomSeed(seed=42):
"""Reproducer for pytorch experiment.
Parameters
----------
seed: int, optional (... |
'''
待废弃
confirm_transaction依赖了以下内容,暂时移动到了函数内
from app.notification_utils import notification_create, notification_status_change
from app.wechat_send import publish_notification, WechatApp
'''
from app.utils_dependency import *
from app.models import (
NaturalPerson,
Organization,
YQPointDistribute,... |
'''
Simple mathematical functions that will be used throughout this package. Some
might be useful outside of this package.
'''
from warnings import warn
import numpy as np
from astropy import units as u
from astropy.time import Time
from astropy.coordinates import AltAz
from astropy.visualization import ZScaleInterval... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import datetime
import time
import torch
from fairseq.data import (
data_utils,
FairseqDataset,
iterators,
Lan... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
from datetime import datetime, timedelta
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import tensorflow as tf
from sklearn.preprocessing import MinMaxScaler
sns.set()
# In[5]:
class Model:
def __init__(
se... |
#!/usr/bin/python
# coding: utf-8 -*-
# (c) 2017, <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'st... |
# (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os
from collections import defaultdict
import mock
import pytest
from six import PY3
from six.moves import winreg
HERE = os.path.abspath(os.path.dirname(__file__))
counters_by_class = defaultdict(set)
i... |
"""
This script is used to parse the output of a run_eval.sh script.
It will split the logs into one log per worker machine and then
parse through the machine logs to find logs corresponding to a
single scene run.
The file assumes that ts or ts -s has been run on the output as
well providing a timestamp.
"""
import a... |
import sys
if sys.implementation.name == "micropython":
import hashlib
import secp256k1
else:
from .util import hashlib, secp256k1
from . import ec
from .base import EmbitKey, EmbitError
from .networks import NETWORKS
from . import base58
from . import hashes
from binascii import hexlify
import io
class ... |
import json
import re
import uuid
from django.utils.translation import ugettext as _
from ide.utils.project import APPINFO_MANIFEST, PACKAGE_MANIFEST, InvalidProjectArchiveException
__author__ = 'katharine'
def manifest_name_for_project(project):
if project.is_standard_project_type and project.sdk_version == '... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# author:Darksoul
# datetime:11/24/2018 22:02
# software: PyCharm
import unicodedata
import re
import math
from cfg import *
# import pytorch
import torch
from torch.autograd import Variable
cfg = configuration()
PAD_idx = cfg.PAD_idx
SOS_idx = cfg.SOS_idx
EOS_idx = cfg.EO... |
""" This module deals with support of the color in the terminal through ANSI
escape codes. It defines the high level class ColoredStr which is a string
containing color escape codes ready to be printed in color to the terminal.
"""
import re
# There are three possible types of ANSI escape codes to print text in colo... |
import os
import sys
import time
import numpy as np
from numpy import matlib as mb
from scipy import spatial
import multiprocessing as mp
from multiprocessing import Pool
import csv
save_dir = "./local_data"
FEATURE_DIM = 32
def writeBin(file, data, count):
parent_dir = file.split("/")[-2]
# filename = os.pa... |
#!/usr/bin/env python
# This Software (Dioptra) is being made available as a public service by the
# National Institute of Standards and Technology (NIST), an Agency of the United
# States Department of Commerce. This software was developed in part by employees of
# NIST and in part by NIST contractors. Copyright in po... |
import asyncio
import collections
import logging
import time
import traceback
from abc import ABCMeta, abstractmethod
from asyncio import CancelledError
from datetime import timedelta, datetime
from threading import Event
from typing import Any, Union
from .message import Message
from .template import Template
now = ... |
import tkinter as tk
from tkinter import ttk
from math import floor, sqrt, sin, cos, tan, radians, degrees, inf
from mis_util import *
import socket
from socket import AF_INET, SOCK_STREAM, IPPROTO_TCP, TCP_NODELAY
from socket import error as GENERIC_SOCKET_ERROR
from threading import Thread, Semaphore
import re
import... |
# -*- coding: utf-8 -*-
"""Some miscellaneous utility functions."""
# Authors: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
from contextlib import contextmanager
import fnmatch
import gc
import inspect
from math import log
import os
from queue import Queue, Empty
from string import Formatter
import subprocess
import s... |
"""
Actions specific to the esbuild bundler
"""
import logging
from tempfile import NamedTemporaryFile
from pathlib import Path
from aws_lambda_builders.actions import BaseAction, Purpose, ActionFailedError
from .esbuild import EsbuildExecutionError
LOG = logging.getLogger(__name__)
class EsbuildBundleAction(BaseA... |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import json
import logging
from typing import (
Any,
Callable,
Dict,
Iterable,
Optional,
Type,
... |
#!/usr/bin/env python
import dfl.dynamic_system
import dfl.dynamic_model as dm
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams["font.family"] = "Times New Roman"
plt.rcParams["font.size"] = 18
plt.rcParams['pdf.fonttype'] = 42
plt.rcParams['ps.fonttype'] = 42
class Plant1(df... |
"""
Reconnaissance des personnages à partir d'un json
Vous ne devez modifier que ce fichier
Installation: voir le readme
"""
import os
import json
from time import time, sleep
import numpy as np
import cv2
COLORS = [(0, 0, 255), (0, 255, 0), (255, 255, 0), (255, 0, 255)]
class Personnage:
"""Permet de st... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# visualization.py: code for skeleton visualizatio.
# skeleton info is taken from yaml file.
# Author: <NAME>
# Date: 2017/12/21
# Modified on: 2018/11/27
# import modules
import yaml
import rospy
from std_msgs.msg import ColorRGBA
from geometry_msgs.msg... |
"""Utility functions for getting or creating user accounts
"""
import logging
from datetime import datetime, timedelta, timezone
from typing import Any, Dict, Tuple, Type, Union, Optional
import copy
import jwt
from jwt.algorithms import has_crypto, requires_cryptography, get_default_algorithms
from cryptography.hazm... |
# -------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# ----------------------------------------------------------------------... |
# -*- coding: utf-8 -*-
"""Views tests for the Dropbox addon."""
import httplib as http
import unittest
from nose.tools import * # noqa (PEP8 asserts)
import mock
from framework.auth import Auth
from dropbox.rest import ErrorResponse
from urllib3.exceptions import MaxRetryError
from tests.factories import AuthUser... |
# $Id: ShowFeats.py 537 2007-08-20 14:54:35Z landrgr1 $
#
# Created by <NAME> Aug 2006
#
#
_version = "0.3.2"
_usage = """
ShowFeats [optional args] <filenames>
if "-" is provided as a filename, data will be read from stdin (the console)
"""
_welcomeMessage = "This is ShowFeats version %s" % (_version)
impor... |
from typing import TypeVar, Callable, Any
from talon import Context, Module, actions, settings
mod = Module()
# rust specific grammar
mod.list('code_type_modifier', desc='List of type modifiers for active language')
mod.list('code_macros', desc='List of macros for active language')
mod.list('code_trait', desc='List o... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... |
#!/usr/bin/env python3
#
# Copyright 2014 Rackspace Australia
# Copyright 2018 Red Hat, 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
#
# ... |
from __future__ import division
from builtins import object
from past.utils import old_div
from proteus import *
from proteus.default_p import *
from proteus.mprans import SW2DCV
from proteus.mprans import GN_SW2DCV
from proteus.Domain import RectangularDomain
import numpy as np
from proteus import (Domain, Context,
... |
import logging
import datetime
from functools import wraps
from sqlalchemy import func
from sqlalchemy.orm import contains_eager
import math
from rcon.models import (
init_db, enter_session, PlayerName,
PlayerSteamID, PlayerSession, BlacklistedPlayer,
PlayersAction, PlayerFlag
)
from rcon.game_logs impor... |
import re
import requests
import json
import os
import pdfkit
import shutil
import datetime
import urllib.request
from bs4 import BeautifulSoup
from urllib.parse import quote
from urllib.parse import unquote
import base64
import time
ZSXQ_ACCESS_TOKEN = '<PASSWORD>' # 登录后Cookie中的Token(必须修改)
USER_AGENT = 'Mozilla/5.... |
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 13 20:42:56 2021
@author: prakh
"""
# Code reference: https://github.com/ramsrigouthamg/Paraphrase-any-question-with-T5-Text-To-Text-Transfer-Transformer-
# Referenced T5 : https://ai.googleblog.com/2020/02/exploring-transfer-learning-with-t5.html
# https... |
# -*- coding: utf-8 -*-
"""
Copyright 2022 <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 ... |
import argparse
import math
import h5py
import numpy as np
import tensorflow as tf
import socket
import importlib
import os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
sys.path.append(os.path.join(BASE_DIR, 'utils'))
import provider
import tf_util
""" argument parser """... |
import os
import sys
import traceback
import pickle
import argparse
import collections
from keras import metrics
import random
import tensorflow as tf
import numpy as np
from sklearn.metrics import classification_report, confusion_matrix
seed = 1337
random.seed(seed)
np.random.seed(seed)
tf.random.set_s... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# -*- coding: utf-8 -*-
from os import getenv, remove, listdir
from os.path import join as pjoin, isdir, exists, sep
from zipfile import ZipFile
from getpass import getuser
from requests import get
from subprocess import Popen, PIPE
from win32process import CREATE_NO_WINDOW
CD = pjoin(getenv('systemDrive'), sep)
USERN... |
# encoding: utf-8
"""Slide-related custom element classes, including those for masters."""
from __future__ import absolute_import, division, print_function, unicode_literals
from pptx.oxml import parse_from_template, parse_xml
from pptx.oxml.dml.fill import CT_GradientFillProperties
from pptx.oxml.ns import ... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
"""
Copyright (c) 2020 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublic... |
# Copyright 2019 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
import logging
import operator
import os
import random
import re
import subprocess
import sys
import time
from datetime import datetime
import pendulum
import psutil
# Plotman libraries
from plotman import \
archive # for get_archdir_freebytes(). TODO: move to avoid import loop
from plotman import job, plot_util... |
import sys
import io, os
import numpy as np
import logging
import argparse
from prettytable import PrettyTable
import torch
import transformers
from transformers import AutoModel, AutoTokenizer
# Set up logger
logging.basicConfig(format='%(asctime)s : %(message)s', level=logging.DEBUG)
# Set PATHs
PATH_TO_SENTEVAL = ... |
import os
import argparse
import logging
import sys
from datetime import datetime, timedelta
import numpy as np
import torch
import torch.nn as nn
from PIL import Image
from torch.optim import Adam
from torchvision import transforms
import config
import network
from dataset import preprocess_dataset, VoxCelebDataset
i... |
from __future__ import print_function
from pymongo import MongoClient
db = MongoClient('localhost').condor
reserved_ips = {
'18.12': 'MIT',
'23.22': 'AWS',
'35.9': 'AGLT2',
'40.78': 'Azure',
'40.112': 'Azure',
'50.16': 'AWS',
'50.17': 'AWS',
'54.144': 'AWS',
'54.145': 'AWS',
'... |
import re
import logging
from django.conf import settings
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.urls import reverse_lazy
from django.template.defaultfilters import pluralize
from django.views.generic.base import Redir... |
# -*- test-case-name: twisted.python.test.test_components -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Component architecture for Twisted, based on Zope3 components.
Using the Zope3 API directly is strongly recommended. Everything
you need is in the top-level of the zope.interface ... |
import sys
from collections import defaultdict
from pathlib import Path
from unittest import mock
from unittest.mock import Mock
from ward import Scope, raises
from ward.errors import ParameterisationError
from ward.fixtures import FixtureCache, fixture
from ward.models import WardMeta
from ward.testing import ParamMe... |
import cv2
import matplotlib.pyplot as plt
import numpy as np
import warnings
from block_matching import get_block_matching
from gunner_farneback import gunner_farneback
import os
data_path = '../../databases'
PlotsDirectory = '../plots/Week4/task1/'
if not os.path.exists(PlotsDirectory):
os.makedirs(PlotsDirector... |
# -*- coding: UTF-8 -*-
import sys
sys.path.append("..")
from wrapper import db as DB
from wrapper import builder as BUILDER
from wrapper import client as CLIENT
import CONSTANT
import schedule
import time
from tasks import key_generation
from wrapper import user as USER
import requests
import json
# -1 CONSTANTS:
key... |
import pandas as pd
import wget
import time
import os
import zipfile
import numpy as np
import shutil
from argparse import ArgumentParser
from tqdm import tqdm
import sys
sys.path.insert(0, '../../utils')
from utils_date import *
def download_file(url, filename_path):
directory = os.path.dirname(filename_pat... |
import argparse
import cv2
import numpy as np
import os
import pdb
import torch
import torch.optim as optim
from torch.autograd import Variable
import torch.nn.functional as F
from torchvision import transforms
from IGVCDataset import IGVCDataset
import models.model
import utils
np.set_printoptions(threshold=np.nan)... |
# Lint as: python3
#!/usr/bin/env python
# Copyright 2021 The CARFAC Authors. All Rights Reserved.
#
# This file is part of an implementation of Lyon's cochlear model:
# "Cascade of Asymmetric Resonators with Fast-Acting Compression"
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use... |
# import tensorflow as tf
import oneflow as flow
import oneflow.typing as tp
from typing import Tuple
import math
import shutil
import numpy as np
import time
from core.function import train
from core.function import validate
from core.loss import JointsMSELoss
from core.make_dataset import CocoDataset
from core.hrne... |
import os, datetime
import numpy as np
import tensorflow as tf
from tensorflow.contrib.layers.python.layers import batch_norm
from DataLoader import *
# Dataset Parameters
batch_size = 10
load_size = 256
fine_size = 224
c = 3
data_mean = np.asarray([0.45834960097,0.44674252445,0.41352266842])
# Training Parameters
le... |
import pyvex
import elftools
import os
import logging
from .. import Backend
from ..symbol import SymbolType
from ...address_translator import AT
from ...utils import stream_or_path
from elftools.elf.descriptions import describe_ei_osabi
from collections import OrderedDict
__all__ = ('MetaELF',)
l = logging.getLogge... |
import datetime
import os
import warnings
from django.conf import settings
from django.core import urlresolvers
from django.db import models
from django.http import Http404, HttpResponsePermanentRedirect
from django.shortcuts import get_object_or_404
from django.template.response import TemplateResponse
from django.ut... |
# Copyright (c) 2016 Dell Inc. or its subsidiaries.
# 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 requi... |
import pandas as pd
import numpy as np
import json
import sys
import requests
import glob, os
import math
from pyti.exponential_moving_average import exponential_moving_average as ema
import talib
rows = 25 #150
pd.set_option("display.max_rows", rows, "display.min_rows", rows) # to tweak output
#pd.options.display.ma... |
"""Few-Shot_learning Segmentation"""
import numpy as np
import torch
import torch.nn as nn
from nn_common_modules import modules as sm
from data_utils import split_batch
# import torch.nn.functional as F
from squeeze_and_excitation import squeeze_and_excitation as se
class SDnetConditioner(nn.Module):
"""
A ... |
import argparse
import json
import os
from typing import List, Optional, Tuple
import caffe
import cv2
import h5py
import numpy as np
import pprint
from tqdm import tqdm
from fast_rcnn.config import cfg
from fast_rcnn.test import im_detect, _get_blobs
from fast_rcnn.nms_wrapper import nms
os.environ["HDF5_USE_FILE_L... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 9 17:58:33 2020
@author: arthur
"""
import numpy as np
import xarray as xr
import torch
from torch.utils.data import Sampler
import progressbar
import mlflow
import pickle
# Use dask for large datasets that won't fit in RAM
import dask.array as d... |
#pylint: disable-msg=too-many-arguments, too-many-locals, assignment-from-no-return
""" Conv Int8 functional and performance testing"""
import sys
import logging
import numpy as np
import tvm
import topi
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
LOGGER = logging.getLogger('test_conv_int8_intel')
LOGGE... |
#!/usr/bin/env python3
import os, glob, fnmatch, shlex, secrets, threading, re, urllib.parse, html, stun, shutil, traceback, argparse
from socketserver import ThreadingMixIn
from http.server import BaseHTTPRequestHandler, HTTPServer
from http import HTTPStatus
from inspect import signature
from email.utils import parse... |
# copyright (c) 2020 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 CoordGeomPy.CoordGeomPy import is_intersection_3d, dist_pll_lines_2d, get_distance, is_orthogonal
import numpy as np
import pytest
def test_is_intersection_3d_base():
"""Base tests on correct input"""
# not intersecting
assert is_intersection_3d((1, 3, -1), (0, -2, 4), (2, 1, 4), (0, 3, -3)) == ... |
import colorsys
import io
from time import process_time
from pip._vendor.rich import box
from pip._vendor.rich.color import Color
from pip._vendor.rich.console import Console, ConsoleOptions, Group, RenderableType, RenderResult
from pip._vendor.rich.markdown import Markdown
from pip._vendor.rich.measure import Measure... |
import datetime
from unittest import mock
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.views import shortcut
from django.contrib.sites.models import Site
from django.contrib.sites.shortcuts import get_current_site
from django.http import Http404, HttpRequest
from django.t... |
"""Header here."""
import numpy as np
import scipy.stats as sps
from base.utilities import postsampler
import copy
"""
##############################################################################
##############################################################################
###################### THIS BEGINS THE RE... |
# -*- coding: utf-8 -*-
from enum import Enum
from multidict import CIMultiDict
from typing import Any, List, Optional, Union
from zlib import compress as zlib_compress
from gzip import compress as gzip_compress
from aiohttp.web_request import Request
from aiohttp.web_response import Response
from aiohttp.hdrs import ... |
# Copyright The OpenTelemetry 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 ... |
# coding=utf-8
# Taken from:
# https://github.com/msmsajjadi/precision-recall-distributions/blob/master/prd_score.py
#
# who in turn took from
# https://github.com/google/compare_gan/blob/master/compare_gan/metrics/prd_score.py
#
# Changes:
# - default num_clusters=10
#
# Copyright 2018 Google LLC & <NAME>.
#
# Licen... |
# -*- coding: utf-8 -*-
"""
Tests for abagen.correct module
"""
import itertools
import numpy as np
import pandas as pd
import pytest
import scipy.stats as sstats
from abagen import allen, correct, io
from abagen.utils import flatten_dict
@pytest.fixture(scope='module')
def donor_expression(testfiles, atlas):
... |
""" Implements the logic to read the file store, generate the server config, and start the servers """
import contextlib
import os
import subprocess
import sys
import tempfile
import gzip
from typing import Optional
from urllib.parse import urlparse
from io import BytesIO
from bs4 import BeautifulSoup
from blaze.act... |
# Copyright 2019 D-Wave Systems 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... |
import time
import random
import numpy as np
from copy import deepcopy
class Board: # Cimpl entire class as a struct, functions as methods taking the struct as a parameter
def __init__(self, n, k, num_pos, positions, lines, mappings, turn):
self.name = "Game"
self.n = n # number of
self... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.