text stringlengths 3.07k 22.1k |
|---|
import time, sys
from copy import deepcopy
import numpy as np
from sedpy.observate import load_filters
from prospect import prospect_args
from prospect.fitting import fit_model
from prospect.io import write_results as writer
# Here we are going to put together some filter names
# All these filters are available in s... |
# -*- coding: utf-8 -*-
'''
Copyright (c) 2021, Trustworthy AI, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list ... |
# -*- coding: utf-8 -*-
# Implementing Unit Tests
#----------------------------------
#
# Here, we will show how to implement different unit tests
# on the MNIST example
import numpy as np
import tensorflow as tf
from tensorflow.contrib.learn.python.learn.datasets.mnist import read_data_sets
from tensorflow.python.fr... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Ring background estimation."""
from __future__ import absolute_import, division, print_function, unicode_literals
from collections import OrderedDict
from itertools import product
import numpy as np
from astropy.convolution import Ring2DKernel, Tophat2D... |
"""Main method to train neural networks with Keras API
"""
import argparse
from datetime import datetime
import itertools
import json
import os
import daiquiri
import numpy as np
from keras import backend, callbacks
from keras.models import Model
from keras.optimizers import Adam
from deeposlandia import generator,... |
'''
Code extracts frames from video at a rate of 25fps and
'''
import sys, os, pdb, cv2, subprocess, struct
import numpy as np
from tqdm import tqdm
TAG_FLOAT = 202021.25
MIN_WIDTH = 1
MAX_WIDTH = 99999
MIN_HEIGHT = 1
MAX_HEIGHT = 99999
import multiprocessing
def readFlowFile(filename):
"""
flow_utils.rea... |
import logging
import os
from cachelib.file import FileSystemCache
logger = logging.getLogger()
def get_env_variable(var_name, default=None):
"""Get the environment variable or raise exception."""
try:
return os.environ[var_name]
except KeyError:
if default is not None:
return ... |
__all__ = ['js']
# Don't look below, you will not understand this Python code :) I don't.
from js2py.pyjs import *
# setting scope
var = Scope( JS_BUILTINS )
set_global_object(var)
# Code follows:
var.registers(['Vec2D', 'rk4'])
@Js
def PyJs_anonymous_0_(this, arguments, var=var):
var = Scope({'this':this, 'argu... |
import argparse
import numpy as np
import keras.backend as K
from . import defines
def parse_args():
"""Parse command line arguments.
The args namespace is used promiscuously in this module.
Its fields control the tensor definition, dataset generation, training, file I/O and evaluation.
Some of the ... |
"""
Some useful tools for working with KBase outputs.
Includes:
* Ion size dictionary
* Rename KBase compounds to PFLOTRAN conventions
* Sort PFLOTRAN outputs into useful groups for plotting
"""
import copy
def ion_size():
"""
Library of ion size parameters.
Mapped to formulas used in Model... |
from dotenv import load_dotenv
import os
import pickle
import serial
import pygatt
import numpy as np
import pyaudio
import wave
import time
from dcd.entities.thing import Thing
from dcd.entities.property import PropertyType
# The thing ID and access token
load_dotenv()
THING_ID = os.environ['THING_ID']
THING_TOKEN =... |
from __future__ import print_function, division, absolute_import
import pytest
pytest.importorskip('ipywidgets')
from ipykernel.comm import Comm
from ipywidgets import Widget
#################
# Utility stuff #
#################
# Taken from ipywidgets/widgets/tests/test_interaction.py
# https://github.c... |
import os
import shutil
import sys
import time
import pytest
import ray
from ray.cluster_utils import Cluster
from ray.test_utils import check_call_ray
def unix_socket_create_path(name):
unix = sys.platform != "win32"
return os.path.join(ray.utils.get_user_temp_dir(), name) if unix else None
def unix_socke... |
"""Base Model for Semantic Segmentation"""
import math
import numpy as np
import mxnet as mx
from mxnet.ndarray import NDArray
from mxnet.gluon.nn import HybridBlock
from mxnet.gluon.loss import Loss, _apply_weighting
from ..utils.metrics import voc_segmentation
from ..utils.parallel import parallel_apply
from .resnetv... |
import crayons
from wecs.core import Component
from wecs.core import System
from wecs.core import and_filter
from wecs.core import or_filter
from wecs.rooms import Room
from wecs.rooms import RoomPresence
from wecs.rooms import ChangeRoomAction
from wecs.inventory import Inventory
from wecs.inventory import TakeAction... |
import torch
import torch.nn.functional as F
import numpy as np
from torch.utils.tensorboard import SummaryWriter
import numpy as np
import os
import torch
import torch.nn.functional as F
from ray import tune
import os, sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)... |
import sqlalchemy as sa
from sqlalchemy import or_
from flask_sqlalchemy import SQLAlchemy
import math
from anyway.utilities import init_flask
from anyway.models import AccidentMarker, Involved, School
from anyway.constants import CONST
import pandas as pd
import os
SUBTYPE_ACCIDENT_WITH_PEDESTRIAN = 1
LOCATION_ACCUR... |
# 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, software
# distributed under th... |
#!/usr/bin/python
import bottle
import uuid
import logging
import datetime
import json
import mimetypes
from jsonobject import (
PropertySet,
Property,
EnumProperty,
Query,
register_schema,
get_schema,
)
from images7.system import current_system
from images7.files import App as FileApp
from i... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import ast
import rhinoscriptsyntax as rs
import scriptcontext as sc
import Eto.Drawing as drawing
import Eto.Forms as forms
import Rhino
find_object = sc.doc.Objects.Find
__all__ = ["AttributesForm"]
def... |
"""Provide dump of software and libraries installed on CloudBioLinux image.
This provides an output YAML file with package details, providing a complete
dump of installed software and packages. The YAML output feeds into a BioGems
style webpage that provides a more human friendly view of installed packages.
The versio... |
import atexit
import functools
import logging
import os
import secrets
import shutil
import string
import subprocess
import sys
import unittest
from functools import lru_cache
import pqclean
@atexit.register
def cleanup_testcases():
"""Clean up any remaining isolated test dirs"""
print("Cleaning up testcases... |
import os
import keras
from keras.layers import concatenate
from sklearn.metrics import cohen_kappa_score
import scipy.io
import math
import random
from keras import optimizers
import numpy as np
import scipy.io as spio
from sklearn.metrics import f1_score, accuracy_score
np.random.seed(0)
from keras.preprocess... |
import functools
import logging
import numpy as np
from theano.compat import OrderedDict
from theano import tensor as T
from pylearn2.linear.conv2d_c01b import make_random_conv2D
from pylearn2.models import Model
from pylearn2.models.maxout import check_cuda # TODO: import from original path
from pylearn2.models.mlp... |
#!/usr/bin/env python
"""Parsers for the LL_tmpl file from LocusLink.
Notes:
The LocusLink format is documented in the README file, but unfortunately this
documentation is mostly lies. Fields that are supposed to be unique are
repeated, fields whose only association with each other is their order are
found out of ord... |
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import pickle
import timeit
import numpy as np
from pymatgen.core.composition import Composition
from pymatgen.core.lattice import Lattice
from pymatgen.core.periodic_table import Element, Species
from pymatgen.core.sites i... |
import unittest
from transformers import is_torch_available
from transformers.file_utils import cached_property
from transformers.testing_utils import require_torch, slow, torch_device
from .test_modeling_bart import TOLERANCE, _assert_tensors_equal, _long_tensor
if is_torch_available():
import torch
from ... |
"""
Download Gemini pages recursively.
Usage: cd examples && PYTHONPATH=.. python -m downloader --help
"""
import argparse
import asyncio
import logging
import time
from functools import partial
from pathlib import Path
import random
from typing import Set, Optional, cast, Iterator, Tuple, List
from urllib.parse impo... |
import functools
from typing import Optional, Iterable, Union, List, Mapping, Tuple
import numpy as np
import pathlib
import json
import torch
from torch import nn
from torch import Tensor, FloatTensor, LongTensor
from GANsynth_pytorch.loader import make_masked_phase_transform
from GANsynth_pytorch.normali... |
# RUN: %PYTHON %s | FileCheck %s
from mlir.ir import *
import mlir.dialects.builtin as builtin
import mlir.dialects.std as std
def run(f):
print("\nTEST:", f.__name__)
f()
return f
# CHECK-LABEL: TEST: testFromPyFunc
@run
def testFromPyFunc():
with Context() as ctx, Location.unknown() as loc:
ctx.allow... |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2021 beyond-blockchain.org.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable l... |
"""
.. codeauthor:: <NAME> <<EMAIL>>
"""
import hashlib
from textwrap import dedent
import humanreadable as hr
import typepy
from typepy import RealNumber
from ._common import validate_within_min_max
from ._const import Tc
from ._logger import logger
from ._network import get_upper_limit_rate
MIN_PACKET_LOSS_RATE ... |
#!/usr/bin/python3
import random
import datetime
from sre_constants import RANGE
import sqlite3
from pydantic import BaseModel
from apscheduler.schedulers.background import BackgroundScheduler
import subprocess
RANGE_MAX = 365
RATIO = 10
DB_FILENAME = "piggysaving.db"
DB_VERSION_ENTITY_NAME = "version"
DB_VERSION = 1... |
import argparse
import re
import string
import pyspark.sql.functions as F
from pyspark.sql import Row, SparkSession
from pyspark.sql.types import BooleanType
from pygtrie import StringTrie # type: ignore # Sideloaded in the spark-submit
PUNCT = "".join(x for x in string.punctuation if x not in "[]")
TARGET_QUOTE_TO... |
# SPDX-FileCopyrightText: 2021 Carnegie Mellon University
#
# SPDX-License-Identifier: Apache-2.0
import argparse
import os
import time
import cv2
import rospy
from cv_bridge import CvBridge
from delphi_filter import DelphiFilter
from gabriel_protocol import gabriel_pb2
from protocol import busedge_delphi_pb2
from se... |
'''
test for PGD Class functions
using an analytic pgd solution of form:
u(x,E,L)
PGD CO: x: space; E: E-modul, L: load factor
attribute 0: U: u(x,E,L)= 1/2A(lae*x-x**2) 1/E L*n
attribute 1: sig: sig(x,E,L)=1/2A(lae-2x) E/E L*n
with modes and meshes given as np.array... |
# Copyright 2015 The Bazel 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 applicable la... |
import collections.abc
from typing import Any, Generator, Optional, Type, Union
import bpy
import mathutils
from bpy.types import NodeSocket, NodeInputs, NodeOutputs
from nodeitems_utils import NodeItem
import arm.log
import arm.logicnode.arm_sockets
import arm.utils
if arm.is_reload(__name__):
arm.log = arm.rel... |
"""Implementation of the climwip weighting scheme.
<NAME> et al. section 2.4
https://iopscience.iop.org/article/10.1088/1748-9326/ab492f
"""
import logging
import os
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import xarray as xr
from calibrate_sigmas import calibrate_performance_sigma
fr... |
import numpy as np
import networkx as nx
import warnings
import os
from networkx.algorithms.shortest_paths.weighted import dijkstra_path
from utils import *
_sim_info = {}
def push_to_sim_info(key, value):
global _sim_info
if key in _sim_info.keys():
warnings.warn("Key already exists! Replacing its c... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
# coding: utf-8
"""
This program performs scaling on integrated datasets, which attempts to improve
the internal consistency of the reflection intensities by correcting for
various experimental effects. By default, a physically motivated scaling model
is used, with a scale, decay (B-factor) and absorption correction.
I... |
from os import listdir, path
import PySimpleGUI as sg
from .. import misc, consts
from ..rexam import extypes
from ..rexam.item import RExamItem, AnswerList
from ..rexam.git_info import GitInfo
_EMPTY_ITEM = RExamItem(None)
sg.theme_add_new("mytheme", consts.SG_COLOR_THEME)
sg.theme("mytheme")
class GUIBaseDirecto... |
# INFO : ini merupakan copy source code dari repo one4ubot, dan sudah mendapatkan izin dari pemilik.
# INFO : This is a copy of the source code from the One4ubot repo, and has the permission of the owner.
# Copyright (C) 2020 <NAME>.
# All rights reserved.
#
# Licensed under the Raphielscape Public License, Version 1.d... |
from flask import request, render_template, Response, Flask, session, redirect, url_for, jsonify, abort, send_file
from requests_oauthlib import OAuth2Session
import os
import json
import urllib.parse
import base64
from jsonschema import exceptions
from flask_misaka import Misaka
from src import bot_client
from src imp... |
from configparser import ConfigParser
import os
class myconf(ConfigParser):
def __init__(self, defaults=None):
ConfigParser.__init__(self, defaults=defaults)
self.add_sec = "Additional"
def optionxform(self, optionstr):
return optionstr
class Configurable(myconf):
def __init__(... |
from math import cos, sin, tan, pi
from time import time
from lib.matrix import matrix_multiply
from lib.vector import vector_add, vector_subtract, dot_product,\
cross_product, inner_product, magnitude
class Camera:
"""class for storing camera properties and calculating projection"""
d... |
from collections import OrderedDict
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class standard_block(nn.Module):
def __init__(self, in_channels, out_channels):
super(standard_block, self).__init__()
self.conv2d = nn.Conv2d(in_channels, out_channels, kernel_size=3,... |
"""test the IPython Kernel"""
#-------------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-------------------... |
#classe decrivant une tableau
# -*- coding: latin-1 -*-
#****************************************************************************
# Copyright (c) 2015 - 2016, CEA
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following con... |
from PIL import Image
import os
import os.path
import torch.utils.data
import torchvision.transforms as transforms
import numpy as np
import json
import torch
import pickle
import h5py
from sklearn.metrics import roc_auc_score
from torch.autograd import Variable
def default_image_loader(path):
return Image.open(p... |
"""
Schemas
=======
Schemas defines the structure of the fields of your table. The schema handles
fields validations, and ensure index unicity. There are 5 main concepts around
the schemas:
**Indexes**
An index defines which key (or set of keys) should be unique within your table.
The schema will perform checks on t... |
#
# Copyright 2016 The BigDL 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 agreed to in ... |
#!/usr/bin/env/python
# File name : server.py
# Production : RaspTank
# Website : www.adeept.com
# E-mail : <EMAIL>
# Author : William
# Date : 2018/08/22
import socket
import time
import threading
import move
import Adafruit_PCA9685
pwm = Adafruit_PCA9685.PCA9685()
pwm.set_pwm_freq(50)
pwm.set... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 9 14:58:41 2021
@author: ste_m
Investigating a fundamental theorem of active inference in simple systems
First of all, we don't yet have an explicit statement of the theorem.
So we will be trying to refine some intuitive concepts as we go.
Set-up:
W: external state... |
# coding: utf8
# copyright (c) 2019 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 requ... |
import json
import os
import re
from collections import deque
from functools import partial, wraps
from flask import Flask, jsonify, make_response, request
from flask_compress import Compress
from flask_cors import CORS
from flask_restplus import Api as RestPlusAPI
from flask_restplus import Resource
from jsonschema i... |
import os
import pickle
import random
from collections import defaultdict
from copy import deepcopy
import math
import numpy as np
from tqdm import tqdm
CLASS_SET = [b"airplane", b"automobile", b"bird", b"cat", b"deer",
b"dog", b"frog", b"horse", b"ship", b"truck"]
class Stats :
def __init__(self, a... |
# 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 2019, The TensorFlow Federated 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... |
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
# Copyright 2017-2020 TensorHub, 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 required by applicable law or agreed to in writ... |
#!/usr/bin/python
'''
(C) Copyright 2018-2019 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 applic... |
from __future__ import print_function
from __future__ import unicode_literals
import os
import sys
import copy
import datetime
import traceback
import importlib
import subprocess
from . import PzLog
from . import pz_env as pz_env
from . import pz_config as pz_config
try:
reload
except NameError:
if hasattr(... |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""
Tests for the HTTP challenge authentication implementation. These tests aren't parallelizable, because
the challenge cache is global to the process.
"""
import funct... |
"""
Root system data for type C
"""
#*****************************************************************************
# Copyright (C) 2008-2009 <NAME>
# Copyright (C) 2008-2009 <NAME>
# Copyright (C) 2008-2013 <NAME> <nthiery at users.sf.net>
#
# Distributed under the terms of the GNU General Public Lic... |
import math, sdl2, sys, threading
from actions import AddAction, DeleteAction
from collections import deque
from entities import Line, Window, Door, UserText, RectangularEntity
from entity_types import EntityType, ModelMutex
from threading import Lock
from tools import Tools
class Model:
"""Contains the applicati... |
import os
import h5py
import seaborn as sns
# import local methods from the source code
from avgn.network_analysis.network_analysis import *
def load_from_hdf5(hdf_locs, to_load, min_ex=1, verbose=False):
"""Loads content from a list of HDF5 files"""
hdf5_content = {}
with h5py.File(hdf_locs[0], 'r') as... |
# -*- coding: utf-8 -*-
"""
@file
@brief Defines a sphinx extension to add button to share a page
"""
import os
import copy
import shutil
import sphinx
from docutils import nodes
from docutils.parsers.rst import Directive, directives
from sphinx.util.logging import getLogger
from sphinx.util import FilenameUniqDict
D... |
# -*- coding: utf-8 -*-
from math import sin, cos, sqrt, atan2, pi
import warnings
from .._debug import typechecked, DEBUG
from ._coeffs import get_coeffs
FACT = 180.0 / pi
@typechecked
def geodetic2geocentric(
theta: float,
alt: float,
) -> tuple[float, float, float]:
"""
Conversion from geodetic... |
# Copyright 2021 MosaicML. All Rights Reserved.
import dataclasses
import os
import sys
import textwrap
from typing import Any, Dict, Iterator, Optional, Union
import yahp as hp
@dataclasses.dataclass
class ObjectStoreProviderHparams(hp.Hparams):
""":class:`~composer.utils.object_store.ObjectStoreProvider` hype... |
import warnings
from typing import Any, Dict, List, Optional, Sequence, Tuple
import numpy as np
import pandas as pd
import pytest
import xarray as xr
from pandas import DataFrame
from xarray import Dataset
from sgkit.stats.association import gwas_linear_regression, linear_regression
from sgkit.typing import ArrayLik... |
# Copyright 2019-2020 NVIDIA Corporation. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# Copyright 2020 Toyota Research Institute. All rights reserved.
# Adapted from: https://github.com/rpautrat/SuperPoint/blob/master/superpoint/evaluations/descriptor_evaluation.py
import random
from glob import glob
from os import path as osp
import cv2
import numpy as np
from kp3d.utils.keypoints import warp_keypoi... |
#!/usr/bin/env python
import os, sys, json, re, socket
from glob import glob
from datetime import datetime
from prov_es.model import get_uuid, ProvEsDocument
PLATFORM_RE = re.compile(r'/(CSKS\d)')
def get_netsel_urls(netsel_file):
"""Return list of CSK urls."""
# use sorted list of urls of the InSAR inputs... |
import cv2 as cv
import networkx as nx
import numpy as np
def show_bboxes(image, bboxes, score, color):
if score > 0:
scores = bboxes[:, -1]
inds = scores > score
bboxes = bboxes[inds, :]
text_color = (255, 0, 0)
for bbox in bboxes:
bbox_int = bbox.astype(np.int32)
... |
import numpy as np
from numba import njit, prange
import dask.array as da
from africanus.constants import c as lightspeed
def compute_counts(uvw, freqs, fbin_idx, fbin_counts, flag, nx, ny,
cell_size_x, cell_size_y, dtype):
counts = da.blockwise(compute_counts_wrapper, ('row', 'chan', 'nx', 'ny... |
"""
<NAME>
August 2016
University of Otago
requires passwordless ssh for both nesi and globus
"""
import subprocess
import time
import os.path
import logging
import sys
from optparse import OptionParser
from optparse import OptionGroup
def parse_arguments():
""" Parse the commandline arguments... |
import marisa_trie
import numpy as np
import pandas as pd
import wordfreq
from conceptnet5.uri import get_uri_language, split_uri, uri_prefix
from conceptnet5.util import get_data_filename
from conceptnet5.vectors import (
cosine_similarity,
normalize_vec,
similar_to_vec,
standardized_uri,
weighted... |
"""
This module provides the ObitScript class.
This class allows running Obit/python scripts either
locally or remotely
ObitScripts are derived from Task and share most of execution properties.
In particular, ObitScripts can be executed either locally or remotely.
In this context a script is a character string contai... |
#!/usr/bin/env python
import argparse
import copy
import json
import os
import shelve
import sys
from builtins import input
from typing import Any # noqa
from typing import List # noqa
from urllib.parse import parse_qs
from urllib.parse import splitquery # type: ignore
from urllib.parse import urlparse
from oic imp... |
"""
Tests for dit.math.ops.
"""
from __future__ import division
import pytest
import numpy as np
from dit.exceptions import InvalidBase
from dit.math.ops import (
get_ops, LinearOperations, LogOperations, exp_func, log_func
)
def test_get_ops():
assert isinstance(get_ops('linear'), LinearOperations)
a... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... |
from Values import *
from Lexer import *
from Tokens import *
from Parser_ import *
from Errors import *
from Extensions import Helper
import copy
import traceback
class RTResult:
def __init__(self):
self.reset()
def reset(self):
self.value = None
self.error = None
... |
#!/usr/bin/python3
import sys
import os
import telebot
from utils import *
from covid import Covid
from math import floor
def getConfig(name: str):
return os.environ[name]
# setup bot
bot = telebot.TeleBot(api_token)
# connect db
connection, curs = connectdb()
# create table in postgress if does not exist
crea... |
"""
Copyright (c) 2019 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from copy import deepcopy
from io import BytesIO
from textwrap import dedent
import base64
import json
import os
import responses
import tarf... |
"""
Script for training model on TensorFlow 2.0.
"""
import os
import logging
import argparse
import numpy as np
import random
import tensorflow as tf
from common.logger_utils import initialize_logging
from tensorflow2.tf2cv.model_provider import get_model
from tensorflow2.dataset_utils import get_dataset_metainfo... |
import inspect
import re
from functools import partial
from typing import Any, Callable, Dict, List, Mapping, Optional
from pydantic import ValidationError
from .._types import ModelType
from ..response import Response
from .base import BasePlugin
class OpenAPI:
def __init__(self, spec: Mapping[str, str]):
... |
# 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.
from typing import Any, Dict, List, NamedTuple, Optional, Sequence, Set, Tuple, Union
import graphene
from graphql.execution.base import Reso... |
# coding: utf8
# cython: profile=True
# cython: infer_types=True
"""Coref resolution"""
from __future__ import unicode_literals
from __future__ import print_function
import sys
import os
import spacy
import numpy as np
from neuralcoref.utils import PACKAGE_DIRECTORY, SIZE_PAIR_IN, SIZE_SINGLE_IN
from neuralcoref.com... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 16 12:51:35 2019
@author: dipu
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
#from decoders import raster_decoder, decoder_25Channel, decoder_25Channel_convOnly
def build_embeding_layer(vocab_size, dim, drop_prob):
em... |
# Copyright 2015 OpenStack LLC.
# 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 b... |
import statsmodels.api as sm
from numpy import tile, empty, linspace
from blackswan.utils import get_variable
from blackswan.ocgis_module import call
from tempfile import mkstemp
import logging
LOGGER = logging.getLogger("PYWPS")
_TIMEREGIONS_ = {'JJA': {'month': [6, 7, 8]},
'SON': {'month': [9, 10... |
from os.path import join
import time
import phuzzer
import logging
l = logging.getLogger("fuzzer.tests.test_fuzzer")
l.setLevel(logging.DEBUG)
import os
bin_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries'))
fuzzer_bin = str(os.path.join(os.path.dirname(os.path.realpath(__file_... |
###########################################################################
#
# Copyright 2020 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
#
# https://www.apache.org/l... |
import argparse
from collections import defaultdict
import configparser
import datetime
import logging
import os
import pprint
import re
import sys
import ee
import openet.ssebop as ssebop
import openet.core.utils as utils
def main(ini_path=None, overwrite_flag=False, delay=0, key=None,
reverse_flag=False)... |
import hashlib
import json
import os
import re
import shutil
import smtplib
import time
from datetime import datetime
import pytz
import requests
from django.conf import settings
from django.utils import timezone
from requests.exceptions import RequestException
from account.decorators import super_admin_required
from... |
# ===============================================================================
# Copyright 2014 <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/LI... |
"""Helper functions for homogeneous transform matrices.
This module defines helper functions used to construct transform matrices.
These functions assume the matrices will *right*-multiply the vectors to be transformed, i.e.
that the inputs are row vectors -- as is the case for a matrix of vertices indexed naturally
E... |
"""Test the helper objects in certbot_nginx.obj."""
import unittest
import itertools
class AddrTest(unittest.TestCase):
"""Test the Addr class."""
def setUp(self):
from certbot_nginx.obj import Addr
self.addr1 = Addr.fromstring("192.168.1.1")
self.addr2 = Addr.fromstring("192.168.1.1:*... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.