content
stringlengths
4
20k
""" Defining a Custom Plugin ======================== Test the custom plugin demoed on the `Pythonic Perambulations <http://jakevdp.github.io/blog/2014/01/10/d3-plugins-truly-interactive/>`_ blog. Hover over the points to see the associated sinusoid. Use the toolbar buttons at the bottom-right of the plot to enable zo...
"""Import hook support. Consistent use of this module will make it possible to change the different mechanisms involved in loading modules independently. While the built-in module imp exports interfaces to the built-in module searching and loading algorithm, and it is possible to replace the built-in function __impor...
"""A build script which (thus far) works on Ubuntu 14.""" import glob import logging import os import platform import re import shutil import subprocess import sys import tempfile def Die(msg): """Prints error and exits with status 1. Args: msg: The error message to emit """ print >> sys.stderr, msg s...
"""Tests for python.util.protobuf.compare.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import copy import re import textwrap import six from google.protobuf import text_format from tensorflow.python.platform import googletest from tensorflow.pytho...
from collections import namedtuple from django.utils import six # Structure returned by DatabaseIntrospection.get_table_list() TableInfo = namedtuple('TableInfo', ['name', 'type']) # Structure returned by the DB-API cursor.description interface (PEP 249) FieldInfo = namedtuple('FieldInfo', 'name type_code displa...
# encoding: utf-8 import datetime from south.db import db from south.v2 import DataMigration from django.db import models from django.contrib.auth.models import User class Migration(DataMigration): def forwards(self, orm): users = User.objects.all() for user in users: user.profile.pref...
""" This page is in the table of contents. The xml.py script is an import translator plugin to get a carving from an Art of Illusion xml file. An import plugin is a script in the interpret_plugins folder which has the function getCarving. It is meant to be run from the interpret tool. To ensure that the plugin works...
""" Third Party Auth REST API views """ from django.contrib.auth.models import User from django.db.models import Q from django.http import Http404 from rest_framework import exceptions, status from rest_framework.generics import ListAPIView from rest_framework.response import Response from rest_framework.views import A...
from django.conf.urls import patterns, url # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = patterns('', url(r'^$', 'chirper.views.home', name='home'), url(r'^login/$', 'chirper.views.stormpath_login', name='login'), url(r'^logout/...
import httplib import myparser import time import sys class search_dogpile: def __init__(self, word, limit): self.word = word self.total_results = "" self.server = "www.dogpile.com" self.hostname = "www.dogpile.com" self.userAgent = "(Mozilla/5.0 (Windows; U; Windows NT 6....
from logbook import Logger, StreamHandler, WARNING import sys import numpy as np from collections import deque from btgym.algorithms.rollout import Rollout class Memory(object): """ Replay memory with rebalanced replay based on reward value. Note: must be filled up before calling sampling method...
try: from taggit.managers import TaggableManager except (ImportError, RuntimeError): pass from django.conf import settings from django.db.models import fields try: from django.apps import apps except ImportError: from django.db.models import get_app #from xgds_data.models import VirtualIncludedField i...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os from ansible.module_utils.facts.collector import BaseFactCollector # A list of dicts. If there is a platform with more than one # package manager, put the preferred one last. If there is an # ansible module, use that ...
from rest_framework import status from rest_framework.test import APITestCase from .models import Empresa, Calificacion from .views import * class EmpresaRESTTests(APITestCase): def test_crear_empresa(self): data = { "nombre" : "test", "ciudad" : "ciudadtest", "sector" : "sectortest" } response = self.client.post...
import json from collections import OrderedDict from django.contrib.postgres.aggregates import ArrayAgg from django.http import HttpResponse from django.shortcuts import redirect from django.views.generic.list import ListView from django import forms from django.core.urlresolvers import reverse from amcat.forms.field...
""" Testing for Isolation Forest algorithm (sklearn.ensemble.iforest). """ # Authors: Nicolas Goix <<EMAIL>> # Alexandre Gramfort <<EMAIL>> # License: BSD 3 clause import numpy as np from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn...
"""Diagnostic functions, mainly for use when doing tech support.""" # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. __license__ = "MIT" import cProfile from io import StringIO from html.parser import HTMLParser import bs4 from bs4 import BeautifulSoup, __version__...
import collections import logging import os import psutil import sys if sys.platform.startswith('linux'): _TOOLS_PATH = os.path.dirname(os.path.abspath(__file__)) _TOOLS_LINUX_PATH = os.path.join(_TOOLS_PATH, 'linux') sys.path.append(_TOOLS_LINUX_PATH) import procfs # pylint: disable=F0401 class _NullHandl...
"""AbsoluteValue bijector.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.framework import ops from tensorflow.python.framework import tensor_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import check...
# stdlib from urlparse import urljoin # 3rd party import requests # project from checks import AgentCheck from config import _is_affirmative class Marathon(AgentCheck): DEFAULT_TIMEOUT = 5 SERVICE_CHECK_NAME = 'marathon.can_connect' ACS_TOKEN = None APP_METRICS = [ 'backoffFactor', ...
import util from tokens import * import lexer import ast import parser import end_expansion import name_mangler import type_collection import fun_collection # also collects templates, unspecialized import built_in_functions_stuff import slot_collection import type_inference_and_annotation util.currentFileName = "typ...
import re import os.path from io import open from setuptools import find_packages, setup try: from azure_bdist_wheel import cmdclass except ImportError: from distutils import log as logger logger.warn("Wheel is not available, disabling bdist_wheel hook") cmdclass = {} # Change the PACKAGE_NAME only to ...
'''Functions that load and write PEM-encoded files.''' import base64 from rsa._compat import b, is_bytes def _markers(pem_marker): ''' Returns the start and end PEM markers ''' if is_bytes(pem_marker): pem_marker = pem_marker.decode('utf-8') return (b('-----BEGIN %s-----' % pem_marker), ...
import os from setuptools import setup from setuptools import Extension from setuptools.command.build_ext import build_ext as BuildExt from subprocess import Popen DIR = os.path.abspath(os.path.dirname(__file__)) LIB_OBJECTS = [ 'core/desugarer.o', 'core/formatter.o', 'core/libjsonnet.o', 'core/lexer.o...
#!/usr/bin/env python """ Atlas of all graphs of 6 nodes or less. """ # Copyright (C) 2004-2016 by # Aric Hagberg <<EMAIL>> # Dan Schult <<EMAIL>> # Pieter Swart <<EMAIL>> # All rights reserved. # BSD license. import networkx as nx from networkx.generators.atlas import * from networkx.algorithms.is...
"""Build wheels/sdists by installing build deps to a temporary environment. """ import os import logging import toml import shutil from subprocess import check_call import sys from sysconfig import get_paths from tempfile import mkdtemp from .wrappers import Pep517HookCaller, LoggerWrapper log = logging.getLogger(__...
from .colorconv import (convert_colorspace, guess_spatial_dimensions, rgb2hsv, hsv2rgb, rgb2xyz, xyz2rgb, rgb2rgbcie, rgbcie2rgb, ...
__author__ = '' __docformat__ = 'plaintext' """Definition of the TransfersType content type. See transferstype.py for more explanation on the statements below. """ from Acquisition import aq_inner from docpool.transfers import DocpoolMessageFactory as _ from docpool.transfers.db.query import allowed_targets from plone...
""" Management command to update libraries' search index """ from django.core.management import BaseCommand, CommandError from optparse import make_option from textwrap import dedent from contentstore.courseware_index import LibrarySearchIndexer from opaque_keys.edx.keys import CourseKey from opaque_keys import Inval...
#!/usr/bin/env python ''' ''' __docformat__ = 'restructuredtext' __version__ = '$Id$' import time from pyglet.media import AbstractAudioPlayer, AbstractAudioDriver, \ MediaThread, MediaEvent import pyglet _debug = pyglet.options['debug_media'] class SilentAudioPacket(object): def __in...
"""The Extended Ips API extension.""" import itertools from nova.api.openstack import common from nova.api.openstack import extensions from nova.api.openstack import wsgi authorize = extensions.soft_extension_authorizer('compute', 'extended_ips_mac') class ExtendedIpsMacController(wsgi.Controller): def __init_...
import json from collections import defaultdict from django.conf import settings from django.contrib import messages from django.core.paginator import EmptyPage, Paginator, PageNotAnInteger from django.db.models import Q from django.http import HttpResponse, HttpResponseBadRequest, Http404 from django.shortcuts impor...
import click from ns1cli.cli import cli, write_options from ns1cli.util import Formatter from nsone.rest.resource import ResourceException class ZoneFormatter(Formatter): def print_zone(self, zdata): records = zdata.pop('records') self.pretty_print(zdata) if len(records) == 0: ...
from contextlib import nested from mock import patch import pytest from pytx import access_token from pytx.errors import pytxInitError from pytx.vocabulary import ThreatExchange as te class TestInit: def verify_token(self, expected_token): assert expected_token == access_token.get_access_token() de...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: bigip_gtm_datacenter short_description: Manage Datacenter c...
from datetime import datetime import unittest, uuid from urllib import urlencode # Zope import transaction # webob from webob import Response from webob.multidict import MultiDict # Repoze from repoze.bfg.testing import ( DummyModel, DummyRequest, cleanUp, registerUtility, ) from repoze.folder im...
# coding: utf-8 """ DeliveryHub DeliveryHub API OpenAPI spec version: 1.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtai...
#!/usr/bin/python # -*- coding: utf-8 -*- """ ============================================= Manifold Learning methods on a severed sphere ============================================= An application of the different :ref:`manifold` techniques on a spherical data-set. Here one can see the use of dimensionality reducti...
""" A set of results returned by SendMessageBatch. """ class ResultEntry(dict): """ The result (successful or unsuccessful) of a single message within a send_message_batch request. In the case of a successful result, this dict-like object will contain the following items: :ivar id: A string c...
import math import numpy as np # dynamic time warping - squared def get_metric(s, t): return _get_dtw_matrix(s, t, _point_cost_sqr)[-1, -1] def _get_dtw_matrix(s, t, point_norm): n = len(s) m = len(t) dtw = np.empty((n, m)) cost = np.empty(m) row = np.empty(m) _cost_vector(cost, s[0], ...
""" Support the sensor of a BloomSky weather station. For more details about this component, please refer to the documentation at https://home-assistant.io/components/sensor.bloomsky/ """ import logging import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const impo...
import ply.yacc as yacc from lexer import Lexer import syntax """ Commands : Command SEMI | Command SEMI Commands Command : Term | LCID Binder Binder : COLON Type PathTerm : PathTerm DOT LCID | PathTerm DOT INTV | ATerm Type ...
import Cython.Compiler.Errors as Errors from Cython.CodeWriter import CodeWriter from Cython.Compiler.TreeFragment import TreeFragment, strip_common_indent from Cython.Compiler.Visitor import TreeVisitor, VisitorTransform from Cython.Compiler import TreePath import unittest import os, sys import tempfile class NodeT...
from selenium.webdriver.common import by from openstack_dashboard.test.integration_tests.pages import basepage from openstack_dashboard.test.integration_tests.regions import forms class ChangepasswordPage(basepage.BaseNavigationPage): _password_form_locator = (by.By.ID, 'change_password_modal') CHA...
''' unit tests ONTAP Ansible module: na_ontap_nvme_namespace''' from __future__ import print_function import json import pytest from units.compat import unittest from units.compat.mock import patch from ansible.module_utils import basic from ansible.module_utils._text import to_bytes import ansible.module_utils.netap...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'core'} EXAMPLES = r""" # Before 2.3, option 'dest', 'destfile' or 'name' was used instead of 'path' - li...
""" TR-specific Form helpers """ from __future__ import absolute_import import re from django.contrib.localflavor.tr.tr_provinces import PROVINCE_CHOICES from django.core.validators import EMPTY_VALUES from django.forms import ValidationError from django.forms.fields import Field, RegexField, Select, CharField from ...
import time try: from novaclient.v1_1 import client as nova_client from novaclient import exceptions as exc HAS_NOVACLIENT = True except ImportError: HAS_NOVACLIENT = False def main(): argument_spec = openstack_argument_spec() argument_spec.update(dict( name =...
from oslo_policy import policy from nova.policies import base POLICY_ROOT = 'os_compute_api:os-networks:%s' BASE_POLICY_NAME = 'os_compute_api:os-networks:view' DEPRECATED_REASON = """ Nova API policies are introducing new default roles with scope_type capabilities. Old policies are deprecated and silently going to...
from openerp.osv import orm, fields, osv import openerp.addons.decimal_precision as dp import time class sale_prepayment(orm.TransientModel): _name = 'sale.prepayment' _columns = { 'journal_id': fields.many2one( 'account.journal', 'Journal', required=True), ...
# test the invariant that # iff a==b then hash(a)==hash(b) # # Also test that hash implementations are inherited as expected import datetime import os import sys import unittest from test import support from test.script_helper import assert_python_ok from collections import Hashable IS_64BIT = sys.maxsize > 2**32 ...
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword from weboob.tools.json import json as simplejson from weboob.capabilities.video import BaseVideo from weboob.capabilities import NotAvailable from weboob.tools.capabilities.thumbnail import Thumbnail from weboob.capabilities.collection import Collec...
import github.GithubObject import github.NamedUser class StatsPunchCard(github.GithubObject.NonCompletableGithubObject): """ This class represents the punch card. The reference can be found here http://developer.github.com/v3/repos/statistics/#get-the-number-of-commits-per-hour-in-each-day """ def g...
"""A module proxy for delayed importing of modules. From http://barnesc.blogspot.com/2006/06/automatic-python-imports-with-autoimp.html, in the public domain. """ import sys class LazyModule(object): """A lazy module proxy.""" def __init__(self, modname): self.__dict__['__name__'] = modname ...
import numpy as np import theano import theano.tensor as T import lasagne as nn import data import load import nn_plankton import dihedral import dihedral_fast import tmp_dnn import tta validation_split_path = "splits/bagging_split_0.pkl" patch_size = (95, 95) augmentation_params = { 'zoom_range': (1 / 1.6,...
""" Classes to represent the default SQL aggregate functions """ import copy import warnings from django.db.models.fields import IntegerField, FloatField from django.db.models.lookups import RegisterLookupMixin from django.utils.deprecation import RemovedInDjango20Warning from django.utils.functional import cached_pro...
"""Module for the Jax tracer functionality for tags.""" import functools from typing import Any, Callable, Sequence, Tuple import jax from jax import core from jax import util as jax_util import jax.numpy as jnp from kfac_ferminet_alpha import layers_and_loss_tags as tags from kfac_ferminet_alpha import tag_graph_mat...
"""Back-end components storage (links to platform-specific things)""" from .element_info import ElementInfo from .base_wrapper import BaseWrapper class BackEnd(object): """Minimal back-end description (name & 2 required base classes)""" def __init__(self, name, element_info_class, generic_wrapper_class): ...
from __future__ import print_function # AsymmetricRandom Chess import random from pychess.Utils.const import * from pychess.Utils.Board import Board class AsymmetricRandomBoard(Board): variant = ASYMMETRICRANDOMCHESS def __init__ (self, setup=False, lboard=None): if setup is True: Board....
"""Stuff that differs in different Python versions""" import os import imp import sys import site __all__ = ['WindowsError'] uses_pycache = hasattr(imp, 'cache_from_source') class NeverUsedException(Exception): """this exception should never be raised""" try: WindowsError = WindowsError except NameError: ...
# _*_ coding: utf-8 _*_ __author__ = 'tongxindao' """djangomooc URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpa...
import time from openerp.osv import osv from openerp.report import report_sxw class report_print_check(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(report_print_check, self).__init__(cr, uid, name, context) self.number_lines = 0 self.number_add = 0 self....
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import os import pkg_resources import re import unittest import shlex import shutil import subprocess import sys import tempfile import traceback def ascend_find_exe(pat...
"""CGI-savvy HTTP Server. This module builds on SimpleHTTPServer by implementing GET and POST requests to cgi-bin scripts. If the os.fork() function is not present (e.g. on Windows), os.popen2() is used as a fallback, with slightly altered semantics; if that function is not present either (e.g. on Macintosh), only Py...
from argus.backends.tempest import tempest_backend from argus import config as argus_config from argus import exceptions from argus import util with util.restore_excepthook(): from tempest.common import dynamic_creds from tempest.common import waiters CONFIG = argus_config.CONFIG SUBNET6_CIDR = ":...
from google.appengine.api import users from google.appengine.ext import webapp, db class UpdateBase(webapp.RequestHandler): def _int_from_request(self, name): string_value = self.request.get(name) try: int_value = int(string_value) return int_value except ValueError...
from glob import glob from distutils.util import convert_path import distutils.command.build_py as orig import os import fnmatch import textwrap import io import distutils.errors import itertools from setuptools.extern import six from setuptools.extern.six.moves import map, filter, filterfalse try: from setuptool...
from test import test_support import types import unittest class FuncAttrsTest(unittest.TestCase): def setUp(self): class F: def a(self): pass def b(): return 3 self.f = F self.fi = F() self.b = b def cannot_set_attr(self,obj, nam...
try: from thread import get_ident as _get_ident except ImportError: from dummy_thread import get_ident as _get_ident try: from _abcoll import KeysView, ValuesView, ItemsView except ImportError: pass class OrderedDict(dict): 'Dictionary that remembers insertion order' # An inherited dict maps ...
import hashlib import json from girder.api import access from girder.api.describe import describeRoute, Description from girder.api.rest import Resource, ValidationException, loadmodel from girder.utility import assetstore_utilities, progress from girder.plugins.minerva.rest.geojson_dataset import GeojsonDataset from ...
import json import os.path import ansible.module_utils.basic from ansible.compat.tests import unittest from ansible.compat.tests.mock import Mock, patch from ansible.module_utils import known_hosts from units.mock.procenv import swap_stdin_and_argv class TestAnsibleModuleKnownHosts(unittest.TestCase): urls = { ...
# to run: # pip install unittest2 # unit2 discover # # to debug: # pip install nose # nosetests --pdb import StringIO import sys import pdfquery import unittest2 from pdfquery.cache import FileCache class TestPDFQuery(unittest2.TestCase): """ Various tests based on the IRS_1040A sample doc. """ ...
"""Unit tests for the ``synse_server.cmd.write`` module.""" import asynctest import pytest from synse_grpc import api from synse_server import cmd, errors @pytest.mark.asyncio async def test_write_async_plugin_not_found(mocker): # Mock test data mock_write_async = mocker.patch( 'synse_grpc.client.Pl...
"""sitio_web URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-...
# -*- coding: utf-8 -*- from odoo import api, fields, models, _ from odoo.exceptions import UserError class SaleCouponApplyCode(models.TransientModel): _name = 'sale.coupon.apply.code' _rec_name = 'coupon_code' _description = 'Sales Coupon Apply Code' coupon_code = fields.Char(string="Coupon", requi...
try: import json except ImportError: import simplejson as json from ansible.module_utils._text import to_bytes, to_text from ansible.module_utils.pycompat24 import get_exception from ansible.module_utils.six import PY3 from ansible.module_utils.six.moves.urllib.parse import quote from ansible.module_utils.urls...
# encoding: utf-8 import hmac import json import time import base64 import collections from website import settings # Written by @jmcarp originally def order_recursive(data): """Recursively sort keys of input data and all its nested dictionaries. Used to ensure consistent ordering of JSON payloads. """ ...
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'TruffeUser.email_perso' db.add_column(u'users_truffeuser'...
"""Support for Sky Hub.""" import logging from pyskyqhub.skyq_hub import SkyQHub import voluptuous as vol from homeassistant.components.device_tracker import ( DOMAIN, PLATFORM_SCHEMA, DeviceScanner, ) from homeassistant.const import CONF_HOST from homeassistant.helpers.aiohttp_client import async_get_cli...
# -*- Mode: Python; test-case-name: whipper.test.test_common_accurip -*- # vi:si:et:sw=4:sts=4:ts=4 import sys from StringIO import StringIO from os import chmod, makedirs from os.path import dirname, exists, join from shutil import copy, rmtree from tempfile import mkdtemp from unittest import TestCase from whipper....
import socket import pygeoip import json import requests from ports import getcommonports, portscan from ipaddress import ip_private, ip_add, ip_order from hetrixblacklist import blacklistscan from mongo import ConexionMongoDB def geo(_file, _ip): ''' This function search the geolocation values of an IP address ''...
__authors__ = "Ian Goodfellow" __copyright__ = "Copyright 2010-2012, Universite de Montreal" __credits__ = ["Ian Goodfellow"] __license__ = "3-clause BSD" __maintainer__ = "LISA Lab" __email__ = "pylearn-dev@googlegroups" from pylearn2.testing.skip import skip_if_no_gpu skip_if_no_gpu() import numpy as np from theano....
from pootle.core.url_helpers import get_all_pootle_paths, split_pootle_path from pootle_app.models import Directory from pootle_store.models import Store from .models import VirtualFolder def extract_vfolder_from_path(pootle_path): """Return a valid virtual folder and an adjusted pootle path. This accepts a...
#!/usr/bin/env python import h5py import numpy import argparse import cPickle from fuel.datasets.hdf5 import H5PYDataset def pack(f, name, dataset_pathes): datasets = [cPickle.load(open(path)) for path in dataset_pathes] data = sum(datasets, []) dtype = h5py.special_dtype(vlen=numpy.dtype('int32')) t...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: win_iis_webapppool version_added: "2.0" short_description: Configure IIS Web Application Pools description: - Creates, removes and configures an ...
from LogAnalyzer import Test,TestResult import DataflashLog class TestPerformance(Test): '''check performance monitoring messages (PM) for issues with slow loops, etc''' def __init__(self): Test.__init__(self) self.name = "PM" def run(self, logdata, verbose): self.result = TestRe...
# -*- coding: utf-8 -*- import xbmcgui, xbmc, xbmcplugin enable_debug = False ####################################### # Xbmc Helpers ####################################### def select(title, menuItems): select = xbmcgui.Dialog().select(title, menuItems) if select == -1: return None else: ...
"""Correct signatures, wrong file name. """ def web_socket_do_extra_handshake(request): pass def web_socket_transfer_data(request): request.connection.write( 'sub/no_wsh_at_the_end.py is called for %s, %s' % (request.ws_resource, request.ws_protocol)) # vi:sts=4 sw=4 et
"""Suite System Events Suite: Terms and Events for controlling the System Events application Level 1, version 1 Generated from /System/Library/CoreServices/System Events.app AETE/AEUT resource version 1/0, language 0, script 0 """ import aetools import MacOS _code = 'sevs' class System_Events_Suite_Events: def...
""" Verifies --root-target removes the unnecessary targets. """ import TestGyp test = TestGyp.TestGyp() build_error_code = { 'android': 2, 'cmake': 1, 'make': 2, 'msvs': 1, 'ninja': 1, 'xcode': 65, }[test.format] # By default, everything will be included. test.run_gyp('test1.gyp') test.build('test2.gyp'...
# -*- coding: cp1252 -*- import csv import sys from xml.dom import minidom def get_attributes(file_xml): out = [] dom1 = minidom.parse(file_xml) for node in dom1.getElementsByTagName('attribute'): out.append({ 'name': node.getAttribute('name') , 'atype':...
# coding: utf-8 ''' Django management command to populate `Instance` instances with hashes for use in duplicate detection. Relies solely on the `argparse` capabilities of `BaseCommand` for argument parsing and validation. :Example: python manage.py populate_xml_hashes_for_instances --repopulate --usernames someu...
import cPickle import os import time import mxnet as mx import numpy as np from module import MutableModule from rcnn.logger import logger from rcnn.config import config from rcnn.io import image from rcnn.processing.bbox_transform import bbox_pred, clip_boxes from rcnn.processing.nms import py_nms_wrapper, cpu_nms_wr...
from __future__ import absolute_import import os import shutil from django.core.files import File from django.core.files.images import ImageFile from django.test import TestCase from .models import (Image, Person, PersonWithHeight, PersonWithHeightAndWidth, PersonDimensionsFirst, PersonTwoImages, TestImageFieldF...
from PIL import Image from PIL.ExifTags import TAGS, GPSTAGS import os, sys import subprocess ''' Usage: python map-in-picture.py photo1.JPG photo2.JPG Set variable maperitive_path to maperitive.exe! ''' def get_exif_data(image): """Returns a dictionary from the exif data of an PIL Image item. Also converts the ...
from django import forms from django.forms.util import ErrorList from django.utils.translation import ugettext_lazy as _ from github import UnknownObjectException from wtl.wtgithub.worker import GithubWorker, ParseError, CantFindParserError class AnalyzeForm(forms.Form): git_url = forms.CharField() def anal...
import sqlalchemy as sa from sqlalchemy import orm from neutron.db import model_base from neutron.db import models_v2 from neutron.extensions import portbindings BINDING_PROFILE_LEN = 4095 class NetworkSegment(model_base.BASEV2, models_v2.HasId): """Represent persistent state of a network segment. A networ...
import sys has_pytest = False #there is the difference between 1.3.4 and 2.0.2 versions #Since version 1.4, the testing tool "py.test" is part of its own pytest distribution. try: import pytest has_pytest = True except: try: import py except: raise NameError("No py.test runner found in selected interpr...
# coding=utf-8 from test_plus.test import TestCase from ..admin import MyUserCreationForm class TestMyUserCreationForm(TestCase): def setUp(self): self.user = self.make_user('notalamode', 'notalamodespassword') def test_clean_username_success(self): # Instantiate the form with a new username...
import theano from theano import tensor from theano.compat.six.moves import xrange import numpy from pylearn2.linear.conv2d_c01b import (Conv2D, make_random_conv2D, make_sparse_random_conv2D, setup_detector_layer_c01b) from pylearn2.space import Conv2DSpace from pylearn2.utils import sharedX from pylearn2.testing.s...