text stringlengths 3.07k 22.1k |
|---|
from numpy import where
from collections import Counter
from sklearn.datasets import make_blobs
import matplotlib.pyplot as plt
from pandas import read_csv
import pandas as pd
import numpy as np
def RMS(tmp):
return np.sqrt((np.square(tmp[0]))+(np.square(tmp[1]))+(np.square(tmp[2])))
def CalRMS(X,Y,Z):... |
import argparse
import os
import re
import subprocess
from configparser import ConfigParser
def run(command_list):
stdout = ""
out_log = subprocess.run(command_list, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdout = str(out_log.stdout, "utf-8")
# print (stdout)
return stdout
def run_tm_... |
import numpy as np
from scipy.optimize import least_squares
from . import math_tools as mt
import itertools
# import scipy.optimize as opt
def Peak_find_vectors(Peaks, atoll=0.087, toll=0.01):
""" Finds the first or 2 first smallest non colinear vectors
for each peak in an image
Input :
Peaks a... |
from __future__ import annotations
import asyncio
import logging
import ssl
from abc import ABC, abstractmethod
from asyncio import Future, Transport, transports
from json import JSONDecodeError
from typing import TYPE_CHECKING, cast
from cryptography.hazmat.primitives import serialization
from cryptography.x509 impo... |
"""
Clingraph functionality
"""
from ast import parse
import sys
import argparse
import textwrap
import pkg_resources
from .graphviz import compute_graphs, dot, render
from .logger import setup_logger_str, COLORS
from .orm import Factbase
from .utils import write, apply
from .exceptions import InvalidSyntaxJSON, Inval... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class conv_block(nn.Module):
def __init__(self,ch_in,ch_out):
super(conv_block,self).__init__()
self.conv = nn.Sequential(
nn.Conv2d(ch_in, ch_out, kernel_size=3,stride=1,padding=1,bias=True),
nn.BatchNorm2d(... |
from agents.dqn_agent_new import *
from agents.rainbow_agent_new import *
import numpy as np
import itertools
agents = {
'dqn': JaxDQNAgentNew,
'rainbow': JaxRainbowAgentNew,
# 'quantile': JaxQuantileAgentNew,
# 'implicit': JaxImplicitQuantileAgentNew,
}
inits = {
'orthogonal': {
'functio... |
import math
import time
import matplotlib.pyplot as plt
import numpy
from tkinter import filedialog
import utm
from pyproj import Proj, transform
import numpy as np
import pandas as pd
plotting_offset = 30
myProj = Proj(init='epsg:5178', proj='utm', zone=52, datum='WGS84')
# ['1', '7', '42.7', '0', '0.0', 'N', '0', '... |
"""
Copyright (C) 2020 <NAME>
All rights reserved.
This file is part of the pTFrenderer library and is made available under
the terms of the BSD license (see the LICENSE file).
"""
import math
import tensorflow as tf
from . import utils
from . import camera
from . import mesh
_broadcast = utils._broadcast
def rende... |
"""A simple memcache-like server.
The basic data structure maintained is a single in-memory dictionary
mapping string keys to string values, with operations get, set and
delete. (Both keys and values may contain Unicode.)
This is a TCP server listening on port 54321. There is no
authentication.
Requests provide an op... |
import smbus2
import bme280
import gpsd
from timezonefinder import TimezoneFinder
from tsl2561 import TSL2561
import RPi.GPIO as GPIO
import LIS3DH
from ina260.controller import Controller
from datetime import datetime
import time
from sms_sender import send_sms
from system_status import system_state
import global_vars... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import gzip
import io
import logging
import os
from zipfile import ZipFile
import numpy as np
import six
from keras.utils.data_utils import get_file
logger = logging.getLogger(__name__)
_EMBEDDINGS_CACHE = dict()
# Add more types here ... |
"""
Parse STREC output and create/select a GMPE set for an event.
"""
# stdlib imports
import os.path
import pprint
import shutil
from collections import OrderedDict
# third party imports
import numpy as np
from configobj import ConfigObj
from validate import ValidateError
# local imports
from .base import CoreModule... |
'''
Project: Negociant
Copyright (c) 2017 <NAME> <https://github.com/XilinJia>
This software is released under the MIT license
https://opensource.org/licenses/MIT
'''
# encoding: UTF-8
import copy
import numpy as np
from collections import OrderedDict
from negociant.trader.vtObject import VtOrderData, VtTradeData
fr... |
import socket
import asyncio
import struct
import time
ETH_P_IP = 0x0800
# Coloque aqui o endereco de destino para onde voce quer mandar o ping
dest_addr = '127.0.0.1'
receivedPackages = {}
#inicializacao da variavel para syncio.get_event_loop().call_later()
discard = None
#contador para o teste do timeout
#se ele... |
#!/usr/bin/env python3
# Copyright 2021 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... |
# Copyright (C) 2019 SAMSUNG SDS <<EMAIL>>
#
# This code is distribued under the terms and conditions from the MIT License (MIT).
#
# Authors : <NAME>, <NAME>, <NAME>, <NAME>
from core.policies import EpsGreedyQPolicy, GreedyQPolicy, LinearAnnealedPolicy
from core.algorithm.DQN import DQNAgent
from core.memories impo... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""Loss functions."""
import torch.nn as nn
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd impo... |
# Author: <NAME>
from pylab import *
import numpy as np
import scipy as sp
from scipy.io.wavfile import read
from scipy import signal
from scipy.signal import butter, lfilter
import matplotlib.pyplot as plt
import wave
import librosa
# Parameters
ENF_frequency = 50
sampling_freq = 1000
lowcut = ENF_f... |
import os, sys
sys.path.append(".")
import torch
import argparse
import datetime
from torchvision import models
from torchvision.models.detection.faster_rcnn import FastRCNNPredictor
from torchvision.transforms import functional as F
import time
from common.utility import *
import pandas as pd
import matplotlib.pyplot... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
import random
import glob, os
import jieba
import pickle
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from clf.ANN import ANN
N_EPOCHS = 1000... |
import pandas as pd
from pyteomics import mass
import copy
SEQUENCE = 'KQLATKAAR'
DICT_MODIFICATIONS = {
'ac12' : mass.calculate_mass(formula='C[12]2H3O') - mass.calculate_mass(formula='H'),
'ac13' : mass.calculate_mass(formula='C[13]2H3O') - mass.calculate_mass(formula='H'),
'ac*' : mass.calculate_mass(f... |
# import essential package
from matplotlib import pyplot as plt
from sklearn.metrics import precision_score
from torch.utils.data import DataLoader
from utils.Getdataset import IntelDNADataset
from torch.utils.tensorboard import SummaryWriter
from tqdm.auto import tqdm
# utils
from utils.aligning import *
from utils.em... |
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
from django.core.paginator import Paginator
from django.db.models import Q, Sum, Count
from django.db.models.functions import TruncYear, TruncMonth, TruncQuarter, TruncDate... |
from __future__ import absolute_import
import sys
import json
import base64
import os
import os.path
from PyQt5 import QtCore, QtWidgets
try:
from jose import jwt
from jose import exceptions
from jose import constants
JOSE = True
except ImportError:
JOSE = False
from .. import DeenPlugin
from dee... |
"""
Module containing classes to run an iteration of an iter8 eperiment, and return assessment and recommendations
"""
# core python dependencies
import logging
from typing import Dict
# iter8 dependencies
from iter8_analytics.api.analytics.types import *
from iter8_analytics.api.analytics.metrics import *
from iter8_... |
import sys
import numpy as np
import matplotlib.pyplot as plt
from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator
from PIL import Image, ImageDraw
from datetime import datetime
import random
from collections import OrderedDict
from parser import Parser
their_name: str = ""
def main():
global their_nam... |
###############################################################################
# For more info, see https://hoseinkh.github.io/
###############################################################################
#
# This takes 4min 30s to run in Python 2.7
# But only 1min 30s to run in Python 3.5!
#
# Note: gym changed fr... |
# Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
from __future__ import absolute_import, division, print_function
import os
import os.path as osp
import json
from operator import itemgetter
import torch
import numpy as np
from itertools import permutations
from ..dataset import Ima... |
"""
Anchor Management
=================
The ``Anchors`` plugin provides the ``Anchors``, ``LoadAnchors``, ``Attach``
and ``PropagateAnchors`` verbs.
``Anchors`` takes a glyph name followed by anchor names and
positions, like so::
Anchors A top <679 1600> bottom <691 0>;
Note that there are no semicolons betwe... |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 <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 limitati... |
import numpy as np
import networkx as nx
import xlsxwriter
import math
def read_gt(gt_file, nodes):
with open(('final_datasets/complex_datasets/gold_standard/' + gt_file + '.txt'), 'r') as f:
gt_raw = []
for item in f:
gt_raw.append(item.split())
if gt_file == 'sgd':
... |
"""
Entry point for the qne command-line.
Creates the Typer app and its commands
"""
import logging
from pathlib import Path
from typing import List, Optional, Tuple
from tabulate import tabulate
import typer
from typer import Typer
from adk.api.local_api import LocalApi
from adk.api.remote_api import RemoteApi
from... |
# -*- coding: utf-8 -*-
import django
try:
from django.contrib.contenttypes.fields import GenericForeignKey
except ImportError:
from django.contrib.contenttypes.generic import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models import Q... |
from functools import partial
import logging
import json
from aws_xray_sdk.core import xray_recorder
from app.models.metrics.metrics_model import MetricsModel
from app.config import ROOT_DIR
from typing import List, Dict, Optional, Union
from operator import itemgetter
from scipy.stats import beta
from app.models.sl... |
"""
utilities for getting resources
"""
import os
import requests
import sys
import urllib.request
import zipfile
from tqdm import tqdm
from pathlib import Path
# set home dir for default
HOME_DIR = str(Path.home())
DEFAULT_MODEL_DIR = HOME_DIR+'/stanfordnlp_resources'
# list of language shorthands
conll_shorthands... |
import math
import random
import networkx
from pytricia import PyTricia
DEFAULT_SERVICE_TYPES = {21: 0.1, 80: 0.1, 2801: 0.2, 8444: 0.3, 8445: 0.3}
def generate_local_policies(G, **kwargs):
# TODO
return generate_random_policy(G, **kwargs)
def generate_random_policy(G,
random_ty... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: yolo_module.py
# Author: <NAME> <<EMAIL>>
import tensorflow as tf
import src.model.layers as L
import src.bbox.tfbboxtool as tfbboxtool
def leaky(x):
""" leaky ReLU with alpha = 0.1 """
return L.leaky_relu(x, leak=0.1)
def yolo_layer(input_feat,
... |
from starter import MY_TROTTER_STEPS, my_trotter # feel free to replace to your module
"""
Recommended development procedure:
1. use noiseless simulator to verify your trotterization is correct: as `trotter_steps` goes high, fidelity should approach 100%
2. use jakarta simulator to see how it performs on noisy simula... |
# Copyright 2018 ProjectQ-Framework (www.projectq.ch)
#
# 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... |
"""Tests for the ResourceTracker class"""
import errno
import gc
import os
import pytest
import re
import signal
import subprocess
import sys
import time
import warnings
import weakref
from loky import ProcessPoolExecutor
import loky.backend.resource_tracker as resource_tracker
from loky.backend.context import get_con... |
# Copyright (c) 2020 PaddlePaddle 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 appli... |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
from _pyngraph import PartialShape, Dimension
import openvino.opset8 as ov
from openvino.utils.types import make_constant_node
from tests.runtime import get_runtime
from tests.test_ngraph.util import run... |
"""Entry point."""
import torch
import argparse
import numpy as np
from sys import exit
from datetime import datetime
import graphnas.utils.tensor_utils as utils
from graphnas.utils.data_utils import available_datasets
from graphnas.utils.model_constants import optimization_metrics
# Selectors
from graphnas.selectors... |
""":mod:`sassutils.builder` --- Build the whole directory
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import with_statement
import collections
import io
import os
import os.path
import re
from six import string_types
from sass import compile
__all__ = 'SUFFIXES', 'SUFFIX_PATTERN',... |
# coding=utf-8
# pylint: disable-msg=E1101,W0612
from datetime import datetime
import collections
import pytest
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
from pandas.compat import StringIO, u
from pandas.util.testing import (assert_series_equal, assert_almost_equal,
... |
# -*- coding: utf-8 -*-
from time import sleep
import requests
import urlparse
import httplib as http
import pymongo
from modularodm import fields
from framework.auth.core import _get_current_user
from framework.auth.decorators import Auth
from framework.exceptions import HTTPError
from website.addons.base import (
... |
import io
import unittest
import urllib.robotparser
from collections import namedtuple
from test import support
from http.server import BaseHTTPRequestHandler, HTTPServer
try:
import threading
except ImportError:
threading = None
class RobotTestCase(unittest.TestCase):
def __init__(self, index=None, parse... |
from abc import ABCMeta
from functools import wraps
from inspect import FrameInfo
from typing import (
TYPE_CHECKING,
Any,
Callable,
ClassVar,
List,
NoReturn,
Optional,
Tuple,
Type,
TypeVar,
Union,
overload,
)
from typing_extensions import ParamSpec, final
from returns.... |
import random
import numpy as np
import networkx as nx
# from numba import jit
random.seed(1337)
np.random.seed(1337)
size = 51
# Halaj-Kok 2013
def generate_halaj_kok_2013_network():
"""
See https://www.ecb.europa.eu/pub/pdf/scpwps/ecbwp1506.pdf page 8-9
"""
def generate_output():
percen... |
import warnings
from . import ops
from .groupby import DataArrayGroupBy, DatasetGroupBy
RESAMPLE_DIM = "__resample_dim__"
class Resample:
"""An object that extends the `GroupBy` object with additional logic
for handling specialized re-sampling operations.
You should create a `Resample` object by using ... |
# Copyright 2021, <NAME>, mailto:<EMAIL>
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... |
import warnings
import numpy as np
import pandas as pd
import xgboost as xgb
from joblib import Parallel, delayed
from sklearn.linear_model import LogisticRegression
from sklearn.neighbors import BallTree
from sklearn.preprocessing import OneHotEncoder
# lib utils
from xgbse._base import XGBSEBaseEstimator, DummyLogis... |
import io
import struct
from pycoin.encoding.hash import double_sha256
from pycoin.encoding.hexbytes import b2h_rev
from pycoin.satoshi.satoshi_int import parse_satoshi_int
from pycoin.satoshi.satoshi_streamer import Streamer, STREAMER_FUNCTIONS
from .InvItem import InvItem
from .PeerAddress import PeerAddress
# def... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch.utils.data as data
import os
import re
import torch
import tarfile
from PIL import Image
import random
import numpy as np
IMG_EXTENSIONS = ['.png', '.jpg', '.jpeg']
def natural_key(string_):
... |
"""Provide the Emoji class."""
import os
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
from ...const import API_PATH
from ...exceptions import ClientException
from .base import RedditBase
if TYPE_CHECKING: # pragma: no cover
from ... import Reddit
from .subreddit import Subreddit
class... |
"""
PhysicalNode class for including real systems in the emulated network.
"""
import logging
import threading
from pathlib import Path
from typing import TYPE_CHECKING, List, Optional, Tuple
from core.emulator.data import InterfaceData
from core.emulator.distributed import DistributedServer
from core.emulator.enumer... |
# eval_arith.py
#
# Copyright 2009, 2011 <NAME>
#
# Expansion on the pyparsing example simpleArith.py, to include evaluation
# of the parsed tokens.
#
# Added support for exponentiation, using right-to-left evaluation of
# operands
#
from pyparsing import (
Word,
nums,
alphas,
Combine,
oneOf,
op... |
#######################################################################################
# This is a utility library for common methods
# Author: <NAME>
# email: <EMAIL>
#######################################################################################
import numpy as np
import matplotlib.pyplot as plt
from scipy... |
#
# Licensed to Dagda under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Dagda licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance... |
#!/usr/bin/env python
# coding=utf-8
import logging
import time
from enum import Enum
import json
import pika
from sqlalchemy import (
Column,
ForeignKey,
Integer,
)
from sqlalchemy.exc import NoSuchTableError
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import backref, relationship
... |
"""
Some key layers used for constructing a Capsule Network. These layers can used to construct CapsNet on other dataset,
not just on MNIST.
Author: <NAME>, E-mail: `<EMAIL>`, Github: `https://github.com/XifengGuo/CapsNet-Pytorch`
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autog... |
# coding=utf-8
# Copyright 2021 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... |
import numpy as np
#from scipy.cluster.vq import *
#import pyGPs
#import gpflow
import copy
import rospy
from nav_msgs.msg import OccupancyGrid
from geometry_msgs.msg import Pose, Point, Quaternion, PoseStamped, PoseArray
from scipy.stats import norm
#from utils.tools import graph_in_poly
from skimage.draw import poly... |
from __future__ import unicode_literals
import re
from .theplatform import ThePlatformIE
from ..utils import (
smuggle_url,
update_url_query,
unescapeHTML,
extract_attributes,
get_element_by_attribute,
)
from ..compat import (
compat_urlparse,
)
class AENetworksBaseIE(ThePlatformIE):
_TH... |
from keras.layers import Input, Add, Dense, Activation, Flatten, Convolution2D, Convolution1D, MaxPooling2D, ZeroPadding2D, \
AveragePooling2D, TimeDistributed, Lambda, Concatenate
from keras import backend as K
from keras_frcnn.RoiPoolingConv import RoiPoolingConv
from keras_frcnn.FixedBatchNormalization import ... |
from passive_backend import *
from tnt_edit import *
from flask import Flask, render_template, send_from_directory
from flask_cors import CORS
from flask import request
from flask_util import ActionConverter
import json
app = Flask(__name__, static_folder='_front/asimple')
CORS(app)
app.url_map.converters['action'] = ... |
import datetime
import enum
import secrets
import uuid
from typing import Tuple
import bcrypt
from sqlalchemy import (
Boolean,
Column,
DateTime,
Enum,
ForeignKey,
Integer,
String,
Table,
)
from sqlalchemy.dialects.postgresql import JSONB, UUID
from sqlalchemy.ext.declarative import Abs... |
#!/usr/bin/env python3
import os.path
import sys
import json
import re
import yaml
import ninja_syntax
def resolve_url(filename, relative_link):
return os.path.normpath(os.path.join(os.path.dirname(filename), relative_link))
def scan_adoc(adoc_filename, apparent_filename, parents):
parents.add(adoc_filenam... |
# Copyright 2009 Facebook
#
# 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, sof... |
"""Unit tests for the graphspace quotient space."""
import networkx as nx
import pytest
import geomstats.backend as gs
from tests.conftest import Parametrizer, TestCase, np_backend
from tests.data.graph_space_data import (
DecoratorsTestData,
GraphSpaceMetricTestData,
GraphSpaceTestData,
GraphTestData... |
# 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... |
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2020 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
import scipy.linalg as spla
import numpy as np
from pymor.algorithms.genericsolvers import _parse... |
# code for IP tunnel over a mesh
# Note python-pytuntap was too buggy
# using pip3 install pytap2
# make sure to "sudo setcap cap_net_admin+eip /usr/bin/python3.8" so python can access tun device without being root
# sudo ip tuntap del mode tun tun0
# sudo bin/run.sh --port /dev/ttyUSB0 --setch-shortfast
# sudo bin/run... |
"""Contains the code needed to find the Ewald energy of the system.
"""
import numpy as np
from itertools import product
def _find_structure_factor(x,z,G): #pragma: no cover
"""Finds the structure factors for the system.
Args:
x (list of float): The locations of the nuclear charges.
z (list of... |
# Copyright 2017 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM Corp. 2017 and later.
#
# 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.... |
# Copyright (c) 2016 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 law or agreed ... |
#!/usr/bin/env python
# coding=utf-8
from __future__ import division, print_function, unicode_literals
import json
import os
import os.path
import tempfile
from shutil import copyfile
from sacred.commandline_options import CommandLineOption
from sacred.dependencies import get_digest
from sacred.observers.base import ... |
# Copyright 2018-2019 The glTF-Blender-IO 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 ... |
import os
import time
import numpy as np
import tvm
import topi
from tvm.contrib import rpc, util
from topi.util import get_const_tuple
import topi.testing
from tvm.contrib.pickle_memoize import memoize
dtype = 'float32'
def convert_to_remote(func, remote):
temp = util.tempdir()
prefix = str(np.random.randi... |
import torch
import numpy as np
from flags import DATA_FOLDER
def load_word_embeddings(emb_type, vocab):
if emb_type == 'glove':
embeds = load_glove_embeddings(vocab)
elif emb_type == 'fasttext':
embeds = load_fasttext_embeddings(vocab)
elif emb_type == 'word2vec':
embeds = load_word... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2017 bily Huazhong University of Science and Technology
#
# Distributed under terms of the MIT license.
"""Contains definitions of the network in [1].
[1] <NAME>., et al. (2016).
"Fully-Convolutional Siamese Networks for Object Tracking."
... |
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# 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 agre... |
#!/usr/bin/env python
import argparse
import json
import logging
from datetime import datetime
from subprocess import CalledProcessError, check_output, STDOUT, Popen, PIPE
from time import sleep
import boto3
import pika
import redis
import requests
import yaml
from pika.exceptions import AMQPError
from requests import... |
"""
Wrapper functions for running the Kappa programs *KaSim* and *KaSa*.
The path to the directory containing the KaSim and KaSa executables can be
specified in one of three ways:
- set the KAPPAPATH environment variable to the KaSim directory
- move Kappa to /usr/local/share/KaSim (macOS, Linux) or
c:\Program File... |
from datetime import datetime
from pathlib import Path
from urllib.parse import unquote
import sqlite3
from typing import List, Set
import pytz
from ..common import PathIsh, Results, Visit, Loc, get_logger, Second, mime
from .. import config
# todo mcachew?
from cachew import cachew
logger = get_logger()
def inde... |
import datetime
import logging
import re
import signal
import threading
from timeit import default_timer as timer
PROFILING = False
if PROFILING:
import cProfile as profile
log = logging.getLogger(__name__)
DEBUG = log.isEnabledFor(logging.DEBUG)
on_exit = []
def append_signal_handler_for(sig, func):
"... |
import re
from collections import OrderedDict
from datetime import date, datetime, time, timedelta
from decimal import Decimal, DecimalException
from enum import Enum
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Pattern, Set, Tuple, Type, TypeVar, Union, cast
from uuid... |
import sys
import numpy as np
import time
from datetime import datetime, timedelta
from .AxisItem import AxisItem
from collections import OrderedDict
__all__ = ['DateAxisItem']
MS_SPACING = 1/1000.0
SECOND_SPACING = 1
MINUTE_SPACING = 60
HOUR_SPACING = 3600
DAY_SPACING = 24 * HOUR_SPACING
WEEK_SPACING = 7 * DAY_SPAC... |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
from collections import defaultdict
from django.contrib import messages
from django.core.urlresolvers import reverse
from django... |
# -*-coding:utf-8-*-
from importlib import import_module, reload
import os
import sys
import time
import shutil
import re
import yaml
from flask_babel import gettext
from apps.app import mdb_sys, cache
from apps.configs.sys_config import PLUG_IN_FOLDER, PLUG_IN_FOLDER_NAME, PLUG_IN_REQUIRED_CONF
__author__ = "<NAM... |
"""
A model for mass definitions.
This is primarily inspired by <NAME>'s COLOSSUS code: https://bdiemer.bitbucket.io/colossus/halo_mass_defs.html
"""
from .._internals import _framework
import numpy as np
import scipy as sp
import astropy.units as u
from astropy.cosmology import Planck15, FLRW
import warnings
from ..c... |
#!/usr/bin/env python2.7
# encoding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
"""Convert (to and) from rdflib graphs to other well known graph libraries.
Currently the following libraries are supported:
-... |
from common import *
from dataset.transform import *
from dataset.sampler import *
from utility.file import *
from utility.draw import *
from net.lib.box.process import *
#data reader ----------------------------------------------------------------
MIN_SIZE = 6
MAX_SIZE = 128 #np.inf
IGNORE_BOUNDARY = -1
IGNORE_... |
"""
@author:<NAME>
"""
import os
import sys
import random
import time
import nltk
import string
import re
from nltk.stem import PorterStemmer
ps = PorterStemmer()
from nltk.corpus import wordnet
BOTNAME = "CrazyBot"
CONTRACTION_MAP = {
"don't": "do not",
}
#keywords list
MISUND_RESPONSES =... |
# -*- encoding: utf-8 -*-
#
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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/LICE... |
from libcity.config import ConfigParser
from libcity.data import get_dataset
from libcity.utils import get_executor, get_model, get_logger
from libcity.data.utils import generate_dataloader
# from geopy import distance
from math import radians, cos, sin, asin, sqrt
import numpy as np
import pickle
from collections impo... |
"""Editor: <NAME>
Last modified: 05.08.2020
This is the so called ball pyramid or super jump, also known as Galilean cannon:
Some balls are stacked and released from a height h. When they arrive at the ground, they are
reflected and the smallest ball on the top is fired out to a very large height.
Implement the balls,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.