content
stringlengths
4
20k
"""These are tests of the Deck class.""" import unittest from blackjack import Deck from blackjack import Card from blackjack import InvalidDeckSize from blackjack import InvalidDeckDraw class TestDeck(unittest.TestCase): """A class which defines the various tests of the Deck class.""" def test_deck_size(sel...
import os import re import sys import urllib """Logpuzzle exercise Given an apache logfile, find the puzzle urls and download the images. Here's what a puzzle url looks like: 10.254.254.28 - - [06/Aug/2007:00:13:48 -0700] "GET /~foo/puzzle-bar-aaab.jpg HTTP/1.0" 302 528 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; e...
import os import re import string import random from subprocess import Popen, PIPE, STDOUT from shutil import rmtree from logging import getLogger from django.template.loader import render_to_string import pki.models from pki.helper import subject_for_object from pki.settings import PKI_OPENSSL_BIN, PKI_OPENSSL_CONF...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Automated tests for DTM/DIM model """ import logging import gensim import os import sys import unittest from gensim import corpora # needed because sample data files are located in the same folder module_path = os.path.dirname(__file__) datapath = lambda fname: os....
# -*- coding: utf-8 -*- """\ This is a python port of "Goose" orignialy licensed to Gravity.com under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Python port was written by Xavier Grangier for Recrutae Gravity.co...
#!/usr/bin/python """ Generate file lists for apt-ftparchive. @contact: Debian FTP Master <<EMAIL>> @copyright: 2009 Torsten Werner <<EMAIL>> @copyright: 2011 Ansgar Burchardt <<EMAIL>> @license: GNU General Public License version 2 or later """ # This program is free software; you can redistribute it and/or modif...
import subprocess import sys from django.db.backends.base.creation import BaseDatabaseCreation from .client import DatabaseClient class DatabaseCreation(BaseDatabaseCreation): def sql_table_creation_suffix(self): suffix = [] test_settings = self.connection.settings_dict['TEST'] if test_...
from __future__ import unicode_literals import logging import re import six from xml import etree __author__ = 'Jay Xu' log = logging.getLogger(__name__) class XMLAPIParser(object): def __init__(self): # The following Boolean acts as the flag for the common sub-element. # For instance: ...
"""Contains the TFExampleDecoder its associated helper classes. The TFExampleDecode is a DataDecoder used to decode TensorFlow Example protos. In order to do so each requested item must be paired with one or more Example features that are parsed to produce the Tensor-based manifestation of the item. """ from __future...
import array import hashlib import itertools import sys try: import threading except ImportError: threading = None import unittest import warnings from test import test_support from test.test_support import _4G, precisionbigmemtest # Were we compiled --with-pydebug or with #define Py_DEBUG? COMPI...
''' Created on Sep 3, 2011 @author: Daniel Sank ''' import numpy as np from pyle.dataking import util from pyle.util import sweeptools as st from pyle.dataking import envelopehelpers as eh from pyle.dataking.fpgaseq import runQubits from pyle.dataking import utilMultilevels import pyle.envelopes as env from pyle.plott...
from openerp.osv import fields, osv class company(osv.osv): _inherit = 'res.company' _columns = { 'security_lead': fields.float( 'Security Days', required=True, help="Margin of error for dates promised to customers. "\ "Products will be scheduled for procurement...
import pytest from django.core.management import call_command from django.core.management.base import CommandError @pytest.mark.cmd def test_purge_user_nouser(): with pytest.raises(CommandError) as e: call_command('purge_user') assert "too few arguments" in str(e) @pytest.mark.cmd @pytest.mark.djan...
#!/usr/bin/env python # encoding: utf-8 # # partially based on boost.py written by Gernot Vormayr # written by Ruediger Sonderfeld <<EMAIL>>, 2008 # modified by Bjoern Michaelsen, 2008 # modified by Luca Fossati, 2008 # rewritten for waf 1.5.1, Thomas Nagy, 2008 # rewritten for waf 1.6.2, Sylvain Rouquette, 2011 ''' ...
import pytest from openpyxl.styles.colors import BLACK, WHITE, Color @pytest.fixture def GradientFill(): from openpyxl.styles.fills import GradientFill return GradientFill class TestGradientFill: def test_empty_ctor(self, GradientFill): gf = GradientFill() assert gf.fill_type == 'linea...
import sys, os, time sys.path[0:0] = [os.path.join(os.path.dirname(__file__), ".."),] from pyzookeeper import election from pyzookeeper import log if __name__=="__main__": # Leader will execute the parameter passed below if ( len( sys.argv) < 3): print 'Usage:\n python '+ sys.argv[0]+' zookeeperIP:Port...
from __future__ import unicode_literals from .common import InfoExtractor class KeekIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?keek\.com/(?:!|\w+/keeks/)(?P<id>\w+)' IE_NAME = 'keek' _TEST = { 'url': 'https://www.keek.com/ytdl/keeks/NODfbab', 'md5': '09c5c109067536c1cec8bac8c21f...
import logging import uuid from horizon import forms from horizon import messages from horizon import exceptions from django import shortcuts from django.template.defaultfilters import register from django.core.urlresolvers import reverse_lazy from django.utils.datastructures import SortedDict from keystoneclient im...
# -*- coding: utf-8 -*- """ @author: Fabio Erculiani <<EMAIL>> @contact: <EMAIL> @copyright: Fabio Erculiani @license: GPL-2 B{Entropy Command Line Client}. """ import os import sys import argparse from entropy.i18n import _ from entropy.output import darkred, darkgreen, blue from solo.commands...
import unittest from airflow.contrib.operators.dataflow_operator import DataFlowPythonOperator, \ DataFlowJavaOperator, DataflowTemplateOperator from airflow.contrib.operators.dataflow_operator import DataFlowPythonOperator from airflow.version import version try: from unittest import mock except ImportError:...
"""Python idiomatic client for Google Cloud Firestore.""" from pkg_resources import get_distribution __version__ = get_distribution("google-cloud-firestore").version from google.cloud.firestore_v1beta1 import types from google.cloud.firestore_v1beta1._helpers import GeoPoint from google.cloud.firestore_v1beta1._help...
from django.shortcuts import render_to_response from django.db.models import Sum,Min,Max from datetime import datetime import time as Time from stats.models import Status, Status2, Log from search.models import File, Host from browseNet.models import Share,Path # Create your views here. def getOnlineSize(): '''c...
""" FTP utility """ import re import ftplib import os import logging logger = logging.getLogger("jnpr.junos.utils.ftp") class FTP(ftplib.FTP): """ FTP utility can be used to transfer files to and from device. """ def __init__(self, junos, **ftpargs): """ :param Device junos: Device...
import textwrap import unittest from mock import patch class TestParseVagrantMachineReadableStatus(unittest.TestCase): def test_machine_readable_status_running(self): with patch('fabtools.vagrant.local') as mock_local: mock_local.return_value = textwrap.dedent(r""" 1391354677...
import os import sys import time from colorama import Back, Fore, Style, init from .api_pull_data import api_data_fill as update from .coin_price_rank import coins from .details import owerview from .newUser import create_new_user as newUser from .user_balance import balance from .wallets import wallet_key class ma...
# -*- coding: utf-8 -*- from openerp import http from openerp.http import request from openerp.addons.web_editor.controllers.main import Web_Editor class Web_Editor(Web_Editor): @http.route(["/website_mass_mailing/field/popup_content"], type='http', auth="user") def mass_mailing_FieldTextHtmlPopupTemplate(s...
import os import ycm_core # These are the compilation flags that will be used in case there's no # compilation database set (by default, one is not set). # CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. flags = [ '-Wall', '-Wextra', '-Werror', '-Wno-long-long', '-Wno-variadic-macros', '-f...
#Extracts the top tweets given a search phrase, #and generates a Mind-Map from the data. #A handy tool to get an overall view of whats being talked about #a particular topic. ##Requires the 'TwitterSearch' Python library. ##Get it here: https://github.com/ckoepp/TwitterSearch from TwitterSearch import * from mapgeist...
from PIL import Image import getopt, sys, math, os, struct, timeit, zipfile, subprocess, shutil from sys import platform # Number of least significant bits containing/to contain data in image num_lsb = 2 def prepare_hide(): # Prepare files for reading and writing for hiding data. global image, input_file, inpu...
""" Provider that returns GeoJSON data responses from Solr spatial queries. This is an example of a provider that does not return an image, but rather queries a Solr instance for raw data and replies with a string of GeoJSON. Read more about the GeoJSON spec at: http://geojson.org/geojson-spec.html Caveats: Example...
# -*- coding: utf-8 -*- """ Spyder Editor Este é um arquivo de script temporário. """ import matplotlib.pyplot as plt import numpy as np f = plt.imread('field.png') plt.imshow(f) # red r = f.copy() plt.imshow(r) r[:,:,1] = 0 r[:,:,2] = 0 plt.imshow(r) # green g = f.copy() g[:,:,0] = 0 g[:,:,2] =...
#!/usr/bin/env python ''' $Id: tzfile.py,v 1.8 2004/06/03 00:15:24 zenzen Exp $ ''' try: from cStringIO import StringIO except ImportError: from io import StringIO from datetime import datetime, timedelta from struct import unpack, calcsize from pytz.tzinfo import StaticTzInfo, DstTzInfo, memorized_ttinfo fro...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import re try: import botocore except ImportError: pass # handled by AnsibleAWSModule from ansible.module_utils.aws.core import AnsibleAWSModule from ansible.module_util...
from __future__ import absolute_import from __future__ import unicode_literals from __future__ import print_function from __future__ import division from future import standard_library standard_library.install_aliases() from builtins import * # noqa from hamcrest import assert_that, contains_inanyorder, has_entries f...
import gdb from linux import constants from linux import utils from linux import tasks from linux import lists from struct import * class LxCmdLine(gdb.Command): """ Report the Linux Commandline used in the current kernel. Equivalent to cat /proc/cmdline on a running target""" def __init__(self): ...
import os import sys import glob import serial import time from datetime import datetime BAUDRATE=9600 DATA_FILE="/tmp/serialData.txt" def getCOM(): # Assume the first /dev/tty.usb* is our COM ports = glob.glob("/dev/tty.usb*") if len(ports) >= 1: return ports[0] return None def monitor(): wait_...
from __future__ import print_function import unittest import numpy as np import paddle import paddle.fluid.core as core class ApiSubtractTest(unittest.TestCase): def setUp(self): if core.is_compiled_with_cuda(): self.place = core.CUDAPlace(0) else: self.place = core.CPUPla...
#! /usr/bin/python # Keep Photo Dump is meant to get your photos out of Google Keep pages # as exported from Google Takeout. # # The photos are base64 encoded. # This script goes through a given html file and finds all the base64 # encoded image tags and writes them to disk as JPG. It should work just # as well for ext...
from tempest.api.compute import base from tempest.common import tempest_fixtures as fixtures from tempest import test class QuotasTestJSON(base.BaseV2ComputeTest): @classmethod def skip_checks(cls): super(QuotasTestJSON, cls).skip_checks() if not test.is_extension_enabled('os-quota-sets', 'co...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: win_firewall_rule version_added: "2.0" author: - Artem Zinenko (@ar7z1) - Timothy Vandenbrande (@TimothyVandenbrande) short_description: Window...
#!/usr/bin/python3 # -*- coding: utf-8 -*- import re from room import RoomInfo from urllib.request import Request, urlopen from urllib.error import URLError import matplotlib.pyplot as plt WEB_SITE = "http://bj.58.com" AREA = "gaobeidianbj" TYPE = "zufang" SUFFIX = "pn" MAX_PAGES = 20 RE_ROOM = r'<p class="room">(\d...
from msrest.serialization import Model class ConnectivitySource(Model): """Parameters that define the source of the connection. All required parameters must be populated in order to send to Azure. :param resource_id: Required. The ID of the resource from which a connectivity check will be initiated...
import sys from django.db import models from django.contrib.auth.models import ( Group, Permission, AbstractBaseUser, PermissionsMixin, BaseUserManager) class CustomUserManager(BaseUserManager): def _create_user(self, username, email, password, is_staff, is_superuser, **extra_fields): ...
import itertools import netaddr import random import string import uuid def rand_uuid(): """Generate a random UUID string :return: a random UUID (e.g. '1dc12c7d-60eb-4b61-a7a2-17cf210155b6') :rtype: string """ return str(uuid.uuid4()) def rand_uuid_hex(): """Generate a random UUID hex strin...
from __future__ import with_statement import Live from itertools import imap, chain, starmap from _Framework.ControlSurfaceComponent import ControlSurfaceComponent from _Framework.CompoundComponent import CompoundComponent from _Framework.SubjectSlot import subject_slot, Subject, subject_slot_group from _Framework.Util...
from . import common import .Test_Driver as driver def read(sensor, pin): # Get a reading from C driver code. result, humidity, temp = driver.read(sensor, pin) if result in common.TRANSIENT_ERRORS: # Signal no result could be obtained, but the caller can retry. return (None, None) elif ...
# See readme.md for instructions on running this code. from __future__ import absolute_import from __future__ import division import copy import importlib import sys from math import log10, floor from . import utils import re def is_float(value): try: float(value) return True except ValueErr...
import unittest import sys sys.path.insert(0, '../macumba') import macumba IS_CONNECTED = False JUJU_URL = 'wss://localhost:17070/' JUJU_PASS = 'pass' c = macumba.JujuClient(url=JUJU_URL, password=JUJU_PASS) try: c.login() IS_CONNECTED = True except: pass @unittest.skipIf(not IS_CONNECTED, 'Not connect...
""" test the label propagation module """ import numpy as np from sklearn.utils.testing import assert_equal from sklearn.semi_supervised import label_propagation from sklearn.metrics.pairwise import rbf_kernel from numpy.testing import assert_array_almost_equal from numpy.testing import assert_array_equal ESTIMATORS...
""" An example script that fits the data with linear regression with a different orders of polynomial. """ # imports import scipy as sp import numpy as np import scipy.io as sio import sklearn.linear_model as linear_model import matplotlib.pyplot as plt # import data ex5_data = sio.loadmat('ex5data1.mat') # Loads...
"""Tests for ops.gmm.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from six.moves import xrange # pylint: disable=redefined-builtin from tensorflow.contrib.factorization.python.ops import gmm as gmm_lib from tensorflow.contrib.lea...
""" Verifies library_dirs (in link_settings) are properly found. """ import sys import TestGyp test = TestGyp.TestGyp(formats=['!android']) lib_dir = test.tempdir('secret_location') test.run_gyp('test.gyp', '-D', 'abs_path_to_secret_library_location={0}'.format(lib_dir), chdir='subdir') ...
""" ========================================= Comparison of Manifold Learning methods ========================================= An illustration of dimensionality reduction on the S-curve dataset with various manifold learning methods. For a discussion and comparison of these algorithms, see the :ref:`manifold module...
"""Publish simple item state changes via MQTT.""" import json import voluptuous as vol from homeassistant.components.mqtt import valid_publish_topic from homeassistant.const import MATCH_ALL from homeassistant.core import callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entityf...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} import datetime import os import traceback from ansible.module_utils.basic import AnsibleM...
import warnings import numpy as np from nose.plugins.attrib import attr from pysb.examples.tyson_oscillator import model from pysb.simulator.cupsoda import CupSodaSimulator, run_cupsoda from nose.tools import raises import os @attr('gpu') class TestCupSODASimulatorSingle(object): def setUp(self): self.n_s...
import time import os import catsup.parser from catsup.logger import logger from catsup.generator.renderer import Renderer from catsup.reader import get_reader from catsup.options import g from catsup.utils import smart_copy from catsup.models import * class Generator(object): def __init__(self, config_path, loc...
from __future__ import absolute_import from datetime import datetime from operator import attrgetter from django.db.models import Q from django.test import TestCase from .models import Article class OrLookupsTests(TestCase): def setUp(self): self.a1 = Article.objects.create( headline='Hell...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os from ansible.errors import AnsibleError, AnsibleAction, _AnsibleActionDone, AnsibleActionFail from ansible.module_utils._text import to_native from ansible.module_utils.parsing.convert_bool import boolean from ansible.pl...
from nose.tools import assert_true, assert_equal, assert_false from desktop.lib.django_test_util import make_logged_in_client from desktop.lib.test_utils import grant_access from django.contrib.auth.models import User, Group from django.core.urlresolvers import reverse from useradmin.models import HuePermission, Gro...
import datetime from keystoneclient import access from keystoneclient.openstack.common import timeutils from keystoneclient.tests.v3 import client_fixtures from keystoneclient.tests.v3 import utils TOKEN_RESPONSE = utils.TestResponse({ "headers": client_fixtures.AUTH_RESPONSE_HEADERS }) UNSCOPED_TOKEN = client_fi...
"""The Chi2 distribution class.""" 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.ops impo...
import datetime import re import fixtures import constants from authomatic.providers import oauth2 conf = fixtures.get_configuration('vk') PICTURE = re.compile(r'http://[A-Za-z0-9]+\.vk\.me/[A-Za-z0-9-/]+\.jpg') CONFIG = { 'login_xpath': '//*[@id="box"]/div/input[6]', 'password_xpath': '//*[@id="box"]/div/...
# Parallel Kalman Filter demo: this script simulates # 4 missiles as described in the section "state-space models". # Each of the missiles is then filtered and smoothed in parallel import jax.numpy as jnp import lds_lib as lds import matplotlib.pyplot as plt import pyprobml_utils as pml from jax import random plt.rcP...
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals import yaml import yamlish import test import unittest test_data_list = [ { "name": 'Hello World', "in": [ '--- Hello, World', '...', ], "out": "Hello, World", }, { "name": 'Hello World 2', "in": ...
#!/usr/bin/python import versioning_base from pyspatialite import dbapi2 import psycopg2 import os import shutil test_data_dir = os.path.dirname(os.path.realpath(__file__)) tmp_dir = "/tmp" # create the test database os.system("dropdb epanet_test_db") os.system("createdb epanet_test_db") os.system("psql epanet_test_...
from case import Case class Case9_4_1(Case): DESCRIPTION = """Send fragmented binary message message with message payload of length 4 * 2**20 (4M). Sent out in fragments of 64.""" EXPECTATION = """Receive echo'ed binary message (with payload as sent).""" def init(self): self.DATALEN = 4 * 2*...
""" Legacy support for parsing results from Grendel++ data.xml files """ from __future__ import print_function from collections import defaultdict import sys from xml.etree import ElementTree from grendel import sanity_checking_enabled from grendel.chemistry.molecular_properties import Energy, MolecularProperty from ...
from . import Image, ImageFile from ._binary import i16le as i16, o16le as o16, i8 import struct, io __version__ = "0.1" # # read MSP files def _accept(prefix): return prefix[:4] in [b"DanM", b"LinS"] ## # Image plugin for Windows MSP images. This plugin supports both # uncompressed (Windows 1.0). class Ms...
# -*- coding: utf-8 -*- """ 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 License, or (at your option) any later version. This program is distributed in...
"""Export inception model given existing training checkpoints. The model is exported as SavedModel with proper signatures that can be loaded by standard tensorflow_model_server. """ import os.path # This is a placeholder for a Google-internal import. import tensorflow as tf from tensorflow.python.saved_model impor...
""" Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at most two transactions. Note: You may not engage in multiple transactions at the same time (ie, you must sell the stock before you buy again). """ class Solut...
class WatchListRule: '''A rule with instructions to do when the rule is satisified.''' def __init__(self, complex_definition, instructions): self.definitions_to_match = complex_definition.split('|') self._instructions = instructions def match(self, matching_definitions): for test_de...
import mock import unittest from pythonwarrior.turn import Turn from pythonwarrior.abilities.feel import Feel class TestTurnWithActions(unittest.TestCase): def setUp(self): self.turn = Turn({'walk_': None, 'attack_': None}) def test_should_have_no_action_performed_at_first(self): self.assertI...
import subprocess; import re; import json; import sys; import os; import importlib; scriptdir = os.path.dirname(os.path.realpath(__file__)) basedir = scriptdir+"/../" sys.path.append(basedir+"scripts"); sys.path.append(basedir+"boards"); import common; import pinutils; # ---------------------------------------------...
import StringIO, zlib, gzip import os.path, os, glob import urllib, urllib2 import re import sickbeard from sickbeard.exceptions import * from sickbeard import logger, classes from sickbeard.common import * from sickbeard import db from sickbeard import encodingKludge as ek from lib.tvdb_api import tv...
"""Change the keys in the packet through a dictionary""" import logging import pypes.component log = logging.getLogger(__name__) class NameChanger(pypes.component.Component): """ The run method will get the keys from the input packet and set them back in the packet with the new key specified by the val...
# This validates date properties of Tenders. class TenderDate_validation: STATE=None # It takes arguments such as callForTendersPublicationDate, bidDeadlineDate, contractAwardNoticePublicationDate, and parentContractAwardDate def __init__(self, callForTendersPublicationDate, bidDeadlineDate, contrac...
""" Write hashtag Frobenius scores to file. """ import io from operator import itemgetter import time import numpy as np from scipy.stats.mstats import mquantiles import twitterproj from twitterproj.fisher import * from twitterproj.fisher import pipeline db = twitterproj.connect() def hashtag_scores(): N = 500...
import os import re import json import datetime import gzip from django.template import RequestContext from django.shortcuts import render_to_response from django.conf import settings from django.http import HttpResponse import changelog def trac_links(text): # changeset links text = re.sub(r'\[(\d+)\]', r'<...
import warnings import numpy as np from ..qt import QtWidgets, has_qt, FigureManagerQT, FigureCanvasQTAgg import matplotlib as mpl from matplotlib.figure import Figure from matplotlib import _pylab_helpers from matplotlib.colors import LinearSegmentedColormap if has_qt and 'agg' not in mpl.get_backend().lower(): ...
from .quaternion import Quaternion from .transform import Transform def retrieveRosResource(path): import os ros_package_paths = os.environ["ROS_PACKAGE_PATH"].split(':') if path.startswith("package://"): relpath = path[len("package://"):] for dir in ros_package_paths: abspath ...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'}
"""Tests for creating different number of masks in rnn_cells.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.contrib.model_pruning.python import pruning from tensorflow.contrib.model_pruning.python.layers import rnn_cells from tensorflow...
#!/usr/bin/env python """Distutils setup file, used to install or test 'setuptools'""" import io import os import sys import textwrap import contextlib # Allow to run setup.py from another directory. os.chdir(os.path.dirname(os.path.abspath(__file__))) src_root = None from distutils.util import convert_path command...
from __future__ import unicode_literals import frappe from frappe.utils import cint, cstr, flt from frappe import _ from frappe.model.document import Document from operator import itemgetter form_grid_templates = { "items": "templates/form_grid/item_grid.html" } class BOM(Document): def autoname(self): last_name...
""" Watches the key ``paste.httpserver.thread_pool`` to see how many threads there are and report on any wedged threads. """ import sys import cgi import time import traceback from cStringIO import StringIO from thread import get_ident from paste import httpexceptions from paste.request import construct_url, parse_form...
""" Tests for django test runner """ from __future__ import unicode_literals import unittest from admin_scripts.tests import AdminScriptTestCase from django import db from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.management import call_command from django.d...
from __future__ import absolute_import from django.db import connection as default_connection from versions.models import VersionedForeignKey from .helper import database_connection, versionable_models def index_exists(cursor, index_name): """ Checks if an index with the given name exists in the database ...
""" This script invokes the go build tool. Must be called as follows: python go.py <go-binary> <build directory> <output file> <src directory> <CGO_CFLAGS> <CGO_LDFLAGS> <go-binary options> eg. python go.py /usr/lib/google-golang/bin/go out/build out/a.out .. "-I." "-L. -ltest" test -c test/test.go """ import argparse...
from rit_lib import * from slList import * class Rooms(struct): """ The HashTable data structure contains a collection of values where each value is located by a hashable key. No two values may have the same key, but more than one key may have the same value. table i...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import print_function import theano.tensor as T from ..layers.core import Layer, Merge from ..utils.theano_utils import ndim_tensor from six.moves import range class Sequential(Layer): ''' Simple linear stack of layers. ...
"""Tests specific to multiple-tree instances""" from dxr.testing import DxrInstanceTestCase from nose.tools import eq_ class ParallelControllerTests(DxrInstanceTestCase): """Tests for the /parallel/ controller""" def test_existent_parallel_file(self): """Make sure the /parallel controller redirects...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import traceback from ansible.module_utils.basic import AnsibleModule from ansible.module_ut...
from . import base # noqa from . import pysqlcipher # noqa from . import pysqlite # noqa from .base import BLOB from .base import BOOLEAN from .base import CHAR from .base import DATE from .base import DATETIME from .base import DECIMAL from .base import FLOAT from .base import INTEGER from .base import JSON from .b...
""" Tests for L{twisted.words.im.ircsupport}. """ from twisted.test.proto_helpers import StringTransport from twisted.words.im.basechat import ChatUI, Conversation, GroupConversation from twisted.words.im.ircsupport import IRCAccount, IRCProto from twisted.words.im.locals import OfflineError from twisted.words.test.t...
from datetime import date from django.conf import settings from django.utils import six from django.utils.crypto import constant_time_compare, salted_hmac from django.utils.http import base36_to_int, int_to_base36 class PasswordResetTokenGenerator(object): """ Strategy object used to generate and check token...
# pylint: disable=no-member """ This file exposes a number of password complexity validators which can be optionally added to account creation This file was inspired by the django-passwords project at https://github.com/dstufft/django-passwords authored by dstufft (https://github.com/dstufft) """ from __future__ impor...
import unittest from env import waagent import sys from tests.tools import * SampleInterfaceInfo="""\ eth0 Link encap:Ethernet HWaddr ff:ff:ff:ff:ff:ff inet addr:10.94.20.249 Bcast:10.94.23.255 Mask:255.255.252.0 inet6 addr: fe80::215:5dff:fe5f:bf03/64 Scope:Link UP BROADCAST RU...
""" Move a file in the safest way possible:: >>> from django.core.files.move import file_move_safe >>> file_move_safe("/tmp/old_file", "/tmp/new_file") """ import os from shutil import copystat from django.core.files import locks __all__ = ['file_move_safe'] def _samefile(src, dst): # Macintosh, Unix....