text stringlengths 3.07k 12.6k |
|---|
#DeepForest bird detection from extracted Zooniverse predictions
from pytorch_lightning.loggers import CometLogger
from deepforest.callbacks import images_callback
from deepforest import visualize
from deepforest import main
import traceback
import geopandas as gp
from shapely.geometry import Point, box
import pandas a... |
"""
MIT License
Copyright (c) 2021 STR-Coding-Club
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, publis... |
"""
Copyright 2018, <NAME>, Stevens Institute of Technology
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 ... |
from .submodule import *
class OneAggregation(nn.Module):
def __init__(self, maxdisp, num_blocks):
super(OneAggregation, self).__init__()
self.maxdisp = maxdisp
self.num_blocks = num_blocks
num_candidates = 2 * maxdisp + 1
OneBranch = nn.ModuleList()
for... |
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
"""Unit tests for the pgmock.render module"""
import datetime as dt
import pytest
import pytest_pgsql
import pgmock.exceptions
import pgmock.render
@pytest.mark.parametrize('rows, expected', [
([(1, '1', 1.1)], "VALUES (1,'1',1.1)"),
([(dt.datetime(2017, 6, 1, 12),)], "VALUES ('2017-06-01T12:00:00'::TIMESTA... |
# import numpy as np
import fun_provider as provider
# load common librarys
import numpy as np
import networkx as nx
from scipy.spatial.distance import pdist,squareform
from sklearn.cluster import KMeans
import time
import h5py
# load GPGL functions
from fun_GPGL import graph_cut,fun_GPGL_layout_push
#%% global set... |
# coding=utf-8
# Copyright 2021 The Trax 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 a... |
import os, sys, time
from basic.constant import ROOT_PATH
from basic.common import checkToSkip, printStatus, writeRankingResults
from basic.util import readImageSet
from util.simpleknn.bigfile import BigFile
from util.simpleknn import simpleknn as imagesearch
DEFAULT_K=1500
DEFAULT_DISTANCE = 'l2'
DEF... |
import os
import unittest
import unittest.mock
import webtest
import ota
app = webtest.TestApp(ota.web)
class TestServer(unittest.TestCase):
def test_root(self):
resp = app.get('/', expect_errors=True)
assert resp.status_int == 404
class TestOTAUpdate(unittest.TestCase):
def setUp(self... |
# Copyright 2020-2022 OpenDR European 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 by applicable law or agree... |
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (c) Sandflow Consulting LLC
#
# 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
#... |
# Author : <EMAIL>
# Date : 2020-12-03
import pandas as pd
import os
import copy, shutil
import torch
import torch.nn.functional as F
from torch.optim import lr_scheduler
import torch.optim as optim
import torch.nn as nn
from collections import defaultdict
# ref : https://github.com/kakaobrain/fast-a... |
from rdkit import Chem
from rdkit.Chem import AllChem, Descriptors
import numpy as np
from rdkit.ML.Descriptors import MoleculeDescriptors
from sklearn import preprocessing
import random
from hyperopt import tpe, fmin, Trials
from sklearn.metrics import average_precision_score, roc_auc_score
from sklearn.model_selectio... |
import numpy as np
import pygame
import sys
import os
from collisionutils import *
from colors import *
from utilutils import *
from chassis import AutoPathFollower, RobotDrive
import initObstacles
os.chdir(os.path.dirname(os.path.realpath(__file__)))
size = (1340, 684)
def allDisplay(obstacles, screen):
display... |
import os
import sys
import _pickle as pickle
import numpy as np
import tensorflow as tf
import chess.pgn
import pgn_tensors_utils
import bz2
def read_data(data_path, num_valids=20000):
print("-" * 80)
print("Reading data")
nb_games = 200
#nb_games = sys.maxsize
boards, labels, results = {}, {}, {}
train... |
'''
@Author: <NAME>
@Github: https://github.com/wsustcid
@Version: 1.0.0
@Date: 2020-09-11 23:42:23
@LastEditTime: 2020-10-13 22:32:20
'''
import os
import sys
import argparse
from datetime import datetime
import time
from tqdm import tqdm
import time
import numpy as np
import tensorflow as tf
base_dir = os.path.dir... |
import typing
import os
from nubia import command, context
from nubia.internal.commands.help import HelpCommand
from nubia.internal.cmdbase import Command
from prompt_toolkit.completion import Completion
from termcolor import cprint, colored
from suzieq.cli.nubia_patch import argument
from suzieq.shared.utils import S... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... |
import math
import torch
from torch.nn.parameter import Parameter
import torch.nn as nn
import torch.nn.functional as F
###########################################
# FORWARD PROPAGATION NEURAL NET LAYERS ###
###########################################
class MLP(nn.Module):
def __init__(self, n_feature, n_hidden:... |
import typing
import numpy as np
import pytest
from ebonite.core.objects import Model, ModelWrapper
from ebonite.core.objects.artifacts import Blobs
from ebonite.core.objects.core import EvaluationResults
from ebonite.core.objects.metric import Metric
from ebonite.core.objects.wrapper import PickleModelIO
class Eva... |
# Copyright (c) 2018 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 appl... |
import os
import numpy as np
import yaml
from typing import Dict, TYPE_CHECKING, List, Tuple
def parse_options(param):
# function to parse read parameters, sets "None" to None and "[]" to []
for key in list(param.__annotations__.keys()):
if param.__getattribute__(key) == "None":
param._... |
#!/usr/bin/env python3
import string
from os.path import expanduser
import argparse
import mpd
import notify2
import toml
# Convert floating point strings to HH:MM:SS time
def format_time(seconds):
try:
secs = float(seconds)
except:
# Not valid time
return ""
# Clamp the numbers ... |
# coding=utf-8
# Copyright 2022 The Uncertainty Baselines 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 ap... |
"""Logging module."""
from typing import Optional
import logging
from logging import INFO, DEBUG, ERROR, WARNING, CRITICAL
from datetime import datetime, timezone, timedelta
from functools import partial, update_wrapper
HINT = (INFO + DEBUG) // 2
logging.addLevelName(HINT, "HINT")
class _RootLogger(logging.RootLog... |
# -*- coding: utf-8 -*-
from ..base import np,sp
from ..base import BaseEstimator,TransformerMixin
from ..utils import tqdm_cs
import matplotlib.pyplot as plt
class FPSFilter(BaseEstimator,TransformerMixin):
def __init__(self,Nselect,kernel,act_on='sample',precompute_kernel=True,disable_pbar=True):
self.N... |
import random
import matplotlib.pyplot as plt
from matplotlib import animation
import numpy as np
print("Welcome to Polarization Model Simulator")
tutorialMode = input("Do you want to use in tutorial mode? (y/n): ")
while tutorialMode != 'y' and tutorialMode != 'n':
tutorialMode = input("Please input y/... |
# Thanks Sandy
# Recode By Apis
from userbot import CMD_HELP
from userbot.events import register
from userbot.utils import edit_delete, edit_or_reply
from userbot.modules.sql_helper.echo_sql import (
addecho,
get_all_echos,
get_echos,
is_echo,
remove_all_echos,
remove_echo,
remove_echos,
)... |
import abc
import torch
from torch.utils.tensorboard import SummaryWriter
import os
import sys
import gym
from shutil import copyfile
from easydict import EasyDict as edict
from self_supervised.utils.writer import MyWriterWithActivation, MyWriter
from mode_disent_no_ssm.utils.parse_args import yaml_save, json_save
f... |
from __future__ import annotations
import math
import re
from datetime import timedelta
from discord.ext import commands
class InvalidTimeDuration(commands.BadArgument):
"""
A conversion error for an invalid input passed to :class:`voxelbotutils.TimeValue`.
Attributes:
value (str): The value th... |
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cross_decomposition import CCA
from sklearn.metrics import confusion_matrix
import functools
def find_correlation_cca_method1(signal, reference_signals, n_components=2):
r"""
Perform canonical correlation analysis (CCA)
Reference: https://git... |
"""
ver 1.0.5. - 20220322
============================================================
업데이트 내역
------------------------------------------------------------
ver. 1.0.5. 자소검색 와일드카드 문자(*) 오류 수정
ver. 1.0.4. 에러 핸들링: QMessageBox 20220322
ver. 1.0.3. 판다스 데이터프레임을 딕셔너리로 변환 20220322
ver. 1.0.2. 자소검색 기능 추가 ... |
# -*- coding: utf-8 -*-
"""
@author: <NAME> <<EMAIL>>
"""
import torch.nn as nn
from torch.nn.init import kaiming_normal_
class ConvBlock(nn.Module):
def __init__(self, input_dim=128, n_filters=256, kernel_size=3, padding=1, stride=1, shortcut=False,
downsampling=None):
super(ConvBlock, ... |
from pathlib import Path
from astropy.io import fits
import numpy as np
import pickle
#calibration io
def save_image(data, imname):
hdu = fits.PrimaryHDU(data)
hdu.writeto(imname, overwrite = True)
return None
def load_calib_img(calib_dir, img_number, style = 'wirc', img_type = ''):
fname = get_img_name(calib_di... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 28 10:38:56 2019
@author: juangabriel
"""
# Redes Neuronales Artificiales
# Instalar Theano
# pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git
# Instalar Tensorflow y Keras
# conda install -c conda-forge keras
# Parte 1 - P... |
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 17 14:52:28 2019
@author: Carlos
"""
import os
import sys
from pathlib import Path
import numpy as np
import datetime
def query_yes_no(question, default="yes"):
'''
Ask a yes/no question via raw_input() and return their answer.
:param quest... |
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
"""
Unit tests for kernel operations, tested for the forward and the backward pass
... |
from flask import Flask, request, make_response
from flask_cors import CORS
import json
import src.api as oa
import src.model as om
import src.heat as oh
import tensorflow as tf
from tensorflow.python.keras.backend import set_session
app = Flask(__name__)
cors = CORS(app, resources={
r"/login/*": {"origin": "*"},
... |
'''
It is for loading price in backtest or live mode.
'''
import pandas as pd
import sys
import os
sys.path.append(os.path.join(os.getcwd().split('xtraderbacktest')[0],'xtraderbacktest') )
import modules.other.sys_conf_loader as sys_conf_loader
import modules.other.logg
import logging
'''
Load price.
symbol = symbol... |
""" This is a simple python script for updating the
DNS Custom Records in Dreamhost Nameservers using
Dreamhost API commands.
Provided under the MIT License (MIT). See LICENSE for details.
"""
import sys
# import syslog
import http.client
import re
import ssl
import uuid
import logging
import soc... |
import torch
import matplotlib
matplotlib.use('agg')
from utils import spatial_transform
rbox = torch.zeros(3, 21, 21)
rbox[0, :2, :] = 1
rbox[0, -2:, :] = 1
rbox[0, :, :2] = 1
rbox[0, :, -2:] = 1
rbox = rbox.view(1, 3, 21, 21)
gbox = torch.zeros(3, 21, 21)
gbox[1, :2, :] = 1
gbox[1, -2:, :] = 1
gbox[1, :, :2] = 1
g... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
''' Tools shared by the module.
'''
# General imports
import numpy as np
from pathlib import Path
import logging
# Import from project files
from .. import tools # import namespace
from .. tools import * # import to overwrite
from . import sim_parameters
# ... |
import nanome
from nanome.util import Logs
import sys
import time
import random
import struct
import math
from nanome.api.structure import *
from nanome.util import Vector3, Quaternion, Matrix
# Config
NAME = "ControllerTracking"
DESCRIPTION = "A plugin to demonstrate and test controller tracking."
CATEGORY = "User Tr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017, <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 code must retain the above copyright
... |
import sys
import numpy as np
import tensorflow as tf
from tensorflow.python.training import training_util
from .. import evaluator, metrics
from ..configuration import *
from .doc2vec_train_doc_prediction import doc2vec_prediction_model
from .doc2vec_train_doc_prediction import DocPredictionDataset
class DocPredicti... |
# Copyright (c) OpenMMLab. All rights reserved.
import copy
import numpy as np
import pytest
import torch
import torch.nn as nn
from mmcv.parallel import MMDistributedDataParallel
from mmcv.runner import EpochBasedRunner, build_optimizer
from mmcv.utils import get_logger
from torch.utils.data import DataLoader, Datase... |
import pandas as pd
import networkx as nx
import numpy as np
import scipy.sparse as sp
import torch
from sklearn.metrics import accuracy_score, f1_score
graph_name = "ppi"
def build_dataframe(input_data: pd.DataFrame, col_name: str, preserve_int_col_name=False) -> pd.DataFrame:
"""
Given an input DataFra... |
"""
For saving and loading checkpoints.
"""
import os
import time
from operator import itemgetter
import torch
_WITH_STATE = ["models", "optimizer"]
def save_ckpt(itr, logger, device, data, save_dir=None, ckpt_path=None, overwrite=True,
most_recent=None, save_best=None, tst_accs=None, prefix=""):
... |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
'''
#+DESCRITION: online segmentation
#+FROM: github.com/durant35/SqueezeSeg
#+DATE: 2018-08-08-Wed
#+AUTHOR: <NAME> (<EMAIL>)
'''
import sys
import os.path
import numpy as np
from PIL import Image
import tensorflow as tf
import rospy
from sen... |
"""Message passing for robocluster."""
import asyncio
import hashlib
import threading
from collections import defaultdict
from contextlib import suppress
from fnmatch import fnmatch
from functools import wraps
from .looper import Looper
from .member import Member
from .util import duration_to_seconds, as_coroutine
c... |
#!/usr/bin/python3.3
import tkinter as tk
from tkinter import *
from random import randint
from math import *
__author__ = "<NAME>"
__copyright__ ="Copyright (C) 2013 <NAME>"
__license__ = "GPL v3+"
#Here we add methods to the tkinter library to handle circles and circle arcs.
def _create_circle(self, x, y, r, **kwa... |
"""ClipTools clipboard manager and text processing tools
with a lines based GUI interface
Definition of data structures used to store text and action data
"""
from functools import wraps
from .. import config
from . import utils
class BaseData:
"""Base of all data storage structure"""
def __init__(self, ... |
import numpy as np
__author__ = "<NAME>"
__copyright__ = "Copyright 2020"
class EKF:
"""Creates a N-dimensional Kalman filter.
Parameters
----------
x_init : numpy.ndarray, optional
Initial state vector: What we know about the (probable) start state.
P_init : numpy.ndarray, optional
... |
from hw2skeleton import cluster as cl
from hw2skeleton import io
import os
import pandas as pd
import numpy as np
from hw2skeleton.utils import *
import sklearn.metrics as sk
aa3 = "ALA CYS ASP GLU PHE GLY HIS ILE LYS LEU MET ASN PRO GLN ARG SER THR VAL TRP TYR".split()
aa_df = pd.DataFrame(0, index=list(aa3), columns=... |
# 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 re
import sys
from pathlib import Path
from typing import List
import humanize
import pandas as pd
from llvm_rl.model import Model
from... |
#!/usr/bin/python3
"""Defines unittests for models/city.py.
Unittest classes:
TestCity_instantiation
TestCity_save
TestCity_to_dict
"""
import os
import models
import unittest
from datetime import datetime
from models.city import City
class TestCity_instantiation(unittest.TestCase):
"""Unittests for t... |
import click
import json
import logging
import os
import signal
import sys
import time
from os.path import abspath, exists
from datetime import datetime, timedelta
from pyramid.paster import get_app, setup_logging
from tempfile import mkstemp
import configparser
import yaml
from . import supervisor
from .device_di... |
import copy
import json
import SessionState
from itertools import chain, product
import pandas as pd
import streamlit as st
def check_time_collision(course_combo):
schedule = {}
for course_3 in course_combo:
course_times = course_3[1]
for day in course_times:
if day not in schedul... |
import tensorflow as tf
tf.compat.v1.enable_eager_execution()
import numpy as np
import pickle
from prepare_lyft_data_v2 import class2angle, class2size
from model_util import NUM_HEADING_BIN, NUM_SIZE_CLUSTER
from prepare_lyft_data import get_sensor_to_world_transform_matrix_from_sample_data_token, \
convert_box_... |
# Step 1: The StildeD RHS *source* term
import os
from outputC import outputC, outCfunction # NRPy+: Core C code output module
import indexedexp as ixp # NRPy+: Symbolic indexed expression (e.g., tensors, vectors, etc.) support
import GRHD.equations as GRHD # NRPy+: Generate general relativistic hydrodynamic... |
"""
Copyright (C) 2015-2021 Alibaba Group Holding Limited
MicroPython's drive for SI7006
Author: HaaS
Date: 2021/09/09
"""
from driver import I2C
from utime import sleep_ms
# The commands provided by SI7006
Si7006_MEAS_REL_HUMIDITY_MASTER_MODE = 0xE5
Si7006_MEAS_REL_HUMIDITY_NO_MASTER_MODE = 0xF5
... |
from __future__ import print_function
import time
import numpy as np
import numpy.random as rnd
from pymanopt import Problem
from pymanopt.solvers.steepest_descent import SteepestDescent
from pymanopt.solvers.solver import Solver
def compute_centroid(man, x):
"""
Compute the centroid as Karcher mean of poi... |
"""
Classes and functions for representing instructions.
"""
import re
import sys
import logging as log
from .UCInstructionStatement import UCInstructionStatement
class UCInstructionArgument(object):
def __init__(self, src=None):
"""
Create a new instruction argument using a string source.
... |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... |
# -*- coding: utf-8 -*-
from datetime import date
import pytest
from faker import Faker
from faker.providers import BaseProvider
from recipe.utils import (
AttrDict,
FakerAnonymizer,
FakerFormatter,
replace_whitespace_with_space,
generate_faker_seed,
pad_values,
)
uppercase = "ABCDEFGHIJKLMNO... |
import sys
import time
import traceback
import tushare as ts
from PyQt5.QtWidgets import QApplication
import main_ui
import config_ui
import stock_analysis_system
from Utiltity.ui_utility import *
# NOTE: If plugin depends on any lib, please import here. Otherwise the packing program cannot find this lib.
# 注意:如果插件依赖... |
# read all messages from zmq
# and send them to a website using POST
# the website may store and publish them
# also respond to request from Telegram
# telegram.py is listening to Telegram requests and sending responses
# the Telegram functions are used in the main loop
import time
import zmq
import sys
import reque... |
'''Test the figures.metrics.LearnerCourseGrades class
'''
from collections import OrderedDict
import datetime
from django.utils.timezone import utc
import mock
import pytest
from figures.metrics import LearnerCourseGrades
from tests.factories import (
CourseEnrollmentFactory,
GeneratedCertificateFactory,
... |
"""IRC transport implementation."""
import re
import asyncio
import functools
from abc import ABCMeta, abstractmethod
from typing import *
from ..util import LogMixin
from .. import common
from . import response
__all__ = ["ConnectInfo", "ClientProtocol", "Message", "response"]
class User:
"""
An IRC user.... |
"""
This program shows how to:
* Have one or more instruction screens
* Show a 'Game over' text and halt the game
* Allow the user to restart the game
If Python and Arcade are installed, this example can be run from the command line with:
python -m arcade.examples.instruction_and_game_over_screens
"""
import a... |
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from django.views.generic.detail import SingleObjectMixin
from django.views.generic import TemplateView,ListView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.views.generic.detail import... |
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import *
from tensorflow.keras.preprocessing import sequence
from tf2bert.layers import MaskedGlobalMaxPooling1D
from tf2bert.text.tokenizers import Tokenizer
from tf2bert.models import build_transformer
im... |
import random
import math
import time
import numpy as np
import matplotlib.pyplot as plt
DIRECTIONS = [(-1, 0), (0, -1), (1, 0), (0, 1)]
def change_direction(direction, turn):
return (direction + turn) % 4
def is_free(freeMap, square, xCoord, yCoord):
return not (not validCoordinate(square, (xCoord, yCoord... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Dict, List, Set
import beanmachine.ppl.compiler.bmg_nodes as bn
import beanmachine.ppl.compiler.profiler as prof
import ... |
import logging
import threading
from google.appengine.api import datastore
from django.conf import settings
from django.core.cache import cache
from django.core.signals import request_finished, request_started
from django.dispatch import receiver
from djangae.db import utils
from djangae.db.unique_utils import unique... |
import glob
import pathlib
import re
import torch
from torch import nn, optim
from torch.utils.data import (Dataset,
DataLoader,
TensorDataset)
import tqdm
from statistics import mean
remove_marks_regex = re.compile("[,\.\(\)\[\]\*:;]|<.*?>")
shift_marks_reg... |
import json
import logging
import os
from aiohttp import web
from pluralkit import db, utils
from pluralkit.errors import PluralKitError
from pluralkit.member import Member
from pluralkit.system import System
logging.basicConfig(level=logging.INFO, format="[%(asctime)s] [%(name)s] [%(levelname)s] %(message)s")
logge... |
import hashlib
import uuid
import re
from django.utils import timezone
import django_rq
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import models
from django_fsm import FSMField, transition
from creator.jobs.models import JobLog
from creator.utils import stop_job
Us... |
# Copyright 2018 NTT Data.
# 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 app... |
"""
PIN diode attenuator class and calibration methods
"""
import logging
import scipy
import dill as pickle
from Electronics.Interfaces.LabJack import LJTickDAC
from Electronics.Instruments import Attenuator
module_logger = logging.getLogger(__name__)
class PINattenuator(Attenuator):
"""
Voltage-controlled PIN ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from fabric.api import task, run
import re, os
from datetime import datetime
from fabric.api import *
def _now():
return datetime.now().strftime('%Y-%m-%d_%H.%M.%S')
def _pwd():
return os.path.dirname(os.path.abspath(__file__))
@task
def update_db(sqlFile=Non... |
#!/usr/bin/env python3
from Bio import SeqIO
import pandas as pd
from treetime.utils import numeric_date
import argparse
def generate_sequence_block(sequence_list):
sequence_block = ''
for item in sequence_list:
sequence_block += '<sequence id="seq_{0}" spec="Sequence" taxon="{0}" \
totalcount... |
import json
import logging
import os
import shutil
import tempfile
import time
from pathlib import Path
import click
from undmainchain.common import start, stop
from undmainchain.const import get_defaults
from undmainchain.sync import get_height, fetch_genesis, run_shell
log = logging.getLogger(__name__)
SLEEP_TIME... |
import re
import numpy as np
from string import punctuation
# snowball stopwords from http://snowball.tartarus.org/algorithms/english/stop.txt
_STOPWORDS = {'a', 'about', 'above', 'after', 'again', 'against', 'all', 'am', 'an', 'and', 'any', 'are', "aren't", 'as',
'at', 'be', 'because', 'been', 'before',... |
#!/usr/bin/python3.7
# -*- coding: utf-8 -*-
# @Time : 2019/7/28 0:51
# @Author: <EMAIL>
from tensorflow.examples.tutorials.mnist import input_data
from tensorflow.contrib.layers import l2_regularizer
import tensorflow as tf
from PIL import Image
import numpy as np
import os
input_node = 784 # 输入节点
output_node = 10 ... |
import numpy as np
from numpy import array
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from tensorflow.keras.utils import to_categorical
from tensorflow.python.keras.utils.vis_utils import plot_model
from tensorflow.keras.models import Model
from tensorf... |
import random
from math import sqrt
import numpy as np
import pandas as pd
from numpy import mean, var
from scipy.stats import mannwhitneyu, wilcoxon
def mwyu(g1, g2, override_alt=None):
"""Calculate mannwhitneyu test."""
g1_mean = np.mean(g1)
g2_mean = np.mean(g2)
if g1_mean < g2_mean:
altme... |
# Copyright 2019 The FastEstimator 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 appl... |
import os, sys, datetime, glob, inspect, warnings
from typing import List, Dict
with warnings.catch_warnings():
from flask_marshmallow import Marshmallow
from ....models.main import AlphaClass
from ....models.logger import AlphaLogger
from ....libs import io_lib, flask_lib
from ....models.config import AlphaConf... |
from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.autograd import Variable
from CapsuleNet import CapsuleNet, CapsuleLoss
from tqdm import tqdm
def parse_args(... |
"""Inventory Plugin for Nornir designed to work with Nautobot ORM."""
# pylint: disable=unsupported-assignment-operation,unsubscriptable-object,no-member
from typing import Any, Dict
from django.db.models import QuerySet
from django.utils.module_loading import import_string
from nornir.core.inventory import (
Inv... |
import grpc
import json
import logging
import os
import sys
import pickle
import datetime
from urllib import parse
import d3m_automl_rpc.core_pb2 as pb_core
import d3m_automl_rpc.core_pb2_grpc as pb_core_grpc
import d3m_automl_rpc.value_pb2 as pb_value
from d3m_automl_rpc.utils import encode_problem_description, encode... |
import numpy as np
def euler2quaternion(phi1, Phi, phi2, P = 1):
# Input - Euler Angles in Radians, Permutation operator (+- 1)
# Output - Tuple containing quaternion form
SIGMA = 0.5*(phi1 + phi2)
DELTA = 0.5*(phi1 - phi2)
C = np.cos(Phi/2)
S = np.sin(Phi/2)
q0 = C*np.cos(SIGMA)
q1 = ... |
# Copyright 2018 Intel Corporation
#
# 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 wri... |
import os
from typing import Iterable, Union, Tuple, Dict, Any, List
import argparse
import pandas as pd
from tqdm.auto import tqdm
from itertools import groupby, starmap
from experiments.datahandlers.iac.fourforum_labels import AuthorLabel
from experiments.datahandlers.loaders import load_conversations
from experimen... |
import os.path
import os
from dotenv import load_dotenv
import sys
import platform
import urllib
import tarfile
import requests
from zipfile import ZipFile
from config import DOWNLOAD_PATH, VERSION_FILE
from .list import list_remote
""" Download Required kubectl / kustomize / helm / helmfile Versions """
def downloa... |
"""
Script for pre-tagging (POS) the xLiMe twitter corpus and generating the
data for loading by annotweb
"""
import gzip
import json
import argparse
import csv
import random
from pattern import it, es, de
(NOUN, VERB, ADJ, ADV, PRON, DET, PREP, ADP, NUM, CONJ, INTJ, PRT, PUNC, X) =\
("NN", "VB", "JJ", "RB", "PR"... |
from django.contrib import admin
from django.db.models import F, Count
from django.urls import reverse
from django.utils.encoding import force_text
from django.utils.safestring import mark_safe
from .models import WishList, Follow, ProxyOrder
@admin.register(WishList)
class WishListAdmin(admin.ModelAdmin):
list_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.