gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
from django.db.models import Count
from migrator.tests.queries.models import SimpleObj
from migrator.tests.queries.base import BaseMockedCDMSApiTestCase
class SingleObjMixin(object):
def setUp(self):
super(SingleObjMixin, self).setUp()
self.obj = SimpleObj.objects.skip_cdms().create(
... | |
# Copyright (c) 2012 NetApp, 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... | |
import datetime
from math import (
acos,
asin,
atan2,
cos,
degrees,
fabs,
floor,
radians,
sin,
sqrt,
tan,
)
from typing import Dict, Optional, Tuple, Union
import pytz
from astral import Depression, Observer, SunDirection, now, today
__all__ = [
"sun",
"dawn",
... | |
# 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 (t... | |
"""
Set operations for arrays based on sorting.
Notes
-----
For floating point arrays, inaccurate results may appear due to usual round-off
and floating point comparison issues.
Speed could be gained in some operations by an implementation of
`numpy.sort`, that can provide directly the permutation vectors, thus avoi... | |
import regex as re
from dateparser.utils import get_logger
class LanguageValidator:
logger = None
VALID_KEYS = [
'name', 'skip', 'pertain', 'simplifications', 'no_word_spacing', 'ago', 'in',
'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday',
'january', 'febr... | |
# Create dummy variables for categorical features with less than 5 unique values
import pandas as pd
from sklearn.preprocessing import LabelEncoder
import gc
import datetime
import calendar
import xgboost as xgb
# import logger.py
from logger import logger
# set iteration
iteration = '3'
logger.info('Start data_pre... | |
# 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... | |
import os
import random
import threading
import socket
import time
import re
from TCAction import TCActionBase
from TCAction import PerformanceTCBase
from NativeLog import NativeLog
def calc_hash(index):
return (index & 0xffffffff) % 83 + (index & 0xffffffff) % 167
def verify_data(data, start_index):
for i... | |
# Authors: Mainak Jas <mainak@neuro.hut.fi>
# Teon Brooks <teon.brooks@gmail.com>
#
# License: BSD (3-clause)
import os
import os.path as op
import glob
import warnings
import shutil
from nose.tools import assert_true, assert_equal, assert_raises
from mne import Epochs, read_events, pick_types, read_evokeds
... | |
# -*- coding: utf-8 -*-
# Copyright 2017, Digital Reasoning
#
# 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... | |
#
# 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... | |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import re
import pytest
from hyputils.memex.util import document_claims
from hyputils.memex.util.document_claims import doi_uri_from_string
class TestDocumentURIsFromLinks(object):
def test_it_ignores_href_links_that_match_the_claimant_uri(self)... | |
# -*- coding: utf-8 -*-
"""
pygments.lexers.text
~~~~~~~~~~~~~~~~~~~~
Lexers for non-source code file types.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from bisect import bisect
from pygments.lexer import Lexer, LexerC... | |
"""Support for OwnTracks."""
from collections import defaultdict
import json
import logging
import re
from aiohttp.web import json_response
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components import mqtt
from homeassistant.const import CONF_WEBHOOK_ID
from homeassistant.cor... | |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/automl_v1beta1/proto/annotation_payload.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _mess... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
import logging
import tempfile
import time
import math
import re
import urllib
import json
import codecs
import csv
import traceback
import xml.etree.ElementTree as et
from itertools import izip
import gzip
from lib.stemutil import stem
import mallet_lda
... | |
# Copyright 2016 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 applicable ... | |
# https://github.com/UCB-ICSI-Vision-Group/decaf-release/wiki/imagenet
import os, sys
import Image
from utils import tic, toc
import numpy as np
from skimage import io
import threading
import Queue
from multiprocessing import Process, JoinableQueue
from multiprocessing import Queue as ProcQueue
import time
###########... | |
#
# Copyright (c) SAS Institute Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | |
"""Copyright 2009 Chris Davis
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
dist... | |
"""
POZ Utility Functions and Classes
"""
import numpy as np
import math
RAD2DEG = 180.0 / np.pi
DEG2RAD = np.pi / 180.0
def calc_axes_rotation_mat(roll_phi, pitch_theta, yaw_psi):
"""
Calculate 3D Euler angle rotation matrix.
Creates matrix for rotating AXES.
With axis pointing out, positive rotati... | |
"""
======================================
Generalized hyperfine component fitter
======================================
.. moduleauthor:: Adam Ginsburg <adam.g.ginsburg@gmail.com>
"""
import numpy as np
import model
import fitter
from astropy import units as u
# should be imported in the future
ckms = 2.99792458e5
c... | |
##########################################################################
#
# Copyright (c) 2013, Image Engine Design 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:
#
# * Red... | |
import ctypes
import struct
import unittest
import logging
import time
from subprocess import Popen
from os import path, kill
import snap7
from snap7.snap7exceptions import Snap7Exception
from snap7.snap7types import S7AreaDB, S7WLByte, S7DataItem
from snap7 import util
logging.basicConfig(level=logging.WARNING)
ip... | |
#!/usr/bin/python
import sys
import os
import argparse
from ete2 import Tree
try:
print "importing image"
import Image
import ImageFont
import ImageDraw
import ImageMath
except ImportError:
print "importing image from pil"
from PIL import Image
from PIL import ImageFont
from PIL ... | |
"""Tests for the HomeKit component."""
from __future__ import annotations
import asyncio
import os
from unittest.mock import ANY, AsyncMock, MagicMock, Mock, patch
from pyhap.accessory import Accessory
from pyhap.const import CATEGORY_CAMERA, CATEGORY_TELEVISION
import pytest
from homeassistant import config as hass... | |
from __future__ import unicode_literals
import re
import time
from ncclient import manager
import paramiko
import xmltodict
CONNECT_TIMEOUT = 5 # seconds
class RPCClient(object):
def __init__(self, device, username='', password=''):
self.username = username
self.password = password
tr... | |
#!/usr/bin/python2
import os, sys
from datetime import datetime, date, timedelta
from backupcommon import BackupLock, BackupLogger, info, debug, error, exception, Configuration, BackupTemplate, scriptpath
from random import randint
from oraexec import OracleExec
from restorecommon import RestoreDB
from tempfile import... | |
#!/usr/bin/env python
"""
This module contains the class TransducerLearner which implements the algorithm
to infer deterministic transducers with bounded lookahead.
For details see the paper
* Back in Black: Towards Formal, Black-Box Analysis of Sanitizers and Filters
George Argyros, Ioannis Stais, Angelos D. Kero... | |
# http://developer.intel.com/software/products/compilers/flin/
from __future__ import division, absolute_import, print_function
import sys
from numpy.distutils.ccompiler import simple_version_match
from numpy.distutils.fcompiler import FCompiler, dummy_fortran_file
compilers = ['IntelFCompiler', 'IntelVisualFCompile... | |
def latentcalls():
f = open('LatentCall.hpp','w')
f.write('''#ifndef DT3_LATENTCALL
#define DT3_LATENTCALL
//==============================================================================
///
/// File: LatentCall.hpp
///
/// Copyright (C) 2000-2013 by Smells Like Donkey, Inc. All rights reserved.
///
/// This file... | |
# Copyright 2014 IBM Corporation
# Copyright 2015 Lenovo
#
# 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... | |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... | |
#!/usr/bin/env python
# -*- coding: utf8 -*-
from .topping import Topping
from jawa.constants import *
from jawa.util.descriptor import method_descriptor, field_descriptor
import traceback
import six
import six.moves
# EnumFacing.Plane. Needed because this is also a predicate, which is used
# to get certain facing... | |
from sympy import Basic, S, Symbol, Real, Integer, Rational, \
sin, cos, exp, log, oo, sqrt, symbols, Integral, sympify, \
WildFunction, Poly, Function, Derivative, Number, pi, var
from sympy.utilities.pytest import XFAIL, raises
class DummyNumber(object):
"""
Minimal implementation of a number that ... | |
"""Training a face recognizer with TensorFlow based on the FaceNet paper
FaceNet: A Unified Embedding for Face Recognition and Clustering: http://arxiv.org/abs/1503.03832
"""
# MIT License
#
# Copyright (c) 2016 David Sandberg
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this ... | |
# Copyright (C) 2015 Niklas Rosenstein
#
# 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, merge, publish, d... | |
## This software is licensed under the MIT License - please refer to the LICENCE file for details
#
# Copyright (c) 2018 Stephane Teisserenc
#
import sys, threading
import socket
import logging
import time
from struct import *
import xml.etree.ElementTree as ET
logger = logging.getLogger('UDPserver')
VERSION = "v1.2.... | |
# 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... | |
# 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 ... | |
#!/usr/bin/env python3
# -*- mode: python -*-
# -*- coding: utf-8 -*-
# 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... | |
""" parquet compat """
from warnings import catch_warnings
from pandas.compat._optional import import_optional_dependency
from pandas.errors import AbstractMethodError
from pandas import DataFrame, get_option
from pandas.io.common import get_filepath_or_buffer, is_s3_url
def get_engine(engine):
""" return our... | |
# Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 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... | |
"""
Taken from https://github.com/brentp/pyfasta/blob/452d1ce5406ed73c4149b6d201bc65e4aa8afc27/tests/bench.py
"""
from itertools import islice
from tempfile import NamedTemporaryFile
import pyfaidx
import pyfasta
import pysam
from Bio import SeqIO
import time
import random
import os
import sys
from subprocess import c... | |
# 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 os
import unittest
import tempfile
from diff_rulekeys import *
class MockFile(object):
def __init__(self, lines):
self._lines = lines
def readlines(self):
return self._lines
class TestRuleKeyDiff(unittest.TestCase):
def test_key_value_diff(self):
list_diff = KeyValueDiff... | |
from PyQt4 import QtCore, QtGui
from addresses import decodeAddress, encodeVarint, addBMIfNotPresent
from account import (
GatewayAccount, MailchuckAccount, AccountMixin, accountClass,
getSortedAccounts
)
from tr import _translate
from retranslateui import RetranslateMixin
import widgets
import queues
import h... | |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test fee estimation code."""
from decimal import Decimal
import random
from test_framework.mininode im... | |
#
# 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... | |
# -*- coding: utf-8 -*-
from dp_tornado.engine.controller import Controller
from bs4 import BeautifulSoup
class PaginationController(Controller):
def get(self):
self.test_simple_1()
self.test_simple_2()
self.test_all()
self.test_first_page()
self.test_last_page()
... | |
"""
sentry.db.models.manager
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import hashlib
import logging
import threading
import weakref
from django.conf imp... | |
# Copyright 2012 OpenStack Foundation
# Copyright 2012 Canonical 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 b... | |
# coding: utf-8
# Copyright Luna Technology 2015
# Matthieu Riviere <mriviere@luna-technology.com>
from contextlib import contextmanager
from rest_framework.test import APITestCase
from api import factories
class BaseAPITestCase(APITestCase):
def setUp(self):
self.user = factories.UserFactory.create(... | |
"""Expose Radio Browser as a media source."""
from __future__ import annotations
import mimetypes
from radios import FilterBy, Order, RadioBrowser, Station
from homeassistant.components.media_player.const import (
MEDIA_CLASS_CHANNEL,
MEDIA_CLASS_DIRECTORY,
MEDIA_CLASS_MUSIC,
MEDIA_TYPE_MUSIC,
)
from... | |
import json
import os
import sys
from django import http
from django.forms import models as model_forms
from django.utils import six
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from django.views import generic
from horizon_contrib.common import content_... | |
# 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 ... | |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Gtacoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test pruning code
# ********
# WARNING:
# This test uses 4GB of disk space.
# This test takes 30 mins... | |
# PYTHON 3 code to run from CreateMonthSeriesfromHadISD.py
# Not currently used!!!
# This used to be part of the IDL code to identify time periods of:
# - changes to reporting frequency (hourly, 3 hourly 6 hourly etc
# - changes to reporting resolution (0., 0.1, 0.5)
# - changes to source input station ID
def Ge... | |
#!/usr/bin/env python
import logging
from optparse import OptionParser
import re
from string import Template
import csv
from dateutil.parser import parse as parse_date
from datetime import datetime, timedelta, date
import sys
import bisect
MIN_INTERVAL = 60 # minimum interval between placemarks in seconds
... | |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
#Helper functions for TF-STAR
import sqlite3
import pandas as pd
import numpy as np
import re
import os
import sys
import random
import hashlib
import time
from collections import defaultdict
from constant import *
import subprocess
import scipy as sp
import scipy.optimize... | |
from __future__ import print_function
import sys
import random
import os
from builtins import range
import time
import json
sys.path.insert(1, "../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.naive_bayes import H2ONaiveBayesEstimator
from h2o.grid.grid_search import H2OGridSearch
class Tes... | |
# Copyright 2021, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | |
# Sources:
# https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/appengine/standard/localtesting/datastore_test.py
# http://flask.pocoo.org/docs/0.12/testing/
#import os
#import imhere
#import unittest
#import tempfile
#from flask import session
import flask
from models import users_model, index_mo... | |
#
# 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
# ... | |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 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... | |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2022, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
"""
exnbo Input Generator and Parser
###################################
"""
import six
import numpy as np
import pandas as pd
from exatomic.exa import TypedMeta
from exatomic import... | |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2014-2017 Alex Forencich
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... | |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | |
import theano.tensor as T
from .. import init
from .. import nonlinearities
from ..theano_extensions import conv
from .base import Layer
__all__ = [
"Conv1DLayer",
"Conv2DLayer",
]
def conv_output_length(input_length, filter_length,
stride, border_mode, pad=0):
if input_length i... | |
import logging
from dateutil import parser
from itertools import chain
from urllib.parse import urlencode
import requests
from requests.packages.urllib3.util import Retry
from zentral.utils.dict import get_nested_val
logger = logging.getLogger('zentral.contrib.puppet.puppetdb_client')
class PuppetDBError(Exception)... | |
import numpy as np
import numpy.random as npr
import random as rand
import csv
import scipy.io as scio
import scipy.special as scsp
from sklearn import preprocessing as pp
import matplotlib.pyplot as plt
import time
import pybrain.datasets as pbds
import pybrain.tools.shortcuts as pbts
import pybrain.supervised.trainer... | |
# 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... | |
#!/usr/bin/env python
# Siconos is a program dedicated to modeling, simulation and control
# of non smooth dynamical systems.
#
# Copyright 2016 INRIA.
#
# 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 L... | |
# tile-generator
#
# Copyright (c) 2015-Present Pivotal Software, 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
#... | |
"""Support for SimpliSafe alarm control panels."""
import re
from simplipy.errors import SimplipyError
from simplipy.system import SystemStates
from simplipy.websocket import (
EVENT_ALARM_CANCELED,
EVENT_ALARM_TRIGGERED,
EVENT_ARMED_AWAY,
EVENT_ARMED_AWAY_BY_KEYPAD,
EVENT_ARMED_AWAY_BY_REMOTE,
... | |
"""EntryAdmin for Zinnia"""
from __future__ import unicode_literals
from django.contrib import admin
from django.db.models import Q
from django.utils import timezone
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from django.core.urlresolvers import NoReverseMatch
from django... | |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... | |
"""
This tutorial introduces denoising auto-encoders (dA) using Theano.
Denoising autoencoders are the building blocks for SdA.
They are based on auto-encoders as the ones used in Bengio et al. 2007.
An autoencoder takes an input x and first maps it to a hidden representation
y = f_{\theta}(x) = s(Wx+b), paramete... | |
#
# Copyright (c) 2005 Canonical
# Copyright (c) 2004 Conectiva, Inc.
#
# Written by Gustavo Niemeyer <niemeyer@conectiva.com>
#
# This file is part of Smart Package Manager.
#
# Smart Package Manager is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as publi... | |
# -*- coding: utf-8 -*-
"""
Sahana Eden Volunteers Management
(Extends modules/eden/hrm.py)
@copyright: 2012-15 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the... | |
import copy
from django.db import router
from django.db.models.query import QuerySet, EmptyQuerySet, insert_query, RawQuerySet
from django.db.models import signals
from django.db.models.fields import FieldDoesNotExist
def ensure_default_manager(sender, **kwargs):
"""
Ensures that a Model subclass contains a d... | |
#!/usr/bin/python3
# load environment variables in the beginning
# because some modules need variables when import
# for example, userManager/model.py
import sys
if sys.path[0].endswith("master"):
sys.path[0] = sys.path[0][:-6]
from flask import Flask, request
# must first init loadenv
from utils import tools, e... | |
"""Test idlelib.codecontext.
Coverage: 100%
"""
import re
import unittest
from unittest import mock
from test.support import requires
from tkinter import Tk, Frame, Text, TclError
import idlelib.codecontext as codecontext
from idlelib import config
usercfg = codecontext.idleConf.userCfg
testcfg = {
'main': co... | |
#!/usr/bin/env python
# "Arduino companion"
# test-implm of a python-based keyboard keys events handler to interface an Arduino connected to an Xbox Controller S
#--------------------------------------------
# import the needed libraries
import os
import sys # needed to print stuff on the same line in stdout
impo... | |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2018, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | |
"""The tests for the Demo Media player platform."""
import datetime
import socket
import unittest
import soco.snapshot
from unittest import mock
import soco
from soco import alarms
from homeassistant.setup import setup_component
from homeassistant.components.media_player import sonos, DOMAIN
from homeassistant.compone... | |
import discord
from bot import Command, categories
from bot.utils import get_guild_role
cfg_roles = 'iam_roles'
cfg_roles_locked = 'iam_roles_locked'
class IAm(Command):
def __init__(self, bot):
super().__init__(bot)
self.name = 'iam'
self.help = '$[iam-help]'
self.allow_pm = Fal... | |
#############################################################################
#
# 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
#
# ... | |
import pytest
import os
from mock import Mock, patch
#import simplejson as json
import json
import sqlalchemy
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import glob, datetime
import app.controllers.front_page_controller
import app.controllers.subreddit_controller
import app.controllers... | |
# -*- test-case-name: twisted.trial.test.test_reporter -*-
# Copyright (c) 2001-2010 Twisted Matrix Laboratories.
# See LICENSE for details.
#
# Maintainer: Jonathan Lange
"""
Defines classes that handle the results of tests.
"""
import sys, os
import time
import warnings
from twisted.python.compat import set
from t... | |
# deltaTime.py
#
# Parser to convert a conversational time reference such as "in a minute" or
# "noon tomorrow" and convert it to a Python datetime. The returned
# ParseResults object contains the results name "timeOffset" containing
# the timedelta, and "calculatedTime" containing the computed time relative
# to d... | |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use th... | |
from django.db.models import Q
from django.shortcuts import get_object_or_404
import django_filters
from rest_framework import serializers
from rest_framework.response import Response
from mozillians.api.v2.viewsets import NoCacheReadOnlyModelViewSet
from mozillians.common.templatetags.helpers import absolutify, mark... | |
from typing import Type, TypeVar
from copy import deepcopy
from datapipelines import DataTransformer, PipelineContext
from ..core.staticdata.champion import ChampionData, ChampionListData, Champion, Champions
from ..core.staticdata.rune import RuneData, RuneListData, Rune, Runes
from ..core.staticdata.item import Ite... | |
"""Aiohttp test utils."""
import asyncio
from contextlib import contextmanager
import json as _json
import re
from unittest import mock
from urllib.parse import parse_qs
from aiohttp import ClientSession
from aiohttp.streams import StreamReader
from yarl import URL
from aiohttp.client_exceptions import ClientResponse... | |
# -*- coding: utf-8 -*-
"""
test_django-watchman
------------
Tests for `django-watchman` views module.
"""
from __future__ import unicode_literals
import json
from _threading_local import local
from copy import copy
from django.db import connections
from django.db.utils import DEFAULT_DB_ALIAS
from django.test.te... | |
# -*- coding: utf-8 -*-
from bda.plone.ajax import ajax_continue
from bda.plone.ajax import ajax_form_fiddle
from bda.plone.ajax import AjaxMessage
from bda.plone.discount import message_factory as _
from bda.plone.discount.interfaces import CEILING_DATETIME
from bda.plone.discount.interfaces import FLOOR_DATETIME
from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.