content
stringlengths
4
20k
"""Utilities for assertion debugging""" import pprint import _pytest._code import py try: from collections import Sequence except ImportError: Sequence = list BuiltinAssertionError = py.builtin.builtins.AssertionError u = py.builtin._totext # The _reprcompare attribute on the util module is used by the new a...
import nipy import pandas as pd import numpy as np import argparse import os from collections import OrderedDict import sys sys.path.append( os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) ) from config import * parser = argparse.ArgumentParser(description='Script to create summary of VBM ...
import datetime import os import random import sys sys.path = [os.path.abspath(os.path.dirname(__file__))] + sys.path from quantile_ml import Predictor from quantile_ml.utils_models import load_ml_model import dill from nose.tools import assert_equal, assert_not_equal, with_setup import numpy as np from sklearn.model...
try: import unittest2 as unittest except ImportError: import unittest # noqa from mock import Mock import cassandra from cassandra.cqltypes import IntegerType, AsciiType, TupleType from cassandra.metadata import (Murmur3Token, MD5Token, BytesToken, ReplicationStrategy, ...
# coding=utf-8 from ..nodes import get from ..utility import abspath from ..exception import DataProcessorError def add(node_list, comment, node_path): """ Add comment to node spedcified path. Parameters ---------- comment : str comment. node_path : str This path specify the ...
from ... import SCHEMA_VERSION from .. import Encoder from omero.model import ExperimenterI class Experimenter201501Encoder(Encoder): TYPE = 'http://www.openmicroscopy.org/Schemas/OME/2015-01#Experimenter' def encode(self, obj): v = super(Experimenter201501Encoder, self).encode(obj) if not o...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Python setup script for TracPortalPlugin # # (C) 2013-2016 Internet Initiative Japan Inc. # All rights reserved. # # Created on 2013/06/27 # @author: <EMAIL> from setuptools import setup, find_packages extra = {} try: import babel extractors = [ ('**....
""" kombu.utils.limits ================== Token bucket implementation for rate limiting. """ from __future__ import absolute_import from kombu.five import monotonic __all__ = ['TokenBucket'] class TokenBucket(object): """Token Bucket Algorithm. See http://en.wikipedia.org/wiki/Token_Bucket Most of th...
import os, mmap from gppylib.test.behave_utils.utils import drop_database_if_exists, drop_table_if_exists @given('database "{dbname}" does not exist') def impl(context, dbname): drop_database_if_exists(context, dbname) @given('the file "{file_name}" does not exist') def impl(context, file_name): if os.path.is...
DATE_FORMAT = 'j. F Y' TIME_FORMAT = 'G:i:s' DATETIME_FORMAT = 'j. F Y G:i:s' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j. F' SHORT_DATE_FORMAT = 'd.m.Y' SHORT_DATETIME_FORMAT = 'd.m.Y G:i:s' FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.pytho...
#pylint: disable=I0011,W0613,W0201,W0212,E1101,E1103 from ..registry import Registry def setup_function(function): Registry().clear() def test_singleton(): assert Registry() is Registry() def test_unique(): r = Registry() assert r.register(3, "test") == "test" assert r.register(4, "test2") == ...
from openerp.osv import fields, osv from openerp.tools import config class document_ftp_configuration(osv.osv_memory): _name='document.ftp.configuration' _description = 'Auto Directory Configuration' _inherit = 'res.config' _rec_name = 'host' _columns = { 'host': fields.char('Address', siz...
#!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2008 (ita) "Gnome support" import os, re import TaskGen, Utils, Runner, Task, Build, Options, Logs import cc from Logs import error from TaskGen import taskgen, before, after, feature n1_regexp = re.compile('<refentrytitle>(.*)</refentrytitle>', re.M) n2_re...
# -*- coding: utf-8 -*- # from rest_framework.compat import coreapi, coreschema from rest_framework import filters from django.db.models import Q from .models import Label from assets.utils import is_query_node_all_assets, get_node class AssetByNodeFilterBackend(filters.BaseFilterBackend): fields = ['node', 'al...
# Rick Porter (Applied Communication Sciences) import os import sys np = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) if np not in sys.path: sys.path.append(np) import util.log LOG = True class OFDPA20(): __shared_state = {} def __init__(self, config): self.__dict__ = self.__sha...
from boxbranding import getBoxType, getMachineName from Screens.Wizard import WizardSummary from Screens.WizardLanguage import WizardLanguage from Screens.Rc import Rc from Components.AVSwitch import iAVSwitch from Components.Pixmap import Pixmap from Components.config import config, ConfigBoolean, configfile from To...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting field 'Session.speaker' db.delete_column('conference_session', 'speaker_id') # Adding M2...
from __future__ import absolute_import from django.conf.urls import patterns, url from django.views.generic import RedirectView from . import views urlpatterns = patterns('', (r'^no_template_view/$', views.no_template_view), (r'^staff_only/$', views.staff_only_view), (r'^get_view/$', views.get_view), ...
""" ============================ Block views on images/arrays ============================ This example illustrates the use of `view_as_blocks` from `skimage.util.shape`. Block views can be incredibly useful when one wants to perform local operations on non-overlapping image patches. We use `astronaut` from `skimage...
{ 'name': 'Stock picking lines with sequence number', 'version': '0.1', 'category': 'Warehouse Management', 'summary': ''' Provide a new field on stock moves, allowing to manage the orders of moves in a picking. ''', 'author': "Camptocamp,Odoo Community Association (OCA)", 'website': 'http:/...
#!/usr/bin/env python from __future__ import print_function from sympy import symbols, log, simplify, diff, cos, sin from sympy.galgebra.ga import MV, ReciprocalFrame from sympy.galgebra.debug import oprint from sympy.galgebra.printing import GA_Printer, enhance_print, Get_Program, Print_Function from sympy.galgebra....
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Example usage to regenerate traps.json: - open the dyld cache in r2 like this: R_DYLDCACHE_FILTER=libsystem_kernel r2 -e bin.usextr=false ~/Library/Developer/Xcode/iOS\ DeviceSupport/12.1.2\ \(16C101\)\ arm64e/Symbols/System/Library/Caches/com.apple.dyld/dyld_shar...
""" HypermediaHttpServer extends the BaseHttpRequestHandler class in BaseHttpServer to create a dictionary driven interface to http requesters and response handlers that allows the processing of requests in the order of path, content format, and method. Requests and their associated responses are exposed in a dictiona...
from django.conf import settings from django.conf.urls import url from django.contrib.auth.decorators import login_required from oscar.core.application import Application from oscar.core.loading import get_class class CheckoutApplication(Application): name = 'checkout' index_view = get_class('checkout.views...
""" South Africa-specific Form helpers """ from __future__ import unicode_literals from django.core.validators import EMPTY_VALUES from django.forms import ValidationError from django.forms.fields import CharField, RegexField from django.utils.checksums import luhn from django.utils.translation import gettext as _ imp...
from openerp.osv import fields,osv,orm from openerp.tools.translate import _ class project_issue(osv.osv): _inherit = 'project.issue' _description = 'project issue' _columns = { 'timesheet_ids': fields.one2many('hr.analytic.timesheet', 'issue_id', 'Timesheets'), 'analytic_account_id': field...
# oppia/templatetags/display_functions.py import hashlib import json import math import urllib from django import template from django.template.defaultfilters import stringfilter from django.utils.safestring import mark_safe register = template.Library() @register.filter(name='get_index') def get_index(start,index):...
"""BibFormat element - Prints subject data from an Authority Record. """ import re __revision__ = "$Id$" def format_element(bfo, detail='no'): """ Prints the data of a subject authority record in HTML. By default prints brief version. @param detail: whether the 'detailed' rather than the 'brief' format ...
from __future__ import absolute_import import logging import os from pip.exceptions import CommandError from pip.index import FormatControl from pip.req import RequirementSet from pip.basecommand import RequirementCommand from pip import cmdoptions from pip.utils import ensure_dir, normalize_path from pip.utils.build...
""" ======================================= Signal processing (:mod:`scipy.signal`) ======================================= Convolution =========== .. autosummary:: :toctree: generated/ convolve -- N-dimensional convolution. correlate -- N-dimensional correlation. fftconvolve -- N-dimensional convol...
import os.path import re import bjam from b2.build import type, toolset, generators, scanner, feature from b2.exceptions import AlreadyDefined from b2.tools import builtin from b2.util import regex from b2.build.toolset import flags from b2.manager import get_manager from b2.util import utility __debug = None def d...
import os import sys import fnmatch import textwrap from distutils.command.build_py import build_py as _build_py from distutils.util import convert_path from glob import glob try: from setuptools.lib2to3_ex import Mixin2to3 except ImportError: class Mixin2to3: def run_2to3(self, files, doctests=True): ...
import pwny def test_xor_int(): assert pwny.xor(61, b'fooo') == b'[RRR' def test_xor_str(): assert pwny.xor(b'abcd', b'fooo') == b'\x07\r\x0c\x0b' assert pwny.xor(b'abcd', b'fooofooo') == b'\x07\r\x0c\x0b\x07\r\x0c\x0b' def test_rot13(): assert pwny.rot13('whax') == 'junk' def test_caesar(): ...
import operator from ..sql import operators from .. import util class UnevaluatableError(Exception): pass _straight_ops = set(getattr(operators, op) for op in ('add', 'mul', 'sub', 'div', 'mod', 'truediv', ...
import IECore import Gaffer ## This class is used by several of the unit tests. class CompoundPlugNode( Gaffer.DependencyNode ) : def __init__( self, name="CompoundPlugNode" ) : Gaffer.DependencyNode.__init__( self, name ) p = Gaffer.Plug( name = "p" ) c1 = Gaffer.FloatPlug( name = "f" ) c2 = Gaffer.Strin...
"""Class for loading tiles from the local tilestore.""" import os import Image from tileprovider import TileProvider import tilestore as TileStore class StaticTileProvider(TileProvider): """StaticTileProvider objects are used for loading tiles from the disk-cache into a TileCache. Constructor: StaticTi...
from ..base import * import inspect try: from js2py.translators.translator import translate_js except: pass @Js def Eval(code): local_scope = inspect.stack()[3][0].f_locals['var'] global_scope = this.GlobalObject # todo fix scope - we have to behave differently if called through variable other than...
"""Unit tests for `cinder.wsgi`.""" import os.path import re import socket import ssl import tempfile import time import mock from oslo_config import cfg from oslo_i18n import fixture as i18n_fixture from six.moves import urllib import testtools import webob import webob.dec from cinder import exception from cinder....
from jinja2.ext import Extension, InternationalizationExtension, nodes from tower import strip_whitespace class I18nExtension(InternationalizationExtension): """ Use this instead of `tower.template.i18n` because the override of `_` global was throwing errors. """ def _parse_block(self, parser, all...
""" Test cases for formmethod module. """ from twisted.trial import unittest from twisted.python import formmethod class ArgumentTestCase(unittest.TestCase): def argTest(self, argKlass, testPairs, badValues, *args, **kwargs): arg = argKlass("name", *args, **kwargs) for val, result in testPairs:...
from south.db import db from django.db import models from cms.plugins.text.models import * class Migration: def forwards(self, orm): # Deleting field 'Text.public' db.delete_column('cmsplugin_text', 'public_id') # Deleting model 'textpublic' db.delete_table('c...
import os import json import sys import six from six import StringIO from pylint.reporters.json import JSONReporter from pylint.lint import Run from conans.client.output import Color from conans.errors import ConanException def conan_linter(conanfile_path, out): apply_lint = os.environ.get("CONAN_RECIPE_LINTER"...
"""Generate template values for a callback interface. FIXME: Not currently used in build. This is a rewrite of the Perl IDL compiler in Python, but is not complete. Once it is complete, we will switch all IDL files over to Python at once. Until then, please work on the Perl IDL compiler. For details, see bug http://cr...
import io import os import signal from os.path import join, exists from os import path import stat import subprocess import time import tempfile import multiprocessing import socket import pkg_resources import docker import psutil import requests from psutil import Process import shutil import json from pixelated.pro...
""" Python Interchangeable Virtual Instrument Library Copyright (c) 2012-2014 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...
"""This module contains an object that represents a Telegram Contact.""" from telegram import TelegramObject class Contact(TelegramObject): """This object represents a Telegram Contact. Attributes: phone_number (str): first_name (str): last_name (str): user_id (int): Arg...
import collections import argparse import os.path import datetime import re import sys def load_pattern_file(fn): res = [] with open(fn) as f: for line in f: line = line.split('#', 1)[0].strip() if not line: continue res.append(re.compile(line)) ...
"""Unit tests for object_json module.""" import datetime import StringIO from nupic.data.inference_shifter import InferenceShifter from nupic.swarming import object_json as json from nupic.support.unittesthelpers.testcasebase import (TestCaseBase, unittest) cl...
from openerp import models, fields from openerp import tools class report_event_registration(models.Model): """Events Analysis""" _name = "report.event.registration" _order = 'event_date desc' _auto = False create_date = fields.Datetime('Creation Date', readonly=True) event_date = fields.Date...
""" This file contains utility functions which will responsible for sending emails. """ import HTMLParser import logging import os import urlparse import uuid from email.mime.image import MIMEImage from email.mime.multipart import MIMEMultipart from django.conf import settings from django.contrib.auth.models import U...
from __future__ import print_function from pyspark import SparkContext # $example on$ from pyspark.mllib.stat import Statistics # $example off$ if __name__ == "__main__": sc = SparkContext(appName="HypothesisTestingKolmogorovSmirnovTestExample") # $example on$ parallelData = sc.parallelize([0.1, 0.15, 0....
from __future__ import print_function import argparse import os import re import shutil import subprocess import sys import tempfile from zipfile import ZipFile class JarDiffer(object): def __init__(self, args): self.parse_args(args) self.tmpdir = tempfile.mkdtemp() def __enter__(self): ...
import datetime import json as jsonlib import re import urlparse from django.conf import settings from django.core.urlresolvers import reverse as django_reverse from django.http import QueryDict from django.utils.encoding import smart_str from django.utils.http import urlencode from django.utils.tzinfo import LocalTim...
import warnings from chainer.utils import conv import numpy as np from onnx_chainer.functions.opset_version import support from onnx_chainer import onnx_helper @support((1, 7)) def convert_AveragePooling2D( func, opset_version, input_names, output_names, context): pad = [func.ph, func.pw] stride = [...
from __future__ import unicode_literals import unittest from django.core.exceptions import FieldError from django.test import SimpleTestCase, TestCase from .models import ( AdvancedUserStat, Child1, Child2, Child3, Child4, Image, Parent1, Parent2, Product, StatDetails, User, UserProfile, UserStat, UserStatRe...
import os import re import shlex import ansible.constants as C from ansible.utils import template from ansible import utils from ansible import errors from ansible.runner.return_data import ReturnData class ActionModule(object): TRANSFERS_FILES = True def __init__(self, runner): self.runner = runner...
import django import time import string from Crypto.Random import random from Crypto.Cipher import Blowfish from django import forms from django.conf import settings from django.core.cache import cache from django.forms import widgets from django.forms.forms import pretty_name from django.forms.forms import NON_FIEL...
""" Exceptions ############### """ from exa.core.error import ExaException class AtomicException(ExaException): """ The exatomic exception. """ pass class StringFormulaError(AtomicException): """ The string representation of a :class:`~exatomic.formula.SimpleFormula` has ...
from __future__ import absolute_import, print_function, unicode_literals, division from jormungandr.interfaces.v1.ResourceUri import complete_links class MockResource(object): def __init__(self): self.region = 'test' def mock_stop_schedules(): return { "stop_schedules": [ { ...
#!/usr/bin/env python """Generate FreeType reference documentation.""" from __future__ import print_function import argparse import glob import os import subprocess import sys def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument( "--input-dir", required=True...
# -*- coding: utf-8 -*- """ pygments.filters ~~~~~~~~~~~~~~~~ Module containing filter lookup functions and default filters. :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from __future__ import unicode_literals import re from ...
from ..utils import now from .forms import ClientAuthForm from .models import AccessToken class BaseBackend(object): """ Base backend used to authenticate clients as defined in :rfc:`1` against our database. """ def authenticate(self, request=None): """ Override this method to impl...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import unittest from django.contrib.webdesign.lorem_ipsum import * from django.template import loader, Context class WebdesignTest(unittest.TestCase): def test_words(self): self.assertEqual(words(7), 'lorem ipsum dolor sit amet consectetur...
""" Phase two: input data = paths of compressed, serialized KinshipVector objects. This phase is meant to be run on phase one's output when the latter is too large for a single process to collect. Using less mappers than there are KinshipVector files allows to reduce the burden of assembling the final matrix. FIXME:...
from operator import attrgetter from flask import request from sqlalchemy.orm import subqueryload, undefer from indico.core.db import db from indico.modules.events.contributions import Contribution from indico.modules.events.papers.models.revisions import PaperRevision, PaperRevisionState from indico.modules.events.p...
""" Test the iris.analysis.interpolate module. """ 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 anything else. import iris.tests as tests import nu...
from django import forms from django.contrib.auth import get_user_model from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import Group, Permission from django.forms.models import inlineformset_factory from wagtail.wagtailcore import hooks from wagtail.wagtailadmin.widgets import A...
import unittest from pyanaconda import kickstart class PwPolicyTestCase(unittest.TestCase): ks = """ %anaconda pwpolicy root --strict --minlen=8 --minquality=50 --nochanges --emptyok pwpolicy user --strict --minlen=8 --minquality=50 --nochanges --emptyok pwpolicy luks --strict --minlen=8 --minquality=50 --nochang...
import unittest import sys import os import subprocess import shutil from copy import copy from test.support import (run_unittest, TESTFN, unlink, check_warnings, captured_stdout, skip_unless_symlink) import sysconfig from sysconfig import (get_paths, get_platform, get_config_vars...
import os import sys import json import time import logging try: from functools import reduce except ImportError: pass try: import urllib.request as urllib2 except ImportError: import urllib2 log = logging.getLogger("travis.leader") log.addHandler(logging.StreamHandler()) log.setLevel(logging.INFO) ...
#! /usr/bin/env python """Runner Script for Robot Framework SeleniumLibrary Demo Tests are run by giving a path to the tests to be executed as an argument to this script. Possible Robot Framework options are given before the path. Examples: rundemo.py login_tests # Run all tests in a directo...
import json import uuid from django.core import exceptions, serializers from django.db import IntegrityError, models from django.test import ( SimpleTestCase, TestCase, TransactionTestCase, skipUnlessDBFeature, ) from .models import ( NullableUUIDModel, PrimaryKeyUUIDModel, RelatedToUUIDModel, UUIDGrandchild,...
from __future__ import absolute_import from optparse import make_option from django.core.management.base import BaseCommand from zerver.models import RealmFilter, all_realm_filters, Realm from zerver.lib.actions import do_add_realm_filter, do_remove_realm_filter import sys class Command(BaseCommand): help = """Cr...
#!/usr/bin/python """ Copyright 2014 Google Inc. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. Compare GM results for two configs, across all builders. """ # System-level imports import argparse import logging import time # Must fix up PYTHONPATH before importing...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['stableinterface'], 'supported_by': 'core'} DOCUMENTATION = r''' --- module: stat version_added: "1.3" short_description: Retrieve file or file system status description: - Retrieves facts for a file similar to the l...
""" A component which allows you to send data to an Influx database. For more details about this component, please refer to the documentation at https://home-assistant.io/components/influxdb/ """ import logging import homeassistant.util as util from homeassistant.const import (EVENT_STATE_CHANGED, STATE_UNAVAILABLE, ...
""" Terminal Escape Sequences for input and display """ import re try: from urwid import str_util except ImportError: from urwid import old_str_util as str_util from urwid.compat import bytes, bytes3 within_double_byte = str_util.within_double_byte SO = "\x0e" SI = "\x0f" IBMPC_ON = "\x1b[11m" IBMPC_OFF = ...
from spack import * class Polymake(Package): """polymake is open source software for research in polyhedral geometry""" homepage = "https://polymake.org/doku.php" url = "https://polymake.org/lib/exe/fetch.php/download/polymake-3.0r1.tar.bz2" version('3.5', sha256='c649f8536ccef5a5e22b82c514a0927...
from django.shortcuts import render from django.http import HttpResponseRedirect from jingo.helpers import urlparams from .exceptions import ReadOnlyException from .jobs import DocumentZoneURLRemapsJob class ReadOnlyMiddleware(object): """ Renders a 403.html page with a flag for a specific message. """ ...
""" :Description: Sphinx extension to remove leading under-scores from directories names in the html build output directory. """ import os import shutil def setup(app): """ Add a html-page-context and a build-finished event handlers """ app.connect('html-page-context', change_pathto) app.connect(...
import abc import typing import pkg_resources import google.auth # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.ads.googleads.v8.resources.types import...
from fabric.api import sudo, cd, run, env from fabric.colors import green, yellow from fabric.contrib.files import append import ConfigParser env.hosts = ['10.104.10.63'] def install_api_server(conf_file): config = ConfigParser.ConfigParser() config.read(conf_file) api_path = config.get('Global', 'api_pa...
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons from common import write_fake_link _python_ = TestSCons._python_ _exe = TestSCons._exe test = TestSCons.TestSCons() write_fake_link(test) test.write('myg77.py', r""" import getopt import sys opts, args = getopt.getopt(sys.argv[1:], '...
from enum import IntEnum from functools import reduce from rdkit.Chem import EState from ._base import Descriptor from ._util import parse_enum try: import builtins except ImportError: import __builtin__ as builtins __all__ = ("AtomTypeEState",) es_types = ( "sLi", "ssBe", "ssssBe", "ssBH...
# Scan an Apple header file, generating a Python file of generator calls. import sys from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner LONG = "MacHelp" SHORT = "help" OBJECT = "NOTUSED" def main(): input = LONG + ".h" output = SHORT + "gen.py" defsoutput...
"""Thin wrapper of CUBLAS.""" import ctypes from cupy.cuda import driver from cupy.cuda import internal _cublas = internal.load_library('cublas') _I = ctypes.c_int _P = ctypes.c_void_p _F = ctypes.c_float _D = ctypes.c_double _IP = ctypes.POINTER(_I) _FP = ctypes.POINTER(_F) _DP = ctypes.POINTER(_D) Handle = _P CU...
import numpy as np from numpy.testing import (assert_equal, assert_almost_equal, assert_raises) from skimage.transform._geometric import _stackcopy from skimage.transform._geometric import GeometricTransform from skimage.transform import (estimate_transform, matrix_transform, ...
#!/usr/bin/env python # -*- mode: python; encoding: utf-8 -*- """Test RDFStruct implementations.""" from google.protobuf import descriptor_pool from google.protobuf import message_factory from grr.lib import flags from grr.lib import rdfvalue from grr.lib import test_lib from grr.lib import type_info from grr.lib....
# http://inamidst.com/saxo/ # Created by Sean B. Palmer import saxo @saxo.setup def instances(irc): if not "saxo_instances" in irc.db: irc.db["saxo_instances"].create( ("pid", int)) @saxo.setup def periodic(irc): sqlite3_schema = [(0, 'name', 'TEXT', 0, None, 1), (1,...
#!/usr/bin/python """ A simple graphical chat client to demonstrate the use of pybluez. Opens a l2cap socket and listens on PSM 0x1001 Provides the ability to scan for nearby bluetooth devices and establish chat sessions with them. """ import os import sys import time import gtk import gobject import gtk.glade i...
"""Base script for doing test setup.""" import logging import os from pylib import constants from pylib import valgrind_tools from pylib.constants import host_paths from pylib.utils import isolator def GenerateDepsDirUsingIsolate(suite_name, isolate_file_path, isolate_file_paths, deps...
import os from oslo_policy import opts from manila.common import config CONF = config.CONF def set_defaults(conf): _safe_set_of_opts(conf, 'verbose', True) _safe_set_of_opts(conf, 'state_path', os.path.abspath( os.path.join(os.path.dirname(__file__), '..', ...
from typing import Any, List, Dict, Optional, Text from django.conf import settings from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect, HttpResponse, HttpRequest from django.shortcuts import redirect, render from django.utils import translation from django.utils.cache import patc...
from datetime import datetime from django.db import models RECORD_INFO = u'info' RECORD_ERROR = u'error' class RecordManager(models.Manager): def log(self, level, src, msg, **kwargs): msg = msg.format(**kwargs).encode('utf-8') return Record.objects.create(level=RECORD_INFO, src=src, msg=msg) ...
from . import Image, ImageFile from ._binary import i32be as i32 def _accept(prefix): return len(prefix) >= 8 and \ i32(prefix[:4]) >= 20 and i32(prefix[4:8]) in (1, 2) ## # Image plugin for the GIMP brush format. class GbrImageFile(ImageFile.ImageFile): format = "GBR" format_description = ...
"""Concat and stack operations for RaggedTensors.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.framework import ops from tensorflow.python.framework import tensor_shape from tensorflow.python.ops import array_ops from tensorflow...
from typing import Dict from cleo.styles import OutputStyle from sdoc.sdoc2.node.HeadingNode import HeadingNode from sdoc.sdoc2.NodeStore import NodeStore class ChapterNode(HeadingNode): """ SDoc2 node for chapters. """ # -----------------------------------------------------------------------------...
# this is based on jsarray.py from ..base import * try: import numpy except: pass @Js def Uint8ClampedArray(): TypedArray = (PyJsInt8Array,PyJsUint8Array,PyJsUint8ClampedArray,PyJsInt16Array,PyJsUint16Array,PyJsInt32Array,PyJsUint32Array,PyJsFloat32Array,PyJsFloat64Array) a = arguments[0] if isin...
#!/usr/bin/python from sys import argv, stdout, stderr import xml.dom.minidom from libglibcodegen import NS_TP, get_docstring, \ get_descendant_text, get_by_path class Generator(object): def __init__(self, prefix, implfile, declfile, dom): self.prefix = prefix + '_' assert declfile.endsw...
import logging _logger = logging.getLogger(__name__) from openerp import models, fields from openerp.tools.translate import _ class WebsiteMenu(models.Model): """Improve website.menu with adding booleans that drive if the menu is displayed when the user is logger or not. """ _inherit = 'website.menu' ...