content string |
|---|
#!/usr/bin/env python
"""
An example using networkx.Graph().
miles_graph() returns an undirected graph over the 128 US cities from
the datafile miles_dat.txt. The cities each have location and population
data. The edges are labeled with the distance betwen the two cities.
This example is described in Section 1.1 in ... |
"""This module provides the components needed to build your own __import__
function. Undocumented functions are obsolete.
In most cases it is preferred you consider using the importlib module's
functionality over this module.
"""
# (Probably) need to stay in _imp
from _imp import (lock_held, acquire_lock, release_lo... |
"""Utils used to manipulate tensor shapes."""
import tensorflow as tf
def assert_shape_equal(shape_a, shape_b):
"""Asserts that shape_a and shape_b are equal.
If the shapes are static, raises a ValueError when the shapes
mismatch.
If the shapes are dynamic, raises a tf InvalidArgumentError when the shapes
... |
r"""A class supporting chat-style (command/response) protocols.
This class adds support for 'chat' style protocols - where one side
sends a 'command', and the other sends a response (examples would be
the common internet protocols - smtp, nntp, ftp, etc..).
The handle_read() method looks at the input stream for the c... |
# vim: set fileencodings=utf-8
# -*- coding: utf-8 -*-
__docformat__ = "reStructuredText"
import re
import hashlib
import logging
from StringIO import StringIO
from datetime import datetime
from markdown2 import markdown
from django.utils.html import strip_tags
from django.utils.text import Truncator
from django.ut... |
{
'name': 'Expense Management',
'version': '1.0',
'category': 'Human Resources',
'sequence': 29,
'summary': 'Expenses Validation, Invoicing',
'description': """
Manage expenses by Employees
============================
This application allows you to manage your employees' daily expenses. It giv... |
"""distutils.extension
Provides the Extension class, used to describe C/C++ extension
modules in setup scripts.
Overridden to support f2py.
"""
from __future__ import division, absolute_import, print_function
import sys
import re
from distutils.extension import Extension as old_Extension
if sys.version_info[0] >= ... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.errors import AnsibleError
from ansible.plugins.action import ActionBase
from ansible.utils.vars import merge_hash
class ActionModule(ActionBase):
_VALID_ARGS = frozenset(('jid', 'mode'))
def run(self, tmp=... |
# -*- coding: utf-8 -*-
import os
import sys
import time
import shutil
import stat
from nixops.backends import MachineDefinition, MachineState
import nixops.known_hosts
sata_ports = 8
class VirtualBoxDefinition(MachineDefinition):
"""Definition of a VirtualBox machine."""
@classmethod
def get_type(cls... |
import threading
from django.contrib.gis.geos.libgeos import (
CONTEXT_PTR, error_h, lgeos, notice_h,
)
class GEOSContextHandle(object):
"""
Python object representing a GEOS context handle.
"""
def __init__(self):
# Initializing the context handler for this thread with
# the noti... |
from openerp.osv import fields,osv
from openerp import tools
class purchase_report(osv.osv):
_name = "purchase.report"
_description = "Purchases Orders"
_auto = False
_columns = {
'date': fields.date('Order Date', readonly=True, help="Date on which this document has been created"),
'sta... |
"""
sentry.utils.samples
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import os.path
from sentry.constants import DATA_ROOT, PLATFORM_ROOTS, PLATFORM_TITLES
from sentry.event_manager... |
from __future__ import absolute_import
from .. import rw
from .base import BaseMessage
from .types import Types
class PingRequestMessage(BaseMessage):
"""Initiate a ping request."""
message_type = Types.PING_REQ
ping_req_rw = rw.instance(PingRequestMessage) # no body |
"""
Initializer of PyNEST.
"""
import sys
import os
# This is a workaround for readline import errors encountered with Anaconda
# Python running on Ubuntu, when invoked from the terminal
# "python -c 'import nest'"
if 'linux' in sys.platform and 'Anaconda' in sys.version:
import readline
# This is a workaround t... |
import struct
from . import packet_base
from . import vlan
from . import mpls
from . import ether_types as ether
from ryu.lib import addrconv
class linuxcooked(packet_base.PacketBase):
_PACK_STR = '!HHH8sH'
_MIN_LEN = struct.calcsize(_PACK_STR)
def __init__(self, pkt_type, arphrd_type, address_length, ad... |
# -*- coding:Utf-8 -*-
from tastypie import fields as base_fields
from tastypie_mongoengine import fields
from core.api.utils import TenantResource
from timeline.models import TimelineEntry
from timeline.api.doc import HELP_TEXT
__all__ = (
'TimelineEntryBaseResource',
)
class TimelineEntryBaseResource(TenantR... |
from mpi4py import MPI
import mpiunittest as unittest
datatypes_c = [
MPI.CHAR, MPI.WCHAR,
MPI.SIGNED_CHAR, MPI.SHORT, MPI.INT, MPI.LONG,
MPI.UNSIGNED_CHAR, MPI.UNSIGNED_SHORT, MPI.UNSIGNED, MPI.UNSIGNED_LONG,
MPI.LONG_LONG, MPI.UNSIGNED_LONG_LONG,
MPI.FLOAT, MPI.DOUBLE, MPI.LONG_DOUBLE,
]
datatypes_c99 = [
MPI.C_BOOL... |
import random
import time
from django.test import TestCase
from graphite.intervals import Interval, IntervalSet
from graphite.node import LeafNode, BranchNode
from graphite.storage import Store, get_finder
class FinderTest(TestCase):
def test_custom_finder(self):
store = Store(finders=[get_finder('tests... |
"""Tools for arithmetic error propogation."""
from __future__ import print_function, division
from itertools import repeat, combinations
from sympy import S, Symbol, Add, Mul, simplify, Pow, exp
from sympy.stats.symbolic_probability import RandomSymbol, Variance, Covariance
_arg0_or_var = lambda var: var.args[0] if l... |
# -*- coding: utf-8 -*-
from __future__ import division
import math
import random
import matplotlib.pyplot as plt
import scipy.signal as sig
from itertools import product
from misc import common_part_values, metric_prefix
from anneal import Annealer
# Setup optimization targets
target_q = 0.707 #... |
#!/usr/bin/python
# don't expect too much.
# this is a really simple&stupid svg parser, which will use rectangles
# and text fields to produce <widget> snippets for a skin.
# use object "id" fields for source names if you want.
# extracting font information is buggy.
# if you want text fields, please use flow text regi... |
# functions related to adding and editing article data
import re
import urllib.request
import Bio
from Bio import Entrez, Medline
from Bio.Entrez import efetch, esearch, parse, read
from models import *
from search_helpers import get_article_object
Entrez.email = "<EMAIL>"
# BEGIN: article helper functions
def u... |
import sys
try:
import reportlab
except ImportError:
cm = 28.346456692913385
A4 = (595.275590551181, 841.8897637795275)
black = None
TA_LEFT, TA_CENTER, TA_RIGHT = 0, 1, 2
landscape = lambda t:(t[1],t[0])
else:
from reportlab.lib.units import * # Check this - is the source of units
from... |
# -*- coding: utf-8 -*-
# (c) 2014-2016 Andreas Motl, Elmyra UG
import re
_slugify_strip_re = re.compile(r'[^\w\s-]')
_slugify_strip_wo_equals_re = re.compile(r'[^\w\s=-]')
_slugify_hyphenate_re = re.compile(r'[-\s]+')
def slugify(value, strip_equals=True, lowercase=True):
"""
Normalizes string, converts to lo... |
"""
Author: Navraj Chohan
Description:
There are three badge types: The image, the template, and an instance
"""
import logging
import hashlib
import datetime
from accounts import Accounts
from users import Users
from google.appengine.ext import db
from google.appengine.ext.blobstore import blobstore
from django.util... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: bigip_gtm_datacenter
short_description: Manage Data... |
#!/usr/bin/env python
from numpy import array,hstack
from numpy.random import seed, rand
from tools.load import LoadMatrix
lm=LoadMatrix()
traindat = lm.load_numbers('../data/fm_train_real.dat')
testdat = lm.load_numbers('../data/fm_test_real.dat')
label_traindat = lm.load_labels('../data/label_train_twoclass.dat')
p... |
from __future__ import absolute_import, division, print_function
import abc
import six
from cryptography import utils
def generate_parameters(generator, key_size, backend):
return backend.generate_dh_parameters(generator, key_size)
class DHPrivateNumbers(object):
def __init__(self, x, public_numbers):
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
DOCUMENTATION = r'''
---
module: bigip_device_syslog
short_description: Manage system-level ... |
'''Test the functions and main class method of textView.py.
Since all methods and functions create (or destroy) a TextViewer, which
is a widget containing multiple widgets, all tests must be gui tests.
Using mock Text would not change this. Other mocks are used to retrieve
information about calls.
The coverage is es... |
# -*- coding: utf-8 -*-
import math
import sys
from pytest import deprecated_call
from almost import almost
def test_repeating_decimal():
assert almost(1 / 3.) == 0.333
assert almost(1 / 6.) == 0.167
assert almost(3227 / 555., prec=6) == 5.814414
def test_irrational_number():
assert almost(math.pi... |
from Screens.Screen import Screen
from Screens.Standby import TryQuitMainloop
from Screens.MessageBox import MessageBox
from Components.ActionMap import NumberActionMap
from Components.Pixmap import Pixmap
from Components.Sources.StaticText import StaticText
from Components.MenuList import MenuList
from Plugins.Plugin ... |
from collections import defaultdict
import logging
import json
import os
import bogo
# TODO: This module needs some tests
ENGINE_DIR = os.path.dirname(__file__)
IBUS_BOGO_DEFAULT_CONFIG = {
"input-method": "telex",
"output-charset": "utf-8",
"telex-w-shorthand": True,
"telex-brackets-shorthand": True... |
from helper import sched
from default import with_context
import json
from mock import patch
class TestSched(sched.Helper):
def setUp(self):
super(TestSched, self).setUp()
self.endpoints = ['project', 'task', 'taskrun']
# Tests
@with_context
@patch('pybossa.api.task_run.request')
... |
from __future__ import absolute_import, print_function, division
import sys
sys.path.append(".")
import gc
import string
import cPickle
import os
import datetime
import time
import pp
import math
import collections
import resource
import scipy
import numpy as np
from scipy import linalg
from pprint import pformat a... |
"""Unit test for jsonchecker.py."""
import unittest
import jsonchecker
class MockErrorHandler(object):
def __init__(self, handle_style_error):
self.turned_off_filtering = False
self._handle_style_error = handle_style_error
def turn_off_line_filtering(self):
self.turned_off_filtering... |
import os
import sys
import yaml
from cassandra.cluster import Cluster
from cqlexecutor import CQLExecutor
class Migrator:
def __init__(self, migrations_path, session):
print('Reading migrations from {0}'.format(migrations_path))
self.migrations_path = migrations_path
self.session = sessio... |
# -*- coding: utf-8 -*-
"""
werkzeug.debug.console
~~~~~~~~~~~~~~~~~~~~~~
Interactive console support.
:copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD.
"""
import sys
import code
from types import CodeType
from werkzeug.utils import escape
from werkzeug.loca... |
"""Documentation tests.
"""
import unittest
class Test_asStructuredText(unittest.TestCase):
def _callFUT(self, iface):
from zope.interface.document import asStructuredText
return asStructuredText(iface)
def test_asStructuredText_no_docstring(self):
from zope.interface import Interfac... |
import fechbase
class Records(fechbase.RecordsBase):
def __init__(self):
fechbase.RecordsBase.__init__(self)
self.fields = [
{'name': 'FORM TYPE', 'number': '1'},
{'name': 'FILER COMMITTEE ID NUMBER', 'number': '2'},
{'name': 'COMMITTEE NAME', 'number': '3'},
... |
import pymel.core.uitypes as pmui
from ctrl_pymel import getController as pmGetController
from pstypes import UIType
from com import message
IDX_PM_TYPE = 0
IDX_PM_CLASS = 1
constructors = {
UIType.MCheckBox: [UIType.PMCheckBox, pmui.CheckBox],
UIType.MCheckBoxGrp1: [UIType.PMCheckBoxGrp1, pmui.CheckBoxGrp],... |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:8638")
else:
access = Ser... |
from core.data.DataTableDataModel import DataTableDataModel
from core.database.constants import DomFuzzerResultsTable
class DomFuzzerResultsDataModel(DataTableDataModel):
ITEM_DEFINITION = (
('#', DomFuzzerResultsTable.ID),
('Confidence', DomFuzzerResultsTable.CONFIDENCE),
('Ta... |
data = (
'Yan ', # 0x00
'Yan ', # 0x01
'Ding ', # 0x02
'Fu ', # 0x03
'Qiu ', # 0x04
'Qiu ', # 0x05
'Jiao ', # 0x06
'Hong ', # 0x07
'Ji ', # 0x08
'Fan ', # 0x09
'Xun ', # 0x0a
'Diao ', # 0x0b
'Hong ', # 0x0c
'Cha ', # 0x0d
'Tao ', # 0x0e
'Xu ', # 0x0f
'Jie ', # 0x10
'Yi... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import division
import sys
import time
from Node import *
from LeafCounter import *
from Sequence import *
from Bio import SeqIO
from TransitionMatrix import *
import cPickle
from GeneticCode import *
def main( fn ):
TM = TransitionMatrix()
TM.read( "tr... |
#!/usr/bin/python3
# example call
# ./master.py /dev/ttyUSB0 /dev/ttyUSB1
## python system imports
import csv
import threading
import queue
import time
import sys
import os.path
import AEMmailer
from casyncosc import SerialServer
## diskSpaceLimit : in MB, when limit reached, processing halts
diskSpaceLimit = 100 # ... |
from django.conf.urls import patterns, include, url
from django.contrib.auth.models import User, Group
from rest_framework import viewsets, routers
# from resume.views import hello
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
# We should create our API now ... |
import logging
from django.db import models, transaction
from student.models import User
from xmodule_django.models import CourseKeyField
log = logging.getLogger("edx.licenses")
class CourseSoftware(models.Model):
name = models.CharField(max_length=255)
full_name = models.CharField(max_length=255)
url... |
"""
Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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 2
of the License, or (at your option... |
import luigi
import luigi.contrib.hadoop
import luigi.contrib.hdfs
# To make this run, you probably want to edit /etc/luigi/client.cfg and add something like:
#
# [hadoop]
# jar: /usr/lib/hadoop-xyz/hadoop-streaming-xyz-123.jar
class InputText(luigi.ExternalTask):
"""
This task is a :py:class:`luigi.task.Ex... |
__author__ = 'jiataogu'
from emolga.dataset.build_dataset import deserialize_from_file, serialize_to_file
import numpy.random as n_rng
n_rng.seed(19920206)
# the vocabulary
tmp = [chr(x) for x in range(48, 58)] # '1', ... , '9', '0'
voc = [tmp[a] + tmp[b] + tmp[c]
for c in xrange(10)
... |
"""Implementation of JSONEncoder
"""
import re
c_encode_basestring_ascii = None
c_make_encoder = None
ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]')
ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])')
HAS_UTF8 = re.compile(r'[\x80-\xff]')
ESCAPE_DCT = {
'\\': '\\\\',
'"': '\\"',
'\b': '\\b',
'\f': '\\f',
... |
{
'name': 'Belgium - Payroll',
'category': 'Localization',
'author': 'OpenERP SA',
'depends': ['hr_payroll'],
'version': '1.0',
'description': """
Belgian Payroll Rules.
======================
* Employee Details
* Employee Contracts
* Passport based Contract
* Allowances/Deducti... |
import BoostBuild
t = BoostBuild.Tester(use_test_config=False)
t.write("jamroot.jam", "build-project src ;")
t.write("lib/jamfile.jam", "lib lib1 : lib1.cpp ;")
t.write("lib/lib1.cpp", """
#ifdef _WIN32
__declspec(dllexport)
#endif
void foo() {}\n
""")
t.write("src/jamfile.jam", """
project : requirements <library... |
"""Identity Tests."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.distributions.python.ops.bijectors import bijector_test_util
from tensorflow.contrib.distributions.python.ops.bijectors import identity as identity_lib
from tensor... |
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', '<EMAIL>'),
)
TIME_ZONE = 'Europe/Madrid'
APPLICATION_DIR = os.path.dirname(globals()['__file__'])
# DATABASE SETTINGS
# =================
DATABASES = {
'default': {
# Add 'postgresql_psycopg2','postgresql','mysql','sqlite3','... |
#! /usr/bin/env python
"""Test the errno module
Roger E. Masse
"""
import errno
from test import test_support
import unittest
std_c_errors = frozenset(['EDOM', 'ERANGE'])
class ErrnoAttributeTests(unittest.TestCase):
def test_for_improper_attributes(self):
# No unexpected attributes should be on the ... |
from yowsup.layers import YowLayer, YowLayerEvent, YowProtocolLayer
from .protocolentities import *
from yowsup.layers.protocol_iq.protocolentities import ErrorIqProtocolEntity
class YowPresenceProtocolLayer(YowProtocolLayer):
def __init__(self):
handleMap = {
"presence": (self.recvPresence, sel... |
"""Hook to allow user-specified customization code to run.
As a policy, Python doesn't run user-specified code on startup of
Python programs (interactive sessions execute the script specified in
the PYTHONSTARTUP environment variable if it exists).
However, some programs or sites may find it convenient to allow users... |
# 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 field 'ProjectMember.api_key'
db.add_column('sentry_projectmember', 'api_key', self.gf('django.db.models.... |
import unittest
from systrace import util
from devil.android import device_utils
from devil.android.sdk import intent
from devil.android.sdk import keyevent
class BaseAgentTest(unittest.TestCase):
def setUp(self):
devices = device_utils.DeviceUtils.HealthyDevices()
self.browser = 'stable'
self.package... |
from __future__ import unicode_literals
import string
from django.db import models
from django.db.models.signals import pre_save, pre_delete
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
from django.core.exceptions import ValidationError
SITE_C... |
from django.contrib.gis.db import models
class City3D(models.Model):
name = models.CharField(max_length=30)
point = models.PointField(dim=3)
objects = models.GeoManager()
def __unicode__(self):
return self.name
class Interstate2D(models.Model):
name = models.CharField(max_length=30)
l... |
from __future__ import unicode_literals
import logging
from mkdocs import utils
from mkdocs.exceptions import ConfigurationError
log = logging.getLogger(__name__)
def pages_compat_shim(original_pages):
"""
Support legacy pages configuration
Re-write the pages config fron MkDocs <=0.12 to match the
... |
import datetime
from django.contrib.admin.util import lookup_field, display_for_field, label_for_field
from django.contrib.admin.views.main import (ALL_VAR, EMPTY_CHANGELIST_VALUE,
ORDER_VAR, PAGE_VAR, SEARCH_VAR)
from django.contrib.admin.templatetags.admin_static import static
from django.core.exceptions import ... |
import re
from django.db.backends.postgresql_psycopg2.base import *
# from the postgresql doc
SQL_IDENTIFIER_RE = re.compile(r'^[_a-zA-Z][_a-zA-Z0-9]{,62}$')
PUBLIC_SCHEMA_NAME = 'public'
def _check_identifier(identifier):
if not SQL_IDENTIFIER_RE.match(identifier):
raise RuntimeError("Invalid string u... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
from PyQt5.QtWidgets import (QWidget, QHBoxLayout, QVBoxLayout, QLabel,
QComboBox, QFrame, QSplitter, QApplication)
from PyQt5.QtCore import Qt
class Example(QWidget):
def __init__(self):
super().__init__()
self.in... |
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = r'Y. \g\a\d\a j. F'
TIME_FORMAT = 'H:i:s'
DATETIME_FORMAT = r'Y. \g\a\d\a j. F, H:i:s'
YEAR_MONTH_FORMAT = r'Y. \g. F'
MONTH_DAY_FORMAT... |
"""Unit tests for the indexing engine."""
__revision__ = "$Id$"
import unittest
from invenio import bibindex_engine_stemmer
from invenio.testutils import make_test_suite, run_test_suite
class TestStemmer(unittest.TestCase):
"""Test stemmer."""
def test_stemmer_none(self):
"""bibindex engine - no st... |
"""
Slovenian specific form helpers.
"""
from __future__ import absolute_import, unicode_literals
import datetime
import re
from django.contrib.localflavor.si.si_postalcodes import SI_POSTALCODES_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields... |
'''*****************************************************************************
AToMPM - A Tool for Multi-Paradigm Modelling
Copyright (c) 2011 Eugene Syriani
This file is part of AToMPM.
AToMPM is free software: you can redistribute it and/or modify it under the
terms of the GNU Lesser General Public License as pu... |
"""Device function for replicated training."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import six
from tensorflow.core.framework import node_def_pb2
from tensorflow.python.framework import device as pydev
from tensorflow.python.platform import tf_lo... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.univention_umc import (
umc_module_for_add,
umc_module_for_edit,
ldap_search,
base_dn,
)
def... |
from __future__ import unicode_literals
import re
import json
from .common import InfoExtractor
from .gigya import GigyaBaseIE
from ..compat import compat_HTTPError
from ..utils import (
ExtractorError,
strip_or_none,
float_or_none,
int_or_none,
merge_dicts,
parse_iso8601,
)
class CanvasIE(I... |
""" Unit tests for the ninja.py file. """
import gyp.generator.ninja as ninja
import unittest
import StringIO
import sys
import TestCommon
class TestPrefixesAndSuffixes(unittest.TestCase):
def test_BinaryNamesWindows(self):
# These cannot run on non-Windows as they require a VS installation to
# correctly ... |
# -*- coding: utf-8 -*-
""" OneLogin_Saml2_Logout_Request class
Copyright (c) 2010-2018 OneLogin, Inc.
MIT License
Logout Request class of OneLogin's Python Toolkit.
"""
from app.lib.onelogin.saml2 import compat
from app.lib.onelogin.saml2.constants import OneLogin_Saml2_Constants
from app.lib.onelogin.saml2.utils... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
try:
from pyVmomi import vim, vmodl
HAS_PYVMOMI = True
except ImportError:
HAS_PYVMOMI = False
def configure_vmkernel_ip_address(host_system, vmk_name, ip_address, s... |
"""$Id: author.py 699 2006-09-25 02:01:18Z rubys $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 699 $"
__date__ = "$Date: 2006-09-25 02:01:18 +0000 (Mon, 25 Sep 2006) $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
from b... |
from core.models import Slice, SliceDeployments, User
from synchronizers.base.deleter import Deleter
from openstack.driver import OpenStackDriver
class SliceDeploymentsDeleter(Deleter):
model='SliceDeployments'
def call(self, pk):
slice_deployment = SliceDeployments.objects.get(pk=pk)
user = U... |
class LRUCache:
'''
>>> l = LRUCache(maxsize=3)
>>> l.add('a')
>>> l.add('b')
>>> l.add('c')
>>> l.add('d')
>>> l.to_list()
['b', 'c', 'd']
>>> l.add('b')
>>> l.to_list()
['c', 'b', 'd']
>>> l.add('b')
>>> l.to_list()
['c', 'd', 'b']
>>> l.add('b')
>>> l.t... |
"""
increment-version.py -- Bump Beta or Canary version number across all required
files.
Crosswalk's versioning schema is "MAJOR.MINOR.BUILD.PATCH". Incrementing a beta
version will monotonically increase the PATCH number, while incrementing a
canary version will monotonically increase the BUILD number.
"""
import o... |
# -*- coding: utf-8 -*-
"""Celery error types.
Error Hierarchy
===============
- :exc:`Exception`
- :exc:`celery.exceptions.CeleryError`
- :exc:`~celery.exceptions.ImproperlyConfigured`
- :exc:`~celery.exceptions.SecurityError`
- :exc:`~celery.exceptions.TaskPredicate`
- :exc:`... |
#
#
# genWix.py is used to generate a WiX .wxs format file that
# can be compiled by the candle.exe WiX compiler.
#
# Usage: python genWix.py <output_file>
#
# The current directory is expected to be the top of a tree
# of built programs, libraries, documentation and files.
#
# The list of directories traversed is at ... |
import unittest
from unittest import TestCase
from algorithms.dataStructures.Deque import Deque
class deque_Test(TestCase):
def setUp(self):
self.d = Deque()
def test_create_deque(self):
self.assertIsInstance(self.d, Deque)
def test_push_to_empty_deque(self):
self.d.push(1)
... |
from pyasn1_modules import rfc2251
from pyasn1_modules.rfc2459 import *
class KeyEncryptionAlgorithms(AlgorithmIdentifier):
pass
class PrivateKeyAlgorithms(AlgorithmIdentifier):
pass
class EncryptedData(univ.OctetString):
pass
class EncryptedPrivateKeyInfo(univ.Sequence):
componentType = namedty... |
"""Utilities for subcommands that need to SSH into virtual machine guests."""
import logging
import os
import subprocess
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.compute.lib import base_classes
from googlecloudsdk.compute.lib import constants
from googlecloudsdk.compute.lib import metadata_ut... |
from django.conf.urls import include # noqa
from django.conf.urls import patterns
from django.conf.urls import url
from openstack_dashboard.dashboards.project.volumes.backups \
import urls as backups_urls
from openstack_dashboard.dashboards.project.volumes.snapshots \
import urls as snapshot_urls
from opensta... |
import subprocess
from .util import log
class Tester(object):
PRODUCER = False
CONSUMER = False
FLIGHT_SERVER = False
FLIGHT_CLIENT = False
def __init__(self, debug=False, **args):
self.args = args
self.debug = debug
def run_shell_command(self, cmd):
cmd = ' '.join(c... |
import unittest
from IECore import *
class PointsMotionOpTest( unittest.TestCase ) :
def _buildPoints( self, time ):
p = PointsPrimitive( 5 )
p[ "P" ] = PrimitiveVariable( PrimitiveVariable.Interpolation.Vertex, V3fVectorData( [ V3f(time*1), V3f(time*2), V3f(time*3), V3f(time*4), V3f(time*5) ] ) )
p[ "id" ] =... |
from __future__ import absolute_import
from django.test import TestCase
from django.utils import six
from .models import (ObjectQuerySet, RelatedObject, Person, Book, Car, PersonManager,
PublishedBookManager)
class CustomManagerTests(TestCase):
def test_manager(self):
p1 = Person.objects.create(firs... |
"""
This file contains the default values for parameters used in the journey planner.
This parameters are used on the creation of the instances in the tyr database, they will not be updated automatically.
This parameters can be used directly by jormungandr if the instance is not known in tyr, typically in development s... |
"""Windows platform implementation."""
import errno
import functools
import os
import sys
from collections import namedtuple
from . import _common
from . import _psutil_windows as cext
from ._common import conn_tmap, usage_percent, isfile_strict
from ._common import sockfam_to_enum, socktype_to_enum
from ._compat imp... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.basic import get_exception
try:
import pan.xapi
from pan.xapi import PanXapiError
import... |
import urllib2, os, tempfile
import numpy as np
from scipy.misc import imread
from cs231n.fast_layers import conv_forward_fast
"""
Utility functions used for viewing and processing images.
"""
def blur_image(X):
"""
A very gentle image blurring operation, to be used as a regularizer for image
generation.
... |
import pycurl
import csv
import hashlib
import re
import os.path
import time
import itertools
import sys
import getopt
#globals
url = ''
file_list_path = ''
local_resource_path = ''
# Helper functions:
# A simple function which returns the sha hash of a file in hex
def get_file_sha(filename):
try:
sha_hash = ha... |
'''OpenGL extension NV.parameter_buffer_object
This module customises the behaviour of the
OpenGL.raw.GL.NV.parameter_buffer_object to provide a more
Python-friendly API
Overview (from the spec)
This extension, in conjunction with NV_gpu_program4, provides a new type
of program parameter than can be used as a c... |
from __future__ import unicode_literals
import sys
from django.conf import settings
from django.template import Library, Node, TemplateSyntaxError, Variable
from django.template.base import TOKEN_TEXT, TOKEN_VAR, render_value_in_context
from django.template.defaulttags import token_kwargs
from django.utils import six... |
#!/usr/bin/env python
from __future__ import print_function
__author__ = "Martin Paul Eve"
__email__ = "<EMAIL>"
"""
A class to handle an interactive prompt.
Portions of this file are Copyright 2014, Adrian Sampson.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software an... |
apiAttachAvailable = u'\u0414\u043e\u0441\u0442\u044a\u043f\u0435\u043d \u0447\u0440\u0435\u0437 API'
apiAttachNotAvailable = u'\u041d\u0435\u0434\u043e\u0441\u0442\u044a\u043f\u0435\u043d'
apiAttachPendingAuthorization = u'\u0427\u0430\u043a\u0430 \u0441\u0435 \u043e\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u... |
"""
support methods for python clients
"""
import json
import collections
from datetime import datetime
from uuid import UUID
from enum import Enum
from dateutil import parser
# python2/3 compatible basestring, for use in to_dict
try:
basestring
except NameError:
basestring = str
def timestamp_from_datetim... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.