content
stringlengths
4
20k
"""Tests that the TensorFlow parts of the prediction example run.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from os import path from tensorflow.contrib.timeseries.examples import predict from tensorflow.python.platform import test _MODULE_PATH ...
import optparse import sys from optparse import * class nodefault(object): pass class splitter(object): def __init__(self, split): self.split = split def __call__(self, option, opt_str, value, parser): values = value.split(self.split) dest = getattr(parser.values, option.dest) ...
#!/usr/bin/env python3 """ This script tests the rotation of spherical harmonic coefficients """ import numpy as np import pyshtools from pyshtools import rotate pyshtools.utils.figstyle() def main(): test_SHRotations() def test_SHRotations(): # ---- input parameters ---- lmax = 3 alpha, beta, gam...
""" Informal notes, mostly for compatibility with other bots. Based entirely on nicks, it's an easy way to tell users who refuse to register notes when they arrive later. """ import supybot import supybot.world as world # Use this for the version of this plugin. You may wish to put a CVS keyword # in here if you're...
"""Tests for the ATAG integration.""" from homeassistant.components.atag import DOMAIN from homeassistant.config_entries import ENTRY_STATE_SETUP_RETRY from homeassistant.core import HomeAssistant from . import init_integration, mock_connection from tests.test_util.aiohttp import AiohttpClientMocker async def test...
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals import pytest from nose.tools import * # noqa PEP8 asserts from osf_tests import factories from tests.base import OsfTestCase from website.util import api_url_for from website.views import find_bookmark_collect...
""" Tests related to the cohorting feature. """ from uuid import uuid4 from nose.plugins.attrib import attr from common.test.acceptance.fixtures.course import CourseFixture, XBlockFixtureDesc from common.test.acceptance.pages.common.auto_auth import AutoAuthPage from common.test.acceptance.pages.lms.courseware import...
#!/usr/bin/env python # encoding: utf-8 # pylint: skip-file import unittest from position import Position class _MPBase(object): def runTest(self): obj = Position(*self.obj) for pivot, delta, wanted in self.steps: obj.move(Position(*pivot), Position(*delta)) self.assert...
#!/usr/bin/env python2 # vim:fileencoding=utf-8 from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>' import re, string from collections import Counter, defaultdict from functool...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'gpmp/ui/playlists.ui' # # by: PyQt4 UI code generator 4.9.1 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: _fromUtf8 = l...
""" Welcome to the encoding dance! In a nutshell, text columns are actually a proxy class for byte columns, which just encode/decodes contents. """ from mitmproxy.tools.console import signals from mitmproxy.tools.console.grideditor import col_bytes class Column(col_bytes.Column): def __init__(self, heading, enc...
from __future__ import absolute_import from __future__ import print_function import numpy as np np.random.seed(1337) # for reproducibility from kerosene.datasets import mnist from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation, Flatten from keras.layers.convolutional import Co...
"""Error object commonly used in linters.""" __author__ = ('<EMAIL> (Robert Walker)', '<EMAIL> (Andy Perelson)') class Error(object): """Object representing a style error.""" def __init__(self, code, message, token, position, fix_data): """Initialize the error object. Args: code: Th...
""" DELSIG style matrix and vector padding routines =============================================== """ import numpy as np __all__ = ["padl", "padr", "padt", "padb"] def padl(x, n, val=0): """ Pad a matrix or a vector on the left. Parameters ---------- x : ndarray matrix or vector to be...
from sqlalchemy import Column, Integer, MetaData, String, Table def upgrade(migrate_engine): # Upgrade operations go here. Don't create your own engine; # bind migrate_engine to your metadata meta = MetaData() meta.bind = migrate_engine volumes = Table('volumes', meta, autoload=True) # Add c...
__codes = { 'AD': 'ANDORRA', 'AE': 'UNITED ARAB EMIRATES', 'AF': 'AFGHANISTAN', 'AG': 'ANTIGUA AND BARBUDA', 'AI': 'ANGUILLA', 'AL': 'ALBANIA', 'AM': 'ARMENIA', 'AN': 'NETHERLANDS ANTILLES', 'AO': 'ANGOLA', 'AQ': 'ANTARCTICA', 'AR': 'ARGENTINA', 'AS': 'AMERICAN SAMOA', ...
#!/usr/bin/python import pexpect, sys, exceptions host = "localhost" port = 8945 baseUsername = "unit" password = "unit123" def usage(): print "Usage: %s [count] [host] [port]" % sys.argv[0] sys.exit(1) if len(sys.argv) < 2: usage() try: userCount = int(sys.argv[1]) except exceptions.ValueError: ...
import os import sys import imp from zipimport import zipimporter from django.core.exceptions import ImproperlyConfigured from django.utils import unittest from django.utils.importlib import import_module from django.utils.module_loading import import_by_path, module_has_submodule from django.utils._os import upath ...
from translate import Translator import json import unittest class TestJavaTranslator(unittest.TestCase): def setUp(self): with open("targets/java.json", "r") as targetFile: self.translator = Translator(json.load(targetFile)) def test_translateProgram(self): """ CSVFile tr...
import json from django.conf import settings from django.core.urlresolvers import reverse from django.core.exceptions import ObjectDoesNotExist from django.http import HttpResponse from django.template import RequestContext from django.template.loader import render_to_string from django.utils.encoding import smart_str...
from django.db.models.aggregates import StdDev from django.db.utils import ProgrammingError from django.utils.functional import cached_property class BaseDatabaseFeatures(object): gis_enabled = False allows_group_by_pk = False allows_group_by_selected_pks = False empty_fetchmany_value = [] update_...
from datetime import date, datetime, time, timedelta from django.contrib.auth.models import User from django.test import TestCase import mox from django_lean.lean_retention.models import DailyActivity from django_lean.lean_retention.reports import (sort_retention_periods, ...
""" This module handles log file upload and download, delete log files from the blobstore (only allowed via a cron job) at a set interval and also creates a 10Mb downloadable file useful for bandwidth benchmarking. """ import cgi import logging import random import os import webapp2 import urllib import datetim...
import sys import imp import os import unittest from test import test_support test_src = """\ def get_name(): return __name__ def get_file(): return __file__ """ absimp = "import sub\n" relimp = "from . import sub\n" deeprelimp = "from .... import sub\n" futimp = "from __future__ import absolute_import\n" r...
import hashlib import inspect import os import os.path import pytest import sys import time import re def md5sum_data(data): """Calculate the MD5 hash of some data. Args: data: The data to hash. Returns: The hash of the data, as a binary string. """ h = hashlib.md5() h.update...
""" Wrapper class that takes a list of template loaders as an argument and attempts to load templates from them in order, caching the result. """ import hashlib import warnings from django.template import Origin, Template, TemplateDoesNotExist from django.template.backends.django import copy_exception from django.uti...
#!/usr/bin/env python #------------------------------------------------------------------------------- # # shotwellfs.py # # # See usage for details. # # LIMITATIONS: Unicode tags are not supported? # #------------------------------------------------------------------------------- import datetime import errno import o...
import MySQLdb, re, string def statcmp(a, b): v1 = a.split('.') v2 = b.split('.') last = min(len(v1), len(v2)) - 1 for i,j in zip(v1[0:last], v2[0:last]): if i != j: return cmp(i, j) # Special compare for last element. if len(v1) == len(v2): return cmp(v1[last], v2...
""" Django management command to create a course in a specific modulestore """ from django.core.management.base import BaseCommand, CommandError from django.contrib.auth.models import User from xmodule.modulestore import ModuleStoreEnum from contentstore.views.course import create_new_course_in_store from contentstore....
from __future__ import division, print_function, absolute_import from dipy.utils.six import string_types import numpy as np try: from scipy.linalg import polar except ImportError: # Some elderly scipy doesn't have polar from dipy.fixes.scipy import polar from scipy.linalg import inv from dipy.io import gra...
""" SoftLayer.tests.CLI.modules.ticket_tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :license: MIT, see LICENSE for more details. """ from SoftLayer import testing import json class TicketTests(testing.TestCase): def test_list(self): result = self.run_command(['ticket', 'list']) e...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) from unittest import skipIf from pants.java.distribution.distribution import DistributionLocator from pants.util.osutil import OS_ALIASES, get_os_name from pants_test...
# encoding: utf-8 """Classes and functions for kernel related errors and exceptions. Authors: * Brian Granger * Min RK """ from __future__ import print_function import sys import traceback __docformat__ = "restructuredtext en" # Tell nose to skip this module __test__ = {} #---------------------------------------...
#! /usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2011-2015 (ita) """ A client for the network cache (playground/netcache/). Launch the server with: ./netcache_server, then use it for the builds by adding the following: def build(bld): bld.load('netcache_client') The parameters should be present in the envi...
import re import gdb.printing class BadChildrenContainerPrinter1(object): """Children iterator doesn't return a tuple of two elements.""" def __init__(self, val): self.val = val def to_string(self): return 'container %s with %d elements' % (self.val['name'], self.val['len']) @static...
from test.support import verbose, run_unittest, import_module, reap_children #Skip these tests if either fcntl or termios is not available fcntl = import_module('fcntl') import_module('termios') import errno import pty import os import sys import select import signal import socket import unittest TEST...
""" :synopsis: the Django Q&A forum application Functions in the askbot module perform various basic actions on behalf of the forum application """ import os import smtplib import sys import logging VERSION = (0, 7, 43) #keys are module names used by python imports, #values - the package qualifier to use for pip REQ...
import datetime import json from django import forms from django.core import exceptions, serializers from django.db import models from django.test import SimpleTestCase, TestCase from .models import DurationModel, NullDurationModel class TestSaveLoad(TestCase): def test_simple_roundtrip(self): duration...
import os import socket import time import socket # pythonic discriminated union I guess, this is kind of retarded. # actually 0 need for a base class it's really more like a comment # that happens to be runable code class RunError(Exception): def __init__(self, str): self.str = str def __str__(self)...
"""Tests for google.protobuf.message_factory.""" import os os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'cpp' os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION'] = '2' # We must set the implementation version above before the google3 imports. # pylint: disable=g-import-not-at-top from google.apputi...
""" Utility functions for dealing with primes. """ import os from paramiko import util from paramiko.py3compat import byte_mask, long from paramiko.ssh_exception import SSHException def _roll_random(n): """returns a random # from 0 to N-1""" bits = util.bit_length(n - 1) byte_count = (bits + 7) // 8 ...
from __future__ import absolute_import from bokeh.io import save from bokeh.models import HoverTool from bokeh.plotting import figure from selenium.webdriver.common.action_chains import ActionChains from tests.integration.utils import has_no_console_errors import pytest pytestmark = pytest.mark.integration HEIGHT = ...
"""This example gets a team by its ID. To determine which teams exist, run get_all_teams.py. Tags: TeamService.getTeam """ __author__ = '<EMAIL> (Jeff Sham)' # Locate the client library. If module was installed via "setup.py" script, then # the following two lines are not needed. import os import sys sys.path.inser...
import sqlalchemy as sa from sqlalchemy import orm from sqlalchemy.orm import exc from sqlalchemy import sql from neutron.api.v2 import attributes as attr from neutron.db import db_base_plugin_v2 from neutron.db import model_base from neutron.db import models_v2 from neutron.openstack.common import log from neutron.op...
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function) __metaclass__ = type # # Copyright (C) 2017 Lenovo, Inc. # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public Licens...
#! /usr/bin/python # -*- python -*- # -*- coding: utf-8 -*- import perf class tracepoint(perf.evsel): def __init__(self, sys, name): config = perf.tracepoint(sys, name) perf.evsel.__init__(self, type = perf.TYPE_TRACEPOINT, config = config,...
""" This module implements the XMLFeedSpider which is the recommended spider to use for scraping from an XML feed. See documentation in docs/topics/spiders.rst """ from scrapy.spiders import Spider from scrapy.utils.iterators import xmliter, csviter from scrapy.utils.spider import iterate_spider_output from scrapy.sel...
from tika import parser from vector import Vector from random import randint import argparse, os, csv, itertools, copy, json, sys union_features = set() def filterFiles(inputDir, acceptTypes): filename_list = [] for root, dirnames, files in os.walk(inputDir): dirnames[:] = [d for d in dirnames if not...
""" Copyright (c) 2017 Genome Research Ltd. Authors: * Simon Beal <<EMAIL>> * Christopher Harrison <<EMAIL>> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, o...
# Extension to format a paragraph # Does basic, standard text formatting, and also understands Python # comment blocks. Thus, for editing Python source code, this # extension is really only suitable for reformatting these comment # blocks or triple-quoted strings. # Known problems with comment reformatting: # * If t...
# # This file is for everybody to add tests for bugs that aren't # fixed yet. Please add a test case and appropriate bug description. # # When you fix one of the bugs, please move the test to the correct # test_ module. # import unittest from test import support # # One test case for outstanding bugs at the moment: #...
"""Tests for tensorflow.ops.resource_variable_ops.""" 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 errors from tenso...
"""Provides functionality to interact with image processing services.""" import asyncio from datetime import timedelta import logging import voluptuous as vol from homeassistant.const import ( ATTR_ENTITY_ID, ATTR_NAME, CONF_ENTITY_ID, CONF_NAME) from homeassistant.core import callback from homeassistant.exceptio...
"""Test the Yeelight config flow.""" from unittest.mock import MagicMock, patch from homeassistant import config_entries from homeassistant.components.yeelight import ( CONF_MODE_MUSIC, CONF_MODEL, CONF_NIGHTLIGHT_SWITCH, CONF_NIGHTLIGHT_SWITCH_TYPE, CONF_SAVE_ON_CHANGE, CONF_TRANSITION, DE...
import datetime from django.core import signing from django.test import SimpleTestCase from django.test.utils import freeze_time class TestSigner(SimpleTestCase): def test_signature(self): "signature() method should generate a signature" signer = signing.Signer('predictable-secret') sign...
class Flap(object): """Common registration methods for applications & blueprints""" def __init__(self, flail): self.flail = flail def configure_context_processors(self, app, context_processors): """Sets app wide context processors.""" app.context_processor(lambda: context_processors...
from collections import namedtuple from unittest import TestCase from redash.permissions import has_access MockUser = namedtuple('MockUser', ['permissions', 'group_ids']) view_only = True class TestHasAccess(TestCase): def test_allows_admin_regardless_of_groups(self): user = MockUser(['admin'], []) ...
"""Tests of the readline-based CLI.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import tempfile from tensorflow.python.debug.cli import debugger_cli_common from tensorflow.python.debug.cli import readline_ui from tensorflow.python.deb...
# -*- coding: utf-8 -*- """ test_markup ~~~~~~~~~~~ Test various Sphinx-specific markup extensions. :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from docutils import frontend, utils, nodes from docutils.parsers import rst ...
import shutil import time import socket def main(): def run_gluster(gargs, **kwargs): args = [glusterbin] args.extend(gargs) rc, out, err = module.run_command(args, **kwargs) if rc != 0: module.fail_json(msg='error running gluster (%s) command (rc=%d): %s' % (' '.join(...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import json import pytest from mock import ANY from ansible.module_utils.network.fortios.fortios import FortiOSHandler try: from ansible.modules.network.fortios import fortios_system_automation_stitch except ImportEr...
from veripy.models.ip_address import IPAddress class IPAddressCollection(object): INTERFACELOCAL = 1 LINKLOCAL = 2 SUBNETLOCAL = 3 ADMINLOCAL = 4 SITELOCAL = 5 ORGANISATIONLOCAL = 8 GLOBAL = 15 def __init__(self, ips): self.__v4_ips = [] self.__v4_mapped_ips = []...
import sys import os import fnmatch import re DOC_PATTERN = '^(?P<indent>[\\t ]*)#\\[(\\s*)doc(\\s*)=' + \ '(\\s*)"(?P<text>(\\"|[^"])*?)"(\\s*)\\]' + \ '(?P<semi>;)?' ESCAPES = [("\\'", "'"), ('\\"', '"'), ("\\n", "\n"), ("\\r", "\r"), ("\\t", ...
from pyramid.renderers import render def includeme(config): config.add_renderer(name='chart', factory='chartfood.InlineChartRenderer') config.add_renderer(name='chart_response', factory='chartfood.ChartResponseRenderer') class ChartRenderer(object): def c...
""" A port of Infobot's nickometer command from Perl. This plugin provides one command (called nickometer) which will tell you how 'lame' an IRC nick is. It's an elitist hacker thing, but quite fun. """ import supybot import supybot.world as world # Use this for the version of this plugin. You may wish to put a CVS ...
import os from twisted.python import log from twisted.internet import defer import sqlalchemy as sa import migrate import migrate.versioning.api from buildbot.db import connector from buildbot.test.util import db, dirs, querylog from buildbot.test.fake import fakemaster # test_upgrade vs. migration tests # # test_upg...
# coding: utf-8 #ELB delete import boto3 # nodelete,trueを変数化 ND = 'nodelete' TR = 'true' def lambda_handler(event, context): #if __name__ == '__main__': #EC2の場合 client = boto3.client('elb') #loadbalancersの情報を変数化 resp = client.describe_load_balancers() all_list1 = [] del_list1 = [] #loadbala...
from Analyser_Osmosis import Analyser_Osmosis sql10 = """ CREATE TEMP TABLE cvqnotag AS SELECT * FROM ( SELECT ways.id, ways.linestring FROM ways LEFT JOIN relation_members ON relation_members.member_id = ways.id AND relation_members.member_type = 'W'...
# -*- coding: utf-8 -*- """ requests.structures ~~~~~~~~~~~~~~~~~~~ Data structures that power Requests. """ import os import collections from itertools import islice class IteratorProxy(object): """docstring for IteratorProxy""" def __init__(self, i): self.i = i # self.i = chain.from_iter...
# -*- coding: utf-8 -*- """ *************************************************************************** Providers.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com *****************************...
"""Common functions for auto_scheduler test cases""" import tvm from tvm import te, auto_scheduler from tvm import topi from tvm.topi.nn.winograd_util import winograd_transform_matrices from tvm.topi.utils import get_const_tuple @auto_scheduler.register_workload def matmul_auto_scheduler_test(N, M, K): A = te.pla...
''' Created on 25.9.2010 @author: marekp ''' import sys import platform import stat as statinfo import fs.errors as errors from fs.path import pathsplit try: # For non-CPython or older CPython versions. # Simplejson also comes with C speedup module which # is not in standard CPython >=2.6 ...
# encoding: utf-8 import datetime from south.db import db from south.v2 import DataMigration from django.db import models class Migration(DataMigration): def forwards(self, orm): "Write your forwards methods here." # Migrate BugzillaTracker to BugzillaTrackerModel for bt in orm['customs.Bu...
from numpy import * from matplotlib.pyplot import * def nconnect(n1,n2,S,order="l0", p_h = None): N = 60 Phx = (n1.x+n2.x)/2.0 Phy = (n1.y+n2.y)/2.0 lP = sqrt((n2.x-n1.x)**2 + (n2.y-n1.y)**2) dPx = (n2.x-n1.x)/lP dPy = (n2.y-n1.y)/lP Cx = Phx - S*dPy Cy = Phy + S*dPx ...
"""Keras layers API.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function # Generic layers. # pylint: disable=g-bad-import-order from tensorflow.python.keras.engine.input_layer import Input from tensorflow.python.keras.engine.input_layer import InputLayer fro...
import time from boto.provider import Provider _HAS_GOOGLE_CREDENTIALS = None def has_google_credentials(): global _HAS_GOOGLE_CREDENTIALS if _HAS_GOOGLE_CREDENTIALS is None: provider = Provider('google') if (provider.get_access_key() is None or provider.get_secret_key() is None...
"""Adjust some old Python 2 idioms to their modern counterparts. * Change some type comparisons to isinstance() calls: type(x) == T -> isinstance(x, T) type(x) is T -> isinstance(x, T) type(x) != T -> not isinstance(x, T) type(x) is not T -> not isinstance(x, T) * Change "while 1:" into "while True:"....
"""Config file for threshold metrics of Performance Tests. This file contains, for every Oppia page, corresponding thresholds for different performance metrics. Each page entry includes: url: relative path to the page. size_limits_mb: threshold for the total data transferred to load the page, ...
from .Exporter import Exporter from ..python2_3 import asUnicode from ..parametertree import Parameter from ..Qt import QtGui, QtCore, QtSvg, USE_PYSIDE from .. import debug from .. import functions as fn import re import xml.dom.minidom as xml import numpy as np __all__ = ['SVGExporter'] class SVGExporter(Exporter)...
"""ndg_httpsclient HTTPS module containing PyOpenSSL implementation of httplib.HTTPSConnection PyOpenSSL utility to make a httplib-like interface suitable for use with urllib2 """ __author__ = "P J Kershaw (STFC)" __date__ = "09/12/11" __copyright__ = "(C) 2012 Science and Technology Facilities Council" __license__ =...
import datetime from ftrace import sdk from galaxy import log_pb2 from galaxy import master_pb2 from galaxy import galaxy_pb2 from galaxy import agent_pb2 from common import pb2dict from common import util import logging logger = logging.getLogger("console") class TraceDao(object): def __init__(self, trace_se): ...
import os import errno from datetime import datetime from django.conf import settings from django.core.exceptions import SuspiciousFileOperation from django.core.files import locks, File from django.core.files.move import file_move_safe from django.utils.crypto import get_random_string from django.utils.encoding impor...
# ~*~ coding: utf-8 ~*~ from django.utils.translation import ugettext as _ from django.conf import settings from django.views.generic import ListView, DetailView, TemplateView from common.mixins import DatetimeSearchMixin from common.permissions import PermissionsMixin, IsOrgAdmin from orgs.utils import current_org f...
import os import re import time from bs4 import BeautifulSoup import pytest import requests @pytest.mark.e2e def test_end_to_end(): """Tests designed to be run against live environments. Unlike the integration tests in the other packages, these tests are designed to be run against fully-functional live ...
__all__ = ['utorrent', 'transmission', 'deluge', 'download_station' ] import sickbeard from os import sys # Mapping error status codes to official W3C names http_error_code = { 300: 'Multiple Choices', 301: 'Moved Permanently', 302: 'Found', 303: 'See Other...
from gnuradio import gr, gru from gnuradio import blocks from gnuradio import audio class output( gr.hier_block2 ): def __init__( self, rate, device ): gr.hier_block2.__init__(self, "output", gr.io_signature(1,1,gr.sizeof_float), gr.io_signatu...
import os import pickle from pkg_resources import resource_filename from nupic.regions.record_sensor import RecordSensor from nupic.data.file_record_stream import FileRecordStream """ Generate column statistics for a StandardSource. Each entry in statsInfo corresponds to one column, and contains a list of statistic...
""" tests: this package contains all Scrapy unittests see http://doc.scrapy.org/en/latest/contributing.html#running-tests """ import os # ignore system-wide proxies for tests # which would send requests to a totally unsuspecting server # (e.g. because urllib does not fully understand the proxy spec) os.environ['http...
from template_tests.test_response import test_processor_name from django.template import Context, EngineHandler, RequestContext from django.template.backends.django import DjangoTemplates from django.template.library import InvalidTemplateLibrary from django.test import RequestFactory, override_settings from .test_du...
from __future__ import unicode_literals, print_function import frappe, os from frappe.core.page.data_import_tool.data_import_tool import import_doc, export_json def sync_fixtures(app=None): """Import, overwrite fixtures from `[app]/fixtures`""" if app: apps = [app] else: apps = frappe.get_installed_apps() fr...
import optparse import os import sys import samba from samba.auth import system_session import samba.getopt as options from samba import ldb from samba.samdb import SamDB import samba.tests from samba.tests.subunitrun import SubunitOptions sys.path.insert(0, "bin/python") parser = optparse.OptionParser("ldap_referral...
import os import stat import time import shutil import errno import sys import mimetypes import cgi try: # Python 3.0 and newer import urllib.parse except ImportError: import urllib import master import PathUtil if not mimetypes.inited: mimetypes.init() # try to read system mime.types extensions_m...
import webob import webob.exc from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova import exception from nova.i18n import _ from nova import objects ALIAS = 'os-fixed-ips' authorize = extensions.extension_authorizer('compute', 'v3:' + ALIAS) class FixedIPController(wsgi.Controller...
from openerp.osv import fields, osv class website_config_settings(osv.osv_memory): _name = 'website.config.settings' _inherit = 'res.config.settings' _columns = { 'website_id': fields.many2one('website', string="website", required=True), 'website_name': fields.related('website_id', 'name',...
from __future__ import absolute_import, print_function import logging, pytest from sage.all import QQ, vector from moment_polytopes import * logger = logging.getLogger(__name__) def test_fermi_3_6(): # check bare inequalities bare_hrepr = third_party.klyachko_fermi_hrepr(3, 6, bare=True) bare_hrepr_expec...
import os import Queue import sys import subprocess import threading import unittest import urllib2 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) PARENT_DIR = os.path.dirname(SCRIPT_DIR) sys.path.append(PARENT_DIR) import httpd class HTTPDTest(unittest.TestCase): def setUp(self): self.server = http...
from utilities import * from sklearn.cluster import KMeans from sklearn import preprocessing import pandas as pd import time import re import os def removeAtts(ds, intest, atts): if not atts: return ds, intest for att in atts: intest.remove(att) for i in range(len(ds)): for att in...
import sys # Adjust path so we can see the src modules running from branch as well # as test dir: for path in ['./', './actions/']: sys.path.insert(0, './' + path) sys.path.insert(0, '../' + path) sys.path.insert(0, '../../' + path)
import os, socket, sys try: socket_path = os.getenv("OMD_ROOT") + "/tmp/run/mkeventd/status" except: sys.stdout.write("UNKNOWN - OMD_ROOT is not set, no socket path is defined.\n") sys.exit(3) def query(query, remote_host): try: if remote_host: parts = remote_host.split(":") ...
from __future__ import unicode_literals # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j F Y' TIME_FORMAT = 'H:i' DATETIME_FORMAT = 'j F Y H:i' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j F' SHORT_DATE_FORMAT = 'Y-m-d...