text stringlengths 6.04k 39.5k |
|---|
"""
Display rotation correcting perspective transforms for Superpaper.
Having displays in a multi monitor setup both tilted and swiveled will
shear the wallpaper in disjoint pieces where lines are not preserved.
This module will research into alleviating or fixing this issue by applying
perspective corrections that ai... |
"""Connect to the Konfuzio Server to receive or send data."""
import json
import os
import io
import logging
import time
from operator import itemgetter
from typing import List
import requests
from urllib.parse import urlparse
from konfuzio_sdk import KONFUZIO_HOST, KONFUZIO_TOKEN
from konfuzio_sdk.urls import (
... |
import pytest
import unittest
import random
import time
from pelita.game import setup_game, run_game, play_turn
from pelita.layout import parse_layout
from pelita.player import (random_player, stopping_player, stepping_player,
round_based_player, speaking_player)
# some directions that ar... |
# Copyright 2021 University College London. 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 appl... |
from __future__ import annotations
import asyncio
from contextlib import asynccontextmanager
from datetime import datetime, timedelta
from http.cookiejar import CookieJar
from types import TracebackType
from typing import Any, AnyStr, AsyncGenerator, List, Optional, Tuple, TYPE_CHECKING, Union
from urllib.parse import... |
import copy
import enum
import typing
import torch
import torch.utils.checkpoint
DUAL_OR_QUAD_TENSOR = typing.Union[typing.Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor],
typing.Tuple[torch.Tensor, torch.Tensor]]
TENSOR_OR_LIST = typing.Union[typing.List[torch.Tensor]... |
# -- coding: utf-8 --
#!/usr/bin/env python
import io
import optparse
import os
import sys
if sys.version < '3':
import codecs
import pyang
from pyang import plugin
from pyang import error
from pyang import util
from pyang import hello
from pyang import statements
from pyang import syntax
def run():
usage =... |
# -*- coding: utf-8 -*-
#
# Copyright 2019 <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 applicabl... |
import logging
import time
from datetime import datetime, timedelta
import requests
from bs4 import BeautifulSoup
from homeassistant.components.climate.const import (HVAC_MODE_AUTO,
HVAC_MODE_HEAT,
HVAC_MODE_OFF)
f... |
"""
WSP Cleaning:
Takes a csv file from WSP's collision analysis tool and returns a new csv file
in a format that can be merged with Weather Underground data, ultimately being
used in a visualization tool
"""
import numpy as np
import pandas as pd
from IPython.core.interactiveshell import InteractiveShell
from pypro... |
"""Utilities relating to lookup and manipulation of mesos tasks in a service or across the cluster.
************************************************************************
FOR THE TIME BEING WHATEVER MODIFICATIONS ARE APPLIED TO THIS FILE
SHOULD ALSO BE APPLIED TO sdk_tasks IN ANY OTHER PARTNER REPOS
****************... |
# coding: utf-8
# In[1]:
import numpy as np
from sklearn.cluster import KMeans
import matplotlib.pylab as plt
import torch
import torch.nn as nn
from torch.autograd import Variable
import time
from sklearn.model_selection import train_test_split
import sys, os
sys.path.append(os.path.join(os.path.dirname("__file__... |
# -*- coding: utf-8 -*-
# created by <NAME>, <EMAIL>
from __future__ import unicode_literals
from datetime import date, datetime
from django.contrib.auth.models import User
from django.core.exceptions import PermissionDenied
from django.shortcuts import render, redirect
from django.urls import reverse, reverse_lazy
... |
import subprocess
import shlex
import re
import os
import time
import platform
import json
import sys
import base64
import random
import datetime
import traceback
import robot_util
import _thread
import copy
import argparse
import audio_util
import urllib.request
from subprocess import Popen, PIPE
from threading import... |
# -*- coding: utf-8 -*-
""" Routes for essay analysis interface"""
import flask
import json
import logging
import os
import traceback
#import urllib3.request, urllib3.error, urllib3.parse,
import urllib
from html.parser import HTMLParser
from logging.handlers import RotatingFileHandler
from random import randint
from ... |
import errno
import io
import json
import logging
import os
import pickle
import string
import random
import tarfile
import typing
import tempfile
import hashlib
import subprocess
from os.path import abspath, dirname, join
from gzip import GzipFile
import arrow
import boto3
ROOT = abspath(dirname(dirname(dirname(__fi... |
# -------------------------------------------------------------------- #
# #
# Python script containing various routines #
# for calculating Green's functions using Tight-binding #
# ... |
#!/usr/bin/env python3
import argparse
import re
import sys
from calendar import monthrange
from datetime import date, datetime, time
from enum import Enum
from functools import partial, reduce
from pathlib import Path
from shutil import copyfileobj
from zipfile import ZipFile
import logging
from dataclasses import dat... |
from aifc import Error
from datetime import datetime
import hashlib
import itertools
import json
import os
from PIL import Image
from random import randint, shuffle
import requests
import sqlite3
from sqlite3.dbapi2 import IntegrityError
import sys
import time
BASE_LAYER_PATCH = 'Background'
def db_connection(dbPat... |
import sys
import os
import copy
import random
import time
import pickle
import numpy as np
from enum import Enum, auto
from typing import List, Union, Text, Optional, Any, Type
import jax
# import jax.config
# jax.config.update("jax_enable_x64", True)
# if os.environ.get('CONDA_DEFAULT_ENV') == 'quspin':
# print... |
# Copyright 2019 <NAME> All Right 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 agreed ... |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2019, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
import os
import logging
import sys
from collections import OrderedDict
import cartosql
import datetime
import hashlib
import requests
import time
import json
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
### Constants
DATA_DIR = 'data'
# url at which the data can be downloaded
DATA_URL = 'https://u50g... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 NetApp, 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.or... |
# Load nvdm or nvrnn, check how Gauss or vMF distributes
"Dataptb_Distnor_Modelnvrnn_Emb400_Hid400_lat200_lr0.001_drop0.2"
import logging
import os
import random
import shutil
import time
import numpy as np
import torch
from NVLL.analysis.analyzer_argparse import parse_arg
from NVLL.data.lm import DataLM
from NVLL.m... |
from bokeh.io import output_file
from bokeh.layouts import gridplot, row, widgetbox
from bokeh.models import HoverTool, Title
from bokeh.plotting import figure, ColumnDataSource, save
from bokeh.models.callbacks import CustomJS
from bokeh.models.widgets import Toggle, MultiSelect
from cffi import FFI
from rpy2 import r... |
import os
import glob
import re
import json
import numpy as np
from astropy.io import fits
import desiutil.log
import desisurvey.etc
import desisurvey.tiles
import desisurvey.ephem
import astropy.table
log = desiutil.log.get_logger()
class subslices:
"Iterator for looping over subsets of an array"
def __init... |
import os
import sys
import pytest
sys.path.insert(0,os.getcwd())
from LSparser.command import CommandCore,OPT,Option,CommandHelper,OptType,ParserCore
from LSparser import Events,Command,CommandParser,ParseResult
def teardown_function():
#每个测试函数后执行
CommandCore.cores.pop("main")
CommandCore.last=None
def... |
# 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... |
import numpy as np
from tqdm import tqdm
possible_motion_estimation_methods = ['decentralized_registration', ]
def init_kwargs_dict(method, method_kwargs):
# handle kwargs by method
if method == 'decentralized_registration':
method_kwargs_ = dict(pairwise_displacement_method='conv2d', convergence_met... |
import sys
import os
import argparse
import time
import textwrap
import yaml
from d20.version import GAME_ENGINE_VERSION
from d20.Manual.Logger import logging
from d20.Manual.Facts import loadFacts
from d20.Manual.Config import Configuration
from d20.Manual.Shell import ShellCmd
from d20.Players import verifyPlayers
... |
import dateutil.parser
from django.core.serializers.json import json, DjangoJSONEncoder
from django.shortcuts import get_object_or_404, redirect
from django.views.generic import FormView, TemplateView
from django.urls import reverse
from django.utils.translation import ugettext as _
from django.utils import timezone
fr... |
#
# 8
# 7
# 6
# 5
# 4
# 3
# 2
# 1
# a b c d e f g h
# board is flipped so white is on top...
import sys
chessBoard = [
[ 'R', 'N', 'B', 'Q', 'K', 'B', 'N', 'R' ],
[ 'P', 'P', 'P', 'P', 'P', 'P', 'P', 'P' ],
[ '.', '.', '.', '.', '.', '.', '.', '.' ],
[ '.', '.', '.', '.', '.', '.', '.', '.' ],
... |
import numpy as np
#import scipy.io.wavfile
import matplotlib.pyplot as plt
import scipy.io
import os
import SER_Datasets_Libs.SER_DB as SER_DB
from FormantsLib.FormantsExtract import Extract_files_formant_features as Extract_formants
import FormantsLib.FormatsHDFread as HDFread
import SER_phonemes_learn.PhonemeSER a... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import matplotlib
matplotlib.use('Agg')
import itertools
import json
import logging
import os
import sys
import random
from random import shuffle
import pdb
from PIL import Image, ImageEnhance
import numpy as np... |
r"""
Classes for output modules.
"""
from collections import Iterable
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import grad
import schnetpack.nn.activations
import schnetpack.nn.base
import schnetpack.nn.blocks
from schnetpack.data import Structure
class AtomisticModel(nn.Module):
... |
"""
Trains a Pixel-CNN++ generative model on CIFAR-10 or Tiny ImageNet data.
Uses multiple GPUs, indicated by the flag --nr-gpu
Example usage:
CUDA_VISIBLE_DEVICES=0,1,2,3 python train_double_cnn.py --nr_gpu 4
"""
import os
import sys
import time
import json
import argparse
from tqdm import tqdm
import numpy as np
i... |
import copy
import math as m
import numpy as np
# Constants
g_0 = 9.81
R_u = 8314.462618 # J/kmol K
def M_star_of_M(M, gamma):
# Calculates M* as a function of M and gamma
return np.sqrt(((gamma+1)*M**2)/(1+(gamma-1)*M**2))
def A_A_star_of_M(M, *args):
# Calculates A/A* as a function of M and gamma
... |
from lib import ops
import tensorflow as tf, numpy as np
class GANBase(object):
# base class for Generator and Discriminator
def __init__(self, name, is_train, FLAGS, norm='instance', activation='relu', unet=False, gb_step=None, train_self=True):
self.name = name
self._is_train = is_... |
"""Contains tests for the model abstractions and different models."""
import unittest
import numpy as np
import tensorflow as tf
import random
from gym.spaces import Box
from hbaselines.hiro.tf_util import get_trainable_vars
from hbaselines.hiro.policy import ActorCriticPolicy, FeedForwardPolicy
from hbaselines.hiro.po... |
# functions_connectivity.py
#
# A collection of functions used for preprocessing EEG data
#
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import mne
BADS_DIR = op.abspath("/net/store/nbp/projects/hyperscanning/study_project/marked_data")
BAD_AR_PATH = op.join(BADS_DIR, "bad_autoreject")
BAD_... |
import base64
from collections import OrderedDict
from datetime import datetime, timedelta
import json
import glob
import logging
import os
import re
import time
from functools import reduce
from pathlib import Path
import cv2
import gevent
import numpy as np
from flask import (
Blueprint,
Flask,
Response,... |
import cv2
import numpy as np
# import tensorflow as tf
from keras.models import Sequential, Model
from keras.layers import Lambda
from keras.layers import Cropping2D
from keras.layers import Dense, Dropout, Flatten
from keras.layers import Conv2D, MaxPooling2D, Convolution2D
from keras import backend as K
from keras.p... |
#!/usr/bin/python
# encoding:utf-8
"""
@author: lance
@version: 1.0.0
@license: Apache Licence
@file: douban_spider_tool.py
@time: 2021/4/1 22:05
"""
import random
import time
import requests
from lxml import etree
import xlwt
import xlrd
from xlutils.copy import copy
from tqdm import tqdm
"""
Cookie: bid=2YpxwjK9lvQ;... |
#!/usr/bin/env python
# encoding: utf-8
#
# Licensed under a 3-clause BSD license.
#
# Original code from mangadap.plot.colorbar.py licensed under the following
# 3-clause BSD license.
#
# Copyright (c) 2015, SDSS-IV/MaNGA Pipeline Group
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, wi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : tokenizers.py
# @Author : <NAME>
# @Time : 2021/07/09
# @Desc :
import os
import json
import numpy as np
import regex as re
import tensorflow as tf
from tensorflow.keras.preprocessing.sequence import pad_sequences
from collections.abc import Iterable
fr... |
import abc
import copy
import enum
import itertools
import logging
import random
import concurrent.futures
from typing import List, Tuple, Set
logger = logging.getLogger(__name__)
class GameConfig:
"""Minesweeper game configuration
Attributes:
width (int): Width of the board.
height (int): ... |
# Author: <NAME>
# Copyright (c) 2019, <NAME>
# All rights reserved.
import os
import numpy as np
import torch
import torch.nn as nn
from torch.nn import init
import torch.nn.functional as F
from torch.autograd import Variable
#from spatial_correlation_sampler import spatial_correlation_sample
from correlation import... |
import torch
from tqdm import tqdm
from modeling.detection.vgg_ssd import create_vgg_ssd, create_vgg_ssd_predictor
from modeling.detection.mobilenetv1_ssd import create_mobilenetv1_ssd, create_mobilenetv1_ssd_predictor
from modeling.detection.mobilenetv1_ssd_lite import create_mobilenetv1_ssd_lite, create_mobilenetv1_s... |
import pytest
import nussl
from pretty_midi import PrettyMIDI, Instrument, Note
from nussl.core import constants
import os
import numpy as np
import yaml
from yaml import Dumper
from nussl.datasets.base_dataset import DataSetException
from nussl.datasets import transforms
import tempfile
import shutil
def test_datase... |
#!/usr/bin/env python3
#
# Author: <NAME>
# Date: 2022-01-28
# Version: 1.5
#
# Updated by <NAME> with pystatx code to support btime
#
# Desc: rewrite of the sleithkit mac-robber in Python
# Unlinke the TSK version, this one can actually includes the MD5 & inode number
# though I still return a 0 in the MD5 column ... |
from django import forms
from django.core.exceptions import ValidationError
from string import Template
from django.utils.safestring import mark_safe
from django.db.utils import ProgrammingError
from .models import (
TnrisImage,
TnrisDocument,
TnrisTraining,
TnrisForumTraining,
TnrisInstructorType... |
# 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... |
#!/usr/bin/env python3
import argparse
import csv
import logging
import math
import random
H = 'H' # Hit
S = 'S' # Stand
Dh = 'DH' # Double Down if allowed, otherwise Hit
Ds = 'DS' # Double Down if allowed, otherwise Stand
P = 'P' # Split
Ph = 'PH' # Split if allowed, otherwise Hit
Rh = 'RH' # Surrender if all... |
# --------------------------------------------------------
# dota_evaluation_task1
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>, based on code from <NAME>
# --------------------------------------------------------
"""
To use the code, users should to config detpath, annopath and i... |
#!/usr/bin/env python3
""" preprocess_mdat2.py
Scripts for preprocesssing idats.
Sequence of operations (and relevant function or functions):
1. Compile a status dictionary (see: 'scan_gsmstatdict')
2. Run preprocessing using wrapper function (see: 'preprocess_mdat_wrapper')
3. Append ne... |
import logging
import os
import random
import argparse
import IPython
import yaml
from PIL import Image
import torch
import timeit
import numpy as np
import scipy.misc as misc
from imageio import imwrite
from os.path import join as pjoin
from torch.backends import cudnn
from torch.utils import data
from ptsemseg.model... |
import src.archs as archs
import torch
import numpy as np
import sys
import matplotlib.pyplot as plt
import argparse
import os
from datetime import datetime
import pickle
import matplotlib
from src.utils.segmentation.IID_losses import IID_segmentation_loss, \
IID_segmentation_loss_uncollapsed
from src.utils.segmen... |
import collections
import subprocess
import tempfile
import time
from enum import Enum
from typing import List, Union, Dict, Tuple, Set, Optional
import numpy as np
import pyparsing
from z3 import Solver, Not, And, Or
from quavl.lib.expressions.complex import ComplexVal, Complexes
from quavl.lib.expressions.qbit impo... |
import discord
from discord.ext import commands
import asyncio
import datetime
from math import floor
import redis
strikesdb = redis.StrictRedis(host='localhost', port=6379, db=0)
punishments = redis.StrictRedis(host='localhost', port=6379, db=1)
bot = commands.Bot(command_prefix='?', description="""Every time someon... |
import os
import torch
# import pickle
# import collections
# import math
import pandas as pd
# import networkx as nx
from rdkit import Chem
# from rdkit.Chem import Descriptors
from rdkit.Chem import AllChem
# from rdkit import DataStructs
from rdkit.Chem.rdMolDescriptors import GetMorganFingerprintAsBitVect
# from to... |
# (c) 2020 Microchip Technology Inc. and its subsidiaries.
# Subject to your compliance with these terms, you may use Microchip software
# and any derivatives exclusively with Microchip products. It is your
# responsibility to comply with third party license terms applicable to your
# use of third party software (incl... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2007, 2012 Red Hat, Inc
# <NAME> <<EMAIL>>
# <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
DOCUMENTATION =... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Copyright (c) Megvii, Inc. and its affiliates.
# <editor-fold desc="import modules">
from loguru import logger
import cv2
import torch
import sys
sys.path.append(r'D:/YOLOX')
from yolox.data.data_augment import preproc, sliding_window
from yolox.data.datasets import C... |
import torch
from torch import nn, optim
from torch.nn import functional as F
from torchvision import transforms as T
from PIL import Image
import os
from torchvision.utils import save_image
from tqdm import tqdm
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.sampler import SubsetRandomSampler
f... |
'''
This file contains the classes, functions and globals used for visualizing
Disk Scheduling algorithms
'''
# Kivy libraries
from kivy.core.window import Window
from kivy.graphics import Color, Line
from kivy.properties import ObjectProperty, NumericProperty
from kivy.uix.scrollview import ScrollView
from kivy.uix.b... |
import os
import shutil
import argparse
import numpy as np
import json
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
import torch.utils.data as data
from torch.utils.tensorboard import SummaryWriter
from sklearn.metrics import precisi... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... |
"""Multiple Degree of Freedom Analysis Tools."""
import numpy as np
import scipy.linalg as la
import scipy.signal as signal
import matplotlib as mpl
__all__ = [
"modes_system",
"modes_system_undamped",
"response_system",
"response_system_undamped",
]
mpl.rcParams["lines.linewidth"] = 2
mpl.rcParams[... |
# Example Problem from
# Practical Methods for Optimal Control and Estimation Using
# Nonlinear Programming SECOND EDITION -- <NAME>
# Section 6.15 Delta III Launch Vehicle, pages 336 -- 345
# Target orbit constraints based on angular momentum and eccentricity vectors:
# Real-time optimal guidance -- <NAME>, 1967
# ht... |
import asyncio
import collections
import datetime
import time
import discord
from discord import AuditLogAction
from discord.embeds import EmptyEmbed
from discord.ext import commands
from discord.raw_models import RawMessageDeleteEvent, RawMessageUpdateEvent
from peewee import IntegrityError
from Util import GearbotL... |
#!/usr/bin/env python
"""Python wrapper for C version of apriltags. This program creates two
classes that are used to detect apriltags and extract information from
them. Using this module, you can identify all apriltags visible in an
image, and get information about the location and orientation of the
tags.
Original ... |
#!/usr/bin/env python
#
# Copyright (c) 2008-2010 <NAME>. All rights reserved.
#
# 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 l... |
"""Blocks processor."""
import logging
import concurrent
from time import perf_counter
from concurrent.futures import ThreadPoolExecutor
from hive.db.adapter import Db
from hive.indexer.accounts import Accounts
from hive.indexer.posts import Posts
from hive.indexer.custom_op import CustomOp
from hive.indexer.payments... |
import struct, re
import pyretic.vendor
from ryu.lib.packet import *
from ryu.lib import addrconv
from pyretic.core import util
from pyretic.core.network import IPAddr, EthAddr
__all__ = ['of_field', 'of_fields', 'get_packet_processor', 'Packet']
_field_list = dict()
IPV4 = 0x0800
IPV6 = 0x86dd
VLAN = 0x8100... |
from collections import namedtuple
import pyfolio as pf
import numpy as np
import pandas as pd
from pandas.tseries.offsets import BDay
from logbook import Logger
from functools import partial
from zipline.api import order, option_chain, record, sid
from zipline.finance import commission, slippage
log = Logger(__na... |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 24 10:45:50 2020
@author: 薛
"""
import matplotlib.pyplot as plt
import numpy as np
import math
import csv
import graham_scan
pi = np.pi
cos = math.cos
sin = math.sin
# 旋转矩阵
def rotation_matrix(rotation):
R = rotation
matrix = [[cos(R), -sin(R)],
[... |
from saturn import Saturn
from discord.ext.commands.converter import clean_content
from assets.cmd import Dueler
import io
import random
from io import BytesIO
from PIL import Image
from aiohttp import request
from assets import *
log = logging.getLogger(__name__)
# noinspection SpellCheckingInspection
class Fun(c... |
# This source code is licensed under the Apache license found in the
# LICENSE file in the root directory of this project.
import requests
import json
from bson.objectid import ObjectId
import logging
import re
from server.db import db
from server.api.common import jenkins_response_to_json, \
create_jenkins_uri, ... |
from collections import OrderedDict
import numpy as np
from lightseq.training.ops.pytorch.util import get_pos_embedding
from lightseq.training import LSTransformerEncoderLayer, LSTransformerDecoderLayer
from lightseq.training.ops.pytorch.export import apply_rule
global_quant_range = 127
global_act_clip_max = 16.0
d... |
from __future__ import division
import random
random.seed(1)
import inspect
from collections import namedtuple, defaultdict, OrderedDict
import numpy as np
np.random.seed(1)
from concise.utils.plot import seqlogo, seqlogo_fig
try:
from sklearn.model_selection import train_test_split # sklearn >= 0.18
except I... |
'''
Module for generating gap visualizations
Author: <NAME>
Date: 2020-11-06
'''
import os
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import matplotlib.dates as mpdates
import pyseas
from pyseas import maps
from pytz import UTC
from cycler import cycler
colors = ["#b... |
"""The model module contains neural network building blocks"""
import torch
import math
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
__all__ = ['corr2d', 'linreg', 'RNNModel', 'Encoder', 'Decoder', 'SequenceMask',
'EncoderDecoder','MLPAttention', 'DotProductAttention', 'masked_so... |
"""
https://github.com/drshrey/spotify-flask-auth-example
https://github.com/plamere/spotipy/issues/194
https://spotipy.readthedocs.io/en/latest/
https://developer.spotify.com/dashboard/
https://developer.spotify.com/documentation/general/guides/scopes/
https://developer.spotify.com/documentation/web-api/reference/... |
# CLI Rack - Lightweight set of tools for building pretty-looking CLI applications in Python
# Copyright (C) 2021 <NAME>
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files
# (the "Software"), to... |
"""Rawls class used to open `.rawls` path image
"""
# main imports
import math
import numpy as np
import struct
import copy
import os
import OpenEXR, array
# image processing imports
from PIL import Image
# package imports
from .scene.details import Details
# astropy
from astropy.io import fits
extensions = ['png',... |
#!/usr/bin/python
# -*- coding:utf-8 -*-
'''
created on 2014 Mar 28
by disooqi
'''
import re
SPACE = u'\u0020'
EXCLAMATION = u'\u0021'
en_QUOTATION = u'\u0022'
NUMBER_SIGN = u'\u0023'
DOLLAR_SIGN = u'\u0024'
en_PERCENT = u'\u0025' #unichr(37)
AMPERSAND = u'\u0026'
APOSTROPHE ... |
# -*- coding: utf-8 -*-
import datetime
from copy import copy
from collections import deque, defaultdict
from utils.linked_list import (
LinkedList, Node
)
from utils.error import Errors
from . calendar_service import CalendarService
def is_collection(item):
"""
判断item是否为list, tuple, 或者set
Args:
... |
from __future__ import print_function
import sys
from collections import defaultdict
try:
import mkl
mkl.set_num_threads(1)
except ImportError:
pass
import pandas as pd
import numpy as np
import pyranges as pr
import pkg_resources
from pyranges.pyranges import PyRanges
from pyranges import data
from ... |
#!/usr/bin/env python3
from __future__ import annotations
from typing import List, Union, Tuple, overload
import numpy as np
from numpy.lib.arraysetops import isin
class Matrix:
"""
An implementation of a simple row-major dense matrix with 64-bit
floating-point elements that uses Numpy as backend.
"""
... |
import os
import numpy as np
import mdtraj as md
from simtk import unit
from simtk.openmm import LangevinIntegrator
from simtk.openmm.app import Simulation
from simtk.openmm.app.pdbfile import PDBFile
from cg_openmm.cg_model.cgmodel import CGModel
from cg_openmm.utilities.helix_utils import *
from cg_openmm.ut... |
import matplotlib.pyplot as plt
import numpy as np
import os
import io
import pandas as pd
import textwrap
from itertools import cycle
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg, NavigationToolbar2QT
from PyQt4 import QtGui, QtCore
from .util import FixedOrderFormatter, eng_format
class Linet... |
"""
This module contains the functions which computes interesting statistics for
the study of the causality between variables. They can be applied to discrete
time-series for obtaining important statistics.
"""
import numpy as np
def parse_spks(spks):
if type(spks) == tuple:
times_event, elements_event,... |
import emoji, re, string, time, os
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from nltk import PorterStemmer, ngrams
from nltk.stem.wordnet import WordNetLemmatizer
from gensim.models import LdaModel
from gensim.corpora import MmCorpus, Dictionary
import data_processing as data_proc
import vocab_helper... |
import json
import os
import sys
import tarfile
import tempfile
import shutil
from uuid import uuid4
import subprocess
from pycompss_cli.core.cmd_helpers import command_runner
# ################ #
# GLOBAL VARIABLES #
# ################ #
master_name = "pycompss-master"
worker_name = "pycompss-worker"
service_name =... |
"""
Pipeline to handle model fitting from data extraction to saving results
"""
import json
import os
import pickle
import shutil
import uuid
from datetime import date, datetime
from glob import glob
import numpy as np
import pandas as pd
from . import changepoint_model
from . import changepoint_preprocess
from .uti... |
"""
This file contains some standard pytest_* plugin hooks to implement multiprocessing runs
"""
import getpass
import inspect
import os
import shutil
import tempfile
from contextlib import contextmanager, suppress
from pathlib import Path
from traceback import format_exc
from typing import Any, Dict
import _pytest
f... |
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import date_diff, add_months, today, getdate, add_days, flt, get_last_day, get_first_day, cint, get_link_to_form, rounded
from erpnext.accounts.utils import get_account_currency
from frappe.email import sendmail_to_system_mana... |
#!/usr/bin/python
# (c) 2018, NetApp, Inc
# 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',
'status': ['preview'],
... |
# Copyright (c) 2015 Cisco Systems, 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 re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.