content
stringlengths
4
20k
""" Some multi-threading tests of boto in a greenlet environment. """ from __future__ import print_function import boto import time import uuid from threading import Thread def spawn(function, *args, **kwargs): """ Spawns a new thread. API is the same as gevent.greenlet.Greenlet.spawn. """ t = T...
from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline ...
import getpass import logging import os from urlparse import urlparse from django.conf import settings from django.core.mail import EmailMultiAlternatives from django.template.loader import get_template from readthedocs.builds.constants import LATEST from readthedocs.builds.constants import LATEST_VERBOSE_NAME from ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible CHOICES = ( (1, 'first'), (2, 'second'), ) @python_2_unicode_compatible class Article(models.Model): headline = models.CharField(max_length=100, def...
class HTTPError(Exception): "Base exception used by this module." pass class PoolError(HTTPError): "Base exception for errors caused within a pool." def __init__(self, pool, message): self.pool = pool HTTPError.__init__(self, "%s: %s" % (pool, message)) def __reduce__(self): ...
#!/usr/bin/python # -*- coding: utf-8 -*- """ Ansible module to add boundary meters. (c) 2013, curtis <<EMAIL>> 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 License as published by the Free Software Foundation, either versi...
import copy import quantities as pq import scipy as sp import scipy.signal import scipy.special import tools default_kernel_area_fraction = 0.99999 class Kernel(object): """ Base class for kernels. """ def __init__(self, kernel_size, normalize): """ :param kernel_size: Parameter controlling...
#!/usr/bin/python3 # import os import sys import xml.sax import subprocess INKSCAPE = '/usr/bin/inkscape' OPTIPNG = '/usr/bin/optipng' MAINDIR = 'Moka' SOURCES = ('src/#', 'src/A', 'src/B', 'src/C', 'src/D', 'src/E', 'src/F', 'src/G', 'src/H', 'src/I', 'src/J', 'src/K', 'src/L', 'src/M', 'src/N', 'src/O', 'src/P', ...
import os import unittest from unittest import skipUnless from django.contrib.gis.gdal import HAS_GDAL from ..test_data import TEST_DATA, TestDS, get_ds_file if HAS_GDAL: from django.contrib.gis.gdal import DataSource, Envelope, OGRGeometry, GDALException, OGRIndexError, GDAL_VERSION from django.contrib.gis....
"""Expose regular shell commands as services.""" import asyncio import logging import shlex import voluptuous as vol from homeassistant.core import ServiceCall from homeassistant.exceptions import TemplateError from homeassistant.helpers import config_validation as cv, template from homeassistant.helpers.typing impor...
# -*- coding: utf-8 -*- from copy import copy import django from django.conf import settings from django.forms.formsets import BaseFormSet from django.template import Context from django.template.loader import get_template from django import template from crispy_forms.helper import FormHelper from crispy_forms.compat...
""" Test the student dashboard view. """ import unittest import ddt from django.conf import settings from django.core.urlresolvers import reverse from django.test import TestCase from edx_oauth2_provider.constants import AUTHORIZED_CLIENTS_SESSION_KEY from edx_oauth2_provider.tests.factories import ClientFactory, Trus...
import unittest import json from pylib.results.flakiness_dashboard import json_results_generator class JSONGeneratorTest(unittest.TestCase): def setUp(self): self.builder_name = 'DUMMY_BUILDER_NAME' self.build_name = 'DUMMY_BUILD_NAME' self.build_number = 'DUMMY_BUILDER_NUMBER' # For archived res...
""" This file describes the interfaces for adapting OPFTaskDriver to specific environments. These interfaces encapsulate external specifics, such as data source (e.g., .csv file or database, etc.), prediction sink (.csv file or databse, etc.), report and serialization destination, etc. """ from abc import ABCMeta,...
""" termcolors.py """ from django.utils import six color_names = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white') foreground = dict((color_names[x], '3%s' % x) for x in range(8)) background = dict((color_names[x], '4%s' % x) for x in range(8)) RESET = '0' opt_dict = {'bold': '1', 'underscore':...
from django import forms from django.conf import settings from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ from django.contrib.admin.widgets import ForeignKeyRawIdWidget generic_script = """ <script type="text/javascript"> function showGenericRelatedObjectLookupPop...
import time import threading class Switch(object): """Button like component with two stable states""" def __init__(self, pin): """ :param pin: A instance of DigitalPin """ self.pin = pin self.pin.mode = 'IN' self.polling_task = None self._up_callback = ...
from __future__ import print_function import argparse import sys from selecta.indexing import FuzzyIndex from selecta.ui import DumbTerminalUI, SmartTerminalUI from selecta.utils import identity from selecta.terminal import reopened_terminal, Terminal __version__ = "0.0.1" KNOWN_UI_CLASSES = dict( dumb=DumbTerm...
# # Emulation of has_key() function for platforms that don't use ncurses # import _curses # Table mapping curses keys to the terminfo capability name _capability_names = { _curses.KEY_A1: 'ka1', _curses.KEY_A3: 'ka3', _curses.KEY_B2: 'kb2', _curses.KEY_BACKSPACE: 'kbs', _curses.KEY_BEG: 'kbeg', ...
"""SocksiPy - Python SOCKS module. Version 1.00 Copyright 2006 Dan-Haim. 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 ...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models try: from django.contrib.auth import get_user_model except ImportError: # django < 1.5 from django.contrib.auth.models import User else: User = get_user_model() user_orm_label...
import json from swallow.logger_mp import get_logger_mp class JsonFileio: """Reads all Docs of a Json file and pushes them into a queue""" def scan_and_queue(self, p_queue, p_file): """ Reads json file and pushes docs to the queue If the file contains a list, each doc is pushed in the que...
from ansible.compat.tests import unittest, mock from hpe_test_utils import OneViewBaseTestCase from oneview_module_loader import NetworkSetModule FAKE_MSG_ERROR = 'Fake message error' NETWORK_SET = dict( name='OneViewSDK Test Network Set', networkUris=['/rest/ethernet-networks/aaa-bbb-ccc'] ) NETWORK_SET_WIT...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import json from ansible.module_utils.basic import to_text from ansible.errors import AnsibleConnectionFailure from ansible.module_utils.six.moves.urllib.error import HTTPError from ansible.plugins.httpapi import HttpApiBase from...
""" Tools for sending email. """ from __future__ import unicode_literals from django.conf import settings # Imported for backwards compatibility and for the sake # of a cleaner namespace. These symbols used to be in # django/core/mail.py before the introduction of email # backends and the subsequent reorganization (Se...
from __future__ import absolute_import from django.utils.datastructures import SortedDict from horizon.utils import memoized from openstack_dashboard.api import neutron neutronclient = neutron.neutronclient class Rule(neutron.NeutronAPIDictWrapper): """Wrapper for neutron firewall rule.""" def get_dict(s...
# <EMAIL> # # This is a simple little module I wrote to make life easier. I didn't # see anything quite like it in the library, though I may have overlooked # something. I wrote this when I was trying to read some heavily nested # tuples with fairly non-descriptive content. This is modeled ver...
from __future__ import unicode_literals ESCAPED = frozenset(".\\+*?[^]$(){}=!<>|:-") def re_escape(pattern): """Escape for use in database regexp match. This is based on re.escape, but that one escapes too much. """ string = list(pattern) for i, char in enumerate(pattern): if char == "\0...
from __future__ import print_function, division from sympy.core.containers import Tuple from sympy.core.compatibility import range from types import FunctionType class TableForm(object): """ Create a nice table representation of data. Examples ======== >>> from sympy import TableForm >>> t...
DATE_FORMAT = 'j F Y' TIME_FORMAT = 'H:i:s' DATETIME_FORMAT = 'j F Y H:i:s' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j F' SHORT_DATE_FORMAT = 'j N Y' SHORT_DATETIME_FORMAT = 'j N Y H:i:s' FIRST_DAY_OF_WEEK = 1 # Monday DATE_INPUT_FORMATS = ( '%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06' '%d.%m.%Y', '%...
from command import PagedCommand try: import threading as _threading except ImportError: import dummy_threading as _threading import glob import itertools import os from color import Coloring class Status(PagedCommand): common = True helpSummary = "Show the working tree status" helpUsage = """ %prog [<pr...
"""Test layout and bijective-layout node""" import tvm from topi.util import get_const_tuple def test_layout(): layout = tvm.layout("NCHW16c") assert layout is not None assert isinstance(layout, tvm.tensor.Layout) assert layout.factor_of("c") == 16 assert layout.factor_of("C") == 16 assert la...
from django.conf import settings from django.contrib.sessions.backends.base import SessionBase, CreateError from django.core.cache import get_cache from django.utils.six.moves import xrange KEY_PREFIX = "django.contrib.sessions.cache" class SessionStore(SessionBase): """ A cache-based session store. """ ...
#!/usr/bin/python # $Id:$ import unittest import pyglet from graphics_common import * __noninteractive = True class TEST_CASE(unittest.TestCase): def check(self, expected, result, dimensions): if len(expected) != len(result) * dimensions / 4: self.fail('Incorrect number of vertices in feedb...
from pygments.style import Style from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic class MyHiglightStyle(Style): """ Port of the default trac highlighter design. """ default_style = '' styles = { Comment: 'italic #999988', # ...
import zipfile from django.core.exceptions import ValidationError import mock from uploadtemplate.forms import ThemeForm from uploadtemplate.models import Theme from uploadtemplate.tests import BaseTestCase from uploadtemplate.utils import is_zipfile class ThemeFormTestCase(BaseTestCase): def test_name_not_give...
from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( HEADRequest, sanitized_Request, urlencode_postdata, ) class GDCVaultIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?gdcvault\.com/play/(?P<id>\d+)/(?P<name>(\w|-)+)?' _NETRC_MACHINE = '...
from nose import SkipTest from nose.tools import assert_raises, assert_true, assert_equal import networkx as nx from networkx.generators.classic import barbell_graph,cycle_graph,path_graph class TestConvertNumpy(object): numpy=1 # nosetests attribute, use nosetests -a 'not numpy' to skip test @classmethod ...
"""feedfinder: Find the Web feed for a Web page http://www.aaronsw.com/2002/feedfinder/ Usage: feed(uri) - returns feed found for a URI feeds(uri) - returns all feeds found for a URI >>> import feedfinder >>> feedfinder.feed('scripting.com') 'http://scripting.com/rss.xml' >>> >>> feedfinder.fe...
# -*- coding: utf-8 -*- """ flask.globals ~~~~~~~~~~~~~ Defines all the global objects that are proxies to the current active context. :copyright: (c) 2015 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from functools import partial from werkzeug.local import LocalStack, ...
__author__ = 'Jeremy Emerson' import os import re import string from core.domain import obj_services from core.domain import rte_component_registry from core.tests import test_utils import feconf import schema_utils import schema_utils_test import utils # File names ending in any of these suffixes will be ignored wh...
from flask import jsonify from indico.core.config import Config from MaKaC.webinterface.rh.conferenceModif import RHConferenceModifBase from indico_piwik.views import WPStatistics from indico_piwik.reports import (ReportCountries, ReportDevices, ReportDownloads, ReportGeneral, ReportMaterial, ...
from yowsup.structs import ProtocolEntity, ProtocolTreeNode from .iq_groups_participants import ParticipantsGroupsIqProtocolEntity class AddParticipantsIqProtocolEntity(ParticipantsGroupsIqProtocolEntity): ''' <iq type="set" id="{{id}}" xmlns="w:g2", to="{{group_jid}}"> <add> <participant j...
# -*- coding: utf-8 -*- """ ==================== Biadjacency matrices ==================== """ # Copyright (C) 2013-2015 by # Aric Hagberg <<EMAIL>> # Dan Schult <<EMAIL>> # Pieter Swart <<EMAIL>> # All rights reserved. # BSD license. import itertools from networkx.convert import _prep_create_using fr...
"""Implementation of JSONEncoder """ import re try: from lib.simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii except ImportError: c_encode_basestring_ascii = None try: from lib.simplejson._speedups import make_encoder as c_make_encoder except ImportError: c_make_encoder ...
"Commonly-used date structures" from django.utils.translation import pgettext_lazy, ugettext_lazy as _ WEEKDAYS = { 0: _('Monday'), 1: _('Tuesday'), 2: _('Wednesday'), 3: _('Thursday'), 4: _('Friday'), 5: _('Saturday'), 6: _('Sunday') } WEEKDAYS_ABBR = { 0: _('Mon'), 1: _('Tue'), 2: _('Wed'), 3: _('Thu'),...
""" Script to generate the installer for cxxtest. """ classifiers = """\ Development Status :: 4 - Beta Intended Audience :: End Users/Desktop License :: OSI Approved :: LGPL License Natural Language :: English Operating System :: Microsoft :: Windows Operating System :: Unix Programming Language :: Python Topic :: So...
# -*- coding: utf-8 -*- from module.plugins.internal.SimpleHoster import SimpleHoster class DataportCz(SimpleHoster): __name__ = "DataportCz" __type__ = "hoster" __version__ = "0.46" __status__ = "testing" __pattern__ = r'http://(?:www\.)?dataport\.cz/file/(.+)' __config__ = [("activ...
"""This module is deprecated. Please use :mod:`airflow.providers.google.cloud.transfers.gcs_to_bigquery`.""" import warnings from airflow.providers.google.cloud.transfers.gcs_to_bigquery import GCSToBigQueryOperator warnings.warn( "This module is deprecated. Please use `airflow.providers.google.cloud.transfers.g...
""" After years of study, scientists have discovered an alien language transmitted from a faraway planet. The alien language is very unique in that every word consists of exactly L lowercase letters. Also, there are exactly D words in this language. Once the dictionary of all the words in the alien language was built,...
#!/usr/bin/env python # -*- coding: utf-8 -*- # import sys import time import logging import getopt from multiprocessing import Process from util.preprocess import mergeMultiProcessMatFiles from util.UniGridDisOnlyPoints import UniGridDisOnlyPoints def processTask(x, city, directory, inum, onum, GRIDSNUM, subopa...
#!/usr/bin/env python import numpy as np def gen_data(num_classes,num_samples,dim): np.random.seed(0) covs = np.array([[[0., -1. ], [2.5, .7]], [[3., -1.5], [1.2, .3]], [[ 2, 0 ], [ .0, 1.5 ]]]) X = np.r_[np.dot(np.random.randn(num_samples, dim), covs[0]) + np.array([0, 10]), np.dot(np.random.randn...
class Node(object): def __init__(self, tag, value, start_mark, end_mark): self.tag = tag self.value = value self.start_mark = start_mark self.end_mark = end_mark def __repr__(self): value = self.value #if isinstance(value, list): # if len(value) == 0: ...
# -*- coding: utf-8 -*- """Sphinx directive to support embedded IPython code. This directive allows pasting of entire interactive IPython sessions, prompts and all, and their code will actually get re-executed at doc build time, with all prompts renumbered sequentially. To enable this directive, simply list it in you...
#!/usr/bin/env python # -*- coding: utf-8 # pytest unit tests for spinalcordtoolbox.deepseg_sc import pytest import numpy as np import nibabel as nib from keras import backend as K import spinalcordtoolbox as sct from spinalcordtoolbox.image import Image import spinalcordtoolbox.deepseg_sc.core from spinalcordtoolbox...
#coding=utf-8 from django.shortcuts import render from django.contrib.auth.decorators import login_required from dashboard.models import * from returner.models import * import logging from shaker.tasks import dashboard_task, grains_task from shaker.check_service import CheckPort, CheckProgress logger = logging.getLogg...
""" Test helper functions and base classes. """ import json import unittest import functools import requests import os from path import path from bok_choy.web_app_test import WebAppTest from opaque_keys.edx.locator import CourseLocator def skip_if_browser(browser): """ Method decorator that skips a test if br...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.plugins.callback import CallbackBase from ansible import constants as C class CallbackModule(CallbackBase): ''' This is the default callback interface, which simply prints messages to stdout when new cal...
"""Functional tests for out-of-memory conditions.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.compiler.tests import xla_test from tensorflow.python.framework import dtypes from tensorflow.python.framework import errors from tensorflow...
# -*- coding: utf-8 -*- """ pygments.formatters.img ~~~~~~~~~~~~~~~~~~~~~~~ Formatter for Pixmap output. :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import sys from pygments.formatter import Formatter from pygments.util import ge...
"""Unit tests for the :func:`iris.analysis._scipy_interpolate._RegularGridInterpolator` class.""" from __future__ import (absolute_import, division, print_function) from six.moves import (filter, input, map, range, zip) # noqa # Import iris.tests first so that some things can be initialised before # importing anythi...
import os TRUE_VALUES = ('true', '1', 'yes') def get_boolean_option(option_dict, option_name, env_name): return ((option_name in option_dict and option_dict[option_name][1].lower() in TRUE_VALUES) or str(os.getenv(env_name)).lower() in TRUE_VALUES)
""" Distutils convenience functionality. Don't use this outside of Twisted. Maintainer: Christopher Armstrong """ import sys, os from distutils.command import build_scripts, install_data, build_ext, build_py from distutils.errors import CompileError from distutils import core from distutils.core import Extension tw...
# -*- coding: utf-8 -*- from django.conf import settings from django.http import HttpRequest from django.test import TestCase from ipware.ip import get_ip from ipware.ip import get_real_ip from ipware.ip import get_trusted_ip class IPv4TestCase(TestCase): """IP address Test""" def test_meta_none(self): ...
from __future__ import division, print_function, absolute_import import os import sys if sys.version_info[0] >= 3: from io import StringIO else: from StringIO import StringIO import tempfile import numpy as np from numpy.testing import TestCase, assert_equal, \ assert_array_almost_equal_nulp from scipy....
import discount # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
from math import floor, ceil class RegionOfInterest: """Abstract base class""" pass class CircularRegionOfInterest(RegionOfInterest): """Representation of a circular ROI *Usage:* >>> roi = CircularRegionOfInterest(20.0, 20.0, radius=5.0) >>> signal = image_sequence.signal_from_region(roi) ...
#!/usr/bin/env python3 '''Spearmint Comic Comic plugin for Spearmint ''' import os from time import mktime from zipfile import is_zipfile, ZipFile import mimetypes import cherrypy import Utils mimetypes.init() class Comic(object): '''Spearmint Comic Plugin Main Class''' def __init__(self, path=None): ...
""" Unit Tests for nova.network.rpcapi """ import collections import contextlib import mock from mox3 import mox from oslo_config import cfg from nova import context from nova.network import rpcapi as network_rpcapi from nova import test from nova.tests.unit import fake_instance CONF = cfg.CONF class NetworkRpcAP...
#!/usr/bin/env python """Master pipeline script for generating trained HDPs for MinION signal data Input: alignments using non-HDP model Output: trained HDP and model The objective of this pipeline is to: 1. use input alignments to make 'build alignment' for generating the initial HDP 2. generates the initial...
from __future__ import absolute_import import os import signal import unittest import threading from contextlib import contextmanager try: from gi.repository import Gtk except ImportError: Gtk = None from gi.repository import Gio, GLib from gi._ossighelper import wakeup_on_signal, register_sigint_fallback c...
import proto # type: ignore from google.ads.googleads.v7.common.types import policy from google.ads.googleads.v7.enums.types import policy_approval_status from google.ads.googleads.v7.enums.types import policy_review_status __protobuf__ = proto.module( package='google.ads.googleads.v7.common', marshal='goog...
import uuid import logging import re import time from openerp.osv import osv, fields from openerp import tools, SUPERUSER_ID from openerp.tools.translate import _ from openerp.exceptions import UserError _logger = logging.getLogger(__name__) try: from gengo import Gengo except ImportError: _logger.warning('G...
from django.contrib.auth.models import User from django.test import TestCase from django.test.utils import override_settings @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) class SpecialHeadersTest(TestCase): fixtures = ['data.xml'] urls = 'special_headers.urls' d...
import sys import re from functools import wraps from unittest import TestCase from scrapy.http import Request from scrapy.utils.spider import iterate_spider_output from scrapy.utils.python import get_spec class ContractsManager(object): contracts = {} def __init__(self, contracts): for contract in ...
import functools import numpy as np import scipy.stats import pandas import matplotlib.pyplot as plt import seaborn as sns def splithalf(data, aggfunc=np.nanmean, rng=None): data = np.array(data) if rng is None: rng = np.random.RandomState(None) inds = list(range(data.shape[0])) rng.shuffle(i...
from __future__ import absolute_import # Copyright (c) 2010-2015 openpyxl from .data_source import NumDataSource, NumRef, AxDataSource from .reference import Reference from .series import Series, XYSeries, SeriesLabel, StrRef from ..utils import SHEETRANGE_RE, rows_from_range, quote_sheetname def SeriesFactory(value...
# -*- coding: utf-8 -*- """ *************************************************************************** __init__.py --------------------- Date : May 2014 Copyright : (C) 2014 by Nathan Woodrow Email : woodrow dot nathan at gmail dot com ********************...
import os import sys sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "python-bitcoinrpc")) import json import shutil import subprocess import tempfile import traceback from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from util import * from netutil import * def run_bind_te...
''' This is a GRID search to find the best parameters of an algorithm. In future developments it will be parallelized. In the Mountain Car Problem, for Sarsa with Tile Coding, we have the parameters from Sutton and Barto Book alpha = 0.5 (then divided by num tilings, so it becomes 0.5/0.8, check the implement...
import re import urllib, ConfigParser from distutils.core import setup import py2exe, sys, os, shutil, datetime, zipfile, subprocess, fnmatch import googlecode_upload from lib.pygithub import github # mostly stolen from the SABnzbd package.py file name = 'SickBeard' version = '0.1' release = name + '-' + version Win...
from __future__ import print_function import sys, time, random, os, json from six.moves.urllib.parse import urlencode from subprocess import Popen, PIPE from twisted.web.server import Site, NOT_DONE_YET from twisted.web.resource import Resource from twisted.internet import reactor, defer, ssl from scrapy import twisted...
import cStringIO import struct import dns.exception import dns.inet import dns.rdata import dns.tokenizer class APLItem(object): """An APL list item. @ivar family: the address family (IANA address family registry) @type family: int @ivar negation: is this item negated? @type negation: bool @i...
"Database cache backend." import base64 from datetime import datetime try: from django.utils.six.moves import cPickle as pickle except ImportError: import pickle from django.conf import settings from django.core.cache.backends.base import BaseCache, DEFAULT_TIMEOUT from django.db import connections, transacti...
import datetime from django.db import models from django.core.exceptions import ImproperlyConfigured from django.http import Http404 from django.utils.encoding import force_unicode from django.utils.translation import ugettext as _ from django.utils import timezone from django.views.generic.base import View from django...
#from https://gist.github.com/andersx/6061586 #runas run() #bench run() #pythran export run() # A simple energy minimization program that uses steepest descent # and a force field to minimize the energy of water in internal coordinates. # Written by Jan H. Jensen, 2013 def Eandg(rOH,thetaHOH): """" Argumen...
import requests from allauth.socialaccount.providers.oauth2.views import (OAuth2Adapter, OAuth2LoginView, OAuth2CallbackView) from .provider import AmazonProvider class AmazonOAuth2Adapter(OAuth2Adapte...
import logging import time import unittest from pylib.device import intent from telemetry.core import android_app from telemetry.core.backends import android_app_backend from telemetry.core import platform as platform_module from telemetry.core.platform import android_device from telemetry.unittest_util import options...
from __future__ import absolute_import import re import shlex # back port from python3 _find_unsafe = re.compile(r'[^\w@%+=:,./-]').search def _shlex_quote(s): """Return a shell-escaped version of the string *s*.""" if not s: return "''" if _find_unsafe(s) is None: return s # use s...
import abc import sqlite3 from django.conf import settings class Connection(object): obj = None DB_PATH = None def __init__(self): super(Connection, self).__init__() self.db_name = settings.DATABASES['default']['NAME'] if self.DB_PATH is None else self.DB_PATH self.conn = sqlite3....
import unittest, mock, shutil, tempfile, os from cookies import aggregate from cookies.models import * from django.db import transaction class TestAggregate(unittest.TestCase): def setUp(self): with transaction.atomic(): self.user = User.objects.create(username='bob') self.superco...
# -*- coding: utf-8 -*- """ *************************************************************************** RandomPointsLayer.py --------------------- Date : April 2014 Copyright : (C) 2014 by Alexander Bruy Email : alexander dot bruy at gmail dot com *********...
from plankton import options import unittest a = options.ArgumentElement f = options.FlagElement N = None def o(*elms): return options.Options(elements=elms) class OptionsTest(unittest.TestCase): def run_element_test(self, expected, *args): result = options.parse(args) self.assertEquals(expected, res...
import os import subprocess import tempfile from conans.util.env_reader import get_env from conans.util.files import load, mkdir, rmdir, save from conans.util.log import logger from conans.util.sha import sha256 CONAN_LINK = ".conan_link" CONAN_REAL_PATH = "real_path.txt" def conan_expand_user(path): """ wrappe...
import warnings from django.conf.urls import include, patterns, url from django.utils.deprecation import RemovedInDjango110Warning from .views import ( absolute_kwargs_view, defaults_view, empty_view, empty_view_partial, empty_view_wrapped, nested_view, ) other_patterns = [ url(r'non_path_include/$', emp...
"""Provides Openstack Version Info Model This module defines a class representing the data model for Openstack package and version information """ import nova.openstack.common.report.models.with_default_views as mwdv import nova.openstack.common.report.views.text.generic as generic_text_views class PackageModel(mwd...
"""Analyze python import statements.""" from __future__ import absolute_import, print_function import ast import os import uuid from lib.util import ( display, ApplicationError, ) VIRTUAL_PACKAGES = set([ 'ansible.module_utils.six', ]) def get_python_module_utils_imports(compile_targets): """Retur...
""" Revision ====== Manage gerrit revisions for a change id """ from gerrit.error import ( UnhandledError ) class Revision(object): """Manage gerrit revisions""" def __init__(self, gerrit_con, change_id, revision_id): """ :param gerrit_con: The connection object to gerrit :type ...
import os import shutil import packer UNPROCESSED_ASSET_FOLDER = "assets/unprocessed" PROCESSED_ASSET_FOLDER = "assets/preprocessed" TEXTURE_FOLDER = "assets/compiled" print("=== Processing unprocessed assets in {} ===".format( UNPROCESSED_ASSET_FOLDER)) for root, dirs, files in os.walk(UNPROCESSED_ASSET_FOLDE...
# -*- coding: utf-8 -*- """ A list of Mexican states for use as `choices` in a formfield. This exists in this standalone file so that it's only imported into memory when explicitly needed. """ from django.utils.translation import ugettext_lazy as _ # All 31 states, plus the `Distrito Federal`. STATE_CHOICES = ( ...