content
stringlengths
4
20k
from django.db.models.sql.aggregates import * from django.contrib.gis.db.models.fields import GeometryField from django.contrib.gis.db.models.sql.conversion import GeomField class GeoAggregate(Aggregate): # Default SQL template for spatial aggregates. sql_template = '%(function)s(%(field)s)' # Conversion ...
categories = ["conditional_move", "move", "stack_operations", "xchg"] microcode = "" for category in categories: exec "import %s as cat" % category microcode += cat.microcode
import argparse import sys import litedextree from _settings import * import dex_parser import hashlib import zipfile import json class LibRadarLite(object): """ LibRadar """ def __init__(self, apk_path): """ Init LibRadar instance with apk_path as a basestring. Create a Tree f...
from __future__ import absolute_import import logging import operator import os import tempfile import shutil import warnings try: import wheel except ImportError: wheel = None from pip.req import RequirementSet from pip.basecommand import RequirementCommand from pip.locations import virtualenv_no_global, dis...
#! /usr/bin/python # See README.txt for information and build instructions. import addressbook_pb2 import sys # Iterates though all people in the AddressBook and prints info about them. def ListPeople(address_book): for person in address_book.person: print "Person ID:", person.id print " Name:", person.na...
"""PEF Results""" class PEFInfoResult(object): """Object to hold PEF info results""" pass class PEFPolicyResult(object): """Object to hold PEF policy results""" pass class PEFStatusResult(object): """Object to hold PEF status results""" pass class PEFListResult(object): """Object to h...
from rope.base import ast, evaluate, builtins, pyobjects from rope.refactor import patchedast, occurrences class Wildcard(object): def get_name(self): """Return the name of this wildcard""" def matches(self, suspect, arg): """Return `True` if `suspect` matches this wildcard""" class Suspec...
'''Module containing NeuroM specific exceptions''' class NeuroMError(Exception): '''Base class for all NeuroM exceptions''' pass class RawDataError(NeuroMError): '''Exception class for raw data errors''' pass class ConfigError(NeuroMError): '''Exception class for configuration data in apps err...
import curses class GuiObject(object): """Abstract GUI object class that all other GUI objects should inherit from.""" def set_parameters(self, songinfo, length, width, color_pair, y, x): self.song_info = songinfo self.window_width = width self.window_length = length self.y = y...
#!/usr/bin/python # $Id:$ import ctypes lib = ctypes.windll.wintab32 LONG = ctypes.c_long BOOL = ctypes.c_int UINT = ctypes.c_uint WORD = ctypes.c_uint16 DWORD = ctypes.c_uint32 WCHAR = ctypes.c_wchar FIX32 = DWORD WTPKT = DWORD LCNAMELEN = 40 class AXIS(ctypes.Structure): _fields_ = ( ...
"""## Placeholders TensorFlow provides a placeholder operation that must be fed with data on execution. For more info, see the section on [Feeding data](../../how_tos/reading_data/index.md#feeding). @@placeholder @@placeholder_with_default For feeding `SparseTensor`s which are composite type, there is a convenience...
""" Example: Enumerate Hidden Markov Model ====================================== This example is ported from [1], which shows how to marginalize out discrete model variables in Pyro. This combines MCMC with a variable elimination algorithm, where we use enumeration to exactly marginalize out some variables from the ...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.plugins.action import ActionBase from ansible.utils.vars import merge_hash class ActionModule(ActionBase): def run(self, tmp=None, task_vars=None): # individual modules might disagree but as the generic...
from __future__ import unicode_literals import frappe from frappe.utils import cint, now, get_gravatar, format_datetime, now_datetime from frappe import throw, msgprint, _ from frappe.auth import _update_password from frappe.desk.notifications import clear_notifications from frappe.utils.user import get_system_managers...
from xml.dom.minidom import parseString from django.contrib.auth.decorators import login_required, permission_required from django.core import mail from django.forms import fields from django.forms.forms import Form, ValidationError from django.forms.formsets import BaseFormSet, formset_factory from django.http import...
# -*- coding: utf-8 -*- import logging import commands import simplejson import os import os.path import openerp import time import random import subprocess import simplejson import werkzeug import werkzeug.wrappers _logger = logging.getLogger(__name__) from openerp import http from openerp.http import request # dr...
__author__ = '<EMAIL> (Jeff Scudder)' import unittest try: from xml.etree import cElementTree as ElementTree except ImportError: try: import cElementTree as ElementTree except ImportError: try: from xml.etree import ElementTree except ImportError: from elementtree import ElementTree impo...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.db.models.deletion from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('monitors...
"""Utilities for the Django web framework Provides Django views and helpers the make using the OAuth2 web server flow easier. It includes an ``oauth_required`` decorator to automatically ensure that user credentials are available, and an ``oauth_enabled`` decorator to check if the user has authorized, and helper short...
# -*- coding: utf-8 -*- """ Copyright (C) 2013 TopCoder Inc., All Rights Reserved. This is module that represents all the externals. Currently it is mock implementation. @author: TCSASSEMBLER @version: 1.0 """ from hfppnetwork.sms.models import BeneficiaryClaimData, CarrierClaimData,\ InpatientClaimData, Outpati...
#!/usr/bin/env python # Perform Path Similarity Analysis on a submatrix """Perform Path Similarity Analysis (PSA) using MDAnalysis.analysis.psa. Provide all trajectories and topology files in a JSON input file (two lists, one with topology files, the other with trajectory files) or on the command line. There *must* b...
""" TASK You are given a set A and N numbers of other sets. These N sets have to perform some specific mutation operations to set A. Your task is to execute those operations and print the sum of elements of set A. Input Format First line contains, number of elements in set A. Second line contains, space separated li...
""" This module implements the Response class which is used to represent HTTP responses in Scrapy. See documentation in docs/topics/request-response.rst """ from six.moves.urllib.parse import urljoin from scrapy.http.headers import Headers from scrapy.utils.trackref import object_ref from scrapy.http.common import ob...
import numpy as np from numpy.testing import assert_array_equal from skimage.segmentation import find_boundaries, mark_boundaries def test_find_boundaries(): image = np.zeros((10, 10)) image[2:7, 2:7] = 1 ref = np.array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ...
"""Text wrapping and filling. """ # Copyright (C) 1999-2001 Gregory P. Ward. # Copyright (C) 2002, 2003 Python Software Foundation. # Written by Greg Ward <<EMAIL>> __revision__ = "$Id$" import string, re # Do the right thing with boolean values for all known Python versions # (so this module can be copied to proje...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'network'} import re from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.network.nxos.nxos import get_config, load_config, run_commands from ansible.module_utils.net...
# This module implements the RFCs 3490 (IDNA) and 3491 (Nameprep) import stringprep, re, codecs from unicodedata import ucd_3_2_0 as unicodedata # IDNA section 3.1 dots = re.compile(u"[\u002E\u3002\uFF0E\uFF61]") # IDNA section 5 ace_prefix = "xn--" uace_prefix = unicode(ace_prefix, "ascii") # This assumes query st...
# -*- coding: utf-8 -*- # FIXME color_index param """ Display bitcoin using bitcoincharts.com. Configuration parameters: cache_timeout: refresh interval for this module. A message from the site: Don't query more often than once every 15 minutes (default 900) color_index: Index of the market res...
__author__ = "Cyril Jaquier" __copyright__ = "Copyright (c) 2004 Cyril Jaquier" __license__ = "GPL" import re, time from abc import abstractmethod from .strptime import reGroupDictStrptime, timeRE, getTimePatternRE from ..helpers import getLogger logSys = getLogger(__name__) # check already grouped contains "(", bu...
class ModuleDocFragment(object): # Standard files documentation fragment DOCUMENTATION = r''' options: provider: description: - B(Deprecated) - "Starting with Ansible 2.5 we recommend using C(connection: network_cli)." - For more information please see the L(Network Guide, ../network/ge...
from trezorlib import btc from .common import TrezorTest class TestMsgVerifymessage(TrezorTest): def test_message_long(self): self.setup_mnemonic_nopin_nopassphrase() ret = btc.verify_message( self.client, "Bitcoin", "14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e", ...
import random from androconf import error import jvm class Automaton : def __init__(self, _analysis) : self.__analysis = _analysis try : from networkx import DiGraph from networkx import draw_graphviz, write_dot except ImportError : error("module networ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from colorstr import color_str # redis包要先安装 try: import redis except ImportError as err: if "No module named" in str(err): print(color_str("this script base on redis, I will install it first, please wait a moment...", "purple")) import os result = os.system("yum...
import logging import re import urllib import urllib2 from django.conf import settings from django.template import Context from django.template.loader import get_template from owslib.csw import CatalogueServiceWeb, namespaces from owslib.util import http_post from urlparse import urlparse from lxml import etree from ge...
"""Feature View: show spikes as 2D points in feature space.""" # ----------------------------------------------------------------------------- # Imports # ----------------------------------------------------------------------------- import time import numpy as np import numpy.random as rdn from qtools import QtGui, ...
class RabbitMqPlugins(object): def __init__(self, module): self.module = module if module.params['prefix']: self._rabbitmq_plugins = module.params['prefix'] + "/sbin/rabbitmq-plugins" else: self._rabbitmq_plugins = module.get_bin_path('rabbitmq-plugins', True) d...
import tablib from desktop.lib.export_csvxls import create_generator, make_response from nose.tools import assert_equal def content_generator(header, data): yield header, data def test_export_csv(): header = ["x", "y"] data = [ ["1", "2"], ["3", "4"], ["5,6", "7"], [None, None] ] # Check CSV generator = ...
""" encrypt_aws_key v0.01 genetic trade simulator Copyright 2011 Brian Monkaba This file is part of ga-bitbot. ga-bitbot 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 Lice...
import smtplib from email.mime.multipart import MIMEMultipart from email.mime.application import MIMEApplication from email.mime.text import MIMEText from email import charset from indico.core.config import Config from indico.util.string import to_unicode from MaKaC.errors import MaKaCError from MaKaC.i18n import _ f...
try: import hashlib md5er = hashlib.md5 except ImportError, e: import md5 md5er = md5.new import optparse import os from os.path import abspath, join, dirname, basename, exists import pickle import re import sys import subprocess import multiprocessing from subprocess import PIPE # Disabled LINT rules and re...
#!/usr/bin/env python # # Robin Shields-Cutler # August 2016 # takes standard blast output TSV (outfmt 6-- *.b6 or *.txt, etc) and stores entries in dictionary, # then writes to dataframe and exports as CSV usage = 'blastp_to_matrix.py -i BLASTOUT.b6 -s SCORE_METHOD -t THRESHOLD -o OUTFILE.csv' import argparse import...
from __future__ import unicode_literals # app configuration # database config db_name = '%(db_name)s' db_password = '%(db_password)s' # user attachments stored in files_path = 'public/files' public_path = 'public' # max file attachment size (default 1MB) max_file_size = 1000000 # max email size in bytes max_email_s...
"""Tests to ensure that the lxml tree builder generates good trees.""" import re import warnings try: from bs4.builder import LXMLTreeBuilder, LXMLTreeBuilderForXML LXML_PRESENT = True except ImportError, e: LXML_PRESENT = False from bs4 import ( BeautifulSoup, BeautifulStoneSoup, ) from bs4....
{ 'name': 'Account Move Line XLS export', 'version': '0.6', 'license': 'AGPL-3', 'author': 'Noviat', 'category': 'Accounting & Finance', 'description': """ Journal Items Excel Export ========================== This module adds a button on the journal items ('account.move.line') list view in ord...
# coding=utf-8 from global_test_case import GlobalTestCase as TestCase, popit_load_data from ..user_section.forms import WriteItInstanceCreateFormPopitUrl, SimpleInstanceCreateFormPopitUrl from django.contrib.auth.models import User from django.conf import settings from mock import patch class InstanceCreateFormTestC...
import unittest from .bendcode import match_string, match_int, match_dict, match_list, decode, encode from .exceptions import MalformedBencodeError class TestDecoder(unittest.TestCase): # Test normal int def test_int(self): self.assertEqual(match_int('i200e')[0], 200) # Test empty integer # It is the same as ze...
# test waiting within "async for" aiter/anext functions import sys if sys.implementation.name == 'micropython': # uPy allows normal generators to be awaitables coroutine = lambda f: f else: import types coroutine = types.coroutine @coroutine def f(x): print('f start:', x) yield x + 1 yield...
#!/usr/bin/python # -*- coding: utf-8 -*- # import module snippets from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.pycompat24 import get_exception """ (c) 2016, Ben Doherty <<EMAIL>> Sponsored by Oomph, Inc. http://www.oomphinc.com This file is part of Ansible Ansible is free software...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} import re from ansible.module_utils.basic import AnsibleModule def parse_out(string): return re.sub("\s+", " ", string).strip() def has_changed(string): return "Nothin...
"""PyNEST Microcircuit: Network Parameters --------------------------------------------- A dictionary with base network and neuron parameters is enhanced with derived parameters. """ import numpy as np def get_exc_inh_matrix(val_exc, val_inh, num_pops): """ Creates a matrix for excitatory and inhibitory values...
""" Defines concrete class for cybersource Enrollment Report. """ from courseware.access import has_access import collections from django.conf import settings from django.utils.translation import ugettext as _ from courseware.courses import get_course_by_id from instructor.enrollment_report import BaseAbstractEnrollm...
#!/usr/bin/python # coding: utf8 from __future__ import absolute_import import logging import json from geocoder.base import OneResult, MultipleResultsQuery class ArcgisResult(OneResult): def __init__(self, json_content): # create safe shortcuts self._feature = json_content.get('feature', {}) ...
# -*- 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), ] operati...
"""Tests for polling measures.""" import datetime import aiohttp import pytest from homeassistant import config_entries from homeassistant.const import ATTR_UNIT_OF_MEASUREMENT, STATE_UNAVAILABLE from homeassistant.setup import async_setup_component import homeassistant.util.dt as dt_util from tests.common import Mo...
""" Interfaces for serializing Django objects. Usage:: from django.core import serializers json = serializers.serialize("json", some_queryset) objects = list(serializers.deserialize("json", json)) To add your own serializers, use the SERIALIZATION_MODULES setting:: SERIALIZATION_MODULES = { ...
""" Machine arithmetics - determine the parameters of the floating-point arithmetic system Author: Pearu Peterson, September 2003 """ from __future__ import division, absolute_import, print_function __all__ = ['MachAr'] from numpy.core.fromnumeric import any from numpy.core.numeric import errstate # Need to speed ...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['stableinterface'], 'supported_by': 'curated'} try: import boto3 from botocore.exceptions import ClientError HAS_BOTO3 = True except ImportError: HAS_BOTO3 = False from ansible.module_utils.basic import ...
"""Test the exposed ArrayProperty """ from __future__ import (absolute_import, division, print_function) import unittest from mantid.kernel import (FloatArrayProperty, StringArrayProperty, IntArrayProperty, Direction, NullValidator) from mantid.api import PythonAlgorithm import numpy as np i...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import traceback from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.ovirt import ( check_sdk, create_connection, get_dict_of_struct, o...
import commander.commands as commands __commander_module__ = True def remove_trailing_spaces(view, all=False): """Remove trailing spaces: format.remove-trailing-spaces [&lt;all&gt;] Remove trailing spaces in the selection. If there is no selection, trailing spaces are removed from the whole document. When the op...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('cms', '0003_auto_20140926_2347'), ] operations = [ migrations.CreateModel( name='TestPluginAlphaModel', ...
import asyncio import logging from collections import OrderedDict from .request import Request from .utils import generate_http_response log = logging.getLogger(__name__) class Application(dict): def __init__(self, default_encoding='utf-8', decode_headers=False, loop=None): super(Application, self).__in...
r"""Benchmarks for low-level eager execution primitives. To run CPU benchmarks: bazel run -c opt benchmarks_test -- --benchmarks=. To run GPU benchmarks: bazel run --config=cuda -c opt --copt="-mavx" benchmarks_test -- \ --benchmarks=. """ from __future__ import absolute_import from __future__ import division...
from .models import * from django.forms import ModelForm from django.contrib.gis import forms as geoforms # import floppyforms as geoforms class AlbumForm(ModelForm): class Meta: model = Album fields = ['title', 'description', 'privacy', 'cover', 'photos'] class PhotoForm(ModelForm): class Me...
# -*- coding: utf-8 -*- import os import re import subprocess from glob import glob from string import digits from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError, PasswordError from module.utils import fs_decode, fs_encode, save_join as fs_join def renice(pid, value): if value and o...
#!/usr/bin/env python """ This is a script to automatically tag repos on GitHub. Sample usage: * To create a tag: $ python tagz.py -r mozilla/fireplace -c create -t 2014.02.11 NOTE: annotated tags are used by default (-a). If you want lightweight tags, you can pass -l: $ python tagz.py -l -r mozilla/...
""" Module :mod:`openquake.hazardlib.scalerel.germany2018` implements :class:`GermanyMSR`. """ from openquake.hazardlib.scalerel.base import BaseMSRSigma class GermanyMSR(BaseMSRSigma): """ Implements a magnitude-area scaling relationship used within the 2018 national seismic hazard model of Germany. ...
import logging import logging.handlers import os class Singleton(type): _instances = dict() def __call__(cls, *args, **kwargs): if cls not in cls._instances: cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs) return cls._instances[cls] class _Logger(object): ...
"""Support for Transport NSW (AU) to query next leave event.""" from datetime import timedelta from TransportNSW import TransportNSW import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity from homeassistant.const import ( ATTR_ATTRIBUTION, ATTR_MODE, CONF_API_KE...
from django.utils.translation import ugettext_lazy as _ import horizon class Instances(horizon.Panel): name = _("Instances") slug = 'instances' permissions = ('openstack.services.compute',) policy_rules = ((("compute", "context_is_admin"), ("compute", "compute:get_all")),)
"""Initializes a DfaClient without using yaml-cached credentials. While our LoadFromStorage method provides a useful shortcut to instantiate a client if you regularly use just one set of credentials, production applications may need to swap out users. This example shows you how to create an OAuth 2.0 client and a DfaC...
# -*- coding: utf-8 -*- """ Support i3blocks blocklets in py3status. [i3blocks](https://github.com/vivien/i3blocks) is a project to allow simple scripts to provide output to the i3bar. This module allows these blocklets to run under py3status. The configuration of the blocklets is similar to how they are configured ...
import os, re, string, sys from file_util import * import git_util as git import svn_util as svn # script directory script_dir = os.path.dirname(__file__) # CEF root directory cef_dir = os.path.abspath(os.path.join(script_dir, os.pardir)) # Valid extensions for files we want to lint. DEFAULT_LINT_WHITELIST_REGEX = r...
from tempest_lib import exceptions as lib_exc from tempest.api.identity import base from tempest.common.utils import data_utils from tempest import test class ServicesTestJSON(base.BaseIdentityV3AdminTest): def _del_service(self, service_id): # Used for deleting the services created in this class ...
""" Converts any type of FASTQ file to Sanger type and makes small adjustments if necessary. usage: %prog [options] -i, --input=i: Input FASTQ candidate file -r, --origType=r: Original type -a, --allOrNot=a: Whether or not to check all blocks -b, --blocks=b: Number of blocks to check -o, --output=o: Ou...
import numpy as np #f2 calculate the distance b/ p1 and p2 f2=lambda p1,p2:np.sqrt(np.sum((p1-p2)**2)) #anonymous function f3 is to calculate the coordinates of basis with magnitude of 1.,p1 and p2 are coordinates for two known points, the #direction of the basis is pointing from p1 to p2 f3=lambda p1,p2:(1./f2...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from units.compat.mock import patch from ansible.modules.network.netvisor import pn_admin_service from units.modules.utils import set_module_args from .nvos_module import TestNvosModule class TestAdminServiceModule(TestNvosModule...
import unittest from bubbles import * # import bubbles.iterator # FIXME: clean this up import inspect def default(ctx, left): pass def unary(ctx, left): pass def binary(ctx, left, right): pass class DummyDataObject(DataObject): def __init__(self, reps=None, data=None): """Creates a dummy da...
# -*- encoding: utf-8 -*- import json from hashlib import sha1 from datetime import datetime from PyQt5.QtCore import QSettings from PyQt5.QtCore import QUrl, Qt, QLocale, QLibraryInfo, QTranslator from PyQt5.QtGui import QClipboard from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply from...
"""The tests for the litejet component.""" import logging import unittest from unittest import mock from homeassistant import setup from homeassistant.components import litejet import homeassistant.components.switch as switch from tests.common import get_test_home_assistant from tests.components.switch import common ...
import ipaddress import os import re from contextlib import suppress from urllib.parse import urlsplit, urlunsplit from django.core.exceptions import ValidationError from django.utils.deconstruct import deconstructible from django.utils.functional import SimpleLazyObject from django.utils.ipv6 import is_valid_ipv6_add...
""" Contains XML text classes. """ from suds import * from suds.sax import * class Text(unicode): """ An XML text object used to represent text content. @ivar lang: The (optional) language flag. @type lang: bool @ivar escaped: The (optional) XML special character escaped flag. @type escaped: ...
#! /usr/bin/env python '''XML Canonicalization Patches Applied to xml.dom.ext.c14n: http://sourceforge.net/projects/pyxml/ [ 1444526 ] c14n.py: http://www.w3.org/TR/xml-exc-c14n/ fix -- includes [ 829905 ] c14n.py fix for bug #825115, Date Submitted: 2003-10-24 23:43 -- include dep...
# -*- coding: utf-8 -*- """ requests.adapters ~~~~~~~~~~~~~~~~~ This module contains the transport adapters that Requests uses to define and maintain connections. """ import socket from .models import Response from .packages.urllib3 import Retry from .packages.urllib3.poolmanager import PoolManager, proxy_from_url ...
"""Cryptographic protocols Implements various cryptographic protocols. (Don't expect to find network protocols here.) Crypto.Protocol.AllOrNothing Transforms a message into a set of message blocks, such that the blocks can be recombined to get the message back. Crypto.Protocol.Chaffing Takes a set of authenticat...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.plugins.action import ActionBase from ansible.utils.vars import merge_hash class ActionModule(ActionBase): def run(self, tmp=None, task_vars=None): # individual modules might disagree but as the generic...
import collections NOT_FLATTEN_KEYS = ['additionalIdentifiers', 'additionalClassifications', 'suppliers', 'changes', 'tenderers' ] class IdValue(str): '''This is basically a string but is used to differentiate itse...
from random import randrange, seed import sys from ..algorithm import SortingAlgorithm seed() def _partition(xs, beg, end, select_pivot): pivot = select_pivot(xs, beg, end) xs[pivot], xs[end] = xs[end], xs[pivot] for i in range(beg, end): if xs[i] <= xs[end]: xs[i], xs[beg] = xs[beg...
from openerp.osv import fields, osv from openerp import tools import openerp.addons.decimal_precision as dp STATE = [ ('none', 'Non Member'), ('canceled', 'Cancelled Member'), ('old', 'Old Member'), ('waiting', 'Waiting Member'), ('invoiced', 'Invoiced Member'), ('free', 'Free Member'), ('p...
''' metricsqueryhandler.py ''' import traceback import tornado.gen import tornado.web from heron.common.src.python.utils.log import Log from heron.tools.tracker.src.python.handlers import BaseHandler from heron.tools.tracker.src.python.query import Query class MetricsQueryHandler(BaseHandler): """ URL - /topolog...
"""Facilities for creating multiple test combinations. Here is an example of testing various optimizers in Eager and Graph mode: class AdditionExample(test.TestCase, parameterized.TestCase): @combinations.generate( combinations.combine(mode=["graph", "eager"], optimizer=[AdamOptimizer...
def main(request, response): import simplejson as json f = file('config.json') source = f.read() s = json.JSONDecoder().decode(source) url1 = "http://" + s['host'] + ":" + str(s['ports']['http'][1]) url2 = "http://" + s['host'] + ":" + str(s['ports']['http'][0]) _CSP = "sandbox " respons...
""" PythonTool Tool-specific initialization for Python. Provides configuration variables used to build Python extension modules. """ ## Values on my PowerBook: # # env['PYTHON'] '/usr/local/bin/python' # env['PYTHON_CC'] 'gcc' # env['PYTHON_CXX'] 'c++' # env['PYTHON_BASECFLAGS'] '-fno-s...
{ 'name': 'Belgium - Structured Communication', 'version': '1.2', 'license': 'AGPL-3', 'author': 'Noviat', 'website': 'https://www.odoo.com/page/accounting', 'category' : 'Localization', 'description': """ Belgian localization for in- and outgoing invoices (prereq to account_coda): ====...
#!/usr/bin/python import sys def encode(n): return bytearray([n & 0xff, (n >> 8) & 0xff]) def encode_basic_number(n): return str(n).encode("iso8859-1") + b"\x0e\x00\x00" + encode(n) + b"\x00" def create_basic_line(line, text): ls = encode(line) return bytearray([ls[1], ls[0]])+encode(len(text)+1)+tex...
from VectorClock import * import unittest class TestVectorClock(unittest.TestCase): def testBasicUsage(self): """Test basic usage of VectorClock.""" v = VectorClock() v.add('foo') self.assertEqual(v.dict(), {'foo' : 0}) v.increment('foo') v.increment('foo') ...
import logging from pylib import content_settings _LOCK_SCREEN_SETTINGS_PATH = '/data/system/locksettings.db' PASSWORD_QUALITY_UNSPECIFIED = '0' def ConfigureContentSettings(device, desired_settings): """Configures device content setings from a list. Many settings are documented at: http://developer.androi...
<<<<<<< HEAD # Copyright (c) 2015 OpenStack Foundation # ======= # -*- coding: utf-8 -*- >>>>>>> 7bea44e26ee8a400564a6a746d26293bb4bbf9cd # 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 # # ...
import json import shlex import os import sys import pipes def query_package(module, pkgin_path, name): """Search for the package by name. Possible return values: * "present" - installed, no upgrade needed * "outdated" - installed, but can be upgraded * False - not installed or not found ...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import json from ansible.module_utils.network.fortimanager.fortimanager import FortiManagerHandler import pytest try: from ansible.modules.network.fortimanager import fmgr_secprof_appctrl except ImportError: pyte...