content
string
"""Create a shaped window to show mouse events. Thanks to mathias.gumz for the original code. """ import gobject import gtk import lazy_pixbuf_creator class ShapedWindow(gtk.Window): """Create a window shaped as fname.""" def __init__(self, fname, scale=1.0, timeout=0.2): gtk.Window.__init__(self) self.c...
""" Certificate end-points used by the student support UI. See lms/djangoapps/support for more details. """ import logging from functools import wraps from django.http import ( HttpResponse, HttpResponseBadRequest, HttpResponseForbidden, HttpResponseServerError ) from django.views.decorators.http imp...
# coding: utf-8 """ Copyright 2015 SmartBear Software 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 l...
from __future__ import absolute_import from .resource import Resource class Aggregate(object): def __init__(self): self.resources = [] self.containers = {} # of resources, not slivers def add_resources(self, resources): self.resources.extend(resources) def catalog(self, containe...
'''This file is currently hand-coded; I don't have a MESA header file to build off. ''' __docformat__ = 'restructuredtext' __version__ = '$Id$' import ctypes from ctypes import * from pyglet.gl.lib import link_GLX as _link_function glXSwapIntervalMESA = _link_function('glXSwapIntervalMESA', c_int, [c_int], 'MESA_swa...
import cvxopt import cvxpy.problems.problem as problem import cvxpy.settings as s from boolean import Boolean def branch(booleans): bool_vals = (b for b in booleans if not b.fix_values) # pick *a* boolean variable to branch on # choose the most ambivalent one (smallest distance to 0.5) # NOTE: if there...
""" Keyboard test application """ import urwid.curses_display import urwid.raw_display import urwid.web_display import urwid import sys if urwid.web_display.is_web_request(): Screen = urwid.web_display.Screen else: if len(sys.argv)>1 and sys.argv[1][:1] == "r": Screen = urwid.raw_display.Screen e...
""" This file contains tasks that are designed to perform background operations on the running state of a course. At present, these tasks all operate on StudentModule objects in one way or another, so they share a visitor architecture. Each task defines an "update function" that takes a module_descriptor, a particula...
"""Performance tests for the splash page.""" from core.tests.performance_tests import base from core.tests.performance_tests import test_config class SplashPagePerformanceTest(base.TestBase): """Performance tests for the splash page.""" PAGE_KEY = test_config.PAGE_KEY_SPLASH def setUp(self): sup...
#!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2018 (ita) """ C# support. A simple example:: def configure(conf): conf.load('cs') def build(bld): bld(features='cs', source='main.cs', gen='foo') Note that the configuration may compile C# snippets:: FRAG = ''' namespace Moo { public class Test ...
from __future__ import print_function # $example on$ from pyspark.ml.feature import StringIndexer # $example off$ from pyspark.sql import SparkSession if __name__ == "__main__": spark = SparkSession\ .builder\ .appName("StringIndexerExample")\ .getOrCreate() # $example on$ df = sp...
from __future__ import ( unicode_literals, absolute_import, print_function, division, ) str = type('') import warnings import pigpio import os from . import Pin from .data import pi_info from ..exc import ( PinInvalidFunction, PinSetInput, PinFixedPull, PinInvalidPull, PinInval...
""" Copyright 2017 Nicholas Moehle This file is part of CVXPY-CODEGEN. CVXPY-CODEGEN 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 License, or (at your option) any later version. CVXPY...
import unittest, time, sys sys.path.extend(['.','..','py']) import h2o, h2o_cmd, h2o_glm, h2o_hosts, h2o_import as h2i, h2o_util class Basic(unittest.TestCase): def tearDown(self): h2o.check_sandbox_for_errors() @classmethod def setUpClass(cls): global localhost localhost = h2o.dec...
import Framework import datetime class Issue(Framework.TestCase): def setUp(self): Framework.TestCase.setUp(self) self.repo = self.g.get_user().get_repo("PyGithub") self.issue = self.repo.get_issue(28) def testAttributes(self): self.assertEqual(self.issue.assignee.login, "jac...
""" Python 'mbcs' Codec for Windows Cloned by Mark Hammond (<EMAIL>) from ascii.py, which was written by Marc-Andre Lemburg (<EMAIL>). (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. """ # Import them explicitly to cause an ImportError # on non-Windows systems from codecs import mbcs_encode, mbcs_decode # for...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'core'} DOCUMENTATION = r''' --- module: win_shell short_description: Execute shell commands on target hosts version_added: 2.2 description: - The C(win_shell) module takes the command nam...
import os import re from subprocess import Popen, PIPE import sys from util import die # Clone of subprocess.CalledProcessError (not in Python 2.4) class CalledProcessError(Exception): def __init__(self, returncode, cmd): self.returncode = returncode self.cmd = cmd def __str__(self): ...
""" Domain Remap Middleware Middleware that translates container and account parts of a domain to path parameters that the proxy server understands. container.account.storageurl/object gets translated to container.account.storageurl/path_root/account/container/object account.storageurl/path_root/container/object get...
{ "name" : "Romania - Accounting", "version" : "1.0", "author" : "TOTAL PC SYSTEMS", "website": "http://www.erpsystems.ro", "category" : "Localization/Account Charts", "depends" : ['account','account_chart','base_vat'], "description": """ This is the module to manage the accounting chart, VA...
""" Provides a class and a global access point for a log polling object. The module stores a LogPollingThread instance in the module-level variable named log_poller. Call initialize() on this object as early as possible to set it up, and then call start() to start the thread. Files to be watched can be added to the p...
import copy import os import sys from importlib import import_module from django.utils import six def import_string(dotted_path): """ Import a dotted module path and return the attribute/class designated by the last name in the path. Raise ImportError if the import failed. """ try: module...
import numpy as np import copy from random import randrange """ We will check across the diagonal top left to bottom right, This will allow us to check all possible solutions for a win """ def threecheck(board): win=False #Top Left if board[0]!=0: #Row T-L to T-R ...
""" Tests for database migrations. This test case reads the configuration file test_migrations.conf for database connection settings to use in the tests. For each connection found in the config file, the test case runs a series of test cases to ensure that migrations work properly. There are also "opportunistic" tests...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: win_lineinfile short_description: Ensure a particular line is in a file, or replace an existing line using a back-referenced regular expression des...
from flask import jsonify, request, g, abort, url_for, current_app from .. import db from ..models import Post, Permission from . import api from .decorators import permission_required from .errors import forbidden @api.route('/posts/') def get_posts(): page = request.args.get('page', 1, type=int) pagination =...
# -*- coding: utf-8 -*- """ *************************************************************************** HypsometricCurves.py --------------------- Date : November 2014 Copyright : (C) 2014 by Alexander Bruy Email : alexander dot bruy at gmail dot com ******...
import copy import docker import pytest from ..helpers import force_leave_swarm, requires_api_version from .base import BaseAPIIntegrationTest class SwarmTest(BaseAPIIntegrationTest): def setUp(self): super(SwarmTest, self).setUp() force_leave_swarm(self.client) self._unlock_key = None ...
import unittest import json import re from base64 import b64encode from flask import url_for from app import create_app, db from app.models import User, Role, Post, Comment class APITestCase(unittest.TestCase): def setUp(self): self.app = create_app('testing') self.app_context = self.app.app_conte...
from swilena import * # Generic iterator interface. b = box2d(2, 3) p = iter(b) while p.is_valid(): print p.site() p.advance() print # Python's iterator interface. # We cannot use # # for p in box2d(2, 3): # print p # # here because the box2d is a temporary object that may be collected # before the end o...
import django.contrib.admin.models from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('contenttypes', '__first__'), ] operations = [ migratio...
import logging import time import unittest from telemetry import decorators from telemetry.internal.platform.power_monitor import msr_power_monitor from telemetry.internal.platform import win_platform_backend class MsrPowerMonitorTest(unittest.TestCase): @decorators.Enabled('xp', 'win7', 'win8') # http://crbug.co...
""" Synchronization primitives: - reader-writer lock (preference to writers) (Contributed to Django by <EMAIL>) """ try: import threading except ImportError: import dummy_threading as threading class RWLock: """ Classic implementation of reader-writer lock with preference to writers. Reader...
import argparse import collections import os import sys import time from distutils.version import StrictVersion try: import json except: import simplejson as json import os_client_config import shade import shade.inventory CONFIG_FILES = ['/etc/ansible/openstack.yaml', '/etc/ansible/openstack.yml'] def get...
import os import verifier class FileVerifier(verifier.Verifier): """Verifies that the current files match the expectation dictionaries.""" def _VerifyExpectation(self, expectation_name, expectation, variable_expander): """Overridden from verifier.Verifier. This method will thro...
from amoco.logger import Log logger = Log(__name__) from .env64 import * from .utils import * from amoco.cas.utils import * def i_ADC(i,fmap): fmap[pc] = fmap[pc]+i.length op1,op2 = map(fmap,i.operands[1:]) x,carry,overflow = AddWithCarry(op1, op2, fmap(C)) if i.setflags: fmap[N] = x<0 ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from .common import InfoExtractor from ..compat import compat_parse_qs from ..utils import ( int_or_none, parse_duration, parse_iso8601, xpath_text, ) class FolketingetIE(InfoExtractor): IE_DESC = 'Folketinget (ft.dk; Danish parliame...
# -*- 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 model 'Folder' db.create_table(u'rss_folder', ( (u'i...
from __future__ import absolute_import, division, unicode_literals from xml.dom import minidom, Node import weakref from . import _base from .. import constants from ..constants import namespaces from ..utils import moduleFactoryFactory def getDomBuilder(DomImplementation): Dom = DomImplementation class A...
from .fetchers import NUMetadatasFetcher from .fetchers import NUGlobalMetadatasFetcher from bambou import NURESTObject class NUMACFilterProfile(NURESTObject): """ Represents a MACFilterProfile in the VSD Notes: 7x50 MAC Filter profile """ __rest_name__ = "macfilterprofile" __...
""" Fixer for itertools.(imap|ifilter|izip) --> (map|filter|zip) and itertools.ifilterfalse --> itertools.filterfalse (bugs 2360-2363) imports from itertools are fixed in fix_itertools_import.py If itertools is imported as something else (ie: import itertools as it; it.izip(spam, eggs)) method calls w...
""" Schema differencing support. """ import logging import sqlalchemy from sqlalchemy.types import Float log = logging.getLogger(__name__) def getDiffOfModelAgainstDatabase(metadata, engine, excludeTables=None): """ Return differences of model against database. :return: object which will evaluate to...
from email_exact import email_exact class email_domain(email_exact): '''Search objects by domain name of email address. Beware of match_first here, this is most likely to get it wrong (gmail)''' name = 'Domain of email address' def search_matches(self, cr, uid, conf, mail_message, mail_message_org): ...
from openerp.osv import fields,osv from openerp import tools class crm_partner_report_assign(osv.osv): """ CRM Lead Report """ _name = "crm.partner.report.assign" _auto = False _description = "CRM Partner Report" _columns = { 'partner_id': fields.many2one('res.partner', 'Partner', required...
from openerp.osv import fields, osv class email_template_preview(osv.osv_memory): _inherit = "email.template" _name = "email_template.preview" _description = "Email Template Preview" def _get_records(self, cr, uid, context=None): """ Return Records of particular Email Template's Model ...
# -*- coding: utf-8 -*- """ blinkpy is an unofficial api for the Blink security camera system. repo url: https://github.com/fronzbot/blinkpy Original protocol hacking by MattTW : https://github.com/MattTW/BlinkMonitorProtocol Published under the MIT license - See LICENSE file for more details. "Blink Wire-Free HS Ho...
from gourmet.plugin import ImporterPlugin from gourmet.importers.importer import Tester from gourmet.threadManager import get_thread_manager from gourmet.importers.interactive_importer import InteractiveImporter from gourmet import check_encodings import os.path import fnmatch from gettext import gettext as _ MAX_PLAI...
from django.db import models from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.core.exceptions import ValidationError from django.utils.html import strip_tags import json from xmodule_django.models import CourseKeyField class Note(models.Model): user = models.Fo...
from telemetry.core import util from telemetry.page.actions import click_element from telemetry.page.actions import wait from telemetry.unittest import tab_test_case class ClickElementActionTest(tab_test_case.TabTestCase): def testClickWithSelectorWaitForNavigation(self): self._browser.SetHTTPServerDirectories(u...
"""Package contenant les commandes du module crafting.""" from secondaires.crafting.commandes import guilde
import os import unittest2 as unittest from nupic.support.consoleprinter import ConsolePrinterMixin, Tee # Class used for testing class MyClass(ConsolePrinterMixin): def __init__(self): ConsolePrinterMixin.__init__(self) def run(self): for i in xrange(0, 4): self.cPrint(i, "message at level %...
{ 'name': 'French Payroll', 'category': 'Localization/Payroll', 'author': 'Yannick Buron (SYNERPGY)', 'depends': ['hr_payroll', 'l10n_fr'], 'version': '1.0', 'description': """ French Payroll Rules. ===================== - Configuration of hr_payroll for French localization - All main c...
# -*- coding: utf-8 -*- ''' This file can be placed in the simulations directory of a neuroConstruct project and when run it will search in all subdirectories for time.dat, and if it doesn't find it, will try running pullsim.sh, which will attempt to retrieve the saved data from a remotely executed simulation ''' im...
"""Adds xref targets to the top of files.""" import sys import os testing = False DONT_TOUCH = ( './index.txt', ) def target_name(fn): if fn.endswith('.txt'): fn = fn[:-4] return '_' + fn.lstrip('./').replace('/', '-') def process_file(fn, lines): lines.insert(0, '\n') lines...
from __future__ import unicode_literals import sys from django.utils import six from django.utils.encoding import force_str from django.utils.six.moves import http_cookies # Some versions of Python 2.7 and later won't need this encoding bug fix: _cookie_encodes_correctly = http_cookies.SimpleCookie().value_encode(';...
N_ = lambda x : x PINYIN_DICT = { "a" : 1, "ai" : 2, "an" : 3, "ang" : 4, "ao" : 5, "ba" : 6, "bai" : 7, "ban" : 8, "bang" : 9, "bao" : 10, "bei" : 11, "ben" : 12, "beng" : 13, "bi" : 14, "bian" : 15, "biao" : 16, "bie" : 17, "bin" : 18, "bing" : 19, "bo" : 20, "bu" : 21, "ca" : 22, "cai" : 23, "can...
"""Testing utilities. Not part of the public API!""" from astropy.wcs import WCS from astropy.wcs.wcsapi import BaseHighLevelWCS def assert_wcs_seem_equal(wcs1, wcs2): """Just checks a few attributes to make sure wcs instances seem to be equal. """ if wcs1 is None and wcs2 is None: return ...
from . import models, serializers, utils from datetime import datetime, timedelta from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import status, permissions class Process(APIView): """ These apis are for general purpose """ def get(self, req...
from __future__ import division import os import tempfile import time from helpers import unittest import luigi import luigi.notifications import luigi.scheduler import luigi.worker luigi.notifications.DEBUG = True tempdir = tempfile.mkdtemp() class DummyTask(luigi.Task): task_id = luigi.Parameter() def ...
"""Ways to select hostname records to test.""" import math import random # When running a weighted distribution, never repeat a domain more than this: MAX_REPEAT = 3 TYPES = { 'automatic': 'Pick the most appropriate selector type for the data source', 'weighted': 'Chooses based on a weighted distribution, pr...
""" Check that all of the certs on all service endpoints validate. """ import unittest from tests.integration import ServiceCertVerificationTest import boto.ec2.autoscale class AutoscaleCertVerificationTest(unittest.TestCase, ServiceCertVerificationTest): autoscale = True regions = boto.ec2.autoscale.region...
#!/usr/bin/env python # # Performs a release of Review Board. This can only be run by the core # developers with release permissions. # import os import re import subprocess import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..")) from reviewboard import get_package_version, VERSION PY_VER...
#!/usr/bin/env python # - * - coding: UTF-8 - * - """ This script generates tests text-emphasis-line-height-001 ~ 004 except 001z. They test the line height expansion in different directions. This script outputs a list of all tests it generated in the format of Mozilla reftest.list to the stdout. """ from __future__ ...
# coding: utf-8 import datetime from django.core.management.base import BaseCommand from registration.models import RegistrationProfile from stats.models import ValueStore class Command(BaseCommand): help = 'creates bulk shifts from existing data' args = "" option_list = BaseCommand.option_list d...
"""This file contains code for use with "Think Stats", by Allen B. Downey, available from greenteapress.com Copyright 2014 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from __future__ import print_function import sys from operator import itemgetter import first import thinkstats2 de...
# -*- coding: utf-8 -*- from django.conf import settings from django.test import TestCase from tastypie.exceptions import BadRequest from tastypie.paginator import Paginator from core.models import Note from core.tests.resources import NoteResource from django.db import reset_queries from django.http import QueryDict ...
""" @author: AAron Walters @license: GNU General Public License 2.0 @contact: <EMAIL> @organization: Volatility Foundation """ import volatility.debug as debug import volatility.registry as registry import volatility.addrspace as addrspace import volatility.constants as constants import volatility.conf...
"""Geary Unittest.""" import unittest from ... import open as popen from ... import examples from .. import geary import numpy as np from ...common import pandas PANDAS_EXTINCT = pandas is None class Geary_Tester(unittest.TestCase): """Geary class for unit tests.""" def setUp(self): self.w = popen(ex...
from __future__ import absolute_import from optparse import make_option from django.core.management.base import BaseCommand from zerver.models import get_user_profile_by_email, UserMessage from zerver.views.old_messages import get_old_messages_backend import cProfile import logging from zerver.middleware import LogReq...
""" Verifies that .so files that are order only dependencies are specified by their install location rather than by their alias. """ # Python 2.5 needs this for the with statement. from __future__ import with_statement import os import TestGyp test = TestGyp.TestGyp(formats=['make']) test.run_gyp('shared_dependency...
# -*- coding: utf-8 -*- """ pygments.console ~~~~~~~~~~~~~~~~ Format colored console output. :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ esc = "\x1b[" codes = {} codes[""] = "" codes["reset"] = esc + "39;49;00m" codes["bold"] = ...
__author__ = 'Alexander Rüedlinger' from xwot.model import Context as XWOTContext from xwot.model import Sensor as XWOTSensor from xwot.model import Device as XWOTDevice from xwot.model import Model from xwot.model import BaseModel class LightBulb(XWOTDevice, BaseModel): __mutable_props__ = ['name', 'streetAddr...
#!/usr/bin/env python # -*- coding: utf-8 -*- import warnings from pytest import mark from translate.tools import pretranslate from translate.convert import test_convert from translate.misc import wStringIO from translate.storage import po from translate.storage import xliff class TestPretranslate: xliff_skele...
import compileall compileall.compile_dir('package') # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
""" Audio Tag --------- This implements a Liquid-style audio tag for Pelican, based on the pelican video plugin [1]_ Syntax ------ {% audio url/to/audio [url/to/audio] [/url/to/audio] %} Example ------- {% audio http://example.tld/foo.mp3 http://example.tld/foo.ogg %} Output ------ <audio controls><source src="http:...
"""A tensor pool stores values from an input tensor and returns a stored one. See the following papers for more details. 1) `Learning from simulated and unsupervised images through adversarial training` (https://arxiv.org/abs/1612.07828). 2) `Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial ...
# -*- coding: utf-8 -*- """ equip.rewriter.simple ~~~~~~~~~~~~~~~~~~~~~ A simplified interface (yet the main one) to handle the injection of instrumentation code. :copyright: (c) 2014 by Romain Gaucher (@rgaucher) :license: Apache 2, see LICENSE for more details. """ import os import copy from ..utils.lo...
#!/usr/bin/python import dbus import sys, os import time import gobject from dbus.mainloop.glib import DBusGMainLoop WPAS_DBUS_SERVICE = "fi.w1.wpa_supplicant1" WPAS_DBUS_INTERFACE = "fi.w1.wpa_supplicant1" WPAS_DBUS_OPATH = "/fi/w1/wpa_supplicant1" WPAS_DBUS_INTERFACES_INTERFACE = "fi.w1.wpa_supplicant1.Interface" ...
import requests import urllib import json def main(): module = AnsibleModule( argument_spec = dict( state = dict(default='present', choices=['present', 'absent'], type='str'), name = dict(required=True, type='str'), login_user = dict(default='guest', type='str'), ...
import logging import unittest from telemetry import decorators from telemetry.internal.backends import android_command_line_backend from telemetry.testing import options_for_unittests from devil.android import device_utils class _MockBackendSettings(object): pseudo_exec_name = 'chrome' def __init__(self, path...
"""Support for LCN scenes.""" import pypck from homeassistant.components.scene import Scene from homeassistant.const import CONF_ADDRESS from . import LcnDevice from .const import ( CONF_CONNECTIONS, CONF_OUTPUTS, CONF_REGISTER, CONF_SCENE, CONF_TRANSITION, DATA_LCN, OUTPUT_PORTS, ) from ....
import struct import time from UM.Logger import Logger from UM.Mesh.MeshWriter import MeshWriter from UM.i18n import i18nCatalog catalog = i18nCatalog("uranium") class STLWriter(MeshWriter): def write(self, stream, nodes, mode = MeshWriter.OutputMode.TextMode): """Write the specified sequence of nodes to...
def main(request, response): def fail(message): response.content = "FAIL " + request.method + ": " + str(message) response.status = 400 def getState(token): server_state = request.server.stash.take(token) if not server_state: return "Uninitialized" return ser...
""" Formatting... """ from geopy import units from geopy.compat import py3k if py3k: unichr = chr # pylint: disable=W0622 # Unicode characters for symbols that appear in coordinate strings. DEGREE = unichr(176) PRIME = unichr(8242) DOUBLE_PRIME = unichr(8243) ASCII_DEGREE = '' ASCII_PRIME = "'" ASCII_DOUBLE_PRIM...
# The following exec statement (or something like it) is needed to # prevent SyntaxError on Python < 2.5. Even though this is a test, # SyntaxErrors are not acceptable; on Debian systems, they block # byte-compilation during install and thus cause the package to fail # to install. import sys if sys.version_info[:2] >=...
try: import pyrax HAS_PYRAX = True except ImportError: HAS_PYRAX = False def rax_asp(module, at=None, change=0, cron=None, cooldown=300, desired_capacity=0, is_percent=False, name=None, policy_type=None, scaling_group=None, state='present'): changed = False au = pyrax.auto...
import logging import re from autotest.client.shared import utils, error from autotest.client import os_dep from virttest import libvirt_vm, virsh, utils_libvirtd, utils_misc from virttest.libvirt_xml import capability_xml def run(test, params, env): """ Test the command virsh capabilities (1) Call virsh...
#!/usr/bin/env python2 # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL v3' __copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>' __docformat__ = 'restructuredtext en' ...
#!/usr/bin/env python import sys _LINUX_PARTITIONS_FILE_NAME = '/proc/partitions' _LINUX_PARTITION_SIZE_MULTIPLIER = 1024 _LINUX_DISK_TYPE_NUMBERS = (3, 8) class DiskInfo(object): def get_disk_full_list(self): raise NotImplementedError("Should be called in subclasses") class DiskInfoLinux(DiskInfo): ...
import os import time import traceback from typing import Callable from sqlalchemy import event def _pretty_format_sql(text: str): import pygments from pygments.formatters.terminal import TerminalFormatter from pygments.lexers.sql import SqlLexer text = pygments.highlight(code=text, formatter=Termin...
import numpy as np from ..cython.cpu_nms import cpu_nms try: from ..cython.gpu_nms import gpu_nms except ImportError: gpu_nms = None def py_nms_wrapper(thresh): def _nms(dets): return nms(dets, thresh) return _nms def cpu_nms_wrapper(thresh): def _nms(dets): return cpu_nms(dets, ...
"""WSGI Routers for the Trust service.""" import functools from keystone.common import json_home from keystone.common import wsgi from keystone.trust import controllers _build_resource_relation = functools.partial( json_home.build_v3_extension_resource_relation, extension_name='OS-TRUST', extension_version=...
"""SCons.Platform.win32 Platform-specific initialization for Win32 systems. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method. """ # # Copyright (c) 2001 - 2016 The SCons Foundation # # Permission is hereby...
import pygame import sys import time import serial ser = serial.Serial('/dev/ttyACM0',115200) pygame.init() pygame.joystick.init() print (pygame.joystick.get_count()) _joystick = pygame.joystick.Joystick(0) _joystick.init() print (_joystick.get_init()) print (_joystick.get_id()) print (_joystick.get_name()) print (_...
from django.conf import settings import os.path EXIFTOOL = getattr(settings, 'AA_EXIFTOOL', 'exiftool') FFMPEG = getattr(settings, 'AA_FFMPEG', 'ffmpeg') IDENTIFY = getattr(settings, 'AA_IDENTIFY', 'identify') CONVERT = getattr(settings, 'AA_CONVERT', 'convert') USER_AGENT = getattr(settings, 'AA_USER_AGENT', "Mozil...
try: import urllib.request as urllib_request import urllib.error as urllib_error import io except ImportError: import urllib2 as urllib_request import urllib2 as urllib_error import simplejson as json from ssl import SSLError import socket from .api import TwitterCall, wrap_response import sys cl...
""" Deployment for moztrap Requires commander (https://github.com/oremj/commander) which is installed on the systems that need it. """ import os import sys sys.path.append(os.path.dirname(os.path.abspath(__file__))) from commander.deploy import task, hostgroups import commander_settings as settings @task def upda...
"""Tokenize C++ source code.""" __author__ = '<EMAIL> (Neal Norwitz)' try: # Python 3.x import builtins except ImportError: # Python 2.x import __builtin__ as builtins import sys from cpp import utils if not hasattr(builtins, 'set'): # Nominal support for Python 2.3. from sets import Set...
ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'version': '1.0'} try: from ovirtsdk.api import API from ovirtsdk.xml import params HAS_OVIRTSDK = True except ImportError: HAS_OVIRTSDK = False # -------------------------------------------...
import errno import re import os import sys import subprocess # Note that gcc uses unicode, which may depend on the locale. TODO: # force LANG to be set to en_US.UTF-8 to get consistent warnings. allowed_warnings = set([ "return_address.c:62", ]) # Capture the name of the object file, can find it. ofile = None...