content stringlengths 4 20k |
|---|
import optparse
import shlex
import subprocess
from maas_common import metric
from maas_common import print_output
from maas_common import status_err
from maas_common import status_ok
def galera_check(arg):
proc = subprocess.Popen(shlex.split(arg),
stdout=subprocess.PIPE,
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
from pyqiwi import __version__
setup(
name='pyqiwi',
version=__version__,
author='Andrey',
author_email='<EMAIL>',
description='Client for QIWI payment system',
license='MIT',
url='https://github.com/onrik/pyqiwi',
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Script to parse Amcache.hve files."""
import argparse
import logging
import sys
from dtformats import amcache
from dtformats import output_writers
def Main():
"""The main program function.
Returns:
bool: True if successful or False if not.
"""
argument_p... |
from unittest import TestCase
from simplejson.compat import StringIO, long_type, b, binary_type, PY3
import simplejson as json
def as_text_type(s):
if PY3 and isinstance(s, binary_type):
return s.decode('ascii')
return s
class TestDump(TestCase):
def test_dump(self):
sio = StringIO()
... |
import sys
import os
import getopt
import h5py
import numpy as np
import matplotlib.pyplot as plt
import _readfile as readfile
def Usage():
print '''
************************************************************************
************************************************************************
Calculates the... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
# import module snippets
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ec2 import boto3_conn, get_aws_connection_info, ec2_argument_spec, camel_di... |
from google.net.proto import ProtocolBuffer
import array
import dummy_thread as thread
__pychecker__ = """maxreturns=0 maxbranches=0 no-callinit
unusednames=printElemNumber,debug_strs no-special"""
if hasattr(ProtocolBuffer, 'ExtendableProtocolMessage'):
_extension_runtime = True
_ExtendablePro... |
#!/usr/bin/env python
# This file should be compatible with both Python 2 and 3.
# If it is not, please file a bug report.
"""
High level operations on subusers.
"""
#external imports
import sys
import os
import shutil
#internal imports
import subuserlib.resolve
import subuserlib.classes.subuser
import subuserlib.ver... |
#!/usr/bin/python
"""
process_file(filename)
takes templated file .xxx.src and produces .xxx file where .xxx
is .pyf .f90 or .f using the following template rules:
'<..>' denotes a template.
All function and subroutine blocks in a source file with names that
contain '<..>' will be replicated according to ... |
{
'name' : 'Email Templates',
'version' : '1.1',
'author' : 'OpenERP,OpenLabs',
'website' : 'http://openerp.com',
'category' : 'Marketing',
'depends' : ['mail'],
'description': """
Email Templating (simplified version of the original Power Email by Openlabs).
================================... |
from django.core.urlresolvers import reverse
from django import http
from mox import IsA # noqa
from openstack_dashboard import api
from openstack_dashboard.test import helpers as test
INDEX_URL = reverse('horizon:project:database_backups:index')
BACKUP_URL = reverse('horizon:project:database_backups:create')
DETAIL... |
"""
Custom-written pure go meterpreter/reverse_http stager.
Module built by @b00stfr3ak44
"""
from modules.common import helpers
from random import randint
class Payload:
def __init__(self):
# required options
self.description = "pure windows/meterpreter/reverse_http stager, no shellcode"
... |
"""Arcam media player."""
import logging
from arcam.fmj import DecodeMode2CH, DecodeModeMCH, IncomingAudioFormat, SourceCodes
from arcam.fmj.state import State
from homeassistant import config_entries
from homeassistant.components.media_player import BrowseMedia, MediaPlayerEntity
from homeassistant.components.media_... |
logical_adresses = [
'TV',
'Recording_1',
'Recording_2',
'Tuner_1',
'Playback_1',
'AudioSystem',
'Tuner2',
'Tuner3',
'Playback_2',
'Recording_3',
'Tuner_4',
'Playback_3',
'Backup_1',
'Backup_2',
'FreeUse',
]
# List taken from LibCEC.
opcodes = {
0x82: 'AC... |
# IEEE 802.1aq - Shorest Path Bridging Mac-in-mac (SPBM):
# Ethernet based link state protocol that enables Layer 2 Unicast, Layer 2 Multicast, Layer 3 Unicast, and Layer 3 Multicast virtualized services
# https://en.wikipedia.org/wiki/IEEE_802.1aq
# Modeled after the scapy VXLAN contribution
#
########################... |
from PyQt4 import QtCore, QtGui
class MyTableWidget():
def __init__(self,TW,listadecolumnas, listadealineaciones = [], indexColumn = 1, widthColumn = 400):
self.__widget = TW
quitAction = QtGui.QAction("Quit", self.__widget)
self.__widget.addAction(quitAction)
self.__widg... |
"""Command for detaching a disk from an instance."""
import copy
from googlecloudsdk.api_lib.compute import base_classes
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.command_lib.compute import flags
from googlecloudsdk.command_lib.compute.instances import flags as instance_flags
class DetachDi... |
#! /usr/bin/env python
#
# GUI module generated by PAGE version 4.7
# In conjunction with Tcl version 8.6
# Mar 22, 2016 10:04:14 AM
import sys
try:
from Tkinter import *
except ImportError:
from tkinter import *
try:
import ttk
py3 = 0
except ImportError:
import tkinter.ttk as ttk
py3 = 1
... |
__version__ = "0.3"
from PIL import Image, ImageFile, ImagePalette, _binary
i16 = _binary.i16be
i32 = _binary.i32be
def _accept(prefix):
return len(prefix) >= 4 and i32(prefix) == 0x59a66a95
##
# Image plugin for Sun raster files.
class SunImageFile(ImageFile.ImageFile):
format = "SUN"
format_descr... |
#!/usr/bin/env python
"""
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import httplib
import re
from lib.core.common import readInput
from lib.core.data import kb
from lib.core.data import logger
from lib.core.exception import SqlmapSyntaxExcept... |
from openerp.tests import common
import zipfile
import StringIO
class test_prototype_module_export(common.TransactionCase):
def setUp(self):
super(test_prototype_module_export, self).setUp()
self.main_model = self.env['module_prototyper.module.export']
self.prototype_model = self.env['modu... |
from bpy import data, types
from .. import utilities, logger
def _lamp(func):
"""
:param func:
"""
def inner(name, *args, **kwargs):
"""
:param name:
:param *args:
:param **kwargs:
"""
if isinstance(name, types.Lamp):
lamp = name
... |
from __init__ import *
from BaseSpider import BaseSpider
import json, time
class CFSpider(BaseSpider):
def __init__(self):
BaseSpider.__init__(self)
self.login_status = True
def get_user_info(self):
url = 'http://codeforces.com/api/user.info?handles='+self.account.nickname
pag... |
import unittest
import IECore
import IECoreRI
import os.path
import os
class DetailTest( IECoreRI.TestCase ) :
def test( self ) :
r = IECoreRI.Renderer( "test/IECoreRI/output/testDetail.rib" )
r.worldBegin()
r.setAttribute( "ri:detail", IECore.Box3f( IECore.V3f( 1, 2, 3 ), IECore.V3f( 4, 5, 6 ) ) )
r.setAtt... |
"""distutils.command.bdist
Implements the Distutils 'bdist' command (create a built [binary]
distribution)."""
__revision__ = "$Id$"
import os
from distutils.util import get_platform
from distutils.core import Command
from distutils.errors import DistutilsPlatformError, DistutilsOptionError
def show_formats():
... |
import numpy as np
from GridCal.Gui.GridEditorWidget.generic_graphics import *
from GridCal.Gui.GridEditorWidget.bus_graphics import TerminalItem
from GridCal.Gui.GuiFunctions import BranchObjectModel
from GridCal.Engine.Devices.upfc import UPFC
from GridCal.Engine.Devices.branch import Branch, BranchType
from GridCal... |
from openerp import api, models, fields, exceptions, _
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as DF
from datetime import datetime, date, timedelta
import logging
logger = logging.getLogger(__name__)
class recurring_contract(models.Model):
_inherit = "recurring.contract"
########... |
"""
MOFED Install Test
"""
import os
from avocado import Test
from avocado import main
from avocado.utils import process
class MOFEDInstallTest(Test):
"""
This test verifies the installation of MOFED iso with different
combinations of input parameters, as specified in multiplexer file.
"""
def... |
from sympy import symbols, sin, exp, cos, Derivative, Integral, Basic, \
count_ops, S, And, I, pi, Eq, Or, Not, Xor, Nand, Nor, Implies, \
Equivalent, MatrixSymbol, Symbol, ITE
from sympy.core.containers import Tuple
x, y, z = symbols('x,y,z')
a, b, c = symbols('a,b,c')
def test_count_ops_non_visual():
de... |
from distutils.core import setup
with open('README.txt') as file:
long_description = file.read()
setup(
name='neo4j-embedded',
# This is auto-generated by the
# maven build that runs this project
version='${pythonic_version}',
description='Bindings for the embedded version of the neo... |
"""
==============================
Lasso on dense and sparse data
==============================
We show that linear_model.Lasso provides the same results for dense and sparse
data and that in the case of sparse data the speed is improved.
"""
print(__doc__)
from time import time
from scipy import sparse
from scipy ... |
"""
Provides XML I{attribute} classes.
"""
import suds.sax
from logging import getLogger
from suds import *
from suds.sax import *
from suds.sax.text import Text
log = getLogger(__name__)
class Attribute:
"""
An XML attribute object.
@ivar parent: The node containing this attribute
@type parent: L{el... |
from gimpfu import *
import random
class randomSVG:
def __init__(self, svg_filename, width, height, interation, shape_position, palette_colors):
self.filename = svg_filename
self.interation = interation
self.shape_position = shape_position
self.palette_colors = palette_colors
self.data = "<?xml version=\"1.... |
from multiprocessing import cpu_count
import socket
DEFAULT = 'tornado,werkzeug-threaded,werkzeug'
def _get_cpu_count():
try:
return cpu_count()
except NotImplementedError:
raise RuntimeError('Could not determine CPU count and no '
'--instance-count supplied.')
d... |
#!/usr/local/bin/python
# coding: utf-8
from distutils.core import setup
import py2exe
import sys
# If run without args, build executables, in quiet mode.
if len(sys.argv) == 1:
sys.argv.append("py2exe")
sys.argv.append("-q")
class Target:
def __init__(self, **kw):
self.__dict__.updat... |
import sipconfig
sipcfg = sipconfig.Configuration()
print("sip_version:%06.0x" % sipcfg.sip_version)
print("sip_version_num:%d" % sipcfg.sip_version)
print("sip_version_str:%s" % sipcfg.sip_version_str)
print("sip_bin:%s" % sipcfg.sip_bin)
print("default_sip_dir:%s" % sipcfg.default_sip_dir)
print("sip_inc_dir:%s" % s... |
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 09 18:41:08 2011
@author: jev
"""
import sqlite3 as db
#import sys, os
class Symbols(object):
''' class for managing a group of spreads through sqlite '''
def __init__(self,fName='spreads.db'):
self.con = db.connect(fName)
se... |
"""Image location order based location strategy module"""
def get_strategy_name():
"""Return strategy module name."""
return 'location_order'
def init():
"""Initialize strategy module."""
pass
def get_ordered_locations(locations, **kwargs):
"""
Order image location list.
:param locati... |
"""
AT-specific Form helpers
"""
import re
from django.utils.translation import ugettext_lazy as _
from django.forms.fields import Field, RegexField, Select
from django.forms import ValidationError
re_ssn = re.compile(r'^\d{4} \d{6}')
class ATZipCodeField(RegexField):
"""
A form field that validates its inp... |
# s-*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para Youtube
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re,httplib
from core import c... |
# -*- coding utf-8 -*-
import os
import copy
import six
from .base import Storage
from ..query.queryset import BaseQuerySet
from ..query.query import QueryGroup
from ..query.query import RawQuery
from modularodm.utils import DirtyField
from modularodm.exceptions import (
KeyExistsException,
MultipleResultsF... |
from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.lib.shape_base import (
apply_along_axis, apply_over_axes, array_split, split, hsplit, dsplit,
vsplit, dstack, column_stack, kron, tile
)
from numpy.testing import (
run_module_suite, TestCase, assert_, asser... |
from __future__ import print_function, division
import string
from .core import Symbol
from .core.alphabets import greeks
from .core.compatibility import exec_
_latin = list(string.ascii_letters)
# COSINEQ should not be imported as they clash; gamma, pi and zeta clash, too
_greek = list(greeks) # make a copy, so we ... |
#! /usr/bin/env python
"""GUI interface to webchecker.
This works as a Grail applet too! E.g.
<APPLET CODE=wcgui.py NAME=CheckerWindow></APPLET>
Checkpoints are not (yet??? ever???) supported.
User interface:
Enter a root to check in the text entry box. To enter more than one root,
enter them one at a time a... |
"""Usage: change_mach_o_flags.py [--executable-heap] [--no-pie] <executablepath>
Arranges for the executable at |executable_path| to have its data (heap)
pages protected to prevent execution on Mac OS X 10.7 ("Lion"), and to have
the PIE (position independent executable) bit set to enable ASLR (address
space layout ra... |
"""
Parser and utilities for the smart 'if' tag
"""
import operator
# Using a simple top down parser, as described here:
# http://effbot.org/zone/simple-top-down-parsing.htm.
# 'led' = left denotation
# 'nud' = null denotation
# 'bp' = binding power (left = lbp, right = rbp)
class TokenBase(object):
"""
Ba... |
from oslo_config import cfg
from nova.compute import api as compute_api
from nova import db
from nova.tests.functional.v3 import test_servers
from nova.tests.unit.api.openstack import fakes
from nova.tests.unit import fake_block_device
from nova.tests.unit import fake_instance
CONF = cfg.CONF
CONF.import_opt('osapi_c... |
"""A PipelineRunner using the SDK harness.
"""
import collections
import json
import logging
import Queue as queue
import threading
import grpc
from concurrent import futures
import apache_beam as beam
from apache_beam.coders import WindowedValueCoder
from apache_beam.coders.coder_impl import create_InputStream
from ... |
#!/usr/bin/python
import h5py
import sys
import numpy as np
import os
import re
import random
# find the path to my own python function:
cur_dir=os.getcwd()
sep='test_cases'
test_DIR=cur_dir.split(sep,1)[0]
scriptDIR=test_DIR+'compare_function'
sys.path.append(scriptDIR)
# import my own function for color and comparat... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import gzip
import os
import struct
import tempfile
import unittest
from io import BytesIO, StringIO, TextIOWrapper
from django.core.files import File
from django.core.files.base import ContentFile
from django.core.files.move import file_move_safe
from d... |
#
# gb18030.py: Python Unicode Codec for GB18030
#
# Written by Hye-Shik Chang <<EMAIL>>
#
import _codecs_cn, codecs
import _multibytecodec as mbc
codec = _codecs_cn.getcodec('gb18030')
class Codec(codecs.Codec):
encode = codec.encode
decode = codec.decode
class IncrementalEncoder(mbc.MultibyteIncrementalEn... |
import sys
from m5.params import *
from m5.proxy import *
from Device import DmaDevice
from AbstractNVM import *
class UFSHostDevice(DmaDevice):
type = 'UFSHostDevice'
cxx_header = "dev/arm/ufs_device.hh"
pio_addr = Param.Addr("Address for SCSI configuration slave interface")
pio_latency = Param.Latenc... |
from oslo.config import cfg
from oslo.db import exception as db_exc
import sqlalchemy as sa
from neutron.common import exceptions as exc
from neutron.db import model_base
from neutron.openstack.common import log
from neutron.plugins.common import constants as p_const
from neutron.plugins.ml2 import driver_api as api
... |
# -*- coding: utf-8 -*-
from django.db import migrations, models
import django.db.models.deletion
def split_words(apps, schema_editor):
Word = apps.get_model("bingo", "Word")
BingoField = apps.get_model("bingo", "BingoField")
NewWord = apps.get_model("bingo", "NewWord")
Site = apps.get_model("sites",... |
import copy
import socket
import ddt
import mock
from oslo_config import cfg
from manila import context
from manila import exception
from manila.share import configuration as config
from manila.share.drivers import ganesha
from manila.share.drivers import glusterfs
from manila.share.drivers.glusterfs import layout
fr... |
from __future__ import division, print_function, unicode_literals
import os
from pysped.xml_sped import TagCaracter, XMLNFe, NAMESPACE_MDFE
from pysped.mdfe.leiaute import ESQUEMA_ATUAL_VERSAO_3 as ESQUEMA_ATUAL
from pysped.mdfe.leiaute.eventomdfe_300 import *
DIRNAME = os.path.dirname(__file__)
class EvCancMDFe(De... |
# COMMON CODE FOR MIGRATION
import re
from ansible.module_utils.basic import get_exception
from ansible.module_utils.netcfg import NetworkConfig, ConfigLine
from ansible.module_utils.shell import ShellError
try:
from ansible.module_utils.nxos import get_module
except ImportError:
from ansible.module_utils.nxo... |
'''
'''
from __future__ import absolute_import
import logging
log = logging.getLogger(__name__)
from ..document import Document
class Application(object):
''' An Application is a factory for Document instances.
'''
def __init__(self, *handlers):
self._handlers = list(handlers)
# TODO (hav... |
import unittest2 as unittest
from webkitpy.common.config.committers import Committer
from webkitpy.common.system.filesystem_mock import MockFileSystem
from webkitpy.common.system.outputcapture import OutputCapture
from webkitpy.layout_tests.models import test_results
from webkitpy.layout_tests.models import test_failu... |
from webkitpy.common.checkout.diff_parser import DiffParser
class WatchList(object):
def __init__(self):
self.definitions = {}
self.cc_rules = set()
self.message_rules = set()
def find_matching_definitions(self, diff):
matching_definitions = set()
patch_files = DiffPar... |
# -*- coding: utf-8 -*-
import logging
import openerp.osv.orm
_logger = logging.getLogger(__name__)
class m(openerp.osv.orm.Model):
""" A model for which we will define a workflow (see data.xml). """
_name = 'test.workflow.model'
def print_(self, cr, uid, ids, s, context=None):
_logger.info('Run... |
#
# $Id$
#
__all__ = \
[
"basic_block",
"defines",
"function",
"instruction",
"module",
]
from basic_block import *
from defines import *
from function import *
from instruction import *
from module import *
# we don't want to make wx an required module for PIDA.
t... |
data = (
'dae', # 0x00
'daeg', # 0x01
'daegg', # 0x02
'daegs', # 0x03
'daen', # 0x04
'daenj', # 0x05
'daenh', # 0x06
'daed', # 0x07
'dael', # 0x08
'daelg', # 0x09
'daelm', # 0x0a
'daelb', # 0x0b
'daels', # 0x0c
'daelt', # 0x0d
'daelp', # 0x0e
'daelh', # 0x0f
'daem', # ... |
"""Tests for trainer hooks."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.boosted_trees.python.utils import losses
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import d... |
"""$Id: base.py 624 2006-05-20 23:42:36Z rubys $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 624 $"
__date__ = "$Date: 2006-05-21 11:42:36 +1200 (Sun, 21 May 2006) $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
__license... |
"""
Verifies simple rules when using an explicit build target of 'all'.
"""
import TestGyp
import os
import sys
test = TestGyp.TestGyp(formats=['make', 'ninja', 'android', 'xcode', 'msvs'])
test.run_gyp('actions.gyp', chdir='src')
test.relocate('src', 'relocate/src')
test.build('actions.gyp', chdir='relocate/src')... |
"""Utility functions for backing up contacts and calendars."""
import os
import sys
import gflags
import pathlib
import contacts_pb2
FLAGS = gflags.FLAGS
def resolve_path(path):
"""Ensure that a directory exists.
Args:
path: (str) A path to a directory, optionally relative or including the
... |
from subprocess import check_output
from utils import *
class Package:
"""
Interface for the builder
"""
__revision = 0
__listFile = []
#-------------------------------------------------------------------------------
def __init__ (self, revision, compressDir, os,platform):
"""
... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import collections
import contextlib
import multiprocessing
import os
import subprocess
from twitter.common.collections import OrderedSet
from pants.backend.jvm.task... |
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.dual import eig
from scipy.special import comb
from scipy import linspace, pi, exp
from scipy.signal import convolve
__all__ = ['daub', 'qmf', 'cascade', 'morlet', 'ricker', 'cwt']
def daub(p):
"""
The coefficient... |
from __future__ import unicode_literals, division, absolute_import
import logging
import urllib
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.config_schema import one_or_more
from flexget.utils.requests import Session, get
from flexget.utils.search import norma... |
import os
import os.path
import sys
import tempfile
import subprocess
import logging
# This and check_output are shims to support features of Python 2.7
# on Python 2.6.
#
# This code was borrowed from PyPy 2.7.
# bitbucket.org/pypy/pypy/src/9d88b4875d6e/lib-python/2.7/subprocess.py
#
# This can be removed when t... |
"""Init file, giving convenient access to all ndlstm ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=wildcard-import,g-importing-member
from tensorflow.contrib.ndlstm.python.lstm1d import *
from tensorflow.contrib.ndlstm.python.lst... |
#!/usr/bin/env python
"""
@file xmledges_applyOffset.py
@author Daniel Krajzewicz
@date 2009-08-01
@version $Id: xmledges_applyOffset.py 11671 2012-01-07 20:14:30Z behrisch $
Applies a given offset to edges given in an xml-edge-file.
The results are written into <XMLEDGES>.mod.xml.
Call: xmledges_applyOffset.py... |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
find_xpath_attr,
int_or_none,
)
class VideofyMeIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.videofy\.me/.+?|p\.videofy\.me/v)/(?P<id>\d+)(&|#|$)'
IE_NAME = 'videofy.me'
_TEST = {
'url': ... |
from fabric.api import *
from fabric.contrib.files import upload_template, append
import time
import config
@task
def uname():
"""Execute uname"""
run("uname -a")
@task
def upgrade():
"""Upgrade a sever"""
sudo("DEBIAN_FRONTEND=noninteractive apt-get update -y")
sudo("DEBIAN_FRONTEND=noninterac... |
# -*- coding: utf-8 -*-
__license__ = 'GPL v3'
__copyright__ = '2009, Tijmen Ruizendaal <tijmen at mybebook.com>'
__docformat__ = 'restructuredtext en'
'''
Device driver for Hanlin
'''
import re
from calibre.devices.usbms.driver import USBMS
class HANLINV3(USBMS):
name = 'Hanlin V3 driver'
gui... |
# -*- coding: utf-8 -*-
"""
flask
~~~~~
A microframework based on Werkzeug. It's extensively documented
and follows best practice patterns.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
__version__ = '0.10'
# utilities we import from ... |
import re
import sys
from django.utils.six.moves import html_parser as _html_parser
current_version = sys.version_info
use_workaround = (
(current_version < (2, 7, 3)) or
(current_version >= (3, 0) and current_version < (3, 2, 3))
)
try:
HTMLParseError = _html_parser.HTMLParseError
except AttributeError... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import MySQLdb
from datetime import datetime, timedelta
from contextlib import contextmanager, closing
from base.smartpool import Connection
query_logger = None
__all__ = [
"transaction",
"lock_str",
"MySQLdbConnection",
]
#################
def total_sec... |
from asynctest import patch
import bot # noqa: F401
from .base_cache_store import TestCacheStore
class TestCacheFfzApiGlobalEmotes(TestCacheStore):
async def setUp(self):
await super().setUp()
patcher = patch('lib.api.ffz.getGlobalEmotes')
self.addCleanup(patcher.stop)
self.moc... |
FreeCAD.addImportType("Point formats (*.asc)","Points")
FreeCAD.addImportType("PLY points (*.ply)","Points")
FreeCAD.addImportType("PCD points (*.pcd)","Points")
FreeCAD.addExportType("Point formats (*.asc)","Points")
FreeCAD.addExportType("PLY points (*.ply)","Points")
FreeCAD.addExportType("PCD points (*.pcd)"... |
"""Simple test example"""
from sparktestingbase.testcase import SparkTestingBaseTestCase
import unittest2
class SimpleTest(SparkTestingBaseTestCase):
"""A simple test."""
def test_basic(self):
"""Test a simple collect."""
input = ["hello world"]
rdd = self.sc.parallelize(input)
... |
#Covered by GPL V2.0
#Coded by Carlos del Ojo Elias (<EMAIL>)
import sys
import re
class TextParser:
def __init__ (self):
self.string=""
self.oldindex=0
self.newindex=0
self.type=""
self.lastFull_line=None
self.lastline = None
pass
def __del__ (self):
if self.type=="file":
self.fd.close()
def... |
microcode = '''
def macroop STOS_M {
# Find the constant we need to either add or subtract from rdi
ruflag t0, 10
movi t3, t3, dsz, flags=(CEZF,), dataSize=asz
subi t4, t0, dsz, dataSize=asz
mov t3, t3, t4, flags=(nCEZF,), dataSize=asz
st rax, es, [1, t0, rdi]
add rdi, rdi, t3, dataSize=as... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import os
import re
import traceback
GITLAB_IMP_ERR = None
try:
import gitlab
HAS_GI... |
#!/usr/bin/env python
from modshogun import WeightedDegreeStringKernel, LinearKernel, PolyKernel, GaussianKernel, CTaxonomy
from modshogun import CombinedKernel, WeightedDegreeRBFKernel
from modshogun import StringCharFeatures, RealFeatures, CombinedFeatures, StringWordFeatures, SortWordString
from modshogun import DN... |
import pytest
from .common import random_str
from .conftest import wait_for
from rancher import ApiError
def test_cannot_target_users_and_group(admin_mc, remove_resource):
"""Asserts that a clusterroletemplatebinding cannot target both
user and group subjects"""
admin_client = admin_mc.client
with p... |
from __future__ import absolute_import
from operator import attrgetter
from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
from .models import Country, Restaurant, Pizzeria, State
class BulkCreateTests(TestCase):
def setUp(self):
self.data = [
Country(name="United States ... |
#!/usr/bin/env python3
"""
Operator Interface
This module exports a set of functions corresponding to the intrinsic
operators of Python. For example, operator.add(x, y) is equivalent
to the expression x+y. The function names are those used for special
methods; variants without leading and trailing '__' are also p... |
""" Client commands """
from datetime import datetime
from pprint import pprint
from steward.colors import green, red, yellow, magenta
def _fuzzy_timedelta(td):
""" Format a timedelta into a *loose* 'X time ago' string """
ago_str = lambda x, y: '%d %s%s ago' % (x, y, 's' if x > 1 else '')
if td.days > 0... |
#!/usr/bin/env python
import cv2
import numpy as np
import sys
def shift_dft(src, dst=None):
'''
Rearrange the quadrants of Fourier image so that the origin is at
the image center. Swaps quadrant 1 with 3, and 2 with 4.
src and dst arrays must be equal size & type
'''
if dst is ... |
import logging
import os
import sys
import time
from urlparse import urlparse
root_path = os.path.abspath(
os.path.dirname(os.path.realpath(__file__))+ '/../..')
opentsdb_path = os.path.join(root_path, 'opentsdb')
sys.path.append(opentsdb_path)
tsdb_register = __import__('tsdb_register')
from tsdb_register import c... |
import pytest
import asyncio
from azure.eventhub import EventData
from azure.eventhub.aio import EventHubConsumerClient
from azure.eventhub.aio._eventprocessor.in_memory_checkpoint_store import InMemoryCheckpointStore
from azure.eventhub._constants import ALL_PARTITIONS
@pytest.mark.liveTest
@pytest.mark.asyncio
asyn... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Ansible module to manage Citrix NetScaler entities
(c) 2013, Nandor Sivok <<EMAIL>>
This file is part of Ansible
Ansible 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 Foundat... |
"""
Support for custom shell commands to retrieve values.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.command_line/
"""
import logging
from datetime import timedelta
import voluptuous as vol
import homeassistant.helpers.config_validati... |
"""engine.SCons.Tool.f77
Tool-specific initialization for the generic Posix f77 Fortran compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2... |
'''Test cases for QObject methods'''
import unittest
from PySide.QtCore import QObject
class InheritsCase(unittest.TestCase):
'''Test case for QObject.inherits'''
def testCppInheritance(self):
#QObject.inherits() for c++ classes
#An class inherits itself
self.assert_(QObject().inheri... |
import matplotlib
import os
import re
import subprocess
from distutils.version import LooseVersion
from . import BaseTestCase
def dot_version():
return re.match(".*version (?P<version>\d+\.\d+\.\d+).*", subprocess.check_output(['dot', '-V'], stderr=subprocess.STDOUT).decode('utf-8').strip()).group('version')
cl... |
# encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
parse_duration,
unified_strdate,
)
class SapoIE(InfoExtractor):
IE_DESC = 'SAPO Vídeos'
_VALID_URL = r'https?://(?:(?:v2|www)\.)?videos\.sapo\.(?:pt|cv|ao|mz|tl)/(?P<id>[\da-zA... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.