text stringlengths 6.04k 39.5k |
|---|
from sqlalchemy import create_engine
import psycopg2
import datetime
import time
import pandas as pd
import requests
import configparser
from src.withings_api_example import config
import json
CLIENT_ID = config.get('withings_api_example', 'client_id')
CUSTOMER_SECRET = config.get('withings_api_example', 'cu... |
from __future__ import division
import numpy as np
import sys
sys.path.append('../lib/pints_e8f8fe79ad068a41af90170a9bf89227955f5645')
import pints
class LeakModel(pints.ForwardModel):
def __init__(self, voltage_trace):
self._V = voltage_trace
def simulate(self, parameters, times):
g, E = para... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: <NAME>
"""
Boundary
========
To do:
* Define boundary conditions for hipims model
-----------
"""
# Created on Tue Mar 31 16:05:27 2020
import warnings
import numpy as np
import pandas as pd
import matplotlib.patches as mplP
from . import spatial_analysis... |
from .canvas import Canvas3D
import wx, os.path as osp, platform
import math
import numpy as np
def make_bitmap(bmp):
img = bmp.ConvertToImage()
img.Resize((20, 20), (2, 2))
return img.ConvertToBitmap()
class MCanvas3D(wx.Panel):
def __init__( self, parent, scene=None):
wx.Panel.__init__(self,... |
epsilon = 10**-9
class Matrix:
def __init__(self,filePath = None):
self.rows = 0
self.collums = 0
self.matrix = self.initizalizeMatrix(self.rows,self.collums)
if(filePath != None):
self.readFromFile(filePath)
def __add__(self,matrix):
newMatrix = self.initizalizeMatrix(self.rows,self.collums)
newOb... |
import torch
import math
from torch.optim import Optimizer
from torch.optim.lr_scheduler import _LRScheduler
import numpy as np
from torch.optim.optimizer import Optimizer
# decoder_optim = torch.optim.Adam(model.decoder.parameters(), amsgrad=True)
# decoder_optim = torch.optim.Adam(model.decoder.parameters())
# deco... |
import numpy as np
from numpy import sin, cos
from scipy.optimize import leastsq, brentq
from scipy.linalg import eig, inv
#### Global Constants ####
G_SI = 6.67384e-11
C_SI = 299792458.0
PI = 3.141592653589793
MSUN_SI = 1.9885469549614615e+30
PC_SI = 3.085677581491367e+16
##########################
def symRatio(m1, ... |
#!/usr/bin/env pypy
from job import ID
from job import Job
from job import Task
from job import Attempt
from commons import timeStr
from math import floor, ceil
from operator import attrgetter
from operator import itemgetter
'''
Store a simulation history.
'''
class History:
def __init__(self, filename='history.lo... |
#!/usr/bin/env python
import argparse
import datetime
import os
import psycopg2
import subprocess
import sys
from six.moves import configparser
from sqlalchemy import create_engine
from sqlalchemy import MetaData
from sqlalchemy.engine.url import make_url
now = datetime.datetime.utcnow
metadata = MetaData()
def ... |
from __future__ import (print_function, division,
absolute_import, unicode_literals)
from matplotlib import pyplot as plt
import numpy as np
import random
import pickle
from . import c_evolve
class Lattice(object):
"""Lattice object.
Attributes
----------
"""
... |
# MIT License
#
# Copyright (c) 2017 Laboratory for Computational and Statistical Learning
#
# authors: <NAME>, <NAME>
# email: <EMAIL>
# Website: http://lcsl.mit.edu
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),... |
#
# Copyright The NOMAD Authors.
#
# This file is part of NOMAD.
# See https://nomad-lab.eu for further info.
#
# 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/lic... |
import os
import sys
import tensorflow as tf
import numpy as np
import imageio
import json
# Misc utils
def img2mse(x, y): return tf.reduce_mean(tf.square(x - y))
def mse2psnr(x): return -10.*tf.log(x)/tf.log(10.)
def to8b(x): return (255*np.clip(x, 0, 1)).astype(np.uint8)
# Positional encoding
class Embedder... |
from torchvision import datasets
import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as func
import torch.optim as optim
import numpy as np
import time
import matplotlib.pyplot as plt
import matplotlib
import os
import cv2
from sklearn.decomposition import PCA
from re_id import re_id_query... |
import bpy
from gpu.shader import from_builtin
from mathutils import Vector
from gpu_extras.batch import batch_for_shader
from itertools import chain
from collections import deque
# from time import perf_counter
from bgl import glLineWidth, glEnable, glDisable, GL_BLEND
import blf
bl_info = {
"name": "H... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import math
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
from torch.nn.init import constant_
import torch.nn.functional as F
from itertools import repeat
import collections.abc
def _ntuple(n):
"""Translate a float value to n-dim tuple
Examples
--------
>>> a = _ntuple(2... |
# -*- coding: utf-8 -*-
"""
MCMC
====
Provides several functions that allow for *PRISM* to be connected more easily
to MCMC routines.
"""
# %% IMPORTS
# Built-in imports
from inspect import isfunction
import warnings
# Package imports
import e13tools as e13
import numpy as np
from numpy.random import multivariate_... |
# <NAME>
# Introduction to Conputer Science
# Tain
# Turned backed combat GUI
#
#
# 180 y
#
#
#############################
# 260 x
# import all the things
import tkinter as tk
from random import randint
from tkinter import messagebox
import time
def OpenImg(Name,x,y,n=1): # define a function that opens a... |
# Copyright 2015 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... |
import re
# from nltk import ViterbiParser
from fo_planner import Operator
from fo_planner import FoPlanner
# from learners.Grammar import grammar
# from learners.WhatLearner import ViterbiParser
_then_gensym_counter = 0
def gensym():
global _then_gensym_counter
_then_gensym_counter += 1
return 'QMthen... |
import os
from time import time
import numpy as np
import pandas as pd
import scipy
from sklearn.ensemble import RandomForestRegressor
from sklearn.tree import DecisionTreeRegressor
from sklearn.model_selection import train_test_split,cross_val_score,StratifiedKFold
from sklearn.metrics import r2_score,mean_absolute_... |
import torch
import numpy as np
from PIL import Image
import streamlit as st
from vietocr.tool.config import Cfg
from vietocr.tool.predictor import Predictor
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
import configs as cf
from backend.kie.kie_utils import *
from backend.kie.kie_utils ... |
import numpy as np
from numpy.testing import assert_allclose
import pytest
from pytest_lazyfixture import lazy_fixture
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
import tempfile
import tensorflow as tf
from typing import List, Union
from alibi.explainers imp... |
import clingo
from csp.astutil import match
AUX = "aux"
class ConstraintAtom(object):
"""
Representation of a constraint atom.
"""
def __init__(self, elements, guard, literal, term):
self.elements = elements
self.guard = guard
self.literal = literal
self.term = term
... |
import sys, pprint, json
from typing import Optional
import ae_backend
from ..utils.num_digits import num_digits
from .. import virus
from . import name_passage
from .name_generator import NameGenerator
# ======================================================================
sPassages = ["cell", "egg", "reassortant"]... |
# Copyright 2022 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# Copyright 2014 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
import os
TAG = 'version_22'
HASH = 'c95b65f21a54835b5623236b15bbe54... |
import itertools
import numbers
import random
import sys
from unittest import TestCase, TestSuite
try:
# python 3.3+
from collections.abc import Hashable
except ImportError:
from collections import Hashable
import six
class ExtendedTestCase(TestCase):
def assertMappingEqual(self, m1, m2, msg=None):
... |
import os
import discord
import mongoengine
from cogs.utils.tasks import Tasks
from data.case import Case
from data.cases import Cases
from data.filterword import FilterWord
from data.guild import Guild
from data.tag import Tag
from data.user import User
from data.giveaway import Giveaway
from discord.ext import comma... |
# Copyright 2020 The Magenta 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 argparse
import torch
import sys
import os
import pickle
import copy
import logging
import shutil
import datetime
import collections
from tqdm import tqdm
from pathlib import Path
from typing import List
from collections import defaultdict
import torch.distributed as dist
from torch.nn.parallel import Distribu... |
'''
mod on Jan 17, 2019
@author: trevaz (<EMAIL>)
---------------------------------------------------------------------
fctlib
---------------------------------------------------------------------
'''
#################################################################################
# IMPORTS
########################... |
"""Multi-object Tracking evaluation code."""
import argparse
import json
import time
from functools import partial
from multiprocessing import Pool
from typing import Callable, Dict, List, Tuple, Union
import motmetrics as mm
import numpy as np
from ..common.io import open_write_text
from ..common.logger import logge... |
'''
Training script for ImageNet
Copyright (c) <NAME>, 2017
'''
from __future__ import print_function
import argparse
import os
import shutil
import time
import random
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.data a... |
import numpy as np
import time
import pprint
import csv
from collections import OrderedDict
from keras import backend as K
import tensorflow as tf
import os
if not os.path.exists('weights/'):
os.makedirs('weights/')
if not os.path.exists('logs/'):
os.makedirs('logs/')
class StateSpace:
'''
State S... |
"""
Run a reduction workflow.
:func:`process_template` evaluates a template for the given input values.
:func:`find_calculated` returns the list the template nodes that have already
been calculated and cached for the given input values.
:func:`fingerprint_template` returns the unique fingerprint for each node
in the... |
# coding: utf-8
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Tests for files.py"""
import os
import os.path
import pytest
from coverage import files
from coverage.files import (
TreeMatcher, FnmatchM... |
'''
Some useful tools in training process
'''
import torch
import cv2
import os
import numpy as np
import math
import pickle
from scipy.ndimage import gaussian_filter1d
import torch.nn.functional as F
import torchvision.transforms as T
import torchvision.transforms.functional as tf
from tsnecuda import TSN... |
# emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
# ex: set sts=4 ts=4 sw=4 et:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the datalad package for the
# copyright and license terms.
#
# ## ### ### ... |
# ------------------------------------------------------------------------------
#
# Copyright (c) 2005-2013, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the condit... |
# Copyright 2021 The NetKet 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 ... |
"""Utilities for configuring ansible runtime environment."""
import json
import logging
import os
import pathlib
import re
import subprocess
import sys
from functools import lru_cache
from typing import Any, Dict, List, Optional, Tuple, Type, Union
import packaging
import tenacity
from packaging import version
from a... |
# Copyright (c) 2006-2011, 2013-2014 LOGILAB S.A. (Paris, FRANCE) <<EMAIL>>
# Copyright (c) 2011-2014 Google, Inc.
# Copyright (c) 2012 <NAME> <<EMAIL>>
# Copyright (c) 2013-2020 <NAME> <<EMAIL>>
# Copyright (c) 2014 <NAME> <<EMAIL>>
# Copyright (c) 2014 <NAME> <<EMAIL>>
# Copyright (c) 2015 <NAME> <<EMAIL>>
# Copyrigh... |
import asyncio
from tortoise.fields import (
IntField,
CharField,
BooleanField,
ForeignKeyField,
ManyToManyField,
)
from tortoise.models import ModelMeta
from tortoise.exceptions import DoesNotExist
from typing import Coroutine, List, Optional, Union, Tuple
import re
import time
from statistics impo... |
"""Python library for accessing xkcd.com.
This is a Python library for accessing and retrieving links to comics from
the xkcd webcomic by <NAME>. It is NOT endorsed or made by him, it's
an entirely independent project.
It makes use of the JSON interface to Randall's site to retrieve comic data.
Both Python 2 and Pyth... |
from __future__ import division
import pandas as pd
import numpy as np
from functools import wraps, partial
import re
import os
from glob import glob
from math import ceil
from toolz import merge, dissoc
from itertools import count
from operator import getitem
from ..compatibility import BytesIO, unicode, range, appl... |
# Copyright 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 agreed to... |
"""The IPython kernel implementation"""
import asyncio
from contextlib import contextmanager
from functools import partial
import getpass
import signal
import sys
from IPython.core import release
from ipython_genutils.py3compat import builtin_mod, PY3, unicode_type, safe_unicode
from IPython.utils.tokenutil import to... |
# -*- coding: utf-8 -*-
"""Module to determine the pywikibot version (tag, revision and date)."""
#
# (C) Merlijn 'valhallasw' <NAME>, 2007-2014
# (C) xqt, 2010-2019
# (C) Pywikibot team, 2007-2019
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, division, unicode_literals
... |
#------------------------------------------------------------------------------
# Copyright (c) 2013-2021, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------... |
#!/usr/bin/env python
import os
import warnings
import tempfile
import shutil
import numpy as np
from numpy import testing
import sympy as sm
import sympy.physics.mechanics as me
from scipy.integrate import odeint
theano = sm.external.import_module('theano')
Cython = sm.external.import_module('Cython')
from ..system... |
# Copyright 2019 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
# Created By: <NAME>
# Created On: 2009-03-03
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html... |
# 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 parlai.mturk.core.worlds import MTurkOnboardWorld
from parlai.mturk.core.agents import TIMEOUT_MESSAGE
from parlai.core.utils import Offensi... |
# -*- coding: utf-8 -*-
import os
import gzip
import json
import pickle
import random
from Cluster import Cluster
import argparse
import numpy as np
import pandas as pd
'''
读取数据,转为pickle,并完成加载数据功能。
'''
class DatasetLoader(object):
def load(self):
"""Minimum condition for dataset:
* All users ... |
'''
This module implements :class:`IrregularlySampledSignal`, an array of analog
signals with samples taken at arbitrary time points.
:class:`IrregularlySampledSignal` inherits from :class:`basesignal.BaseSignal`
which derives from :class:`BaseNeo`, from :module:`neo.core.baseneo`,
and from :class:`quantities.Quantity... |
import os
import attr
import random
import paho.mqtt.client
import urllib.request
import asyncio
import aiohttp
from ._common import log, kw_only
from . import _util, _exception, _session, _graphql, _events
from typing import AsyncGenerator, Optional, List
try:
import socks
from yarl import URL
except ImportE... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
from abc import ABCMeta, abstractmethod
from bisect import bisect_left
from dataclasses import dataclass
from mido.frozen import FrozenMessage
from pushpluck import constants
from pushpluck.base import MatchException
from pushpluck.config import ChannelMode, Config, PlayMode, VisState
from pushpluck.midi import is_note... |
import json
import shutil
import subprocess
import uuid
from pathlib import Path
from typing import Union, Optional, Set
import click
import yaml
from bs4 import BeautifulSoup
from sphinx.cmd.build import main as sphinx_build_cmd
from sphinx.ext.apidoc import main as sphinx_apidoc_cmd
from cli.helpers import (
is... |
# coding=utf-8
# Created by Meteorix at 2019/7/13
import logging
import multiprocessing
import os
import threading
import time
import uuid
import weakref
import pickle
from queue import Queue, Empty
from typing import List
from redis import Redis
from .managed_model import ManagedModel
TIMEOUT = 1
TIME_SLEEP = 0.001... |
import re
import random
from datetime import datetime, timedelta
import time
from functools import reduce
import traceback
import struct
import json
import urllib
from hashlib import blake2b
# Copied and Modified from Jumpscale
# TODO: Remove
def blake2(s, digest_size=32):
if isinstance(s, str): # check string di... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import contextlib
import pathlib
import re
import sys
import inspect
import os
from collections import OrderedDict
from operator import itemgetter
import numpy as np
__all__ = ['register_reader', 'register_writer', 'register_identifier',
'id... |
import numpy
try:
import scipy.sparse
_scipy_available = True
except ImportError:
_scipy_available = False
import cupy
from cupy import core
from cupy import cusparse
from cupyx.scipy.sparse import base
from cupyx.scipy.sparse import csc
from cupyx.scipy.sparse import csr
from cupyx.scipy.sparse import dat... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 ... |
#
# 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
# ... |
from __future__ import unicode_literals
import copy
from six import string_types
from six import text_type
from taggit.forms import TagWidget
from modelcluster.forms import ClusterForm, ClusterFormMetaclass
from django.template.loader import render_to_string
from django.template.defaultfilters import addslashes
fro... |
from numpy import *
import math
import pickle
import time
from pprint import pprint
import re
import os
import sys
#**********************PARAMETERS SETTING**************************************************
# Replace the parameters of def __init__ with the following ones according to the dataset.
# Please be noted that... |
import os
from decimal import Decimal
import subprocess
from .helper import thirdparty_binary, load_scp, edit_distance, log_kaldi_errors
from .exceptions import KaldiProcessingError, CorpusError
from .multiprocessing import run_mp, run_non_mp
from .trainers import MonophoneTrainer
from .config import FeatureConfig
fr... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#
from collections import OrderedDict
import os
import torch
from fairseq.data import (
IndexedCachedDataset,
IndexedDataset,
IndexedRawTextDataset,
LanguagePairDataset,
NoisingDataset,
RoundRobinZipD... |
import pytest
import numpy as np
from scipy import signal
from numpy.testing import (assert_array_equal, assert_array_almost_equal,
assert_equal)
import axopy.pipeline as pipeline
from axopy.features.classes import _FeatureBase
np.random.seed(12345)
rand_data_1d = np.random.rand(100)
rand... |
# coding: utf-8
# Copyright (c) Materials Virtual Lab.
# Distributed under the terms of the BSD License.
"""
Created on April 01, 2019
"""
__author__ = "<NAME>"
__copyright__ = "Copyright 2019, The Materials Project"
__version__ = "0.1"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__date__ = "April 11, 2019"
from ... |
# vim: set fileencoding=utf-8 :
import os
import re
import locale
import json
import ctypes
import sys
import warnings
from pkg_resources import get_distribution, DistributionNotFound
import xml.etree.ElementTree as ET
try:
import pathlib
except ImportError:
pathlib = None
if sys.version_info < (3,):
impo... |
__all__ = ('MessageType', 'MessageActivityType')
from scarletio import any_to_any
from ..bases import PreinstancedBase, Preinstance as P
from ..utils import sanitize_mentions
from ..activity import ACTIVITY_TYPES
class MessageActivityType(PreinstancedBase):
"""
Represents a ``MessageActivity``'s type.
... |
# !/usr/bin/python
# -*- coding: utf-8 -*-
# FollowTcpStream - Comparable to Wireshark's functionality but including un-chunking and un-gzipping.
#
# Author: <NAME>
# Credits: Influenced by <NAME>aloneys PCAP_tools (https://github.com/Beercow/ProcDOT-Plugins/tree/master/PCAP_tools)
#
# Dependencies:
# - TcpFl... |
import torch
import torch.nn as nn
import torch.optim as optim
import time, functools, itertools, os, argparse
import logging
import numpy as np
from tensorboardX import SummaryWriter
from tqdm import tqdm
from utils import unserialize, serialize, divide_dataset
from evaluate import topNRecall, multi_mean_measure
from ... |
import sys
from configparser import ConfigParser
import pathlib
import collections
import functools
import importlib
import attr
from beastling.util.misc import sanitise_tree, all_subclasses
from beastling.util import log
from beastling.clocks import * # Make sure all clocks are imported.
from beastling.clocks.basec... |
# Copyright 2019-2020 Spotify AB
#
# 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 writin... |
# Copyright 2011 OpenStack, LLC.
# Copyright 2012 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/LICENSE-2.0... |
# $Id: frontmatter.py 8117 2017-06-18 23:38:18Z milde $
# Author: <NAME>, <NAME> <<EMAIL>>
# Copyright: This module has been placed in the public domain.
"""
Transforms related to the front matter of a document or a section
(information found before the main text):
- `DocTitle`: Used to transform a lone top level sec... |
#!/usr/bin/python
# Copyright 2017-2020 IBM Corp. 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... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: proxysql_query_rules
versi... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import math
class Color (object):
def to_rgb(self):
raise Exception('Must implement to_rgb() in subclasses')
class RGB (Color):
def __init__(self, r, g, b):
self.r = r
self.g = g
self.b = b
def to_r... |
import mxnet as mx
import numpy as np
from itertools import cycle
from mxnet.image import ForceResizeAug
from mxnet.io import DataDesc
from models.loss import pairwise_distance
def get_datasets(train_image_files, test_image_files, boxes, data_shape, use_crops, scale_image_data, use_aug=True,
with_p... |
import asyncio
import logging
import uuid
import warnings
from asyncio import TimeoutError
from collections import defaultdict, deque
import dask
from tornado.ioloop import PeriodicCallback
from distributed.utils_comm import retry_operation
from .metrics import time
from .utils import log_errors, parse_timedelta
from... |
"""Calculate statistics for a CheXpert dataset.
It works on the DataFrame, not on the CheXPertDataset class, to allow statistics on filtered data.
Example::
import chexpert_dataset as cxd
import chexpert_statistics as cxs
# Get a ChexPert dataset
cxdata = cxd.CheXpertDataset()
cxdata.fix_dataset... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Deep IV estimator and related components."""
import numpy as np
import keras
from .cate_estimator import BaseCateEstimator
from keras import backend as K
import keras.layers as L
from keras.models import Model
# TODO: ma... |
from .Exporter import Exporter
from ..python2_3 import asUnicode
from ..parametertree import Parameter
from ..Qt import QtGui, QtCore, QtSvg, QT_LIB
from .. import debug
from .. import functions as fn
import re
import xml.dom.minidom as xml
import numpy as np
translate = QtCore.QCoreApplication.translate
__all__ = ['... |
import json
import os
import shutil
import ssl
import subprocess
import traceback
import uuid
import zipfile
from pathlib import Path
from flask import Flask, request, jsonify, send_file, after_this_request, make_response
from werkzeug.utils import secure_filename
import yaml
import hashlib
import boto3
import botocor... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
from __future__ import unicode_literals
from nose.tools import *
import pygraphviz as pgv
from os import linesep
class TestGraph:
def setUp(self):
self.null = pgv.AGraph()
self.K1 = pgv.AGraph()
self.K1.add_node(1)
self.K3 = pgv.AGraph()
self.K3.add_edges_from([(1,2),(1,3),(... |
"""Transducer speech recognition model (pytorch)."""
from collections import Counter
from dataclasses import asdict
from distutils.util import strtobool
import logging
import math
import chainer
import torch
from espnet.nets.asr_interface import ASRInterface
from espnet.nets.pytorch_backend.nets_utils import get_sub... |
"""
pygluu.containerlib.persistence.couchbase
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module contains various helpers related to Couchbase persistence.
"""
import json
import logging
import os
from functools import partial
from typing import NoReturn
import requests
from requests_toolbelt.adapters.host_header... |
#
# Copyright (c) 2021 salesforce.com, inc.
# All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
#
"""
Metrics and utilities for evaluating forecasting models in a continuous sense.
"""
from enum imp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_mysql_grants_generator is used to test the mysql grants generator
copyright: 2015, (c) sproutsocial.com
author: <NAME> <<EMAIL>>
"""
# This script requires the following packages to be installed:
# mock==1.0.1
# PyYAML==3.11
# python-ldap==2.4.19
from ... |
# emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the NiBabel package for the
# copyright and license terms.
#
### ### ### #... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import ast
import os
import pytest
import spack.directives
import spack.paths
import spack.util.package_hash as ph
from ... |
"""
Code for Pathak et al's Context Encoder
"""
import numpy as np
import tensorflow as tf
#import tensorflow.contrib
import tensorflow.keras.backend as K
import warnings
from patchwork._augment import augment_function
from patchwork.loaders import _image_file_dataset
from patchwork._util import _load_im... |
#!/usr/bin/python3
from matplotlib import pyplot as plt
from matplotlib import colors
from numpy.core.fromnumeric import std
from scipy import interpolate
from pathlib import Path
from xes_dataset import XesDataset as xs
from xes_signal_analysis import calc_photon_accumulation_rate as photon_rate
import xes_signal_ana... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.