content stringlengths 4 20k |
|---|
import random, struct
from OpenGL.GL import *
from tics.triangle import Triangle
class Image(object):
def __init__(self, (width, height), triangles):
self.__width = width
self.__height = height
self.__triangles = tuple(triangles)
@property
def resolution(self):
return self.... |
"""functions helper."""
from ast import literal_eval
import base64
import os
import hashlib
import random
import uuid
import time
import shutil
import re
import socket
import _thread
import OpenSSL
import redis
def addAppPath(path):
"""Add a path to sys path."""
os.sys.path.append(path)
def getCwd():
""... |
declare_user_attribute(
"force_authuser",
Checkbox(
title = _("Visibility of Hosts/Services"),
label = _("Only show hosts and services the user is a contact for"),
help = _("When this option is checked, then the status GUI will only "
"display hosts and services that the... |
import logging
import re
import os
import tempfile
from pathlib import Path
from modules.antivirus.base import AntivirusUnix
log = logging.getLogger(__name__)
class BitdefenderForUnices(AntivirusUnix):
name = "Bitdefender Antivirus Scanner (Linux)"
# ==================================
# Constructor an... |
"""Split single OBJ model into mutliple OBJ files by materials
-------------------------------------
How to use
-------------------------------------
python split_obj.py -i infile.obj -o outfile
Will generate:
outfile_000.obj
outfile_001.obj
...
outfile_XXX.obj
-------------------------------------
Parser based ... |
"""WebSocket utilities.
"""
import array
import errno
# Import hash classes from a module available and recommended for each Python
# version and re-export those symbol. Use sha and md5 module in Python 2.4, and
# hashlib module in Python 2.6.
try:
import hashlib
md5_hash = hashlib.md5
sha1_hash = hashli... |
'''
Problem 32 from Project Euler
We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once; for example, the 5-digit number, 15234, is 1 through 5 pandigital.
The product 7254 is unusual, as the identity, 39 * 186 = 7254, containing multiplicand, multiplier, and product i... |
"""The super-group for the update manager."""
import argparse
import os
import textwrap
from googlecloudsdk.core.util import platforms
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.core import config
from googlecloudsdk.core import log
from googlecloudsdk... |
from django.db import models
from django.utils import timezone
class ReceiveAddress(models.Model):
address = models.CharField(max_length=128, blank=True)
available = models.BooleanField(default=True)
@classmethod
def newAddress(cls, address):
receive_address = cls()
receive_address.add... |
"""Python wrappers for reader Datasets."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.data.ops.dataset_ops import Dataset
from tensorflow.python.data.util import convert
from tensorflow.python.framework import dtypes
from tensorfl... |
"""
Black-box tests of the DjangoUserStateClient against the semantics
defined in edx_user_state_client.
"""
from collections import defaultdict
from unittest import skip
from django.test import TestCase
from edx_user_state_client.tests import UserStateClientTestBase
from courseware.user_state_client import DjangoXB... |
import unittest, getpass, os, sys, re, threading, time
myDirectory = os.path.realpath(sys.argv[0])
rootDirectory = re.sub("/testing/.*", "", myDirectory)
sys.path.append(rootDirectory)
import tempfile
from testing.lib import BaseTestSuite, MockLogger, MockHadoopCluster
from hodlib.Hod.hod import hodRunner, hodStat... |
from __future__ import unicode_literals
import json
import datetime
import mimetypes
import os
import frappe
from frappe import _
import frappe.model.document
import frappe.utils
import frappe.sessions
import werkzeug.utils
from werkzeug.local import LocalProxy
from werkzeug.wsgi import wrap_file
from werkzeug.wrappers... |
import mock
from oslo_config import cfg
from nova import objects
from nova.scheduler.filters import affinity_filter
from nova import test
from nova.tests.unit.scheduler import fakes
CONF = cfg.CONF
CONF.import_opt('my_ip', 'nova.netconf')
class TestDifferentHostFilter(test.NoDBTestCase):
def setUp(self):
... |
# test memoryview
try:
memoryview
except:
print("SKIP")
raise SystemExit
try:
import uarray as array
except ImportError:
try:
import array
except ImportError:
print("SKIP")
raise SystemExit
# test reading from bytes
b = b'1234'
m = memoryview(b)
print(len(m))
print(m[0],... |
"""
Discrete Fourier Transform (:mod:`numpy.fft`)
=============================================
.. currentmodule:: numpy.fft
Standard FFTs
-------------
.. autosummary::
:toctree: generated/
fft Discrete Fourier transform.
ifft Inverse discrete Fourier transform.
fft2 Discrete Fourier tr... |
"""
================================
SVM Exercise
================================
A tutorial exercise for using different SVM kernels.
This exercise is used in the :ref:`using_kernels_tut` part of the
:ref:`supervised_learning_tut` section of the :ref:`stat_learn_tut_index`.
"""
print(__doc__)
import numpy as np
i... |
#!/usr/bin/python3
import logging
logging.basicConfig(level=logging.DEBUG)
from binascii import b2a_hex
import bitcoin.txn
import bitcoin.varlen
import jsonrpc
import jsonrpcserver
import jsonrpc_getwork
import merkletree
import socket
from struct import pack
import sys
import threading
from time import time
from uti... |
from __future__ import unicode_literals
import webnotes
from webnotes import _, msgprint
from webnotes.utils import flt
import time
from accounts.utils import get_fiscal_year
from controllers.trends import get_period_date_ranges, get_period_month_ranges
def execute(filters=None):
if not filters: filters = {}
colum... |
from __future__ import absolute_import
from __future__ import print_function
import errno
import os
import string
import textwrap
from twisted.python import runtime
from twisted.python import usage
from twisted.python.compat import NativeStringIO
from twisted.trial import unittest
from buildbot import config as conf... |
"""Tests for grr.client.client_actions.plist."""
import os
# pylint: disable=unused-import
from grr.client import client_plugins
# pylint: enable=unused-import
from grr.client import vfs
from grr.lib import flags
from grr.lib import plist as plist_lib
from grr.lib import rdfvalue
from grr.lib import test_lib
# ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gensim import corpora, models, similarities #, ldamodel
import sys
import re
import latin.ansi_color as ansi_color
import latin.textutil as textutil
import latin.latin_char as char
import latin.latindic as latindic
import latin.util as util
from latin.LatinObject im... |
"""Macintosh binhex compression/decompression.
easy interface:
binhex(inputfilename, outputfilename)
hexbin(inputfilename, outputfilename)
"""
#
# Jack Jansen, CWI, August 1995.
#
# The module is supposed to be as compatible as possible. Especially the
# easy interface should work "as expected" on any platform.
# XXX... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.shell
~~~~~~~~~~~~~~~~~~~~~
Lexers for various shells.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import Lexer, RegexLexer, do_insertions, bygroups, inclu... |
import logging
import os
import re
import subprocess
import warnings
from luigi import six
import luigi.configuration
import luigi.contrib.hadoop
import luigi.contrib.hadoop_jar
import luigi.contrib.hdfs
from luigi import LocalTarget
from luigi.task import flatten
logger = logging.getLogger('luigi-interface')
"""
S... |
"""
The plugin module provides classes for implementation
of suds plugins.
"""
from suds import *
from logging import getLogger
log = getLogger(__name__)
class Context(object):
"""
Plugin context.
"""
pass
class InitContext(Context):
"""
Init Context.
@ivar wsdl: The wsdl.
@type ws... |
"""
Helper methods for operations related to the management of network
records and their attributes like bridges, PIFs, QoS, as well as
their lookup functions.
"""
from nova import exception
from nova.openstack.common.gettextutils import _
def find_network_with_name_label(session, name_label):
networks = session... |
__author__ = '<EMAIL> (Jeff Scudder)'
import atom.core
XML_TEMPLATE = '{http://www.w3.org/XML/1998/namespace}%s'
ATOM_TEMPLATE = '{http://www.w3.org/2005/Atom}%s'
APP_TEMPLATE_V1 = '{http://purl.org/atom/app#}%s'
APP_TEMPLATE_V2 = '{http://www.w3.org/2007/app}%s'
class Name(atom.core.XmlElement):
"""The atom:na... |
{
'name': 'Create Tasks on SO',
'version': '1.0',
'category': 'Project Management',
'description': """
Automatically creates project tasks from procurement lines.
===========================================================
This module will automatically create a new task for each procurement order line... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'core'} |
# encoding: 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):
# Adding M2M table for field followers on 'SubtitleLanguage'
db.create_table('videos_subtitlelanguage_... |
# ScintillaData.py - implemented 2013 by Neil Hodgson <EMAIL>
# Released to the public domain.
# Common code used by Scintilla and SciTE for source file regeneration.
# The ScintillaData object exposes information about Scintilla as properties:
# Version properties
# version
# versionDotted
# versionCommad... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
try:
import shade
HAS_SHADE = True
except ImportError:
HAS_SHADE = False
from distutils.version import StrictVersion
def _needs_update(module, aggregate):
new_m... |
import os, sys, unittest
sys.path.append(os.path.join('..'))
from twyg.css3colors import color_to_rgba, rgba_to_color
class TestCSS3Colors(unittest.TestCase):
def test_valid(self):
r, g, b, a = color_to_rgba('aquamarine')
c = rgba_to_color(r, g, b, a, format='rgb')
self.as... |
"""
Script for removing all redundant Mac OS metadata files (with filename ".DS_Store"
or with filename which starts with "._") for all courses
"""
import logging
from django.core.management.base import BaseCommand
from xmodule.contentstore.django import contentstore
log = logging.getLogger(__name__)
class Command... |
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import random
import sys
from PrimeDual import *
from utils import save_model
import torch.backends.cudnn as cudnn
cudnn.benchmark = True
def train(Project, params, dataset, dist, P_joint... |
from __future__ import unicode_literals
import re
import itertools
from .common import InfoExtractor
from ..utils import unified_strdate
class VineIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?vine\.co/(?:v|oembed)/(?P<id>\w+)'
_TESTS = [{
'url': 'https://vine.co/v/b9KOOWX7HUx',
'md5'... |
"""
Nroff writer for reStructuredText. Tweaked for Project Gutenberg usage.
"""
__docformat__ = 'reStructuredText'
from epubmaker.mydocutils.writers import nroff
from epubmaker import Unitame
from epubmaker.lib.Logger import info, debug, warn, error
GUTENBERG_NROFF_PREAMBLE = r""".\" -*- mode: nroff -*- coding: {... |
from mod_pywebsocket import handshake
def web_socket_do_extra_handshake(request):
raise handshake.AbortedByUserException(
"Aborted in web_socket_do_extra_handshake")
def web_socket_transfer_data(request):
pass
# vi:sts=4 sw=4 et |
import logging
from webkitpy.common.system.executive import ScriptError
from webkitpy.tool.commands.stepsequence import StepSequence
from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
_log = logging.getLogger(__name__)
class AbstractSequencedCommand(AbstractDeclarativeCommand):
steps = None
... |
#
# qutip benchmark: mesolve 8 spin chain
#
import time
try:
from numpy import *
from qutip import *
except:
print("nan")
import sys
sys.exit(1)
def benchmark(runs=1):
"""
mesolver evolution of 8-spin chain
"""
test_name='8-spin ME [256]'
N = 8# number of spins
# uniform pa... |
"""
pytime
~~~~~~~~~~~~~
A easy-use module to solve the datetime needs by string.
:copyright: (c) 2015 by Sinux <<EMAIL>>
:license: MIT, see LICENSE for more details.
"""
import datetime
import calendar
from .filter import BaseParser, str_tuple
from .exception import CanNotFormatError, Unexpected... |
import struct
from decimal import Decimal
from twisted.internet import reactor
from zmqbase import ClientBase
import bitcoin
import models
import serialize
import error_code
def unpack_error(data):
value = struct.unpack_from('<I', data, 0)[0]
return error_code.error_code.name_from_id(value)
def pack_block_... |
"""Module implementing RNN Cells that used to be in core.
@@EmbeddingWrapper
@@InputProjectionWrapper
@@OutputProjectionWrapper
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
from tensorflow.python.framework import ops
from tensorflow.pyth... |
#!/usr/bin/env python
import sys
import rospy
import serial
import struct
import binascii
import time
from teleop_twist_keyboard.msg import Command
from xbee import ZigBee
xbee = None
XBEE_ADDR_LONG = '\x00\x13\xA2\x00\x40\x86\x96\x4F'
XBEE_ADDR_SHORT = '\xFF\xFE'
DEVICE = '/dev/tty.usbserial-A603HA9K'
#Each bot will... |
from django import forms
from portfolio.models import Security, Transaction, Account
from currency_history.models import Currency
class BuyForm(forms.ModelForm):
#def __init__(self, *pa, **ka):
#super(BuyForm, self).__init__(*pa, **ka)
#self.fields['security'].queryset = Security.objects.all()
... |
"""
This module houses ctypes interfaces for GDAL objects. The following GDAL
objects are supported:
CoordTransform: Used for coordinate transformations from one spatial
reference system to another.
Driver: Wraps an OGR data source driver.
DataSource: Wrapper for the OGR data source object, supports
OGR-su... |
"""
Django Extensions additional model fields
"""
import re
import six
import warnings
try:
import uuid
HAS_UUID = True
except ImportError:
HAS_UUID = False
try:
import shortuuid
HAS_SHORT_UUID = True
except ImportError:
HAS_SHORT_UUID = False
from django.core.exceptions import ImproperlyConf... |
from django.contrib import admin
from django.forms.models import BaseInlineFormSet
from django.forms.fields import BooleanField
from django.forms.formsets import DELETION_FIELD_NAME
from django.forms.util import ErrorDict
from django.utils.translation import ugettext as _
from multilingual.languages import *
from mult... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2, 7):
pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7")
from ansible.module_utils.basic import AnsibleModule
try:
from librar... |
from django.conf.urls.defaults import *
from django.contrib.admindocs import views
urlpatterns = patterns('',
url('^$',
views.doc_index,
name='django-admindocs-docroot'
),
url('^bookmarklets/$',
views.bookmarklets,
name='django-admindocs-bookmarklets'
),
url('^tags/$... |
"""
Tests for the IBM NAS family (SONAS, Storwize V7000 Unified,
NAS based IBM GPFS Storage Systems).
"""
import mock
from oslo.utils import units
from oslo_config import cfg
from cinder import context
from cinder import exception
from cinder.openstack.common import log as logging
from cinder import test
from cinder.... |
import attr
from urwid import (
ACTIVATE,
AttrWrap,
Button,
connect_signal,
LineBox,
PopUpLauncher,
SelectableIcon,
Text,
Widget,
)
from subiquitycore.ui.container import (
Columns,
ListBox,
WidgetWrap,
)
from subiquitycore.ui.utils import Color
class ActionBackBu... |
"""Version information for json-merger.
This file is imported by ``json_merger.__init__``,
and parsed by ``setup.py``.
"""
from __future__ import absolute_import, print_function
__version__ = "0.7.1" |
from __future__ import print_function
import espressomd._system as es
import espressomd
from espressomd import thermostat
from espressomd import code_info
from espressomd import analyze
from espressomd import integrate
from espressomd import electrostatics
import numpy
print("""
=======================================... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import traceback
try:
import ovirtsdk4.types as otypes
except ImportError:
pass
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ovirt impo... |
"""Tests for sparse_cross_op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy
from tensorflow.python.client import session
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.py... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_u... |
from __future__ import print_function, division
from sympy.core import Basic
class CartanType_generator(Basic):
"""
Constructor for actually creating things
"""
def __call__(self, *args):
c = args[0]
c = list(c)
letter, n = c[0], int(c[1])
if n < 0:
raise ... |
import re
from django.template import Node, Variable, VariableNode, _render_value_in_context
from django.template import TemplateSyntaxError, TokenParser, Library
from django.template import TOKEN_TEXT, TOKEN_VAR
from django.utils import translation
from django.utils.encoding import force_unicode
register = Library()... |
"""Plugins for interactively examining the state of the deployment."""
import json
import arrow
from rekall import yaml_utils
from rekall.plugins.addrspaces import standard
from rekall_agent import common
from rekall_agent import result_collections
from rekall_agent.ui import renderers
class AgentControllerShowFile... |
'''Decoder for BMP files.
Currently supports version 3 and 4 bitmaps with BI_RGB and BI_BITFIELDS
encoding. Alpha channel is supported for 32-bit BI_RGB only.
'''
# Official docs are at
# http://msdn2.microsoft.com/en-us/library/ms532311.aspx
#
# But some details including alignment and bit/byte order are omitted; s... |
## @file Compare_Songs.py
# Compare Songs
# @brief Functions associated with the collection of tracks to compare against
# @details This file describes the methods by which we collect songs to process
# against our user profile.
import sys
import spotipy
import spotipy.util as util
import Assemble_Profile... |
from oslo import messaging
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.api.rpc.handlers import dvr_rpc
from neutron.common import constants as q_const
from neutron.common import exceptions
from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils... |
import os
import logging
import serial
from RPi.GPIO import *
class BluetoothSerial:
def __init__(self, usb, pin):
self.usb = usb
self.pin = pin
self.port = None
self.buffer = ""
setmode(BCM)
setup(self.pin, IN)
self.Connected = False
self.JustConnect... |
import sys, glob
from optparse import OptionParser
parser = OptionParser()
parser.add_option('--genpydir', type='string', dest='genpydir', default='gen-py')
options, args = parser.parse_args()
del sys.argv[1:] # clean up hack so unittest doesn't complain
sys.path.insert(0, options.genpydir)
sys.path.insert(0, glob.glob... |
"""
=========================
Bayesian Ridge Regression
=========================
Computes a Bayesian Ridge Regression on a synthetic dataset.
See :ref:`bayesian_ridge_regression` for more information on the regressor.
Compared to the OLS (ordinary least squares) estimator, the coefficient
weights are slightly shift... |
#!/bin/python
import os
import sys
import re
import urllib2
import random
import datetime
dbfile="";
def getSQLiteRows(sql):
key=str(random.randint(0,9999));
os.system("sqlite3 \""+dbfile+"\" \""+sql+"\" > db_file_"+key);
all_content="";
if(os.path.exists("db_file_"+key)):
all_content=open("db_file_"+key,"r").re... |
from javascript import console
from browser import timer
import math
class Queue:
def __init__(self):
self._list=[]
def empty(self):
return len(self._list) == 0
def put(self, element):
self._list.append(element)
def get(self):
if len(self._list) == 0:
raise BaseError
... |
"""Main entry point into the Policy service."""
import abc
from oslo_config import cfg
import six
from keystone.common import dependency
from keystone.common import manager
from keystone import exception
from keystone import notifications
CONF = cfg.CONF
@dependency.provider('policy_api')
class Manager(manager.M... |
# coding: utf-8
from __future__ import unicode_literals
import re
import random
from .common import InfoExtractor
from ..utils import (
int_or_none,
float_or_none,
unified_strdate,
)
class PornoVoisinesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?pornovoisines\.com/showvideo/(?P<id>\d+)/(?P<... |
#!/usr/bin/python
'''
Script for building and uploading a STM8 project with dependency auto-detection
'''
# set general options
UPLOAD = 'BSL' # select 'BSL' or 'SWIM'
TERMINAL = True # set True to open terminal after upload
RESET = 1 # STM8 reset: 0=skip, 1=manual, 2=DTR line (RS232),... |
from .fetchers import NUPermissionsFetcher
from .fetchers import NUMetadatasFetcher
from .fetchers import NUGlobalMetadatasFetcher
from bambou import NURESTObject
class NUSAPEgressQoSProfile(NURESTObject):
""" Represents a SAPEgressQoSProfile in the VSD
Notes:
7x50 SAP Egress QoS profile... |
import datetime
import traceback
import uuid
import fixtures
from ceilometer.event import models
from ceilometer.pipeline import base as pipeline
from ceilometer.pipeline import event
from ceilometer import publisher
from ceilometer.publisher import test as test_publisher
from ceilometer import service
from ceilomete... |
from sqlalchemy.schema import (
Column, ForeignKey, Index, MetaData, Table, UniqueConstraint)
from glance.db.sqlalchemy.migrate_repo.schema import (
Boolean, DateTime, Integer, String, Text, create_tables, drop_tables,
from_migration_import) # noqa
def define_image_properties_table(meta):
(define_im... |
# -*- 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):
# Adding field 'GalleryItem.slug'
db.add_column('ella_galleries_galleryitem', 'slug',
... |
"""
This module integrates Tkinter with twisted.internet's mainloop.
Maintainer: Itamar Shtull-Trauring
To use, do::
| tksupport.install(rootWidget)
and then run your reactor as usual - do *not* call Tk's mainloop(),
use Twisted's regular mechanism for running the event loop.
Likewise, to stop your program you... |
'''
Created on Oct 12, 2016
@author: mwitt_000
'''
import queue
import threading
## wrapper class for a queue of packets
class Interface:
## @param maxsize - the maximum size of the queue storing packets
# @param cost - of the interface used in routing
# @param capacity - the capacity of the link in bp... |
import numpy as np
from numpy.testing import assert_array_almost_equal
from nose.tools import assert_raises
from sklearn.manifold import mds
def test_smacof():
# test metric smacof using the data of "Modern Multidimensional Scaling",
# Borg & Groenen, p 154
sim = np.array([[0, 5, 3, 4],
... |
# Test packages (dotted-name import)
# XXX: This test is borrowed from CPython 2.7 as it tickles
# http://bugs.jython.org/issue1871 so it should be removed in Jython 2.7
import sys
import os
import tempfile
import textwrap
import unittest
from test import test_support
# Helpers to create and destroy hierarchies.
de... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.modules.network.nxos import nxos_vxlan_vtep
from .nxos_module import TestNxosModule, load_fixture, set_module_args
class TestNxosVxlanVtepVniModule(TestNxosModule):
module = n... |
{
'name': 'Account Check Deposit',
'version': '0.1',
'category': 'Accounting & Finance',
'license': 'AGPL-3',
'summary': 'Manage deposit of checks to the bank',
'description': """
Account Check Deposit
=====================
This module allows you to easily manage check deposits : you can select ... |
#!/usr/bin/python
import unittest
try:
import autotest.common as common
except ImportError:
import common
from autotest.client.shared import profiler_manager
# simple job stub for using in tests
class stub_job(object):
tmpdir = "/home/autotest/tmp"
autodir = "/home/autotest"
# simple profiler stub ... |
"""DNS nodes. A node is a set of rdatasets."""
import StringIO
import dns.rdataset
import dns.rdatatype
import dns.renderer
class Node(object):
"""A DNS node.
A node is a set of rdatasets
@ivar rdatasets: the node's rdatasets
@type rdatasets: list of dns.rdataset.Rdataset objects"""
__slots__... |
"""
Catalan-language mappings for language-dependent features of
reStructuredText.
"""
__docformat__ = 'reStructuredText'
directives = {
# language-dependent: fixed
u'atenci\u00F3': 'attention',
u'compte': 'caution',
u'code (translation required)': 'code',
u'perill': 'danger',
u'e... |
"""
A class representing a Type 1 font.
This version merely reads pfa and pfb files and splits them for
embedding in pdf files. There is no support yet for subsetting or
anything like that.
Usage (subject to change):
font = Type1Font(filename)
clear_part, encrypted_part, finale = font.parts
Source: Adobe Tech... |
import gtk
class PageDrawer (gtk.DrawingArea):
def __init__(self, page_width=None, page_height=None,
sub_areas=[],xalign=0.5,yalign=0.5
):
"""Draw a page based on page areas given to us.
The areas can be given in any scale they like.
sub_areas are each (... |
import numpy as np
from scipy.optimize import linear_sum_assignment
import tensorflow as tf
import tensorflow.contrib.slim as slim
SMALL_EPSILON = 1e-10
def compute_assignments(locations, confidences, gt_bboxes, num_gt_bboxes, batch_size, alpha):
"""
locations: [batch_size * num_predictions, 4]
confidences: [ba... |
"""SCons.Warnings
This file implements the warnings framework for SCons.
"""
__revision__ = "src/engine/SCons/Warnings.py 5023 2010/06/14 22:05:46 scons"
import sys
import SCons.Errors
class Warning(SCons.Errors.UserError):
pass
class WarningOnByDefault(Warning):
pass
# NOTE: If you add a new warning ... |
# Thank you to iAcquire for sponsoring development of this module.
#
# See http://alestic.com/2011/06/ec2-ami-security for more information about ensuring the security of your AMI.
import sys
import time
try:
import boto
import boto.ec2
except ImportError:
print "failed=True msg='boto required for this m... |
import asyncio
from collections import defaultdict
from functools import partial
import json
import logging
import random
import uuid
from again.utils import unique_hex
import aiohttp
from retrial.retrial import retry
from .services import TCPServiceClient, HTTPServiceClient
from .pubsub import PubSub
from .packet im... |
#!/usr/bin/env python
import json
import thread
import uuid
try:
from urllib.request import urlopen
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
from urllib2 import urlopen
__all__ = ["NotifyPublisher"]
class NotifySubscriber():
def __init__(self, **kwargs)... |
# -*- coding: utf-8 -*-
import gettext
import os
import random
import string
from datetime import datetime
from jinja2 import Environment, PackageLoader
_ = gettext.translation("sepa", os.path.join(os.path.dirname(os.path.abspath(__file__)), "../locale"), ["es"]).gettext
SEQUENCE_TYPES = ("FRST", "RCUR", "FNAL", "O... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
# import module snippets
from ansible.module_utils.basic import AnsibleModule
from ansible.m... |
from edx.idea.common.identifier import generate_uuid
class Workflow(object):
def __init__(self, phases=None, name=None):
self.phases = phases or []
self.name = name or ('workflow_' + generate_uuid())
def __repr__(self):
return 'Workflow(phases={0}, name={1})'.format(
repr... |
"""Functions that read and write gzipped files.
The user of the file doesn't have to worry about the compression,
but random access is not allowed."""
# based on Andrew Kuchling's minigzip.py distributed with the zlib module
import struct, sys, time, os
import zlib
import io
import __builtin__
__all__ = ["GzipFile"... |
from oslo_policy import policy
from nova.policies import base
BASE_POLICY_NAME = 'os_compute_api:os-server-diagnostics'
server_diagnostics_policies = [
policy.DocumentedRuleDefault(
name=BASE_POLICY_NAME,
check_str=base.SYSTEM_ADMIN,
description="Show the usage data for a server",
... |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 02 2016
@author: Cedric Vallee
Inspired by Chong Wee Tan
"""
import os
import Helper as helper
import Scraper as scraper
from textblob import TextBlob
from bs4 import BeautifulSoup
def getMDAfromText(filename,text):
try:
soup = BeautifulSoup(te... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Startup plugin for command-line deletes
Copyright 2009-2015 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
import sys
from omero.cli import CLI, GraphControl
HELP = """Delete OMERO data.
Remove enti... |
import bank
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.