content
string
from telemetry.page import page as page_module from telemetry.page import page_set as page_set_module class SkiaBuildbotDesktopPage(page_module.Page): def __init__(self, url, page_set): super(SkiaBuildbotDesktopPage, self).__init__( url=url, page_set=page_set, credentials_path='data/cre...
from django import http from django.conf import settings from django.contrib.sites.models import Site from django.core.exceptions import ImproperlyConfigured from django.test import TestCase, modify_settings, override_settings from django.utils import six from .middleware import RedirectFallbackMiddleware from .models...
ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'core', 'version': '1.0'}
#!/usr/bin/env python from __future__ import absolute_import from collections import OrderedDict from linchpin.InventoryFilters.InventoryFilter import InventoryFilter class Inventory(InventoryFilter): DEFAULT_HOSTNAMES = ['metadata.name'] def get_host_data(self, res, cfgs): """ Returns a d...
"""Stuff that differs in different Python versions and platform distributions.""" from __future__ import absolute_import, division import os import sys from pip._vendor.six import text_type try: from logging.config import dictConfig as logging_dictConfig except ImportError: from pip.compat.dictconfig import ...
"""Syncronizes cell Zookeeper with LDAP data. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import collections import itertools import logging import math import time import click import six from treadmill im...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import re import socket import platform from ansible.module_utils.facts.utils import get_file_content from ansible.module_utils.facts.collector import BaseFactCollector # i86pc is a Solaris and derivatives-ism SOLARIS_I86_RE_PAT...
"""Test Z-Wave switches.""" from unittest.mock import patch from homeassistant.components.zwave import switch from tests.mock.zwave import MockEntityValues, MockNode, MockValue, value_changed def test_get_device_detects_switch(mock_openzwave): """Test get_device returns a Z-Wave switch.""" node = MockNode()...
""" Copyright 2011 Software Freedom Conservancy. 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...
"""Rules based permissions for the crowdsource app""" # pylint: disable=missing-docstring, unused-argument, invalid-unary-operand-type # Third Party from rules import add_perm, always_deny, is_staff, predicate # MuckRock from muckrock.foia.rules import has_feature_level, skip_if_not_obj, user_authenticated @predic...
from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( fix_xml_ampersands, ) class MetacriticIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?metacritic\.com/.+?/trailers/(?P<id>\d+)' _TESTS = [{ 'url': 'http://www.metacritic.com/game/plays...
""" Tests for L{twisted.names.common}. """ from __future__ import division, absolute_import from zope.interface.verify import verifyClass from twisted.internet.interfaces import IResolver from twisted.trial.unittest import SynchronousTestCase from twisted.python.failure import Failure from twisted.names.common impor...
""" Script that trains graph-conv models on HOPV dataset. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import numpy as np from deepchem.models import GraphConvModel np.random.seed(123) import tensorflow as tf tf.random.set_seed(123) import deepchem...
from pulpo_forms.fieldtypes import ModelField from pulpo_forms.fieldtypes import FieldFactory from .models import PulpoUser, Club, Country class PulpoUserField(ModelField.ModelField): prp_template_name = "usuario/properties.html" model = PulpoUser name = "PulpoUser" def get_assets(): return [...
from tests.unit import AWSMockServiceTestCase, MockServiceWithConfigTestCase from tests.compat import mock from boto.sqs.connection import SQSConnection from boto.sqs.regioninfo import SQSRegionInfo from boto.sqs.message import RawMessage from boto.sqs.queue import Queue from boto.connection import AWSQueryConnection...
import arrow from mendeley.models.common import Discipline, Photo, Location, Education, Employment from mendeley.response import SessionResponseObject class Profile(SessionResponseObject): """ A Mendeley profile. .. attribute:: id .. attribute:: first_name .. attribute:: last_name .. attribu...
from httplib import HTTPSConnection import os import socket import ssl from urllib2 import HTTPSHandler from scli.constants import CABundle from lib.utility import shell_utils HTTP_GET = 'GET' HTTP_POST = 'POST' class CaValidationHttpsConnection(HTTPSConnection): '''Override HTTPSConnection to verify server ...
import pytest import unittest from selenium.common.exceptions import NoSuchElementException, ElementNotSelectableException, UnexpectedTagNameException from selenium.webdriver.support.ui import Select from selenium.webdriver.common.by import By def not_available_on_remote(func): def testMethod(self): print...
from . base import EXT_MSG, EXT_SRV, SEP, log, plog, InvalidMsgSpec, log_verbose, MsgGenerationException from . gentools import compute_md5, compute_full_text, compute_md5_text from . names import resource_name_base, package_resource_name, is_legal_resource_base_name, \ resource_name_package, resource_name, is_leg...
#!python import json import os.path import cherrypy from cherrypy import tools from mako.lookup import TemplateLookup from tentacle.cthulhu.operation import CthulhuData from tentacle.cthulhu.datastore import * from tentacle.shared.screed import Screed from aetypes import end print '------------- CThulhu is alive' c...
import signal from .daemon import Daemon from .signal_handler import SignalHandler class DaemonBuilder: """Builder class for Daemon""" @staticmethod def build(main_function, pidfile, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'): """Builds the daemon and returns SignalHandler instanc...
# -*- coding: windows-1252 -*- import BIFFRecords import Style from Cell import StrCell, BlankCell, NumberCell, FormulaCell, MulBlankCell, BooleanCell, ErrorCell, \ _get_cells_biff_data_mul import ExcelFormula import datetime as dt from Formatting import Font try: from decimal import Decimal except ImportErro...
"""Implementation of the DOM Level 3 'LS-Load' feature.""" import copy import xml.dom from xml.dom.NodeFilter import NodeFilter __all__ = ["DOMBuilder", "DOMEntityResolver", "DOMInputSource"] class Options: """Features object that has variables set for each DOMBuilder feature. The DOMBuilder class uses a...
""" Tests for the command-line interfaces to conch. """ try: import pyasn1 except ImportError: pyasn1Skip = "Cannot run without PyASN1" else: pyasn1Skip = None try: import Crypto except ImportError: cryptoSkip = "can't run w/o PyCrypto" else: cryptoSkip = None try: import tty except Impo...
import cgi import json import os import traceback import urllib import urlparse from constants import content_types from pipes import Pipeline, template from ranges import RangeParser from request import Authentication from response import MultipartContent from utils import HTTPException __all__ = ["file_handler", "p...
# datalogger.py # Logs the data from the acceleromter to a file on the SD-card import pyb # creating objects accel = pyb.Accel() blue = pyb.LED(4) switch = pyb.Switch() # loop while True: # wait for interrupt # this reduces power consumption while waiting for switch press pyb.wfi() # start if switc...
from rx.core import ObservableBase, Observer, AnonymousObserver, Disposable from rx.disposables import CompositeDisposable from .subscription import Subscription from .reactive_assert import AssertList class ColdObservable(ObservableBase): def __init__(self, scheduler, messages): super(ColdObservable, se...
""" ======================================================= Gabors / Primary Visual Cortex "Simple Cells" from Lena ======================================================= How to build a (bio-plausible) "sparse" dictionary (or 'codebook', or 'filterbank') for e.g. image classification without any fancy math and with j...
import cPickle import logging import os import sys import HPOlib.wrapping_util as wrappingUtil __authors__ = ["Katharina Eggensperger", "Matthias Feurer"] __contact__ = "automl.org" logger = logging.getLogger("HPOlib.optimizers.tpe.randomtpe") version_info = ("# %76s #" % "https://github.com/hyperopt/hyperopt/tree...
from xmodule import templates from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, TEST_DATA_SPLIT_MODULESTORE from xmodule.course_module import CourseDescriptor from xmodule.seq...
import inspect import types from rbnics.utils.cache import cache from rbnics.utils.decorators.dispatch import dispatch def ReductionMethodDecoratorFor(Algorithm, replaces=None, replaces_if=None, exact_decorator_for=None): # Convert replaces into a reduction method decorator generator if replaces is not None: ...
class Stats(object): def __init__(self, status_format, time_fn, size): self.fmt = status_format self.finished = 0 self.started = 0 self.total = 0 self.started_time = time_fn() self._times = [] self._size = size self._time = time_fn self._times...
import logging import time from datetime import datetime from boto.sdb.db.model import Model from boto.sdb.db.property import StringProperty, IntegerProperty, BooleanProperty from boto.sdb.db.property import DateTimeProperty, FloatProperty, ReferenceProperty from boto.sdb.db.property import PasswordProperty, ListPrope...
#!/usr/bin/env python3 import argparse import dataclasses import glob import os import subprocess import sys try: import colorama as c GREEN = c.Fore.GREEN YELLOW = c.Fore.YELLOW RED = c.Fore.RED RESET_ALL = c.Style.RESET_ALL BRIGHT = c.Style.BRIGHT except ImportError: GREEN = YELLOW = RED ...
import sys, os from esky.bdist_esky import Executable from distutils.core import setup import assetjet from deploy import exeName, appName from glob import glob def get_data_files(dirs): """ Recursively include data directories. """ results = [] for directory in dirs: for root, dirs, files ...
import IECore class splineInput( IECore.Op ) : def __init__( self ) : IECore.Op.__init__( self, "", IECore.IntParameter( name = "result", description = "", defaultValue = 0, ) ) self.parameters().addParameter( IECore.SplineffParameter( name = "spline", description = "descript...
from nose.tools import * import networkx as nx from networkx.utils import * class X(object): def __eq__(self, other): raise self is other def __ne__(self, other): raise self is not other def __lt__(self, other): raise TypeError('cannot compare') def __le__(self, other): ...
""" Shiny new words service maker """ import sys, socket from twisted.application import strports from twisted.application.service import MultiService from twisted.python import usage from twisted import plugin from twisted.words import iwords, service from twisted.cred import checkers, credentials, portal, strcred ...
import argparse import os from keystoneclient.auth import base from keystoneclient import utils @utils.positional() def register_argparse_arguments(parser, argv, default=None): """Register CLI options needed to create a plugin. The function inspects the provided arguments so that it can also register th...
"""Resize the chrome browser window to the appropriate size.""" import getpass import os import platform import re import subprocess import time import client_logging CHROME_WINDOWS_USER_DATA = ('C:\\Users\\%s\\AppData\\Local\\Google\\Chrome\\' 'User Data\\') CHROME_LINUX_USER_DATA = ...
''' Adapted from https://github.com/tornadomeet/ResNet/blob/master/symbol_resnet.py Original author Wei Wu Implemented the following paper: Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun. "Identity Mappings in Deep Residual Networks" ''' import mxnet as mx import numpy as np def residual_unit(data, num_filter, st...
import errno import os import socket import stat import sys import time from gunicorn import util from gunicorn.six import string_types SD_LISTEN_FDS_START = 3 class BaseSocket(object): def __init__(self, address, conf, log, fd=None): self.log = log self.conf = conf self.cfg_addr = add...
""" Views for managing images. """ from django.conf import settings # noqa from django.forms import ValidationError # noqa from django.forms.widgets import HiddenInput # noqa from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms from horizon import ...
"""Loading unittests.""" import os import re import sys import traceback import types import unittest from fnmatch import fnmatch from unittest2 import case, suite try: from os.path import relpath except ImportError: from unittest2.compatibility import relpath __unittest = True def _CmpToKey(mycmp): ...
import csv from cStringIO import StringIO from django.views.generic import TemplateView from django.utils.decorators import method_decorator from django.contrib.auth.decorators import user_passes_test from django.http import HttpResponse from . import models as hs_tracking class UseTrackingView(TemplateView): t...
#Your code here #You can import some modules or create additional functions def checkio(maze_map): #replace this for solution #This is just example for first maze MOVE = {"S": (1, 0), "N": (-1, 0), "W": (0, -1), "E": (0, 1)} copy_maze_map = [row[:] for row in maze_map] #print type(copy_maze_map) ...
# -*- coding: utf-8 -*- """ The module :mod:`openerp.tests.common` provides unittest2 test cases and a few helpers and classes to write tests. """ import errno import glob import importlib import json import logging import os import select import subprocess import threading import time import itertools import unittest...
import pygame import random from pygame.locals import* pygame.init() x = 800 y = 600 janela = pygame.display.set_mode((x, y)) fundo_verde = (4, 166, 1) # cor do fundo da tela cor_letra = (0, 0, 0) # cor da letra cor_cursor = (50, 60, 50) cor_cobra = (255, 55, 255) red = (255, 0, 0) # s...
from tests.unittest import HomeserverTestCase class EndToEndKeyStoreTestCase(HomeserverTestCase): def prepare(self, reactor, clock, hs): self.store = hs.get_datastore() def test_key_without_device_name(self): now = 1470174257070 json = {"key": "value"} self.get_success(self.s...
from datetime import datetime # exceptions --------------------------------------------------------------- {{{ class OSXDefaultsException(Exception): pass # /exceptions -------------------------------------------------------------- }}} # class MacDefaults -------------------------------------------------------- {...
""" Initial configuration. """ from __future__ import unicode_literals __all__ = ( 'STARTUP_COMMANDS' ) STARTUP_COMMANDS = """ bind-key '"' split-window -v bind-key % split-window -h bind-key c new-window bind-key Right select-pane -R bind-key Left select-pane -L bind-key Up select-pane -U bind-key Down select-pa...
# -*- coding: utf-8 -*- ''' Novell ASAM Runner ================== .. versionadded:: Beryllium Runner to interact with Novell ASAM Fan-Out Driver :codeauthor: Nitin Madhok <<EMAIL>> To use this runner, set up the Novell Fan-Out Driver URL, username and password in the master configuration at ``/etc/salt/master`` or ...
from __future__ import division, print_function, absolute_import import numpy as np from numpy.testing import TestCase, assert_array_almost_equal, dec, \ assert_equal, assert_, run_module_suite from common import FUNCS_TP, FLAPACK_IS_EMPTY, CLAPACK_IS_EMPTY, FUNCS_FLAPACK, \ ...
# -*- coding: utf-8 -*- """ werkzeug.debug ~~~~~~~~~~~~~~ WSGI application traceback debugger. :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import mimetypes from os.path import join, dirname, basename, isfile from werkzeu...
# Tiles, tiles, tiles! Doors, walls.. If it's not a player but it's # on the map, it goes here. # Our imports from constants import Constants class Tile(object): """Represents a tile in vision. Once seen, a tile will show what is currently on it via the game draw method. Once a tile goes out of view, ever...
{ 'name': 'WMS Landed Costs', 'version': '1.1', 'author': 'OpenERP SA', 'summary': 'Landed Costs', 'description': """ Landed Costs Management ======================= This module allows you to easily add extra costs on pickings and decide the split of these costs among their stock moves in order to t...
try: from pyVmomi import vim, vmodl HAS_PYVMOMI = True except ImportError: HAS_PYVMOMI = False def create_vmkernel_adapter(host_system, port_group_name, vlan_id, vswitch_name, ip_address, subnet_mask, mtu, enable_vsan, ena...
"""MongoDB event tracker backend.""" from __future__ import absolute_import import logging import pymongo from pymongo import MongoClient from pymongo.errors import PyMongoError from bson.errors import BSONError from track.backends import BaseBackend log = logging.getLogger(__name__) class MongoBackend(BaseBack...
try: from msrestazure.azure_exceptions import CloudError from msrestazure.azure_configuration import AzureConfiguration from msrest.service_client import ServiceClient import json except ImportError: # This is handled in azure_rm_common AzureConfiguration = object class GenericRestClientConfig...
#!/usr/bin/env python import os, sys, subprocess, logging, dxpy, json, re, socket, getpass, urlparse from posixpath import basename, dirname import common EPILOG = '''Notes: Examples: %(prog)s ''' DEFAULT_APPLET_PROJECT = 'E3 ChIP-seq' KEYFILE = os.path.expanduser("~/keypairs.json") def get_args(): import...
"""An agent that mixes a list of agents with a constant mixture distribution.""" from __future__ import absolute_import from __future__ import division # Using Type Annotations. from __future__ import print_function import abc from typing import List, Optional, Sequence, Text import gin import tensorflow as tf from t...
import re import logging from scrapy.spiders import Spider from scrapy.http import Request, XmlResponse from scrapy.utils.sitemap import Sitemap, sitemap_urls_from_robots from scrapy.utils.gz import gunzip, is_gzipped logger = logging.getLogger(__name__) class SitemapSpider(Spider): sitemap_urls = () sitem...
from django.contrib.auth.models import User from webpos.models import Item, Bill, BillItem def commit_bill(output, reqdata, user): billhd = Bill(customer_name=reqdata['customer_name'], server=User.objects.get(pk=user.id).username) billitms = [] reqquants = reqdata['items'] dbitms = I...
''' Websocket proxy that is compatible with OpenStack Nova. Leverages websockify.py by Joel Martin ''' import Cookie import socket import sys import urlparse from oslo_log import log as logging import websockify from nova.consoleauth import rpcapi as consoleauth_rpcapi from nova import context from nova import excep...
""" Simple utility functions that operate on block metadata. This is a place to put simple functions that operate on block metadata. It allows us to share code between the XModuleMixin and CourseOverview and BlockStructure. """ def url_name_for_block(block): """ Given a block, returns the block's URL name. ...
from vispy import app, gloo vertex = """ attribute vec2 position; void main() { gl_Position = vec4(position, 0.0, 1.0); } """ fragment = """ #include "math/constants.glsl" #include "arrows/arrows.glsl" #include "antialias/antialias.glsl" uniform vec2 iResolution; uniform vec2 iMouse; void main() { const floa...
import sys import os from clone import gpvdm_clone from export_as import export_as from import_archive import import_archive from util import gpvdm_copy_src from scan_io import scan_io from ver import ver from ver import version from import_archive import import_scan_dirs from make_man import make_man from scan_tree ...
from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils.http import urlquote @python_2_unicode_compatible class Author(models.Model): name = models.CharField(max_length=100) def __str__(self): return self.na...
import os import socket import atexit import re from setuptools.extern.six.moves import urllib, http_client, map import pkg_resources from pkg_resources import ResolutionError, ExtractionError try: import ssl except ImportError: ssl = None __all__ = [ 'VerifyingHTTPSHandler', 'find_ca_bundle', 'is_avail...
"""Tests for distutils.dir_util.""" import unittest import os import stat import sys from unittest.mock import patch from distutils import dir_util, errors from distutils.dir_util import (mkpath, remove_tree, create_tree, copy_tree, ensure_relative) from distutils import log from distu...
#!/usr/bin/env python # -*- coding: utf-8 -*- ## # Just enough auxiliary bits to make the translated code work. # # This package provides the support necessary to use the translated # code. The configuration modules used in translation take care of # many semantic differences between Java and Python, while this # pac...
"""Generic USB gadget functionality. """ import struct import usb_constants class Gadget(object): """Basic functionality for a USB device. Implements standard control requests assuming that a subclass will handle class- or vendor-specific requests. """ def __init__(self, device_desc, fs_config_desc, hs_...
# -*- coding: utf-8 -*- """ This test file will verify proper password policy enforcement, which is an option feature """ import json from django.test import TestCase from django.test.client import RequestFactory from django.core.urlresolvers import reverse from django.contrib.auth.models import AnonymousUser from djan...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import json from ansible.compat.tests.mock import patch from ansible.modules.network.dellos10 import dellos10_command from units.modules.utils import set_module_args from .dellos10_module import TestDellos10Module, load_fixture ...
""" CellState Manager """ import copy import datetime import functools from oslo.config import cfg from nova.cells import rpc_driver from nova import context from nova.db import base from nova import exception from nova.openstack.common import fileutils from nova.openstack.common.gettextutils import _ from nova.opens...
import os import sys import json import re import errno import gitnb.config as con import gitnb.utils as utils from gitnb.constants import * import gitnb.default as default class Py2NB(object): """CONVERT NBPY to Notebook Args: path: <str> path to file """ def __init__(self,path,nb_pat...
# WARNING: This file is extremely specific to how Katharine happens to have her # local machines set up. # In particular, to run without modification, you will need: # - An EC2 keypair in ~/Downloads/katharine-keypair.pem # - A keypair for the ycmd servers in ~/.ssh/id_rsa # - The tintin source tree in ~/projects/tint...
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Listing.shipping' db.add_column('listings', 'shipping', ...
from os.path import join as pjoin def configuration(parent_package='', top_path=None, setup_name='setupscons.py'): from numpy.distutils.misc_util import Configuration from numpy.distutils.misc_util import scons_generate_config_py pkgname = 'scipy' config = Configuration(pkgname, parent_package, top_pa...
{ 'name': 'Products & Pricelists', 'version': '1.2', 'category': 'Sales Management', 'depends': ['base', 'decimal_precision', 'mail', 'report'], 'demo': [ 'product_demo.xml', 'product_image_demo.xml', ], 'description': """ This is the base module for managing products and pri...
""" TODO: add table listing each forecast's peak and peak time... """ import datetime import pytz import numpy as np import pandas as pd from pandas.io.sql import read_sql import matplotlib.dates as mdates from pyiem.plot import figure_axes from pyiem.util import get_autoplot_context, get_dbconn from pyiem.exceptions ...
import os from pyxform.errors import PyXFormError from onadata.apps.logger.models import XForm, Instance from test_base import TestBase class TestInputs(TestBase): """ This is where I'll input all files that proved problematic for users when uploading. """ def test_uniqueness_of_group_names_enfo...
import random from canari.maltego.transform import Transform from canari.maltego.entities import URL from canari.framework import EnableDebugWindow from common.entities import NettackerScan from lib.scan.shodan.engine import start from database.db import __logs_by_scan_id as find_log __author__ = 'Shaddy Garg' __cop...
#!/usr/bin/env python """ |jedi| is mostly being tested by what I would call "Blackbox Tests". These tests are just testing the interface and do input/output testing. This makes a lot of sense for |jedi|. Jedi supports so many different code structures, that it is just stupid to write 200'000 unittests in the manner of...
import json import base64 import os from django.core.urlresolvers import reverse from django.test import TestCase, LiveServerTestCase import requests from selenium import webdriver from selenium.webdriver.common.keys import Keys from easter_egg.models import split_image class _HelperTestCase(TestCase): path_to...
import os import subprocess import sys from PyQt5 import QtCore, QtWidgets from ouf.filemodel.proxymodel import FileProxyModel from ouf.view.filenamedelegate import FileNameDelegate from ouf import shortcuts # TODO: modifiers to open in new window # TODO: switch icons / tree # TODO: modify icon size class FileView...
import shutil from snapcraft.internal.errors import MissingCommandError from . import errors # noqa from ._base import BaseRepo # noqa from ._base import fix_pkg_config # noqa from ._platform import _get_repo_for_platform # Imported for backwards compatibility with plugins from ._deb import Ubunt...
"""Typing helpers for ZHA component.""" from typing import TYPE_CHECKING, Callable, TypeVar import zigpy.device import zigpy.endpoint import zigpy.group import zigpy.zcl import zigpy.zdo # pylint: disable=invalid-name CALLABLE_T = TypeVar("CALLABLE_T", bound=Callable) ChannelType = "ZigbeeChannel" ChannelsType = "Ch...
import sys import threading import time from contextlib import contextmanager from .variables import ENV __all__ = ('TraceLogger',) class Trace(object): __slots__ = ('msg', 'verbosity', 'parent', 'children', '_clock', '_start', '_stop') def __init__(self, msg, parent=None, verbosity=1, clock=time): self.ms...
from BTL import BTFailure def decode_int(x, f): f += 1 newf = x.index('e', f) n = int(x[f:newf]) if x[f] == '-': if x[f + 1] == '0': raise ValueError elif x[f] == '0' and newf != f+1: raise ValueError return (n, newf+1) def decode_string(x, f): colon = x.index(...
import time import logging from twisted.internet.task import LoopingCall import deluge from deluge.plugins.pluginbase import CorePluginBase from deluge import component from deluge import configmanager from deluge.core.rpcserver import export DEFAULT_PREFS = { "test": "NiNiNi", "update_interval": 1, #2 second...
from ctypes import c_char_p, c_double, c_int, c_void_p, POINTER from django.contrib.gis.gdal.envelope import OGREnvelope from django.contrib.gis.gdal.libgdal import lgdal from django.contrib.gis.gdal.prototypes.errcheck import check_envelope from django.contrib.gis.gdal.prototypes.generation import (const_string_output...
from openstack.network import network_service from openstack import resource class MeteringLabel(resource.Resource): resource_key = 'metering_label' resources_key = 'metering_labels' base_path = '/metering/metering-labels' service = network_service.NetworkService() # capabilities allow_create...
""" This module contains query handlers responsible for calculus queries: infinitesimal, bounded, etc. """ from __future__ import print_function, division from sympy.logic.boolalg import conjuncts from sympy.assumptions import Q, ask from sympy.assumptions.handlers import CommonHandler, test_closed_group from sympy.ma...
"""Test converted models """ import os import argparse import sys import logging import mxnet as mx from convert_caffe_modelzoo import convert_caffe_model, get_model_meta_info, download_caffe_model from compare_layers import convert_and_compare_caffe_to_mxnet curr_path = os.path.abspath(os.path.dirname(__file__)) sys....
# -*- coding: utf-8 -*- from importlib import reload from io import StringIO import pytest from pyscaffold import termui @pytest.fixture(scope="module") def after(): # Reload termui after tests to ensure constants are calculated # with original logic (without mocks). yield reload(termui) @pytest....
from django.db import models from django.utils.translation import ugettext_lazy as _ from django.core.urlresolvers import reverse from django.contrib import admin class Patient(models.Model): GENDER = ( ('F', 'Female'), ('M', 'Male'), ) MARRIAGE_STATUS = ( ('S', 'Single'), ...
from __future__ import absolute_import from django.utils.translation import ugettext as _ from zerver.lib.actions import check_send_message from zerver.lib.response import json_success, json_error from zerver.decorator import REQ, has_request_variables, api_key_only_webhook_view from zerver.models import UserProfile ...
""" PT-specific Form helpers """ from __future__ import unicode_literals import re from django.core.validators import EMPTY_VALUES from django.forms import ValidationError from django.forms.fields import Field, RegexField from django.utils.encoding import smart_text from django.utils.translation import ugettext_lazy ...
#!/usr/bin/env python #-*- coding:utf-8 -*- """ QCheckBox demo Tested environment: Mac OS X 10.6.8 http://doc.qt.nokia.com/latest/qcheckbox.html http://doc.qt.nokia.com/latest/qabstractbutton.html http://doc.qt.nokia.com/latest/qt.html#CheckState-enum """ import sys try: from PySide import QtCore from Py...