content
stringlengths
4
20k
from django.conf import settings from django.db.models import signals from django.utils.translation import ugettext_noop as _ from django.apps import apps if "notification" in settings.INSTALLED_APPS: from notification import models as notification notification_appconfig = apps.get_app_config('notification') ...
"""distutils.archive_util Utility functions for creating archive files (tarballs, zip files, that sort of thing).""" __revision__ = "$Id$" import os from warnings import warn import sys from distutils.errors import DistutilsExecError from distutils.spawn import spawn from distutils.dir_util import mkpa...
#!/usr/bin/env python # -*- coding: utf-8 -*- from datetime import date from jinja2 import Environment, FileSystemLoader from huizi import * sampleItems = [ { "name": "咪啊(山头尾顶)", # 会头 "quantity": 2, # 名数 "startdate": date(2010, 1, 9), # 开始时间 "tip": 300, # 会头钱 "checkin": 200...
"""A Backend class defines the core low-level functions required by a Window class, such as the ability to create an OpenGL context and flip the window. Users simply call visual.Window(..., winType='pyglet') and the winType is then used by backends.getBackend(winType) which will locate the appropriate class and initia...
import unittest from tools import warn from bottle import MakoTemplate, mako_template, mako_view, touni class TestMakoTemplate(unittest.TestCase): def test_string(self): """ Templates: Mako string""" t = MakoTemplate('start ${var} end').render(var='var') self.assertEqual('start var end', t)...
LOAD_OPENGL_DLL = ''' private global Library libGL; extern(System) private alias gladGetProcAddressPtrType = void* function(const(char)*); private global gladGetProcAddressPtrType gladGetProcAddressPtr; %(pre)s bool %(init)s() { version(Windows) { libGL = Library.load("opengl32.dll"); } else version(OS...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Backend management. Creating new backends --------------------- A new backend named 'foo-bar' corresponds to Python module 'tracetool/backend/foo_bar.py'. A backend module should provide a docstring, whose first non-empty line will be considered its short descripti...
""" Boolean geometry utilities. """ from __future__ import absolute_import #Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module. import __init__ __author__ = 'Enrique Perez (<EMAIL>)' __credits__ = 'Art of Illusi...
#!/usr/bin/env python3 import json import os import subprocess import requests from github import Github from iteration_utilities import unique_everseen from ruamel.yaml import YAML GH_TOKEN = os.environ["GITHUB_TOKEN"] GH_ORG_NAME = os.getenv("GH_ORG_NAME", "cloudposse") GH_SEARCH_PATTERN = os.getenv("GH_SEARCH_PAT...
"""The deferred instance delete extension.""" import webob from nova.api.openstack import common from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova import compute from nova import exception authorize = extensions.extension_authorizer('compute', 'deferred_delete') class Deferre...
import random from datetime import datetime, timedelta import struct import time from itertools import repeat from collections import Sequence formatString = '%H:%M' def strTimeProp(start, end, format, prop): """Get a time at a proportion of a range of two formatted times. start and end should be strings s...
#!/usr/bin/python3 from State import State class World: """Every instance of this class represents the world of the game, in a specific state.""" def __init__(self, missionaries = 3, cannibals = 3, state = None, history = None): self.missionaries = missionaries self.c...
from socorro.unittest.cron.setup_configman import ( get_config_manager_for_crontabber, ) from crontabber.tests import base class IntegrationTestBase(base.IntegrationTestCaseBase): def get_standard_config(self): """this method overrides the crontabber version of the same name. It is not used b...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('commerce...
import numpy from math import floor, ceil from gtrackcore.track.core.TrackView import TrackView from gtrackcore.track.core.VirtualNumpyArray import VirtualNumpyArray from gtrackcore.track.format.FormatConverter import FormatConverter class VirtualStartFromInterval(VirtualNumpyArray): def __init__(self, startArra...
from __future__ import print_function, absolute_import, division import os import shutil import tempfile import numpy as np from mdtraj.testing import get_fn from nose.tools import assert_raises, assert_raises_regexp from sklearn.externals.joblib import Parallel, delayed from msmbuilder.dataset import dataset from ....
#!/usr/bin/env python3 ## -*- coding: utf-8 -*- ## ## Jonathan Salwan - 2018-11-02 ## ## This code solve the angry-reverser from the HackCon 2016 CTF. ## The particularity of this sample is that we use an external solver to solve ## queries instead of using the internal Triton's solver (even if in both cases ## it...
# -*-coding:Utf-8 -*- """Contains functions which make requests to the server""" # Compatibility 2.7-3.4 from __future__ import absolute_import from __future__ import unicode_literals from builtins import input import sys, locale import requests, re from . import user as user from . import target as target from . i...
import datetime from pyramid.response import Response from pyramid.view import view_config from sqlalchemy.exc import DBAPIError from .models import ( Users, Municipalities, Entities, Addresses, DocumentTypes, Jobs, Scrapers, Dispatchers, Workers, JobRuns, Documents, D...
""" ================ Precision-Recall ================ Example of Precision-Recall metric to evaluate classifier output quality. In information retrieval, precision is a measure of result relevancy, while recall is a measure of how many truly relevant results are returned. A high area under the curve represents both ...
import pyparsing from pyparsing import Forward, Literal, OneOrMore, Optional, Word, alphas, alphanums, nums from PyQt5 import QtCore from maestro.core import tags from maestro import config, profiles translate = QtCore.QCoreApplication.translate def defaultStorage(): return dict(renamer=dict(profiles=[], cur...
# -*- coding: utf-8 -*- import os import re import sys import alabaster # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.pat...
from __future__ import unicode_literals import inspect from docutils import nodes from docutils.parsers import rst from docutils.parsers.rst import directives from docutils.statemachine import ViewList from sphinx.util.nodes import nested_parse_with_titles from stevedore import extension def _get_docstring(plugin)...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} try: import pyrax HAS_PYRAX = True except ImportError: HAS_PYRAX = False from ...
from xml.etree.ElementTree import Element, SubElement, tostring import os import re import traceback import xml.dom.minidom from couchpotato.core.media.movie.providers.metadata.base import MovieMetaData from couchpotato.core.helpers.encoding import toUnicode from couchpotato.core.helpers.variable import getTitle from ...
from pyspark.mllib.regression import LabeledPoint, LinearRegressionWithSGD from pyspark.mllib.evaluation import RegressionMetrics from pyspark.mllib.linalg import DenseVector # $example off$ from pyspark import SparkContext if __name__ == "__main__": sc = SparkContext(appName="Regression Metrics Example") # ...
""" Functions for creating and restoring url-safe signed JSON objects. The format used looks like this: >>> signing.dumps("hello") 'ImhlbGxvIg:1QaUZC:YIye-ze3TTx7gtSv422nZA4sgmk' There are two components here, separated by a ':'. The first component is a URLsafe base64 encoded JSON of the object passed to dumps(). T...
""" Check input.data are valid or not """ import re from lib.language.en import email_invalid, password_not_same, password_invalid, something_null class ValidChecker(object): is_valid = True error = '' def null_check(self, data): for key in data.keys(): if data[key] == '': ...
""" Tests for the mhlib module Nick Mathewson """ ### BUG: This suite doesn't currently test the mime functionality of ### mhlib. It should. import unittest from test.test_support import run_unittest, TESTFN, import_module import os, StringIO import sys mhlib = import_module('mhlib', deprecated=True) if ...
#!/usr/bin/env python3 """ Support Eiffel-style preconditions and postconditions for functions. An example for Python metaclasses. """ import unittest from types import FunctionType as function class EiffelBaseMetaClass(type): def __new__(meta, name, bases, dict): meta.convert_methods(dict) ret...
from django.urls import reverse # wger from wger.core.models import Language from wger.core.tests.base_testcase import WgerTestCase class RobotsTxtTestCase(WgerTestCase): """ Tests the generated robots.txt """ def test_robots(self): response = self.client.get(reverse('robots')) for ...
from tests.core.helpers import authenticated_response from datetime import datetime from dateutil.tz import tzutc from trakt import Trakt import responses @responses.activate def test_movies_get(): responses.add_callback( responses.GET, 'http://mock/users/me/lists/movies', callback=authenticated_...
import WebIDL def WebIDLTest(parser, harness): def checkArgument(argument, QName, name, type, optional, variadic): harness.ok(isinstance(argument, WebIDL.IDLArgument), "Should be an IDLArgument") harness.check(argument.identifier.QName(), QName, "Argument has the right QName") ...
DATE_FORMAT = 'j. E Y' TIME_FORMAT = 'G.i' DATETIME_FORMAT = r'j. E Y \k\e\l\l\o G.i' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j. F' SHORT_DATE_FORMAT = 'j.n.Y' SHORT_DATETIME_FORMAT = 'j.n.Y G.i' FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://doc...
from __future__ import absolute_import import logging import os import sys from importlib import import_module config_module = os.environ.setdefault("CELERY_TEST_CONFIG_MODULE", "celery.tests.config") os.environ.setdefault("CELERY_CONFIG_MODULE", config_module) os.environ["CELE...
from __future__ import absolute_import import os import pytest import subprocess from yaclifw.framework import Stop, main from scc.git import TagRelease from .Sandbox import SandboxTest class TestTagRelease(SandboxTest): def setup_method(self, method): super(TestTagRelease, self).setup_method(method) ...
import shlex def split(value): lex = shlex.shlex(value) lex.quotes = '"' lex.whitespace_split = True lex.commenters = '' return list(lex) def rpc_args(args): kwargs = dict() args = split(args) name = args.pop(0) for arg in args: key, value = arg.split('=') if str(va...
#!/usr/bin/env python2 """ Adobe character mapping (CMap) support. CMaps provide the mapping between character codes and Unicode code-points to character ids (CIDs). More information is available on the Adobe website: http://opensource.adobe.com/wiki/display/cmap/CMap+Resources """ import sys import re import o...
######################################################################## ######################################################################## """ :mod: PfnTestCase ======================= .. module: PfnTestCase :synopsis: test case for Pfn module .. moduleauthor:: <EMAIL> test case for Pfn mo...
""" This file contains celery tasks for programs-related functionality. """ from celery import task from celery.utils.log import get_task_logger # pylint: disable=no-name-in-module, import-error from django.conf import settings from django.contrib.auth.models import User from edx_rest_api_client.client import EdxRestA...
"""Deprecated core event interfaces. This module is **deprecated** and is superseded by the event system. """ from . import event, util class PoolListener(object): """Hooks into the lifecycle of connections in a :class:`.Pool`. .. note:: :class:`.PoolListener` is deprecated. Please refer ...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import re import time import glob from ansible.plugins.action.ios import ActionModule as _ActionModule from ansible.module_utils._text import to_text from ansible.module_utils.six.moves.urllib.parse import urlsplit from ...
import six from django.forms.util import flatatt from django.core.urlresolvers import reverse from django.utils.safestring import mark_safe from django import forms from six.moves import filter from six.moves import map class ProductSelect(forms.Widget): is_multiple = False css = 'select2 input-xlarge' d...
from oslo_config import cfg from nova.tests.functional.api_sample_tests import api_sample_base CONF = cfg.CONF CONF.import_opt('osapi_compute_extension', 'nova.api.openstack.compute.legacy_v2.extensions') class HostsSampleJsonTest(api_sample_base.ApiSampleTestBaseV3): ADMIN_API = True extens...
"""The JHBuild plugin is used for GNOME-based parts. JHBuild is a tool used to build components of the GNOME ecosystem from version control. See the JHBuild manual for more details: https://developer.gnome.org/jhbuild/stable/. The plugin can be customized with the following keys: - modules: (required) a list of mo...
import copy update_quota_set = { 'status_code': [200], 'response_body': { 'type': 'object', 'properties': { 'quota_set': { 'type': 'object', 'properties': { 'instances': {'type': 'integer'}, 'cores': {'type': 'i...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Faraday Penetration Test IDE - Community Version Copyright (C) 2013 Infobyte LLC (http://www.infobytesec.com/) See the file 'doc/LICENSE' for the license information ''' import unittest import sys import os sys.path.append(os.path.abspath(os.getcwd())) # from plugins...
__doc__ = """hashlib module - A common interface to many hash functions. new(name, string='') - returns a new hash object implementing the given hash function; initializing the hash using the given string data. Named constructor functions are also available, these a...
import re from subprocess import Popen, PIPE, STDOUT import platform from conans.client.output import Color from conans.model.version import Version import os def _execute(command): proc = Popen(command, shell=True, bufsize=1, stdout=PIPE, stderr=STDOUT) output_buffer = [] while True: line = proc...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], 'supported_by': 'certified'} try: import boto.ec2 HAS_BOTO = True except ImportError: HAS_BOTO = False from ansible.module_utils._text import to_bytes import random import string def ma...
import BoostBuild import os import re import sys executable = sys.executable.replace("\\", "/") if " " in executable: executable = '"%s"' % executable def string_of_length(n): if n <= 0: return "" n -= 1 y = ['', '$(1x10-1)', '$(10x10-1)', '$(100x10-1)', '$(1000x10-1)'] result = [] f...
import logging import logging.handlers import json import etc.fishface_config as ff_conf logger = logging.getLogger('fishface') logger.setLevel(ff_conf.OVERALL_LOG_LEVEL) formatter = logging.Formatter('%(asctime)s %(name)s %(levelname)s %(message)s') file_handler = logging.FileHandler(ff_conf.LOG_FILE_PATH) file_ha...
#!/usr/bin/python3 """ Copyright (c) 2014, Maxim Abrosimov All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of c...
""" This simple component makes it so that switches send full packet payloads on table misses. """ from pox.core import core from pox.lib.revent import EventRemove def launch (): def set_miss_length (event = None): if not core.hasComponent('openflow'): return core.openflow.miss_send_len = 0x7fff c...
import urllib import pytest from mitmproxy.test import taddons from mitmproxy.test import tflow import mitmproxy.test.tutils from mitmproxy.addons import serverplayback from mitmproxy import options from mitmproxy import exceptions from mitmproxy import io def tdump(path, flows): w = io.FlowWriter(open(path, "w...
""" NOTES ABOUT THIS PROGRAM The following files are produced when only a SAM file is provided: The coverage file produced gives the scaffold name, each subunit within each scaffold, and how many times a read maps to that subunit. If no reads are mapped to the subunit, it will be given a value of zero. In most cases ...
"""Utility functions for writing decorators (which modify docstrings).""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys def get_qualified_name(function): # Python 3 if hasattr(function, '__qualname__'): return function.__qualname__ ...
from __future__ import unicode_literals from django.db import DEFAULT_DB_ALIAS class TestRouter(object): """ Vaguely behave like primary/replica, but the databases aren't assumed to propagate changes. """ def db_for_read(self, model, instance=None, **hints): if instance: retu...
# -*- coding: utf-8 -*- """ jinja2.utils ~~~~~~~~~~~~ Utility functions. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import re import sys import errno try: from thread import allocate_lock except ImportError: from dummy_thread import allocate_lo...
from __future__ import division, absolute_import, print_function import warnings import numpy as np from numpy.testing import (assert_, TestCase, assert_array_equal, assert_allclose, run_module_suite, suppress_warnings) from numpy.compat import sixu rlevel = 1 ...
import re from decimal import Decimal from datetime import time, datetime, timedelta from weboob.deprecated.browser import Page from weboob.tools.json import json from weboob.deprecated.mech import ClientForm from weboob.capabilities.base import UserError, Currency class ForeignPage(Page): def on_loaded(self): ...
ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'version': '1.0'} import json from ansible.module_utils.api import basic_auth_argument_spec from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.pycompat24 import get_exception fr...
from Source import Source from Components.Element import cached from enigma import iRecordableService from Components.SystemInfo import SystemInfo class RecordState(Source): def __init__(self, session): Source.__init__(self) self.records_running = 0 self.session = session session.nav.record_event.append(self....
import logging import threading import serial logger = logging.getLogger('') class DMX(): # _dim = 10^((n-1)/(253/3)-1) by JNK from KNX UF #_dim = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
from django import forms from markitup.widgets import MarkItUpWidget from .models import TalkProposal, TutorialProposal class ProposalForm(forms.ModelForm): def clean_description(self): value = self.cleaned_data["description"] if len(value) > 400: raise forms.ValidationError( ...
import numpy as np # This function calculates best fitting polynomial line (up to order 3) for a # given set of input points x and y, using linear least squares inversion. # Default is for 1st order. # x and y are one dimensional arrays def oneD_least_squares_polynomial(x,y,order=1): # first up - mask nodata values...
import os import sys import unittest import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common'))) import utils r = utils.import_python_driver() class PrettyPrintTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.conn = r.connect( ...
from prismriver.plugin.common import Plugin from prismriver.struct import Song class LyricsFreakPlugin(Plugin): ID = 'lyricsfreak' def __init__(self, config): super(LyricsFreakPlugin, self).__init__('LyricsFreak', config) def search_song(self, artist, title): link = 'http://www.lyricsfre...
"""Statistics for all network connections currently known by the netfilter subsystem.""" import os import rrdtool from components.common import * from templates.connections.index import index as ConnectionsPage # # The file where we get our data from. # DATA_SOURCE = "/proc/net/ip_conntrack" class NetworkConnect...
import email.utils import mimetypes from .packages import six def guess_content_type(filename, default='application/octet-stream'): """ Guess the "Content-Type" of a file. :param filename: The filename to guess the "Content-Type" of using :mod:`mimetypes`. :param default: If no "Cont...
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 __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import flt, cint, getdate, formatdate, comma_and, time_diff_in_seconds, to_timedelta from frappe.model.document import Document from dateutil.parser import parse class WorkstationHolidayError(frappe.ValidationError): pass clas...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings import wagtail.wagtailsearch.index def set_page_path_collation(apps, schema_editor): """ Treebeard's path comparison logic can fail on certain locales such as sk_SK, which...
#!/usr/bin/env python3 import argparse import glob import os import sys from typing import Set ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(ZULIP_PATH) from scripts.lib.hash_reqs import expand_reqs, hash_deps from scripts.lib.zulip_tools import ( get_env...
from django.core.validators import URLValidator from rest_framework import serializers as ser from modularodm import Q from website.models import ApiOAuth2Application from api.base.serializers import JSONAPISerializer, LinksField, IDField, TypeField from api.base.utils import absolute_reverse class ApiOAuthApplica...
from django.conf import settings from django.conf.urls.defaults import * if settings.USE_I18N: i18n_view = 'django.views.i18n.javascript_catalog' else: i18n_view = 'django.views.i18n.null_javascript_catalog' urlpatterns = patterns('', ('^$', 'django.contrib.admin.views.main.index'), ('^r/(\d+)/(.*)/$'...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from Define import Global from Define import IMocca from Define import Utility # from qqbot import qqbotsched def onQQMessage(bot, contact, member, content): """ QQBot 全局调用入口 """ # print(bot) # print(contact) # print(member) # print(content) ...
import StringIO import sys # Twisted Imports from twisted.trial import unittest from twisted.spread import banana from twisted.python import failure from twisted.internet import protocol, main class MathTestCase(unittest.TestCase): def testInt2b128(self): funkylist = range(0,100) + range(1000,1100) + ran...
# -*- coding: utf-8 -*- import re from datetime import datetime import nose import numpy as np from pandas.compat import long import pandas.core.algorithms as algos import pandas.util.testing as tm from pandas.tslib import iNaT _multiprocess_can_split_ = True class TestTake(tm.TestCase): # standard incompatible...
import json from scipy import stats # !!! This giant block of imports should be something simpler, such as: # from great_exepectations.helpers.expectation_creation import * from great_expectations.execution_engine import ( PandasExecutionEngine, SparkDFExecutionEngine, SqlAlchemyExecutionEngine, ) from gr...
import sys import traceback import buggalo_client as client import xbmc import xbmcaddon import xbmcgui buggaloAddon = xbmcaddon.Addon(id='script.module.buggalo') ACTION_PARENT_DIR = 9 ACTION_PREVIOUS_MENU = 10 class BuggaloDialog(xbmcgui.WindowXMLDialog): THANK_YOU_VISIBLE_LABEL = 98 DETAILS_VISIBLE_LABE...
from nose.tools import eq_, ok_, assert_raises from socorro.app.fetch_transform_save_app import FetchTransformSaveApp from socorro.lib.threaded_task_manager import ThreadedTaskManager from socorro.lib.util import DotDict, SilentFakeLogger from socorro.unittest.testbase import TestCase class TestFetchTransformSaveApp...
def donuts(count): if count >= 10: count_string = 'many' else: count_string = str(count) return ('Number of donuts: ' + count_string) # B. both_ends # Given a string s, return a string made of the first 2 # and the last 2 chars of the original string, # so 'spring' yields 'spng'. However, ...
from werkzeug.security import generate_password_hash, check_password_hash from flask import Flask, render_template, redirect, url_for, request from flask.ext.bootstrap import Bootstrap from flask.ext.wtf import Form from wtforms import StringField, PasswordField, BooleanField, SubmitField from wtforms.validators import...
import sys import os import os.path import re import getopt # # svn autoprops definitions. # Copy and paste here the ICU recommended auto-props from # http://icu-project.org/docs/subversion_howto/index.html # # This program will parse this autoprops string, and verify that files in # the repository have t...
"""Simple text browser for IDLE """ from tkinter import * import tkinter.messagebox as tkMessageBox class TextViewer(Toplevel): """A simple text viewer dialog for IDLE """ def __init__(self, parent, title, text, modal=True, _htest=False): """Show the given text in a scrollable window with a 'clo...
import os, sys, getpass from optparse import OptionParser try: import pyacd except ImportError: pyacd_lib_dir=os.path.dirname(__file__)+os.sep+".." if os.path.exists(pyacd_lib_dir) and os.path.isdir(pyacd_lib_dir): sys.path.insert(0, pyacd_lib_dir) import pyacd parser=OptionParser( epilog="This command ...
""" Distance and Area objects to allow for sensible and convenient calculation and conversions. Authors: Robert Coup, Justin Bronn, Riccardo Di Virgilio Inspired by GeoPy (http://exogen.case.edu/projects/geopy/) and Geoff Biggs' PhD work on dimensioned units for robotics. """ __all__ = ['A', 'Area', 'D', 'Distance'] ...
"""This tool creates a docker image from a layer and the various metadata.""" import sys import tarfile from tools.build_defs.pkg import archive from third_party.py import gflags # Hardcoded docker versions that we are claiming to be. DATA_FORMAT_VERSION = '1.0' gflags.DEFINE_string( 'output', None, 'The ou...
# -*- 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 'PluginVersion.create_date' db.add_column('developer_plugi...
"""Unit tests for the input.py file.""" import gyp.input import unittest import sys class TestFindCycles(unittest.TestCase): def setUp(self): self.nodes = {} for x in ('a', 'b', 'c', 'd', 'e'): self.nodes[x] = gyp.input.DependencyGraphNode(x) def _create_dependency(self, dependent, dependency): ...
import numpy as np from scipy import sparse as sp from nose.tools import assert_raises, assert_equal from numpy.testing import assert_array_equal from sklearn.base import BaseEstimator from sklearn.feature_selection.base import SelectorMixin from sklearn.utils import check_array class StepSelector(SelectorMixin, Ba...
import random import math import hashlib from optparse import OptionParser import os import sys import re try: import Image import ImageFont import ImageDraw import ImageEnhance import ImageOps except: sys.exit("This script requires the Python Imaging Library - http://www.pythonware.com/products/pil/") nonalpha...
""" Helper functions for dealing with Twisted deferreds """ from twisted.internet import defer, reactor, task from twisted.python import failure from scrapy.exceptions import IgnoreRequest def defer_fail(_failure): """Same as twisted.internet.defer.fail, but delay calling errback until next reactor loop ...
#!/usr/bin/python import sys import re import operator #import csv from collections import defaultdict scenario = {'worker':-1, 'schedule':'none', 'allocation':'none', 'time':0.0} scenarios = [] def fast_unique(seq): seen = set() seen_add = seen.add return [ x for x in seq if x not in seen and not seen_a...
from __future__ import print_function import argparse import os import subprocess parser = argparse.ArgumentParser() parser.add_argument("cmd") parser.add_argument("args", nargs=argparse.REMAINDER) args = parser.parse_args() # These are the dependencies that need to be satisfied # Include the dependencies implicit ...
import pos_box import pos_confirm import pos_details import pos_discount import pos_open_statement import pos_payment import pos_session_opening # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
import os import sys import unittest SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) TOOLS_DIR = os.path.dirname(SCRIPT_DIR) CHROME_SRC = os.path.dirname(os.path.dirname(os.path.dirname(TOOLS_DIR))) MOCK_DIR = os.path.join(CHROME_SRC, 'third_party', 'pymock') # For the mock library sys.path.append(MOCK_DIR) i...
import test.test_support, unittest # we're testing the behavior of these future builtins: from future_builtins import hex, oct, map, zip, filter class BuiltinTest(unittest.TestCase): def test_hex(self): self.assertEqual(hex(0), '0x0') self.assertEqual(hex(16), '0x10') self.assertEqual(hex(...
try: from cs import CloudStack, CloudStackException, read_config has_lib_cs = True except ImportError: has_lib_cs = False # import cloudstack common from ansible.module_utils.cloudstack import * class AnsibleCloudStackSecurityGroup(AnsibleCloudStack): def __init__(self, module): super(Ansibl...