content string |
|---|
# -*- coding: utf-8 -*-
from django.conf import settings
if settings.OSCAR_DELETE_IMAGE_FILES:
from oscar.core.loading import get_model
from django.db import models
from django.db.models.signals import post_delete
from sorl import thumbnail
from sorl.thumbnail.helpers import ThumbnailError
... |
'''
.. module:: skrf.calibration.calibrationSet
================================================================
calibrationSet (:mod:`skrf.calibration.calibrationSet`)
================================================================
Contains the CalibrationSet class, and supporting functions
CalibrationSet Class
==... |
from spack import *
class Nghttp2(AutotoolsPackage):
"""nghttp2 is an implementation of HTTP/2 and its header compression
algorithm HPACK in C."""
homepage = "https://nghttp2.org/"
url = "https://github.com/nghttp2/nghttp2/releases/download/v1.26.0/nghttp2-1.26.0.tar.gz"
version('1.26.0'... |
from __future__ import unicode_literals, absolute_import
import sys
import click
import cProfile
import StringIO
import pstats
import frappe
import frappe.utils
from functools import wraps
click.disable_unicode_literals_warning = True
def pass_context(f):
@wraps(f)
def _func(ctx, *args, **kwargs):
profile = ctx.o... |
from jsonrpc import ServiceProxy
import sys
import string
import getpass
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:8332")
e... |
# -*- coding: utf-8 -*-
tests = r"""
>>> from django.forms import *
>>> from django.core.files.uploadedfile import SimpleUploadedFile
# CharField ###################################################################
>>> e = {'required': 'REQUIRED'}
>>> e['min_length'] = 'LENGTH %(length)s, MIN LENGTH %(min)s'
>>> e['ma... |
from TTransport import *
from cStringIO import StringIO
import urlparse
import httplib
import warnings
class THttpClient(TTransportBase):
"""Http implementation of TTransport base."""
def __init__(self, uri_or_host, port=None, path=None):
"""THttpClient supports two different types constructor parameters.
... |
"""The test for the random number sensor platform."""
import unittest
from homeassistant.bootstrap import setup_component
from tests.common import get_test_home_assistant
class TestRandomSensor(unittest.TestCase):
"""Test the Random number sensor."""
def setup_method(self, method):
"""Set up things... |
"""
TODO
"""
from openedx.core.lib.block_structure.transformer import BlockStructureTransformer
from .block_depth import BlockDepthTransformer
class DescendantList(object):
"""
Contain
"""
def __init__(self):
self.items = []
class BlockNavigationTransformer(BlockStructureTransformer):
""... |
import datetime
import requests
from . loader_utils import (
source_to_records
)
from zipline.data.treasuries import (
treasury_mappings, get_treasury_date, get_treasury_rate
)
_CURVE_MAPPINGS = {
'date': (get_treasury_date, "Date"),
'1month': (get_treasury_rate, "V39063"),
'3month': (get_treasu... |
"""Implementation of the public test library logging API.
This is exposed via :py:mod:`robot.api.logger`. Implementation must reside
here to avoid cyclic imports.
"""
import sys
import threading
from robot.errors import DataError
from robot.utils import unic, console_encode
from .logger import LOGGER
from .loggerhe... |
"""Implementation of platform-specific functionality.
For each function or class described in `tornado.platform.interface`,
the appropriate platform-specific implementation exists in this module.
Most code that needs access to this functionality should do e.g.::
from tornado.platform.auto import set_close_exec
""... |
from portage import os
from portage.util._ctypes import find_library, LoadLibrary
from portage.util._async.ForkProcess import ForkProcess
class SyncfsProcess(ForkProcess):
"""
Isolate ctypes usage in a subprocess, in order to avoid
potential problems with stale cached libraries as
described in bug #448858, comment... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from .youtube import YoutubeIE
class WimpIE(InfoExtractor):
_VALID_URL = r'http://(?:www\.)?wimp\.com/([^/]+)/'
_TESTS = [{
'url': 'http://www.wimp.com/maruexhausted/',
'md5': 'f1acced123ecb28d9bb79f2479f2b6a... |
"""Implementation module for socket operations.
See the socket module for documentation."""
AF_APPLETALK = 16
AF_DECnet = 12
AF_INET = 2
AF_INET6 = 23
AF_IPX = 6
AF_IRDA = 26
AF_SNA = 11
AF_UNSPEC = 0
AI_ADDRCONFIG = 1024
AI_ALL = 256
AI_CANONNAME = 2
AI_NUMERICHOST = 4
AI_NUMERICSERV = 8
AI_PASSIVE = 1... |
# coding=utf-8
"""
Test Suite for InaSAFE.
Contact : etienne at kartoza dot com
.. note:: 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 2 of the License, or
(at your ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import filer.fields.file
import filer.fields.image
import cms.models.fields
class Migration(migrations.Migration):
dependencies = [
('cms', '0003_auto_20140926_2347')... |
from __future__ import division, absolute_import, print_function
import sys
import collections
import pickle
from os import path
import numpy as np
from numpy.compat import asbytes
from numpy.testing import (
TestCase, run_module_suite, assert_, assert_equal, assert_array_equal,
assert_array_almost_equal, ass... |
"""A collection of modules for iterating through different kinds of
tree, generating tokens identical to those produced by the tokenizer
module.
To create a tree walker for a new type of tree, you need to do
implement a tree walker object (called TreeWalker by convention) that
implements a 'serialize' method taking a ... |
"""
Enrollment operations for use by instructor APIs.
Does not include any access control, be sure to check access before calling.
"""
import json
from django.contrib.auth.models import User
from django.conf import settings
from django.core.urlresolvers import reverse
from django.core.mail import send_mail
from stud... |
# -*- coding: utf-8 -*-
import pytest
from time import sleep
from six.moves.urllib.parse import urlparse
from cfme.base.ui import ServerView
from cfme.common.vm import VM
from cfme.infrastructure.provider import wait_for_a_provider
from cfme.utils.appliance import provision_appliance
from cfme.utils.appliance.impleme... |
from django.core.urlresolvers import reverse
from django import http
from mox import IsA # noqa
from openstack_dashboard import api
from openstack_dashboard.test import helpers as test
INDEX_URL = reverse('horizon:project:data_processing.jobs:index')
DETAILS_URL = reverse(
'horizon:project:data_processing.jobs... |
import sys
import argparse
import ConfigParser
from provision_dns import DnsProvisioner
from requests.exceptions import ConnectionError
class DelVirtualDns(object):
def __init__(self, args_str = None):
self._args = None
if not args_str:
args_str = ' '.join(sys.argv[1:])
self._p... |
from __future__ import (absolute_import, division, print_function)
import json
from ansible.compat.tests.mock import patch
from ansible.compat.tests import unittest
from ansible.module_utils.network.nso import nso
MODULE_PREFIX_MAP = '''
{
"ansible-nso": "an",
"tailf-ncs": "ncs"
}
'''
SCHEMA_DATA = {
'/an... |
import time
from openerp.osv import fields
from openerp.osv import osv
from openerp.tools.translate import _
from openerp import SUPERUSER_ID
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, float_compare
class StockMove(osv.osv):
_inherit = 'stock.move'
_columns = {
'production_id': fields.... |
"""
Copyright (c) 2015 Michael Bright and Bamboo HR LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... |
"""
An implementation of a key manager that returns a single key in response to
all invocations of get_key.
"""
from nova import exception
from nova.keymgr import mock_key_mgr
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
LOG = logging.getLogger(__name__)
class ... |
from flask import Flask, jsonify, make_response, abort,request, send_from_directory, redirect, render_template, Response
import db, datetime, csv
from time import time
from io import StringIO
DEBUG = False
#path to file to be displayed on index page
INDEX = '/opt/index.html'
app = Flask(__name__, static_url_path='')
... |
import hashlib
from storage import Storage
from .methods import to_utf8
class SearchHistory(Storage):
def __init__(self, filename, max_items=10):
Storage.__init__(self, filename, max_item_count=max_items)
pass
def is_empty(self):
return self._is_empty()
def list(self):
r... |
import numpy as np
from numba import cuda, float32, void
from numba.cuda.testing import unittest, CUDATestCase
def generate_input(n):
A = np.array(np.arange(n * n).reshape(n, n), dtype=np.float32)
B = np.array(np.arange(n) + 0, dtype=A.dtype)
return A, B
class TestCudaNonDet(CUDATestCase):
def test_... |
import pytest
from selenium.webdriver.edge.options import Options
@pytest.fixture
def options():
return Options()
def test_raises_exception_with_invalid_page_load_strategy(options):
with pytest.raises(ValueError):
options.page_load_strategy = 'never'
def test_set_page_load_strategy(options):
... |
"""Add a setuptools command that runs a helper-based application."""
try:
from setuptools import Command
except ImportError:
from distutils.core import Command
try:
from functools import reduce
except ImportError:
pass # use the builtin for py 2.x
from . import parser
from . import platform
class R... |
# -*- coding: utf-8 -*-
"""
flask.config
~~~~~~~~~~~~
Implements the configuration related objects.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import imp
import os
import errno
from werkzeug.utils import import_string
from ._compat import string_type... |
# -*- coding: utf-8 -*-
'''
Management of keyboard layouts
==============================
The keyboard layout can be managed for the system:
.. code-block:: yaml
us:
keyboard.system
Or it can be managed for XOrg:
.. code-block:: yaml
us:
keyboard.xorg
'''
def __virtual__():
'''
Only ... |
# Generated from 'CarbonEvents.h'
def FOUR_CHAR_CODE(x): return x
def FOUR_CHAR_CODE(x): return x
false = 0
true = 1
keyAEEventClass = FOUR_CHAR_CODE('evcl')
keyAEEventID = FOUR_CHAR_CODE('evti')
eventAlreadyPostedErr = -9860
eventTargetBusyErr = -9861
eventClassInvalidErr = -9862
eventClassIncorrectErr = -9864
eventH... |
"""
Python tests for the Survey models
"""
from collections import OrderedDict
from django.contrib.auth.models import User
from django.test.client import Client
from survey.models import SurveyForm
from survey.utils import is_survey_required_for_course, is_survey_required_and_unanswered
from xmodule.modulestore.test... |
import json
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
from django.core.serializers.json import DjangoJSONEncoder
from django.test.client import CONTENT_TYPE_RE
fro... |
import sys
import unittest
import pywintypes
import time
from pywin32_testutil import str2bytes, ob2memory
import datetime
import operator
class TestCase(unittest.TestCase):
def testPyTimeFormat(self):
struct_current = time.localtime()
pytime_current = pywintypes.Time(struct_current)
# try ... |
from nova.api.validation import parameter_types
change_password = {
'type': 'object',
'properties': {
'changePassword': {
'type': 'object',
'properties': {
'adminPass': parameter_types.admin_password,
},
'required': ['adminPass'],
... |
import chainer
from chainer.backends import cuda
from chainer import distribution
from chainer.functions.array import broadcast
from chainer.functions.array import where
from chainer.functions.math import digamma
from chainer.functions.math import exponential
from chainer.functions.math import lgamma
class Gamma(dist... |
#! /usr/bin/env python
"""Mirror a remote ftp subtree into a local directory tree.
usage: ftpmirror [-v] [-q] [-i] [-m] [-n] [-r] [-s pat]
[-l username [-p passwd [-a account]]]
hostname[:port] [remotedir [localdir]]
-v: verbose
-q: quiet
-i: interactive mode
-m: macintosh ... |
import pytest
pytest_plugins = [
"jupyter_server.pytest_plugin",
"jupyterlab_server.pytest_plugin",
"jupyterlab.pytest_plugin"
]
def pytest_addoption(parser):
"""
Adds flags for py.test.
This is called by the pytest API
"""
group = parser.getgroup("general")
group.addoption('--q... |
"""Regular expression based JavaScript matcher classes."""
__author__ = ('<EMAIL> (Robert Walker)',
'<EMAIL> (Andy Perelson)')
from closure_linter.common import position
from closure_linter.common import tokens
# Shorthand
Token = tokens.Token
Position = position.Position
class Matcher(object):
"""... |
import unittest
from tempfile import mkdtemp
from os.path import join
from shutil import rmtree
from json import dumps, loads
import copy
from .settings import SPEC_DATA_DIR
from slyd.gitstorage.repoman import Repoman
def j(json):
return dumps(json, sort_keys=True, indent=4)
class RepomanTest(unittest.TestCas... |
import json
import requests
def get_token():
client_id = "..."
client_secret = "..."
auth = requests.auth.HTTPBasicAuth(client_id, client_secret)
resp = requests.post('https://stepik.org/oauth2/token/',
data={'grant_type': 'client_credentials'},
... |
from __future__ import unicode_literals
import logging
import sys
import types
import warnings
from django import http
from django.conf import settings
from django.core import signals, urlresolvers
from django.core.exceptions import (
MiddlewareNotUsed, PermissionDenied, SuspiciousOperation,
)
from django.db impo... |
import kurve
import area
from nc.nc import *
import math
# roughing_funcs.py- intended to be used for lathe roughing
# adapted from area_funcs.py and turning.py
# and possibly roughing a profile-approaching the part from the side
# some globals, to save passing variables as parameters too much
area_for_feed_po... |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2017 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the... |
import json
from django.db.models import Count
from django.http import HttpResponse
from django.views.generic import TemplateView
from candidates.models import Ballot
from elections.mixins import ElectionMixin
from elections.models import Election
from parties.models import Party
from popolo.models import Membership
... |
"""
Wrapper service handler for all OWS services (/service?).
"""
class OWSServer(object):
"""
Wraps all OWS services (/service?, /ows?, /wms?, /wmts?) and dispatches requests
based on the ``services`` query argument.
"""
def __init__(self, services):
self.names = ['service', 'ows']
... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
class account_open_closed_fiscalyear(osv.osv_memory):
_name = "account.open.closed.fiscalyear"
_description = "Choose Fiscal Year"
_columns = {
'fyear_id': fields.many2one('account.fiscalyear', \
... |
"""Functions for computing moving statistics."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import init_ops
from tensorflow.python.ops imp... |
import logging
import unittest
from unittest import mock
from flask_appbuilder import SQLA, Model, expose, has_access
from flask_appbuilder.security.sqla import models as sqla_models
from flask_appbuilder.views import BaseView, ModelView
from sqlalchemy import Column, Date, Float, Integer, String
from airflow import ... |
"""Launches Android Virtual Devices with a set configuration for testing Chrome.
The script will launch a specified number of Android Virtual Devices (AVD's).
"""
import install_emulator_deps
import logging
import optparse
import os
import re
import sys
from pylib import cmd_helper
from pylib import constants
from ... |
#!/usr/bin/env python3.5
'''
Automate the Boring Stuff with Python
generic testing for chapter 4 projects
Jack Hayhurst
'''
from io import StringIO
import unittest
from unittest.mock import patch
import picture_grid
class TestPictureGrid(unittest.TestCase):
'''tests the picture_grid.py script'''
def test_pi... |
import simplejson
import openerp
import openerp.addons.web.http as http
from openerp.addons.web.http import request
import openerp.addons.web.controllers.main as webmain
import json
class meeting_invitation(http.Controller):
@http.route('/calendar/meeting/accept', type='http', auth="calendar")
def accept(sel... |
"""SCons.Tool.gcc
Tool-specific initialization for MinGW (http://www.mingw.org/)
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
See also http://www.scons.org/wiki/CrossCompilingMingw
"""
#
# Copyright (c) 2001,... |
import itertools
from testtools import matchers
from pbr.tests import base
from pbr import version
from_pip_string = version.SemanticVersion.from_pip_string
class TestSemanticVersion(base.BaseTestCase):
def test_ordering(self):
ordered_versions = [
"1.2.3.dev6",
"1.2.3.dev7",
... |
from Tkinter import *
class WidgetRedirector:
"""Support for redirecting arbitrary widget subcommands.
Some Tk operations don't normally pass through Tkinter. For example, if a
character is inserted into a Text widget by pressing a key, a default Tk
binding to the widget's 'insert' operation is acti... |
"""
Various useful constants and conversion formulae
Modules
-------
.. autosummary::
:toctree: generated/
codata - CODATA Recommended Values of Fundamental Physical Const (2006)
constants - Collection of physical constants and conversion factors
Functions
---------
.. autosummary::
:toctree: generated... |
from datetime import date, datetime, time
from dateutil.relativedelta import relativedelta
from flask import session
from sqlalchemy.orm import joinedload, load_only
from indico.core.db import db
from indico.core.db.sqlalchemy.principals import PrincipalType
from indico.core.db.sqlalchemy.util.queries import db_dates... |
"""Support for Radarr."""
from datetime import datetime, timedelta
import logging
import time
from pytz import timezone
import requests
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_API_KEY,
CONF_HOST,
CONF_MONITORED_CONDITIONS,... |
"""
Command based UI for the obfuscator.
"""
# OAT - Obfuscation and Analysis Tool
# Copyright (C) 2011 Andy Gurden
#
# This file is part of OAT.
#
# OAT 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 Softwar... |
import six
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova import quota
QUOTAS = quota.QUOTAS
XMLNS = "http://docs.openstack.org/compute/ext/used_limits/api/v1.1"
ALIAS = "os-used-limits"
authorize = extensions.soft_extension_authorizer('compute', 'used_limits')
authorize_fo... |
from openerp.osv import fields, osv
class project_compute_tasks(osv.osv_memory):
_name = 'project.compute.tasks'
_description = 'Project Compute Tasks'
_columns = {
'project_id': fields.many2one('project.project', 'Project', required=True)
}
def compute_date(self, cr, uid, ids, context=Non... |
"""HTML character entity references."""
# maps the HTML entity name to the Unicode codepoint
name2codepoint = {
'AElig': 0x00c6, # latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1
'Aacute': 0x00c1, # latin capital letter A with acute, U+00C1 ISOlat1
'Acirc': 0x00c2, # latin... |
import unittest
from django.utils import text
class TestUtilsText(unittest.TestCase):
def test_truncate_words(self):
self.assertEqual(u'The quick brown fox jumped over the lazy dog.',
text.truncate_words(u'The quick brown fox jumped over the lazy dog.', 10))
self.assertEqual(u'The qui... |
"""TypeinViewer class.
The TypeinViewer is what you see at the lower right of the main Pynche
widget. It contains three text entry fields, one each for red, green, blue.
Input into these windows is highly constrained; it only allows you to enter
values that are legal for a color axis. This usually means 0-255 for de... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
USER_AGENT = 'ansible-ipinfoio-module/0.0.1'
class IpinfoioFacts(object):
def __init__(self, module):
self.url = 'https://ipinfo.io/json'
self.timeout = module.params... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from actstream.compat import user_model_label
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Follow'
db.create_table('actstream_follow', (
... |
import logging
import threading
import time
from spreads.config import OptionTemplate
from spreads.plugin import HookPlugin, TriggerHooksMixin
logger = logging.getLogger('spreadsplug.intervaltrigger')
class IntervalTrigger(HookPlugin, TriggerHooksMixin):
__name__ = 'intervaltrigger'
_loop_thread = None
... |
"""
Represents an EC2 Instance
"""
import boto
from boto.ec2.ec2object import EC2Object, TaggedEC2Object
from boto.resultset import ResultSet
from boto.ec2.address import Address
from boto.ec2.blockdevicemapping import BlockDeviceMapping
from boto.ec2.image import ProductCodes
from boto.ec2.networkinterface import Netw... |
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
from hikes.models import Hike
from django.shortcuts import render_to_response, render
from django.contrib.gis import forms
from django.contrib import auth
from django.contrib.auth.forms import UserCreationForm
from django.core.urlresolvers... |
# -*- coding: utf-8 -*-
from nose.tools import * # PEP8 asserts
from modularodm.exceptions import ValidationError
from tests.base import OsfTestCase
from website.addons.forward.tests.factories import ForwardSettingsFactory
class TestSettingsValidation(OsfTestCase):
def setUp(self):
super(TestSettings... |
from sources import *
from content import *
from utils import *
################################################################
##
## FORMATTER CLASS
##
class Formatter:
def __init__( self, processor ):
self.processor = processor
self.identifiers = {}
self.chapters = processor.... |
import socket
import codecs
import re
from publicsuffix import PublicSuffixList
import datetime
import pprint
import sys
#Seed the whois server map with special cases that aren't in our whois-servers.txt list nor returned by iana
#Based on http://www.nirsoft.net/whois-servers.txt
FIELD_SEPERATOR = ', '
RATE_LIMITTED_... |
from __future__ import division
import ldscore.sumstats as s
import ldscore.parse as ps
import unittest
import numpy as np
import pandas as pd
from pandas.util.testing import assert_series_equal, assert_frame_equal
from nose.tools import *
from numpy.testing import assert_array_equal, assert_array_almost_equal, assert_... |
from gen import *
##########
# shared #
##########
flow_var[0] = """
(declare-fun tau () Real)
"""
flow_dec[0] = """
(define-ode flow_1 ((= d/dt[tau] 1)))
"""
state_dec[0] = """
(declare-fun time_{0} () Real)
(declare-fun tau_{0}_0 () Real)
(declare-fun tau_{0}_t () Real)
"""
state_val[0] = """
(assert (<= 0 t... |
from robot.utils import is_list_like
from .filesetter import VariableFileSetter
from .finders import VariableFinder
from .replacer import VariableReplacer
from .store import VariableStore
from .tablesetter import VariableTableSetter
class Variables(object):
"""Represents a set of variables.
Contains methods... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ansible import constants as C
from ansible.plugins.action import ActionBase
class ActionModule(ActionBase):
TRANSFERS_FILES = True
def run(self, tmp=None, task_vars=None):
''' handler for file tran... |
import uuid
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
# Basic tests
@python_2_unicode_compatible
class Author(models.... |
import os
import shutil
import tempfile
import unittest
from pyspark.testing.utils import ReusedPySparkTestCase, SPARK_HOME
class InputFormatTests(ReusedPySparkTestCase):
@classmethod
def setUpClass(cls):
ReusedPySparkTestCase.setUpClass()
cls.tempdir = tempfile.NamedTemporaryFile(delete=Fal... |
"""
GBDX Catalog Search Helper Functions.
This set of functions is used for breaking up a large AOI into smaller AOIs to search, because the catalog API
can only handle 2 square degrees at a time.
"""
from builtins import zip
from builtins import range
from pygeoif import geometry
import json
def point_in_poly(x,y... |
# -*- encoding: utf-8 -*-
import unittest2
from openerp.tests.common import TransactionCase
from .. import models
ID_FIELD = {
'id': 'id',
'name': 'id',
'string': "External ID",
'required': False,
'fields': [],
}
def make_field(name='value', string='unknown', required=False, fields=[]):
retur... |
from copy import deepcopy
import numpy as np
from vectortween.Animation import Animation
from vectortween.Mapping import Mapping
from vectortween.Tween import Tween
def normalize(x):
return x / sum(x)
class SequentialAnimation(Animation):
def __init__(self, list_of_animations=None, timeweight=None, repeat... |
from configparser import ConfigParser
import getpass
import os
import shutil
import xml.etree.ElementTree as etree
import xmlrpc.client
import zipfile
from paver.easy import (call_task, cmdopts, error, info, options, path,
sh, task, Bunch)
from owslib.csw import CatalogueServiceWeb # spellok
... |
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.http import urlencode
from core.forms import SearchForm
from core.models import Translation
from django.db.models import Count
from django.views.generic import ListView
from django.views.generic import ListVie... |
#!/usr/bin/env python
import re, string, sys
with open("../stop_words.txt") as f:
stops = set(f.read().split(",")+list(string.ascii_lowercase))
# The "database"
data = {}
# Internal functions of the "server"-side application
def error_state():
return "Something wrong", ["get", "default", None]
# The "server"... |
import re
import salt.exceptions
import salt.utils.ipaddr as ipaddr
def ensure(name, cidr, mtu=1460):
'''
Ensure that a bridge (named <name>) is configured for contianers.
Under the covers we will make sure that
- The bridge exists
- The MTU is set
- The correct network is added to the ... |
# -*- coding: utf-8 -*-
"""
flask.testsuite.reqctx
~~~~~~~~~~~~~~~~~~~~~~
Tests the request context.
:copyright: (c) 2012 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import flask
import unittest
try:
from greenlet import greenlet
except ImportError:
greenlet = None... |
"""
This is the "basic" text-mode user interface class.
"""
#############################################################################
LICENSE = """\
This file is part of pagekite.py.
Copyright 2010-2013, the Beanstalks Project ehf. and Bjarni Runar Einarsson
This program is free software: you can redistribute it a... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import time
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = r'''
---
module: vmware_host_package_facts
short_description: Gathers facts about available packages on... |
"""SavedModel main op.
Builds a main op that defines the sequence of ops to be run as part of the
SavedModel load/restore operations.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
from tensorflow.python.ops... |
"""Generates out a Closure deps.js file given a list of JavaScript sources.
Paths can be specified as arguments or (more commonly) specifying trees
with the flags (call with --help for descriptions).
Usage: depswriter.py [path/to/js1.js [path/to/js2.js] ...]
"""
import logging
import optparse
import os
import posixp... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django import VERSION as DJANGO_VERSION
def get_operations():
"""
This will break things if you upgrade Django to 1.8 having already applied this migration in 1.7.
Since this is for a demo site i... |
import tensorflow as tf
from tensorflow.python.framework import ops
import roi_pooling_op
import pdb
@tf.RegisterShape("RoiPool")
def _roi_pool_shape(op):
"""Shape function for the RoiPool op.
"""
dims_data = op.inputs[0].get_shape().as_list()
channels = dims_data[3]
dims_rois = op.inputs[1].get_shape().as... |
# -*- coding: utf-8 -*
import getopt
import os
import sys
from east import applications
from east import consts
from east import formatting
from east.synonyms import synonyms
from east import relevance
from east import utils
def main():
args = sys.argv[1:]
opts, args = getopt.getopt(args, "s:a:w:v:l:f:c:r:p... |
import os
import sys
import click
import pathlib
import logging
from subprocess import Popen, PIPE, STDOUT, CalledProcessError
from utils.cert import openssl_installed
from utils.misc import get_realpath
gen_tls_script = pathlib.Path(__file__).parent.parent.joinpath('scripts/gencert.sh').absolute()
@click.command()
... |
"""Test Mikrotik setup process."""
from unittest.mock import AsyncMock, Mock, patch
from homeassistant.components import mikrotik
from homeassistant.setup import async_setup_component
from . import MOCK_DATA
from tests.common import MockConfigEntry
async def test_setup_with_no_config(hass):
"""Test that we do ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.