gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
import datetime
from django.conf import settings
from django.core.cache import cache
from django.db import models
from django.db.models import Sum
from django.template import Context, loader
from django.utils.datastructures import SortedDict
from django.utils.translation import ugettext_lazy as _lazy
import commonwar... | |
"""Test service helpers."""
import asyncio
from collections import OrderedDict
from copy import deepcopy
import unittest
from unittest.mock import Mock, patch
import voluptuous as vol
import pytest
# To prevent circular import when running just this file
import homeassistant.components # noqa
from homeassistant impo... | |
import pandas as pd
import numpy as np
import itertools
import warnings
import sys
try:
import matplotlib.pyplot as plt
import seaborn as sns
except ImportError:
print('Importing hier_diff without matplotlib.')
import scipy.cluster.hierarchy as sch
from scipy.spatial import distance
from scipy import stat... | |
from core.himesis import Himesis
import uuid
class HState2CProcDef(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule State2CProcDef.
"""
# Flag this instance as compiled now
self.is_compiled = True
super(HS... | |
"""
A python class to represent a single comic, be it file or folder of images
"""
"""
Copyright 2012-2014 Anthony Beville
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/l... | |
# -*- coding: utf-8 -*-
import cherrypy
import datetime
import dateutil.parser
import errno
import json
import os
import pytz
import re
import string
import six
import girder
import girder.events
try:
from random import SystemRandom
random = SystemRandom()
random.random() # potentially raises NotImplemen... | |
#!/usr/bin/env python
###############################################################################
# A log search utility. #
# Includes some advanced options, including ranges, ORs, less than #
# and greater than. ... | |
"""Implement SeshetBot as subclass of ircutils3.bot.SimpleBot."""
import logging
import os
from io import StringIO
from datetime import datetime
from ircutils3 import bot, client
from .utils import KVStore, Storage, IRCstr
class SeshetUser(object):
"""Represent one IRC user."""
def __init__(self, nick... | |
import os.path
import numpy
from scipy import optimize, interpolate
from . import path as appath
from . import download as download
try:
import fitsio
fitsread = fitsio.read
except ImportError:
import astropy.io.fits as pyfits
fitsread= pyfits.getdata
import warnings
from periodictable import elements
t... | |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | |
import gzip
import json
from CommonServerPython import *
# IMPORTS
import urllib3
import csv
import requests
import traceback
import urllib.parse
from typing import Tuple, Optional, List, Dict
# Disable insecure warnings
urllib3.disable_warnings()
BATCH_SIZE = 2000
INTEGRATION_NAME = 'Recorded Future'
# taken from r... | |
from __future__ import unicode_literals
import datetime
import re
import uuid
from django.conf import settings
from django.db.backends.base.operations import BaseDatabaseOperations
from django.db.backends.utils import truncate_name
from django.utils import six, timezone
from django.utils.encoding import force_bytes, ... | |
"""
Mean log loss from 5-fold CV: 0.488150595136
"""
import copy
import itertools
import numpy as np
import lasagne
import math
import os
import theano
import theano.tensor as T
import time
from lasagne.layers import DenseLayer, DropoutLayer, InputLayer, get_all_params
from lasagne.nonlinearities import rectify, softm... | |
#!/usr/bin/env python
import re
# The number of minutes in an hour.
HOUR = 60
# Various patterns for matching time/date information.
REGEX_CLASSTIME = "([a-zA-Z]+)[\s+](\d*\d:\d\d[ap])-(\d*\d:\d\d[ap])"
REGEX_TIME = "(\d*\d):(\d\d)([ap])"
REGEX_DAY = "([A-Z][a-z]*)"
# The number of hours on a 12-hour clock.
MAX_HO... | |
"""Master server for lab-nanny
Collects data from the different nodes and makes it available to the
clients using websockets.
The functionality of the master server is to join the data from the
different nodes and make it available in two forms:
-- clients using websockets
-- store it in a database
To do this, the m... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import logging
import tempfile
import gzip
import shutil
import time
import csv
import copy
import sys
from mtgraphite import MTGraphiteClient
import json
import multiprocessing
import Queue
from crawler_exceptions import (EmitterUnsupportedFormat,
... | |
import aiohttp
from waterbutler.core import streams
from waterbutler.core import provider
from waterbutler.core import exceptions
from waterbutler.core.path import WaterButlerPath
from waterbutler.providers.owncloud import utils
from waterbutler.providers.owncloud.metadata import OwnCloudFileRevisionMetadata
class ... | |
"""
Support to interface with the Emby API.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.emby/
"""
import logging
import voluptuous as vol
from homeassistant.components.media_player import (
MediaPlayerDevice, PLATFORM_SCHEMA)
from h... | |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2010 Barry Schwartz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, me... | |
import sys
from json import loads
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
try:
from unittest import mock
except ImportError:
import mock
from django.conf import settings
from django.utils.translation import activate
from django.template.base import Template,... | |
import unittest
from test import test_support
import zlib
import random
# print test_support.TESTFN
def getbuf():
# This was in the original. Avoid non-repeatable sources.
# Left here (unused) in case something wants to be done with it.
import imp
try:
t = imp.find_module('test_zlib')
... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
DOCUMENTATION = """
---
module: kube
short_description: Manage Kubernetes Cluster
description:
- Create, replace, remove, and stop resources within a Kubernetes Cluster
version_added: "2.0"
options:
name:
required: false
default: null
description:
- The n... | |
"""Tests for binary operators on subtypes of built-in types."""
import unittest
from operator import eq, le, ne
from abc import ABCMeta
def gcd(a, b):
"""Greatest common divisor using Euclid's algorithm."""
while a:
a, b = b%a, a
return b
def isint(x):
"""Test whether an object is an instance... | |
"""
Peasauce - interactive disassembler
Copyright (C) 2012-2017 Richard Tew
Licensed using the MIT license.
"""
from dataclasses import dataclass
import io
import logging
import os
import struct
from typing import Any, IO, List, Optional, Tuple
from . import amiga
from . import atarist
from . import binar... | |
#!/usr/bin/env python
# Copyright (c) 2014-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under both the Apache 2.0 license (found in the
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
# in the COPYING file in the root directory of this source tree)... | |
# Copyright 2011 OpenStack Foundation
# Copyright 2013 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/LIC... | |
#-------------------------------------------------------------------------------
#
# Vector Geometry Manipulations
#
# Project: XML Metadata Handling
# Authors: Martin Paces <martin.paces@eox.at>
#
#-------------------------------------------------------------------------------
# Copyright (C) 2013 EOX IT Services Gmb... | |
from nose.tools import ok_, eq_, raises
from flask import Flask, request
from flask.views import MethodView
from flask.ext.admin import base
class MockView(base.BaseView):
# Various properties
allow_call = True
allow_access = True
@base.expose('/')
def index(self):
return 'Success!'
... | |
"""
Reports base classes. This reports module tries to provide an ORM agnostic reports engine that will allow nice reports
to be generated and exportable in a variety of formats. It seeks to be easy to use with query sets, raw SQL, or pure
python. An additional goal is to have the reports be managed by model instances ... | |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
"""
This module implements an interface to enumlib, Gus Hart"s excellent Fortran
code for enumerating derivative structures.
This module depends on a compiled... | |
from collections import OrderedDict
from bson import DBRef, ObjectId
from bson.errors import InvalidId
from django.utils.encoding import smart_str
from django.utils.translation import gettext_lazy as _
from mongoengine import Document, EmbeddedDocument
from mongoengine import fields as me_fields
from mongoengine.base ... | |
import sys
import os
import numpy as np
import torch
from torch import nn, optim
from torch.utils.data import DataLoader
from tqdm import tqdm
from argparse import SUPPRESS
try:
from apex import amp
except ImportError:
amp = None
from dataset import LMDBDataset
from pixelsnail import PixelSNAIL
from schedul... | |
# Copyright (c) 2011-2012 The Board of Trustees of The Leland Stanford Junior University
# Copyright (c) 2012 Barnstormer Softworks, Ltd.
import xmlrpclib
import jsonrpc
import logging
import datetime
import time
from foam.core.log import KeyAdapter
from foam.openflow.types import Port
import foam.core.allocation
... | |
import pickle
from flatdict import FlatDict
from openpnm.utils import NestedDict, sanitize_dict, Workspace
from openpnm.utils import logging
from openpnm.io import GenericIO
logger = logging.getLogger(__name__)
ws = Workspace()
class Dict(GenericIO):
r"""
Generates hierarchical ``dicts`` with a high degree of... | |
#!/usr/bin/env python
#
# esp-idf serial output monitor tool. Does some helpful things:
# - Looks up hex addresses in ELF file with addr2line
# - Reset ESP32 via serial RTS line (Ctrl-T Ctrl-R)
# - Run "make flash" (Ctrl-T Ctrl-F)
# - Run "make app-flash" (Ctrl-T Ctrl-A)
# - If gdbstub output is detected, gdb is automa... | |
import matplotlib.pyplot as plt
from matplotlib import dates
import numpy as np
import os
import sys
from pprint import pprint
from datetime import datetime
from datetime import timedelta
import copy
import calendar
import mysql.connector
timezone = -8
#database connection
cnx = mysql.connector.connect(user='root', p... | |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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... | |
"""
This module implements the base model class. All model things inherit from this class.
"""
from __future__ import print_function
from builtins import zip
from builtins import str
from builtins import range
from builtins import object
import h2o
import imp, traceback
from ..utils.shared_utils import can_use_pandas... | |
#
# Copyright (c) 2017 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... | |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import logging
from .base import BaseAction, plan, build_walker
from .base import STACK_POLL_TIME
from ..providers.base import Template
from stacker.hooks import utils
from ..exceptions import (
MissingPar... | |
#!/usr/bin/env python
import argparse
import os.path
import re
import subprocess
import sys
import threading
import traceback
import tkinter as tk
import tkinter.filedialog
import tkinter.messagebox
import tkinter.scrolledtext
import tkinter.simpledialog
from truce.catcher import Catcher
VERSION = [0, 2, 1]
ABANDON... | |
# -*- coding: utf-8 -*-
'''
IO data from/to multiple sensors
Written by Laurent Fournier, October 2016
'''
from copy import deepcopy
from multiprocessing import Process
from Queue import Queue
from threading import Timer, Thread
import os, sys
import argparse
import datetime
impor... | |
# Copyright 2015-2018 Internap.
#
# 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... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import inspect
import logging
import random
log = logging.getLogger()
DEFAULT_SHERIFF_DELAY = 20
DEFAULT_NUM_BULLETS = 5
DEFAULT_HEALTH = 5
MAX_SCENES = 350 # ~150 words per scene
# Initiatives
HIGH_INITIATIVE = 30
MEDIUM_INITIATIVE = 20
DEFAULT_INITIATIVE = 10
GUN_DAMAGE... | |
# 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 agreed to in... | |
# -*- coding: utf-8
from apis.specs import (RestartPolicy, DependencyPolicy)
from apis.specs import (ImSpec, Dependency, LogConfigSpec, ContainerSpec,
PodSpec, PodGroupSpec, AppSpec)
def test_ImSpec_smoke():
s = ImSpec()
assert s.CreateAt is None
assert s.Name == ""
def test_Dep... | |
# for the API Fetch
import urllib.request
import json
import sys
# for the socket check
import socket
import random
import time
#FIXED
#get a new blog from the frontier
def get_blog_from_frontier(host,port):
#connect to the frontier to get a socket to communicate with
connection_success = False
connection_success... | |
# -*- coding: utf-8 -*-
import logging
import pandas as pd
import numpy as np
from experiments.ctr_model import CTRModel
from hccf.utils.helpers import Timer
from sklearn.feature_extraction import FeatureHasher
from sklearn.pipeline import Pipeline
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.... | |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyrigh... | |
# Copyright 2015 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 GUI functionality
import Tkinter as tk
from tkFileDialog import askopenfilenames, asksaveasfilename
# Import internals
from .buttons import *
from .popups import *
# Import style
from . import theme
style_layerspane_normal = {"bg": theme.color4,
"width": 200}
style_layersheader = ... | |
"""A simple declarative layer for SQLAlchemy ORM.
SQLAlchemy object-relational configuration involves the usage of Table,
mapper(), and class objects to define the three areas of configuration.
declarative moves these three types of configuration underneath the
individual mapped class. Regular SQLAlchemy schema and O... | |
import os
import sys
import shutil
import tempfile
from cStringIO import StringIO
from nose.tools import ok_, eq_
import mock
from django.conf import settings
from django.core.cache import cache
from airmozilla.main.models import Event, Template, VidlySubmission, Picture
from airmozilla.manage import videoinfo
from ... | |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import with_statement
from twisted.python import log
from twisted.internet import defer
from twisted.internet.interfaces import IProtocolFactory
from twisted.internet.error import ConnectionDone
from t... | |
import json
import pandas as pd
import requests
from py2cytoscape.data.network_view import CyNetworkView
from ..util import util_networkx as nx_util
from ..util import util_dataframe as df_util
from .util_http import check_response
from . import BASE_URL, HEADERS
import warnings
warnings.warn('\n\n\n**** data.cynet... | |
# -*- coding: utf-8 -*-
import datetime
import os
import re
import time
import pytz
try:
import json
except ImportError:
try:
import simplejson as json
except ImportError:
from django.utils import simplejson as json
from twactor import cache, connection, json, log
class User(cache.Cache... | |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, David Hamp-Gonsalves
#
# 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 limitat... | |
import logging
import os
import pandas as pd
import numpy as np
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import matplotlib.colors as colors
from funfolding import binning, model, solution
from funfolding.visualization import visualize_classic_binning
from funfolding.visualizatio... | |
# Copyright 2013 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.
import cStringIO
import json
import logging
import os
import re
from lib.ordered_dict import OrderedDict
LOGGER = logging.getLogger('dmprof')
BASE_PATH =... | |
from __future__ import print_function, division
import math
import numpy as np
from bhc import bhc
class rbhc(object):
"""
An instance of Randomized Bayesian hierarchical clustering CRP
mixture model.
Attributes
----------
Notes
-----
The cost of rBHC scales as O(nlogn) and so should... | |
#!/usr/bin/env python
#
# Copyright 2015 by Justin MacCallum, Alberto Perez, Ken Dill
# All rights reserved
#
import numpy as np
import unittest
import os
from meld import vault, comm
from meld.remd import master_runner, ladder, adaptor
from meld import system
from meld.test.helper import TempDirHelper
from meld.util... | |
# coding: utf-8
"""
Cloudbreak API
Cloudbreak is a powerful left surf that breaks over a coral reef, a mile off southwest the island of Tavarua, Fiji. Cloudbreak is a cloud agnostic Hadoop as a Service API. Abstracts the provisioning and ease management and monitoring of on-demand clusters. SequenceIQ's Cloud... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020-2021 The SymbiFlow 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
#
# https://www.apache.org/licenses/LICE... | |
import logging
import os
import pysam
import sys
from svviz import commandline
from svviz import disambiguate
from svviz import debug
from svviz import datahub
from svviz import dotplots
from svviz import export
from svviz import flanking
from svviz import insertsizes
from svviz import remap
from svviz import summarys... | |
"""
Database API
(part of web.py)
"""
__all__ = [
"UnknownParamstyle", "UnknownDB", "TransactionError",
"sqllist", "sqlors", "reparam", "sqlquote",
"SQLQuery", "SQLParam", "sqlparam",
"SQLLiteral", "sqlliteral",
"database", 'DB',
]
import time, os, urllib, urlparse
try:
import datetime
except ImportErr... | |
"""
Author: Dr. Mohamed Amine Bouhlel <mbouhlel@umich.edu>
Some functions are copied from gaussian_process submodule (Scikit-learn 0.14)
This package is distributed under New BSD license.
"""
import numpy as np
from scipy import linalg, optimize
from copy import deepcopy
from smt.surrogate_models.surrogate_model impo... | |
import datetime
import mock
import pytest
import pandas as pd
import synapseclient
from genie.clinical import clinical
def createMockTable(dataframe):
table = mock.create_autospec(synapseclient.table.CsvFileTable)
table.asDataFrame.return_value = dataframe
return(table)
def table_query_results(*args):... | |
# -*- coding: utf-8 -*-
#
# Copyright 2018-2021 BigML
#
# 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 ... | |
# PyAlgoTrade
#
# Copyright 2011-2015 Gabriel Martin Becedillas Ruiz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | |
# Standard library
from math import log
import os
import sys
# Third-party
from astropy.io import fits
import astropy.units as u
import matplotlib.pyplot as plt
import numpy as np
from scipy.misc import logsumexp
from scipy.integrate import simps
from scipy.stats import norm
from tqdm import tqdm
import emcee
from emc... | |
import os
import sys
import re
import glob
import copy
import subprocess
"""
args:
- parallel: max number of parallel sessions mobatch will use. default=10.
- bin_path: path, if moshell/mobatch binaries are installed in a
non-standard location.
"""
class Amos:
def... | |
# coding=utf-8
"""
test
"""
import logging
import math
from struct import unpack, pack, calcsize
from pycolo import PROTOCOL_VERSION as v
from pycolo.codes import options as refOptions, opt_i, msgType
from pycolo.codes import codes as refCodes
from pycolo.codes import msgType as refType
from pycolo.request import reque... | |
#
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google 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 copyri... | |
from pipes import quote as shell_quote
from characteristic import attributes
from eliot import Message, MessageType, Field
from effect import (
sync_performer, TypeDispatcher, ComposedDispatcher, Effect,
)
from effect.twisted import (
make_twisted_dispatcher,
)
from effect.twisted import (
perform, d... | |
"""Async gunicorn worker for aiohttp.web"""
import asyncio
import logging
import os
import re
import signal
import ssl
import sys
import gunicorn.workers.base as base
from gunicorn.config import AccessLogFormat as GunicornAccessLogFormat
from aiohttp.helpers import AccessLogger, ensure_future
__all__ = ('GunicornWe... | |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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) 2012 Google Inc. All rights reserved.
# Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Szeged
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of so... | |
from unittest2 import TestCase
from whitepages.location import WhitePagesLocation
class TestWhitePagesLocation(TestCase):
def setUp(self):
self.basic_input = {
"results": [
{
"id": {
"key": "Location.efe46385-b057-40c3-8b67-f5a5278e0... | |
# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Jayesh Kariya <jayeshk@saltstack.com>`
'''
# Import Python Libs
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting import TestCase, skipIf
from salttesting.mock import (
MagicMock,
patch,
NO_MOCK,
NO_MOCK_REASON
)
fr... | |
#
#
# Copyright (C) 2007, 2011, 2012, 2013 Google 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 ... | |
#!/usr/bin/env python
#
import unittest
import os
import femagtools.bch
from io import open
import numpy as np
class BchReaderTest(unittest.TestCase):
def read_bch(self, filename):
testPath = os.path.join(os.path.split(__file__)[0], 'data')
if len(testPath) == 0:
testPath = os.path.jo... | |
# Copyright 2012 Michael Still and Canonical 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
#
# ... | |
'''
Attempt to implement synchronous optimizers for Keras models. A synchronous
optimizers averages the gradients across devices. This should result in more
consistent learning convergence rate. An alternative popular implementation is
via Horovod.
Note, the current implementation might not be working correctly.
'''
f... | |
#Pyjsdl - Copyright (C) 2013 James Garnon <https://gatc.ca/>
#Released under the MIT License <https://opensource.org/licenses/MIT>
from pyjsdl.pyjsarray import BitSet
from pyjsdl.color import Color
import sys
if sys.version_info < (3,):
from pyjsdl.util import _range as range
__docformat__ = 'restructuredtext'
... | |
# openstack_dashboard.local.dashboards.project_nci.vlconfig.forms
#
# Copyright (c) 2015, NCI, Australian National University.
# 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... | |
"""Tools to extract features."""
import logging
import time
from typing import Tuple, Dict, Any, List, Optional
import cv2
import numpy as np
from opensfm import context, pyfeatures
logger = logging.getLogger(__name__)
class SemanticData:
segmentation: np.ndarray
instances: Optional[np.ndarray]
labels... | |
from nose.tools import eq_
import hashlib
import json
import nose
from js_helper import _do_real_test_raw as _js_test
from validator.testcases.markup.markuptester import MarkupParser
import validator.testcases.jetpack as jetpack
from validator.errorbundler import ErrorBundle
from validator.xpi import XPIManager
def... | |
# Copyright 2015 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 warnings
from contextlib import contextmanager
import pytest
import capnp
import os
import platform
import test_regression
import tempfile
import pickle
import mmap
import sys
this_dir = os.path.dirname(__file__)
@pytest.fixture
def all_types():
return capnp.load(os.path.join(this_dir, "all_types.capnp")... | |
"""Conversion tool from CTF to FIF
"""
# Author: Eric Larson <larson.eric.d<gmail.com>
#
# License: BSD (3-clause)
import os
from os import path as op
import numpy as np
from ...utils import verbose, logger
from ...externals.six import string_types
from ..base import _BaseRaw
from ..utils import _mult_cal_one, _bl... | |
import sklearn
import sklearn.ensemble
import gc
from sklearn.preprocessing import StandardScaler
import numpy as np
class KerasWrap(object):
""" A wrapper that allows us to set parameters in the constructor and do a reset before fitting.
"""
def __init__(self, model, epochs, flatten_output=False):
... | |
# Copyright 2012, Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.
"""VTGateCursor, and StreamVTGateCursor."""
import itertools
import operator
import re
from vtdb import base_cursor
from vtdb import dbexceptions
write_sql_pattern... | |
################################################################################
# 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... | |
# Copyright (c) 2016 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
Natural Neighbor Verification
=============================
Walks through the steps of Natural Neighbor interpolation to validate that the algorithmic
approach taken in MetPy is... | |
#######################################################
#
# ***** NOTE *****
#
# This file hasn't been updated since some changes were made in the way
# Midi() works. Basically, rather than using MidiInput.devices(),
# you need to explicitly pull in the MIDI hardware you're using, e.g.
#
# m = MidiPypmHardware()... | |
from __future__ import print_function, unicode_literals
import sys
import types
import traceback
# Test imports.
import time
droid = None
skip_gui = False
fOutName = True
# tests for python modification for android {{{1
def test_029_isfile(): # issue #29 {{{1
import os
# FIXME: dete... | |
"""Build base image and pod runtime.
The construction of a pod is divided into two phases:
* Base image construction: This sets up the basic environment of a pod.
Notably, /usr/sbin/pod-exit and /var/lib/pod/exit-status.
* Pod runtime: This includes systemd unit files and exit status.
"""
__all__ = [
# Expose... | |
'''
Test correctness of matvec for various cases.
'''
import dynamite_test_runner as dtr
import numpy as np
import hamiltonians
from dynamite import config
from dynamite.msc_tools import msc_dtype
from dynamite.operators import identity, sigmax, sigmay, index_sum, index_product
from dynamite.subspaces import Full, Pa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.