text stringlengths 3.07k 22.1k |
|---|
#!/usr/bin/env python3
import os
import sys
sys.path += [os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'src')]
sys.path += [os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))]
import fire
import json
import numpy as np
import tensorflow as tf
import model, sample, e... |
# coding=utf-8
"""
一些通用的小工具。
"""
import json
import os
from functools import partial
from pymel import core as pm
__author__ = '<NAME>'
__version__ = '0.01'
class Singleton(object):
"""
单例模式的基类,窗口类型的类都会继承这个类
"""
_instance = None
def __new__(cls, *args, **kw):
if cls._instance is None:... |
"""
Generic methods for converting data between different spatial coordinate systems.
Uses pyproj library.
"""
import firedrake as fd
import pyproj
import numpy
from abc import ABC, abstractmethod
LL_WGS84 = pyproj.Proj(proj='latlong', datum='WGS84', errcheck=True)
class CoordinateSystem(ABC):
"""
Base class... |
import matplotlib
import scipy
__version__="01.00.00"
__author__ ="<NAME>"
ZRS =(0 , 78)
UAS1 =(281,303)
UAS2 =(389,411)
TATA =(551,557)
TSS = 607
ORF =(652,2055)
LEXA =(2140,2246)
LENGTH=2246
NUCLEOSOME_SIZE =147
NUCLEOSOME_CUTOFF=90
class Configuration:
"""Configuration is simply a representation of a... |
### Author <NAME> - 29 September 2020 ###
import pandas as pd
import numpy as np
import json
from gooey import Gooey, GooeyParser
import _pickle as cPickle
from collections import Counter
import warnings
import webbrowser
import time
from sklearn.ensemble import RandomForestClassifier
from imblearn.ensemble import Bal... |
from __future__ import annotations
from datetime import date
from multiprocessing.connection import wait
from hikari.colors import Color
import typing as t
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from hikari.guilds import Guild
from lightbulb.commands import message
from lightbulb.decorators import... |
import torch
import torch.nn as nn
def Conv1x1ReLU(in_channels,out_channels):
return nn.Sequential(
nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=1, stride=1),
nn.ReLU6(inplace=True)
)
def Conv3x3ReLU(in_channels,out_channels,stride,padding):
return ... |
from typing import Optional, Union
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import numpy as np
_annotation_kws = {
"horizontalalignment": "left", # if not mirror_intensity else "right",
"verticalalignment": "center",
"fontsize": 7,
"rotation": 90,
"rotation_mode": "anch... |
from __future__ import absolute_import, unicode_literals, print_function
import logging
import pprint
from builtins import str, object
from future.utils import python_2_unicode_compatible, iteritems
from .compat import PY2, PY2_STR
log = logging.getLogger(__name__)
__all__ = ('compile',
'TypeMatch',
... |
# Application Imports
from application import db, httpauth
from .models import JsonLengthInputs, JsonTypeInputs, User, UserFollow, UserWebhook
from flask import current_app as app
from rfc3986 import is_valid_uri, normalize_uri
import re
# Main Imports
from flask import Response, request, json, send_from_directory
fro... |
# This files contains your custom actions which can be used to run
# custom Python code.
#
# See this guide on how to implement these action:
# https://rasa.com/docs/rasa/custom-actions
# This is a simple example for a custom action which utters "Hello World!"
import mimetypes
import random
from typing import Any, Te... |
# -*- coding: utf-8 -*-
import os
import numpy as np
from datetime import datetime
from tempfile import mkdtemp
def read_header(f):
'''
Read header information from the first 1024 bytes of an OpenEphys file.
Parameters
----------
| f : file
| An open file handle to an OpenEphys file
... |
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import scipy.optimize as optimize
R = 287.058; Cpd = 1005.7; Cpv = 1875; g = 9.81 # define constants
Lw = lambda T: (2.501 - 0.00237 * T) * 10**6
varsIncluded = ['timestamp', 'Pressure', 'Temperature',
'Hum... |
import random
import discord
from discord.ext import commands
from discord.ext.commands import has_permissions
from groovebot.core.models import Album, Music, Abbreviation, Strike
from groovebot.core.utils import (
read_file,
failure_message,
success_message,
config,
text_to_neuropol,
)
class Mu... |
from coreapp.asm_diff_wrapper import AsmDifferWrapper
from coreapp.m2c_wrapper import M2CWrapper
from coreapp.compiler_wrapper import CompilerWrapper
from coreapp.serializers import ScratchCreateSerializer, ScratchSerializer, ScratchWithMetadataSerializer, serialize_profile
from django.shortcuts import get_object_or_40... |
# coding=utf-8
# Copyright 2022 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 ... |
from jax.scipy.signal import convolve2d as conv2
import jax, jax.numpy as jnp
import tqdm
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
from matplotlib import gridspec
from .helpers import reconstruct, reconstruct_numpy, shift_factors, compute_loadings_percent_power, get_shapes, shifted_... |
import argparse
import copy
import logging
import os
import numpy as np
from astropy.wcs import Sip
from scipy import optimize as optimize
from CatalogMatcher import CatalogMatcher
from ReferenceCatalogProvider import refcat2
from wcsfitsdatabase import wcsfitdatabase
__author__ = '<EMAIL>'
log = logging.getLogger(_... |
# 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 math
import numpy as np
import trimesh
# color palette for nyu40 labels
def create_color_palette():
return [
(0, 0, 0),
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# rest framework
from rest_framework import routers, filters
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.viewsets import ModelViewSet
# django
from django.contrib.auth.models import User
from django.urls import... |
#script for generating report and SSheet for exome
#1.0 == 0.4 W/O TEMP LOCAL READ-INS
__author__ = '<NAME>'
import csv
import os
import sys
import glob
import datetime
import argparse
import subprocess
from string import Template
parser = argparse.ArgumentParser()
parser.add_argument('-nod', help='Turn off directo... |
# Copyright (c) 2020-2022 GUARD
# author: <NAME> <<EMAIL>>
from copy import deepcopy
from time import sleep
from typing import Callable, Optional
from lib.http import HTTPMethod
from lib.response import (ContentResponse, CreatedResponse, NoContentResponse,
NotFoundResponse, NotModifiedRespon... |
#!/usr/bin/env python3
import json
import pdb
import csv
from collections import OrderedDict
import os.path
from pathlib import Path
from datetime import datetime
import re
import pandas as pd
import sys
import settings
import scrape_schedule
def CalcPercent(total, skip, correct):
try:
return round(corr... |
#!/usr/bin/env python3
#
# tconf.py
r"""
The :rst:dir:`tconf` directive and role for configuration fields in ``pyproject.toml`` etc.
"""
#
# Copyright © 2020-2021 <NAME> <<EMAIL>>
#
# Based on https://github.com/readthedocs/sphinx_rtd_theme/blob/master/docs/conf.py
# Copyright (c) 2013-2018 <NAME>, Read the Docs, I... |
import numpy as np
import pytest
from ndcube.tests.helpers import assert_cubes_equal
from ndcube.utils.wcs import WCS
import astropy.units as u
from astropy.time import Time, TimeDelta
from sunraster import SpectrogramCube
import sunraster.spectrogram
# Define a sample wcs object
H0 = {
'CTYPE1': 'WAVE ', 'C... |
'''
this is EMU^r (recursive computation of expected marginal utility) algorithm of Bhattacharjee et.al
REFERENCES:
<NAME>., <NAME>., <NAME>., <NAME>.: Bridging the gap: Manyobjective optimization and informed decision-making. IEEE Trans. Evolutionary
Computation 21(5), 813{820 (2017)
'''
import numpy as np
impor... |
"""
some networks
"""
import torch.nn as nn
import torch.nn.functional as F
import torch
# TODO better network(cnn and lstm)
class vggish_bn(nn.Module):
def __init__(self, classify=False):
super(vggish_bn, self).__init__()
self.classify = classify
# convolution block 1
self.conv... |
#----------------------------
# Author: <NAME>
#----------------------------
from collections import namedtuple
import numpy as np
import math
FILE_TYPE = "P2" # to verify the file type
PGMFile = namedtuple('PGMFile', ['max_shade', 'data']) # named tuple
# This function receives the name of a file, reads it in, v... |
# 集成攻击 general detection coco
import sys
sys.path.append('/home/huanghao/hhattack/yolov4/eval_code')
sys.path.append('/home/huanghao/hhattack/mmdetection')
import os
from argparse import ArgumentParser
import torch
from torchvision import transforms
from PIL import Image, ImageDraw,ImageFont
from PIL import ImageFil... |
# Copyright (c) 2020 Spanish National Research Council
#
# 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 ... |
'''
Max-Planck-Gesellschaft zur Foerderung der Wissenschaften e.V. (MPG) is holder of all proprietary rights on this computer program.
Using this computer program means that you agree to the terms in the LICENSE file (https://flame.is.tue.mpg.de/modellicense) included
with the FLAME model. Any use not explicitly gran... |
import re
import bokeh.plotting as plotting
from bokeh.models import Legend, ColumnDataSource, HoverTool, Div
import bokeh.transform as transform
import bokeh.layouts as layouts
import pandas as pd
def create_source(data):
"""
Create a Bokeh ColumnDataSource from an Astropy Table containing results from
... |
import torch
from torch import nn
import numpy as np
import pytorch_lightning as pl
from .interpolations import TrilinearInterpolation
from .utils import *
class DirectVolumeRendering(nn.Module):
def __init__(self,
n_ray_samples,
feature_img_resolution,
depth_ran... |
import argparse
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import scipy as sp
import scipy.stats
import pyemma
from pyemma.util.contexts import settings
import MDAnalysis as mda
# My own functions
from pensa import *
def workflow_torsions_jsd(args, feat_a, feat_b, data_a, data_b, to... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib.sites.models import get_current_site
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from django.shortcuts import get_object_or_404
from django.utils import timezone
from ... |
import csv
import cv2
import numpy as np
import math
import tensorflow as tf
import time
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
from keras.preprocessing.image import ImageDataGenerator
from keras import regularizers
from keras.models import Sequential
from keras.layers i... |
import os
import time
import sqlalchemy
import numpy as np
import pandas as pd
import datetime as dt
# Used to record elapsed time
start_time = time.time()
# Define unit constants
CUBE_IN_PER_GALLON = 231
CUBE_IN_PER_CUBIC_FT = 1728
# The default length of time between 'prior_date' and 'current_date' if incomplete d... |
from ast import literal_eval
import json
import requests
import csv
from io import StringIO
from flask import Flask, request, jsonify, Response
import psycopg2
from numpy import transpose, array
from bm25 import BM25L
from preprocessing import preprocess
SELECT_CORPUS_FIELDS = "SELECT code, name, txt_ementa FROM corp... |
import os
import cv2
import copy
import shutil
import numpy as np
import torch
import torch.nn as nn
from torch.utils.data import DataLoader, Dataset
from torchvision import transforms
from sklearn.metrics import roc_auc_score
from models.scse import SCSEUnet
gpu_ids = '0, 1'
os.environ['CUDA_VISIBLE_DEVICES'] = gpu_i... |
import pandas as pd
import numpy as np
import os
import glob
from datetime import datetime, timedelta
import gzip
import time
import pkg_resources
import logging
from joblib import Parallel, delayed
from tempset.logger import Logger
class AggregateOutput(Logger):
def __init__(self,
... |
#!/usr/bin/env python3
__author__ = '<NAME>'
import ccxt
import time
import math
import argparse
import signal
import sys
import os
import re
import sqlite3
#import ccxt.async_support as ccxt
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
from sqlalchemy import create_engin... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import argparse
import collections
import csv
import json
import sys
import numpy as np
EXISTING = 'existing'
OCCURRENCE = 'occurrence'
EXISTING_PERCENTAGE = 'existing_percentage'
NOTEXISTING_PERCENTAGE = 'notexisting_percentage'
NOTEXISTING = 'notexisting'
UNIQUE = 'unique... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class FocalLoss_Ori(nn.Module):
"""
This is a implementation of Focal Loss with smooth label cross entropy supported which is proposed in
'Focal Loss for Dense Object Detection. (https://arxiv.org/abs/1708.02002)'
Focal_Loss= -1*al... |
import numpy as np
import pandas as pd
import RecSysALS
import RecSysKNN
import RecSysNMF
from RecSysExampleData20Items import RecSysExampleData20Items
class ArticleAntidoteData():
def __init__(self, n_users, n_movies, top_users, top_movies, l, theta, k):
self.n_users = n_users
self.n_movi... |
from substrateinterface import Keypair
from substrateinterface import SubstrateInterface
from pathlib import Path
from brownie import *
import base58
from hashlib import blake2b
import json
import yaml
from pathlib import Path
from colorama import Fore, Back, Style, init
import os
init(autoreset=True)
NETWORK=os.get... |
import random
import time
import Classes
from seleniumwire import webdriver, request as selenium_request
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
import json
# ------------- Constants -----------------
CHECK_STRING = "Check"
CHANGING_SIGN = "X1Y"
WAITING_TIME = 10
TEXT_TYPES = ["t... |
""" Plugin for Russian Roulette
Commands:
roulette
hotpotato
"""
import asyncio
import random
from datetime import datetime
from difflib import SequenceMatcher
from random import randint, choice
from threading import Timer
import discord
import bot
import plugins
client = plugins.client # type: bot.Client... |
import math
import quaternion
import numpy as np
from plyfile import PlyData, PlyElement
def write_ply(points, filename, text=True):
""" input: Nx3, write points to filename as PLY format. """
points = [(points[i,0], points[i,1], points[i,2]) for i in range(points.shape[0])]
vertex = np.array(points, dtyp... |
"""Pi-kalman"""
import numpy as np
from typing import Tuple
class LinearGaussianStateSpaceModel(object):
""" Minimal implementation of a linear gaussian (LG) state space model (SSM)
A (stationary) linear gaussian state space model is defined as:
z' = A * z + B * U + 𝛆 (transition model)
y' = C... |
from collections import deque
import time
from bluetooth import BLE
import machine
from micropython import const, schedule
_IRQ_CENTRAL_CONNECT = const(1 << 0)
_IRQ_CENTRAL_DISCONNECT = const(1 << 1)
_IRQ_GATTS_WRITE = const(1 << 2)
_IRQ_GATTS_READ_REQUEST = const(1 << 3)
_IRQ_SCAN_RESULT = const(1 << 4)
_IRQ_SCAN_CO... |
import tensorflow as tf
from TeLL.activations import selu
from TeLL.config import Config
from TeLL.initializations import weight_xavier_conv2d, scaled_elu_initialization
from TeLL.layers import DenseLayer, ConvLayer, MaxPoolingLayer, DropoutLayer, ConcatLayer, \
AvgPoolingLayer
class DeepLoc(object):
def __i... |
# Third-Party
from dry_rest_permissions.generics import DRYPermissionsField
from rest_framework_json_api import serializers
from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from django.core.validators import URLValidator
from django.core.validators import validate_email... |
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from re import search
from os import geteuid,popen
from subprocess import Popen,PIPE
import subprocess
import random
class frm_mac_changer(QMainWindow):
def __init__(self, parent=None):
super(frm_mac_changer, self).__init__(parent)
self.form_widge... |
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 24 20:47:24 2019
@author: elif.ayvali
"""
import pandas as pd
import numpy as np
import matplotlib.collections as mc
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
from matplotlib.patches import Rectangle
def create_uniform_grid(low, high, bins=(1... |
import numpy as np
import torch
import glob
import os
import pickle
import argparse
from torch.utils.data import DataLoader
from torch.utils.data.dataset import (TensorDataset,
ConcatDataset)
from i2i.cyclegan import CycleGAN
from util import (convert_to_rgb,
H5Da... |
import pandas as pd
from os import path
from .common import *
from .time_utility import *
# Tushare access limit, as fetch times per minute.
# If fetch data from tushare gets error message like: "抱歉,您每分钟最多访问该接口x次"
# Fill the x to the corresponding entry of this table
# This config is for 5000 scores. The number in c... |
from collections import deque, OrderedDict
from django.conf import settings
from elasticsearch_dsl import Document, Date, Integer, Keyword, Text, Search, Index, Boolean, Completion, \
SearchAsYouType, normalizer, analyzer
from elasticsearch_dsl.connections import connections
from tqdm import tqdm
from elasticsearc... |
"""
drift/continuous.py
===================
GSadjust code for calculating continuous-model drift correction.
--------------------------------------------------------------------------------
This software is preliminary, provisional, and is subject to revision. It is
being provided to meet the need for timely best sci... |
import argparse
import os
import abc
import time
import common.evalutation.eval as ev
import rechun.eval.analysis as analysis
import rechun.eval.hook as hooks
import rechun.eval.evaldata as evdata
import rechun.directories as dirs
def main(dataset, to_eval, action_names):
if dataset not in ('brats', 'isic'):
... |
#
# laaso/command.py
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#
'''
Implement the Command class which handles @command decorators.
'''
import functools
import inspect
import logging
import pprint
import sys
import laaso.output
from laaso.util import expand_item_pf... |
#!/usr/bin/env python
#########
# Copyright (c) 2016 GigaSpaces Technologies Ltd. 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/... |
from typing import List
from symengine.lib.symengine_wrapper import sympy2symengine, Expr, Symbol, One, Zero
from sympy import Rational, linsolve, Poly, re, ComplexRootOf, N, symbols, Piecewise, LessThan
def float_to_rational(expr: Expr):
return sympy2symengine(Rational(str(expr)))
def get_all_roots(poly: Poly... |
from __future__ import annotations
import math
import random as py_random
import sys
from typing import TYPE_CHECKING, Tuple
from pyrevolve.custom_logging.logger import logger
from pyrevolve.revolve_bot.revolve_module import Orientation
from pyrevolve.SDF.math import Vector3
from pyrevolve.tol.manage import measures
... |
# /test/autoderef_list.py
#
# Utility helpers to generate situations where variables might be automatically
# dereferenced.
#
# See /LICENCE.md for Copyright information
"""Generate situations where variables are automatically dereferenced."""
from collections import namedtuple
_AutoderefVariable = namedtuple("_Autod... |
import numpy as np
from wtm_envs.mujoco import robot_env, utils
import mujoco_py
from queue import deque
from mujoco_py import modder
import matplotlib.pyplot as plt
from matplotlib.backends.backend_agg import FigureCanvasAgg
import platform
import os
def goal_distance(goal_a, goal_b):
assert goal_a.shape == goal_... |
"""
Genome, genetic map and demographic model definitions for humans.
"""
import msprime
import stdpopsim
###########################################################
#
# Genome definition
#
###########################################################
# List of chromosomes. Data for length information based on DM6,
#... |
from __future__ import absolute_import, division, print_function
import sys
from blaze.expr.arithmetic import (scalar_coerce, Mult, Add, dshape)
from blaze.expr.math import sin, cos, isnan, exp, log
from blaze.expr import symbol, eval_str, exprify
from blaze.compatibility import xfail, basestring, raises
from datetim... |
import os, gzip, pickle, numpy as np
from variational import mean_field_vso, marginal_approx, get_semfunc
from __config__.filepath import AUX_DIR
def get_scoring_fn(pred_wei, pred_bias, C, meanfield_vecs):
"""
Get a scoring function for the relpron dataset
:param pred_wei: weights of semantic functions
... |
import datetime
import logging
import os
import sys
from time import time as t
import pandas as pd
from core.database import Database
import core.settings as ss
log = logging.getLogger(__name__)
class GetAssets:
def __init__(self,
source: str = '',
forced: bool = False):
... |
from __future__ import print_function
import sys
import torch
import torch.optim as optim
import numpy as np
from torchvision import datasets, transforms
from absl import app
from absl import flags
import copy
import torch.nn.functional as F
from load_data import MNIST_data, Covertype_data
from model import ConvNet... |
import json
import requests
import os
import mutation_type as mut
import logging
import re
import copy
import gene_enricher
def _enrich_ensemble(feature, transcript_id, exon, provenance_rule):
""" get coordinates from ensembl
curl -s 'http://grch37.rest.ensembl.org/lookup/id/ENST00000275493?expand=1'
... |
"""
Dogstatsd tasks
"""
from __future__ import print_function, absolute_import
import os
import sys
import shutil
from distutils.dir_util import copy_tree
import invoke
from invoke import task
from invoke.exceptions import Exit
from .build_tags import get_build_tags, get_default_build_tags
from .utils import get_bui... |
# Copyright 2017 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... |
#IMPORTING REQUIRED MODULES
import mysql.connector
import datetime
import pyautogui
#CONNECTING TO DB AND CREATING CURSOR OBJECT
mycon = mysql.connector.connect(user='root',passwd='',host='localhost',database='hotel_management')
cursor = mycon.cursor()
#DEFINING GLOBAL VARIABLES NEEDED
global action
global... |
"""
Download spreadsheets from Google Drive and save each worksheet as a TSV
(tab separated values) file.
See the README in amf-check-writer for details.
"""
import os
import sys
import time
import argparse
from pathlib import Path
import httplib2
from pygdrive3 import service
from apiclient import discovery
from ap... |
"""Script to compare the sensitivity and discovery potential for the LLAGN sample (15887 sources)
as a function of injected spectral index for energy decades between 100 GeV and 10 PeV.
"""
from __future__ import print_function
from __future__ import division
import numpy as np
from flarestack.core.results import Resul... |
#!/usr/bin/env python
# Copyright 2015, The Android Open Source Project
#
# 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 ... |
# Copyright (C) 2021, Mindee.
# This program is licensed under the Apache License version 2.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0.txt> for full license details.
# Credits: post-processing adapted from https://github.com/xuannianz/DifferentiableBinarization
from copy import deepcopy
fro... |
import argparse
import os
import sys
from glob import glob
from os.path import basename, join, splitext
import librosa
import numpy as np
import pysinsy
import soundfile as sf
from nnmnkwii.io import hts
from nnsvs.io.hts import get_note_indices
def _is_silence(label):
is_full_context = "@" in label
if is_fu... |
"""Support for the definition of zones."""
from __future__ import annotations
import logging
from typing import Any, cast
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import (
ATTR_EDITABLE,
ATTR_LATITUDE,
ATTR_LONGITUDE,
CONF_ICON,
CONF_ID,
CONF_... |
from __future__ import division, print_function, absolute_import
import numpy as np
from scipy.sparse.sputils import isshape, isintlike
from scipy.sparse import isspmatrix
__all__ = ['LinearOperator', 'aslinearoperator']
class LinearOperator(object):
"""Common interface for performing matrix vector products
... |
from heapq import heappush
from heapq import heappop
from enum import IntEnum
from enum import unique
from abc import ABC
from abc import abstractmethod
from math import nan
from math import inf
__author__ = "<NAME>"
@unique
class Priority(IntEnum):
LOWEST = 1E10
LOWER = 1000
LOW = 100
DEFAULT = 0
... |
# Software License Agreement (BSD License)
#
# Copyright (c) 2011, <NAME>, Inc.
# Copyright (c) 2016, <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:
#
# * Redistributions of source cod... |
#!/usr/bin/env python
"""
TODO:
# Author:
# Created Time :
# File Name:
# Description:
"""
import numpy as np
import scipy.sparse as sp
import random
import inspect
try:
import tensorflow as tf
except ImportError:
raise ImportError('DeepLinc requires TensorFlow. Please follow instructions'
... |
"""
Module that contains many useful utilities
for validating data or function arguments
"""
from typing import Iterable, Union
import warnings
import numpy as np
from my_happy_pandas.core.dtypes.common import is_bool
def _check_arg_length(fname, args, max_fname_arg_count, compat_args):
"""
Checks whether '... |
import os
import json
import random
import numpy as np
import tensorflow as tf
from dataset import DataProcessor, get_dataset
class BeerProcessor(DataProcessor):
"""
Processor for the Beer dataset.
"""
def get_train_examples(self, data_dir):
return self._create_examples(
self._re... |
import base64
import binascii
import math
import os
import uuid
from itertools import chain
from typing import Any, Dict, Mapping, Optional, Sized
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation import gettext_lazy as _
from typing_extensions import Final
... |
#!/usr/bin/python
def scheduler(dummy,state):
import time
import sys
import schedule
from datetime import datetime
sys.stdout = open("scheduler.log", "a")
sys.stderr = open("scheduler.err.log", "a")
with open("scheduler.log", "a") as fsch:
print("Starting scheduler thread ...", file=fsch)
last... |
import copy
import json
import base64
from operator import itemgetter
from bson import json_util
import api_modules.utils
import utils.s3_utils
import utils.redis_utils
def _is_config_malformed(config_json_input):
config_json = copy.deepcopy(config_json_input)
if not "config_name" in config_js... |
import inspect
from contextlib import contextmanager
from threading import RLock
from decorator import decorator
from .compat import with_metaclass, iteritems
__all__ = [
"ValidationError", "SchemaError", "Validator", "accepts", "returns", "adapts",
"parse", "parsing", "register", "register_factory",
"set_... |
""" PyTorch EfficientDet support benches
Hacked together by <NAME>
"""
from typing import Optional, Dict, List
import torch
import torch.nn as nn
from .anchors import Anchors, AnchorLabeler, generate_detections
from .loss import DetectionLoss
def _post_process(
cls_outputs: List[torch.Tensor],
box_ou... |
from django.db import models, router
from django.db.models import F, Value, signals
from django.db.models.functions import Coalesce
from django.utils.encoding import python_2_unicode_compatible
from django.utils.functional import cached_property
from django.utils.timezone import now
from django.utils.translation import... |
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# 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
... |
#!/usr/bin/env python
#
# 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
# ... |
# Copyright 2018 The TensorFlow Probability 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 o... |
"""Utility functions for conversion between color models."""
__all__ = [
"color_to_rgb",
"color_to_rgba",
"rgb_to_color",
"rgba_to_color",
"rgb_to_hex",
"hex_to_rgb",
"invert_color",
"color_to_int_rgb",
"color_to_int_rgba",
"color_gradient",
"interpolate_color",
"average... |
# vimspector - A multi-language debugging system for Vim
# Copyright 2018 <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 re... |
""" show_fdb.py
supported commands:
* show mac address-table vni <WORD> | grep <WORD>
* show mac address-table local vni <WORD>
* show mac address-table
* show mac address-table aging-time
* show mac address-table limit
* show system internal l2fwder mac
* sho... |
#
# Copyright (C) 2014-2016 UAVCAN Development Team <dronecan.org>
#
# This software is distributed under the terms of the MIT License.
#
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
from __future__ import division, absolute_import, print_function, unicode_literals
import decimal
class SourceTimeResolve... |
from collections import defaultdict
import os
from biicode.common.settings.version import Version
'''
Module to create the cmake lines with the info of the boards.
It return the string that it is needed to compile and upload correctly the scketch to the Arduino.
This module is used always that biicode biicode create ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.