content
string
# -*- coding: utf-8 -*- from minerva.storage.valuedescriptor import ValueDescriptor from minerva.storage import datatype class OutputDescriptor: """ Combines a value descriptor with configuration for serializing values. """ def __init__( self, value_descriptor: ValueDescriptor, ...
""" custom_components.mqtt_example ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Shows how to communicate with MQTT. Follows a topic on MQTT and updates the state of an entity to the last message received on that topic. Also offers a service 'set_state' that will publish a message on the topic that will be passed via MQTT to our mes...
# -*- coding: utf-8 -*- """ pygments.styles.default ~~~~~~~~~~~~~~~~~~~~~~~ The default highlighting style. :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.style import Style from pygments.token import Keyword, Name, Com...
"""Utilities for extractid metadata from image files.""" import io from superdesk.text_utils import decode from PIL import Image, ExifTags from PIL import IptcImagePlugin from PIL.TiffImagePlugin import IFDRational from flask import json from .iim_codes import iim_codes ORIENTATIONS = { 1: ("Normal", 0), 2: (...
from scapy.fields import * from scapy.packet import * from scapy.layers.inet import UDP from scapy.layers.dns import DNSQRField, DNSRRField, DNSRRCountField """ LLMNR (Link Local Multicast Node Resolution). [RFC 4795] """ ############################################################################# ### ...
from openstack_dashboard.test.integration_tests import helpers from openstack_dashboard.test.integration_tests.pages.project.data_processing\ import jobbinariespage from openstack_dashboard.test.integration_tests.tests import decorators JOB_BINARY_INTERNAL = { # Size of binary name is limited to 50 characters...
from datetime import datetime from unittest import TestCase, mock from dateutil.relativedelta import relativedelta from django.utils import timezone from ..plugin import Plugin class PluginTests(TestCase): def test_parse_time(self): plugin = Plugin(mock.MagicMock(), {}) def expected(**kwargs):...
"""Class browser. XXX TO DO: - reparse when source changed (maybe just a button would be OK?) (or recheck on window popup) - add popup menu with more options (e.g. doc strings, base classes, imports) - show function argument list? (have to do pattern matching on source) - should the classes and methods lists also...
import numpy as np from astropy import units as u from astropy.modeling.blackbody import blackbody_lambda from numina.instrument.hwdevice import HWDevice from megaradrp.simulation.extended import create_th_ar_arc_spectrum class Lamp(HWDevice): def __init__(self, name, factor=1.0, illumination=None): supe...
""" Vitality measures. """ # Copyright (C) 2012 by # Aric Hagberg <<EMAIL>> # Dan Schult <<EMAIL>> # Pieter Swart <<EMAIL>> # All rights reserved. # BSD license. import networkx as nx __author__ = "\n".join(['Aric Hagberg (<EMAIL>)', 'Renato Fabbri']) __all__ = ['closeness_vita...
from __future__ import unicode_literals import frappe import frappe.defaults import frappe.permissions from frappe.model.document import Document class Feed(Document): pass def on_doctype_update(): if not frappe.db.sql("""show index from `tabFeed` where Key_name="feed_doctype_docname_index" """): frappe.db.comm...
# -*- coding: utf-8 -*- """Extract reference documentation from the NumPy source tree. """ from __future__ import print_function from future import standard_library standard_library.install_aliases() from builtins import object import inspect import textwrap import re import pydoc from warnings import warn from io i...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import keyword import random import uuid from json import dumps from ansible import constants as C from ansible import context from ansible.errors import AnsibleError, AnsibleOptionsError from ansible.module_utils.six import ite...
# -*- coding: utf-8 -*- """ Tests for auth manager PKI access to postgres. This is an integration test for QGIS Desktop Auth Manager postgres provider that checks if QGIS can use a stored auth manager auth configuration to access a PKI protected postgres. Configuration from the environment: * QGIS_POSTGRES_SERVE...
""" Counts words in UTF8 encoded, '\n' delimited text received from the network every second. Usage: flume_wordcount.py <hostname> <port> To run this on your local machine, you need to setup Flume first, see https://flume.apache.org/documentation.html and then run the example `$ bin/spark-submit --jars \ ...
import beanstalkc import yaml import logging import pprint import sys from collections import OrderedDict from .config import config from . import report log = logging.getLogger(__name__) def connect(): host = config.queue_host port = config.queue_port if host is None or port is None: raise Runt...
"""Generate new bench expectations from results of trybots on a code review.""" import collections import compare_codereview import os import re import shutil import subprocess import sys BENCH_DATA_URL = 'gs://chromium-skia-gm/perfdata/%s/%s/*' CHECKOUT_PATH = os.path.realpath(os.path.join( os.path.dirname(os....
#!/usr/bin/env python import rospy from actionlib import SimpleActionServer from art_msgs.msg import PickPlaceAction, PickPlaceGoal, PickPlaceResult, PickPlaceFeedback import random class FakeGrasping: ALWAYS = 0 NEVER = 1 RANDOM = 2 def __init__(self): self.left_server = SimpleActionServer(...
""" OpenStack Client interface. Handles the REST calls and responses. """ # E0202: An attribute inherited from %s hide this method # pylint: disable=E0202 import logging import time try: import simplejson as json except ImportError: import json import requests from ironic.openstack.common.apiclient import ...
"""Tests for checkpoints tools.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import time import numpy as np from tensorflow.core.protobuf import config_pb2 from tensorflow.python.client import session as session_lib from tensorflow.python....
import os import sys import subprocess from config import gen_config as gc from config import rfam_local as rl # ---------------------------------------------------------------------- def launch_genome_download(project_dir, upid_list): fp = open(upid_list, 'r') upids = [x.strip() for x in fp] fp.close(...
import pytest from datetime import datetime import maya def test_rfc2822(): r = maya.now().rfc2822() d = maya.MayaDT.from_rfc2822(r) assert r == d.rfc2822() def test_iso8601(): r = maya.now().iso8601() d = maya.MayaDT.from_iso8601(r) assert r == d.iso8601() def test_human_when(): r1 =...
from __future__ import unicode_literals from django.contrib.auth.models import User from django.contrib.contenttypes.fields import ( GenericForeignKey, GenericRelation, ) from django.contrib.contenttypes.models import ContentType from django.db import models from django.utils.encoding import python_2_unicode_compa...
""" Sources: Irish Counties: http://en.wikipedia.org/wiki/Counties_of_Ireland """ from django.utils.translation import ugettext_lazy as _ IE_COUNTY_CHOICES = ( ('antrim', _('Antrim')), ('armagh', _('Armagh')), ('carlow', _('Carlow')), ('cavan', _('Cavan')), ('clare', _('Clare')), ('cork...
""" Copyright (c) 2007 Jan-Klaas Kollhof This file is part of jsonrpc. jsonrpc is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later ...
from selenium.webdriver.common.by import By import unittest class AlertsTest(unittest.TestCase): def testShouldBeAbleToOverrideTheWindowAlertMethod(self): self._loadPage("alerts") self.driver.execute_script( "window.alert = function(msg) { document.getElementById('text').innerHTML = ...
from dxr.plugins.clang.tests import CSingleFileTestCase class OperatorCallTests(CSingleFileTestCase): source = """ struct Foo { void operator()(int) { } void operator[](int) { } }; int ...
""" Django's standard crypto functions and utilities. """ import hashlib import hmac import random import time from django.conf import settings from django.utils.encoding import force_bytes # Use the system PRNG if possible try: random = random.SystemRandom() using_sysrandom = True except NotImplementedError:...
import unittest import os import gi from tempfile import TemporaryDirectory from unittest.mock import patch, Mock, call from pyanaconda.modules.payloads.payload.rpm_ostree.flatpak_manager import FlatpakManager gi.require_version("Flatpak", "1.0") from gi.repository.Flatpak import RefKind class FlatpakTest(unittest...
import unittest, sys, random, time sys.path.extend(['.','..','../..','py']) import h2o, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_jobs, h2o_exec as h2e import h2o_util import multiprocessing, os, signal, time from multiprocessing import Process, Queue print "single writer, single reader flows (after sequenti...
import timeit import alignlib NUM_SAMPLES=1000 ALISIZE=2000 alignlib_vector = alignlib.makeAlignmentVector() alignlib_vector.addDiagonal( 0, ALISIZE, 0) python_vector = [] for x in xrange(ALISIZE): python_vector.append(x) def pythonBuildVector(): """build vector alignment in python.""" vector = [] ...
#!/usr/bin/env python # vim:fileencoding=utf-8:noet from __future__ import (unicode_literals, division, absolute_import, print_function) import os import socket import sys import codecs import platform import re test_type = sys.argv[1] test_client = sys.argv[2] shell = sys.argv[3] fname = os.path.join('tests', 'shel...
from __future__ import print_function import numpy as np import datetime as dt from bokeh.browserlib import view from bokeh.document import Document from bokeh.embed import file_html from bokeh.models.glyphs import Patch, Line, Text from bokeh.models import ( ColumnDataSource, DataRange1d, DatetimeAxis, Datet...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.compat.tests.mock import patch from ansible.modules.network.onyx import onyx_config from units.modules.utils import set_module_args from .onyx_module import TestOnyxModule, load_fixture class TestOnyxConfigModule(Tes...
import time from tests.unit import unittest from boto.dynamodb.layer2 import Layer2 from boto.dynamodb.table import Table from boto.dynamodb.schema import Schema class TestDynamoDBTable(unittest.TestCase): dynamodb = True def setUp(self): self.dynamodb = Layer2() self.schema = Schema.create(...
try: from http.client import BadStatusLine except ImportError: from httplib import BadStatusLine import pytest from selenium.common.exceptions import ( NoSuchElementException, NoSuchFrameException, WebDriverException) from selenium.webdriver.common.by import By from selenium.webdriver.support.ui i...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} import requests import urllib import json def main(): module = AnsibleModule( argument_spec = dict( state = dict(default='present', choices=['present', 'a...
class ModuleDocFragment(object): # Standard files documentation fragment DOCUMENTATION = """ options: host: description: - Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address f...
from django.utils.html import strip_tags from django.utils.translation import ugettext_lazy as _, ungettext from django.utils.timezone import now from django.contrib import messages from django.views import generic from oscar.core.loading import get_model from oscar.core.utils import redirect_to_referrer from oscar.ap...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = { 'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community' } import os from ansible.module_utils.basic import AnsibleModule PACKAGE_STATE_MAP = dict( present="install", ...
from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * from test_framework.mininode import CTransaction import cStringIO import binascii def txFromHex(hexstring): tx = CTransaction() f = cStringIO.StringIO(binascii.unhexlify(hexstring)) tx.deserialize(f) return...
#!/usr/bin/env python ''' This little example shows how a cursor can be created in image viewers, and renderers. The standard TkImageViewerWidget and TkRenderWidget bindings are used. There is a new binding: middle button in the image viewer sets the position of the cursor. ''' import sys from functools import p...
import itertools import pytest from speaklater import is_lazy_string from sqlalchemy.exc import IntegrityError from indico.modules.users import User from indico.modules.users.models.users import UserTitle def test_can_be_modified(): user = User() # user can modify himself assert user.can_be_modified(use...
import trio class ThreadFSAccess: def __init__(self, trio_token, workspace_fs): self.workspace_fs = workspace_fs self._trio_token = trio_token def _run(self, fn, *args): return trio.from_thread.run(fn, *args, trio_token=self._trio_token) def _run_sync(self, fn, *args): re...
# System imports import subprocess import time from os import path import shutil import numpy as np from flask.ext.cors import CORS from flask import * from werkzeug import secure_filename from flask_extensions import * import math # Local predicition modules # find modules in parent_folder/predictions # sys.path.app...
from direct.gui.DirectGui import * from direct.showbase import DirectObject from pandac.PandaModules import * import sys from otp.otpbase import OTPGlobals from otp.otpbase import OTPLocalizer from toontown.chat.ChatGlobals import * class ChatInputNormal(DirectObject.DirectObject): def __init__(self, chatMgr): ...
import unittest from unittest.mock import MagicMock, ANY from toolbelt.utils.git import Git from toolbelt.utils.subproc import SubProc class GitTest(unittest.TestCase): def setUp(self): self.sub_proc_mock = MagicMock(SubProc) self.sut = Git(self.sub_proc_mock) def test_clone(self): ...
from test import support import unittest import dummy_threading as _threading import time class DummyThreadingTestCase(unittest.TestCase): class TestThread(_threading.Thread): def run(self): global running global sema global mutex # Uncomment if testing ano...
''' args.py ''' import argparse import heron.tools.ui.src.python.consts as consts # pylint: disable=protected-access class _HelpAction(argparse._HelpAction): def __call__(self, parser, namespace, values, option_string=None): parser.print_help() # retrieve subparsers from parser subparsers_actions = [ ...
import mock from nose.tools import * # noqa from tests.base import OsfTestCase from tests.factories import RegistrationFactory, UserFactory from website import models from scripts.email_registration_contributors import ( get_registration_contributors, send_retraction_and_embargo_addition_message, main, MAIL...
import sys import unittest from copy import deepcopy from airflow import configuration from airflow.exceptions import AirflowException from airflow.contrib.operators.ecs_operator import ECSOperator try: from unittest import mock except ImportError: try: import mock except ImportError: mock...
import unittest import os import yaml import roslaunch import rostopic from roslaunch import core from testing_tools.misc import wait_for, wait_for_message from genpy.message import fill_message_args from sensor_msgs.msg import JointState from tf.msg import tfMessage from roslaunch import nodeprocess nodeprocess._TI...
""" Copyright (c) 2017, Jairus Martin. Distributed under the terms of the MIT License. The full license is in the file LICENSE, distributed with this software. Created on June 7, 2017 @author: jrm """ from atom.api import Typed, set_default from enamlnative.widgets.toggle_button import ProxyToggleButton from .and...
from openerp.osv import fields, osv from openerp.tools.translate import _ class res_company(osv.osv): _inherit = "res.company" _columns = { 'propagation_minimum_delta': fields.integer('Minimum Delta for Propagation of a Date Change on moves linked together'), 'internal_transit_location_id': fie...
from datetime import date from django.contrib.auth.decorators import login_required from django.db.models import Q from django.http import HttpResponseForbidden, JsonResponse from django.shortcuts import render, get_object_or_404 from django.conf import settings from django.views.decorators.csrf import csrf_exempt fro...
from _pygit2 import option from _pygit2 import GIT_OPT_GET_SEARCH_PATH, GIT_OPT_SET_SEARCH_PATH from _pygit2 import GIT_OPT_GET_MWINDOW_SIZE, GIT_OPT_SET_MWINDOW_SIZE class SearchPathList(object): def __getitem__(self, key): return option(GIT_OPT_GET_SEARCH_PATH, key) def __setitem__(self, key, value...
""" Created on Jul 1, 2012 @author: msouza """ import unittest import os import sys import sifter import FunctionModels.Sifter2 from pprint import pprint class Test_Sifter_Deaminase(unittest.TestCase): """ Tests SIFTER inference and leave one out on a toy family. """ def setUp(self): """ ...
from __future__ import print_function import argparse import difflib import glob import json import mmap import os import re import sys parser = argparse.ArgumentParser() parser.add_argument( "filenames", help="list of files to check, all files if unspecified", nargs='*') rootdir = os.path.dirname(__file...
"""This module contains an extensible mainline that's used by all Cloudfeaster services. """ import logging import optparse import signal import sys import time import tor_async_util import tornado.httpclient import tornado.httpserver import tornado.web from cloudfeaster_services import __version__ from config impor...
class ModuleDocFragment(object): # OpenNebula common documentation DOCUMENTATION = r''' options: api_url: description: - The ENDPOINT URL of the XMLRPC server. - If not specified then the value of the ONE_URL environment variable, if any, is used. type: str al...
import AlGDock.BindingPMF_plots import os, shutil, glob for run_type in ['cool','dock','postprocess','free_energies']: self = AlGDock.BindingPMF_plots.BPMF_plots(\ dir_dock='dock', dir_cool='cool',\ ligand_tarball='prmtopcrd/ligand.tar.gz', \ ligand_database='ligand.db', \ forcefield='prmtopcrd/gaff....
"""Extension for hiding server addresses in certain states.""" from oslo_config import cfg from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova.compute import vm_states opts = [ cfg.ListOpt('osapi_hide_server_address_states', default=[vm_states.BUILDING], ...
from InsightToolkit import * import itkTesting import sys import os import shutil basename = os.path.basename(sys.argv[0]) name = os.path.splitext(basename)[0] dir = "Algorithms" testInput = itkTesting.ITK_TEST_INPUT testOutput = itkTesting.ITK_TEST_OUTPUT baseLine = itkTesting.ITK_TEST_BASELINE reader = itkImage...
__author__ = 'root' #copied from python3 import os import sys def which(cmd, mode=os.F_OK | os.X_OK, path=None): """Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` def...
# Needed ctypes routines from ctypes import c_double, byref # Other GDAL imports. from django.contrib.gis.gdal.base import GDALBase from django.contrib.gis.gdal.envelope import Envelope, OGREnvelope from django.contrib.gis.gdal.error import OGRException, OGRIndexError, SRSException from django.contrib.gis.gdal....
import re from threading import Lock import crash_utils REVIEW_URL_PATTERN = re.compile(r'Review URL:( *)(.*?)/(\d+)') class Match(object): """Represents a match entry. A match is a CL that is suspected to have caused the crash. A match object contains information about files it changes, their authors, etc...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} from distutils.version import StrictVersion try: import shade HAS_SHADE = True exce...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This is a skeleton file that can serve as a starting point for a Python console script. To run this script uncomment the following line in the entry_points section in setup.cfg: console_scripts = fibonacci = siftsite.skeleton:run Then run `python setup.py ins...
import sys import os import genmsg.template_tools msg_template_map = { 'msg.h.template':'@NAME@.h' } srv_template_map = { 'srv.h.template':'@NAME@.h' } if __name__ == "__main__": genmsg.template_tools.generate_from_command_line_options(sys.argv, msg_tem...
# -*- coding: utf-8 -*- """ Production Configurations - Use djangosecure - Use Amazon's S3 for storing static files and uploaded media - Use mailgun to send emails - Use Redis on Heroku - Use sentry for error logging - Use opbeat for error reporting """ from __future__ import absolute_import, unicode_literals fro...
from distutils.core import setup CLASSIFIERS = ( ('Development Status :: 5 - Production/Stable'), ('Environment :: Console'), ('Environment :: Web Environment'), ('Framework :: Django'), #('Framework :: Zope3'), #('Framework :: Trac'), #('Framework :: TurboGears :: Widgets'), #('Framewo...
""" Lockfile behaviour implemented via Unix PID files. """ from __future__ import absolute_import import errno import os import time from . import (LockBase, AlreadyLocked, LockFailed, NotLocked, NotMyLock, LockTimeout) class PIDLockFile(LockBase): """ Lockfile implemented as a Unix PID fil...
# disable missing docstring # pylint: disable=missing-docstring import json from lettuce import world, step from nose.tools import assert_equal, assert_true # pylint: disable=no-name-in-module from common import type_in_codemirror, open_new_course from advanced_settings import change_value, ADVANCED_MODULES_KEY from ...
""" Integrity check debugging tool for IMAP accounts. Run as: python -m inbox.util.consistency_check --help """ from __future__ import absolute_import, division, print_function import argparse import errno import os import pkg_resources import subprocess import sys from fnmatch import fnmatch from inbox.models...
"""Runs Closure compiler on a JavaScript file to check for errors.""" import argparse import os import re import subprocess import sys import tempfile import build.inputs import processor import error_filter class Checker(object): """Runs the Closure compiler on a given source file and returns the success/error...
# coding: utf-8 """Check if any file has changed and then build this Dockerfile""" import os import sys import subprocess import argparse class DockerOdooImages(object): """Class to build if has changed any file""" def __init__(self, folder, docker_image): """Init method folder : Folder to c...
import requests from behave import * from peer_basic_impl import getAttributeFromJSON from bdd_request_util import httpGetToContainerAlias from bdd_test_util import bdd_log @when(u'I request transaction certs with query parameters on "{containerAlias}"') def step_impl(context, containerAlias): assert 'table' in c...
#!/bin/python #coding=utf-8 import MySQLdb import sys from optparse import OptionParser user_value="reboot" pass_value='reboot123' port_value=3306 def CHECK_ARGV(): argv_dict = {} usage = "usage: %prog [options] arg1 arg2" parser = OptionParser(usage) parser.add_option("-H","--host",dest="hostn...
__all__ = ['Queue', 'SimpleQueue', 'JoinableQueue'] import sys import os import threading import collections import time import atexit import weakref from Queue import Empty, Full import _multiprocessing from multiprocessing import Pipe from multiprocessing.synchronize import Lock, BoundedSemaphore, Semaphore, Condit...
from django.core.cache import cache from rest_framework.authentication import (BaseAuthentication, get_authorization_header) from ..profiles.models import User from .exceptions import PermissionDenied from .models import check_auth_token class GoogleLoginAuthentication(Base...
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'GroupBookmark' db.create_table('sentry_groupbookmark', ( ('id', self.gf('sentry.db.mod...
import codecs from os.path import join,isfile,isdir from os import mkdir def get_intervals(layout): results = [] layout = codecs.open(layout,'r') count = 0 for line in layout: count = count + 1 if count < 8: continue if line.strip()=='': continue # print line.split(' ') numbers = '' segment...
#!/usr/bin/env python import operator from optparse import OptionGroup import sys from time import time from digress.cli import Dispatcher as _Dispatcher from digress.errors import ComparisonError, FailedTestError, DisabledTestError from digress.testing import depends, comparer, Fixture, Case from digress.comparer...
""" Serial port support for Windows. Requires PySerial and pywin32. """ from __future__ import division, absolute_import # system imports from serial import PARITY_NONE from serial import STOPBITS_ONE from serial import EIGHTBITS import win32file, win32event # twisted imports from twisted.internet import abstract ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import python_2_unicode_compatible from django.conf import settings CONTINENTS = ( ("AF", _("Africa")), ("NA", _("North America")), ...
"""Tests for Keras loss functions.""" 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.python.platform import test ALL_LOSSES = [keras.losses.mean_squared_error, ...
""" sentry.models.releasefile ~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2015 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from django.db import models from hashlib import sha1 from sentry.db.models import FlexibleForei...
"""Tests for input pipeline modifications for distribution strategies.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os from tensorflow.contrib.distribute.python import input_ops from tensorflow.python.data.ops import dataset_ops from tensorflo...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models def add_legacy_name(apps, schema_editor): ContentType = apps.get_model('contenttypes', 'ContentType') for ct in ContentType.objects.all(): try: ct.name = apps.get_model(ct.app_label, c...
import django from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.generic import GenericForeignKey from django.db import models, IntegrityError, transaction from django.template.defaultfilters import slugify as default_slugify from django.utils.translation import ugettext_lazy as...
import sys from ansible.module_utils.basic import * from ansible.module_utils.ec2 import * try: import boto import boto.ec2 import boto.sns except ImportError: print "failed=True msg='boto required for this module'" sys.exit(1) def arn_topic_lookup(connection, short_topic): response = connec...
""" Shows real-time network statistics. Author: Giampaolo Rodola' <<EMAIL>> $ python examples/nettop.py ----------------------------------------------------------- total bytes: sent: 1.49 G received: 4.82 G total packets: sent: 7338724 received: 8082712 wlan0 TOTAL ...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'GeneratedCertificate' db.create_table('certificates_generatedcertificate', ( ('i...
"""Install a theme.""" from __future__ import print_function import os import io import time import requests import pygments from pygments.lexers import PythonLexer from pygments.formatters import TerminalFormatter from nikola.plugin_categories import Command from nikola import utils LOGGER = utils.get_logger('inst...
#!/usr/bin/python from __future__ import (absolute_import, division, print_function) # Copyright 2018 Fortinet, Inc. # # 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 3 of the Lic...
from gnuradio import gr, gr_unittest import random import struct #import os #print "pid =", os.getpid() #raw_input("Attach gdb and press return...") """ Note: The QA tests below have been disabled by renaming them from test_* to xtest_*. See ticket:199 on http://gnuradio.org/trac/ticket/199 """ class counter(gr.fev...
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( ExtractorError, unsmuggle_url, ) from ..compat import ( compat_parse_qs, compat_urlparse, ) class SenateISVPIE(InfoExtractor): _COMM_MAP = [ ["ag", "76440", "http://ag...
#coding:utf-8 import numpy as np from mlp import MultiLayerPerceptron from sklearn.datasets import load_digits from sklearn.cross_validation import train_test_split from sklearn.preprocessing import LabelBinarizer from sklearn.metrics import confusion_matrix, classification_report """ 簡易手書き数字データの認識 scikit-learnのインストール...
""" 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 use this ...
from __future__ import absolute_import, division, print_function __metaclass__ = type import os import re import uuid import hashlib from ansible.errors import AnsibleError from ansible.module_utils._text import to_text, to_bytes from ansible.module_utils.connection import Connection, ConnectionError from ansible.pl...