text stringlengths 3.07k 22.1k |
|---|
# coding: utf-8
from __future__ import print_function, division
import argparse
import os
import sys
import numpy as np
import random
import torch
from torch.optim import Adam
from torch.utils.data import DataLoader
from torchvision import datasets
from torchvision import transforms
from ignite.engine import Engine,... |
"""Contains the NighthawkTestServer class, which wraps the nighthawk_test_servern binary."""
import http.client
import json
import logging
import os
import socket
import subprocess
import sys
import random
import requests
import tempfile
import threading
import time
import yaml
from string import Template
from pathlib... |
"""Starry speed tests."""
from starry.kepler import Primary, Secondary, System
from starry import Map
import time
import matplotlib.pyplot as pl
import numpy as np
import batman
import subprocess
from scipy.optimize import curve_fit
from scipy.special import gamma
from scipy.integrate import dblquad
def ms(error):
... |
import numpy as np
import matplotlib.pyplot as plt
import multiprocessing as mp
from tqdm import tqdm
from importlib import reload
def BGsubtraction(data, meta, log, isplots):
"""
Does background subtraction using inst.fit_bg & optspex.fitbg
Args:
dat: Data object
md: Metadata object
... |
import torch.nn as nn
from torch.nn import functional as F
import math
import torch.utils.model_zoo as model_zoo
import torch
import numpy as np
from torch.utils.model_zoo import load_url
from torch.autograd import Variable
import sys, os
from ..nn import AttentionGraphCondKernel
from encoding.nn import BatchNorm2d
mo... |
# -*- coding: utf-8 -*-
"""
----------------------------------------------------------------
This is an adapted version of auxiliary functions to read from SpikeGLX data files.
The original code can be found at:
https://billkarsh.github.io/SpikeGLX/#offline-analysis-tools
-------------------------------------------... |
# Copyright 2012 Cloudbase Solutions Srl
#
# 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 l... |
# 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... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by <NAME> and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
"""
import os
import numpy as np
from scipy.stats.stats import pearsonr
import torch
def nanpearsonr(real, pred):
'''Compute Pearson's correlation, omit NA... |
import torch
from torch import nn, einsum
import torch.nn.functional as F
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
from ..registry import register_model
__all__ = ["cvt"]
def group_dict_by_key(cond, d):
return_val = [dict(), dict()]
for key in d.keys():
match = ... |
import torch
import torch.nn as nn
from transformers import BertModel
from config import *
import numpy as np
class BertClassifier(nn.Module):
def __init__(self, freeze_bert=False):
super(BertClassifier, self).__init__()
D_in, H, D_out = 768, HIDDEN_DIM, 2
# Instantiate BERT model
... |
# coding=utf-8
# Copyright 2020 The HuggingFace Datasets 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
#
# Unless required by applicable law or agreed to in writing, software
# dis... |
import betterproto
from dataclasses import dataclass
from typing import Optional, List, Dict
def test_has_field():
@dataclass
class Bar(betterproto.Message):
baz: int = betterproto.int32_field(1)
@dataclass
class Foo(betterproto.Message):
bar: Bar = betterproto.message_field(1)
#... |
from opt_einsum import contract
from .cc_eqs import build_tau
from .lambda_eqs import build_Goo, build_Gvv
def build_Doo(t1, t2, l1, l2): # complete
Doo = -1.0 * contract('ie,je->ij', t1, l1)
Doo -= contract('imef,jmef->ij', t2, l2)
return Doo
def build_Dvv(t1, t2, l1, l2): # complete
Dvv = contra... |
#!/usr/bin/env python3
# Copyright 2020 The Johns Hopkins University (author: <NAME>, <NAME>)
from torch.utils.data import Dataset
import numpy as np
import torch
import os
import librosa
def _get_spectrograms(fpath, require_sr, preemphasis, n_fft, hop_length, win_length, max_db, ref_db, n_mels=80):
'''Parse th... |
# coding: utf-8
# The MIT License (MIT)
# Copyright (c) 2016 Sentry
# Copyright (c) 2016 <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 limita... |
"""Dataset requests."""
import flask
import user
import utils
blueprint = flask.Blueprint("dataset", __name__) # pylint: disable=invalid-name
@blueprint.route("", methods=["GET"])
def list_datasets():
"""Provide a simplified list of all available datasets."""
results = list(
flask.g.db["datasets"].... |
# Modified by <NAME> and <NAME>
###############################################################################
# Copyright (c) 2017-present, Facebook, 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 t... |
import random
import re
import time
from io import BytesIO
from PIL import Image, ImageFont, ImageDraw
from flask import render_template, request, send_file, abort, redirect, session, make_response
from service import *
from util import *
# this function is for recording different ips and distinguish blocked ips. I... |
from __future__ import annotations
import json
import os
from dataclasses import dataclass
from datetime import date, datetime
from enum import Enum
from typing import (
Any,
Callable,
Dict,
Generic,
Iterable,
Iterator,
List,
Optional,
Type,
Union,
)
import requests
from loguru... |
# The MIT License (MIT)
# Copyright © 2021 <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,... |
import pytest
from typing import Dict, Optional
import rasa.shared.utils.io
from rasa.nlu.components import UnsupportedLanguageError
from rasa.nlu.config import RasaNLUModelConfig
from rasa.nlu.constants import TOKENS_NAMES
from rasa.shared.nlu.constants import TEXT, INTENT, ACTION_TEXT, ACTION_NAME
from rasa.shared.n... |
import torch.nn as nn
import sys
sys.path.append(r"E:\ML\Dog-Cat-GANs")
import myViT as vit
#Critic
class CriticA(nn.Module): # (N,3,128,128) -> (N,1)
def __init__(self,CH):
super(CriticA, self).__init__()
c1,c2,c3,c4,c5 = 64, 128, 256, 512, 1024
self.l1 = nn.Sequential(nn.utils.spect... |
# Copyright 2014 Google LLC
#
# 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, s... |
# Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
#
# This work is made available under the Nvidia Source Code License-NC.
# To view a copy of this license, visit
# https://nvlabs.github.io/stylegan2/license.html
"""Helper for adding automatically tracked values to Tensorboard.
Autosummary creates an ide... |
#!/usr/bin/python3.6 -u
import os # For user id, home dir
import pwd # For user name
import time # For refresh interval
import psutil # For memory, cpu usage
import platform # For system info
# For journalctl log
import sys
import re
from subprocess import PIPE, Popen
from threading import Thread
from queue impo... |
# Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmrotate.core import obb2xyxy
from torch import Tensor
import mmdeploy
from mmdeploy.core import FUNCTION_REWRITER, mark
from mmdeploy.mmcv.ops import (ONNXNMSop, ONNXNMSRotatedOp,
TRTBatchedRotatedNMSop)
def select_rnms... |
from torchvision.models.resnet import resnet18
from cifar10_models import resnet
import torchvision.transforms as T
import torch
from torchvision.datasets import CIFAR10
from torch.utils.data import DataLoader
import numpy as np
from time import time
from math import ceil
import os
import argparse
from common_keys impo... |
from math import sqrt
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import statistics
from tqdm import tqdm
import seaborn as sns
import random
from sklearn.cluster import KMeans
import spacy
import time
from langdetect import detect
import nltk
import math
import sklearn
from sklearn.pipeli... |
# 1. 由資料庫讀出姓名 與 68 face landmark 資訊
# 2. 建立視窗
# 3. 開啟webcam 進行身份辨識
# 4. 寫入資料庫
import tkinter as tk
import tkinter.font as tkFont
import mysql.connector
import sys, os, dlib, glob, numpy
import cv2
from skimage import io
import time
from PIL import ImageFont, ImageDraw, Image
# cv2顯示中文字
# 使用 PIL
# paint_chinese_ope... |
from torch import nn
import torch
from torch.nn import functional as F
import functools
from torch.nn import init
import torch.nn as nn
def get_norm_layer(norm_type='instance'):
if norm_type == 'batch':
norm_layer = functools.partial(nn.BatchNorm2d, affine=True)
elif norm_type == 'instance':
no... |
'''
1. 登录认证;
2. 增删改查和搜索
1 增 add # add monkey 12 132xxx <EMAIL>
2 删 delete # delete monkey
3 改 update # update monkey set age = 18
4 查 list # list
5 搜 find # find monkey
6 分页显示 # display page 1 pagesize 2
7 保存 # save
8 导出为cvs格式... |
# Copyright (c) 2016-2017 <NAME> & <NAME>
# This software was developed in Kotulska Lab at Politechnika Wroclawska.
# This module is a part of Quantiprot, released under the MIT license:
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation file... |
# RT - Role Panel
from __future__ import annotations
from typing import TYPE_CHECKING, Callable, Literal, Union
from types import SimpleNamespace
from collections import defaultdict
from inspect import cleandoc
from time import time
from discord.ext import commands
import discord
from rtutil import get_webhook
fro... |
import os
import copy
import inspect
from typing import List
from dataclasses import dataclass
from pygears.conf import PluginBase, reg
from pygears.core.graph import has_async_producer
from traceback import walk_stack
from .intf import Intf
from .port import InPort, OutPort, HDLConsumer, HDLProducer
from .hier_node i... |
#! /usr/bin/env python
# -*- coding: utf8 -*-
from cnlp_annotator.algo_factory.utils import ordered
from cnlp_annotator.algo_factory.utils import lazyproperty
from cnlp_annotator.algo_factory.utils import list_to_str
from itertools import groupby
import os
import json
import io
import datetime
import logging
import w... |
import pytest
import httpx
import time
# Public endpoints
from crypto_dom.kraken.market_data.ohlc import Response as OhlcResp, URL as OHLCURL
from crypto_dom.kraken.market_data.orderbook import Response as OrderBookResp, URL as OBURL
from crypto_dom.kraken.market_data.asset_pairs import Response as AssetPairsResp, URL... |
from tqdm import tqdm
import numpy as np
from imutils import face_utils
import dlib
from collections import OrderedDict
import cv2
from calib_utils import track_bidirectional
detector = dlib.get_frontal_face_detector()
predictor = dlib.shape_predictor("shape_predictor_68_face_landmarks.dat")
FACIAL_LANDMARKS_68_IDXS =... |
# -*- coding: utf-8 -*-
"""
The DigitalElevationDataType definition.
"""
from typing import Union, List
import numpy
from .base import DEFAULT_STRICT
# noinspection PyProtectedMember
from ..sicd_elements.base import Serializable, _SerializableDescriptor, _IntegerDescriptor, \
_FloatDescriptor, _FloatListDescrip... |
"""
Script adopted from:
https://github.com/huggingface/transformers/blob/master/examples/run_glue.py
"""
import collections
import logging
from transformers import BertConfig
from model.model import BertForDistantRE
from utils.train_utils import *
from utils.utils import idx_to_rel, idx_to_ent, trip_set
logg... |
from __future__ import print_function
from compas_rhino.forms import Form
try:
import System
from System.Windows.Forms import TabControl
from System.Windows.Forms import Button
from System.Windows.Forms import DialogResult
from System.Windows.Forms import FlowLayoutPanel
from System.... |
#!/usr/bin/env python
import math
import argparse
import logging
import numpy as np
import scipy.signal
import audio
logger = logging.getLogger(__name__)
def hrtf_file(audio_path, azimuth, elevation=0, distance=1, ear_distance=0.215, output=None):
"""
Read mono audio file and write binaural wav file to out... |
import common
import congealingcomplex
import cv2
import glob
import landmark
import numpy as np
import open_face
import os
import pyprind
import vgg_face
# The extensions of the facial images
FACIAL_IMAGE_EXTENSION_LIST = [
"_bbox.jpg", "_open_face.jpg", "_congealingcomplex.jpg"
]
# The file names of the mean fa... |
"""
Test Nextflow workflow using configuration with UMI extraction and
deduplication.
The test suite runs ``nextflow run prep_riboviz.nf`` using
``vignette/simdata_umi_config.yaml``
(:py:const:`riboviz.test.SIMDATA_UMI_CONFIG`) and simulated data in
``data/simdata/`` (created by
:py:mod:`riboviz.tools.create_fastq_sim... |
#!/usr/bin/env python3.6
# coding=utf-8
'''
Scripts to run the model over preprocessed data to generate evaluatable results
@author: <NAME> (<EMAIL>)
@since: 2018-05-30
'''
from parser.DataIterator import *
from parser.BertDataIterator import *
import parser
import torch
import os
import networkx as nx
from torch i... |
#!/usr/bin/env python
import random
from PyQt5.QtPrintSupport import (QPrinter)
from PyQt5.QtCore import (QLineF, QPointF, QRectF, Qt, QTimer)
from PyQt5.QtGui import (QPen, QBrush, QColor, QPainter, QIntValidator, QImage)
from PyQt5.QtWidgets import (QApplication, QWidget, QGraphicsView, QGraphicsScene, QGraphicsIte... |
from __future__ import print_function
import json
import os
import shutil
import subprocess
import tempfile
from dcos import constants, util
from dcos.errors import DCOSException
logger = util.get_logger(__name__)
def command_executables(subcommand):
"""List the real path to executable dcos program for specifi... |
# Utility functions for the course Robot Modelling
# <NAME> (<EMAIL>), sept. 2016
#
# Additional functions added for more functionality
# <NAME> (<EMAIL>), sept. 2018
# <NAME> (<EMAIL>), sept. 2018
###############################################################################
import numpy as np
from numpy import cos, ... |
import os
import random
import sys
import uuid
import warnings
from typing import Any, Dict, Optional, Sequence
__windows__ = sys.platform == 'win32'
__resources_path__ = os.path.join(
os.path.dirname(
sys.modules.get('docarray').__file__ if 'docarray' in sys.modules else __file__
),
'resources',
... |
import json
from interface import *
import pprint
import random
import sys
boards = []
mainBoard = -1
gameBoard = [[]]
intentos = 0
def loadData(filename):
with open(filename) as jsonFile:
boards = json.load(jsonFile)
jsonFile.close()
return boards
def __init__():
global... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import asyncio
import datetime
import math
import os
import re
import time
from re import findall, match
from typing imp... |
#!/usr/bin/env python3
# @Time : 17-9-2 14:47
# @Author : <NAME>
# @Contact : <EMAIL>
# @File : time_elements.py
"""
Process overall information of one month.
"""
import calendar
from collections import namedtuple
from datetime import date, datetime, timezone, timedelta
from decimal import Decimal
from functool... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
from builtins import range
from io import open
import gevent as gvt
import json as jsn
from flask import Flask
from flask import request
import re as rgx
import os
import eel_flask.browsers as brw
import random as rnd
import sys
import pkg_resources as pkg
import socket
import mimetypes
from flask_sockets import Socket... |
from contextlib import closing
from PIL import Image
import subprocess
from audiotsm import phasevocoder
from audiotsm.io.wav import WavReader, WavWriter
from scipy.io import wavfile
import numpy as np
import re
import math
from shutil import copyfile, rmtree
import os
import argparse
from pytube import YouTube
def d... |
import numpy as np
import pandas as pd
from unittest import TestCase
from dataverk.exceptions.dataverk_exceptions import EnvironmentVariableNotSet
from dataverk.utils import anonymization
df_in = pd.DataFrame(data={'col1': [1, 2, 3, 4, 5, 6], 'col2': [33, 44, 55, 67, 765, 1111]})
df_values = pd.DataFrame(data={'value... |
# Copyright 2014-2020 The PySCF Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#Anki add-on
#Written by <NAME> <EMAIL>
from aqt import mw
from aqt.qt import *
from aqt.deckbrowser import DeckBrowser
from aqt.deckconf import DeckConf
class ScrollArea(QScrollArea):
def __init__(self):
super(ScrollArea, self).__init__()
class ConfigurationWin... |
# -*- coding: utf-8 -*-
from abc import ABCMeta, abstractproperty, abstractmethod
from pdb import Pdb
from lxml import etree as ET
from lxml import objectify
from ..utils import regex_base
import re
debugger = Pdb()
numeric_ranges = {
'SByte': { '_minval': -2**7, '_maxval': 2**7 },
'Int16': { '_maxval': 2**15, '_mi... |
#*****************************************************************************#
#* Copyright (c) 2004-2008, SRI International. *#
#* All rights reserved. *#
#* ... |
import json
import logging
from json_delta import diff
_LOGGER = logging.getLogger(__name__)
def _build_md(content, title, buffer):
buffer.append(title)
buffer.append("")
for item in content:
buffer.append(" - " + item)
buffer.append("")
class ChangeLog:
def __init__(self, old_report,... |
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import pytest
from unittest import mock
from traitlets import Bool, Tuple, List, Instance, CFloat, CInt, Float, Int, TraitError, observe
from .utils import setup, teardown
from ..widget import Widget
#
# First some... |
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module containing the report stages."""
import logging
import os
import sys
from chromite.cbuildbot import commands
from chromite.cbuildbot impor... |
# flake8: noqa
# global
import copy
import functools
import numpy as np
from operator import mul
# local
from . import conversions
from .conversions import *
from .activations import ArrayWithActivations
from .creation import ArrayWithCreation
from .data_types import ArrayWithDataTypes
from .device import ArrayWithDev... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import sys
from builtins import object
from pants.base.cmd_line_spec_pars... |
import logging
import fingerprints
from pprint import pprint, pformat # noqa
from banal import ensure_list, first
from followthemoney import model
from followthemoney.types import registry
from elasticsearch.helpers import scan
from aleph.core import es, cache
from aleph.model import Entity
from aleph.index.indexes i... |
import asyncio
from discord import Embed, Color, Member, utils, File
from discord.ext import commands
from data import dbconn
from utils import cf_api, paginator
import discord
import random
import string
from random import randint
from operator import itemgetter
from discord.ext.commands import cooldown, BucketType, ... |
"""
This programm computes the HEATMAPS and STATISTICAL TESTS for the collocators that occur BEFORE a dfcp or 'dass'
"""
import re
import pandas as pd
import scipy.stats as stats # import stat calculator
import matplotlib.pyplot as plt # plor graphs
import seaborn as sns # create heatmaps
import pre_plots.dass.plot_10... |
# -*- coding: utf-8 -*-
"""
Root resources for Pyramid traversal.
Root resources are reusable components that can handle things like looking up a
model object in the database, raising :py:exc:`KeyError` if the object doesn't
exist in the database, and checking whether the request has permission to
access the object.
... |
#!/usr/bin/env python
import os
def plot_boxplot(
filename, group_names, group2values, height=None, width=None, cluster=None,
title="", subtitle="", sub="", xlab="", ylab="",
subtitle_size=1.0, subtitle_line=0.5, subtitle_col="#000000",
xlabel_size=1.0, xlabel_off=False,
mar_bottom=1.0, mar_left=... |
import datajoint as dj
import numpy as np
from numpy.lib import emath
from functools import reduce
from .common_session import Session # noqa: F401
schema = dj.schema('common_interval')
# TODO: ADD export to NWB function to save relevant intervals in an NWB file
@schema
class IntervalList(dj.Manual):
definitio... |
#! /usr/bin/env python3
import sys, platform
import ctypes, ctypes.util
import os.path
from ctypes import POINTER
if platform.uname().system == "Windows":
system = "Windows"
libjtag_client_filename = 'jtag_client.dll'
libjtag_atlantic_filename = 'jtag_atlantic.dll'
bin_dir ... |
# coding=utf-8
# Copyright 2020 The SimCLR 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... |
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.core.urlresolvers import reverse as django_reverse
from django.utils.http import urlquote
from django.conf import settings
import jingo
from spark.models import City
from spark.urlresolvers import reverse, absolute... |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import fnmatch
import logging
import posixpath
import signal
try:
import _thread as thread
except ImportError:
import thread
import threading
from devil... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file declares types and methods useful for enumerating
all of the address spaces and permissions of an ELF file in memory.
This is necessary for when access to /proc is restricted, or when
working on a BSD system which simply does not have /proc.
"""
import ctype... |
"""Plays SALIENT for you
pip install requests tqdm
"""
import os
import re
import sys
import json
import logging
from io import open
from time import sleep, time
from datetime import datetime
from getpass import getpass
import requests
from tqdm import tqdm
try:
_input = raw_input
except:
_input = input
d... |
from . import rxd, node, rxdmath
import numpy
import weakref
import itertools
import scipy.sparse
import itertools
from .rxdException import RxDException
import warnings
_weakref_ref = weakref.ref
# aliases to avoid repeatedly doing multiple hash-table lookups
_itertools_chain = itertools.chain
_numpy_array = numpy.ar... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 19 18:29:16 2021
"""
def cry_out2pmg(output, vacuum=10, initial = False, molecule = True):
#Transform a CRYSTAL output object into a pymatgen structure object
# output_file is a crystal output object
# initial == False reads the last g... |
"""This module implements a basic constraint checker for a solved graph.
This module implements a number of functions to help check basic relational constraints
between entities. Note that only checking is implemented: this is not an implementation
of a solver, and cannot solve for the desired constraints.
"""
impor... |
"""Support for Minut Point."""
import asyncio
import logging
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_TOKEN, CONF_WEBHOOK_ID
from homeassistant.helpers import config_validation as cv
from homeassistant.h... |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from operator import attrgetter
from flask import flash, request, session
from sqlalchemy.orm import join... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
import numpy as np
import copy
import logging
import random
from gunpowder.coordinate import Coordinate
from gunpowder.provider_spec import ProviderSpec
from gunpowder.array import ArrayKey
from gunpowder.array_spec import ArraySpec
from gunpowder.graph import GraphKey
from gunpowder.graph_spec import GraphSpec
logg... |
import numpy as np
import vaex
import collections
import six
try:
collections_abc = collections.abc
except AttributeError:
collections_abc = collections
__all__ = ['GroupBy', 'Grouper', 'BinnerTime']
_USE_DELAY = True
class BinnerBase:
pass
class BinnerTime(BinnerBase):
"""Bins an expression in a s... |
"""empty message
Revision ID: rename_uri_slug
Revises: 20181214_published_unpublished
Create Date: 2018-12-20 10:52:50.641092
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "rename_uri_slug"
down_revision = "20181220_m... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Author: <NAME>
@Contact: <EMAIL>
@File: model.py
@Time: 2018/10/13 6:35 PM
"""
import copy
import math
import os, sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
import torch
import torch.nn as nn
from torch.autograd import Variabl... |
# -*- coding: utf-8 -*-
import pathlib
import time
import pytest
from pytest import mark
from storyruntime.Exceptions import StackOverflowException
from storyruntime.Story import MAX_BYTES_LOGGING, Story
from storyruntime.utils import Dict, Resolver
def test_story_init(app, logger, story):
assert story.entrypoi... |
# model url : https://huggingface.co/fnlp/bart-base-chinese
import torch
import torch.nn as nn
import time
import glob
from torch.utils.data import Dataset, DataLoader
from bert_seq2seq import T5PegasusTokenizer, load_chinese_base_vocab
from bert_seq2seq import T5Model
from bert_seq2seq.bart_chinese import BartGenerati... |
import sys
from typing import Dict, Any, Tuple, Sequence
import hdl21 as h
@h.paramclass
class PdkResistorParams:
w = h.Param(dtype=float, desc="Resistor width (m)")
l = h.Param(dtype=float, desc="Resistor length (m)")
PdkResistor = h.ExternalModule(
name="rupolym_m",
desc="PDK Resistor",
domai... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
"""
Execute actions via the web interface.
"""
from __future__ import annotations
import platform, sys, io, os, shlex, time
from dash.exceptions import PreventUpdate
from meerschaum.utils.threading import Thread
from meerschaum.utils.typing import Succes... |
import streamlit as st
from traderl import data, nn
import pandas as pd
import gc
from traderl import agent
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import clear_output
class DQN(agent.DQN):
def evolute(self, h, h_):
pips, profits, total_pips, total_profits, to... |
"""Class for 2D - Rectangle
When len of Sequence is 4... (Left, Top, Width, Height).
When len of Sequence is 2 (y-coordination, x-coordination).
"""
# TODO: Box should be Immutable.
from collections import UserDict
from collections.abc import Mapping, Sequence
from types import GeneratorType
from fairypptx impor... |
import argparse
import os
from shutil import copyfile
import cv2 as cv
import numpy as np
import torch
from align_faces import get_reference_facial_points, warp_and_crop_face
from config import im_size
from retinaface.detector import detector
def clip_gradient(optimizer, grad_clip):
"""
Clips gradients compu... |
# 测试横向误差指标
import argparse
import numpy as np
import torch
import cv2
from lib.config import Config
import os
from scipy import integrate
from pathlib import Path
from tqdm import tqdm
import matplotlib.pyplot as plt
def parse_args():
parser = argparse.ArgumentParser(description="Train lane detector")... |
from os import mkdir
from os.path import join, exists
import numpy as np
import pandas as pd
from sklearn.metrics import precision_score, recall_score, f1_score
from utils import utils
from utils.enums import MetricCaptions, MetricNames, MetricKind, Classification
class Classifier:
"""
Class to model a class... |
from ansible.module_utils._text import to_native
from ansible.module_utils.basic import AnsibleModule, env_fallback
from ansible import __version__
import re
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
HAS_SDK = True
try:
... |
#!/usr/bin/env python
"""
Process OLCI L1 and MSI L1C image to L2 using default algorithm from SeaDAS
to reproduce Ocean Color Rrs processing and compute additional products
Input files must be in the format downloaded with getOC.py
Need to be run through a SeaDAS Virtual Env and ocssw_runner:
/home/gbourdin/ocssw/... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from .arg_parser import parse_arguments
from .paws_x.utils import convert_examples_to_features, InputExample
from torch.utils.data import DataLoader, TensorDataset, SequentialSampler
from typing import Dict, List, Union
from transformers import (
BertConfig,
BertF... |
# -*- coding: utf-8 -*-
import time
from typing import Any, Collection, Tuple
from unittest.case import expectedFailure
import pytest
from rdflib import XSD, util
from rdflib.graph import ConjunctiveGraph, Graph, QuotedGraph
from rdflib.term import BNode, Literal, URIRef
from rdflib.util import _coalesce
n3source =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.