content
stringlengths
4
20k
from django.conf import settings from django.test import TestCase from django.contrib.auth.models import User, SiteProfileNotAvailable class ProfileTestCase(TestCase): fixtures = ['authtestdata.json'] def setUp(self): """Backs up the AUTH_PROFILE_MODULE""" self.old_AUTH_PROFILE_MODULE = getattr...
from offlineimap.repository.Base import BaseRepository from offlineimap import folder, imaputil, imapserver, OfflineImapError from offlineimap.folder.UIDMaps import MappedIMAPFolder from offlineimap.threadutil import ExitNotifyThread from threading import Event import os from sys import exc_info import netrc import err...
"""basic tests of lazy loaded attributes""" from sqlalchemy import testing from sqlalchemy.orm import mapper, relationship, create_session, immediateload from sqlalchemy.testing import eq_ from test.orm import _fixtures class ImmediateTest(_fixtures.FixtureTest): run_inserts = 'once' run_deletes = None ...
__author__ = 'Thomas Rueckstiess, <EMAIL>' from pybrain.rl.environments import EpisodicTask class MinimizeTask(EpisodicTask): def __init__(self, environment): EpisodicTask.__init__(self, environment) self.N = 15 self.t = 0 self.state = [0.0] * environment.dim self.action =...
import webbrowser from util import * from electrum_cesc.i18n import _ from electrum_cesc.util import block_explorer_URL, format_satoshis, format_time from electrum_cesc.plugins import run_hook from electrum_cesc.bitcoin import is_address class AddressList(MyTreeWidget): def __init__(self, parent=None): ...
from PyQt5.QtCore import pyqtSignal, Qt from PyQt5.QtGui import QKeySequence from PyQt5.QtWidgets import * from OpenNumismat.PageView import PageView from OpenNumismat.Tools.Gui import createIcon class TabBar(QTabBar): doubleClicked = pyqtSignal(int) def __init__(self, parent): super(TabBar, self)._...
#!/usr/bin/python # "Avoid locker or centralized resource by hard-wiring the port mapping within range" # "implied by max # of ports used per job, max # of executors per machine, and # of machines." # "Map of source determines port. in/out using env variables" print "\njenkins_h2o_port_allocate...." import socket, o...
"""Run BERT on SQuAD 1.1 and SQuAD 2.0 in TF 2.x.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import json import os from absl import app from absl import flags from absl import logging import tensorflow as tf from official.modeling import model_trai...
""" Support for showing random numbers. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.random/ """ import asyncio import logging import voluptuous as vol import homeassistant.helpers.config_validation as cv from homeassistant.components.sensor i...
import logging import os import pytest from copy import copy from subprocess import call from tests.beeswax.impala_beeswax import ImpalaBeeswaxException from tests.common.impala_test_suite import * from tests.common.test_vector import * from tests.common.impala_cluster import ImpalaCluster from tests.common.test_dimens...
import unittest from tempfile import NamedTemporaryFile from centerpoints.cli import parse_arguments class TestArgumentParser(unittest.TestCase): @classmethod def setUpClass(cls): cls.ptsf = NamedTemporaryFile() @classmethod def tearDownClass(cls): cls.ptsf.truncate() cls.pts...
import sys from prettytable import PrettyTable from mistcommand.helpers.login import authenticate def show_cloud(cloud): x = PrettyTable(["Title", "ID", "Provider", "State"]) x.add_row([cloud.title, cloud.id, cloud.provider, cloud.info['state']]) print x print print "Machines:" x = PrettyTab...
""" # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2011 Cisco Systems, 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.ap...
from thriftpy3.Thrift import TProcessor, TMessageType, TException from thriftpy3.protocol import TProtocolDecorator, TMultiplexedProtocol class TMultiplexedProcessor(TProcessor): def __init__(self): self.services = {} def registerProcessor(self, serviceName, processor): self.services[serviceName] = proces...
from boto.exception import JSONResponseError class InvalidSubnet(JSONResponseError): pass class DBParameterGroupQuotaExceeded(JSONResponseError): pass class DBSubnetGroupAlreadyExists(JSONResponseError): pass class DBSubnetGroupQuotaExceeded(JSONResponseError): pass class InstanceQuotaExceeded...
import os, sys from ConfigParser import SafeConfigParser # This dequote() business is required for some older versions # of mysql_config def dequote(s): if s[0] in "\"'" and s[0] == s[-1]: s = s[1:-1] return s def compiler_flag(f): return "-%s" % f def mysql_config(what): from...
# pylint: skip-file class GitPush(GitCLI): ''' Class to wrap the git merge line tools ''' # pylint: disable=too-many-arguments def __init__(self, path, remote, src_branch, dest_branch, ssh_key=None): ''' Constr...
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <headingcell level=2> # Usage of IC 7404 # <codecell> from __future__ import print_function from BinPy import * # <codecell> # Usage of IC 7404: ic = IC_7404() print(ic.__doc__) # <codecell> # The Pin configuration is: inp = {1: 1, 3: 0, 5: 0, 7: 0, 9: 0, ...
#!/usr/bin/env python import array import binascii import zmq import struct port = 28332 zmqContext = zmq.Context() zmqSubSocket = zmqContext.socket(zmq.SUB) zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashblock") zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashtx") zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashtxlock") zm...
# -*- coding: utf-8 -*- from .cartan_type import CartanType from sympy.core import Basic class RootSystem(Basic): """ Every simple Lie algebra has a unique root system. To find the root system, we first consider the Cartan subalgebra of g, which is the maximal abelian subalgebra, and consider the adj...
from __future__ import print_function from __future__ import unicode_literals from localization import N_ from outputable import Outputable from changes import FileDiff import comment import filtering import interval import re import subprocess __metric_eloc__ = {"java": 500, "c": 500, "cpp": 500, "h": 300, "hpp": 300...
import os # toolchains options ARCH='arm' CPU='am335x' CROSS_TOOL='gcc' if os.getenv('RTT_CC'): CROSS_TOOL = os.getenv('RTT_CC') if CROSS_TOOL == 'gcc': PLATFORM = 'gcc' EXEC_PATH = r'C:\Program Files (x86)\CodeSourcery\Sourcery_CodeBench_Lite_for_ARM_EABI\bin' elif CROSS_TOOL == 'keil': PLATFORM = ...
__author__ = "Peter F. Neher" import numpy as np import caffe from caffe import layers as L from caffe import params as P from Layers.DiceLoss import DiceLossLayer from Layers.DiceIndex import DiceIndexLayer class CaffeUNet_2D : def __init__(self, batch_size, num_classes, input_size, data_channels...
from sklearn.datasets import fetch_20newsgroups from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.naive_bayes import MultinomialNB from sklearn import metrics from sklearn.pipeline import Pipeline import numpy as np import pandas as pd ...
from docutils import nodes, utils # noinspection PyUnresolvedReferences from sphinx.errors import SphinxError GROUP_ID = 'com.facebook.presto' ARTIFACTS = { 'server': ('presto-server', 'tar.gz', None), 'cli': ('presto-cli', 'jar', 'executable'), 'jdbc': ('presto-jdbc', 'jar', None), 'verifier': ('prest...
""" Commerce app tests package. """ import json import httpretty from django.conf import settings from . import factories # pylint: disable=invalid-name class mock_ecommerce_api_endpoint(object): """ Base class for contextmanagers used to mock calls to api endpoints. The contextmanager internally acti...
import re from django.contrib import sites from django.core.exceptions import ObjectDoesNotExist from django.http import HttpResponsePermanentRedirect from django.utils import cache from django.conf import settings from . import models, get_default_site, set_default_site, set_current_site def _process_request(request...
import distutils.sysconfig import sys import os import time import cobbler.templar from cobbler.utils import _ from cobbler.cexceptions import CX plib = distutils.sysconfig.get_python_lib() mod_path = "%s/cobbler" % plib sys.path.insert(0, mod_path) template_file = "/etc/cobbler/genders.template" settings_file = "/etc...
"""Coordination and locking utilities.""" import inspect import random import threading import uuid import eventlet from eventlet import tpool import itertools from oslo_config import cfg from oslo_log import log import six from tooz import coordination from tooz import locking from cinder import exception from cind...
import eventlet from github import Github from st2reactor.sensor.base import PollingSensor eventlet.monkey_patch( os=True, select=True, socket=True, thread=True, time=True) DATE_FORMAT_STRING = '%Y-%m-%d %H:%M:%S' class GithubRepositorySensor(PollingSensor): EVENT_TYPE_WHITELIST = [ ...
from __future__ import unicode_literals import frappe from frappe import _ from frappe.model.document import Document class DuplicationError(frappe.ValidationError): pass class ActivityCost(Document): def validate(self): self.set_title() self.check_unique() def set_title(self): if self.employee: if not ...
from selenium.webdriver.common import utils from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities from selenium.webdriver.remote.command import Command from selenium.common.exceptions import WebDriverException import b...
""" Common utilities for fovea diagnostics. """ from __future__ import division, absolute_import from numpy import tan import os, sys import PyDSTool as dst from PyDSTool.Toolbox.phaseplane import bisection class gen_versioner(object): _targetlangs = {'dopri': 'c', 'radau': 'c', 'vode': 'py...
import copy from types import ClassType, FunctionType __all__ = ["Implements", "Class"] def Implements(*args): """ This class decorator is used to implement methods of given classes into the decorated class. Your class needs a `implement` method for this to work. See the `Class` decorator. """ def do_implemen...
""" BarGraph represents bar graphs with vertical bars both simple and stacked. The DIRAC Graphs package is derived from the GraphTool plotting package of the CMS/Phedex Project by ... <to be added> """ import datetime from pylab import setp from matplotlib.patches import Polygon from matplotlib.dates imp...
#! /usr/bin/env python import os import sys import subprocess import shutil try: import argparse as ap except ImportError: import pyne._argparse as ap absexpanduser = lambda x: os.path.abspath(os.path.expanduser(x)) def check_windows_cmake(cmake_cmd): if os.name == 'nt': files_on_path = set() ...
import numpy as np import pytest from pandas import DataFrame, MultiIndex, Series import pandas._testing as tm class TestReorderLevels: @pytest.mark.parametrize("klass", [Series, DataFrame]) def test_reorder_levels(self, klass): index = MultiIndex( levels=[["bar"], ["one", "two", "three"]...
r"""Runs a DRAGNN model on a given set of CoNLL-formatted sentences. Sample invocation: bazel run -c opt <...>:dragnn_eval -- \ --master_spec="/path/to/master-spec" \ --checkpoint_file="/path/to/model/name.checkpoint" \ --input_file="/path/to/input/documents/test.connlu" """ import os import re import t...
from django.core.urlresolvers import reverse from django.http import Http404 from django.shortcuts import redirect from misago.conf import settings from misago.models import Forum, Thread, Post from misago.utils.pagination import page_number class ViewBase(object): def __new__(cls, request, **kwargs): obj ...
r"""Removes unneeded nodes from a GraphDef file. This script is designed to help streamline models, by taking the input and output nodes that will be used by an application and figuring out the smallest set of operations that are required to run for those arguments. The resulting minimal graph is then saved out. The ...
import logging from functools import partial from kivy.clock import Clock from cobiv.modules.core.sets.setmanager import SetManager class SqliteSetManager(SetManager): logger = logging.getLogger(__name__) def ready(self): super().ready() self.conn = self.lookup('sqlite_ds', 'Datasource').g...
import subprocess from django.core.management.base import BaseCommand, CommandError from django.conf import settings class Command(BaseCommand): help = "Dumps data tables to CSV. Just a thin wrapper around pg_dump." def add_arguments(self, parser): parser.add_argument( '--table', ...
"""Helpers constructing Datasets.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.framewo...
#!/usr/bin/env python from __future__ import print_function import argparse import chainer import chainer.functions as F import chainer.links as L from chainer import training from chainer.training import extensions import chainermn class MLP(chainer.Chain): def __init__(self, n_units, n_out): super(M...
"""Convert a NT pathname to a file URL and vice versa.""" def url2pathname(url): """OS-specific conversion from a relative URL of the 'file' scheme to a file system path; not recommended for general use.""" # e.g. # ///C|/foo/bar/spam.foo # becomes # C:\foo\bar\spam.foo import string, urlli...
from __future__ import print_function import collections import json import sys import time from . import exceptions # Some utility functions for output. def color(cond): """Returns 32 (green) or 31 (red) depending on the validity of the given condition.""" return cond and 32 or 31 def up(cond): "...
import pytest from tests.functional.plots import with_confirmation, without_confirmation, \ refuse_with_confirmation, select_command_with_arrows containers = (('thefuck/ubuntu-python3-tcsh', u'''FROM ubuntu:latest RUN apt-get update RUN apt-get install -yy pytho...
""" Created on 22/02/2017 @author: jrkarki """ class Reanimator: """This class represents lifeless bodies that can be reanimated""" def __init__(self, corpse, alive=False): """ :param corpse: The name of the corpse :type corpse: str :param alive: Is the corpse alive? Defaults ...
#========================================================================= # pisa_and_test.py #========================================================================= import pytest import random import pisa_encoding from pymtl import Bits from PisaSim import PisaSim from pisa_inst_test_utils import * #---------...
"""Vector Student's t distribution classes.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.contrib.distributions.python.ops import bijectors from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtyp...
from django.conf.urls.defaults import * from django.contrib import messages from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect, HttpResponse from django.shortcuts import render_to_response, redirect from django.template import RequestContext, Template from django.template.response...
"""Unittest for reflection.py, which tests the generated C++ implementation.""" __author__ = '<EMAIL> (Jason Hsueh)' import os os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'cpp' import unittest from google.protobuf.internal import api_implementation from google.protobuf.internal import more_extensions_dyna...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) from pants.backend.jvm.targets.jar_dependency import JarDependency from pants.base.payload import Payload from pants.base.payload_field import JarsField from pants.bui...
import datetime from openerp.osv import fields, osv from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT class resource_calendar_leaves(osv.osv): _inherit = "resource.calendar.leaves" _columns = { 'group_id': fields.many2one('procurement.group', string="Procurement Gro...
import unittest from telemetry.internal.platform import cros_platform_backend class CrosPlatformBackendTest(unittest.TestCase): initial_cstate = { 'cpu0': 'POLL\nC1\nC2\nC3\n0\n138356189\n102416540\n' '17158209182\n0\n1\n500\n1000\n1403211341', 'cpu1': 'POLL\nC1\nC2\nC3\n0\n107318149\n81786238\...
"""The metaclasses used by the mojo python bindings.""" import itertools import logging import sys # pylint: disable=F0401 import mojo.bindings.messaging as messaging import mojo.bindings.promise as promise import mojo.bindings.serialization as serialization class MojoEnumType(type): """Meta class for enumeration...
import logging import threading from openerp import SUPERUSER_ID from openerp import tools from openerp.osv import osv from openerp.api import Environment _logger = logging.getLogger(__name__) class procurement_compute_all(osv.osv_memory): _name = 'procurement.order.compute.all' _description = 'Compute all s...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import json import os from ansible.module_utils.basic import AnsibleModule def main(): ...
""" Test run/stop aspects of a simple workflow. """ import unittest from openmdao.main.api import Assembly, Component, set_as_top, Driver from openmdao.main.case import Case from openmdao.main.exceptions import RunStopped from openmdao.main.datatypes.api import Int, Bool, Float from openmdao.main.hasparameters import...
r""" ************************************ espressopp.integrator.MinimizeEnergy ************************************ This is a very simple approach to perform energy minimization of the system. The module uses a `steepest descent method <https://en.wikipedia.org/wiki/Gradient_descent>`_. The position of particles is up...
import json from oslo_log import log from oslo_utils import strutils import requests from requests import adapters from urllib import parse as urlparse from ceilometer import publisher LOG = log.getLogger(__name__) class HttpPublisher(publisher.ConfigPublisherBase): """Publish metering data to a http endpoint ...
import re from django.db import models from django.db.models.signals import post_save from django.db.models.signals import post_delete from django.contrib.auth.models import User from django.utils import timezone from .xform import XForm from .survey_type import SurveyType from odk_logger.xform_instance_parser import X...
import os import glob from distutils.core import setup import py2exe meta = {} execfile(os.path.join(os.path.dirname(__file__), '..', 'openerp', 'release.py'), meta) def generate_files(): actions = { 'start': ['stop', 'start'], 'stop': ['stop'], } files = [] if os.name == 'nt': ...
from __future__ import absolute_import from __future__ import unicode_literals from dnf.pycomp import long from tests import support from tests.support import mock import binascii import hawkey import rpm TOUR_MD5 = binascii.unhexlify("68e9ded8ea25137c964a638f12e9987c") TOUR_SHA256 = binascii.unhexlify("ce77c1e5694b0...
"""Wrappers for sparse cross operations.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.contrib.framework import deprecated_arg_values from tensorflow.contrib.layers.ops import gen_sparse_feature_cross_op from tensorflow.contrib.util impo...
""" This module provides access to the Unix password database. Password database entries are reported as 7-tuples containing the following items from the password database (see `<pwd.h>'), in order: pw_name, pw_passwd, pw_uid, pw_gid, pw_gecos, pw_dir, pw_shell. The uid and gid items are integers, all others are stri...
"""Helpers for sun events.""" from __future__ import annotations import datetime from typing import TYPE_CHECKING from homeassistant.const import SUN_EVENT_SUNRISE, SUN_EVENT_SUNSET from homeassistant.core import HomeAssistant, callback from homeassistant.loader import bind_hass from homeassistant.util import dt as d...
import unittest, time, sys, random, math, getpass sys.path.extend(['.','..','../..','py']) import h2o2 as h2o import h2o_cmd, h2o_import as h2i, h2o_util, h2o_print as h2p, h2o_summ from h2o_test import OutputObj print "Same as test_summary2_uniform.py but with exponential distribution on the data" DO_TRY_SCIPY = Fals...
# The Computer Language Benchmarks Game # http://shootout.alioth.debian.org/ # # contributed by Antoine Pitrou # modified by Dominique Wahli # modified by Heinrich Acker from __future__ import print_function import time # Map "range" to an efficient range in both Python 2 and 3. try: range = xrange except NameErr...
from __future__ import unicode_literals import frappe from frappe import _ from frappe.model.document import Document class LeaveBlockList(Document): def validate(self): dates = [] for d in self.get("leave_block_list_dates"): # date is not repeated if d.block_date in dates: frappe.msgprint(_("Date is ...
""" Support for the LIFX platform that implements lights. This is a legacy platform, included because the current lifx platform does not yet support Windows. """ import logging import liffylights import voluptuous as vol from homeassistant.components.light import ( ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_...
#!/usr/bin/env python #-*- coding: utf-8 -*- import define import tw8836 import spi import fontosd import bmposd import sx1505 import string import time import sys img = [ #0x000000, 0x0015C0, 0x0044A0, 0x007390, 0x00A2A0, 0x00D1B0, 0x0100B0, 0x013020, 0x015F60, 0x018EE0, 0x01BEA0, 0x01EED0, 0x021EC0, 0x024F00, 0x02...
# -*- coding: utf-8 -*- """ overholt.helpers ~~~~~~~~~~~~~~~~ overholt helpers module """ import pkgutil import importlib from flask import Blueprint from flask.json import JSONEncoder as BaseJSONEncoder def register_blueprints(app, package_name, package_path): """Register all Blueprint instances o...
import inspect import os import shelve import random import time import readline import obj import locations import entities def confirm(prompt='', default=True): if default: answer = input(prompt + ' (Y/n) ') if answer.lower() == 'y' or answer.lower() == 'yes' or answer == '': return ...
"""network configuration""" # system provided modules import os, string, time, socket # PlanetLab system modules import sioc, plnet # local modules import plnode.bwlimit as bwlimit import logger, iptables, tools # we can't do anything without a network priority=1 dev_default = tools.get_default_if() def start():...
from __future__ import nested_scopes import os import re import string import types ######################################################################## # Classes ######################################################################## class Label: """A 'Label' identifies an entity. A 'Label' is a gene...
from m5.objects import * from arm_generic import * from O3_ARM_v7a import O3_ARM_v7a_3 root = LinuxArmFSSystemUniprocessor(machine_type='VExpress_EMM64', mem_mode='timing', mem_class=DDR3_1600_x64, cpu_class=O3_...
import sys import unittest from libcloud.utils.py3 import httplib from libcloud.compute.drivers.bluebox import BlueboxNodeDriver as Bluebox from libcloud.compute.base import Node, NodeAuthPassword from libcloud.compute.types import NodeState from libcloud.test import MockHttp from libcloud.test.file_fixtures import ...
import json import logging from django.core.urlresolvers import reverse_lazy from django.utils.translation import ugettext_lazy as _ from horizon import exceptions from horizon import forms from horizon import tables from horizon.utils import memoized from openstack_dashboard.api import sahara as saharaclient from o...
from ..source import GitSource from ..package import Package from ..patch import LocalPatch from ..util import target_arch import os class Cffi2(Package): source = GitSource('https://github.com/QPYPI/cffi.git', alias='cffi2') patches = [ #LocalPatch('0001-cross-compile'), ] def prepare(self):...
import contextlib import os import sqlite3 import unittest from tempfile import mktemp from unittest import mock from cylc.flow.rundb import CylcSuiteDAO GLOBAL_CONFIG = """ [platforms] [[desktop[0-9]{2}|laptop[0-9]{2}]] # hosts = platform name (default) # Note: "desktop01" and "desktop02" are b...
"""Tests for control_flow module.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.autograph.operators import control_flow from tensorflow.python.data.ops import dataset_ops from tensorflow.python.framework import constant_op from t...
import sys from osgeo import gdal from osgeo import ogr from osgeo import osr def Usage(): print('Usage: gcps2vec.py [-of <ogr_drivername>] [-p] <raster_file> <vector_file>') sys.exit(1) # ============================================================================= # Mainline # ===========================...
#!/usr/bin/python # -*- coding: UTF-8 -*- """ This file is part of data2gnokii. data2gnokii 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 3 of the License, or (at your option...
# -*- coding: utf-8 -*- import unittest import six from scrapy.spiders import Spider from scrapy.utils.url import (url_is_from_any_domain, url_is_from_spider, canonicalize_url) __doctests__ = ['scrapy.utils.url'] class UrlUtilsTest(unittest.TestCase): def test_url_is_from_any_doma...
from __future__ import print_function import argparse import os import os.path import re import subprocess import sys import zipfile class Abort(RuntimeError): def __init__(self, message, retCode=-1): RuntimeError.__init__(self) self.message = message self.retCode = retCode _mode_factorie...
#!/usr/bin/env python """Chainer example: train a multi-layer perceptron on MNIST using two GPUs. This is a toy example to write a model-parallel computation in Chainer. Note that this is just an example; the network definition is not optimal and performs poorly on MNIST dataset. """ import math import numpy as np i...
from plugins.plugin import Plugin class Spoof(Plugin): name = "Spoof" optname = "spoof" desc = "Redirect/Modify traffic using ICMP, ARP, DHCP or DNS" version = "0.6" def initialize(self, options): '''Called if plugin is enabled, passed the options namespace''' ...
from collections import defaultdict from utility import to_words, from_words from utility import expand_sided_value, collapse_sided_value class StylesContainer(dict): # e. g. 'border', 'padding', etc. prefix = None # names that are available within prefix, # e. g. 'color' (full name 'border-color'). su...
import math import unittest import numpy import six import chainer from chainer import cuda from chainer import functions from chainer import gradient_check from chainer.testing import attr from chainer.testing import condition if cuda.available: cuda.init() class TestSigmoidCrossEntropy(unittest.TestCase): ...
#!/s/std/bin/python # This is an example of how to use the functions from mfgraph to # generate jgraph images. Run this script and look in examples.pdf # for two graphs. If you want to generate an eps, you can only # generate one graph at a time. To do this comment out the line below # and un-comment the line below...
from __future__ import print_function, absolute_import from numba import cuda import numba.unittest_support as unittest from numba.cuda.testing import skip_on_cudasim import numpy @skip_on_cudasim('forall API unsupported in the simulator') class TestForAll(unittest.TestCase): def test_forall_1(self): @cud...
"""Tests for LSTM layer.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.contrib.keras.python import keras from tensorflow.contrib.keras.python.keras import testing_utils from tensorflow.python.platform import test c...
config = { "interfaces": { "google.cloud.vision.v1p3beta1.ImageAnnotator": { "retry_codes": { "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], "non_idempotent": [], }, "retry_params": { "default": { "i...
import numpy as np from pandas import ( Categorical, Series, ) import pandas._testing as tm class TestUnique: def test_unique_data_ownership(self): # it works! GH#1807 Series(Series(["a", "c", "b"]).unique()).sort_values() def test_unique(self): # GH#714 also, dtype=float ...
from kivy.app import App from kivy.event import EventDispatcher from kivy.clock import Clock from kivy.properties import DictProperty from kivy.logger import Logger import netcheck import toast from jnius import autoclass, PythonJavaClass, java_method, cast from android import activity from functools import partial ...
# -*- coding: utf-8 -*- """Find near positive definite correlation and covariance matrices Created on Sun Aug 19 15:25:07 2012 Author: Josef Perktold TODO: add examples for cov_nearest from script log Notes ----- We are looking at eigenvalues before and after the conversion to psd matrix. As distance measure fo...
#!/usr/bin/env python import getopt, sys import uno import mimetypes import subprocess import re from unohelper import Base, systemPathToFileUrl, absolutize from os import getcwd import os.path import base64 import urllib import tempfile tempfile.tempdir = "/tmp" import shutil import os import stat from bs4 import Beau...
"""Define the menu contents, hotkeys, and event bindings. There is additional configuration information in the EditorWindow class (and subclasses): the menus are created there based on the menu_specs (class) variable, and menus not created are silently skipped in the code here. This makes it possible, for example, to...
"""engine.SCons.Platform.hpux Platform-specific initialization for HP-UX systems. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method. """ # # Copyright (c) 2001 - 2019 The SCons Foundation # # Permission is ...