text stringlengths 3.07k 22.1k |
|---|
# Copyright(c) Microsoft Corporation.
# Licensed under the MIT license.
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import math
import torch.nn.functional as F
import pdb
def Entropy(input_):
bs = input_.size(0)
epsilon = 1e-5
entropy = -input_ * torch.log(in... |
#####
#
# This code is included in yt, but was not originally written by yt. For the
# original source, please see this discussion:
#
# https://groups.google.com/forum/#!topic/mpi4py/DYNXufzfKPA
#
# and the repository:
#
# https://github.com/langton/MPI_Import
#
#
# Inclusion with yt does not imply any change in... |
import base64
import json
import logging
import os
from datetime import date, datetime
from moto.ses import responses as ses_responses
from moto.ses.exceptions import MessageRejectedError
from moto.ses.models import SESBackend
from moto.ses.responses import EmailResponse as email_responses
from localstack import conf... |
import random
import math
import matplotlib.pyplot as plt
# Class of one bandit
class Bandit:
id = 0
mean = 0
variance = 1
def __init__(self, id, mean=0, variance=1):
self.id = id
self.mean = mean
self.variance = variance
def Update(self, mean=0, variance=1):
self.... |
#!/usr/bin/env python3
"""
The MIT License
Copyright (c) 2021, <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, m... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
# Copyright (c) 2016, the GPyOpt Authors
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
import itertools
from copy import deepcopy
from .variables import BanditVariable, DiscreteVariable, CategoricalVariable, ContinuousVariable, create_variable
from ..errors import InvalidConfigError, ... |
import os
import functools
import operator
from scipy._lib import _pep440
import numpy as np
from numpy.testing import assert_
import pytest
import scipy.special as sc
__all__ = ['with_special_errors', 'assert_func_equal', 'FuncData']
#------------------------------------------------------------------------------
... |
#
# 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 us... |
import logging
from datetime import timedelta, timezone
from operator import itemgetter
import arrow
import discord
from arrow import Arrow
from async_rediscache import RedisCache
from discord.ext import commands
from bot.bot import Bot
from bot.constants import Colours, Emojis, Guild, MODERATION_ROLES, Roles, STAFF_... |
import pandas as pd
from prelude import *
from .risk import *
from .liquidity_provider import *
from .liquidity import *
class Market(Data):
'''
'''
name: str
# Liquidity mechanic network parameters
liquidity: Liquidity = default_factory(Liquidity)
risk_model: RiskModel = default_factory(Ri... |
# Copyright (c) 2020 UATC, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
"""High-level polynomials manipulation functions. """
from __future__ import print_function, division
from sympy.polys.polytools import (
poly_from_expr, parallel_poly_from_expr, Poly)
from sympy.polys.polyoptions import allowed_flags
from sympy.polys.specialpolys import (
symmetric_poly, interpolating_poly)... |
from .Textos import Textos
from .Opciones import OpcionesCat
from .Rectangulos import Rectangulos
from .Esquinas import DatosEsquinas
from .MovParabolico import *
from .Terreno import Terreno
from .Variables import *
from .Turnos import *
from .Tanques import *
class Juego:
def juego(Pant,AnguloINPUT,Ve... |
# common package
import os
from os.path import basename, dirname
import sys
import string
import glob
import numpy as np
# for calculating bleu score
from nltk.translate.bleu_score import SmoothingFunction
from nltk.translate import bleu
from nltk import word_tokenize
import nltk
#nltk.download('punkt') # add this lin... |
import json
from ast import literal_eval
import requests
import requests.exceptions
import pytest
from pytest_bdd import scenario, given, then, when, parsers
import kubernetes.client
from kubernetes.client import AppsV1Api
from kubernetes.client.rest import ApiException
from tests import kube_utils
from tests impor... |
#!/usr/bin/env python3
# Copyright (c) 2015-2017 The Bitcoin Unlimited developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import test_framework.loginit
#
# Test re-org scenarios with a mempool that contains transactions
# t... |
""" Fundamental Analysis Controller """
__docformat__ = "numpy"
import argparse
import os
from typing import List
from prompt_toolkit.completion import NestedCompleter
from gamestonk_terminal.stocks.fundamental_analysis.financial_modeling_prep import (
fmp_controller,
fmp_view,
)
from gamestonk_terminal.stock... |
"""
Organized utilities for efficiently specifiying arguments needed for a QA-GNN training run,
from datasets and pre-computed embeddings to language model hyperparams.
"""
import argparse
from utils.utils import *
from modeling.modeling_encoder import MODEL_NAME_TO_CLASS
ENCODER_DEFAULT_LR = {
'default': 1e-3,
... |
# -*- coding: utf-8 -*-
"""API models for working with device and user assets."""
from typing import List, Optional, Union
from ...constants import GUI_PAGE_SIZES, PAGE_SIZE
from ...exceptions import ApiError, NotFoundError
from ...tools import listify
from ..mixins import ChildMixins, PagingMixinsObject
def check_g... |
import re
import sys
from enum import Enum
from urllib.parse import urlparse
from collections import namedtuple
from ..exceptions import ProtocolError
METHOD_RE = re.compile(b"[A-Z0-9$-_.]{3,20}")
VERSION_RE = re.compile(b"HTTP/(\d+).(\d+)")
STATUS_RE = re.compile(b"(\d{3})\s*(\w*)")
HEADER_RE = re.compile(b"[\x00-\... |
import numpy as np
import matplotlib.pyplot as plt
import csv
import random
from PIL import Image
import cv2
import myMethod as myMethod
import argparse
from keras import backend as K
import tensorflow as tf
# python select_transform.py --model myVGG --load_path /Users/wyc/Downloads/cp-0560.ckpt
parser = argparse.Arg... |
#!/usr/bin/env python3
"""Simple script for plotting .agr (Grace) files created with VMD.
Visual Molecular Dynamics allows generation of .agr files which are no longer
properly interpreted by xmgrace software. This small tool allows to quickly
plot data from an agr file (using matplotlib underneath) or to export the d... |
import argparse
import sys
import os
# disable autotune
os.environ['MXNET_CUDNN_AUTOTUNE_DEFAULT'] = '0'
# add module path
sys.path.append(os.path.abspath(os.path.join(__file__, os.pardir, os.pardir, os.pardir)))
import logging
import time
import mxnet as mx
from mxnet import gluon
from mxnet import autograd
import lib... |
#####################################################################
# #
# /connections.py #
# #
# Copyright 2013, Monash University ... |
import os
import re
import sublime
import sublime_api
import sublime_plugin
PACKAGES_FILE_REGEX = r'^Packages/(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$'
class RunSyntaxTestsCommand(sublime_plugin.WindowCommand):
def run(self, find_all=False, **kwargs):
if not hasattr(self, 'output_view'):
# Tr... |
import getpass
import os
from importlib.util import find_spec
import subprocess
import sys
def ls_procs(keywords):
if type(keywords) == str: keywords = [keywords]
username = getpass.getuser()
searchcmd = 'ps aux | grep '
searchcmd += ' | grep '.join(f'"{k}"' for k in keywords)
grep = subprocess.... |
"""STIX2 Error Classes."""
class STIXError(Exception):
"""Base class for errors generated in the stix2 library."""
class ObjectConfigurationError(STIXError):
"""
Represents specification violations regarding the composition of STIX
objects.
"""
pass
class InvalidValueError(ObjectConfigurat... |
import sys
from glob import glob
import pycodestyle as pycodestyle
from urlwatch.jobs import UrlJob, JobBase, ShellJob
from urlwatch.storage import UrlsYaml, UrlsTxt
from nose.tools import raises, with_setup
import tempfile
import os
import imp
from urlwatch import storage
from urlwatch.config import BaseConfig
fro... |
#!/usr/bin/python
#
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This script reads the global interface data collected by
# compute_interfaces_info_overall.py, and writes out the code which adds
# bin... |
"""Volume processing methods."""
import itertools
import numpy as np
import tensorflow as tf
from nobrainer.transform import get_affine
from nobrainer.transform import warp_features_labels
def apply_random_transform(features, labels):
"""Apply a random rigid transformation to `features` and `labels`.
The ... |
"""DataLoader using Shared Memory"""
import copy
import random
import time
from random import randint
import multiprocessing as mp
import multiprocessing.queues
import numpy as np
import numpy.random as npr
import sampler as _sampler
# shared memory based on posix_ipc and pickle
# NOTE: the pickle and unpickle will ... |
#!/usr/bin/env python
"""
Generate F matrix.
Window zone 0-9
"""
import logging
import math
import os
import shutil
import subprocess as sp
import tempfile as tf
from typing import List
from frads import radmtx as rm
from frads import radgeom as rg
from frads import radutil, util
logger = logging.getLogger('frads.m... |
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import io
import re
import socket
from errno import ENOTCONN
from gunicorn.http.unreader import SocketUnreader
from gunicorn.http.body import ChunkedReader, LengthReader, EOFReader, Body
from... |
"""
Script to reproduce forecast $ (%) we see in the AWS Cost Explorer
Written by: <NAME>
Date: Sept 4, 2020
Commandline:
python3 get_forecast.py
Environment Variables:
GET_FORECAST_COLUMNS_DISPLAYED - specify columnns and order
default: "Account,MTD,Forecast,Change"
GET_FORECAST_ACCOUNT_COLUMN_WIDT... |
#!python
# cython: language_level=3
# Script for radar signal processing
# This script requires that `numpy` and be installed within the Python
# environment you are running this script in.
# This file can be imported as a module and contains the following
# functions:
# * cal_range_profile - calculate range profil... |
# -*- coding: utf-8 -*-
# Original source: github.com/okfn/bibserver
# Authors:
# markmacgillivray
# <NAME> (epoz)
# <NAME> <fboulogne at april dot org>
import io
import logging
from bibtexparser.bibdatabase import (BibDatabase, BibDataString, as_text,
BibDataStringExpression, S... |
# ActivitySim
# See full license in LICENSE.txt.
from builtins import zip
import logging
import os
from operator import itemgetter
import numpy as np
import pandas as pd
import cytoolz as tz
import cytoolz.curried
logger = logging.getLogger(__name__)
def si_units(x, kind='B', digits=3, shift=1000):
# ... |
import math
import torch.nn as nn
from timm.utils import *
from timm.models.layers.activations import Swish
from timm.models.layers import CondConv2d, get_condconv_initializer
def parse_ksize(ss):
if ss.isdigit():
return int(ss)
else:
return [int(k) for k in ss.split('.')]
def decode_arch_d... |
# -*- test-case-name: cowrie.test.protocol -*-
# Copyright (c) 2009-2014 <NAME> <<EMAIL>>
# See the COPYRIGHT file for more information
from __future__ import absolute_import, division
import os
import socket
import sys
import time
import traceback
from twisted.conch import recvline
from twisted.conch.insults import... |
from typing import Union, Dict, Optional, Any, IO, TYPE_CHECKING
from thinc.api import Config, fix_random_seed, set_gpu_allocator
from thinc.api import ConfigValidationError
from pathlib import Path
import srsly
import numpy
import tarfile
import gzip
import zipfile
import tqdm
from itertools import islice
import warni... |
# -*- coding: UTF-8 -*-
import os
import sys
import random
import pickle
from datetime import datetime
import numpy as np
from torchvision.datasets.vision import VisionDataset
classes = ['basketball', 'biking', 'diving', 'golf_swing', 'horse_riding', 'soccer_juggling',
'swing', 'tennis_swing', 'trampol... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
#coding=utf-8
import sys
import re
import os
import shutil
import datetime
from PIL import Image
def prepare_export_dir(revealjs_preview_dir, revealjs_export_dir):
if not os.path.exists(revealjs_export_dir):
os.makedirs(revealjs_export_dir)
export_repo_dir = "{}/repo".format(revealjs_export_dir)
if... |
# Copyright The OpenTelemetry 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 ... |
import json
import numpy as np
import os
from pose_model import PoseEstimationInferenceModel
import cv2
from PIL import Image
from tqdm import tqdm
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
DATASET_INFO = {
'MSCOCOPerson2017_val': {
"img_dir": os.path.expanduser('~/.mxnet/dat... |
import argparse
from PIL import Image
import re
import subprocess
import os
import random
import time
from dumb_switcher import controller
import json
USED_IMAGES_JSON = "used_images.json"
def parse_screen_properties_to_resolution_and_position(resolutions):
"""
Parse a list of resolutions of the format ####x... |
# This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, <NAME> and <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:
#
# 1. Redistribut... |
import csv
import os
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def smooth(inp):
assert len(inp.shape) == 2
output = np.empty(inp.shape)
for i in range(inp.shape[0]):
output[i] = np.mean(inp[max(i-3,0):i+1,:], axis=0)
return output
def extract_one_file(filen... |
import os
import tarfile
import datetime
import json
import time
import math
import random
import logging
import torch
import torch.nn.functional as F
import torch.nn as nn
import pie
from pie import utils, torch_utils, initialization
from pie.models import RNNEmbedding, CNNEmbedding, EmbeddingConcat, EmbeddingMixer... |
# Copyright 2020 The Flax 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 wri... |
"""
Calculate and graph various statistics about reddit comments.
"""
import datetime
import statistics
from typing import Optional
from dataclasses import dataclass
import numpy
import pandas
import plotly.express
@dataclass
class StatisticsCommentInfo:
"""
This class represents a single statistical data... |
from app.registration.models import RegistrationForm
from app.registration.models import RegistrationQuestion
from app.registration.models import RegistrationSection
import json
from datetime import datetime, timedelta
from app import db, LOGGER
from app.utils.testing import ApiTestCase
from app.users.models import App... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ykdl.extractor import VideoExtractor
from ykdl.videoinfo import VideoInfo
from ykdl.util.html import get_content
from ykdl.util.match import match1, matchall
from ykdl.compact import compact_bytes
import time
import random
import sys
import hashlib
import binascii
f... |
# coding: utf-8
#
# Copyright 2021 The Oppia 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 requi... |
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for chrome_util."""
from __future__ import print_function
import os
from chromite.lib import cros_test_lib
from chromite.lib import ch... |
# -*- coding: utf-8 -*-
# Copyright 2015, Pinterest, 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 ... |
# Copyright (c) 2016-2021, <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:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions ... |
#################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021
# by the softwar... |
###############################################################################
# WaterTAP Copyright (c) 2021, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory, Oak Ridge National
# Laboratory, National Renewable Energy Laboratory, and National Energy
# Technology Laboratory ... |
# Copyright 2014 IBM Corp.
#
# 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 t... |
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 28 21:47:22 2020
@author: boucher
"""
import numpy as np
import random
import matplotlib.pyplot as plt
class agent:
def __init__(self, x,y,angle):
self.x = x
self.y = y
self.angle = angle
def get_pos(self):
... |
"""
Code to export from yt to RadMC3D
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, yt Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#---------... |
#!/usr/bin/env python2
"""
NAME: getKrakenFna.py
=========
DESCRIPTION
===========
INSTALLATION
============
USAGE
=====
VERSION HISTORY
===============
0.0.2 2017/01/20 Allowed for gziped output files
0.0.1 2016/12/06 Initial version.
LICENCE
=======
2016, copyright <NAME> (<EMAIL>), sschmeier.com
tem... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2021 UT-Battelle, LLC and other Celeritas Developers.
# See the top-level COPYRIGHT file for details.
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""\
Generate file stubs for Celeritas.
"""
from datetime import datetime
import os
import os.path
import re
im... |
# encoding: utf-8
from __future__ import annotations
import datetime
import re
import logging
from typing import Any, Iterator, Optional, Union, Dict
import requests
from ckan.common import config
from ckan.common import _, json
log = logging.getLogger(__name__)
TIMEOUT = config.get_value('ckan.requests.timeout')... |
import gzip
import logging
from overrides import overrides
import numpy
import torch
from torch.nn.functional import embedding
import h5py
from allennlp.common import Params
from allennlp.common.checks import ConfigurationError
from allennlp.common.file_utils import cached_path
from allennlp.data import Vocabulary
fr... |
# 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... |
import plotly.graph_objects as go
import networkx as nx
from pathlib import Path
import os
import subprocess
import importlib.util
import copy
"""
This file handles the logic when a button is pressed on our GUI
__author__: <NAME>
__author__: <NAME>
__author__: <NAME>
__author__: <NAME>
__version__: 12/2/21
"""
BASE_DI... |
from importlib import import_module
from collections import defaultdict
from django.conf import settings as django_settings
from django.core.exceptions import ImproperlyConfigured
__all__ = [
'city_types','district_types',
'import_opts','import_opts_all','HookException','settings'
]
url_bases = {
'geo... |
import os.path
import numpy as np
from adaptiveleak.utils.constants import BT_FRAME_SIZE
from adaptiveleak.utils.data_utils import round_to_block, truncate_to_block
from adaptiveleak.utils.encryption import AES_BLOCK_SIZE
from adaptiveleak.utils.file_utils import iterate_dir, read_json
from adaptiveleak.utils.data_typ... |
import itertools
from abc import abstractmethod
from pathlib import Path
from typing import Dict, List, Optional, Union
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
from torch.utils.data import Dataset
import flair
from flair.data import DT, DT2, DataPair
from flair.datasets im... |
from config.config import REPEAT_DELAY, REPEAT_RATE
import time
import pyautogui
pyautogui.FAILSAFE = False
pyautogui.PAUSE = 0.0
# import pydirectinput
# pydirectinput.FAILSAFE=False
# pydirectinput.PAUSE = 0.0
import threading
# Managers sending inputs to manipulate the keyboard or mouse, or to print out statements ... |
import os
import time
from datetime import datetime
import numpy as np
import tensorflow as tf
from tqdm import trange
from inception.slim import slim
from shutil import copyfile
import importlib.util
import subprocess
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import libs.cylib as cylib... |
from inspect import signature
from typing import Dict, List, Callable, Any, cast, get_type_hints, Optional
import re
import time
class MockingError(Exception):
pass
class AnnotationError(Exception):
pass
class SCPIHandler:
"""
SCPI handlers contain *class* methods which are called at runtime when
... |
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.urls import reverse
from django.template.defaultfilters import slugify
# Create your models here.
class GeneralSettings(models.Model):
key = models.CharField(max_length=50)
value = models.CharField(max_length=50)
... |
import torch
import torch.nn as nn
import torch.nn.functional as F
#Encoder
class Encoder(nn.Module):
def __init__(self,vocab_size,embed_dim,max_len,num_layers,num_heads,ff_hid_dim,dropout=0.5):
super().__init__()
self.tok_embed = nn.Embedding(vocab_size,embed_dim)
self.pos_embed = nn.Embeddi... |
# ==============================================================================
# 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.apa... |
# -*- coding: utf-8 -*-
##--------------------------------------#
## Kvasir
##
## (c) 2010-2013 Cisco Systems, Inc.
##
## Evidence controller
##
## Author: <NAME> <<EMAIL>>
##--------------------------------------#
from skaldship.general import get_host_record, host_title_maker, host_a_maker, create_hostfilter_query
... |
from .core.promise import Promise
from .core.protocol import CodeAction
from .core.protocol import Command
from .core.protocol import Diagnostic
from .core.protocol import Error
from .core.protocol import Request
from .core.registry import LspTextCommand
from .core.registry import windows
from .core.sessions import Ses... |
import logging
import jsonpickle
import requests
import time
import os
from threading import Thread
from rasa.core.tracker_store import TrackerStore
from rasa.core.trackers import DialogueStateTracker, EventVerbosity
from sgqlc.endpoint.http import HTTPEndpoint
import urllib.error
logger = logging.getLogger(__name__... |
# Copyright 2017 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... |
# Copyright 2012-2017, Intel Corporation, All Rights Reserved.
#
# This software is supplied under the terms of a license
# agreement or nondisclosure agreement with Intel Corp.
# and may not be copied or disclosed except in accordance
# with the terms of that agreement.
#
# Author: <NAME>
#
import os
import sy... |
import theano.tensor as T
from .base import MergeLayer
__all__ = [
"autocrop",
"autocrop_array_shapes",
"ConcatLayer",
"concat",
"ElemwiseMergeLayer",
"ElemwiseSumLayer",
]
def autocrop(inputs, cropping):
"""
Crops the given input arrays.
Cropping takes a sequence of inputs and... |
import logging
class NullHandler(logging.Handler):
def emit(self, record):
pass
log = logging.getLogger('coapTransmitter')
log.setLevel(logging.ERROR)
log.addHandler(NullHandler())
import time
import threading
import random
import coapDefines as d
import coapException as e
import coapUtils... |
import torch
from torch.utils import data
from torch.utils.tensorboard import SummaryWriter
import math
import matplotlib.pyplot as plt
import numpy as np
import argparse
import os
import torch.nn as nn
import torch.nn.functional as F
import json
from utils import Cosine_Scheduler, DOSLoss
from ssl_mode import SimCLR,... |
#!/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... |
"""
Continue parcel-related cleaning and processing here,
save to S3, because parcel files are large.
Moving to historical 2006-2019 parcels means we only have parcel centroids.
Will NOT be using parcel polygons, which we have for 2014.
Parcels with different AINs can have the same geometry...is this because of... |
from contextlib import contextmanager
from datetime import datetime
from itertools import product
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import patch
import numpy as np
import pandas as pd
from lithops import Storage
from pyimzml.ImzMLWriter import ImzMLWriter
from sm.engi... |
from django.forms.models import inlineformset_factory
from .boundfield import CompositeBoundField
from .widgets import FormWidget, FormSetWidget
class BaseCompositeField(object):
"""
The ``BaseCompositeField`` takes care of keeping some kind of compatibility
with the ``django.forms.Field`` class.
"""... |
from datetime import datetime
from typing import Any, Dict, List, Optional, Type, Union
import pytz
from nig.endpoints import PHENOTYPE_NOT_FOUND, NIGEndpoint
from nig.endpoints._injectors import verify_phenotype_access, verify_study_access
from restapi import decorators
from restapi.connectors import neo4j
from resta... |
#!/usr/bin/env python
# coding: utf-8
"""
A functionally equivalent parser of the numpy.einsum input parser
"""
import itertools
from collections import OrderedDict
import numpy as np
__all__ = [
"is_valid_einsum_char", "has_valid_einsum_chars_only", "get_symbol", "gen_unused_symbols",
"convert_to_valid_eins... |
import gzip
import io
import math
import os
import re
from concurrent.futures import ThreadPoolExecutor
import numpy as np
from google.protobuf.message import DecodeError
from google.protobuf.text_format import MessageToString, Parse, ParseError
from tensorflow import GraphDef, NodeDef
from tensorflow.python.framework... |
"""
Python version of testlib, the library for creating checkers only.
This version in tested for Yandex.Contest only.
The original source of this library here (https://gist.github.com/niyaznigmatullin/211c6aba82ec9825abaa7b8375ce5618).
"""
import io
import atexit
import math
import sys
version = "0.1.0 (Jun 4 2020... |
from detectron2.data.datasets import register_coco_instances
from dafne.utils.sort_corners import sort_quadrilateral
from detectron2.utils.colormap import colormap
from detectron2.data.datasets.coco import load_coco_json
from detectron2.data import (
DatasetCatalog,
MetadataCatalog,
DatasetMapper,
trans... |
# author: DSCI_522_group_28
# date:
"""This script constructs various exploratory data visualizations,
and tables.
Usage: eda.py [--data_path=<data_path>] [--out_dir=<out_dir>]
Options:
[--data_path=<data_path>] The path to read the training data in from.
[--out_dir=<out_dir>] The path to save... |
from cdo import Cdo
from tempfile import mkstemp
import os
from flyingpigeon import config
from flyingpigeon.ocgis_module import call
from flyingpigeon.utils import sort_by_filename, get_variable
import logging
LOGGER = logging.getLogger("PYWPS")
def countries():
"""
:return: a list of all country codes.
... |
# Copyright 2021 ONDEWO GmbH
#
# 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, ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from filereader3db import *
import os
import numpy as np
class Vertex:
def __init__(self, x, y, z):
self.vertices = np.array([x, y, z, 1])
def scale_vertex(self, scale):
identity = np.identity(4)
for i in range(3):
identity[i][i] =... |
# Copyright (c) 2016, GohighSec
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.