code stringlengths 1 199k |
|---|
hiddenimports = ["sql_mar"] |
from ansible.module_utils._text import to_text
from ansible.module_utils.basic import env_fallback, return_values
from ansible.module_utils.network_common import to_list, EntityCollection
from ansible.module_utils.connection import Connection
_DEVICE_CONFIGS = {}
_CONNECTION = None
asa_argument_spec = {
'host': dic... |
"""
InaSAFE Disaster risk assessment tool by AusAid - **Clipper test suite.**
Contact : ole.moller.nielsen@gmail.com
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version ... |
import wxversion
wxversion.select('2.8')
import wx
import wx.lib.intctrl as intctrl
import wxmpl
import os
import analysis
import synthesis
import file_ops
class MyFrame(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: MyFrame.__init__
kwds["size"] = (800, 600)
kwds["style"] = ... |
import numpy
def numerov_integration(domain, a, f0, f1):
f = numpy.zeros(len(domain), dtype=numpy.complex)
f[0] = f0
f[1] = f1
step = domain.step
for i in range(2, len(domain)):
phi_i1 = f[i-1] * (2.0 + 5.0 * step**2 * a[i-1] / 6.0)
phi_i2 = f[i-2] * (1.0 - step**2 * a[i-2] / 12.0)
... |
import argparse
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
import os
from scapy.all import IP, UDP, DNS, DNSQR, DNSRR, sr1
import sys
def add_a_record(name_server, new_dns_record, ip_value):
os.system('clear')
title()
# Verifying all required options have a populated value
... |
from cloudinit.config import cc_locale
from cloudinit import cloud
from cloudinit import distros
from cloudinit import helpers
from cloudinit import util
from cloudinit.sources import DataSourceNoCloud
from .. import helpers as t_help
from configobj import ConfigObj
from six import BytesIO
import logging
import shutil
... |
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import * # noqa: F401
'''Runs a full joinmarket pit (using `nirc` miniircd servers,
with `nirc` options specified as an option to pytest),in
bitcoin regtest mode with 3 maker bots and 1 taker bot,
... |
""" Remove blocks module """
import os
import re
import sys
import glob
import logging
from ..tools import remove_pattern_from_file, CMakeFileEditor, CPPFileEditor, get_block_names
from .base import ModTool, ModToolException
logger = logging.getLogger(__name__)
class ModToolRemove(ModTool):
""" Remove block (delete... |
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
from unittest import TestCase
from sklearn.datasets.samples_generator import make_spd_matrix
from sklearn import hmm
from sklearn import mixture
from sklearn.utils.extmath import logsumexp
from sklearn.utils import check_random_s... |
from __future__ import unicode_literals
import frappe, json, copy
from frappe.utils import cstr, flt, getdate
from frappe import _
from frappe.utils.file_manager import save_file
from frappe.translate import (set_default_language, get_dict,
get_lang_dict, send_translations, get_language_from_code)
from frappe.geo.coun... |
from PyQt4 import QtCore, QtGui
class Ui_ListEditor(object):
def setupUi(self, ListEditor):
ListEditor.setObjectName("ListEditor")
ListEditor.resize(310, 280)
self.horizontalLayout_2 = QtGui.QHBoxLayout(ListEditor)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
s... |
DATE_FORMAT = '%Y-%m-%dT%H:%M:%S+00:00' |
from spack import *
class RPhilentropy(RPackage):
"""Computes 46 optimized distance and similarity measures for comparing
probability functions (Drost (2018) <doi:10.21105/joss.00765>). These
comparisons between probability functions have their foundations in a broad
range of scientific disciplines from... |
from spack import *
class Wgsim(Package):
"""Wgsim is a small tool for simulating sequence reads from a reference
genome.
It is able to simulate diploid genomes with SNPs and insertion/deletion
(INDEL) polymorphisms, and simulate reads with uniform substitution
sequencing errors. It does not generat... |
from spack import *
class PyUnicycler(PythonPackage):
"""Unicycler is an assembly pipeline for bacterial genomes. It can
assemble Illumina-only read sets where it functions as a SPAdes-optimiser.
It can also assembly long-read-only sets (PacBio or Nanopore) where it
runs a miniasm+Racon pipeline. For th... |
"""Schema for mirrors.yaml configuration file.
.. literalinclude:: ../spack/schema/mirrors.py
:lines: 32-
"""
schema = {
'$schema': 'http://json-schema.org/schema#',
'title': 'Spack mirror configuration file schema',
'type': 'object',
'additionalProperties': False,
'patternProperties': {
... |
{
'name': "Sync POS orders across multiple sessions",
'version': '1.0.0',
'author': 'Ivan Yelizariev',
'category': 'Point Of Sale',
'website': 'https://yelizariev.github.io',
'depends': ['pos_disable_payment', 'bus'],
'data': [
'security/ir.model.access.csv',
'views.xml',
... |
import os, sys
import unittest
from gppylib import gplog
from gpsegstart import GpSegStart
from mock import patch
logger = gplog.get_unittest_logger()
class GpSegStartTestCase(unittest.TestCase):
@patch('gpsegstart.GpSegStart.getOverallStatusKeys', return_value=[])
@patch('gpsegstart.gp.GpVersion.local', return... |
"""Command for setting scheduling for virtual machine instances."""
from googlecloudsdk.api_lib.compute import base_classes
from googlecloudsdk.command_lib.compute import flags
from googlecloudsdk.command_lib.compute.instances import flags as instance_flags
class SetSchedulingInstances(base_classes.NoOutputAsyncMutator... |
#-------------------------------------------------------------------------
class HTTPError(Exception):
'''
Represents an HTTP Exception when response status code >= 300.
:ivar int status:
the status code of the response
:ivar str message:
the message
:ivar list headers:
the ... |
import os
import re
import sys
from time import sleep
from OSEncryptionState import *
class UnmountOldrootState(OSEncryptionState):
def __init__(self, context):
super(UnmountOldrootState, self).__init__('UnmountOldrootState', context)
def should_enter(self):
self.context.logger.log("Verifying if... |
from common import runtests
from .shared import try_except_maker3
from .shared import setGenerator, test_exceptions
setGenerator(try_except_maker3)
runtests(test_exceptions) |
"""Global import for model hyper-parameters.
Using this module any ModelParams can be accessed via GetParams.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import importlib
import REDACTED.tensorflow_models.mlperf.models.rough.transformer_lingvo.lingvo.... |
from .cqlhandling import CqlParsingRuleSet, Hint
from cassandra.metadata import maybe_escape_name
simple_cql_types = set(('ascii', 'bigint', 'blob', 'boolean', 'counter', 'date', 'decimal', 'double', 'duration', 'float',
'inet', 'int', 'smallint', 'text', 'time', 'timestamp', 'timeuuid', 'tinyin... |
import json
from collections import OrderedDict
from django import forms
from django.template.loader import get_template
from django.utils.translation import ugettext_lazy as _
from pretix.base.payment import BasePaymentProvider
class BankTransfer(BasePaymentProvider):
identifier = 'banktransfer'
verbose_name =... |
"""Module for testing cursor objects."""
import cx_Oracle
class TestCursor(BaseTestCase):
def testExecuteNoArgs(self):
"""test executing a statement without any arguments"""
result = self.cursor.execute(u"begin null; end;")
self.failUnlessEqual(result, None)
def testExecuteNoStatementWit... |
"""
Neutron Plug-in for PLUMgrid Virtual Networking Infrastructure (VNI)
This plugin will forward authenticated REST API calls
to the PLUMgrid Network Management System called Director
"""
import netaddr
from oslo.config import cfg
from sqlalchemy.orm import exc as sa_exc
from neutron.api.v2 import attributes
from neut... |
"""deCONZ scene platform tests."""
from copy import deepcopy
from asynctest import patch
from homeassistant.components import deconz
from homeassistant.setup import async_setup_component
import homeassistant.components.scene as scene
from .test_gateway import ENTRY_CONFIG, DECONZ_WEB_REQUEST, setup_deconz_integration
G... |
"""The Hyperion component."""
from __future__ import annotations
import asyncio
from contextlib import suppress
import logging
from typing import Any, Callable, cast
from awesomeversion import AwesomeVersion
from hyperion import client, const as hyperion_const
from homeassistant.components.camera.const import DOMAIN as... |
"""The example of four ways of data transmission using gRPC in Python."""
from threading import Thread
from concurrent import futures
import grpc
import demo_pb2_grpc
import demo_pb2
__all__ = 'DemoServer'
SERVER_ADDRESS = 'localhost:23333'
SERVER_ID = 1
class DemoServer(demo_pb2_grpc.GRPCDemoServicer):
# 一元模式(在一次调... |
"""
Management class for Storage-related functions (attach, detach, etc).
"""
import time
from oslo.config import cfg
from nova import exception
from nova.openstack.common import log as logging
from nova.virt import driver
from nova.virt.hyperv import hostutils
from nova.virt.hyperv import vmutils
from nova.virt.hyperv... |
from twisted.internet import defer
from tests import unittest
from synapse.api.constants import Membership
import json
import time
class RestTestCase(unittest.TestCase):
"""Contains extra helper functions to quickly and clearly perform a given
REST action, which isn't the focus of the test.
This subclass as... |
import random
FOOZZIE_EXPERIMENTS = [
[10, 'ignition', 'jitless', 'd8'],
[10, 'ignition', 'slow_path', 'd8'],
[5, 'ignition', 'slow_path_opt', 'd8'],
[30, 'ignition', 'ignition_turbo', 'd8'],
[20, 'ignition', 'ignition_turbo_opt', 'd8'],
[5, 'ignition_turbo_opt', 'ignition_turbo_opt', 'clang_x86/d8'],
[5,... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants_test.pants_run_integration_test import PantsRunIntegrationTest
class ScroogeGenTest(PantsRunIntegrationTest):
@classmethod
def hermetic(cls):
return ... |
y = "C785"
x = train.names[0:784]
train[y] = train[y].asfactor()
test[y] = test[y].asfactor()
model = h2o.deeplearning(x=x,
y=y,
training_frame=train,
validation_frame=test,
distribution="multinomial",
... |
import mock
import requests
from neutron.plugins.common import constants
from neutron.plugins.ml2 import config as config
from neutron.plugins.ml2 import driver_api as api
from neutron.plugins.ml2.drivers import mechanism_odl
from neutron.plugins.ml2 import plugin
from neutron.tests import base
from neutron.tests.unit ... |
x = 0
try:
x = 1
except:
x = 2
else:
x = 3
assert x == 3
x = 0
try:
x = 1
raise Exception
x = 2
except:
x = 3
assert x == 3
x = 0
try:
x = 1
raise Exception
x = 2
except TypeError:
x = 4
except Exception:
x = 3
assert x == 3
x = 0
try:
x = 1
raise Exception
x = 2
except Exception:
x = 3
... |
"""The Tile component."""
import asyncio
from datetime import timedelta
from pytile import async_login
from pytile.errors import SessionExpiredError, TileError
from homeassistant.const import ATTR_ATTRIBUTION, CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import callback
from homeassistant.helpers import aiohttp... |
class DataAlreadyExistsError(RuntimeError):
def __init__(self, label):
self.message = str("Data with label '%s' already exists and cannot be added" % (label))
def get_patient_id(d):
return d['patient']['identifier']
def get_index_by_label(d, label):
for idx in range(len(d['data'])):
if d['da... |
from __future__ import print_function, unicode_literals
core_store_students_programs = False
core_store_students_programs_path = 'files_stored'
core_experiment_poll_time = 350 # seconds
core_facade_port = 28345
core_facade_server_route = 'provider1-route'
core_server_url = 'http://127.0.0.1:%s/weblab/' %... |
"""Implementation of SSH_ASKPASS to get a password to ssh from pssh.
The password is read from the socket specified by the environment variable
PSSH_ASKPASS_SOCKET. The other end of this socket is pssh.
The ssh man page discusses SSH_ASKPASS as follows:
If ssh needs a passphrase, it will read the passphrase from t... |
from __future__ import division
import numpy as np
from numpy.testing import assert_almost_equal
import pytest
from acoustics.power import lw_iso3746
@pytest.mark.parametrize("background_noise, expected", [
(79, 91.153934187),
(83, 90.187405234),
(88, 88.153934187),
])
def test_lw_iso3746(background_noise, ... |
from django import forms as django_forms
from django.core.urlresolvers import reverse
from django.http import Http404
import commonware
import waffle
from rest_framework import exceptions, response, serializers, status, viewsets
from rest_framework.decorators import detail_route
from rest_framework.response import Resp... |
"""
Easy-to-use UMFPACK interface
=============================
.. currentmodule:: scikits.umfpack
The following functions can be used for LU decompositions and solving
equation systems:
.. autosummary::
:toctree: reference/
spsolve
splu
UmfpackLU
"""
from __future__ import division, print_function, absolut... |
"""
A standalone test runner script, configuring the minimum settings
required for tests to execute.
Re-use at your own risk: many Django applications will require
different settings and/or templates to run their tests.
"""
import os
import sys
APP_DIR = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, APP... |
"""
This file contains the DynamicsValidator class for validating component
:copyright: Copyright 2010-2017 by the NineML Python team, see AUTHORS.
:license: BSD-3, see LICENSE for details.
"""
from builtins import object
from nineml.visitors.validators import NoDuplicatedObjectsValidator
from .general import (
Tim... |
import json
from django.contrib.auth.decorators import permission_required
from django.core.paginator import Paginator
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template impor... |
from django import forms
from django.contrib import messages
from django.core.exceptions import ValidationError
from django.db.models import ObjectDoesNotExist
from django.shortcuts import get_object_or_404, redirect, render_to_response
from django.template import RequestContext
from django.utils.translation import uge... |
"""
Extensions to pickle allowing items in __main__ to be saved.
"""
import new
import pickle
import types
import __main__
from StringIO import StringIO
import copy
def _name_is_main(obj):
# CEBALERT: see IPython hack in commandline.py
return obj.__module__ == "__main__" or obj.__module__ == "__mynamespace__"
c... |
import re
from waliki.signals import page_saved
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from waliki.models import Page
from django.utils.translation import ugettext_lazy as _
from django.utils.text import get_text_list
try:
from waliki.attachments.models im... |
import sys
import os
import shlex
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.graphviz',
]
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'Pontoon'
copyright = u'2015, Matjaž Horvat, Mozilla Foundation'
author = u'Matjaž Horvat, Mozilla Foundation'
version = '1.0'
re... |
from better_zoom import BetterZoom
from better_selecting_zoom import BetterSelectingZoom
from broadcaster import BroadcasterTool
from dataprinter import DataPrinter
from data_label_tool import DataLabelTool
from enable.tools.drag_tool import DragTool
from draw_points_tool import DrawPointsTool
from drag_zoom import Dra... |
from __future__ import print_function
from __future__ import absolute_import
import os
from . import spd
from . import new_lj_thellier_gui_spd as tgs
cwd = os.getcwd()
main_dir = cwd + '/SPD'
calculate = ['int_n', 'frac', 'fvds', 'b_sigma', 'b_beta', 'scat', 'g', 'k', 'k_sse', 'z', 'int_mad_anc', 'int_dang', 'int_alpha... |
from __future__ import print_function
import flask
import os
import threading
import time
import webbrowser
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
_basedir = os.path.join("..", os.path.dirname(__file__))
app = flask.Flask(__name__, static_path=... |
"""
Magic Link.
pymdownx.magiclink
An extension for Python Markdown.
Find http|ftp links and email address and turn them to actual links
MIT license.
Copyright (c) 2014 - 2017 Isaac Muse <isaacmuse@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
do... |
import sys
for line in sys.stdin:
data = line.strip().split(" ")
if len(data) == 10:
page = data[6]
ip_address = data[0]
print "{0}\t{1}".format(page, ip_address) |
"""Run fuzz test targets.
"""
from concurrent.futures import ThreadPoolExecutor, as_completed
import argparse
import configparser
import logging
import os
import subprocess
import sys
def get_fuzz_env(*, target, source_dir):
return {
'FUZZ': target,
'UBSAN_OPTIONS':
f'suppressions={source_di... |
""" Python Character Mapping Codec generated from 'CP861.TXT' with gencodec.py.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
(c) Copyright 2000 Guido van Rossum.
"""#"
import codecs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
r... |
"""
Support for Unifi WAP controllers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.unifi/
"""
import logging
import urllib
from homeassistant.components.device_tracker import DOMAIN
from homeassistant.const import CONF_HOST, CONF_USERNAM... |
from setuptools import find_packages, setup
from eventlet import __version__
from os import path
setup(
name='eventlet',
version=__version__,
description='Highly concurrent networking library',
author='Linden Lab',
author_email='eventletdev@lists.secondlife.com',
url='http://eventlet.net',
p... |
import warnings
from typing import IO, Union
from bs4 import BeautifulSoup
from html5lib.constants import DataLossWarning
warnings.simplefilter('ignore', DataLossWarning)
def get_soup(obj: Union[str, IO, bytes], parser: str = 'html5lib') -> BeautifulSoup:
return BeautifulSoup(obj, parser) |
from __future__ import unicode_literals, division, absolute_import
import re
from argparse import ArgumentParser, ArgumentTypeError
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from flexget import options
from flexget.event import event
from flexget.terminal import TerminalTable, Term... |
from os.path import abspath, dirname, isdir, join
from django.apps import apps
from django.core.exceptions import ImproperlyConfigured
from django.template import TemplateDoesNotExist
from django.template.loaders.filesystem import Loader
class NameSpacedLoader(Loader):
def _get_template_vars(self, template_name):
... |
from oschecks import utils
def _check_ceilometer_api():
ceilometer = utils.Ceilometer()
ceilometer.add_argument('-w', dest='warning', type=int, default=5,
help='Warning timeout for Ceilometer APIs calls')
ceilometer.add_argument('-c', dest='critical', type=int, default=10,
... |
"""
Support for showing the date and the time.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.time_date/
"""
import logging
import homeassistant.util.dt as dt_util
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__... |
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
file = open('fcover.dat','r')
ul=[];vl=[];pl=[]
nlons=73; nlats=73
dellat = 2.5; dellon = 5.
for line in file.readlines():
l = line.replace('\n','').split()
ul.append(float(l[0]))
vl.append(float(l[1]))
pl.append(flo... |
from Screen import Screen
from Components.Label import Label
class PVRState(Screen):
def __init__(self, session):
Screen.__init__(self, session)
self["state"] = Label(text="")
class TimeshiftState(PVRState):
pass |
from time import localtime, mktime, time, strftime
from datetime import datetime
from enigma import eEPGCache
from Screens.Screen import Screen
import ChannelSelection
from ServiceReference import ServiceReference
from Components.config import config, ConfigSelection, ConfigText, ConfigSubList, ConfigDateTime, ConfigCl... |
import itertools
import os
import random
import sys
import time
from functools import partial
from concurrent import futures
if sys.platform == 'win32':
try:
import win32api
_has_win32api = True
except ImportError:
_has_win32api = False
else:
_has_win32api = False
import vtk
import w... |
from Plugins.Plugin import PluginDescriptor
from Screens.Console import Console
from Screens.ChoiceBox import ChoiceBox
from Screens.MessageBox import MessageBox
from Screens.Screen import Screen
from Screens.Standby import TryQuitMainloop
from Screens.Ipkg import Ipkg
from Screens.SoftwareUpdate import UpdatePlugin
fr... |
"""
TLS Pseudorandom Function.
"""
from __future__ import absolute_import
from scapy.error import warning
from scapy.utils import strxor
from scapy.layers.tls.crypto.hash import _tls_hash_algs
from scapy.layers.tls.crypto.h_mac import _tls_hmac_algs
from scapy.modules.six.moves import range
from scapy.compat import byt... |
"""API version tests."""
__all__ = [
'TestAPIVersion',
]
import unittest
from mailman.core.system import system
from mailman.testing.helpers import call_api
from mailman.testing.layers import RESTLayer
from urllib.error import HTTPError
class TestAPIVersion(unittest.TestCase):
layer = RESTLayer
def test... |
import angr
import claripy
import sys
def main(argv):
path_to_binary = argv[1]
project = angr.Project(path_to_binary)
initial_state = project.factory.entry_state()
# Define a class that inherits angr.SimProcedure in order to take advantage
# of Angr's SimProcedures.
class ReplacementCheckEquals(angr.SimProc... |
from __future__ import absolute_import, unicode_literals
from .celery import app
@app.task
def add(x, y):
return x + y
@app.task
def mul(x, y):
return x * y
@app.task
def xsum(numbers):
return sum(numbers) |
"""
Webcore is a basic web server framework based on the SocketServer-based
BaseHTTPServer that comes with Python. The big difference is that this
one can carve up URL-space by prefix, such that "/foo/*" gets handled by
a different request handler than "/bar/*". I refer to this as "splitting".
You should also be able... |
"""
Utilities, the stable ones are the following:
* h_file: compute a unique value for a file (hash), it uses
the module fnv if it is installed (see waf/utils/fnv & http://code.google.com/p/waf/wiki/FAQ)
else, md5 (see the python docs)
For large projects (projects with more than 15000 files) or slow hard disks an... |
from __future__ import absolute_import
from django.utils.translation import ugettext_lazy as _
from smart_settings import LocalScope
from .icons import icon_icons_app
from .literals import DEFAULT_ICON_SET
name = 'icons'
label = _(u'Icons')
description = _(u'Handles the registration and rendering of icons and sprites.'... |
from datetime import datetime, timedelta
import time
from openerp.osv import fields, osv
from openerp.tools.translate import _
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
import openerp.addons.decimal_precision as dp
from openerp import workflow
class res_company(osv.Model):
... |
import base64
import time
import re
from openerp.tools.translate import _
from openerp.osv.orm import TransientModel, fields
from openerp.osv.osv import except_osv
from openerp.tools import mod10r
REF = re.compile('[^0-9]')
class BvrImporterWizard(TransientModel):
_name = 'bvr.import.wizard'
_columns = {'file':... |
from facts import FactRules
from sympy.core.compatibility import cmp
class CycleDetected(Exception):
"""(internal) used to detect cycles when evaluating assumptions
through prerequisites
"""
pass
class AssumeMeths(object):
""" Define default assumption methods.
AssumeMeths should be used to d... |
import datetime
from django import template
from registration.models import RegistrationProfile
register = template.Library()
@register.simple_tag
def get_volunteer_number():
volunteers = RegistrationProfile.objects.all().count()
return volunteers |
import time
from selenium.common.exceptions import NoSuchElementException, InvalidSelectorException
from selenium.common.exceptions import TimeoutException
POLL_FREQUENCY = 0.5 # How long to sleep in between calls to the method
IGNORED_EXCEPTIONS = (NoSuchElementException,) # exceptions ignored during calls to the me... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class GetClicksForLink(Choreography):
def __init__(self, temboo_session):
"""
Create a... |
def merge(dbag, rules):
for rule in rules["rules"]:
source_ip = rule["source_ip_address"]
destination_ip = rule["destination_ip_address"]
revoke = rule["revoke"]
newrule = dict()
newrule["public_ip"] = source_ip
newrule["internal_ip"] = destination_ip
if rules... |
"""Allow users to set and activate scenes."""
from __future__ import annotations
import logging
from typing import Any, NamedTuple
import voluptuous as vol
from homeassistant import config as conf_util
from homeassistant.components.light import ATTR_TRANSITION
from homeassistant.components.scene import DOMAIN as SCENE_... |
"""Code for backpropagation using the tape utilities."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
from tensorflow.python import pywrap_tensorflow
from tensorflow.python.ops.unconnected_gradients import UnconnectedGradients
from tenso... |
""" Building is a subclass of Location """
from sqlalchemy import Column, Integer, ForeignKey
from aquilon.aqdb.model import Location
class Building(Location):
""" Building is a subtype of location """
__tablename__ = 'building'
__mapper_args__ = {'polymorphic_identity' : 'building'}
id = Column(Integer... |
import os
from future.moves.urllib.parse import quote
import uuid
import ssl
from pymongo import MongoClient
import requests
from django.apps import apps
from addons.wiki import settings as wiki_settings
from addons.wiki.exceptions import InvalidVersionError
from osf.utils.permissions import ADMIN, READ, WRITE
mongo_ma... |
"""This module contains AWS SNS hook"""
import json
import warnings
from typing import Dict, Optional, Union
from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook
def _get_message_attribute(o):
if isinstance(o, bytes):
return {'DataType': 'Binary', 'BinaryValue': o}
if isinstance(o, str):
... |
"""Neural network support.
See the @{$python/nn} guide.
@@relu
@@relu6
@@crelu
@@swish
@@elu
@@leaky_relu
@@selu
@@softplus
@@softsign
@@dropout
@@bias_add
@@sigmoid
@@log_sigmoid
@@tanh
@@convolution
@@conv2d
@@depthwise_conv2d
@@depthwise_conv2d_native
@@separable_conv2d
@@atrous_conv2d
@@atrous_conv2d_transpose
@@co... |
"""This code example gets all labels.
To create labels, run create_labels.py. This feature is only available to DFP
premium solution networks."""
from googleads import dfp
def main(client):
# Initialize appropriate service.
label_service = client.GetService('LabelService', version='v201502')
# Create statement to... |
"""Tests for layers.feature_column_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
from tensorflow.contrib.layers.python.layers import feature_column_ops
from tensorflow.python.ops import init_ops
class Trans... |
"""Basic operations examples.""" |
'''
Adapted from https://github.com/tornadomeet/ResNet/blob/master/symbol_resnet.py
(Original author Wei Wu) by Antti-Pekka Hynninen
Implementing the original resnet ILSVRC 2015 winning network from:
Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun. "Deep Residual Learning for Image Recognition"
'''
import mxnet as mx... |
from __future__ import unicode_literals
import os
import socket
import unittest
import warnings
from unittest import skipUnless
from django.conf import settings
from django.contrib.gis.geoip import HAS_GEOIP
from django.contrib.gis.geos import HAS_GEOS, GEOSGeometry
from django.test import ignore_warnings
from django.u... |
import unittest
import logging
import numpy as np
import ginga.colors
class TestError(Exception):
pass
class TestColors(unittest.TestCase):
def setUp(self):
self.logger = logging.getLogger("TestColors")
self.color_list_length = len(ginga.colors.color_dict)
# Tests for the lookup_color() funtion
def test_look... |
from __future__ import division, print_function, absolute_import
import sys
from numpy.testing import *
import numpy.linalg as linalg
def random(size):
return rand(*size)
class TestSolve(TestCase):
def bench_random(self):
basic_solve = linalg.solve
print()
print(' Solving system of ... |
import time
from importlib import import_module
from django.conf import settings
from django.contrib.sessions.backends.base import UpdateError
from django.shortcuts import redirect
from django.utils.cache import patch_vary_headers
from django.utils.http import cookie_date
class SessionMiddleware(object):
def __init... |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import absolute_import
from .build_response import BuildResponse # noqa
from .pod_response import PodResponse # noqa |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.