code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1 value | license stringclasses 15 values | size int64 3 1.05M |
|---|---|---|---|---|---|
#
# Copyright (c) 2006, 2007 Canonical
#
# Written by Gustavo Niemeyer <gustavo@niemeyer.net>
#
# This file is part of Storm Object Relational Mapper.
#
# Storm is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.
#
# Storm is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from zope import component
from storm.zope.interfaces import IZStorm
def set_default_uri(name, uri):
"""Register C{uri} as the default URI for stores called C{name}."""
zstorm = component.getUtility(IZStorm)
zstorm.set_default_uri(name, uri)
def store(_context, name, uri):
_context.action(discriminator=("store", name),
callable=set_default_uri,
args=(name, uri))
| nwokeo/supysonic | venv/lib/python2.7/site-packages/storm/zope/metaconfigure.py | Python | agpl-3.0 | 1,225 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
return True
pybindgen.settings.error_handler = ErrorHandler()
import sys
def module_init():
root_module = Module('ns.internet_apps', cpp_namespace='::ns3')
return root_module
def register_types(module):
root_module = module.get_root()
## address.h (module 'network'): ns3::Address [class]
module.add_class('Address', import_from_module='ns.network')
## address.h (module 'network'): ns3::Address::MaxSize_e [enumeration]
module.add_enum('MaxSize_e', ['MAX_SIZE'], outer_class=root_module['ns3::Address'], import_from_module='ns.network')
## application-container.h (module 'network'): ns3::ApplicationContainer [class]
module.add_class('ApplicationContainer', import_from_module='ns.network')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::Application > > const_iterator', u'ns3::ApplicationContainer::Iterator')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::Application > > const_iterator*', u'ns3::ApplicationContainer::Iterator*')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::Application > > const_iterator&', u'ns3::ApplicationContainer::Iterator&')
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList [class]
module.add_class('AttributeConstructionList', import_from_module='ns.core')
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item [struct]
module.add_class('Item', import_from_module='ns.core', outer_class=root_module['ns3::AttributeConstructionList'])
typehandlers.add_type_alias(u'std::list< ns3::AttributeConstructionList::Item > const_iterator', u'ns3::AttributeConstructionList::CIterator')
typehandlers.add_type_alias(u'std::list< ns3::AttributeConstructionList::Item > const_iterator*', u'ns3::AttributeConstructionList::CIterator*')
typehandlers.add_type_alias(u'std::list< ns3::AttributeConstructionList::Item > const_iterator&', u'ns3::AttributeConstructionList::CIterator&')
## average.h (module 'stats'): ns3::Average<double> [class]
module.add_class('Average', import_from_module='ns.stats', template_parameters=['double'])
## buffer.h (module 'network'): ns3::Buffer [class]
module.add_class('Buffer', import_from_module='ns.network')
## buffer.h (module 'network'): ns3::Buffer::Iterator [class]
module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::Buffer'])
## packet.h (module 'network'): ns3::ByteTagIterator [class]
module.add_class('ByteTagIterator', import_from_module='ns.network')
## packet.h (module 'network'): ns3::ByteTagIterator::Item [class]
module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagIterator'])
## byte-tag-list.h (module 'network'): ns3::ByteTagList [class]
module.add_class('ByteTagList', import_from_module='ns.network')
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator [class]
module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList'])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item [struct]
module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList::Iterator'])
## callback.h (module 'core'): ns3::CallbackBase [class]
module.add_class('CallbackBase', import_from_module='ns.core')
## data-output-interface.h (module 'stats'): ns3::DataOutputCallback [class]
module.add_class('DataOutputCallback', allow_subclassing=True, import_from_module='ns.stats')
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::AttributeAccessor> [struct]
module.add_class('DefaultDeleter', import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::AttributeChecker> [struct]
module.add_class('DefaultDeleter', import_from_module='ns.core', template_parameters=['ns3::AttributeChecker'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::AttributeValue> [struct]
module.add_class('DefaultDeleter', import_from_module='ns.core', template_parameters=['ns3::AttributeValue'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::CallbackImplBase> [struct]
module.add_class('DefaultDeleter', import_from_module='ns.core', template_parameters=['ns3::CallbackImplBase'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::EventImpl> [struct]
module.add_class('DefaultDeleter', import_from_module='ns.core', template_parameters=['ns3::EventImpl'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::Hash::Implementation> [struct]
module.add_class('DefaultDeleter', import_from_module='ns.core', template_parameters=['ns3::Hash::Implementation'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::NixVector> [struct]
module.add_class('DefaultDeleter', import_from_module='ns.core', template_parameters=['ns3::NixVector'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::Packet> [struct]
module.add_class('DefaultDeleter', import_from_module='ns.core', template_parameters=['ns3::Packet'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::RadvdInterface> [struct]
module.add_class('DefaultDeleter', template_parameters=['ns3::RadvdInterface'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::RadvdPrefix> [struct]
module.add_class('DefaultDeleter', template_parameters=['ns3::RadvdPrefix'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::TraceSourceAccessor> [struct]
module.add_class('DefaultDeleter', import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor'])
## dhcp-helper.h (module 'internet-apps'): ns3::DhcpHelper [class]
module.add_class('DhcpHelper')
## event-id.h (module 'core'): ns3::EventId [class]
module.add_class('EventId', import_from_module='ns.core')
## hash.h (module 'core'): ns3::Hasher [class]
module.add_class('Hasher', import_from_module='ns.core')
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress [class]
module.add_class('Inet6SocketAddress', import_from_module='ns.network')
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress [class]
root_module['ns3::Inet6SocketAddress'].implicitly_converts_to(root_module['ns3::Address'])
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress [class]
module.add_class('InetSocketAddress', import_from_module='ns.network')
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress [class]
root_module['ns3::InetSocketAddress'].implicitly_converts_to(root_module['ns3::Address'])
## ipv4-address.h (module 'network'): ns3::Ipv4Address [class]
module.add_class('Ipv4Address', import_from_module='ns.network')
## ipv4-address.h (module 'network'): ns3::Ipv4Address [class]
root_module['ns3::Ipv4Address'].implicitly_converts_to(root_module['ns3::Address'])
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress [class]
module.add_class('Ipv4InterfaceAddress', import_from_module='ns.internet')
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e [enumeration]
module.add_enum('InterfaceAddressScope_e', ['HOST', 'LINK', 'GLOBAL'], outer_class=root_module['ns3::Ipv4InterfaceAddress'], import_from_module='ns.internet')
## ipv4-interface-container.h (module 'internet'): ns3::Ipv4InterfaceContainer [class]
module.add_class('Ipv4InterfaceContainer', import_from_module='ns.internet')
typehandlers.add_type_alias(u'std::vector< std::pair< ns3::Ptr< ns3::Ipv4 >, unsigned int > > const_iterator', u'ns3::Ipv4InterfaceContainer::Iterator')
typehandlers.add_type_alias(u'std::vector< std::pair< ns3::Ptr< ns3::Ipv4 >, unsigned int > > const_iterator*', u'ns3::Ipv4InterfaceContainer::Iterator*')
typehandlers.add_type_alias(u'std::vector< std::pair< ns3::Ptr< ns3::Ipv4 >, unsigned int > > const_iterator&', u'ns3::Ipv4InterfaceContainer::Iterator&')
## ipv4-address.h (module 'network'): ns3::Ipv4Mask [class]
module.add_class('Ipv4Mask', import_from_module='ns.network')
## ipv6-address.h (module 'network'): ns3::Ipv6Address [class]
module.add_class('Ipv6Address', import_from_module='ns.network')
## ipv6-address.h (module 'network'): ns3::Ipv6Address [class]
root_module['ns3::Ipv6Address'].implicitly_converts_to(root_module['ns3::Address'])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix [class]
module.add_class('Ipv6Prefix', import_from_module='ns.network')
## mac48-address.h (module 'network'): ns3::Mac48Address [class]
module.add_class('Mac48Address', import_from_module='ns.network')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Mac48Address )', u'ns3::Mac48Address::TracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Mac48Address )*', u'ns3::Mac48Address::TracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Mac48Address )&', u'ns3::Mac48Address::TracedCallback&')
## mac48-address.h (module 'network'): ns3::Mac48Address [class]
root_module['ns3::Mac48Address'].implicitly_converts_to(root_module['ns3::Address'])
## mac64-address.h (module 'network'): ns3::Mac64Address [class]
module.add_class('Mac64Address', import_from_module='ns.network')
## mac64-address.h (module 'network'): ns3::Mac64Address [class]
root_module['ns3::Mac64Address'].implicitly_converts_to(root_module['ns3::Address'])
## mac8-address.h (module 'network'): ns3::Mac8Address [class]
module.add_class('Mac8Address', import_from_module='ns.network')
## mac8-address.h (module 'network'): ns3::Mac8Address [class]
root_module['ns3::Mac8Address'].implicitly_converts_to(root_module['ns3::Address'])
## net-device-container.h (module 'network'): ns3::NetDeviceContainer [class]
module.add_class('NetDeviceContainer', import_from_module='ns.network')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::NetDevice > > const_iterator', u'ns3::NetDeviceContainer::Iterator')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::NetDevice > > const_iterator*', u'ns3::NetDeviceContainer::Iterator*')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::NetDevice > > const_iterator&', u'ns3::NetDeviceContainer::Iterator&')
## node-container.h (module 'network'): ns3::NodeContainer [class]
module.add_class('NodeContainer', import_from_module='ns.network')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::Node > > const_iterator', u'ns3::NodeContainer::Iterator')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::Node > > const_iterator*', u'ns3::NodeContainer::Iterator*')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::Node > > const_iterator&', u'ns3::NodeContainer::Iterator&')
## object-base.h (module 'core'): ns3::ObjectBase [class]
module.add_class('ObjectBase', allow_subclassing=True, import_from_module='ns.core')
## object.h (module 'core'): ns3::ObjectDeleter [struct]
module.add_class('ObjectDeleter', import_from_module='ns.core')
## object-factory.h (module 'core'): ns3::ObjectFactory [class]
module.add_class('ObjectFactory', import_from_module='ns.core')
## packet-metadata.h (module 'network'): ns3::PacketMetadata [class]
module.add_class('PacketMetadata', import_from_module='ns.network')
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [struct]
module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::PacketMetadata'])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::ItemType [enumeration]
module.add_enum('ItemType', ['PAYLOAD', 'HEADER', 'TRAILER'], outer_class=root_module['ns3::PacketMetadata::Item'], import_from_module='ns.network')
## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator [class]
module.add_class('ItemIterator', import_from_module='ns.network', outer_class=root_module['ns3::PacketMetadata'])
## packet.h (module 'network'): ns3::PacketTagIterator [class]
module.add_class('PacketTagIterator', import_from_module='ns.network')
## packet.h (module 'network'): ns3::PacketTagIterator::Item [class]
module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagIterator'])
## packet-tag-list.h (module 'network'): ns3::PacketTagList [class]
module.add_class('PacketTagList', import_from_module='ns.network')
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData [struct]
module.add_class('TagData', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagList'])
## ping6-helper.h (module 'internet-apps'): ns3::Ping6Helper [class]
module.add_class('Ping6Helper')
## radvd-helper.h (module 'internet-apps'): ns3::RadvdHelper [class]
module.add_class('RadvdHelper')
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'], parent=root_module['ns3::ObjectBase'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simulator.h (module 'core'): ns3::Simulator [class]
module.add_class('Simulator', destructor_visibility='private', import_from_module='ns.core')
## simulator.h (module 'core'): ns3::Simulator [enumeration]
module.add_enum('', ['NO_CONTEXT'], outer_class=root_module['ns3::Simulator'], import_from_module='ns.core')
## data-calculator.h (module 'stats'): ns3::StatisticalSummary [class]
module.add_class('StatisticalSummary', allow_subclassing=True, import_from_module='ns.stats')
## tag.h (module 'network'): ns3::Tag [class]
module.add_class('Tag', import_from_module='ns.network', parent=root_module['ns3::ObjectBase'])
## tag-buffer.h (module 'network'): ns3::TagBuffer [class]
module.add_class('TagBuffer', import_from_module='ns.network')
## nstime.h (module 'core'): ns3::TimeWithUnit [class]
module.add_class('TimeWithUnit', import_from_module='ns.core')
## type-id.h (module 'core'): ns3::TypeId [class]
module.add_class('TypeId', import_from_module='ns.core')
## type-id.h (module 'core'): ns3::TypeId::AttributeFlag [enumeration]
module.add_enum('AttributeFlag', ['ATTR_GET', 'ATTR_SET', 'ATTR_CONSTRUCT', 'ATTR_SGC'], outer_class=root_module['ns3::TypeId'], import_from_module='ns.core')
## type-id.h (module 'core'): ns3::TypeId::SupportLevel [enumeration]
module.add_enum('SupportLevel', ['SUPPORTED', 'DEPRECATED', 'OBSOLETE'], outer_class=root_module['ns3::TypeId'], import_from_module='ns.core')
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation [struct]
module.add_class('AttributeInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId'])
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation [struct]
module.add_class('TraceSourceInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId'])
typehandlers.add_type_alias(u'uint32_t', u'ns3::TypeId::hash_t')
typehandlers.add_type_alias(u'uint32_t*', u'ns3::TypeId::hash_t*')
typehandlers.add_type_alias(u'uint32_t&', u'ns3::TypeId::hash_t&')
## v4ping-helper.h (module 'internet-apps'): ns3::V4PingHelper [class]
module.add_class('V4PingHelper')
## empty.h (module 'core'): ns3::empty [class]
module.add_class('empty', import_from_module='ns.core')
## int64x64-128.h (module 'core'): ns3::int64x64_t [class]
module.add_class('int64x64_t', import_from_module='ns.core')
## int64x64-128.h (module 'core'): ns3::int64x64_t::impl_type [enumeration]
module.add_enum('impl_type', ['int128_impl', 'cairo_impl', 'ld_impl'], outer_class=root_module['ns3::int64x64_t'], import_from_module='ns.core')
## chunk.h (module 'network'): ns3::Chunk [class]
module.add_class('Chunk', import_from_module='ns.network', parent=root_module['ns3::ObjectBase'])
## header.h (module 'network'): ns3::Header [class]
module.add_class('Header', import_from_module='ns.network', parent=root_module['ns3::Chunk'])
## object.h (module 'core'): ns3::Object [class]
module.add_class('Object', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
## object.h (module 'core'): ns3::Object::AggregateIterator [class]
module.add_class('AggregateIterator', import_from_module='ns.core', outer_class=root_module['ns3::Object'])
## random-variable-stream.h (module 'core'): ns3::RandomVariableStream [class]
module.add_class('RandomVariableStream', import_from_module='ns.core', parent=root_module['ns3::Object'])
## random-variable-stream.h (module 'core'): ns3::SequentialRandomVariable [class]
module.add_class('SequentialRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeChecker', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeChecker>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeValue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeValue>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::CallbackImplBase', 'ns3::empty', 'ns3::DefaultDeleter<ns3::CallbackImplBase>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::EventImpl', 'ns3::empty', 'ns3::DefaultDeleter<ns3::EventImpl>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Hash::Implementation', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Hash::Implementation>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Ipv4MulticastRoute', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Ipv4MulticastRoute>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Ipv4Route', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Ipv4Route>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::NixVector', 'ns3::empty', 'ns3::DefaultDeleter<ns3::NixVector>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Packet', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Packet>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::RadvdInterface, ns3::empty, ns3::DefaultDeleter<ns3::RadvdInterface> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::RadvdInterface', 'ns3::empty', 'ns3::DefaultDeleter<ns3::RadvdInterface>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::RadvdPrefix, ns3::empty, ns3::DefaultDeleter<ns3::RadvdPrefix> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::RadvdPrefix', 'ns3::empty', 'ns3::DefaultDeleter<ns3::RadvdPrefix>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## socket.h (module 'network'): ns3::Socket [class]
module.add_class('Socket', import_from_module='ns.network', parent=root_module['ns3::Object'])
## socket.h (module 'network'): ns3::Socket::SocketErrno [enumeration]
module.add_enum('SocketErrno', ['ERROR_NOTERROR', 'ERROR_ISCONN', 'ERROR_NOTCONN', 'ERROR_MSGSIZE', 'ERROR_AGAIN', 'ERROR_SHUTDOWN', 'ERROR_OPNOTSUPP', 'ERROR_AFNOSUPPORT', 'ERROR_INVAL', 'ERROR_BADF', 'ERROR_NOROUTETOHOST', 'ERROR_NODEV', 'ERROR_ADDRNOTAVAIL', 'ERROR_ADDRINUSE', 'SOCKET_ERRNO_LAST'], outer_class=root_module['ns3::Socket'], import_from_module='ns.network')
## socket.h (module 'network'): ns3::Socket::SocketType [enumeration]
module.add_enum('SocketType', ['NS3_SOCK_STREAM', 'NS3_SOCK_SEQPACKET', 'NS3_SOCK_DGRAM', 'NS3_SOCK_RAW'], outer_class=root_module['ns3::Socket'], import_from_module='ns.network')
## socket.h (module 'network'): ns3::Socket::SocketPriority [enumeration]
module.add_enum('SocketPriority', ['NS3_PRIO_BESTEFFORT', 'NS3_PRIO_FILLER', 'NS3_PRIO_BULK', 'NS3_PRIO_INTERACTIVE_BULK', 'NS3_PRIO_INTERACTIVE', 'NS3_PRIO_CONTROL'], outer_class=root_module['ns3::Socket'], import_from_module='ns.network')
## socket.h (module 'network'): ns3::Socket::Ipv6MulticastFilterMode [enumeration]
module.add_enum('Ipv6MulticastFilterMode', ['INCLUDE', 'EXCLUDE'], outer_class=root_module['ns3::Socket'], import_from_module='ns.network')
## socket.h (module 'network'): ns3::SocketIpTosTag [class]
module.add_class('SocketIpTosTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## socket.h (module 'network'): ns3::SocketIpTtlTag [class]
module.add_class('SocketIpTtlTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## socket.h (module 'network'): ns3::SocketIpv6HopLimitTag [class]
module.add_class('SocketIpv6HopLimitTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## socket.h (module 'network'): ns3::SocketIpv6TclassTag [class]
module.add_class('SocketIpv6TclassTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## socket.h (module 'network'): ns3::SocketPriorityTag [class]
module.add_class('SocketPriorityTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## socket.h (module 'network'): ns3::SocketSetDontFragmentTag [class]
module.add_class('SocketSetDontFragmentTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## nstime.h (module 'core'): ns3::Time [class]
module.add_class('Time', import_from_module='ns.core')
## nstime.h (module 'core'): ns3::Time::Unit [enumeration]
module.add_enum('Unit', ['Y', 'D', 'H', 'MIN', 'S', 'MS', 'US', 'NS', 'PS', 'FS', 'LAST'], outer_class=root_module['ns3::Time'], import_from_module='ns.core')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Time )', u'ns3::Time::TracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Time )*', u'ns3::Time::TracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Time )&', u'ns3::Time::TracedCallback&')
## nstime.h (module 'core'): ns3::Time [class]
root_module['ns3::Time'].implicitly_converts_to(root_module['ns3::int64x64_t'])
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor [class]
module.add_class('TraceSourceAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
## trailer.h (module 'network'): ns3::Trailer [class]
module.add_class('Trailer', import_from_module='ns.network', parent=root_module['ns3::Chunk'])
## random-variable-stream.h (module 'core'): ns3::TriangularRandomVariable [class]
module.add_class('TriangularRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## random-variable-stream.h (module 'core'): ns3::UniformRandomVariable [class]
module.add_class('UniformRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## random-variable-stream.h (module 'core'): ns3::WeibullRandomVariable [class]
module.add_class('WeibullRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## random-variable-stream.h (module 'core'): ns3::ZetaRandomVariable [class]
module.add_class('ZetaRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## random-variable-stream.h (module 'core'): ns3::ZipfRandomVariable [class]
module.add_class('ZipfRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## application.h (module 'network'): ns3::Application [class]
module.add_class('Application', import_from_module='ns.network', parent=root_module['ns3::Object'])
typehandlers.add_type_alias(u'void ( * ) ( ns3::Time const &, ns3::Address const & )', u'ns3::Application::DelayAddressCallback')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Time const &, ns3::Address const & )*', u'ns3::Application::DelayAddressCallback*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Time const &, ns3::Address const & )&', u'ns3::Application::DelayAddressCallback&')
typehandlers.add_type_alias(u'void ( * ) ( std::string const &, std::string const & )', u'ns3::Application::StateTransitionCallback')
typehandlers.add_type_alias(u'void ( * ) ( std::string const &, std::string const & )*', u'ns3::Application::StateTransitionCallback*')
typehandlers.add_type_alias(u'void ( * ) ( std::string const &, std::string const & )&', u'ns3::Application::StateTransitionCallback&')
## attribute.h (module 'core'): ns3::AttributeAccessor [class]
module.add_class('AttributeAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
## attribute.h (module 'core'): ns3::AttributeChecker [class]
module.add_class('AttributeChecker', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
## attribute.h (module 'core'): ns3::AttributeValue [class]
module.add_class('AttributeValue', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
## boolean.h (module 'core'): ns3::BooleanChecker [class]
module.add_class('BooleanChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## boolean.h (module 'core'): ns3::BooleanValue [class]
module.add_class('BooleanValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## callback.h (module 'core'): ns3::CallbackChecker [class]
module.add_class('CallbackChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## callback.h (module 'core'): ns3::CallbackImplBase [class]
module.add_class('CallbackImplBase', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >'])
## callback.h (module 'core'): ns3::CallbackValue [class]
module.add_class('CallbackValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## random-variable-stream.h (module 'core'): ns3::ConstantRandomVariable [class]
module.add_class('ConstantRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## data-calculator.h (module 'stats'): ns3::DataCalculator [class]
module.add_class('DataCalculator', import_from_module='ns.stats', parent=root_module['ns3::Object'])
## data-output-interface.h (module 'stats'): ns3::DataOutputInterface [class]
module.add_class('DataOutputInterface', import_from_module='ns.stats', parent=root_module['ns3::Object'])
## random-variable-stream.h (module 'core'): ns3::DeterministicRandomVariable [class]
module.add_class('DeterministicRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## dhcp-client.h (module 'internet-apps'): ns3::DhcpClient [class]
module.add_class('DhcpClient', parent=root_module['ns3::Application'])
## dhcp-header.h (module 'internet-apps'): ns3::DhcpHeader [class]
module.add_class('DhcpHeader', parent=root_module['ns3::Header'])
## dhcp-header.h (module 'internet-apps'): ns3::DhcpHeader::Options [enumeration]
module.add_enum('Options', ['OP_MASK', 'OP_ROUTE', 'OP_ADDREQ', 'OP_LEASE', 'OP_MSGTYPE', 'OP_SERVID', 'OP_RENEW', 'OP_REBIND', 'OP_END'], outer_class=root_module['ns3::DhcpHeader'])
## dhcp-header.h (module 'internet-apps'): ns3::DhcpHeader::Messages [enumeration]
module.add_enum('Messages', ['DHCPDISCOVER', 'DHCPOFFER', 'DHCPREQ', 'DHCPACK', 'DHCPNACK'], outer_class=root_module['ns3::DhcpHeader'])
## dhcp-server.h (module 'internet-apps'): ns3::DhcpServer [class]
module.add_class('DhcpServer', parent=root_module['ns3::Application'])
## double.h (module 'core'): ns3::DoubleValue [class]
module.add_class('DoubleValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## random-variable-stream.h (module 'core'): ns3::EmpiricalRandomVariable [class]
module.add_class('EmpiricalRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## attribute.h (module 'core'): ns3::EmptyAttributeAccessor [class]
module.add_class('EmptyAttributeAccessor', import_from_module='ns.core', parent=root_module['ns3::AttributeAccessor'])
## attribute.h (module 'core'): ns3::EmptyAttributeChecker [class]
module.add_class('EmptyAttributeChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## attribute.h (module 'core'): ns3::EmptyAttributeValue [class]
module.add_class('EmptyAttributeValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## enum.h (module 'core'): ns3::EnumChecker [class]
module.add_class('EnumChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## enum.h (module 'core'): ns3::EnumValue [class]
module.add_class('EnumValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## random-variable-stream.h (module 'core'): ns3::ErlangRandomVariable [class]
module.add_class('ErlangRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## event-impl.h (module 'core'): ns3::EventImpl [class]
module.add_class('EventImpl', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >'])
## random-variable-stream.h (module 'core'): ns3::ExponentialRandomVariable [class]
module.add_class('ExponentialRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## random-variable-stream.h (module 'core'): ns3::GammaRandomVariable [class]
module.add_class('GammaRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## integer.h (module 'core'): ns3::IntegerValue [class]
module.add_class('IntegerValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## ipv4.h (module 'internet'): ns3::Ipv4 [class]
module.add_class('Ipv4', import_from_module='ns.internet', parent=root_module['ns3::Object'])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker [class]
module.add_class('Ipv4AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue [class]
module.add_class('Ipv4AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker [class]
module.add_class('Ipv4MaskChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue [class]
module.add_class('Ipv4MaskValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## ipv4-route.h (module 'internet'): ns3::Ipv4MulticastRoute [class]
module.add_class('Ipv4MulticastRoute', import_from_module='ns.internet', parent=root_module['ns3::SimpleRefCount< ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> >'])
## ipv4-route.h (module 'internet'): ns3::Ipv4Route [class]
module.add_class('Ipv4Route', import_from_module='ns.internet', parent=root_module['ns3::SimpleRefCount< ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> >'])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker [class]
module.add_class('Ipv6AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue [class]
module.add_class('Ipv6AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker [class]
module.add_class('Ipv6PrefixChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue [class]
module.add_class('Ipv6PrefixValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## random-variable-stream.h (module 'core'): ns3::LogNormalRandomVariable [class]
module.add_class('LogNormalRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## mac48-address.h (module 'network'): ns3::Mac48AddressChecker [class]
module.add_class('Mac48AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## mac48-address.h (module 'network'): ns3::Mac48AddressValue [class]
module.add_class('Mac48AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## mac64-address.h (module 'network'): ns3::Mac64AddressChecker [class]
module.add_class('Mac64AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## mac64-address.h (module 'network'): ns3::Mac64AddressValue [class]
module.add_class('Mac64AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator<double> [class]
module.add_class('MinMaxAvgTotalCalculator', import_from_module='ns.stats', template_parameters=['double'], parent=[root_module['ns3::DataCalculator'], root_module['ns3::StatisticalSummary']])
## net-device.h (module 'network'): ns3::NetDevice [class]
module.add_class('NetDevice', import_from_module='ns.network', parent=root_module['ns3::Object'])
## net-device.h (module 'network'): ns3::NetDevice::PacketType [enumeration]
module.add_enum('PacketType', ['PACKET_HOST', 'NS3_PACKET_HOST', 'PACKET_BROADCAST', 'NS3_PACKET_BROADCAST', 'PACKET_MULTICAST', 'NS3_PACKET_MULTICAST', 'PACKET_OTHERHOST', 'NS3_PACKET_OTHERHOST'], outer_class=root_module['ns3::NetDevice'], import_from_module='ns.network')
typehandlers.add_type_alias(u'void ( * ) ( )', u'ns3::NetDevice::LinkChangeTracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( )*', u'ns3::NetDevice::LinkChangeTracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( )&', u'ns3::NetDevice::LinkChangeTracedCallback&')
typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::NetDevice::ReceiveCallback')
typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::NetDevice::ReceiveCallback*')
typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::NetDevice::ReceiveCallback&')
typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', u'ns3::NetDevice::PromiscReceiveCallback')
typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::NetDevice::PromiscReceiveCallback*')
typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::NetDevice::PromiscReceiveCallback&')
## nix-vector.h (module 'network'): ns3::NixVector [class]
module.add_class('NixVector', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >'])
## node.h (module 'network'): ns3::Node [class]
module.add_class('Node', import_from_module='ns.network', parent=root_module['ns3::Object'])
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', u'ns3::Node::ProtocolHandler')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::Node::ProtocolHandler*')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::Node::ProtocolHandler&')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::Node::DeviceAdditionListener')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::Node::DeviceAdditionListener*')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::Node::DeviceAdditionListener&')
## random-variable-stream.h (module 'core'): ns3::NormalRandomVariable [class]
module.add_class('NormalRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## object-factory.h (module 'core'): ns3::ObjectFactoryChecker [class]
module.add_class('ObjectFactoryChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## object-factory.h (module 'core'): ns3::ObjectFactoryValue [class]
module.add_class('ObjectFactoryValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## packet.h (module 'network'): ns3::Packet [class]
module.add_class('Packet', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const > )', u'ns3::Packet::TracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const > )*', u'ns3::Packet::TracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const > )&', u'ns3::Packet::TracedCallback&')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const >, ns3::Address const & )', u'ns3::Packet::AddressTracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const >, ns3::Address const & )*', u'ns3::Packet::AddressTracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const >, ns3::Address const & )&', u'ns3::Packet::AddressTracedCallback&')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const > const, ns3::Address const &, ns3::Address const & )', u'ns3::Packet::TwoAddressTracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const > const, ns3::Address const &, ns3::Address const & )*', u'ns3::Packet::TwoAddressTracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const > const, ns3::Address const &, ns3::Address const & )&', u'ns3::Packet::TwoAddressTracedCallback&')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const >, ns3::Mac48Address )', u'ns3::Packet::Mac48AddressTracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const >, ns3::Mac48Address )*', u'ns3::Packet::Mac48AddressTracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const >, ns3::Mac48Address )&', u'ns3::Packet::Mac48AddressTracedCallback&')
typehandlers.add_type_alias(u'void ( * ) ( uint32_t, uint32_t )', u'ns3::Packet::SizeTracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( uint32_t, uint32_t )*', u'ns3::Packet::SizeTracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( uint32_t, uint32_t )&', u'ns3::Packet::SizeTracedCallback&')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const >, double )', u'ns3::Packet::SinrTracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const >, double )*', u'ns3::Packet::SinrTracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const >, double )&', u'ns3::Packet::SinrTracedCallback&')
## random-variable-stream.h (module 'core'): ns3::ParetoRandomVariable [class]
module.add_class('ParetoRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## ping6.h (module 'internet-apps'): ns3::Ping6 [class]
module.add_class('Ping6', parent=root_module['ns3::Application'])
## radvd.h (module 'internet-apps'): ns3::Radvd [class]
module.add_class('Radvd', parent=root_module['ns3::Application'])
## radvd-interface.h (module 'internet-apps'): ns3::RadvdInterface [class]
module.add_class('RadvdInterface', parent=root_module['ns3::SimpleRefCount< ns3::RadvdInterface, ns3::empty, ns3::DefaultDeleter<ns3::RadvdInterface> >'])
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::RadvdPrefix > >', u'ns3::RadvdInterface::RadvdPrefixList')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::RadvdPrefix > >*', u'ns3::RadvdInterface::RadvdPrefixList*')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::RadvdPrefix > >&', u'ns3::RadvdInterface::RadvdPrefixList&')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::RadvdPrefix > > iterator', u'ns3::RadvdInterface::RadvdPrefixListI')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::RadvdPrefix > > iterator*', u'ns3::RadvdInterface::RadvdPrefixListI*')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::RadvdPrefix > > iterator&', u'ns3::RadvdInterface::RadvdPrefixListI&')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::RadvdPrefix > > const_iterator', u'ns3::RadvdInterface::RadvdPrefixListCI')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::RadvdPrefix > > const_iterator*', u'ns3::RadvdInterface::RadvdPrefixListCI*')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::RadvdPrefix > > const_iterator&', u'ns3::RadvdInterface::RadvdPrefixListCI&')
## radvd-prefix.h (module 'internet-apps'): ns3::RadvdPrefix [class]
module.add_class('RadvdPrefix', parent=root_module['ns3::SimpleRefCount< ns3::RadvdPrefix, ns3::empty, ns3::DefaultDeleter<ns3::RadvdPrefix> >'])
## nstime.h (module 'core'): ns3::TimeValue [class]
module.add_class('TimeValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## type-id.h (module 'core'): ns3::TypeIdChecker [class]
module.add_class('TypeIdChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## type-id.h (module 'core'): ns3::TypeIdValue [class]
module.add_class('TypeIdValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## uinteger.h (module 'core'): ns3::UintegerValue [class]
module.add_class('UintegerValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## v4ping.h (module 'internet-apps'): ns3::V4Ping [class]
module.add_class('V4Ping', parent=root_module['ns3::Application'])
## address.h (module 'network'): ns3::AddressChecker [class]
module.add_class('AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## address.h (module 'network'): ns3::AddressValue [class]
module.add_class('AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## callback.h (module 'core'): ns3::CallbackImpl<bool, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['bool', 'ns3::Ptr<ns3::Socket>', 'const ns3::Address &', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['ns3::ObjectBase *', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<void, const ns3::Ipv4Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['void', 'const ns3::Ipv4Address &', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['void', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<const ns3::Packet>', 'unsigned short', 'const ns3::Address &', 'const ns3::Address &', 'ns3::NetDevice::PacketType', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['void', 'ns3::Ptr<ns3::NetDevice>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['void', 'ns3::Ptr<ns3::Socket>', 'const ns3::Address &', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['void', 'ns3::Ptr<ns3::Socket>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['void', 'ns3::Ptr<ns3::Socket>', 'unsigned int', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Time, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['void', 'ns3::Time', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
module.add_container('std::vector< ns3::Ipv6Address >', 'ns3::Ipv6Address', container_type=u'vector')
module.add_container('std::map< unsigned int, unsigned int >', ('unsigned int', 'unsigned int'), container_type=u'map')
module.add_container('std::list< ns3::Ptr< ns3::RadvdPrefix > >', 'ns3::Ptr< ns3::RadvdPrefix >', container_type=u'list')
module.add_container('ns3::RadvdInterface::RadvdPrefixList', 'ns3::Ptr< ns3::RadvdPrefix >', container_type=u'list')
## Register a nested module for the namespace FatalImpl
nested_module = module.add_cpp_namespace('FatalImpl')
register_types_ns3_FatalImpl(nested_module)
## Register a nested module for the namespace Hash
nested_module = module.add_cpp_namespace('Hash')
register_types_ns3_Hash(nested_module)
## Register a nested module for the namespace TracedValueCallback
nested_module = module.add_cpp_namespace('TracedValueCallback')
register_types_ns3_TracedValueCallback(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
register_types_ns3_internal(nested_module)
def register_types_ns3_FatalImpl(module):
root_module = module.get_root()
def register_types_ns3_Hash(module):
root_module = module.get_root()
## hash-function.h (module 'core'): ns3::Hash::Implementation [class]
module.add_class('Implementation', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> >'])
typehandlers.add_type_alias(u'uint32_t ( * ) ( char const *, std::size_t const )', u'ns3::Hash::Hash32Function_ptr')
typehandlers.add_type_alias(u'uint32_t ( * ) ( char const *, std::size_t const )*', u'ns3::Hash::Hash32Function_ptr*')
typehandlers.add_type_alias(u'uint32_t ( * ) ( char const *, std::size_t const )&', u'ns3::Hash::Hash32Function_ptr&')
typehandlers.add_type_alias(u'uint64_t ( * ) ( char const *, std::size_t const )', u'ns3::Hash::Hash64Function_ptr')
typehandlers.add_type_alias(u'uint64_t ( * ) ( char const *, std::size_t const )*', u'ns3::Hash::Hash64Function_ptr*')
typehandlers.add_type_alias(u'uint64_t ( * ) ( char const *, std::size_t const )&', u'ns3::Hash::Hash64Function_ptr&')
## Register a nested module for the namespace Function
nested_module = module.add_cpp_namespace('Function')
register_types_ns3_Hash_Function(nested_module)
def register_types_ns3_Hash_Function(module):
root_module = module.get_root()
## hash-fnv.h (module 'core'): ns3::Hash::Function::Fnv1a [class]
module.add_class('Fnv1a', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation'])
## hash-function.h (module 'core'): ns3::Hash::Function::Hash32 [class]
module.add_class('Hash32', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation'])
## hash-function.h (module 'core'): ns3::Hash::Function::Hash64 [class]
module.add_class('Hash64', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation'])
## hash-murmur3.h (module 'core'): ns3::Hash::Function::Murmur3 [class]
module.add_class('Murmur3', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation'])
def register_types_ns3_TracedValueCallback(module):
root_module = module.get_root()
typehandlers.add_type_alias(u'void ( * ) ( ns3::Time, ns3::Time )', u'ns3::TracedValueCallback::Time')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Time, ns3::Time )*', u'ns3::TracedValueCallback::Time*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Time, ns3::Time )&', u'ns3::TracedValueCallback::Time&')
typehandlers.add_type_alias(u'void ( * ) ( bool, bool )', u'ns3::TracedValueCallback::Bool')
typehandlers.add_type_alias(u'void ( * ) ( bool, bool )*', u'ns3::TracedValueCallback::Bool*')
typehandlers.add_type_alias(u'void ( * ) ( bool, bool )&', u'ns3::TracedValueCallback::Bool&')
typehandlers.add_type_alias(u'void ( * ) ( int8_t, int8_t )', u'ns3::TracedValueCallback::Int8')
typehandlers.add_type_alias(u'void ( * ) ( int8_t, int8_t )*', u'ns3::TracedValueCallback::Int8*')
typehandlers.add_type_alias(u'void ( * ) ( int8_t, int8_t )&', u'ns3::TracedValueCallback::Int8&')
typehandlers.add_type_alias(u'void ( * ) ( uint8_t, uint8_t )', u'ns3::TracedValueCallback::Uint8')
typehandlers.add_type_alias(u'void ( * ) ( uint8_t, uint8_t )*', u'ns3::TracedValueCallback::Uint8*')
typehandlers.add_type_alias(u'void ( * ) ( uint8_t, uint8_t )&', u'ns3::TracedValueCallback::Uint8&')
typehandlers.add_type_alias(u'void ( * ) ( int16_t, int16_t )', u'ns3::TracedValueCallback::Int16')
typehandlers.add_type_alias(u'void ( * ) ( int16_t, int16_t )*', u'ns3::TracedValueCallback::Int16*')
typehandlers.add_type_alias(u'void ( * ) ( int16_t, int16_t )&', u'ns3::TracedValueCallback::Int16&')
typehandlers.add_type_alias(u'void ( * ) ( uint16_t, uint16_t )', u'ns3::TracedValueCallback::Uint16')
typehandlers.add_type_alias(u'void ( * ) ( uint16_t, uint16_t )*', u'ns3::TracedValueCallback::Uint16*')
typehandlers.add_type_alias(u'void ( * ) ( uint16_t, uint16_t )&', u'ns3::TracedValueCallback::Uint16&')
typehandlers.add_type_alias(u'void ( * ) ( int32_t, int32_t )', u'ns3::TracedValueCallback::Int32')
typehandlers.add_type_alias(u'void ( * ) ( int32_t, int32_t )*', u'ns3::TracedValueCallback::Int32*')
typehandlers.add_type_alias(u'void ( * ) ( int32_t, int32_t )&', u'ns3::TracedValueCallback::Int32&')
typehandlers.add_type_alias(u'void ( * ) ( uint32_t, uint32_t )', u'ns3::TracedValueCallback::Uint32')
typehandlers.add_type_alias(u'void ( * ) ( uint32_t, uint32_t )*', u'ns3::TracedValueCallback::Uint32*')
typehandlers.add_type_alias(u'void ( * ) ( uint32_t, uint32_t )&', u'ns3::TracedValueCallback::Uint32&')
typehandlers.add_type_alias(u'void ( * ) ( double, double )', u'ns3::TracedValueCallback::Double')
typehandlers.add_type_alias(u'void ( * ) ( double, double )*', u'ns3::TracedValueCallback::Double*')
typehandlers.add_type_alias(u'void ( * ) ( double, double )&', u'ns3::TracedValueCallback::Double&')
typehandlers.add_type_alias(u'void ( * ) ( )', u'ns3::TracedValueCallback::Void')
typehandlers.add_type_alias(u'void ( * ) ( )*', u'ns3::TracedValueCallback::Void*')
typehandlers.add_type_alias(u'void ( * ) ( )&', u'ns3::TracedValueCallback::Void&')
def register_types_ns3_internal(module):
root_module = module.get_root()
def register_methods(root_module):
register_Ns3Address_methods(root_module, root_module['ns3::Address'])
register_Ns3ApplicationContainer_methods(root_module, root_module['ns3::ApplicationContainer'])
register_Ns3AttributeConstructionList_methods(root_module, root_module['ns3::AttributeConstructionList'])
register_Ns3AttributeConstructionListItem_methods(root_module, root_module['ns3::AttributeConstructionList::Item'])
register_Ns3Average__Double_methods(root_module, root_module['ns3::Average< double >'])
register_Ns3Buffer_methods(root_module, root_module['ns3::Buffer'])
register_Ns3BufferIterator_methods(root_module, root_module['ns3::Buffer::Iterator'])
register_Ns3ByteTagIterator_methods(root_module, root_module['ns3::ByteTagIterator'])
register_Ns3ByteTagIteratorItem_methods(root_module, root_module['ns3::ByteTagIterator::Item'])
register_Ns3ByteTagList_methods(root_module, root_module['ns3::ByteTagList'])
register_Ns3ByteTagListIterator_methods(root_module, root_module['ns3::ByteTagList::Iterator'])
register_Ns3ByteTagListIteratorItem_methods(root_module, root_module['ns3::ByteTagList::Iterator::Item'])
register_Ns3CallbackBase_methods(root_module, root_module['ns3::CallbackBase'])
register_Ns3DataOutputCallback_methods(root_module, root_module['ns3::DataOutputCallback'])
register_Ns3DefaultDeleter__Ns3AttributeAccessor_methods(root_module, root_module['ns3::DefaultDeleter< ns3::AttributeAccessor >'])
register_Ns3DefaultDeleter__Ns3AttributeChecker_methods(root_module, root_module['ns3::DefaultDeleter< ns3::AttributeChecker >'])
register_Ns3DefaultDeleter__Ns3AttributeValue_methods(root_module, root_module['ns3::DefaultDeleter< ns3::AttributeValue >'])
register_Ns3DefaultDeleter__Ns3CallbackImplBase_methods(root_module, root_module['ns3::DefaultDeleter< ns3::CallbackImplBase >'])
register_Ns3DefaultDeleter__Ns3EventImpl_methods(root_module, root_module['ns3::DefaultDeleter< ns3::EventImpl >'])
register_Ns3DefaultDeleter__Ns3HashImplementation_methods(root_module, root_module['ns3::DefaultDeleter< ns3::Hash::Implementation >'])
register_Ns3DefaultDeleter__Ns3NixVector_methods(root_module, root_module['ns3::DefaultDeleter< ns3::NixVector >'])
register_Ns3DefaultDeleter__Ns3Packet_methods(root_module, root_module['ns3::DefaultDeleter< ns3::Packet >'])
register_Ns3DefaultDeleter__Ns3RadvdInterface_methods(root_module, root_module['ns3::DefaultDeleter< ns3::RadvdInterface >'])
register_Ns3DefaultDeleter__Ns3RadvdPrefix_methods(root_module, root_module['ns3::DefaultDeleter< ns3::RadvdPrefix >'])
register_Ns3DefaultDeleter__Ns3TraceSourceAccessor_methods(root_module, root_module['ns3::DefaultDeleter< ns3::TraceSourceAccessor >'])
register_Ns3DhcpHelper_methods(root_module, root_module['ns3::DhcpHelper'])
register_Ns3EventId_methods(root_module, root_module['ns3::EventId'])
register_Ns3Hasher_methods(root_module, root_module['ns3::Hasher'])
register_Ns3Inet6SocketAddress_methods(root_module, root_module['ns3::Inet6SocketAddress'])
register_Ns3InetSocketAddress_methods(root_module, root_module['ns3::InetSocketAddress'])
register_Ns3Ipv4Address_methods(root_module, root_module['ns3::Ipv4Address'])
register_Ns3Ipv4InterfaceAddress_methods(root_module, root_module['ns3::Ipv4InterfaceAddress'])
register_Ns3Ipv4InterfaceContainer_methods(root_module, root_module['ns3::Ipv4InterfaceContainer'])
register_Ns3Ipv4Mask_methods(root_module, root_module['ns3::Ipv4Mask'])
register_Ns3Ipv6Address_methods(root_module, root_module['ns3::Ipv6Address'])
register_Ns3Ipv6Prefix_methods(root_module, root_module['ns3::Ipv6Prefix'])
register_Ns3Mac48Address_methods(root_module, root_module['ns3::Mac48Address'])
register_Ns3Mac64Address_methods(root_module, root_module['ns3::Mac64Address'])
register_Ns3Mac8Address_methods(root_module, root_module['ns3::Mac8Address'])
register_Ns3NetDeviceContainer_methods(root_module, root_module['ns3::NetDeviceContainer'])
register_Ns3NodeContainer_methods(root_module, root_module['ns3::NodeContainer'])
register_Ns3ObjectBase_methods(root_module, root_module['ns3::ObjectBase'])
register_Ns3ObjectDeleter_methods(root_module, root_module['ns3::ObjectDeleter'])
register_Ns3ObjectFactory_methods(root_module, root_module['ns3::ObjectFactory'])
register_Ns3PacketMetadata_methods(root_module, root_module['ns3::PacketMetadata'])
register_Ns3PacketMetadataItem_methods(root_module, root_module['ns3::PacketMetadata::Item'])
register_Ns3PacketMetadataItemIterator_methods(root_module, root_module['ns3::PacketMetadata::ItemIterator'])
register_Ns3PacketTagIterator_methods(root_module, root_module['ns3::PacketTagIterator'])
register_Ns3PacketTagIteratorItem_methods(root_module, root_module['ns3::PacketTagIterator::Item'])
register_Ns3PacketTagList_methods(root_module, root_module['ns3::PacketTagList'])
register_Ns3PacketTagListTagData_methods(root_module, root_module['ns3::PacketTagList::TagData'])
register_Ns3Ping6Helper_methods(root_module, root_module['ns3::Ping6Helper'])
register_Ns3RadvdHelper_methods(root_module, root_module['ns3::RadvdHelper'])
register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
register_Ns3Simulator_methods(root_module, root_module['ns3::Simulator'])
register_Ns3StatisticalSummary_methods(root_module, root_module['ns3::StatisticalSummary'])
register_Ns3Tag_methods(root_module, root_module['ns3::Tag'])
register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer'])
register_Ns3TimeWithUnit_methods(root_module, root_module['ns3::TimeWithUnit'])
register_Ns3TypeId_methods(root_module, root_module['ns3::TypeId'])
register_Ns3TypeIdAttributeInformation_methods(root_module, root_module['ns3::TypeId::AttributeInformation'])
register_Ns3TypeIdTraceSourceInformation_methods(root_module, root_module['ns3::TypeId::TraceSourceInformation'])
register_Ns3V4PingHelper_methods(root_module, root_module['ns3::V4PingHelper'])
register_Ns3Empty_methods(root_module, root_module['ns3::empty'])
register_Ns3Int64x64_t_methods(root_module, root_module['ns3::int64x64_t'])
register_Ns3Chunk_methods(root_module, root_module['ns3::Chunk'])
register_Ns3Header_methods(root_module, root_module['ns3::Header'])
register_Ns3Object_methods(root_module, root_module['ns3::Object'])
register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator'])
register_Ns3RandomVariableStream_methods(root_module, root_module['ns3::RandomVariableStream'])
register_Ns3SequentialRandomVariable_methods(root_module, root_module['ns3::SequentialRandomVariable'])
register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >'])
register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >'])
register_Ns3SimpleRefCount__Ns3HashImplementation_Ns3Empty_Ns3DefaultDeleter__lt__ns3HashImplementation__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> >'])
register_Ns3SimpleRefCount__Ns3Ipv4MulticastRoute_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4MulticastRoute__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> >'])
register_Ns3SimpleRefCount__Ns3Ipv4Route_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4Route__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> >'])
register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >'])
register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
register_Ns3SimpleRefCount__Ns3RadvdInterface_Ns3Empty_Ns3DefaultDeleter__lt__ns3RadvdInterface__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::RadvdInterface, ns3::empty, ns3::DefaultDeleter<ns3::RadvdInterface> >'])
register_Ns3SimpleRefCount__Ns3RadvdPrefix_Ns3Empty_Ns3DefaultDeleter__lt__ns3RadvdPrefix__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::RadvdPrefix, ns3::empty, ns3::DefaultDeleter<ns3::RadvdPrefix> >'])
register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
register_Ns3Socket_methods(root_module, root_module['ns3::Socket'])
register_Ns3SocketIpTosTag_methods(root_module, root_module['ns3::SocketIpTosTag'])
register_Ns3SocketIpTtlTag_methods(root_module, root_module['ns3::SocketIpTtlTag'])
register_Ns3SocketIpv6HopLimitTag_methods(root_module, root_module['ns3::SocketIpv6HopLimitTag'])
register_Ns3SocketIpv6TclassTag_methods(root_module, root_module['ns3::SocketIpv6TclassTag'])
register_Ns3SocketPriorityTag_methods(root_module, root_module['ns3::SocketPriorityTag'])
register_Ns3SocketSetDontFragmentTag_methods(root_module, root_module['ns3::SocketSetDontFragmentTag'])
register_Ns3Time_methods(root_module, root_module['ns3::Time'])
register_Ns3TraceSourceAccessor_methods(root_module, root_module['ns3::TraceSourceAccessor'])
register_Ns3Trailer_methods(root_module, root_module['ns3::Trailer'])
register_Ns3TriangularRandomVariable_methods(root_module, root_module['ns3::TriangularRandomVariable'])
register_Ns3UniformRandomVariable_methods(root_module, root_module['ns3::UniformRandomVariable'])
register_Ns3WeibullRandomVariable_methods(root_module, root_module['ns3::WeibullRandomVariable'])
register_Ns3ZetaRandomVariable_methods(root_module, root_module['ns3::ZetaRandomVariable'])
register_Ns3ZipfRandomVariable_methods(root_module, root_module['ns3::ZipfRandomVariable'])
register_Ns3Application_methods(root_module, root_module['ns3::Application'])
register_Ns3AttributeAccessor_methods(root_module, root_module['ns3::AttributeAccessor'])
register_Ns3AttributeChecker_methods(root_module, root_module['ns3::AttributeChecker'])
register_Ns3AttributeValue_methods(root_module, root_module['ns3::AttributeValue'])
register_Ns3BooleanChecker_methods(root_module, root_module['ns3::BooleanChecker'])
register_Ns3BooleanValue_methods(root_module, root_module['ns3::BooleanValue'])
register_Ns3CallbackChecker_methods(root_module, root_module['ns3::CallbackChecker'])
register_Ns3CallbackImplBase_methods(root_module, root_module['ns3::CallbackImplBase'])
register_Ns3CallbackValue_methods(root_module, root_module['ns3::CallbackValue'])
register_Ns3ConstantRandomVariable_methods(root_module, root_module['ns3::ConstantRandomVariable'])
register_Ns3DataCalculator_methods(root_module, root_module['ns3::DataCalculator'])
register_Ns3DataOutputInterface_methods(root_module, root_module['ns3::DataOutputInterface'])
register_Ns3DeterministicRandomVariable_methods(root_module, root_module['ns3::DeterministicRandomVariable'])
register_Ns3DhcpClient_methods(root_module, root_module['ns3::DhcpClient'])
register_Ns3DhcpHeader_methods(root_module, root_module['ns3::DhcpHeader'])
register_Ns3DhcpServer_methods(root_module, root_module['ns3::DhcpServer'])
register_Ns3DoubleValue_methods(root_module, root_module['ns3::DoubleValue'])
register_Ns3EmpiricalRandomVariable_methods(root_module, root_module['ns3::EmpiricalRandomVariable'])
register_Ns3EmptyAttributeAccessor_methods(root_module, root_module['ns3::EmptyAttributeAccessor'])
register_Ns3EmptyAttributeChecker_methods(root_module, root_module['ns3::EmptyAttributeChecker'])
register_Ns3EmptyAttributeValue_methods(root_module, root_module['ns3::EmptyAttributeValue'])
register_Ns3EnumChecker_methods(root_module, root_module['ns3::EnumChecker'])
register_Ns3EnumValue_methods(root_module, root_module['ns3::EnumValue'])
register_Ns3ErlangRandomVariable_methods(root_module, root_module['ns3::ErlangRandomVariable'])
register_Ns3EventImpl_methods(root_module, root_module['ns3::EventImpl'])
register_Ns3ExponentialRandomVariable_methods(root_module, root_module['ns3::ExponentialRandomVariable'])
register_Ns3GammaRandomVariable_methods(root_module, root_module['ns3::GammaRandomVariable'])
register_Ns3IntegerValue_methods(root_module, root_module['ns3::IntegerValue'])
register_Ns3Ipv4_methods(root_module, root_module['ns3::Ipv4'])
register_Ns3Ipv4AddressChecker_methods(root_module, root_module['ns3::Ipv4AddressChecker'])
register_Ns3Ipv4AddressValue_methods(root_module, root_module['ns3::Ipv4AddressValue'])
register_Ns3Ipv4MaskChecker_methods(root_module, root_module['ns3::Ipv4MaskChecker'])
register_Ns3Ipv4MaskValue_methods(root_module, root_module['ns3::Ipv4MaskValue'])
register_Ns3Ipv4MulticastRoute_methods(root_module, root_module['ns3::Ipv4MulticastRoute'])
register_Ns3Ipv4Route_methods(root_module, root_module['ns3::Ipv4Route'])
register_Ns3Ipv6AddressChecker_methods(root_module, root_module['ns3::Ipv6AddressChecker'])
register_Ns3Ipv6AddressValue_methods(root_module, root_module['ns3::Ipv6AddressValue'])
register_Ns3Ipv6PrefixChecker_methods(root_module, root_module['ns3::Ipv6PrefixChecker'])
register_Ns3Ipv6PrefixValue_methods(root_module, root_module['ns3::Ipv6PrefixValue'])
register_Ns3LogNormalRandomVariable_methods(root_module, root_module['ns3::LogNormalRandomVariable'])
register_Ns3Mac48AddressChecker_methods(root_module, root_module['ns3::Mac48AddressChecker'])
register_Ns3Mac48AddressValue_methods(root_module, root_module['ns3::Mac48AddressValue'])
register_Ns3Mac64AddressChecker_methods(root_module, root_module['ns3::Mac64AddressChecker'])
register_Ns3Mac64AddressValue_methods(root_module, root_module['ns3::Mac64AddressValue'])
register_Ns3MinMaxAvgTotalCalculator__Double_methods(root_module, root_module['ns3::MinMaxAvgTotalCalculator< double >'])
register_Ns3NetDevice_methods(root_module, root_module['ns3::NetDevice'])
register_Ns3NixVector_methods(root_module, root_module['ns3::NixVector'])
register_Ns3Node_methods(root_module, root_module['ns3::Node'])
register_Ns3NormalRandomVariable_methods(root_module, root_module['ns3::NormalRandomVariable'])
register_Ns3ObjectFactoryChecker_methods(root_module, root_module['ns3::ObjectFactoryChecker'])
register_Ns3ObjectFactoryValue_methods(root_module, root_module['ns3::ObjectFactoryValue'])
register_Ns3Packet_methods(root_module, root_module['ns3::Packet'])
register_Ns3ParetoRandomVariable_methods(root_module, root_module['ns3::ParetoRandomVariable'])
register_Ns3Ping6_methods(root_module, root_module['ns3::Ping6'])
register_Ns3Radvd_methods(root_module, root_module['ns3::Radvd'])
register_Ns3RadvdInterface_methods(root_module, root_module['ns3::RadvdInterface'])
register_Ns3RadvdPrefix_methods(root_module, root_module['ns3::RadvdPrefix'])
register_Ns3TimeValue_methods(root_module, root_module['ns3::TimeValue'])
register_Ns3TypeIdChecker_methods(root_module, root_module['ns3::TypeIdChecker'])
register_Ns3TypeIdValue_methods(root_module, root_module['ns3::TypeIdValue'])
register_Ns3UintegerValue_methods(root_module, root_module['ns3::UintegerValue'])
register_Ns3V4Ping_methods(root_module, root_module['ns3::V4Ping'])
register_Ns3AddressChecker_methods(root_module, root_module['ns3::AddressChecker'])
register_Ns3AddressValue_methods(root_module, root_module['ns3::AddressValue'])
register_Ns3CallbackImpl__Bool_Ns3Ptr__lt__ns3Socket__gt___Const_ns3Address___amp___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< bool, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Ns3ObjectBase___star___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Void_Const_ns3Ipv4Address___amp___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, const ns3::Ipv4Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3NetDevice__gt___Ns3Ptr__lt__const_ns3Packet__gt___Unsigned_short_Const_ns3Address___amp___Const_ns3Address___amp___Ns3NetDevicePacketType_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3NetDevice__gt___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, ns3::Ptr<ns3::NetDevice>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3Socket__gt___Const_ns3Address___amp___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3Socket__gt___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3Socket__gt___Unsigned_int_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Void_Ns3Time_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, ns3::Time, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3HashImplementation_methods(root_module, root_module['ns3::Hash::Implementation'])
register_Ns3HashFunctionFnv1a_methods(root_module, root_module['ns3::Hash::Function::Fnv1a'])
register_Ns3HashFunctionHash32_methods(root_module, root_module['ns3::Hash::Function::Hash32'])
register_Ns3HashFunctionHash64_methods(root_module, root_module['ns3::Hash::Function::Hash64'])
register_Ns3HashFunctionMurmur3_methods(root_module, root_module['ns3::Hash::Function::Murmur3'])
return
def register_Ns3Address_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
cls.add_output_stream_operator()
## address.h (module 'network'): ns3::Address::Address() [constructor]
cls.add_constructor([])
## address.h (module 'network'): ns3::Address::Address(uint8_t type, uint8_t const * buffer, uint8_t len) [constructor]
cls.add_constructor([param('uint8_t', 'type'), param('uint8_t const *', 'buffer'), param('uint8_t', 'len')])
## address.h (module 'network'): ns3::Address::Address(ns3::Address const & address) [constructor]
cls.add_constructor([param('ns3::Address const &', 'address')])
## address.h (module 'network'): bool ns3::Address::CheckCompatible(uint8_t type, uint8_t len) const [member function]
cls.add_method('CheckCompatible',
'bool',
[param('uint8_t', 'type'), param('uint8_t', 'len')],
is_const=True)
## address.h (module 'network'): uint32_t ns3::Address::CopyAllFrom(uint8_t const * buffer, uint8_t len) [member function]
cls.add_method('CopyAllFrom',
'uint32_t',
[param('uint8_t const *', 'buffer'), param('uint8_t', 'len')])
## address.h (module 'network'): uint32_t ns3::Address::CopyAllTo(uint8_t * buffer, uint8_t len) const [member function]
cls.add_method('CopyAllTo',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint8_t', 'len')],
is_const=True)
## address.h (module 'network'): uint32_t ns3::Address::CopyFrom(uint8_t const * buffer, uint8_t len) [member function]
cls.add_method('CopyFrom',
'uint32_t',
[param('uint8_t const *', 'buffer'), param('uint8_t', 'len')])
## address.h (module 'network'): uint32_t ns3::Address::CopyTo(uint8_t * buffer) const [member function]
cls.add_method('CopyTo',
'uint32_t',
[param('uint8_t *', 'buffer')],
is_const=True)
## address.h (module 'network'): void ns3::Address::Deserialize(ns3::TagBuffer buffer) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'buffer')])
## address.h (module 'network'): uint8_t ns3::Address::GetLength() const [member function]
cls.add_method('GetLength',
'uint8_t',
[],
is_const=True)
## address.h (module 'network'): uint32_t ns3::Address::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## address.h (module 'network'): bool ns3::Address::IsInvalid() const [member function]
cls.add_method('IsInvalid',
'bool',
[],
is_const=True)
## address.h (module 'network'): bool ns3::Address::IsMatchingType(uint8_t type) const [member function]
cls.add_method('IsMatchingType',
'bool',
[param('uint8_t', 'type')],
is_const=True)
## address.h (module 'network'): static uint8_t ns3::Address::Register() [member function]
cls.add_method('Register',
'uint8_t',
[],
is_static=True)
## address.h (module 'network'): void ns3::Address::Serialize(ns3::TagBuffer buffer) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'buffer')],
is_const=True)
return
def register_Ns3ApplicationContainer_methods(root_module, cls):
## application-container.h (module 'network'): ns3::ApplicationContainer::ApplicationContainer(ns3::ApplicationContainer const & arg0) [constructor]
cls.add_constructor([param('ns3::ApplicationContainer const &', 'arg0')])
## application-container.h (module 'network'): ns3::ApplicationContainer::ApplicationContainer() [constructor]
cls.add_constructor([])
## application-container.h (module 'network'): ns3::ApplicationContainer::ApplicationContainer(ns3::Ptr<ns3::Application> application) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Application >', 'application')])
## application-container.h (module 'network'): ns3::ApplicationContainer::ApplicationContainer(std::string name) [constructor]
cls.add_constructor([param('std::string', 'name')])
## application-container.h (module 'network'): void ns3::ApplicationContainer::Add(ns3::ApplicationContainer other) [member function]
cls.add_method('Add',
'void',
[param('ns3::ApplicationContainer', 'other')])
## application-container.h (module 'network'): void ns3::ApplicationContainer::Add(ns3::Ptr<ns3::Application> application) [member function]
cls.add_method('Add',
'void',
[param('ns3::Ptr< ns3::Application >', 'application')])
## application-container.h (module 'network'): void ns3::ApplicationContainer::Add(std::string name) [member function]
cls.add_method('Add',
'void',
[param('std::string', 'name')])
## application-container.h (module 'network'): ns3::ApplicationContainer::Iterator ns3::ApplicationContainer::Begin() const [member function]
cls.add_method('Begin',
'ns3::ApplicationContainer::Iterator',
[],
is_const=True)
## application-container.h (module 'network'): ns3::ApplicationContainer::Iterator ns3::ApplicationContainer::End() const [member function]
cls.add_method('End',
'ns3::ApplicationContainer::Iterator',
[],
is_const=True)
## application-container.h (module 'network'): ns3::Ptr<ns3::Application> ns3::ApplicationContainer::Get(uint32_t i) const [member function]
cls.add_method('Get',
'ns3::Ptr< ns3::Application >',
[param('uint32_t', 'i')],
is_const=True)
## application-container.h (module 'network'): uint32_t ns3::ApplicationContainer::GetN() const [member function]
cls.add_method('GetN',
'uint32_t',
[],
is_const=True)
## application-container.h (module 'network'): void ns3::ApplicationContainer::Start(ns3::Time start) [member function]
cls.add_method('Start',
'void',
[param('ns3::Time', 'start')])
## application-container.h (module 'network'): void ns3::ApplicationContainer::StartWithJitter(ns3::Time start, ns3::Ptr<ns3::RandomVariableStream> rv) [member function]
cls.add_method('StartWithJitter',
'void',
[param('ns3::Time', 'start'), param('ns3::Ptr< ns3::RandomVariableStream >', 'rv')])
## application-container.h (module 'network'): void ns3::ApplicationContainer::Stop(ns3::Time stop) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time', 'stop')])
return
def register_Ns3AttributeConstructionList_methods(root_module, cls):
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList(ns3::AttributeConstructionList const & arg0) [constructor]
cls.add_constructor([param('ns3::AttributeConstructionList const &', 'arg0')])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList() [constructor]
cls.add_constructor([])
## attribute-construction-list.h (module 'core'): void ns3::AttributeConstructionList::Add(std::string name, ns3::Ptr<const ns3::AttributeChecker> checker, ns3::Ptr<ns3::AttributeValue> value) [member function]
cls.add_method('Add',
'void',
[param('std::string', 'name'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker'), param('ns3::Ptr< ns3::AttributeValue >', 'value')])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::CIterator ns3::AttributeConstructionList::Begin() const [member function]
cls.add_method('Begin',
'ns3::AttributeConstructionList::CIterator',
[],
is_const=True)
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::CIterator ns3::AttributeConstructionList::End() const [member function]
cls.add_method('End',
'ns3::AttributeConstructionList::CIterator',
[],
is_const=True)
## attribute-construction-list.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeConstructionList::Find(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('Find',
'ns3::Ptr< ns3::AttributeValue >',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True)
return
def register_Ns3AttributeConstructionListItem_methods(root_module, cls):
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item() [constructor]
cls.add_constructor([])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item(ns3::AttributeConstructionList::Item const & arg0) [constructor]
cls.add_constructor([param('ns3::AttributeConstructionList::Item const &', 'arg0')])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::checker [variable]
cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False)
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::name [variable]
cls.add_instance_attribute('name', 'std::string', is_const=False)
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::value [variable]
cls.add_instance_attribute('value', 'ns3::Ptr< ns3::AttributeValue >', is_const=False)
return
def register_Ns3Average__Double_methods(root_module, cls):
## average.h (module 'stats'): ns3::Average<double>::Average(ns3::Average<double> const & arg0) [constructor]
cls.add_constructor([param('ns3::Average< double > const &', 'arg0')])
## average.h (module 'stats'): ns3::Average<double>::Average() [constructor]
cls.add_constructor([])
## average.h (module 'stats'): double ns3::Average<double>::Avg() const [member function]
cls.add_method('Avg',
'double',
[],
is_const=True)
## average.h (module 'stats'): uint32_t ns3::Average<double>::Count() const [member function]
cls.add_method('Count',
'uint32_t',
[],
is_const=True)
## average.h (module 'stats'): double ns3::Average<double>::Error90() const [member function]
cls.add_method('Error90',
'double',
[],
is_const=True)
## average.h (module 'stats'): double ns3::Average<double>::Error95() const [member function]
cls.add_method('Error95',
'double',
[],
is_const=True)
## average.h (module 'stats'): double ns3::Average<double>::Error99() const [member function]
cls.add_method('Error99',
'double',
[],
is_const=True)
## average.h (module 'stats'): double ns3::Average<double>::Max() const [member function]
cls.add_method('Max',
'double',
[],
is_const=True)
## average.h (module 'stats'): double ns3::Average<double>::Mean() const [member function]
cls.add_method('Mean',
'double',
[],
is_const=True)
## average.h (module 'stats'): double ns3::Average<double>::Min() const [member function]
cls.add_method('Min',
'double',
[],
is_const=True)
## average.h (module 'stats'): void ns3::Average<double>::Reset() [member function]
cls.add_method('Reset',
'void',
[])
## average.h (module 'stats'): double ns3::Average<double>::Stddev() const [member function]
cls.add_method('Stddev',
'double',
[],
is_const=True)
## average.h (module 'stats'): void ns3::Average<double>::Update(double const & x) [member function]
cls.add_method('Update',
'void',
[param('double const &', 'x')])
## average.h (module 'stats'): double ns3::Average<double>::Var() const [member function]
cls.add_method('Var',
'double',
[],
is_const=True)
return
def register_Ns3Buffer_methods(root_module, cls):
## buffer.h (module 'network'): ns3::Buffer::Buffer(ns3::Buffer const & o) [constructor]
cls.add_constructor([param('ns3::Buffer const &', 'o')])
## buffer.h (module 'network'): ns3::Buffer::Buffer() [constructor]
cls.add_constructor([])
## buffer.h (module 'network'): ns3::Buffer::Buffer(uint32_t dataSize) [constructor]
cls.add_constructor([param('uint32_t', 'dataSize')])
## buffer.h (module 'network'): ns3::Buffer::Buffer(uint32_t dataSize, bool initialize) [constructor]
cls.add_constructor([param('uint32_t', 'dataSize'), param('bool', 'initialize')])
## buffer.h (module 'network'): void ns3::Buffer::AddAtEnd(uint32_t end) [member function]
cls.add_method('AddAtEnd',
'void',
[param('uint32_t', 'end')])
## buffer.h (module 'network'): void ns3::Buffer::AddAtEnd(ns3::Buffer const & o) [member function]
cls.add_method('AddAtEnd',
'void',
[param('ns3::Buffer const &', 'o')])
## buffer.h (module 'network'): void ns3::Buffer::AddAtStart(uint32_t start) [member function]
cls.add_method('AddAtStart',
'void',
[param('uint32_t', 'start')])
## buffer.h (module 'network'): ns3::Buffer::Iterator ns3::Buffer::Begin() const [member function]
cls.add_method('Begin',
'ns3::Buffer::Iterator',
[],
is_const=True)
## buffer.h (module 'network'): void ns3::Buffer::CopyData(std::ostream * os, uint32_t size) const [member function]
cls.add_method('CopyData',
'void',
[param('std::ostream *', 'os'), param('uint32_t', 'size')],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::CopyData(uint8_t * buffer, uint32_t size) const [member function]
cls.add_method('CopyData',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')],
is_const=True)
## buffer.h (module 'network'): ns3::Buffer ns3::Buffer::CreateFragment(uint32_t start, uint32_t length) const [member function]
cls.add_method('CreateFragment',
'ns3::Buffer',
[param('uint32_t', 'start'), param('uint32_t', 'length')],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::Deserialize(uint8_t const * buffer, uint32_t size) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## buffer.h (module 'network'): ns3::Buffer::Iterator ns3::Buffer::End() const [member function]
cls.add_method('End',
'ns3::Buffer::Iterator',
[],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::GetSize() const [member function]
cls.add_method('GetSize',
'uint32_t',
[],
is_const=True)
## buffer.h (module 'network'): uint8_t const * ns3::Buffer::PeekData() const [member function]
cls.add_method('PeekData',
'uint8_t const *',
[],
is_const=True)
## buffer.h (module 'network'): void ns3::Buffer::RemoveAtEnd(uint32_t end) [member function]
cls.add_method('RemoveAtEnd',
'void',
[param('uint32_t', 'end')])
## buffer.h (module 'network'): void ns3::Buffer::RemoveAtStart(uint32_t start) [member function]
cls.add_method('RemoveAtStart',
'void',
[param('uint32_t', 'start')])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function]
cls.add_method('Serialize',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')],
is_const=True)
return
def register_Ns3BufferIterator_methods(root_module, cls):
## buffer.h (module 'network'): ns3::Buffer::Iterator::Iterator(ns3::Buffer::Iterator const & arg0) [constructor]
cls.add_constructor([param('ns3::Buffer::Iterator const &', 'arg0')])
## buffer.h (module 'network'): ns3::Buffer::Iterator::Iterator() [constructor]
cls.add_constructor([])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::CalculateIpChecksum(uint16_t size) [member function]
cls.add_method('CalculateIpChecksum',
'uint16_t',
[param('uint16_t', 'size')])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::CalculateIpChecksum(uint16_t size, uint32_t initialChecksum) [member function]
cls.add_method('CalculateIpChecksum',
'uint16_t',
[param('uint16_t', 'size'), param('uint32_t', 'initialChecksum')])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetDistanceFrom(ns3::Buffer::Iterator const & o) const [member function]
cls.add_method('GetDistanceFrom',
'uint32_t',
[param('ns3::Buffer::Iterator const &', 'o')],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetRemainingSize() const [member function]
cls.add_method('GetRemainingSize',
'uint32_t',
[],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetSize() const [member function]
cls.add_method('GetSize',
'uint32_t',
[],
is_const=True)
## buffer.h (module 'network'): bool ns3::Buffer::Iterator::IsEnd() const [member function]
cls.add_method('IsEnd',
'bool',
[],
is_const=True)
## buffer.h (module 'network'): bool ns3::Buffer::Iterator::IsStart() const [member function]
cls.add_method('IsStart',
'bool',
[],
is_const=True)
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Next() [member function]
cls.add_method('Next',
'void',
[])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Next(uint32_t delta) [member function]
cls.add_method('Next',
'void',
[param('uint32_t', 'delta')])
## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::PeekU8() [member function]
cls.add_method('PeekU8',
'uint8_t',
[])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev() [member function]
cls.add_method('Prev',
'void',
[])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev(uint32_t delta) [member function]
cls.add_method('Prev',
'void',
[param('uint32_t', 'delta')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(uint8_t * buffer, uint32_t size) [member function]
cls.add_method('Read',
'void',
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(ns3::Buffer::Iterator start, uint32_t size) [member function]
cls.add_method('Read',
'void',
[param('ns3::Buffer::Iterator', 'start'), param('uint32_t', 'size')])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadLsbtohU16() [member function]
cls.add_method('ReadLsbtohU16',
'uint16_t',
[])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadLsbtohU32() [member function]
cls.add_method('ReadLsbtohU32',
'uint32_t',
[])
## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadLsbtohU64() [member function]
cls.add_method('ReadLsbtohU64',
'uint64_t',
[])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadNtohU16() [member function]
cls.add_method('ReadNtohU16',
'uint16_t',
[])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadNtohU32() [member function]
cls.add_method('ReadNtohU32',
'uint32_t',
[])
## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadNtohU64() [member function]
cls.add_method('ReadNtohU64',
'uint64_t',
[])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadU16() [member function]
cls.add_method('ReadU16',
'uint16_t',
[])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadU32() [member function]
cls.add_method('ReadU32',
'uint32_t',
[])
## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadU64() [member function]
cls.add_method('ReadU64',
'uint64_t',
[])
## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::ReadU8() [member function]
cls.add_method('ReadU8',
'uint8_t',
[])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Write(uint8_t const * buffer, uint32_t size) [member function]
cls.add_method('Write',
'void',
[param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Write(ns3::Buffer::Iterator start, ns3::Buffer::Iterator end) [member function]
cls.add_method('Write',
'void',
[param('ns3::Buffer::Iterator', 'start'), param('ns3::Buffer::Iterator', 'end')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU16(uint16_t data) [member function]
cls.add_method('WriteHtolsbU16',
'void',
[param('uint16_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU32(uint32_t data) [member function]
cls.add_method('WriteHtolsbU32',
'void',
[param('uint32_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU64(uint64_t data) [member function]
cls.add_method('WriteHtolsbU64',
'void',
[param('uint64_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU16(uint16_t data) [member function]
cls.add_method('WriteHtonU16',
'void',
[param('uint16_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU32(uint32_t data) [member function]
cls.add_method('WriteHtonU32',
'void',
[param('uint32_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU64(uint64_t data) [member function]
cls.add_method('WriteHtonU64',
'void',
[param('uint64_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU16(uint16_t data) [member function]
cls.add_method('WriteU16',
'void',
[param('uint16_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU32(uint32_t data) [member function]
cls.add_method('WriteU32',
'void',
[param('uint32_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU64(uint64_t data) [member function]
cls.add_method('WriteU64',
'void',
[param('uint64_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU8(uint8_t data) [member function]
cls.add_method('WriteU8',
'void',
[param('uint8_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU8(uint8_t data, uint32_t len) [member function]
cls.add_method('WriteU8',
'void',
[param('uint8_t', 'data'), param('uint32_t', 'len')])
return
def register_Ns3ByteTagIterator_methods(root_module, cls):
## packet.h (module 'network'): ns3::ByteTagIterator::ByteTagIterator(ns3::ByteTagIterator const & arg0) [constructor]
cls.add_constructor([param('ns3::ByteTagIterator const &', 'arg0')])
## packet.h (module 'network'): bool ns3::ByteTagIterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## packet.h (module 'network'): ns3::ByteTagIterator::Item ns3::ByteTagIterator::Next() [member function]
cls.add_method('Next',
'ns3::ByteTagIterator::Item',
[])
return
def register_Ns3ByteTagIteratorItem_methods(root_module, cls):
## packet.h (module 'network'): ns3::ByteTagIterator::Item::Item(ns3::ByteTagIterator::Item const & arg0) [constructor]
cls.add_constructor([param('ns3::ByteTagIterator::Item const &', 'arg0')])
## packet.h (module 'network'): uint32_t ns3::ByteTagIterator::Item::GetEnd() const [member function]
cls.add_method('GetEnd',
'uint32_t',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::ByteTagIterator::Item::GetStart() const [member function]
cls.add_method('GetStart',
'uint32_t',
[],
is_const=True)
## packet.h (module 'network'): void ns3::ByteTagIterator::Item::GetTag(ns3::Tag & tag) const [member function]
cls.add_method('GetTag',
'void',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet.h (module 'network'): ns3::TypeId ns3::ByteTagIterator::Item::GetTypeId() const [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_const=True)
return
def register_Ns3ByteTagList_methods(root_module, cls):
## byte-tag-list.h (module 'network'): ns3::ByteTagList::ByteTagList() [constructor]
cls.add_constructor([])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::ByteTagList(ns3::ByteTagList const & o) [constructor]
cls.add_constructor([param('ns3::ByteTagList const &', 'o')])
## byte-tag-list.h (module 'network'): ns3::TagBuffer ns3::ByteTagList::Add(ns3::TypeId tid, uint32_t bufferSize, int32_t start, int32_t end) [member function]
cls.add_method('Add',
'ns3::TagBuffer',
[param('ns3::TypeId', 'tid'), param('uint32_t', 'bufferSize'), param('int32_t', 'start'), param('int32_t', 'end')])
## byte-tag-list.h (module 'network'): void ns3::ByteTagList::Add(ns3::ByteTagList const & o) [member function]
cls.add_method('Add',
'void',
[param('ns3::ByteTagList const &', 'o')])
## byte-tag-list.h (module 'network'): void ns3::ByteTagList::AddAtEnd(int32_t appendOffset) [member function]
cls.add_method('AddAtEnd',
'void',
[param('int32_t', 'appendOffset')])
## byte-tag-list.h (module 'network'): void ns3::ByteTagList::AddAtStart(int32_t prependOffset) [member function]
cls.add_method('AddAtStart',
'void',
[param('int32_t', 'prependOffset')])
## byte-tag-list.h (module 'network'): void ns3::ByteTagList::Adjust(int32_t adjustment) [member function]
cls.add_method('Adjust',
'void',
[param('int32_t', 'adjustment')])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator ns3::ByteTagList::Begin(int32_t offsetStart, int32_t offsetEnd) const [member function]
cls.add_method('Begin',
'ns3::ByteTagList::Iterator',
[param('int32_t', 'offsetStart'), param('int32_t', 'offsetEnd')],
is_const=True)
## byte-tag-list.h (module 'network'): void ns3::ByteTagList::RemoveAll() [member function]
cls.add_method('RemoveAll',
'void',
[])
return
def register_Ns3ByteTagListIterator_methods(root_module, cls):
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Iterator(ns3::ByteTagList::Iterator const & arg0) [constructor]
cls.add_constructor([param('ns3::ByteTagList::Iterator const &', 'arg0')])
## byte-tag-list.h (module 'network'): uint32_t ns3::ByteTagList::Iterator::GetOffsetStart() const [member function]
cls.add_method('GetOffsetStart',
'uint32_t',
[],
is_const=True)
## byte-tag-list.h (module 'network'): bool ns3::ByteTagList::Iterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item ns3::ByteTagList::Iterator::Next() [member function]
cls.add_method('Next',
'ns3::ByteTagList::Iterator::Item',
[])
return
def register_Ns3ByteTagListIteratorItem_methods(root_module, cls):
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::Item(ns3::ByteTagList::Iterator::Item const & arg0) [constructor]
cls.add_constructor([param('ns3::ByteTagList::Iterator::Item const &', 'arg0')])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::Item(ns3::TagBuffer buf) [constructor]
cls.add_constructor([param('ns3::TagBuffer', 'buf')])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::buf [variable]
cls.add_instance_attribute('buf', 'ns3::TagBuffer', is_const=False)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::end [variable]
cls.add_instance_attribute('end', 'int32_t', is_const=False)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::size [variable]
cls.add_instance_attribute('size', 'uint32_t', is_const=False)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::start [variable]
cls.add_instance_attribute('start', 'int32_t', is_const=False)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::tid [variable]
cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False)
return
def register_Ns3CallbackBase_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::CallbackBase const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackBase const &', 'arg0')])
## callback.h (module 'core'): ns3::CallbackBase::CallbackBase() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::Ptr<ns3::CallbackImplBase> ns3::CallbackBase::GetImpl() const [member function]
cls.add_method('GetImpl',
'ns3::Ptr< ns3::CallbackImplBase >',
[],
is_const=True)
## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::Ptr<ns3::CallbackImplBase> impl) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::CallbackImplBase >', 'impl')],
visibility='protected')
return
def register_Ns3DataOutputCallback_methods(root_module, cls):
## data-output-interface.h (module 'stats'): ns3::DataOutputCallback::DataOutputCallback() [constructor]
cls.add_constructor([])
## data-output-interface.h (module 'stats'): ns3::DataOutputCallback::DataOutputCallback(ns3::DataOutputCallback const & arg0) [constructor]
cls.add_constructor([param('ns3::DataOutputCallback const &', 'arg0')])
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, int val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('int', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, uint32_t val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('uint32_t', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, double val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('double', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, std::string val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('std::string', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, ns3::Time val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('ns3::Time', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputStatistic(std::string key, std::string variable, ns3::StatisticalSummary const * statSum) [member function]
cls.add_method('OutputStatistic',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('ns3::StatisticalSummary const *', 'statSum')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3DefaultDeleter__Ns3AttributeAccessor_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::AttributeAccessor>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::AttributeAccessor>::DefaultDeleter(ns3::DefaultDeleter<ns3::AttributeAccessor> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::AttributeAccessor > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::AttributeAccessor>::Delete(ns3::AttributeAccessor * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::AttributeAccessor *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3AttributeChecker_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::AttributeChecker>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::AttributeChecker>::DefaultDeleter(ns3::DefaultDeleter<ns3::AttributeChecker> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::AttributeChecker > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::AttributeChecker>::Delete(ns3::AttributeChecker * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::AttributeChecker *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3AttributeValue_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::AttributeValue>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::AttributeValue>::DefaultDeleter(ns3::DefaultDeleter<ns3::AttributeValue> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::AttributeValue > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::AttributeValue>::Delete(ns3::AttributeValue * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::AttributeValue *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3CallbackImplBase_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::CallbackImplBase>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::CallbackImplBase>::DefaultDeleter(ns3::DefaultDeleter<ns3::CallbackImplBase> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::CallbackImplBase > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::CallbackImplBase>::Delete(ns3::CallbackImplBase * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::CallbackImplBase *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3EventImpl_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::EventImpl>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::EventImpl>::DefaultDeleter(ns3::DefaultDeleter<ns3::EventImpl> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::EventImpl > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::EventImpl>::Delete(ns3::EventImpl * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::EventImpl *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3HashImplementation_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::Hash::Implementation>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::Hash::Implementation>::DefaultDeleter(ns3::DefaultDeleter<ns3::Hash::Implementation> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::Hash::Implementation > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::Hash::Implementation>::Delete(ns3::Hash::Implementation * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::Hash::Implementation *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3NixVector_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::NixVector>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::NixVector>::DefaultDeleter(ns3::DefaultDeleter<ns3::NixVector> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::NixVector > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::NixVector>::Delete(ns3::NixVector * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::NixVector *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3Packet_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::Packet>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::Packet>::DefaultDeleter(ns3::DefaultDeleter<ns3::Packet> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::Packet > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::Packet>::Delete(ns3::Packet * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::Packet *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3RadvdInterface_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::RadvdInterface>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::RadvdInterface>::DefaultDeleter(ns3::DefaultDeleter<ns3::RadvdInterface> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::RadvdInterface > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::RadvdInterface>::Delete(ns3::RadvdInterface * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::RadvdInterface *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3RadvdPrefix_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::RadvdPrefix>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::RadvdPrefix>::DefaultDeleter(ns3::DefaultDeleter<ns3::RadvdPrefix> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::RadvdPrefix > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::RadvdPrefix>::Delete(ns3::RadvdPrefix * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::RadvdPrefix *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3TraceSourceAccessor_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::TraceSourceAccessor>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::TraceSourceAccessor>::DefaultDeleter(ns3::DefaultDeleter<ns3::TraceSourceAccessor> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::TraceSourceAccessor > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::TraceSourceAccessor>::Delete(ns3::TraceSourceAccessor * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::TraceSourceAccessor *', 'object')],
is_static=True)
return
def register_Ns3DhcpHelper_methods(root_module, cls):
## dhcp-helper.h (module 'internet-apps'): ns3::DhcpHelper::DhcpHelper(ns3::DhcpHelper const & arg0) [constructor]
cls.add_constructor([param('ns3::DhcpHelper const &', 'arg0')])
## dhcp-helper.h (module 'internet-apps'): ns3::DhcpHelper::DhcpHelper() [constructor]
cls.add_constructor([])
## dhcp-helper.h (module 'internet-apps'): ns3::ApplicationContainer ns3::DhcpHelper::InstallDhcpClient(ns3::Ptr<ns3::NetDevice> netDevice) const [member function]
cls.add_method('InstallDhcpClient',
'ns3::ApplicationContainer',
[param('ns3::Ptr< ns3::NetDevice >', 'netDevice')],
is_const=True)
## dhcp-helper.h (module 'internet-apps'): ns3::ApplicationContainer ns3::DhcpHelper::InstallDhcpClient(ns3::NetDeviceContainer netDevices) const [member function]
cls.add_method('InstallDhcpClient',
'ns3::ApplicationContainer',
[param('ns3::NetDeviceContainer', 'netDevices')],
is_const=True)
## dhcp-helper.h (module 'internet-apps'): ns3::ApplicationContainer ns3::DhcpHelper::InstallDhcpServer(ns3::Ptr<ns3::NetDevice> netDevice, ns3::Ipv4Address serverAddr, ns3::Ipv4Address poolAddr, ns3::Ipv4Mask poolMask, ns3::Ipv4Address minAddr, ns3::Ipv4Address maxAddr, ns3::Ipv4Address gateway=ns3::Ipv4Address()) [member function]
cls.add_method('InstallDhcpServer',
'ns3::ApplicationContainer',
[param('ns3::Ptr< ns3::NetDevice >', 'netDevice'), param('ns3::Ipv4Address', 'serverAddr'), param('ns3::Ipv4Address', 'poolAddr'), param('ns3::Ipv4Mask', 'poolMask'), param('ns3::Ipv4Address', 'minAddr'), param('ns3::Ipv4Address', 'maxAddr'), param('ns3::Ipv4Address', 'gateway', default_value='ns3::Ipv4Address()')])
## dhcp-helper.h (module 'internet-apps'): ns3::Ipv4InterfaceContainer ns3::DhcpHelper::InstallFixedAddress(ns3::Ptr<ns3::NetDevice> netDevice, ns3::Ipv4Address addr, ns3::Ipv4Mask mask) [member function]
cls.add_method('InstallFixedAddress',
'ns3::Ipv4InterfaceContainer',
[param('ns3::Ptr< ns3::NetDevice >', 'netDevice'), param('ns3::Ipv4Address', 'addr'), param('ns3::Ipv4Mask', 'mask')])
## dhcp-helper.h (module 'internet-apps'): void ns3::DhcpHelper::SetClientAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetClientAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## dhcp-helper.h (module 'internet-apps'): void ns3::DhcpHelper::SetServerAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetServerAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
return
def register_Ns3EventId_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
## event-id.h (module 'core'): ns3::EventId::EventId(ns3::EventId const & arg0) [constructor]
cls.add_constructor([param('ns3::EventId const &', 'arg0')])
## event-id.h (module 'core'): ns3::EventId::EventId() [constructor]
cls.add_constructor([])
## event-id.h (module 'core'): ns3::EventId::EventId(ns3::Ptr<ns3::EventImpl> const & impl, uint64_t ts, uint32_t context, uint32_t uid) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::EventImpl > const &', 'impl'), param('uint64_t', 'ts'), param('uint32_t', 'context'), param('uint32_t', 'uid')])
## event-id.h (module 'core'): void ns3::EventId::Cancel() [member function]
cls.add_method('Cancel',
'void',
[])
## event-id.h (module 'core'): uint32_t ns3::EventId::GetContext() const [member function]
cls.add_method('GetContext',
'uint32_t',
[],
is_const=True)
## event-id.h (module 'core'): uint64_t ns3::EventId::GetTs() const [member function]
cls.add_method('GetTs',
'uint64_t',
[],
is_const=True)
## event-id.h (module 'core'): uint32_t ns3::EventId::GetUid() const [member function]
cls.add_method('GetUid',
'uint32_t',
[],
is_const=True)
## event-id.h (module 'core'): bool ns3::EventId::IsExpired() const [member function]
cls.add_method('IsExpired',
'bool',
[],
is_const=True)
## event-id.h (module 'core'): bool ns3::EventId::IsRunning() const [member function]
cls.add_method('IsRunning',
'bool',
[],
is_const=True)
## event-id.h (module 'core'): ns3::EventImpl * ns3::EventId::PeekEventImpl() const [member function]
cls.add_method('PeekEventImpl',
'ns3::EventImpl *',
[],
is_const=True)
return
def register_Ns3Hasher_methods(root_module, cls):
## hash.h (module 'core'): ns3::Hasher::Hasher(ns3::Hasher const & arg0) [constructor]
cls.add_constructor([param('ns3::Hasher const &', 'arg0')])
## hash.h (module 'core'): ns3::Hasher::Hasher() [constructor]
cls.add_constructor([])
## hash.h (module 'core'): ns3::Hasher::Hasher(ns3::Ptr<ns3::Hash::Implementation> hp) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Hash::Implementation >', 'hp')])
## hash.h (module 'core'): uint32_t ns3::Hasher::GetHash32(char const * buffer, std::size_t const size) [member function]
cls.add_method('GetHash32',
'uint32_t',
[param('char const *', 'buffer'), param('std::size_t const', 'size')])
## hash.h (module 'core'): uint32_t ns3::Hasher::GetHash32(std::string const s) [member function]
cls.add_method('GetHash32',
'uint32_t',
[param('std::string const', 's')])
## hash.h (module 'core'): uint64_t ns3::Hasher::GetHash64(char const * buffer, std::size_t const size) [member function]
cls.add_method('GetHash64',
'uint64_t',
[param('char const *', 'buffer'), param('std::size_t const', 'size')])
## hash.h (module 'core'): uint64_t ns3::Hasher::GetHash64(std::string const s) [member function]
cls.add_method('GetHash64',
'uint64_t',
[param('std::string const', 's')])
## hash.h (module 'core'): ns3::Hasher & ns3::Hasher::clear() [member function]
cls.add_method('clear',
'ns3::Hasher &',
[])
return
def register_Ns3Inet6SocketAddress_methods(root_module, cls):
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(ns3::Inet6SocketAddress const & arg0) [constructor]
cls.add_constructor([param('ns3::Inet6SocketAddress const &', 'arg0')])
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(ns3::Ipv6Address ipv6, uint16_t port) [constructor]
cls.add_constructor([param('ns3::Ipv6Address', 'ipv6'), param('uint16_t', 'port')])
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(ns3::Ipv6Address ipv6) [constructor]
cls.add_constructor([param('ns3::Ipv6Address', 'ipv6')])
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(uint16_t port) [constructor]
cls.add_constructor([param('uint16_t', 'port')])
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(char const * ipv6, uint16_t port) [constructor]
cls.add_constructor([param('char const *', 'ipv6'), param('uint16_t', 'port')])
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(char const * ipv6) [constructor]
cls.add_constructor([param('char const *', 'ipv6')])
## inet6-socket-address.h (module 'network'): static ns3::Inet6SocketAddress ns3::Inet6SocketAddress::ConvertFrom(ns3::Address const & addr) [member function]
cls.add_method('ConvertFrom',
'ns3::Inet6SocketAddress',
[param('ns3::Address const &', 'addr')],
is_static=True)
## inet6-socket-address.h (module 'network'): ns3::Ipv6Address ns3::Inet6SocketAddress::GetIpv6() const [member function]
cls.add_method('GetIpv6',
'ns3::Ipv6Address',
[],
is_const=True)
## inet6-socket-address.h (module 'network'): uint16_t ns3::Inet6SocketAddress::GetPort() const [member function]
cls.add_method('GetPort',
'uint16_t',
[],
is_const=True)
## inet6-socket-address.h (module 'network'): static bool ns3::Inet6SocketAddress::IsMatchingType(ns3::Address const & addr) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'addr')],
is_static=True)
## inet6-socket-address.h (module 'network'): void ns3::Inet6SocketAddress::SetIpv6(ns3::Ipv6Address ipv6) [member function]
cls.add_method('SetIpv6',
'void',
[param('ns3::Ipv6Address', 'ipv6')])
## inet6-socket-address.h (module 'network'): void ns3::Inet6SocketAddress::SetPort(uint16_t port) [member function]
cls.add_method('SetPort',
'void',
[param('uint16_t', 'port')])
return
def register_Ns3InetSocketAddress_methods(root_module, cls):
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(ns3::InetSocketAddress const & arg0) [constructor]
cls.add_constructor([param('ns3::InetSocketAddress const &', 'arg0')])
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(ns3::Ipv4Address ipv4, uint16_t port) [constructor]
cls.add_constructor([param('ns3::Ipv4Address', 'ipv4'), param('uint16_t', 'port')])
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(ns3::Ipv4Address ipv4) [constructor]
cls.add_constructor([param('ns3::Ipv4Address', 'ipv4')])
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(uint16_t port) [constructor]
cls.add_constructor([param('uint16_t', 'port')])
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(char const * ipv4, uint16_t port) [constructor]
cls.add_constructor([param('char const *', 'ipv4'), param('uint16_t', 'port')])
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(char const * ipv4) [constructor]
cls.add_constructor([param('char const *', 'ipv4')])
## inet-socket-address.h (module 'network'): static ns3::InetSocketAddress ns3::InetSocketAddress::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::InetSocketAddress',
[param('ns3::Address const &', 'address')],
is_static=True)
## inet-socket-address.h (module 'network'): ns3::Ipv4Address ns3::InetSocketAddress::GetIpv4() const [member function]
cls.add_method('GetIpv4',
'ns3::Ipv4Address',
[],
is_const=True)
## inet-socket-address.h (module 'network'): uint16_t ns3::InetSocketAddress::GetPort() const [member function]
cls.add_method('GetPort',
'uint16_t',
[],
is_const=True)
## inet-socket-address.h (module 'network'): uint8_t ns3::InetSocketAddress::GetTos() const [member function]
cls.add_method('GetTos',
'uint8_t',
[],
is_const=True)
## inet-socket-address.h (module 'network'): static bool ns3::InetSocketAddress::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
## inet-socket-address.h (module 'network'): void ns3::InetSocketAddress::SetIpv4(ns3::Ipv4Address address) [member function]
cls.add_method('SetIpv4',
'void',
[param('ns3::Ipv4Address', 'address')])
## inet-socket-address.h (module 'network'): void ns3::InetSocketAddress::SetPort(uint16_t port) [member function]
cls.add_method('SetPort',
'void',
[param('uint16_t', 'port')])
## inet-socket-address.h (module 'network'): void ns3::InetSocketAddress::SetTos(uint8_t tos) [member function]
cls.add_method('SetTos',
'void',
[param('uint8_t', 'tos')])
return
def register_Ns3Ipv4Address_methods(root_module, cls):
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(ns3::Ipv4Address const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv4Address const &', 'arg0')])
## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(uint32_t address) [constructor]
cls.add_constructor([param('uint32_t', 'address')])
## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(char const * address) [constructor]
cls.add_constructor([param('char const *', 'address')])
## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::CombineMask(ns3::Ipv4Mask const & mask) const [member function]
cls.add_method('CombineMask',
'ns3::Ipv4Address',
[param('ns3::Ipv4Mask const &', 'mask')],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::Ipv4Address',
[param('ns3::Address const &', 'address')],
is_static=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::Deserialize(uint8_t const * buf) [member function]
cls.add_method('Deserialize',
'ns3::Ipv4Address',
[param('uint8_t const *', 'buf')],
is_static=True)
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Address::Get() const [member function]
cls.add_method('Get',
'uint32_t',
[],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetAny() [member function]
cls.add_method('GetAny',
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetBroadcast() [member function]
cls.add_method('GetBroadcast',
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetLoopback() [member function]
cls.add_method('GetLoopback',
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::GetSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function]
cls.add_method('GetSubnetDirectedBroadcast',
'ns3::Ipv4Address',
[param('ns3::Ipv4Mask const &', 'mask')],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetZero() [member function]
cls.add_method('GetZero',
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsAny() const [member function]
cls.add_method('IsAny',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsBroadcast() const [member function]
cls.add_method('IsBroadcast',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsEqual(ns3::Ipv4Address const & other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ipv4Address const &', 'other')],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsLocalMulticast() const [member function]
cls.add_method('IsLocalMulticast',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsLocalhost() const [member function]
cls.add_method('IsLocalhost',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): static bool ns3::Ipv4Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsMulticast() const [member function]
cls.add_method('IsMulticast',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function]
cls.add_method('IsSubnetDirectedBroadcast',
'bool',
[param('ns3::Ipv4Mask const &', 'mask')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Serialize(uint8_t * buf) const [member function]
cls.add_method('Serialize',
'void',
[param('uint8_t *', 'buf')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(uint32_t address) [member function]
cls.add_method('Set',
'void',
[param('uint32_t', 'address')])
## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(char const * address) [member function]
cls.add_method('Set',
'void',
[param('char const *', 'address')])
return
def register_Ns3Ipv4InterfaceAddress_methods(root_module, cls):
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress::Ipv4InterfaceAddress() [constructor]
cls.add_constructor([])
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress::Ipv4InterfaceAddress(ns3::Ipv4Address local, ns3::Ipv4Mask mask) [constructor]
cls.add_constructor([param('ns3::Ipv4Address', 'local'), param('ns3::Ipv4Mask', 'mask')])
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress::Ipv4InterfaceAddress(ns3::Ipv4InterfaceAddress const & o) [constructor]
cls.add_constructor([param('ns3::Ipv4InterfaceAddress const &', 'o')])
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4InterfaceAddress::GetBroadcast() const [member function]
cls.add_method('GetBroadcast',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4InterfaceAddress::GetLocal() const [member function]
cls.add_method('GetLocal',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4Mask ns3::Ipv4InterfaceAddress::GetMask() const [member function]
cls.add_method('GetMask',
'ns3::Ipv4Mask',
[],
is_const=True)
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e ns3::Ipv4InterfaceAddress::GetScope() const [member function]
cls.add_method('GetScope',
'ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e',
[],
is_const=True)
## ipv4-interface-address.h (module 'internet'): bool ns3::Ipv4InterfaceAddress::IsSecondary() const [member function]
cls.add_method('IsSecondary',
'bool',
[],
is_const=True)
## ipv4-interface-address.h (module 'internet'): void ns3::Ipv4InterfaceAddress::SetBroadcast(ns3::Ipv4Address broadcast) [member function]
cls.add_method('SetBroadcast',
'void',
[param('ns3::Ipv4Address', 'broadcast')])
## ipv4-interface-address.h (module 'internet'): void ns3::Ipv4InterfaceAddress::SetLocal(ns3::Ipv4Address local) [member function]
cls.add_method('SetLocal',
'void',
[param('ns3::Ipv4Address', 'local')])
## ipv4-interface-address.h (module 'internet'): void ns3::Ipv4InterfaceAddress::SetMask(ns3::Ipv4Mask mask) [member function]
cls.add_method('SetMask',
'void',
[param('ns3::Ipv4Mask', 'mask')])
## ipv4-interface-address.h (module 'internet'): void ns3::Ipv4InterfaceAddress::SetPrimary() [member function]
cls.add_method('SetPrimary',
'void',
[])
## ipv4-interface-address.h (module 'internet'): void ns3::Ipv4InterfaceAddress::SetScope(ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e scope) [member function]
cls.add_method('SetScope',
'void',
[param('ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e', 'scope')])
## ipv4-interface-address.h (module 'internet'): void ns3::Ipv4InterfaceAddress::SetSecondary() [member function]
cls.add_method('SetSecondary',
'void',
[])
return
def register_Ns3Ipv4InterfaceContainer_methods(root_module, cls):
## ipv4-interface-container.h (module 'internet'): ns3::Ipv4InterfaceContainer::Ipv4InterfaceContainer(ns3::Ipv4InterfaceContainer const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv4InterfaceContainer const &', 'arg0')])
## ipv4-interface-container.h (module 'internet'): ns3::Ipv4InterfaceContainer::Ipv4InterfaceContainer() [constructor]
cls.add_constructor([])
## ipv4-interface-container.h (module 'internet'): void ns3::Ipv4InterfaceContainer::Add(ns3::Ipv4InterfaceContainer const & other) [member function]
cls.add_method('Add',
'void',
[param('ns3::Ipv4InterfaceContainer const &', 'other')])
## ipv4-interface-container.h (module 'internet'): void ns3::Ipv4InterfaceContainer::Add(ns3::Ptr<ns3::Ipv4> ipv4, uint32_t interface) [member function]
cls.add_method('Add',
'void',
[param('ns3::Ptr< ns3::Ipv4 >', 'ipv4'), param('uint32_t', 'interface')])
## ipv4-interface-container.h (module 'internet'): void ns3::Ipv4InterfaceContainer::Add(std::pair<ns3::Ptr<ns3::Ipv4>, unsigned int> ipInterfacePair) [member function]
cls.add_method('Add',
'void',
[param('std::pair< ns3::Ptr< ns3::Ipv4 >, unsigned int >', 'ipInterfacePair')])
## ipv4-interface-container.h (module 'internet'): void ns3::Ipv4InterfaceContainer::Add(std::string ipv4Name, uint32_t interface) [member function]
cls.add_method('Add',
'void',
[param('std::string', 'ipv4Name'), param('uint32_t', 'interface')])
## ipv4-interface-container.h (module 'internet'): ns3::Ipv4InterfaceContainer::Iterator ns3::Ipv4InterfaceContainer::Begin() const [member function]
cls.add_method('Begin',
'ns3::Ipv4InterfaceContainer::Iterator',
[],
is_const=True)
## ipv4-interface-container.h (module 'internet'): ns3::Ipv4InterfaceContainer::Iterator ns3::Ipv4InterfaceContainer::End() const [member function]
cls.add_method('End',
'ns3::Ipv4InterfaceContainer::Iterator',
[],
is_const=True)
## ipv4-interface-container.h (module 'internet'): std::pair<ns3::Ptr<ns3::Ipv4>, unsigned int> ns3::Ipv4InterfaceContainer::Get(uint32_t i) const [member function]
cls.add_method('Get',
'std::pair< ns3::Ptr< ns3::Ipv4 >, unsigned int >',
[param('uint32_t', 'i')],
is_const=True)
## ipv4-interface-container.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4InterfaceContainer::GetAddress(uint32_t i, uint32_t j=0) const [member function]
cls.add_method('GetAddress',
'ns3::Ipv4Address',
[param('uint32_t', 'i'), param('uint32_t', 'j', default_value='0')],
is_const=True)
## ipv4-interface-container.h (module 'internet'): uint32_t ns3::Ipv4InterfaceContainer::GetN() const [member function]
cls.add_method('GetN',
'uint32_t',
[],
is_const=True)
## ipv4-interface-container.h (module 'internet'): void ns3::Ipv4InterfaceContainer::SetMetric(uint32_t i, uint16_t metric) [member function]
cls.add_method('SetMetric',
'void',
[param('uint32_t', 'i'), param('uint16_t', 'metric')])
return
def register_Ns3Ipv4Mask_methods(root_module, cls):
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(ns3::Ipv4Mask const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv4Mask const &', 'arg0')])
## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(uint32_t mask) [constructor]
cls.add_constructor([param('uint32_t', 'mask')])
## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(char const * mask) [constructor]
cls.add_constructor([param('char const *', 'mask')])
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::Get() const [member function]
cls.add_method('Get',
'uint32_t',
[],
is_const=True)
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::GetInverse() const [member function]
cls.add_method('GetInverse',
'uint32_t',
[],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetLoopback() [member function]
cls.add_method('GetLoopback',
'ns3::Ipv4Mask',
[],
is_static=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetOnes() [member function]
cls.add_method('GetOnes',
'ns3::Ipv4Mask',
[],
is_static=True)
## ipv4-address.h (module 'network'): uint16_t ns3::Ipv4Mask::GetPrefixLength() const [member function]
cls.add_method('GetPrefixLength',
'uint16_t',
[],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetZero() [member function]
cls.add_method('GetZero',
'ns3::Ipv4Mask',
[],
is_static=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsEqual(ns3::Ipv4Mask other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ipv4Mask', 'other')],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsMatch(ns3::Ipv4Address a, ns3::Ipv4Address b) const [member function]
cls.add_method('IsMatch',
'bool',
[param('ns3::Ipv4Address', 'a'), param('ns3::Ipv4Address', 'b')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Set(uint32_t mask) [member function]
cls.add_method('Set',
'void',
[param('uint32_t', 'mask')])
return
def register_Ns3Ipv6Address_methods(root_module, cls):
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(char const * address) [constructor]
cls.add_constructor([param('char const *', 'address')])
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(uint8_t * address) [constructor]
cls.add_constructor([param('uint8_t *', 'address')])
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(ns3::Ipv6Address const & addr) [constructor]
cls.add_constructor([param('ns3::Ipv6Address const &', 'addr')])
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(ns3::Ipv6Address const * addr) [constructor]
cls.add_constructor([param('ns3::Ipv6Address const *', 'addr')])
## ipv6-address.h (module 'network'): ns3::Ipv6Address ns3::Ipv6Address::CombinePrefix(ns3::Ipv6Prefix const & prefix) [member function]
cls.add_method('CombinePrefix',
'ns3::Ipv6Address',
[param('ns3::Ipv6Prefix const &', 'prefix')])
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::Ipv6Address',
[param('ns3::Address const &', 'address')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::Deserialize(uint8_t const * buf) [member function]
cls.add_method('Deserialize',
'ns3::Ipv6Address',
[param('uint8_t const *', 'buf')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllHostsMulticast() [member function]
cls.add_method('GetAllHostsMulticast',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllNodesMulticast() [member function]
cls.add_method('GetAllNodesMulticast',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllRoutersMulticast() [member function]
cls.add_method('GetAllRoutersMulticast',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAny() [member function]
cls.add_method('GetAny',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::GetBytes(uint8_t * buf) const [member function]
cls.add_method('GetBytes',
'void',
[param('uint8_t *', 'buf')],
is_const=True)
## ipv6-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv6Address::GetIpv4MappedAddress() const [member function]
cls.add_method('GetIpv4MappedAddress',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetLoopback() [member function]
cls.add_method('GetLoopback',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetOnes() [member function]
cls.add_method('GetOnes',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetZero() [member function]
cls.add_method('GetZero',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllHostsMulticast() const [member function]
cls.add_method('IsAllHostsMulticast',
'bool',
[],
deprecated=True, is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllNodesMulticast() const [member function]
cls.add_method('IsAllNodesMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllRoutersMulticast() const [member function]
cls.add_method('IsAllRoutersMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAny() const [member function]
cls.add_method('IsAny',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsDocumentation() const [member function]
cls.add_method('IsDocumentation',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsEqual(ns3::Ipv6Address const & other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ipv6Address const &', 'other')],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsIpv4MappedAddress() const [member function]
cls.add_method('IsIpv4MappedAddress',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLinkLocal() const [member function]
cls.add_method('IsLinkLocal',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLinkLocalMulticast() const [member function]
cls.add_method('IsLinkLocalMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLocalhost() const [member function]
cls.add_method('IsLocalhost',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): static bool ns3::Ipv6Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsMulticast() const [member function]
cls.add_method('IsMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsSolicitedMulticast() const [member function]
cls.add_method('IsSolicitedMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac16Address addr, ns3::Ipv6Address prefix) [member function]
cls.add_method('MakeAutoconfiguredAddress',
'ns3::Ipv6Address',
[param('ns3::Mac16Address', 'addr'), param('ns3::Ipv6Address', 'prefix')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac48Address addr, ns3::Ipv6Address prefix) [member function]
cls.add_method('MakeAutoconfiguredAddress',
'ns3::Ipv6Address',
[param('ns3::Mac48Address', 'addr'), param('ns3::Ipv6Address', 'prefix')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac64Address addr, ns3::Ipv6Address prefix) [member function]
cls.add_method('MakeAutoconfiguredAddress',
'ns3::Ipv6Address',
[param('ns3::Mac64Address', 'addr'), param('ns3::Ipv6Address', 'prefix')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac8Address addr, ns3::Ipv6Address prefix) [member function]
cls.add_method('MakeAutoconfiguredAddress',
'ns3::Ipv6Address',
[param('ns3::Mac8Address', 'addr'), param('ns3::Ipv6Address', 'prefix')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(ns3::Mac16Address mac) [member function]
cls.add_method('MakeAutoconfiguredLinkLocalAddress',
'ns3::Ipv6Address',
[param('ns3::Mac16Address', 'mac')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(ns3::Mac48Address mac) [member function]
cls.add_method('MakeAutoconfiguredLinkLocalAddress',
'ns3::Ipv6Address',
[param('ns3::Mac48Address', 'mac')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(ns3::Mac64Address mac) [member function]
cls.add_method('MakeAutoconfiguredLinkLocalAddress',
'ns3::Ipv6Address',
[param('ns3::Mac64Address', 'mac')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(ns3::Mac8Address mac) [member function]
cls.add_method('MakeAutoconfiguredLinkLocalAddress',
'ns3::Ipv6Address',
[param('ns3::Mac8Address', 'mac')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeIpv4MappedAddress(ns3::Ipv4Address addr) [member function]
cls.add_method('MakeIpv4MappedAddress',
'ns3::Ipv6Address',
[param('ns3::Ipv4Address', 'addr')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeSolicitedAddress(ns3::Ipv6Address addr) [member function]
cls.add_method('MakeSolicitedAddress',
'ns3::Ipv6Address',
[param('ns3::Ipv6Address', 'addr')],
is_static=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Serialize(uint8_t * buf) const [member function]
cls.add_method('Serialize',
'void',
[param('uint8_t *', 'buf')],
is_const=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Set(char const * address) [member function]
cls.add_method('Set',
'void',
[param('char const *', 'address')])
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Set(uint8_t * address) [member function]
cls.add_method('Set',
'void',
[param('uint8_t *', 'address')])
return
def register_Ns3Ipv6Prefix_methods(root_module, cls):
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t * prefix) [constructor]
cls.add_constructor([param('uint8_t *', 'prefix')])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(char const * prefix) [constructor]
cls.add_constructor([param('char const *', 'prefix')])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t prefix) [constructor]
cls.add_constructor([param('uint8_t', 'prefix')])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const & prefix) [constructor]
cls.add_constructor([param('ns3::Ipv6Prefix const &', 'prefix')])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const * prefix) [constructor]
cls.add_constructor([param('ns3::Ipv6Prefix const *', 'prefix')])
## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::GetBytes(uint8_t * buf) const [member function]
cls.add_method('GetBytes',
'void',
[param('uint8_t *', 'buf')],
is_const=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetLoopback() [member function]
cls.add_method('GetLoopback',
'ns3::Ipv6Prefix',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetOnes() [member function]
cls.add_method('GetOnes',
'ns3::Ipv6Prefix',
[],
is_static=True)
## ipv6-address.h (module 'network'): uint8_t ns3::Ipv6Prefix::GetPrefixLength() const [member function]
cls.add_method('GetPrefixLength',
'uint8_t',
[],
is_const=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetZero() [member function]
cls.add_method('GetZero',
'ns3::Ipv6Prefix',
[],
is_static=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsEqual(ns3::Ipv6Prefix const & other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ipv6Prefix const &', 'other')],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsMatch(ns3::Ipv6Address a, ns3::Ipv6Address b) const [member function]
cls.add_method('IsMatch',
'bool',
[param('ns3::Ipv6Address', 'a'), param('ns3::Ipv6Address', 'b')],
is_const=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
return
def register_Ns3Mac48Address_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
cls.add_output_stream_operator()
## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address(ns3::Mac48Address const & arg0) [constructor]
cls.add_constructor([param('ns3::Mac48Address const &', 'arg0')])
## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address() [constructor]
cls.add_constructor([])
## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address(char const * str) [constructor]
cls.add_constructor([param('char const *', 'str')])
## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::Allocate() [member function]
cls.add_method('Allocate',
'ns3::Mac48Address',
[],
is_static=True)
## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::Mac48Address',
[param('ns3::Address const &', 'address')],
is_static=True)
## mac48-address.h (module 'network'): void ns3::Mac48Address::CopyFrom(uint8_t const * buffer) [member function]
cls.add_method('CopyFrom',
'void',
[param('uint8_t const *', 'buffer')])
## mac48-address.h (module 'network'): void ns3::Mac48Address::CopyTo(uint8_t * buffer) const [member function]
cls.add_method('CopyTo',
'void',
[param('uint8_t *', 'buffer')],
is_const=True)
## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetBroadcast() [member function]
cls.add_method('GetBroadcast',
'ns3::Mac48Address',
[],
is_static=True)
## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast(ns3::Ipv4Address address) [member function]
cls.add_method('GetMulticast',
'ns3::Mac48Address',
[param('ns3::Ipv4Address', 'address')],
is_static=True)
## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast(ns3::Ipv6Address address) [member function]
cls.add_method('GetMulticast',
'ns3::Mac48Address',
[param('ns3::Ipv6Address', 'address')],
is_static=True)
## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast6Prefix() [member function]
cls.add_method('GetMulticast6Prefix',
'ns3::Mac48Address',
[],
is_static=True)
## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticastPrefix() [member function]
cls.add_method('GetMulticastPrefix',
'ns3::Mac48Address',
[],
is_static=True)
## mac48-address.h (module 'network'): bool ns3::Mac48Address::IsBroadcast() const [member function]
cls.add_method('IsBroadcast',
'bool',
[],
is_const=True)
## mac48-address.h (module 'network'): bool ns3::Mac48Address::IsGroup() const [member function]
cls.add_method('IsGroup',
'bool',
[],
is_const=True)
## mac48-address.h (module 'network'): static bool ns3::Mac48Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
return
def register_Ns3Mac64Address_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
cls.add_output_stream_operator()
## mac64-address.h (module 'network'): ns3::Mac64Address::Mac64Address(ns3::Mac64Address const & arg0) [constructor]
cls.add_constructor([param('ns3::Mac64Address const &', 'arg0')])
## mac64-address.h (module 'network'): ns3::Mac64Address::Mac64Address() [constructor]
cls.add_constructor([])
## mac64-address.h (module 'network'): ns3::Mac64Address::Mac64Address(char const * str) [constructor]
cls.add_constructor([param('char const *', 'str')])
## mac64-address.h (module 'network'): static ns3::Mac64Address ns3::Mac64Address::Allocate() [member function]
cls.add_method('Allocate',
'ns3::Mac64Address',
[],
is_static=True)
## mac64-address.h (module 'network'): static ns3::Mac64Address ns3::Mac64Address::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::Mac64Address',
[param('ns3::Address const &', 'address')],
is_static=True)
## mac64-address.h (module 'network'): void ns3::Mac64Address::CopyFrom(uint8_t const * buffer) [member function]
cls.add_method('CopyFrom',
'void',
[param('uint8_t const *', 'buffer')])
## mac64-address.h (module 'network'): void ns3::Mac64Address::CopyTo(uint8_t * buffer) const [member function]
cls.add_method('CopyTo',
'void',
[param('uint8_t *', 'buffer')],
is_const=True)
## mac64-address.h (module 'network'): static bool ns3::Mac64Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
return
def register_Ns3Mac8Address_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
## mac8-address.h (module 'network'): ns3::Mac8Address::Mac8Address(ns3::Mac8Address const & arg0) [constructor]
cls.add_constructor([param('ns3::Mac8Address const &', 'arg0')])
## mac8-address.h (module 'network'): ns3::Mac8Address::Mac8Address() [constructor]
cls.add_constructor([])
## mac8-address.h (module 'network'): ns3::Mac8Address::Mac8Address(uint8_t addr) [constructor]
cls.add_constructor([param('uint8_t', 'addr')])
## mac8-address.h (module 'network'): static ns3::Mac8Address ns3::Mac8Address::Allocate() [member function]
cls.add_method('Allocate',
'ns3::Mac8Address',
[],
is_static=True)
## mac8-address.h (module 'network'): static ns3::Mac8Address ns3::Mac8Address::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::Mac8Address',
[param('ns3::Address const &', 'address')],
is_static=True)
## mac8-address.h (module 'network'): void ns3::Mac8Address::CopyFrom(uint8_t const * pBuffer) [member function]
cls.add_method('CopyFrom',
'void',
[param('uint8_t const *', 'pBuffer')])
## mac8-address.h (module 'network'): void ns3::Mac8Address::CopyTo(uint8_t * pBuffer) const [member function]
cls.add_method('CopyTo',
'void',
[param('uint8_t *', 'pBuffer')],
is_const=True)
## mac8-address.h (module 'network'): static ns3::Mac8Address ns3::Mac8Address::GetBroadcast() [member function]
cls.add_method('GetBroadcast',
'ns3::Mac8Address',
[],
is_static=True)
## mac8-address.h (module 'network'): static bool ns3::Mac8Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
return
def register_Ns3NetDeviceContainer_methods(root_module, cls):
## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::NetDeviceContainer const & arg0) [constructor]
cls.add_constructor([param('ns3::NetDeviceContainer const &', 'arg0')])
## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer() [constructor]
cls.add_constructor([])
## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::Ptr<ns3::NetDevice> dev) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::NetDevice >', 'dev')])
## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(std::string devName) [constructor]
cls.add_constructor([param('std::string', 'devName')])
## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::NetDeviceContainer const & a, ns3::NetDeviceContainer const & b) [constructor]
cls.add_constructor([param('ns3::NetDeviceContainer const &', 'a'), param('ns3::NetDeviceContainer const &', 'b')])
## net-device-container.h (module 'network'): void ns3::NetDeviceContainer::Add(ns3::NetDeviceContainer other) [member function]
cls.add_method('Add',
'void',
[param('ns3::NetDeviceContainer', 'other')])
## net-device-container.h (module 'network'): void ns3::NetDeviceContainer::Add(ns3::Ptr<ns3::NetDevice> device) [member function]
cls.add_method('Add',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'device')])
## net-device-container.h (module 'network'): void ns3::NetDeviceContainer::Add(std::string deviceName) [member function]
cls.add_method('Add',
'void',
[param('std::string', 'deviceName')])
## net-device-container.h (module 'network'): ns3::NetDeviceContainer::Iterator ns3::NetDeviceContainer::Begin() const [member function]
cls.add_method('Begin',
'ns3::NetDeviceContainer::Iterator',
[],
is_const=True)
## net-device-container.h (module 'network'): ns3::NetDeviceContainer::Iterator ns3::NetDeviceContainer::End() const [member function]
cls.add_method('End',
'ns3::NetDeviceContainer::Iterator',
[],
is_const=True)
## net-device-container.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::NetDeviceContainer::Get(uint32_t i) const [member function]
cls.add_method('Get',
'ns3::Ptr< ns3::NetDevice >',
[param('uint32_t', 'i')],
is_const=True)
## net-device-container.h (module 'network'): uint32_t ns3::NetDeviceContainer::GetN() const [member function]
cls.add_method('GetN',
'uint32_t',
[],
is_const=True)
return
def register_Ns3NodeContainer_methods(root_module, cls):
## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & arg0) [constructor]
cls.add_constructor([param('ns3::NodeContainer const &', 'arg0')])
## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer() [constructor]
cls.add_constructor([])
## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::Ptr<ns3::Node> node) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Node >', 'node')])
## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(std::string nodeName) [constructor]
cls.add_constructor([param('std::string', 'nodeName')])
## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b) [constructor]
cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b')])
## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b, ns3::NodeContainer const & c) [constructor]
cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b'), param('ns3::NodeContainer const &', 'c')])
## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b, ns3::NodeContainer const & c, ns3::NodeContainer const & d) [constructor]
cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b'), param('ns3::NodeContainer const &', 'c'), param('ns3::NodeContainer const &', 'd')])
## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b, ns3::NodeContainer const & c, ns3::NodeContainer const & d, ns3::NodeContainer const & e) [constructor]
cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b'), param('ns3::NodeContainer const &', 'c'), param('ns3::NodeContainer const &', 'd'), param('ns3::NodeContainer const &', 'e')])
## node-container.h (module 'network'): void ns3::NodeContainer::Add(ns3::NodeContainer other) [member function]
cls.add_method('Add',
'void',
[param('ns3::NodeContainer', 'other')])
## node-container.h (module 'network'): void ns3::NodeContainer::Add(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('Add',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')])
## node-container.h (module 'network'): void ns3::NodeContainer::Add(std::string nodeName) [member function]
cls.add_method('Add',
'void',
[param('std::string', 'nodeName')])
## node-container.h (module 'network'): ns3::NodeContainer::Iterator ns3::NodeContainer::Begin() const [member function]
cls.add_method('Begin',
'ns3::NodeContainer::Iterator',
[],
is_const=True)
## node-container.h (module 'network'): bool ns3::NodeContainer::Contains(uint32_t id) const [member function]
cls.add_method('Contains',
'bool',
[param('uint32_t', 'id')],
is_const=True)
## node-container.h (module 'network'): void ns3::NodeContainer::Create(uint32_t n) [member function]
cls.add_method('Create',
'void',
[param('uint32_t', 'n')])
## node-container.h (module 'network'): void ns3::NodeContainer::Create(uint32_t n, uint32_t systemId) [member function]
cls.add_method('Create',
'void',
[param('uint32_t', 'n'), param('uint32_t', 'systemId')])
## node-container.h (module 'network'): ns3::NodeContainer::Iterator ns3::NodeContainer::End() const [member function]
cls.add_method('End',
'ns3::NodeContainer::Iterator',
[],
is_const=True)
## node-container.h (module 'network'): ns3::Ptr<ns3::Node> ns3::NodeContainer::Get(uint32_t i) const [member function]
cls.add_method('Get',
'ns3::Ptr< ns3::Node >',
[param('uint32_t', 'i')],
is_const=True)
## node-container.h (module 'network'): static ns3::NodeContainer ns3::NodeContainer::GetGlobal() [member function]
cls.add_method('GetGlobal',
'ns3::NodeContainer',
[],
is_static=True)
## node-container.h (module 'network'): uint32_t ns3::NodeContainer::GetN() const [member function]
cls.add_method('GetN',
'uint32_t',
[],
is_const=True)
return
def register_Ns3ObjectBase_methods(root_module, cls):
## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase() [constructor]
cls.add_constructor([])
## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase(ns3::ObjectBase const & arg0) [constructor]
cls.add_constructor([param('ns3::ObjectBase const &', 'arg0')])
## object-base.h (module 'core'): void ns3::ObjectBase::GetAttribute(std::string name, ns3::AttributeValue & value) const [member function]
cls.add_method('GetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue &', 'value')],
is_const=True)
## object-base.h (module 'core'): bool ns3::ObjectBase::GetAttributeFailSafe(std::string name, ns3::AttributeValue & value) const [member function]
cls.add_method('GetAttributeFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue &', 'value')],
is_const=True)
## object-base.h (module 'core'): ns3::TypeId ns3::ObjectBase::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## object-base.h (module 'core'): static ns3::TypeId ns3::ObjectBase::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## object-base.h (module 'core'): void ns3::ObjectBase::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## object-base.h (module 'core'): bool ns3::ObjectBase::SetAttributeFailSafe(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttributeFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceConnect',
'bool',
[param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceConnectWithoutContext',
'bool',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceDisconnect',
'bool',
[param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceDisconnectWithoutContext',
'bool',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): void ns3::ObjectBase::ConstructSelf(ns3::AttributeConstructionList const & attributes) [member function]
cls.add_method('ConstructSelf',
'void',
[param('ns3::AttributeConstructionList const &', 'attributes')],
visibility='protected')
## object-base.h (module 'core'): void ns3::ObjectBase::NotifyConstructionCompleted() [member function]
cls.add_method('NotifyConstructionCompleted',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3ObjectDeleter_methods(root_module, cls):
## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter() [constructor]
cls.add_constructor([])
## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter(ns3::ObjectDeleter const & arg0) [constructor]
cls.add_constructor([param('ns3::ObjectDeleter const &', 'arg0')])
## object.h (module 'core'): static void ns3::ObjectDeleter::Delete(ns3::Object * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::Object *', 'object')],
is_static=True)
return
def register_Ns3ObjectFactory_methods(root_module, cls):
cls.add_output_stream_operator()
## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory(ns3::ObjectFactory const & arg0) [constructor]
cls.add_constructor([param('ns3::ObjectFactory const &', 'arg0')])
## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory() [constructor]
cls.add_constructor([])
## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory(std::string typeId) [constructor]
cls.add_constructor([param('std::string', 'typeId')])
## object-factory.h (module 'core'): ns3::Ptr<ns3::Object> ns3::ObjectFactory::Create() const [member function]
cls.add_method('Create',
'ns3::Ptr< ns3::Object >',
[],
is_const=True)
## object-factory.h (module 'core'): ns3::TypeId ns3::ObjectFactory::GetTypeId() const [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_const=True)
## object-factory.h (module 'core'): void ns3::ObjectFactory::Set(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('Set',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(ns3::TypeId tid) [member function]
cls.add_method('SetTypeId',
'void',
[param('ns3::TypeId', 'tid')])
## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(char const * tid) [member function]
cls.add_method('SetTypeId',
'void',
[param('char const *', 'tid')])
## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(std::string tid) [member function]
cls.add_method('SetTypeId',
'void',
[param('std::string', 'tid')])
return
def register_Ns3PacketMetadata_methods(root_module, cls):
## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(uint64_t uid, uint32_t size) [constructor]
cls.add_constructor([param('uint64_t', 'uid'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(ns3::PacketMetadata const & o) [constructor]
cls.add_constructor([param('ns3::PacketMetadata const &', 'o')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddAtEnd(ns3::PacketMetadata const & o) [member function]
cls.add_method('AddAtEnd',
'void',
[param('ns3::PacketMetadata const &', 'o')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddHeader(ns3::Header const & header, uint32_t size) [member function]
cls.add_method('AddHeader',
'void',
[param('ns3::Header const &', 'header'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddPaddingAtEnd(uint32_t end) [member function]
cls.add_method('AddPaddingAtEnd',
'void',
[param('uint32_t', 'end')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddTrailer(ns3::Trailer const & trailer, uint32_t size) [member function]
cls.add_method('AddTrailer',
'void',
[param('ns3::Trailer const &', 'trailer'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator ns3::PacketMetadata::BeginItem(ns3::Buffer buffer) const [member function]
cls.add_method('BeginItem',
'ns3::PacketMetadata::ItemIterator',
[param('ns3::Buffer', 'buffer')],
is_const=True)
## packet-metadata.h (module 'network'): ns3::PacketMetadata ns3::PacketMetadata::CreateFragment(uint32_t start, uint32_t end) const [member function]
cls.add_method('CreateFragment',
'ns3::PacketMetadata',
[param('uint32_t', 'start'), param('uint32_t', 'end')],
is_const=True)
## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::Deserialize(uint8_t const * buffer, uint32_t size) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): static void ns3::PacketMetadata::Enable() [member function]
cls.add_method('Enable',
'void',
[],
is_static=True)
## packet-metadata.h (module 'network'): static void ns3::PacketMetadata::EnableChecking() [member function]
cls.add_method('EnableChecking',
'void',
[],
is_static=True)
## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## packet-metadata.h (module 'network'): uint64_t ns3::PacketMetadata::GetUid() const [member function]
cls.add_method('GetUid',
'uint64_t',
[],
is_const=True)
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveAtEnd(uint32_t end) [member function]
cls.add_method('RemoveAtEnd',
'void',
[param('uint32_t', 'end')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveAtStart(uint32_t start) [member function]
cls.add_method('RemoveAtStart',
'void',
[param('uint32_t', 'start')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveHeader(ns3::Header const & header, uint32_t size) [member function]
cls.add_method('RemoveHeader',
'void',
[param('ns3::Header const &', 'header'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveTrailer(ns3::Trailer const & trailer, uint32_t size) [member function]
cls.add_method('RemoveTrailer',
'void',
[param('ns3::Trailer const &', 'trailer'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function]
cls.add_method('Serialize',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')],
is_const=True)
return
def register_Ns3PacketMetadataItem_methods(root_module, cls):
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::Item() [constructor]
cls.add_constructor([])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::Item(ns3::PacketMetadata::Item const & arg0) [constructor]
cls.add_constructor([param('ns3::PacketMetadata::Item const &', 'arg0')])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::current [variable]
cls.add_instance_attribute('current', 'ns3::Buffer::Iterator', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentSize [variable]
cls.add_instance_attribute('currentSize', 'uint32_t', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentTrimedFromEnd [variable]
cls.add_instance_attribute('currentTrimedFromEnd', 'uint32_t', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentTrimedFromStart [variable]
cls.add_instance_attribute('currentTrimedFromStart', 'uint32_t', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::isFragment [variable]
cls.add_instance_attribute('isFragment', 'bool', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::tid [variable]
cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::type [variable]
cls.add_instance_attribute('type', 'ns3::PacketMetadata::Item::ItemType', is_const=False)
return
def register_Ns3PacketMetadataItemIterator_methods(root_module, cls):
## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator::ItemIterator(ns3::PacketMetadata::ItemIterator const & arg0) [constructor]
cls.add_constructor([param('ns3::PacketMetadata::ItemIterator const &', 'arg0')])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator::ItemIterator(ns3::PacketMetadata const * metadata, ns3::Buffer buffer) [constructor]
cls.add_constructor([param('ns3::PacketMetadata const *', 'metadata'), param('ns3::Buffer', 'buffer')])
## packet-metadata.h (module 'network'): bool ns3::PacketMetadata::ItemIterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item ns3::PacketMetadata::ItemIterator::Next() [member function]
cls.add_method('Next',
'ns3::PacketMetadata::Item',
[])
return
def register_Ns3PacketTagIterator_methods(root_module, cls):
## packet.h (module 'network'): ns3::PacketTagIterator::PacketTagIterator(ns3::PacketTagIterator const & arg0) [constructor]
cls.add_constructor([param('ns3::PacketTagIterator const &', 'arg0')])
## packet.h (module 'network'): bool ns3::PacketTagIterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## packet.h (module 'network'): ns3::PacketTagIterator::Item ns3::PacketTagIterator::Next() [member function]
cls.add_method('Next',
'ns3::PacketTagIterator::Item',
[])
return
def register_Ns3PacketTagIteratorItem_methods(root_module, cls):
## packet.h (module 'network'): ns3::PacketTagIterator::Item::Item(ns3::PacketTagIterator::Item const & arg0) [constructor]
cls.add_constructor([param('ns3::PacketTagIterator::Item const &', 'arg0')])
## packet.h (module 'network'): void ns3::PacketTagIterator::Item::GetTag(ns3::Tag & tag) const [member function]
cls.add_method('GetTag',
'void',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet.h (module 'network'): ns3::TypeId ns3::PacketTagIterator::Item::GetTypeId() const [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_const=True)
return
def register_Ns3PacketTagList_methods(root_module, cls):
## packet-tag-list.h (module 'network'): ns3::PacketTagList::PacketTagList() [constructor]
cls.add_constructor([])
## packet-tag-list.h (module 'network'): ns3::PacketTagList::PacketTagList(ns3::PacketTagList const & o) [constructor]
cls.add_constructor([param('ns3::PacketTagList const &', 'o')])
## packet-tag-list.h (module 'network'): void ns3::PacketTagList::Add(ns3::Tag const & tag) const [member function]
cls.add_method('Add',
'void',
[param('ns3::Tag const &', 'tag')],
is_const=True)
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData const * ns3::PacketTagList::Head() const [member function]
cls.add_method('Head',
'ns3::PacketTagList::TagData const *',
[],
is_const=True)
## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Peek(ns3::Tag & tag) const [member function]
cls.add_method('Peek',
'bool',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Remove(ns3::Tag & tag) [member function]
cls.add_method('Remove',
'bool',
[param('ns3::Tag &', 'tag')])
## packet-tag-list.h (module 'network'): void ns3::PacketTagList::RemoveAll() [member function]
cls.add_method('RemoveAll',
'void',
[])
## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Replace(ns3::Tag & tag) [member function]
cls.add_method('Replace',
'bool',
[param('ns3::Tag &', 'tag')])
return
def register_Ns3PacketTagListTagData_methods(root_module, cls):
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData() [constructor]
cls.add_constructor([])
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData(ns3::PacketTagList::TagData const & arg0) [constructor]
cls.add_constructor([param('ns3::PacketTagList::TagData const &', 'arg0')])
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::count [variable]
cls.add_instance_attribute('count', 'uint32_t', is_const=False)
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::data [variable]
cls.add_instance_attribute('data', 'uint8_t [ 1 ]', is_const=False)
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::next [variable]
cls.add_instance_attribute('next', 'ns3::PacketTagList::TagData *', is_const=False)
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::size [variable]
cls.add_instance_attribute('size', 'uint32_t', is_const=False)
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::tid [variable]
cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False)
return
def register_Ns3Ping6Helper_methods(root_module, cls):
## ping6-helper.h (module 'internet-apps'): ns3::Ping6Helper::Ping6Helper(ns3::Ping6Helper const & arg0) [constructor]
cls.add_constructor([param('ns3::Ping6Helper const &', 'arg0')])
## ping6-helper.h (module 'internet-apps'): ns3::Ping6Helper::Ping6Helper() [constructor]
cls.add_constructor([])
## ping6-helper.h (module 'internet-apps'): ns3::ApplicationContainer ns3::Ping6Helper::Install(ns3::NodeContainer c) [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::NodeContainer', 'c')])
## ping6-helper.h (module 'internet-apps'): void ns3::Ping6Helper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## ping6-helper.h (module 'internet-apps'): void ns3::Ping6Helper::SetIfIndex(uint32_t ifIndex) [member function]
cls.add_method('SetIfIndex',
'void',
[param('uint32_t', 'ifIndex')])
## ping6-helper.h (module 'internet-apps'): void ns3::Ping6Helper::SetLocal(ns3::Ipv6Address ip) [member function]
cls.add_method('SetLocal',
'void',
[param('ns3::Ipv6Address', 'ip')])
## ping6-helper.h (module 'internet-apps'): void ns3::Ping6Helper::SetRemote(ns3::Ipv6Address ip) [member function]
cls.add_method('SetRemote',
'void',
[param('ns3::Ipv6Address', 'ip')])
## ping6-helper.h (module 'internet-apps'): void ns3::Ping6Helper::SetRoutersAddress(std::vector<ns3::Ipv6Address, std::allocator<ns3::Ipv6Address> > routers) [member function]
cls.add_method('SetRoutersAddress',
'void',
[param('std::vector< ns3::Ipv6Address >', 'routers')])
return
def register_Ns3RadvdHelper_methods(root_module, cls):
## radvd-helper.h (module 'internet-apps'): ns3::RadvdHelper::RadvdHelper(ns3::RadvdHelper const & arg0) [constructor]
cls.add_constructor([param('ns3::RadvdHelper const &', 'arg0')])
## radvd-helper.h (module 'internet-apps'): ns3::RadvdHelper::RadvdHelper() [constructor]
cls.add_constructor([])
## radvd-helper.h (module 'internet-apps'): void ns3::RadvdHelper::AddAnnouncedPrefix(uint32_t interface, ns3::Ipv6Address prefix, uint32_t prefixLength) [member function]
cls.add_method('AddAnnouncedPrefix',
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefix'), param('uint32_t', 'prefixLength')])
## radvd-helper.h (module 'internet-apps'): void ns3::RadvdHelper::ClearPrefixes() [member function]
cls.add_method('ClearPrefixes',
'void',
[])
## radvd-helper.h (module 'internet-apps'): void ns3::RadvdHelper::DisableDefaultRouterForInterface(uint32_t interface) [member function]
cls.add_method('DisableDefaultRouterForInterface',
'void',
[param('uint32_t', 'interface')])
## radvd-helper.h (module 'internet-apps'): void ns3::RadvdHelper::EnableDefaultRouterForInterface(uint32_t interface) [member function]
cls.add_method('EnableDefaultRouterForInterface',
'void',
[param('uint32_t', 'interface')])
## radvd-helper.h (module 'internet-apps'): ns3::Ptr<ns3::RadvdInterface> ns3::RadvdHelper::GetRadvdInterface(uint32_t interface) [member function]
cls.add_method('GetRadvdInterface',
'ns3::Ptr< ns3::RadvdInterface >',
[param('uint32_t', 'interface')])
## radvd-helper.h (module 'internet-apps'): ns3::ApplicationContainer ns3::RadvdHelper::Install(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::Ptr< ns3::Node >', 'node')])
## radvd-helper.h (module 'internet-apps'): void ns3::RadvdHelper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
return
def register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount(ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter > const &', 'o')])
return
def register_Ns3Simulator_methods(root_module, cls):
## simulator.h (module 'core'): ns3::Simulator::Simulator(ns3::Simulator const & arg0) [constructor]
cls.add_constructor([param('ns3::Simulator const &', 'arg0')])
## simulator.h (module 'core'): static void ns3::Simulator::Cancel(ns3::EventId const & id) [member function]
cls.add_method('Cancel',
'void',
[param('ns3::EventId const &', 'id')],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::Destroy() [member function]
cls.add_method('Destroy',
'void',
[],
is_static=True)
## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetContext() [member function]
cls.add_method('GetContext',
'uint32_t',
[],
is_static=True)
## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetDelayLeft(ns3::EventId const & id) [member function]
cls.add_method('GetDelayLeft',
'ns3::Time',
[param('ns3::EventId const &', 'id')],
is_static=True)
## simulator.h (module 'core'): static ns3::Ptr<ns3::SimulatorImpl> ns3::Simulator::GetImplementation() [member function]
cls.add_method('GetImplementation',
'ns3::Ptr< ns3::SimulatorImpl >',
[],
is_static=True)
## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetMaximumSimulationTime() [member function]
cls.add_method('GetMaximumSimulationTime',
'ns3::Time',
[],
is_static=True)
## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetSystemId() [member function]
cls.add_method('GetSystemId',
'uint32_t',
[],
is_static=True)
## simulator.h (module 'core'): static bool ns3::Simulator::IsExpired(ns3::EventId const & id) [member function]
cls.add_method('IsExpired',
'bool',
[param('ns3::EventId const &', 'id')],
is_static=True)
## simulator.h (module 'core'): static bool ns3::Simulator::IsFinished() [member function]
cls.add_method('IsFinished',
'bool',
[],
is_static=True)
## simulator.h (module 'core'): static ns3::Time ns3::Simulator::Now() [member function]
cls.add_method('Now',
'ns3::Time',
[],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::Remove(ns3::EventId const & id) [member function]
cls.add_method('Remove',
'void',
[param('ns3::EventId const &', 'id')],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::SetImplementation(ns3::Ptr<ns3::SimulatorImpl> impl) [member function]
cls.add_method('SetImplementation',
'void',
[param('ns3::Ptr< ns3::SimulatorImpl >', 'impl')],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function]
cls.add_method('SetScheduler',
'void',
[param('ns3::ObjectFactory', 'schedulerFactory')],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::Stop() [member function]
cls.add_method('Stop',
'void',
[],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::Stop(ns3::Time const & delay) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'delay')],
is_static=True)
return
def register_Ns3StatisticalSummary_methods(root_module, cls):
## data-calculator.h (module 'stats'): ns3::StatisticalSummary::StatisticalSummary() [constructor]
cls.add_constructor([])
## data-calculator.h (module 'stats'): ns3::StatisticalSummary::StatisticalSummary(ns3::StatisticalSummary const & arg0) [constructor]
cls.add_constructor([param('ns3::StatisticalSummary const &', 'arg0')])
## data-calculator.h (module 'stats'): long int ns3::StatisticalSummary::getCount() const [member function]
cls.add_method('getCount',
'long int',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getMax() const [member function]
cls.add_method('getMax',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getMean() const [member function]
cls.add_method('getMean',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getMin() const [member function]
cls.add_method('getMin',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getSqrSum() const [member function]
cls.add_method('getSqrSum',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getStddev() const [member function]
cls.add_method('getStddev',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getSum() const [member function]
cls.add_method('getSum',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getVariance() const [member function]
cls.add_method('getVariance',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3Tag_methods(root_module, cls):
## tag.h (module 'network'): ns3::Tag::Tag() [constructor]
cls.add_constructor([])
## tag.h (module 'network'): ns3::Tag::Tag(ns3::Tag const & arg0) [constructor]
cls.add_constructor([param('ns3::Tag const &', 'arg0')])
## tag.h (module 'network'): void ns3::Tag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_pure_virtual=True, is_virtual=True)
## tag.h (module 'network'): uint32_t ns3::Tag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## tag.h (module 'network'): static ns3::TypeId ns3::Tag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## tag.h (module 'network'): void ns3::Tag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## tag.h (module 'network'): void ns3::Tag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3TagBuffer_methods(root_module, cls):
## tag-buffer.h (module 'network'): ns3::TagBuffer::TagBuffer(ns3::TagBuffer const & arg0) [constructor]
cls.add_constructor([param('ns3::TagBuffer const &', 'arg0')])
## tag-buffer.h (module 'network'): ns3::TagBuffer::TagBuffer(uint8_t * start, uint8_t * end) [constructor]
cls.add_constructor([param('uint8_t *', 'start'), param('uint8_t *', 'end')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::CopyFrom(ns3::TagBuffer o) [member function]
cls.add_method('CopyFrom',
'void',
[param('ns3::TagBuffer', 'o')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::Read(uint8_t * buffer, uint32_t size) [member function]
cls.add_method('Read',
'void',
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')])
## tag-buffer.h (module 'network'): double ns3::TagBuffer::ReadDouble() [member function]
cls.add_method('ReadDouble',
'double',
[])
## tag-buffer.h (module 'network'): uint16_t ns3::TagBuffer::ReadU16() [member function]
cls.add_method('ReadU16',
'uint16_t',
[])
## tag-buffer.h (module 'network'): uint32_t ns3::TagBuffer::ReadU32() [member function]
cls.add_method('ReadU32',
'uint32_t',
[])
## tag-buffer.h (module 'network'): uint64_t ns3::TagBuffer::ReadU64() [member function]
cls.add_method('ReadU64',
'uint64_t',
[])
## tag-buffer.h (module 'network'): uint8_t ns3::TagBuffer::ReadU8() [member function]
cls.add_method('ReadU8',
'uint8_t',
[])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::TrimAtEnd(uint32_t trim) [member function]
cls.add_method('TrimAtEnd',
'void',
[param('uint32_t', 'trim')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::Write(uint8_t const * buffer, uint32_t size) [member function]
cls.add_method('Write',
'void',
[param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteDouble(double v) [member function]
cls.add_method('WriteDouble',
'void',
[param('double', 'v')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU16(uint16_t v) [member function]
cls.add_method('WriteU16',
'void',
[param('uint16_t', 'v')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU32(uint32_t v) [member function]
cls.add_method('WriteU32',
'void',
[param('uint32_t', 'v')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU64(uint64_t v) [member function]
cls.add_method('WriteU64',
'void',
[param('uint64_t', 'v')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU8(uint8_t v) [member function]
cls.add_method('WriteU8',
'void',
[param('uint8_t', 'v')])
return
def register_Ns3TimeWithUnit_methods(root_module, cls):
cls.add_output_stream_operator()
## nstime.h (module 'core'): ns3::TimeWithUnit::TimeWithUnit(ns3::TimeWithUnit const & arg0) [constructor]
cls.add_constructor([param('ns3::TimeWithUnit const &', 'arg0')])
## nstime.h (module 'core'): ns3::TimeWithUnit::TimeWithUnit(ns3::Time const time, ns3::Time::Unit const unit) [constructor]
cls.add_constructor([param('ns3::Time const', 'time'), param('ns3::Time::Unit const', 'unit')])
return
def register_Ns3TypeId_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('<')
## type-id.h (module 'core'): ns3::TypeId::TypeId(char const * name) [constructor]
cls.add_constructor([param('char const *', 'name')])
## type-id.h (module 'core'): ns3::TypeId::TypeId() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeId::TypeId(ns3::TypeId const & o) [constructor]
cls.add_constructor([param('ns3::TypeId const &', 'o')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, ns3::AttributeValue const & initialValue, ns3::Ptr<const ns3::AttributeAccessor> accessor, ns3::Ptr<const ns3::AttributeChecker> checker, ns3::TypeId::SupportLevel supportLevel=::ns3::TypeId::SupportLevel::SUPPORTED, std::string const & supportMsg="") [member function]
cls.add_method('AddAttribute',
'ns3::TypeId',
[param('std::string', 'name'), param('std::string', 'help'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker'), param('ns3::TypeId::SupportLevel', 'supportLevel', default_value='::ns3::TypeId::SupportLevel::SUPPORTED'), param('std::string const &', 'supportMsg', default_value='""')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, uint32_t flags, ns3::AttributeValue const & initialValue, ns3::Ptr<const ns3::AttributeAccessor> accessor, ns3::Ptr<const ns3::AttributeChecker> checker, ns3::TypeId::SupportLevel supportLevel=::ns3::TypeId::SupportLevel::SUPPORTED, std::string const & supportMsg="") [member function]
cls.add_method('AddAttribute',
'ns3::TypeId',
[param('std::string', 'name'), param('std::string', 'help'), param('uint32_t', 'flags'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker'), param('ns3::TypeId::SupportLevel', 'supportLevel', default_value='::ns3::TypeId::SupportLevel::SUPPORTED'), param('std::string const &', 'supportMsg', default_value='""')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr<const ns3::TraceSourceAccessor> accessor) [member function]
cls.add_method('AddTraceSource',
'ns3::TypeId',
[param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor')],
deprecated=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr<const ns3::TraceSourceAccessor> accessor, std::string callback, ns3::TypeId::SupportLevel supportLevel=::ns3::TypeId::SupportLevel::SUPPORTED, std::string const & supportMsg="") [member function]
cls.add_method('AddTraceSource',
'ns3::TypeId',
[param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor'), param('std::string', 'callback'), param('ns3::TypeId::SupportLevel', 'supportLevel', default_value='::ns3::TypeId::SupportLevel::SUPPORTED'), param('std::string const &', 'supportMsg', default_value='""')])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation ns3::TypeId::GetAttribute(std::size_t i) const [member function]
cls.add_method('GetAttribute',
'ns3::TypeId::AttributeInformation',
[param('std::size_t', 'i')],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeId::GetAttributeFullName(std::size_t i) const [member function]
cls.add_method('GetAttributeFullName',
'std::string',
[param('std::size_t', 'i')],
is_const=True)
## type-id.h (module 'core'): std::size_t ns3::TypeId::GetAttributeN() const [member function]
cls.add_method('GetAttributeN',
'std::size_t',
[],
is_const=True)
## type-id.h (module 'core'): ns3::Callback<ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> ns3::TypeId::GetConstructor() const [member function]
cls.add_method('GetConstructor',
'ns3::Callback< ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >',
[],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeId::GetGroupName() const [member function]
cls.add_method('GetGroupName',
'std::string',
[],
is_const=True)
## type-id.h (module 'core'): ns3::TypeId::hash_t ns3::TypeId::GetHash() const [member function]
cls.add_method('GetHash',
'ns3::TypeId::hash_t',
[],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeId::GetName() const [member function]
cls.add_method('GetName',
'std::string',
[],
is_const=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::GetParent() const [member function]
cls.add_method('GetParent',
'ns3::TypeId',
[],
is_const=True)
## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::GetRegistered(uint16_t i) [member function]
cls.add_method('GetRegistered',
'ns3::TypeId',
[param('uint16_t', 'i')],
is_static=True)
## type-id.h (module 'core'): static uint16_t ns3::TypeId::GetRegisteredN() [member function]
cls.add_method('GetRegisteredN',
'uint16_t',
[],
is_static=True)
## type-id.h (module 'core'): std::size_t ns3::TypeId::GetSize() const [member function]
cls.add_method('GetSize',
'std::size_t',
[],
is_const=True)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation ns3::TypeId::GetTraceSource(std::size_t i) const [member function]
cls.add_method('GetTraceSource',
'ns3::TypeId::TraceSourceInformation',
[param('std::size_t', 'i')],
is_const=True)
## type-id.h (module 'core'): std::size_t ns3::TypeId::GetTraceSourceN() const [member function]
cls.add_method('GetTraceSourceN',
'std::size_t',
[],
is_const=True)
## type-id.h (module 'core'): uint16_t ns3::TypeId::GetUid() const [member function]
cls.add_method('GetUid',
'uint16_t',
[],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::HasConstructor() const [member function]
cls.add_method('HasConstructor',
'bool',
[],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::HasParent() const [member function]
cls.add_method('HasParent',
'bool',
[],
is_const=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::HideFromDocumentation() [member function]
cls.add_method('HideFromDocumentation',
'ns3::TypeId',
[])
## type-id.h (module 'core'): bool ns3::TypeId::IsChildOf(ns3::TypeId other) const [member function]
cls.add_method('IsChildOf',
'bool',
[param('ns3::TypeId', 'other')],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::LookupAttributeByName(std::string name, ns3::TypeId::AttributeInformation * info) const [member function]
cls.add_method('LookupAttributeByName',
'bool',
[param('std::string', 'name'), param('ns3::TypeId::AttributeInformation *', 'info', transfer_ownership=False)],
is_const=True)
## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::LookupByHash(ns3::TypeId::hash_t hash) [member function]
cls.add_method('LookupByHash',
'ns3::TypeId',
[param('uint32_t', 'hash')],
is_static=True)
## type-id.h (module 'core'): static bool ns3::TypeId::LookupByHashFailSafe(ns3::TypeId::hash_t hash, ns3::TypeId * tid) [member function]
cls.add_method('LookupByHashFailSafe',
'bool',
[param('uint32_t', 'hash'), param('ns3::TypeId *', 'tid')],
is_static=True)
## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::LookupByName(std::string name) [member function]
cls.add_method('LookupByName',
'ns3::TypeId',
[param('std::string', 'name')],
is_static=True)
## type-id.h (module 'core'): ns3::Ptr<const ns3::TraceSourceAccessor> ns3::TypeId::LookupTraceSourceByName(std::string name) const [member function]
cls.add_method('LookupTraceSourceByName',
'ns3::Ptr< ns3::TraceSourceAccessor const >',
[param('std::string', 'name')],
is_const=True)
## type-id.h (module 'core'): ns3::Ptr<const ns3::TraceSourceAccessor> ns3::TypeId::LookupTraceSourceByName(std::string name, ns3::TypeId::TraceSourceInformation * info) const [member function]
cls.add_method('LookupTraceSourceByName',
'ns3::Ptr< ns3::TraceSourceAccessor const >',
[param('std::string', 'name'), param('ns3::TypeId::TraceSourceInformation *', 'info')],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::MustHideFromDocumentation() const [member function]
cls.add_method('MustHideFromDocumentation',
'bool',
[],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::SetAttributeInitialValue(std::size_t i, ns3::Ptr<const ns3::AttributeValue> initialValue) [member function]
cls.add_method('SetAttributeInitialValue',
'bool',
[param('std::size_t', 'i'), param('ns3::Ptr< ns3::AttributeValue const >', 'initialValue')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetGroupName(std::string groupName) [member function]
cls.add_method('SetGroupName',
'ns3::TypeId',
[param('std::string', 'groupName')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetParent(ns3::TypeId tid) [member function]
cls.add_method('SetParent',
'ns3::TypeId',
[param('ns3::TypeId', 'tid')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetParent() [member function]
cls.add_method('SetParent',
'ns3::TypeId',
[],
template_parameters=[u'ns3::Object'])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetSize(std::size_t size) [member function]
cls.add_method('SetSize',
'ns3::TypeId',
[param('std::size_t', 'size')])
## type-id.h (module 'core'): void ns3::TypeId::SetUid(uint16_t uid) [member function]
cls.add_method('SetUid',
'void',
[param('uint16_t', 'uid')])
return
def register_Ns3TypeIdAttributeInformation_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation(ns3::TypeId::AttributeInformation const & arg0) [constructor]
cls.add_constructor([param('ns3::TypeId::AttributeInformation const &', 'arg0')])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::accessor [variable]
cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::AttributeAccessor const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::checker [variable]
cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False)
cls.add_instance_attribute('flags', 'uint32_t', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::help [variable]
cls.add_instance_attribute('help', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::initialValue [variable]
cls.add_instance_attribute('initialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::name [variable]
cls.add_instance_attribute('name', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::originalInitialValue [variable]
cls.add_instance_attribute('originalInitialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::supportLevel [variable]
cls.add_instance_attribute('supportLevel', 'ns3::TypeId::SupportLevel', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::supportMsg [variable]
cls.add_instance_attribute('supportMsg', 'std::string', is_const=False)
return
def register_Ns3TypeIdTraceSourceInformation_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation(ns3::TypeId::TraceSourceInformation const & arg0) [constructor]
cls.add_constructor([param('ns3::TypeId::TraceSourceInformation const &', 'arg0')])
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::accessor [variable]
cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::TraceSourceAccessor const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::callback [variable]
cls.add_instance_attribute('callback', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::help [variable]
cls.add_instance_attribute('help', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::name [variable]
cls.add_instance_attribute('name', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::supportLevel [variable]
cls.add_instance_attribute('supportLevel', 'ns3::TypeId::SupportLevel', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::supportMsg [variable]
cls.add_instance_attribute('supportMsg', 'std::string', is_const=False)
return
def register_Ns3V4PingHelper_methods(root_module, cls):
## v4ping-helper.h (module 'internet-apps'): ns3::V4PingHelper::V4PingHelper(ns3::V4PingHelper const & arg0) [constructor]
cls.add_constructor([param('ns3::V4PingHelper const &', 'arg0')])
## v4ping-helper.h (module 'internet-apps'): ns3::V4PingHelper::V4PingHelper(ns3::Ipv4Address remote) [constructor]
cls.add_constructor([param('ns3::Ipv4Address', 'remote')])
## v4ping-helper.h (module 'internet-apps'): ns3::ApplicationContainer ns3::V4PingHelper::Install(ns3::NodeContainer nodes) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::NodeContainer', 'nodes')],
is_const=True)
## v4ping-helper.h (module 'internet-apps'): ns3::ApplicationContainer ns3::V4PingHelper::Install(ns3::Ptr<ns3::Node> node) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_const=True)
## v4ping-helper.h (module 'internet-apps'): ns3::ApplicationContainer ns3::V4PingHelper::Install(std::string nodeName) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('std::string', 'nodeName')],
is_const=True)
## v4ping-helper.h (module 'internet-apps'): void ns3::V4PingHelper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
return
def register_Ns3Empty_methods(root_module, cls):
## empty.h (module 'core'): ns3::empty::empty() [constructor]
cls.add_constructor([])
## empty.h (module 'core'): ns3::empty::empty(ns3::empty const & arg0) [constructor]
cls.add_constructor([param('ns3::empty const &', 'arg0')])
return
def register_Ns3Int64x64_t_methods(root_module, cls):
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right'))
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<=')
cls.add_binary_comparison_operator('>=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('>')
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', u'right'))
cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', u'right'))
cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', u'right'))
cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', u'right'))
cls.add_unary_numeric_operator('-')
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t() [constructor]
cls.add_constructor([])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(double const value) [constructor]
cls.add_constructor([param('double const', 'value')])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(long double const value) [constructor]
cls.add_constructor([param('long double const', 'value')])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(int const v) [constructor]
cls.add_constructor([param('int const', 'v')])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(long int const v) [constructor]
cls.add_constructor([param('long int const', 'v')])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(long long int const v) [constructor]
cls.add_constructor([param('long long int const', 'v')])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(unsigned int const v) [constructor]
cls.add_constructor([param('unsigned int const', 'v')])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(long unsigned int const v) [constructor]
cls.add_constructor([param('long unsigned int const', 'v')])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(long long unsigned int const v) [constructor]
cls.add_constructor([param('long long unsigned int const', 'v')])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(int64_t const hi, uint64_t const lo) [constructor]
cls.add_constructor([param('int64_t const', 'hi'), param('uint64_t const', 'lo')])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(ns3::int64x64_t const & o) [constructor]
cls.add_constructor([param('ns3::int64x64_t const &', 'o')])
## int64x64-128.h (module 'core'): double ns3::int64x64_t::GetDouble() const [member function]
cls.add_method('GetDouble',
'double',
[],
is_const=True)
## int64x64-128.h (module 'core'): int64_t ns3::int64x64_t::GetHigh() const [member function]
cls.add_method('GetHigh',
'int64_t',
[],
is_const=True)
## int64x64-128.h (module 'core'): uint64_t ns3::int64x64_t::GetLow() const [member function]
cls.add_method('GetLow',
'uint64_t',
[],
is_const=True)
## int64x64-128.h (module 'core'): static ns3::int64x64_t ns3::int64x64_t::Invert(uint64_t const v) [member function]
cls.add_method('Invert',
'ns3::int64x64_t',
[param('uint64_t const', 'v')],
is_static=True)
## int64x64-128.h (module 'core'): void ns3::int64x64_t::MulByInvert(ns3::int64x64_t const & o) [member function]
cls.add_method('MulByInvert',
'void',
[param('ns3::int64x64_t const &', 'o')])
## int64x64-128.h (module 'core'): ns3::int64x64_t::implementation [variable]
cls.add_static_attribute('implementation', 'ns3::int64x64_t::impl_type const', is_const=True)
return
def register_Ns3Chunk_methods(root_module, cls):
## chunk.h (module 'network'): ns3::Chunk::Chunk() [constructor]
cls.add_constructor([])
## chunk.h (module 'network'): ns3::Chunk::Chunk(ns3::Chunk const & arg0) [constructor]
cls.add_constructor([param('ns3::Chunk const &', 'arg0')])
## chunk.h (module 'network'): uint32_t ns3::Chunk::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_pure_virtual=True, is_virtual=True)
## chunk.h (module 'network'): uint32_t ns3::Chunk::Deserialize(ns3::Buffer::Iterator start, ns3::Buffer::Iterator end) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start'), param('ns3::Buffer::Iterator', 'end')],
is_virtual=True)
## chunk.h (module 'network'): static ns3::TypeId ns3::Chunk::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## chunk.h (module 'network'): void ns3::Chunk::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3Header_methods(root_module, cls):
cls.add_output_stream_operator()
## header.h (module 'network'): ns3::Header::Header() [constructor]
cls.add_constructor([])
## header.h (module 'network'): ns3::Header::Header(ns3::Header const & arg0) [constructor]
cls.add_constructor([param('ns3::Header const &', 'arg0')])
## header.h (module 'network'): uint32_t ns3::Header::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_pure_virtual=True, is_virtual=True)
## header.h (module 'network'): uint32_t ns3::Header::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## header.h (module 'network'): static ns3::TypeId ns3::Header::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## header.h (module 'network'): void ns3::Header::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## header.h (module 'network'): void ns3::Header::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3Object_methods(root_module, cls):
## object.h (module 'core'): ns3::Object::Object() [constructor]
cls.add_constructor([])
## object.h (module 'core'): void ns3::Object::AggregateObject(ns3::Ptr<ns3::Object> other) [member function]
cls.add_method('AggregateObject',
'void',
[param('ns3::Ptr< ns3::Object >', 'other')])
## object.h (module 'core'): void ns3::Object::Dispose() [member function]
cls.add_method('Dispose',
'void',
[])
## object.h (module 'core'): ns3::Object::AggregateIterator ns3::Object::GetAggregateIterator() const [member function]
cls.add_method('GetAggregateIterator',
'ns3::Object::AggregateIterator',
[],
is_const=True)
## object.h (module 'core'): ns3::TypeId ns3::Object::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## object.h (module 'core'): static ns3::TypeId ns3::Object::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## object.h (module 'core'): void ns3::Object::Initialize() [member function]
cls.add_method('Initialize',
'void',
[])
## object.h (module 'core'): bool ns3::Object::IsInitialized() const [member function]
cls.add_method('IsInitialized',
'bool',
[],
is_const=True)
## object.h (module 'core'): ns3::Object::Object(ns3::Object const & o) [constructor]
cls.add_constructor([param('ns3::Object const &', 'o')],
visibility='protected')
## object.h (module 'core'): void ns3::Object::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## object.h (module 'core'): void ns3::Object::DoInitialize() [member function]
cls.add_method('DoInitialize',
'void',
[],
visibility='protected', is_virtual=True)
## object.h (module 'core'): void ns3::Object::NotifyNewAggregate() [member function]
cls.add_method('NotifyNewAggregate',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3ObjectAggregateIterator_methods(root_module, cls):
## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator(ns3::Object::AggregateIterator const & arg0) [constructor]
cls.add_constructor([param('ns3::Object::AggregateIterator const &', 'arg0')])
## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator() [constructor]
cls.add_constructor([])
## object.h (module 'core'): bool ns3::Object::AggregateIterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## object.h (module 'core'): ns3::Ptr<const ns3::Object> ns3::Object::AggregateIterator::Next() [member function]
cls.add_method('Next',
'ns3::Ptr< ns3::Object const >',
[])
return
def register_Ns3RandomVariableStream_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::RandomVariableStream::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::RandomVariableStream::RandomVariableStream() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): void ns3::RandomVariableStream::SetStream(int64_t stream) [member function]
cls.add_method('SetStream',
'void',
[param('int64_t', 'stream')])
## random-variable-stream.h (module 'core'): int64_t ns3::RandomVariableStream::GetStream() const [member function]
cls.add_method('GetStream',
'int64_t',
[],
is_const=True)
## random-variable-stream.h (module 'core'): void ns3::RandomVariableStream::SetAntithetic(bool isAntithetic) [member function]
cls.add_method('SetAntithetic',
'void',
[param('bool', 'isAntithetic')])
## random-variable-stream.h (module 'core'): bool ns3::RandomVariableStream::IsAntithetic() const [member function]
cls.add_method('IsAntithetic',
'bool',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::RandomVariableStream::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_pure_virtual=True, is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::RandomVariableStream::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_pure_virtual=True, is_virtual=True)
## random-variable-stream.h (module 'core'): ns3::RngStream * ns3::RandomVariableStream::Peek() const [member function]
cls.add_method('Peek',
'ns3::RngStream *',
[],
is_const=True, visibility='protected')
return
def register_Ns3SequentialRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::SequentialRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::SequentialRandomVariable::SequentialRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::SequentialRandomVariable::GetMin() const [member function]
cls.add_method('GetMin',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::SequentialRandomVariable::GetMax() const [member function]
cls.add_method('GetMax',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): ns3::Ptr<ns3::RandomVariableStream> ns3::SequentialRandomVariable::GetIncrement() const [member function]
cls.add_method('GetIncrement',
'ns3::Ptr< ns3::RandomVariableStream >',
[],
is_const=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::SequentialRandomVariable::GetConsecutive() const [member function]
cls.add_method('GetConsecutive',
'uint32_t',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::SequentialRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::SequentialRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter< ns3::AttributeAccessor > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter< ns3::AttributeChecker > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter< ns3::AttributeValue > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount(ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter< ns3::CallbackImplBase > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::SimpleRefCount(ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter< ns3::EventImpl > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3HashImplementation_Ns3Empty_Ns3DefaultDeleter__lt__ns3HashImplementation__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> >::SimpleRefCount(ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter< ns3::Hash::Implementation > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3Ipv4MulticastRoute_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4MulticastRoute__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> >::SimpleRefCount(ns3::SimpleRefCount<ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter< ns3::Ipv4MulticastRoute > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3Ipv4Route_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4Route__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> >::SimpleRefCount(ns3::SimpleRefCount<ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter< ns3::Ipv4Route > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount(ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter< ns3::NixVector > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::SimpleRefCount(ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter< ns3::Packet > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3RadvdInterface_Ns3Empty_Ns3DefaultDeleter__lt__ns3RadvdInterface__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::RadvdInterface, ns3::empty, ns3::DefaultDeleter<ns3::RadvdInterface> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::RadvdInterface, ns3::empty, ns3::DefaultDeleter<ns3::RadvdInterface> >::SimpleRefCount(ns3::SimpleRefCount<ns3::RadvdInterface, ns3::empty, ns3::DefaultDeleter<ns3::RadvdInterface> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::RadvdInterface, ns3::empty, ns3::DefaultDeleter< ns3::RadvdInterface > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3RadvdPrefix_Ns3Empty_Ns3DefaultDeleter__lt__ns3RadvdPrefix__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::RadvdPrefix, ns3::empty, ns3::DefaultDeleter<ns3::RadvdPrefix> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::RadvdPrefix, ns3::empty, ns3::DefaultDeleter<ns3::RadvdPrefix> >::SimpleRefCount(ns3::SimpleRefCount<ns3::RadvdPrefix, ns3::empty, ns3::DefaultDeleter<ns3::RadvdPrefix> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::RadvdPrefix, ns3::empty, ns3::DefaultDeleter< ns3::RadvdPrefix > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter< ns3::TraceSourceAccessor > > const &', 'o')])
return
def register_Ns3Socket_methods(root_module, cls):
## socket.h (module 'network'): ns3::Socket::Socket(ns3::Socket const & arg0) [constructor]
cls.add_constructor([param('ns3::Socket const &', 'arg0')])
## socket.h (module 'network'): ns3::Socket::Socket() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): int ns3::Socket::Bind(ns3::Address const & address) [member function]
cls.add_method('Bind',
'int',
[param('ns3::Address const &', 'address')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Bind() [member function]
cls.add_method('Bind',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Bind6() [member function]
cls.add_method('Bind6',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::BindToNetDevice(ns3::Ptr<ns3::NetDevice> netdevice) [member function]
cls.add_method('BindToNetDevice',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'netdevice')],
is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Close() [member function]
cls.add_method('Close',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Connect(ns3::Address const & address) [member function]
cls.add_method('Connect',
'int',
[param('ns3::Address const &', 'address')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): static ns3::Ptr<ns3::Socket> ns3::Socket::CreateSocket(ns3::Ptr<ns3::Node> node, ns3::TypeId tid) [member function]
cls.add_method('CreateSocket',
'ns3::Ptr< ns3::Socket >',
[param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::TypeId', 'tid')],
is_static=True)
## socket.h (module 'network'): bool ns3::Socket::GetAllowBroadcast() const [member function]
cls.add_method('GetAllowBroadcast',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::Socket::GetBoundNetDevice() [member function]
cls.add_method('GetBoundNetDevice',
'ns3::Ptr< ns3::NetDevice >',
[])
## socket.h (module 'network'): ns3::Socket::SocketErrno ns3::Socket::GetErrno() const [member function]
cls.add_method('GetErrno',
'ns3::Socket::SocketErrno',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::Socket::GetIpTos() const [member function]
cls.add_method('GetIpTos',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): uint8_t ns3::Socket::GetIpTtl() const [member function]
cls.add_method('GetIpTtl',
'uint8_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::Socket::GetIpv6HopLimit() const [member function]
cls.add_method('GetIpv6HopLimit',
'uint8_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::Socket::GetIpv6Tclass() const [member function]
cls.add_method('GetIpv6Tclass',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Node> ns3::Socket::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::GetPeerName(ns3::Address & address) const [member function]
cls.add_method('GetPeerName',
'int',
[param('ns3::Address &', 'address')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::Socket::GetPriority() const [member function]
cls.add_method('GetPriority',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): uint32_t ns3::Socket::GetRxAvailable() const [member function]
cls.add_method('GetRxAvailable',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::GetSockName(ns3::Address & address) const [member function]
cls.add_method('GetSockName',
'int',
[param('ns3::Address &', 'address')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): ns3::Socket::SocketType ns3::Socket::GetSocketType() const [member function]
cls.add_method('GetSocketType',
'ns3::Socket::SocketType',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::Socket::GetTxAvailable() const [member function]
cls.add_method('GetTxAvailable',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): static ns3::TypeId ns3::Socket::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): static uint8_t ns3::Socket::IpTos2Priority(uint8_t ipTos) [member function]
cls.add_method('IpTos2Priority',
'uint8_t',
[param('uint8_t', 'ipTos')],
is_static=True)
## socket.h (module 'network'): void ns3::Socket::Ipv6JoinGroup(ns3::Ipv6Address address, ns3::Socket::Ipv6MulticastFilterMode filterMode, std::vector<ns3::Ipv6Address, std::allocator<ns3::Ipv6Address> > sourceAddresses) [member function]
cls.add_method('Ipv6JoinGroup',
'void',
[param('ns3::Ipv6Address', 'address'), param('ns3::Socket::Ipv6MulticastFilterMode', 'filterMode'), param('std::vector< ns3::Ipv6Address >', 'sourceAddresses')],
is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::Ipv6JoinGroup(ns3::Ipv6Address address) [member function]
cls.add_method('Ipv6JoinGroup',
'void',
[param('ns3::Ipv6Address', 'address')],
is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::Ipv6LeaveGroup() [member function]
cls.add_method('Ipv6LeaveGroup',
'void',
[],
is_virtual=True)
## socket.h (module 'network'): bool ns3::Socket::IsIpRecvTos() const [member function]
cls.add_method('IsIpRecvTos',
'bool',
[],
is_const=True)
## socket.h (module 'network'): bool ns3::Socket::IsIpRecvTtl() const [member function]
cls.add_method('IsIpRecvTtl',
'bool',
[],
is_const=True)
## socket.h (module 'network'): bool ns3::Socket::IsIpv6RecvHopLimit() const [member function]
cls.add_method('IsIpv6RecvHopLimit',
'bool',
[],
is_const=True)
## socket.h (module 'network'): bool ns3::Socket::IsIpv6RecvTclass() const [member function]
cls.add_method('IsIpv6RecvTclass',
'bool',
[],
is_const=True)
## socket.h (module 'network'): bool ns3::Socket::IsRecvPktInfo() const [member function]
cls.add_method('IsRecvPktInfo',
'bool',
[],
is_const=True)
## socket.h (module 'network'): int ns3::Socket::Listen() [member function]
cls.add_method('Listen',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::Recv(uint32_t maxSize, uint32_t flags) [member function]
cls.add_method('Recv',
'ns3::Ptr< ns3::Packet >',
[param('uint32_t', 'maxSize'), param('uint32_t', 'flags')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::Recv() [member function]
cls.add_method('Recv',
'ns3::Ptr< ns3::Packet >',
[])
## socket.h (module 'network'): int ns3::Socket::Recv(uint8_t * buf, uint32_t size, uint32_t flags) [member function]
cls.add_method('Recv',
'int',
[param('uint8_t *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags')])
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::RecvFrom(uint32_t maxSize, uint32_t flags, ns3::Address & fromAddress) [member function]
cls.add_method('RecvFrom',
'ns3::Ptr< ns3::Packet >',
[param('uint32_t', 'maxSize'), param('uint32_t', 'flags'), param('ns3::Address &', 'fromAddress')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::RecvFrom(ns3::Address & fromAddress) [member function]
cls.add_method('RecvFrom',
'ns3::Ptr< ns3::Packet >',
[param('ns3::Address &', 'fromAddress')])
## socket.h (module 'network'): int ns3::Socket::RecvFrom(uint8_t * buf, uint32_t size, uint32_t flags, ns3::Address & fromAddress) [member function]
cls.add_method('RecvFrom',
'int',
[param('uint8_t *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags'), param('ns3::Address &', 'fromAddress')])
## socket.h (module 'network'): int ns3::Socket::Send(ns3::Ptr<ns3::Packet> p, uint32_t flags) [member function]
cls.add_method('Send',
'int',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('uint32_t', 'flags')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Send(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('Send',
'int',
[param('ns3::Ptr< ns3::Packet >', 'p')])
## socket.h (module 'network'): int ns3::Socket::Send(uint8_t const * buf, uint32_t size, uint32_t flags) [member function]
cls.add_method('Send',
'int',
[param('uint8_t const *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags')])
## socket.h (module 'network'): int ns3::Socket::SendTo(ns3::Ptr<ns3::Packet> p, uint32_t flags, ns3::Address const & toAddress) [member function]
cls.add_method('SendTo',
'int',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('uint32_t', 'flags'), param('ns3::Address const &', 'toAddress')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::SendTo(uint8_t const * buf, uint32_t size, uint32_t flags, ns3::Address const & address) [member function]
cls.add_method('SendTo',
'int',
[param('uint8_t const *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags'), param('ns3::Address const &', 'address')])
## socket.h (module 'network'): void ns3::Socket::SetAcceptCallback(ns3::Callback<bool, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> connectionRequest, ns3::Callback<void, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> newConnectionCreated) [member function]
cls.add_method('SetAcceptCallback',
'void',
[param('ns3::Callback< bool, ns3::Ptr< ns3::Socket >, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'connectionRequest'), param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'newConnectionCreated')])
## socket.h (module 'network'): bool ns3::Socket::SetAllowBroadcast(bool allowBroadcast) [member function]
cls.add_method('SetAllowBroadcast',
'bool',
[param('bool', 'allowBroadcast')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::SetCloseCallbacks(ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> normalClose, ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> errorClose) [member function]
cls.add_method('SetCloseCallbacks',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'normalClose'), param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'errorClose')])
## socket.h (module 'network'): void ns3::Socket::SetConnectCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> connectionSucceeded, ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> connectionFailed) [member function]
cls.add_method('SetConnectCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'connectionSucceeded'), param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'connectionFailed')])
## socket.h (module 'network'): void ns3::Socket::SetDataSentCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> dataSent) [member function]
cls.add_method('SetDataSentCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'dataSent')])
## socket.h (module 'network'): void ns3::Socket::SetIpRecvTos(bool ipv4RecvTos) [member function]
cls.add_method('SetIpRecvTos',
'void',
[param('bool', 'ipv4RecvTos')])
## socket.h (module 'network'): void ns3::Socket::SetIpRecvTtl(bool ipv4RecvTtl) [member function]
cls.add_method('SetIpRecvTtl',
'void',
[param('bool', 'ipv4RecvTtl')])
## socket.h (module 'network'): void ns3::Socket::SetIpTos(uint8_t ipTos) [member function]
cls.add_method('SetIpTos',
'void',
[param('uint8_t', 'ipTos')])
## socket.h (module 'network'): void ns3::Socket::SetIpTtl(uint8_t ipTtl) [member function]
cls.add_method('SetIpTtl',
'void',
[param('uint8_t', 'ipTtl')],
is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::SetIpv6HopLimit(uint8_t ipHopLimit) [member function]
cls.add_method('SetIpv6HopLimit',
'void',
[param('uint8_t', 'ipHopLimit')],
is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::SetIpv6RecvHopLimit(bool ipv6RecvHopLimit) [member function]
cls.add_method('SetIpv6RecvHopLimit',
'void',
[param('bool', 'ipv6RecvHopLimit')])
## socket.h (module 'network'): void ns3::Socket::SetIpv6RecvTclass(bool ipv6RecvTclass) [member function]
cls.add_method('SetIpv6RecvTclass',
'void',
[param('bool', 'ipv6RecvTclass')])
## socket.h (module 'network'): void ns3::Socket::SetIpv6Tclass(int ipTclass) [member function]
cls.add_method('SetIpv6Tclass',
'void',
[param('int', 'ipTclass')])
## socket.h (module 'network'): void ns3::Socket::SetPriority(uint8_t priority) [member function]
cls.add_method('SetPriority',
'void',
[param('uint8_t', 'priority')])
## socket.h (module 'network'): void ns3::Socket::SetRecvCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> arg0) [member function]
cls.add_method('SetRecvCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'arg0')])
## socket.h (module 'network'): void ns3::Socket::SetRecvPktInfo(bool flag) [member function]
cls.add_method('SetRecvPktInfo',
'void',
[param('bool', 'flag')])
## socket.h (module 'network'): void ns3::Socket::SetSendCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> sendCb) [member function]
cls.add_method('SetSendCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'sendCb')])
## socket.h (module 'network'): int ns3::Socket::ShutdownRecv() [member function]
cls.add_method('ShutdownRecv',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::ShutdownSend() [member function]
cls.add_method('ShutdownSend',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## socket.h (module 'network'): bool ns3::Socket::IsManualIpTtl() const [member function]
cls.add_method('IsManualIpTtl',
'bool',
[],
is_const=True, visibility='protected')
## socket.h (module 'network'): bool ns3::Socket::IsManualIpv6HopLimit() const [member function]
cls.add_method('IsManualIpv6HopLimit',
'bool',
[],
is_const=True, visibility='protected')
## socket.h (module 'network'): bool ns3::Socket::IsManualIpv6Tclass() const [member function]
cls.add_method('IsManualIpv6Tclass',
'bool',
[],
is_const=True, visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyConnectionFailed() [member function]
cls.add_method('NotifyConnectionFailed',
'void',
[],
visibility='protected')
## socket.h (module 'network'): bool ns3::Socket::NotifyConnectionRequest(ns3::Address const & from) [member function]
cls.add_method('NotifyConnectionRequest',
'bool',
[param('ns3::Address const &', 'from')],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyConnectionSucceeded() [member function]
cls.add_method('NotifyConnectionSucceeded',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyDataRecv() [member function]
cls.add_method('NotifyDataRecv',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyDataSent(uint32_t size) [member function]
cls.add_method('NotifyDataSent',
'void',
[param('uint32_t', 'size')],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyErrorClose() [member function]
cls.add_method('NotifyErrorClose',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyNewConnectionCreated(ns3::Ptr<ns3::Socket> socket, ns3::Address const & from) [member function]
cls.add_method('NotifyNewConnectionCreated',
'void',
[param('ns3::Ptr< ns3::Socket >', 'socket'), param('ns3::Address const &', 'from')],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyNormalClose() [member function]
cls.add_method('NotifyNormalClose',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifySend(uint32_t spaceAvailable) [member function]
cls.add_method('NotifySend',
'void',
[param('uint32_t', 'spaceAvailable')],
visibility='protected')
return
def register_Ns3SocketIpTosTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketIpTosTag::SocketIpTosTag(ns3::SocketIpTosTag const & arg0) [constructor]
cls.add_constructor([param('ns3::SocketIpTosTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketIpTosTag::SocketIpTosTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketIpTosTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): ns3::TypeId ns3::SocketIpTosTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketIpTosTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::SocketIpTosTag::GetTos() const [member function]
cls.add_method('GetTos',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketIpTosTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): void ns3::SocketIpTosTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpTosTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpTosTag::SetTos(uint8_t tos) [member function]
cls.add_method('SetTos',
'void',
[param('uint8_t', 'tos')])
return
def register_Ns3SocketIpTtlTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketIpTtlTag::SocketIpTtlTag(ns3::SocketIpTtlTag const & arg0) [constructor]
cls.add_constructor([param('ns3::SocketIpTtlTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketIpTtlTag::SocketIpTtlTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketIpTtlTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): ns3::TypeId ns3::SocketIpTtlTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketIpTtlTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::SocketIpTtlTag::GetTtl() const [member function]
cls.add_method('GetTtl',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketIpTtlTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): void ns3::SocketIpTtlTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpTtlTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpTtlTag::SetTtl(uint8_t ttl) [member function]
cls.add_method('SetTtl',
'void',
[param('uint8_t', 'ttl')])
return
def register_Ns3SocketIpv6HopLimitTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketIpv6HopLimitTag::SocketIpv6HopLimitTag(ns3::SocketIpv6HopLimitTag const & arg0) [constructor]
cls.add_constructor([param('ns3::SocketIpv6HopLimitTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketIpv6HopLimitTag::SocketIpv6HopLimitTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketIpv6HopLimitTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::SocketIpv6HopLimitTag::GetHopLimit() const [member function]
cls.add_method('GetHopLimit',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): ns3::TypeId ns3::SocketIpv6HopLimitTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketIpv6HopLimitTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketIpv6HopLimitTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): void ns3::SocketIpv6HopLimitTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpv6HopLimitTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpv6HopLimitTag::SetHopLimit(uint8_t hopLimit) [member function]
cls.add_method('SetHopLimit',
'void',
[param('uint8_t', 'hopLimit')])
return
def register_Ns3SocketIpv6TclassTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketIpv6TclassTag::SocketIpv6TclassTag(ns3::SocketIpv6TclassTag const & arg0) [constructor]
cls.add_constructor([param('ns3::SocketIpv6TclassTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketIpv6TclassTag::SocketIpv6TclassTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketIpv6TclassTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): ns3::TypeId ns3::SocketIpv6TclassTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketIpv6TclassTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::SocketIpv6TclassTag::GetTclass() const [member function]
cls.add_method('GetTclass',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketIpv6TclassTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): void ns3::SocketIpv6TclassTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpv6TclassTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpv6TclassTag::SetTclass(uint8_t tclass) [member function]
cls.add_method('SetTclass',
'void',
[param('uint8_t', 'tclass')])
return
def register_Ns3SocketPriorityTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketPriorityTag::SocketPriorityTag(ns3::SocketPriorityTag const & arg0) [constructor]
cls.add_constructor([param('ns3::SocketPriorityTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketPriorityTag::SocketPriorityTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketPriorityTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): ns3::TypeId ns3::SocketPriorityTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::SocketPriorityTag::GetPriority() const [member function]
cls.add_method('GetPriority',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): uint32_t ns3::SocketPriorityTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketPriorityTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): void ns3::SocketPriorityTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketPriorityTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketPriorityTag::SetPriority(uint8_t priority) [member function]
cls.add_method('SetPriority',
'void',
[param('uint8_t', 'priority')])
return
def register_Ns3SocketSetDontFragmentTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketSetDontFragmentTag::SocketSetDontFragmentTag(ns3::SocketSetDontFragmentTag const & arg0) [constructor]
cls.add_constructor([param('ns3::SocketSetDontFragmentTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketSetDontFragmentTag::SocketSetDontFragmentTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Disable() [member function]
cls.add_method('Disable',
'void',
[])
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Enable() [member function]
cls.add_method('Enable',
'void',
[])
## socket.h (module 'network'): ns3::TypeId ns3::SocketSetDontFragmentTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketSetDontFragmentTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketSetDontFragmentTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): bool ns3::SocketSetDontFragmentTag::IsEnabled() const [member function]
cls.add_method('IsEnabled',
'bool',
[],
is_const=True)
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
return
def register_Ns3Time_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<=')
cls.add_binary_comparison_operator('>=')
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('>')
cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', u'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', u'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::Time'], param('int64_t const &', u'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::Time'], root_module['ns3::Time'], param('int64_t const &', u'right'))
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', u'right'))
cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', u'right'))
cls.add_output_stream_operator()
## nstime.h (module 'core'): ns3::Time::Time() [constructor]
cls.add_constructor([])
## nstime.h (module 'core'): ns3::Time::Time(ns3::Time const & o) [constructor]
cls.add_constructor([param('ns3::Time const &', 'o')])
## nstime.h (module 'core'): ns3::Time::Time(double v) [constructor]
cls.add_constructor([param('double', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(int v) [constructor]
cls.add_constructor([param('int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(long int v) [constructor]
cls.add_constructor([param('long int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(long long int v) [constructor]
cls.add_constructor([param('long long int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(unsigned int v) [constructor]
cls.add_constructor([param('unsigned int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(long unsigned int v) [constructor]
cls.add_constructor([param('long unsigned int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(long long unsigned int v) [constructor]
cls.add_constructor([param('long long unsigned int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(ns3::int64x64_t const & v) [constructor]
cls.add_constructor([param('ns3::int64x64_t const &', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(std::string const & s) [constructor]
cls.add_constructor([param('std::string const &', 's')])
## nstime.h (module 'core'): ns3::TimeWithUnit ns3::Time::As(ns3::Time::Unit const unit) const [member function]
cls.add_method('As',
'ns3::TimeWithUnit',
[param('ns3::Time::Unit const', 'unit')],
is_const=True)
## nstime.h (module 'core'): int ns3::Time::Compare(ns3::Time const & o) const [member function]
cls.add_method('Compare',
'int',
[param('ns3::Time const &', 'o')],
is_const=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::From(ns3::int64x64_t const & value) [member function]
cls.add_method('From',
'ns3::Time',
[param('ns3::int64x64_t const &', 'value')],
is_static=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::From(ns3::int64x64_t const & value, ns3::Time::Unit unit) [member function]
cls.add_method('From',
'ns3::Time',
[param('ns3::int64x64_t const &', 'value'), param('ns3::Time::Unit', 'unit')],
is_static=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::FromDouble(double value, ns3::Time::Unit unit) [member function]
cls.add_method('FromDouble',
'ns3::Time',
[param('double', 'value'), param('ns3::Time::Unit', 'unit')],
is_static=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::FromInteger(uint64_t value, ns3::Time::Unit unit) [member function]
cls.add_method('FromInteger',
'ns3::Time',
[param('uint64_t', 'value'), param('ns3::Time::Unit', 'unit')],
is_static=True)
## nstime.h (module 'core'): double ns3::Time::GetDays() const [member function]
cls.add_method('GetDays',
'double',
[],
is_const=True)
## nstime.h (module 'core'): double ns3::Time::GetDouble() const [member function]
cls.add_method('GetDouble',
'double',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetFemtoSeconds() const [member function]
cls.add_method('GetFemtoSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): double ns3::Time::GetHours() const [member function]
cls.add_method('GetHours',
'double',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetInteger() const [member function]
cls.add_method('GetInteger',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetMicroSeconds() const [member function]
cls.add_method('GetMicroSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetMilliSeconds() const [member function]
cls.add_method('GetMilliSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): double ns3::Time::GetMinutes() const [member function]
cls.add_method('GetMinutes',
'double',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetNanoSeconds() const [member function]
cls.add_method('GetNanoSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetPicoSeconds() const [member function]
cls.add_method('GetPicoSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): static ns3::Time::Unit ns3::Time::GetResolution() [member function]
cls.add_method('GetResolution',
'ns3::Time::Unit',
[],
is_static=True)
## nstime.h (module 'core'): double ns3::Time::GetSeconds() const [member function]
cls.add_method('GetSeconds',
'double',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetTimeStep() const [member function]
cls.add_method('GetTimeStep',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): double ns3::Time::GetYears() const [member function]
cls.add_method('GetYears',
'double',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsNegative() const [member function]
cls.add_method('IsNegative',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsPositive() const [member function]
cls.add_method('IsPositive',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsStrictlyNegative() const [member function]
cls.add_method('IsStrictlyNegative',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsStrictlyPositive() const [member function]
cls.add_method('IsStrictlyPositive',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsZero() const [member function]
cls.add_method('IsZero',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::Max() [member function]
cls.add_method('Max',
'ns3::Time',
[],
is_static=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::Min() [member function]
cls.add_method('Min',
'ns3::Time',
[],
is_static=True)
## nstime.h (module 'core'): static void ns3::Time::SetResolution(ns3::Time::Unit resolution) [member function]
cls.add_method('SetResolution',
'void',
[param('ns3::Time::Unit', 'resolution')],
is_static=True)
## nstime.h (module 'core'): static bool ns3::Time::StaticInit() [member function]
cls.add_method('StaticInit',
'bool',
[],
is_static=True)
## nstime.h (module 'core'): ns3::int64x64_t ns3::Time::To(ns3::Time::Unit unit) const [member function]
cls.add_method('To',
'ns3::int64x64_t',
[param('ns3::Time::Unit', 'unit')],
is_const=True)
## nstime.h (module 'core'): double ns3::Time::ToDouble(ns3::Time::Unit unit) const [member function]
cls.add_method('ToDouble',
'double',
[param('ns3::Time::Unit', 'unit')],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::ToInteger(ns3::Time::Unit unit) const [member function]
cls.add_method('ToInteger',
'int64_t',
[param('ns3::Time::Unit', 'unit')],
is_const=True)
return
def register_Ns3TraceSourceAccessor_methods(root_module, cls):
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor(ns3::TraceSourceAccessor const & arg0) [constructor]
cls.add_constructor([param('ns3::TraceSourceAccessor const &', 'arg0')])
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor() [constructor]
cls.add_constructor([])
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Connect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function]
cls.add_method('Connect',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::ConnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function]
cls.add_method('ConnectWithoutContext',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Disconnect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function]
cls.add_method('Disconnect',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::DisconnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function]
cls.add_method('DisconnectWithoutContext',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3Trailer_methods(root_module, cls):
cls.add_output_stream_operator()
## trailer.h (module 'network'): ns3::Trailer::Trailer() [constructor]
cls.add_constructor([])
## trailer.h (module 'network'): ns3::Trailer::Trailer(ns3::Trailer const & arg0) [constructor]
cls.add_constructor([param('ns3::Trailer const &', 'arg0')])
## trailer.h (module 'network'): uint32_t ns3::Trailer::Deserialize(ns3::Buffer::Iterator end) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'end')],
is_pure_virtual=True, is_virtual=True)
## trailer.h (module 'network'): uint32_t ns3::Trailer::Deserialize(ns3::Buffer::Iterator start, ns3::Buffer::Iterator end) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start'), param('ns3::Buffer::Iterator', 'end')],
is_virtual=True)
## trailer.h (module 'network'): uint32_t ns3::Trailer::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trailer.h (module 'network'): static ns3::TypeId ns3::Trailer::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## trailer.h (module 'network'): void ns3::Trailer::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trailer.h (module 'network'): void ns3::Trailer::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3TriangularRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::TriangularRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::TriangularRandomVariable::TriangularRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetMean() const [member function]
cls.add_method('GetMean',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetMin() const [member function]
cls.add_method('GetMin',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetMax() const [member function]
cls.add_method('GetMax',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetValue(double mean, double min, double max) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'mean'), param('double', 'min'), param('double', 'max')])
## random-variable-stream.h (module 'core'): uint32_t ns3::TriangularRandomVariable::GetInteger(uint32_t mean, uint32_t min, uint32_t max) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'mean'), param('uint32_t', 'min'), param('uint32_t', 'max')])
## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::TriangularRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3UniformRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::UniformRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::UniformRandomVariable::UniformRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::UniformRandomVariable::GetMin() const [member function]
cls.add_method('GetMin',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::UniformRandomVariable::GetMax() const [member function]
cls.add_method('GetMax',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::UniformRandomVariable::GetValue(double min, double max) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'min'), param('double', 'max')])
## random-variable-stream.h (module 'core'): uint32_t ns3::UniformRandomVariable::GetInteger(uint32_t min, uint32_t max) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'min'), param('uint32_t', 'max')])
## random-variable-stream.h (module 'core'): double ns3::UniformRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::UniformRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3WeibullRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::WeibullRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::WeibullRandomVariable::WeibullRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetScale() const [member function]
cls.add_method('GetScale',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetShape() const [member function]
cls.add_method('GetShape',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetBound() const [member function]
cls.add_method('GetBound',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetValue(double scale, double shape, double bound) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'scale'), param('double', 'shape'), param('double', 'bound')])
## random-variable-stream.h (module 'core'): uint32_t ns3::WeibullRandomVariable::GetInteger(uint32_t scale, uint32_t shape, uint32_t bound) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'scale'), param('uint32_t', 'shape'), param('uint32_t', 'bound')])
## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::WeibullRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3ZetaRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ZetaRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::ZetaRandomVariable::ZetaRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::ZetaRandomVariable::GetAlpha() const [member function]
cls.add_method('GetAlpha',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ZetaRandomVariable::GetValue(double alpha) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'alpha')])
## random-variable-stream.h (module 'core'): uint32_t ns3::ZetaRandomVariable::GetInteger(uint32_t alpha) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'alpha')])
## random-variable-stream.h (module 'core'): double ns3::ZetaRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::ZetaRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3ZipfRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ZipfRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::ZipfRandomVariable::ZipfRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): uint32_t ns3::ZipfRandomVariable::GetN() const [member function]
cls.add_method('GetN',
'uint32_t',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ZipfRandomVariable::GetAlpha() const [member function]
cls.add_method('GetAlpha',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ZipfRandomVariable::GetValue(uint32_t n, double alpha) [member function]
cls.add_method('GetValue',
'double',
[param('uint32_t', 'n'), param('double', 'alpha')])
## random-variable-stream.h (module 'core'): uint32_t ns3::ZipfRandomVariable::GetInteger(uint32_t n, uint32_t alpha) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'n'), param('uint32_t', 'alpha')])
## random-variable-stream.h (module 'core'): double ns3::ZipfRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::ZipfRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3Application_methods(root_module, cls):
## application.h (module 'network'): ns3::Application::Application(ns3::Application const & arg0) [constructor]
cls.add_constructor([param('ns3::Application const &', 'arg0')])
## application.h (module 'network'): ns3::Application::Application() [constructor]
cls.add_constructor([])
## application.h (module 'network'): ns3::Ptr<ns3::Node> ns3::Application::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_const=True)
## application.h (module 'network'): static ns3::TypeId ns3::Application::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## application.h (module 'network'): void ns3::Application::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')])
## application.h (module 'network'): void ns3::Application::SetStartTime(ns3::Time start) [member function]
cls.add_method('SetStartTime',
'void',
[param('ns3::Time', 'start')])
## application.h (module 'network'): void ns3::Application::SetStopTime(ns3::Time stop) [member function]
cls.add_method('SetStopTime',
'void',
[param('ns3::Time', 'stop')])
## application.h (module 'network'): void ns3::Application::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## application.h (module 'network'): void ns3::Application::DoInitialize() [member function]
cls.add_method('DoInitialize',
'void',
[],
visibility='protected', is_virtual=True)
## application.h (module 'network'): void ns3::Application::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## application.h (module 'network'): void ns3::Application::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3AttributeAccessor_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor(ns3::AttributeAccessor const & arg0) [constructor]
cls.add_constructor([param('ns3::AttributeAccessor const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): bool ns3::AttributeAccessor::Get(ns3::ObjectBase const * object, ns3::AttributeValue & attribute) const [member function]
cls.add_method('Get',
'bool',
[param('ns3::ObjectBase const *', 'object'), param('ns3::AttributeValue &', 'attribute')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasGetter() const [member function]
cls.add_method('HasGetter',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasSetter() const [member function]
cls.add_method('HasSetter',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::Set(ns3::ObjectBase * object, ns3::AttributeValue const & value) const [member function]
cls.add_method('Set',
'bool',
[param('ns3::ObjectBase *', 'object', transfer_ownership=False), param('ns3::AttributeValue const &', 'value')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3AttributeChecker_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker(ns3::AttributeChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::AttributeChecker const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): bool ns3::AttributeChecker::Check(ns3::AttributeValue const & value) const [member function]
cls.add_method('Check',
'bool',
[param('ns3::AttributeValue const &', 'value')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeChecker::Copy(ns3::AttributeValue const & source, ns3::AttributeValue & destination) const [member function]
cls.add_method('Copy',
'bool',
[param('ns3::AttributeValue const &', 'source'), param('ns3::AttributeValue &', 'destination')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::Create() const [member function]
cls.add_method('Create',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::CreateValidValue(ns3::AttributeValue const & value) const [member function]
cls.add_method('CreateValidValue',
'ns3::Ptr< ns3::AttributeValue >',
[param('ns3::AttributeValue const &', 'value')],
is_const=True)
## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetUnderlyingTypeInformation() const [member function]
cls.add_method('GetUnderlyingTypeInformation',
'std::string',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetValueTypeName() const [member function]
cls.add_method('GetValueTypeName',
'std::string',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeChecker::HasUnderlyingTypeInformation() const [member function]
cls.add_method('HasUnderlyingTypeInformation',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3AttributeValue_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue(ns3::AttributeValue const & arg0) [constructor]
cls.add_constructor([param('ns3::AttributeValue const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_pure_virtual=True, is_virtual=True)
## attribute.h (module 'core'): std::string ns3::AttributeValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3BooleanChecker_methods(root_module, cls):
## boolean.h (module 'core'): ns3::BooleanChecker::BooleanChecker() [constructor]
cls.add_constructor([])
## boolean.h (module 'core'): ns3::BooleanChecker::BooleanChecker(ns3::BooleanChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::BooleanChecker const &', 'arg0')])
return
def register_Ns3BooleanValue_methods(root_module, cls):
cls.add_output_stream_operator()
## boolean.h (module 'core'): ns3::BooleanValue::BooleanValue(ns3::BooleanValue const & arg0) [constructor]
cls.add_constructor([param('ns3::BooleanValue const &', 'arg0')])
## boolean.h (module 'core'): ns3::BooleanValue::BooleanValue() [constructor]
cls.add_constructor([])
## boolean.h (module 'core'): ns3::BooleanValue::BooleanValue(bool value) [constructor]
cls.add_constructor([param('bool', 'value')])
## boolean.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::BooleanValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## boolean.h (module 'core'): bool ns3::BooleanValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## boolean.h (module 'core'): bool ns3::BooleanValue::Get() const [member function]
cls.add_method('Get',
'bool',
[],
is_const=True)
## boolean.h (module 'core'): std::string ns3::BooleanValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## boolean.h (module 'core'): void ns3::BooleanValue::Set(bool value) [member function]
cls.add_method('Set',
'void',
[param('bool', 'value')])
return
def register_Ns3CallbackChecker_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker(ns3::CallbackChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackChecker const &', 'arg0')])
return
def register_Ns3CallbackImplBase_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase(ns3::CallbackImplBase const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImplBase const &', 'arg0')])
## callback.h (module 'core'): std::string ns3::CallbackImplBase::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## callback.h (module 'core'): bool ns3::CallbackImplBase::IsEqual(ns3::Ptr<const ns3::CallbackImplBase> other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ptr< ns3::CallbackImplBase const >', 'other')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::Demangle(std::string const & mangled) [member function]
cls.add_method('Demangle',
'std::string',
[param('std::string const &', 'mangled')],
is_static=True, visibility='protected')
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'ns3::ObjectBase*'])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'void'])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'ns3::Ptr<ns3::NetDevice> '])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'ns3::Ptr<ns3::Packet const> '])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'unsigned short'])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'ns3::Address const&'])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'ns3::NetDevice::PacketType'])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'ns3::Ipv4Address const&'])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'ns3::Ptr<ns3::Socket> '])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'bool'])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'unsigned int'])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'ns3::Time'])
return
def register_Ns3CallbackValue_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackValue const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackValue const &', 'arg0')])
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackBase const & base) [constructor]
cls.add_constructor([param('ns3::CallbackBase const &', 'base')])
## callback.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::CallbackValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): bool ns3::CallbackValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## callback.h (module 'core'): std::string ns3::CallbackValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackValue::Set(ns3::CallbackBase base) [member function]
cls.add_method('Set',
'void',
[param('ns3::CallbackBase', 'base')])
return
def register_Ns3ConstantRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ConstantRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::ConstantRandomVariable::ConstantRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::ConstantRandomVariable::GetConstant() const [member function]
cls.add_method('GetConstant',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ConstantRandomVariable::GetValue(double constant) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'constant')])
## random-variable-stream.h (module 'core'): uint32_t ns3::ConstantRandomVariable::GetInteger(uint32_t constant) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'constant')])
## random-variable-stream.h (module 'core'): double ns3::ConstantRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::ConstantRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3DataCalculator_methods(root_module, cls):
## data-calculator.h (module 'stats'): ns3::DataCalculator::DataCalculator(ns3::DataCalculator const & arg0) [constructor]
cls.add_constructor([param('ns3::DataCalculator const &', 'arg0')])
## data-calculator.h (module 'stats'): ns3::DataCalculator::DataCalculator() [constructor]
cls.add_constructor([])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Disable() [member function]
cls.add_method('Disable',
'void',
[])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Enable() [member function]
cls.add_method('Enable',
'void',
[])
## data-calculator.h (module 'stats'): std::string ns3::DataCalculator::GetContext() const [member function]
cls.add_method('GetContext',
'std::string',
[],
is_const=True)
## data-calculator.h (module 'stats'): bool ns3::DataCalculator::GetEnabled() const [member function]
cls.add_method('GetEnabled',
'bool',
[],
is_const=True)
## data-calculator.h (module 'stats'): std::string ns3::DataCalculator::GetKey() const [member function]
cls.add_method('GetKey',
'std::string',
[],
is_const=True)
## data-calculator.h (module 'stats'): static ns3::TypeId ns3::DataCalculator::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Output(ns3::DataOutputCallback & callback) const [member function]
cls.add_method('Output',
'void',
[param('ns3::DataOutputCallback &', 'callback')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::SetContext(std::string const context) [member function]
cls.add_method('SetContext',
'void',
[param('std::string const', 'context')])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::SetKey(std::string const key) [member function]
cls.add_method('SetKey',
'void',
[param('std::string const', 'key')])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Start(ns3::Time const & startTime) [member function]
cls.add_method('Start',
'void',
[param('ns3::Time const &', 'startTime')],
is_virtual=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Stop(ns3::Time const & stopTime) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'stopTime')],
is_virtual=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3DataOutputInterface_methods(root_module, cls):
## data-output-interface.h (module 'stats'): ns3::DataOutputInterface::DataOutputInterface(ns3::DataOutputInterface const & arg0) [constructor]
cls.add_constructor([param('ns3::DataOutputInterface const &', 'arg0')])
## data-output-interface.h (module 'stats'): ns3::DataOutputInterface::DataOutputInterface() [constructor]
cls.add_constructor([])
## data-output-interface.h (module 'stats'): std::string ns3::DataOutputInterface::GetFilePrefix() const [member function]
cls.add_method('GetFilePrefix',
'std::string',
[],
is_const=True)
## data-output-interface.h (module 'stats'): static ns3::TypeId ns3::DataOutputInterface::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputInterface::Output(ns3::DataCollector & dc) [member function]
cls.add_method('Output',
'void',
[param('ns3::DataCollector &', 'dc')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputInterface::SetFilePrefix(std::string const prefix) [member function]
cls.add_method('SetFilePrefix',
'void',
[param('std::string const', 'prefix')])
## data-output-interface.h (module 'stats'): void ns3::DataOutputInterface::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3DeterministicRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::DeterministicRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::DeterministicRandomVariable::DeterministicRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): void ns3::DeterministicRandomVariable::SetValueArray(double * values, std::size_t length) [member function]
cls.add_method('SetValueArray',
'void',
[param('double *', 'values'), param('std::size_t', 'length')])
## random-variable-stream.h (module 'core'): double ns3::DeterministicRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::DeterministicRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3DhcpClient_methods(root_module, cls):
## dhcp-client.h (module 'internet-apps'): ns3::DhcpClient::DhcpClient(ns3::DhcpClient const & arg0) [constructor]
cls.add_constructor([param('ns3::DhcpClient const &', 'arg0')])
## dhcp-client.h (module 'internet-apps'): ns3::DhcpClient::DhcpClient() [constructor]
cls.add_constructor([])
## dhcp-client.h (module 'internet-apps'): ns3::DhcpClient::DhcpClient(ns3::Ptr<ns3::NetDevice> netDevice) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::NetDevice >', 'netDevice')])
## dhcp-client.h (module 'internet-apps'): int64_t ns3::DhcpClient::AssignStreams(int64_t stream) [member function]
cls.add_method('AssignStreams',
'int64_t',
[param('int64_t', 'stream')])
## dhcp-client.h (module 'internet-apps'): ns3::Ptr<ns3::NetDevice> ns3::DhcpClient::GetDhcpClientNetDevice() [member function]
cls.add_method('GetDhcpClientNetDevice',
'ns3::Ptr< ns3::NetDevice >',
[])
## dhcp-client.h (module 'internet-apps'): ns3::Ipv4Address ns3::DhcpClient::GetDhcpServer() [member function]
cls.add_method('GetDhcpServer',
'ns3::Ipv4Address',
[])
## dhcp-client.h (module 'internet-apps'): static ns3::TypeId ns3::DhcpClient::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## dhcp-client.h (module 'internet-apps'): void ns3::DhcpClient::SetDhcpClientNetDevice(ns3::Ptr<ns3::NetDevice> netDevice) [member function]
cls.add_method('SetDhcpClientNetDevice',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'netDevice')])
## dhcp-client.h (module 'internet-apps'): void ns3::DhcpClient::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## dhcp-client.h (module 'internet-apps'): void ns3::DhcpClient::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## dhcp-client.h (module 'internet-apps'): void ns3::DhcpClient::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3DhcpHeader_methods(root_module, cls):
## dhcp-header.h (module 'internet-apps'): ns3::DhcpHeader::DhcpHeader(ns3::DhcpHeader const & arg0) [constructor]
cls.add_constructor([param('ns3::DhcpHeader const &', 'arg0')])
## dhcp-header.h (module 'internet-apps'): ns3::DhcpHeader::DhcpHeader() [constructor]
cls.add_constructor([])
## dhcp-header.h (module 'internet-apps'): ns3::Address ns3::DhcpHeader::GetChaddr() [member function]
cls.add_method('GetChaddr',
'ns3::Address',
[])
## dhcp-header.h (module 'internet-apps'): ns3::Ipv4Address ns3::DhcpHeader::GetDhcps() const [member function]
cls.add_method('GetDhcps',
'ns3::Ipv4Address',
[],
is_const=True)
## dhcp-header.h (module 'internet-apps'): uint32_t ns3::DhcpHeader::GetLease() const [member function]
cls.add_method('GetLease',
'uint32_t',
[],
is_const=True)
## dhcp-header.h (module 'internet-apps'): uint32_t ns3::DhcpHeader::GetMask() const [member function]
cls.add_method('GetMask',
'uint32_t',
[],
is_const=True)
## dhcp-header.h (module 'internet-apps'): uint32_t ns3::DhcpHeader::GetRebind() const [member function]
cls.add_method('GetRebind',
'uint32_t',
[],
is_const=True)
## dhcp-header.h (module 'internet-apps'): uint32_t ns3::DhcpHeader::GetRenew() const [member function]
cls.add_method('GetRenew',
'uint32_t',
[],
is_const=True)
## dhcp-header.h (module 'internet-apps'): ns3::Ipv4Address ns3::DhcpHeader::GetReq() const [member function]
cls.add_method('GetReq',
'ns3::Ipv4Address',
[],
is_const=True)
## dhcp-header.h (module 'internet-apps'): ns3::Ipv4Address ns3::DhcpHeader::GetRouter() const [member function]
cls.add_method('GetRouter',
'ns3::Ipv4Address',
[],
is_const=True)
## dhcp-header.h (module 'internet-apps'): uint32_t ns3::DhcpHeader::GetTran() const [member function]
cls.add_method('GetTran',
'uint32_t',
[],
is_const=True)
## dhcp-header.h (module 'internet-apps'): uint8_t ns3::DhcpHeader::GetType() const [member function]
cls.add_method('GetType',
'uint8_t',
[],
is_const=True)
## dhcp-header.h (module 'internet-apps'): static ns3::TypeId ns3::DhcpHeader::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## dhcp-header.h (module 'internet-apps'): ns3::Ipv4Address ns3::DhcpHeader::GetYiaddr() const [member function]
cls.add_method('GetYiaddr',
'ns3::Ipv4Address',
[],
is_const=True)
## dhcp-header.h (module 'internet-apps'): void ns3::DhcpHeader::ResetOpt() [member function]
cls.add_method('ResetOpt',
'void',
[])
## dhcp-header.h (module 'internet-apps'): void ns3::DhcpHeader::SetChaddr(ns3::Address addr) [member function]
cls.add_method('SetChaddr',
'void',
[param('ns3::Address', 'addr')])
## dhcp-header.h (module 'internet-apps'): void ns3::DhcpHeader::SetChaddr(uint8_t * addr, uint8_t len) [member function]
cls.add_method('SetChaddr',
'void',
[param('uint8_t *', 'addr'), param('uint8_t', 'len')])
## dhcp-header.h (module 'internet-apps'): void ns3::DhcpHeader::SetDhcps(ns3::Ipv4Address addr) [member function]
cls.add_method('SetDhcps',
'void',
[param('ns3::Ipv4Address', 'addr')])
## dhcp-header.h (module 'internet-apps'): void ns3::DhcpHeader::SetHWType(uint8_t htype, uint8_t hlen) [member function]
cls.add_method('SetHWType',
'void',
[param('uint8_t', 'htype'), param('uint8_t', 'hlen')])
## dhcp-header.h (module 'internet-apps'): void ns3::DhcpHeader::SetLease(uint32_t time) [member function]
cls.add_method('SetLease',
'void',
[param('uint32_t', 'time')])
## dhcp-header.h (module 'internet-apps'): void ns3::DhcpHeader::SetMask(uint32_t addr) [member function]
cls.add_method('SetMask',
'void',
[param('uint32_t', 'addr')])
## dhcp-header.h (module 'internet-apps'): void ns3::DhcpHeader::SetRebind(uint32_t time) [member function]
cls.add_method('SetRebind',
'void',
[param('uint32_t', 'time')])
## dhcp-header.h (module 'internet-apps'): void ns3::DhcpHeader::SetRenew(uint32_t time) [member function]
cls.add_method('SetRenew',
'void',
[param('uint32_t', 'time')])
## dhcp-header.h (module 'internet-apps'): void ns3::DhcpHeader::SetReq(ns3::Ipv4Address addr) [member function]
cls.add_method('SetReq',
'void',
[param('ns3::Ipv4Address', 'addr')])
## dhcp-header.h (module 'internet-apps'): void ns3::DhcpHeader::SetRouter(ns3::Ipv4Address addr) [member function]
cls.add_method('SetRouter',
'void',
[param('ns3::Ipv4Address', 'addr')])
## dhcp-header.h (module 'internet-apps'): void ns3::DhcpHeader::SetTime() [member function]
cls.add_method('SetTime',
'void',
[])
## dhcp-header.h (module 'internet-apps'): void ns3::DhcpHeader::SetTran(uint32_t tran) [member function]
cls.add_method('SetTran',
'void',
[param('uint32_t', 'tran')])
## dhcp-header.h (module 'internet-apps'): void ns3::DhcpHeader::SetType(uint8_t type) [member function]
cls.add_method('SetType',
'void',
[param('uint8_t', 'type')])
## dhcp-header.h (module 'internet-apps'): void ns3::DhcpHeader::SetYiaddr(ns3::Ipv4Address addr) [member function]
cls.add_method('SetYiaddr',
'void',
[param('ns3::Ipv4Address', 'addr')])
## dhcp-header.h (module 'internet-apps'): uint32_t ns3::DhcpHeader::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
visibility='private', is_virtual=True)
## dhcp-header.h (module 'internet-apps'): ns3::TypeId ns3::DhcpHeader::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, visibility='private', is_virtual=True)
## dhcp-header.h (module 'internet-apps'): uint32_t ns3::DhcpHeader::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, visibility='private', is_virtual=True)
## dhcp-header.h (module 'internet-apps'): void ns3::DhcpHeader::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, visibility='private', is_virtual=True)
## dhcp-header.h (module 'internet-apps'): void ns3::DhcpHeader::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_const=True, visibility='private', is_virtual=True)
return
def register_Ns3DhcpServer_methods(root_module, cls):
## dhcp-server.h (module 'internet-apps'): ns3::DhcpServer::DhcpServer(ns3::DhcpServer const & arg0) [constructor]
cls.add_constructor([param('ns3::DhcpServer const &', 'arg0')])
## dhcp-server.h (module 'internet-apps'): ns3::DhcpServer::DhcpServer() [constructor]
cls.add_constructor([])
## dhcp-server.h (module 'internet-apps'): void ns3::DhcpServer::AddStaticDhcpEntry(ns3::Address chaddr, ns3::Ipv4Address addr) [member function]
cls.add_method('AddStaticDhcpEntry',
'void',
[param('ns3::Address', 'chaddr'), param('ns3::Ipv4Address', 'addr')])
## dhcp-server.h (module 'internet-apps'): static ns3::TypeId ns3::DhcpServer::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## dhcp-server.h (module 'internet-apps'): void ns3::DhcpServer::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## dhcp-server.h (module 'internet-apps'): void ns3::DhcpServer::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## dhcp-server.h (module 'internet-apps'): void ns3::DhcpServer::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3DoubleValue_methods(root_module, cls):
## double.h (module 'core'): ns3::DoubleValue::DoubleValue() [constructor]
cls.add_constructor([])
## double.h (module 'core'): ns3::DoubleValue::DoubleValue(double const & value) [constructor]
cls.add_constructor([param('double const &', 'value')])
## double.h (module 'core'): ns3::DoubleValue::DoubleValue(ns3::DoubleValue const & arg0) [constructor]
cls.add_constructor([param('ns3::DoubleValue const &', 'arg0')])
## double.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::DoubleValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## double.h (module 'core'): bool ns3::DoubleValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## double.h (module 'core'): double ns3::DoubleValue::Get() const [member function]
cls.add_method('Get',
'double',
[],
is_const=True)
## double.h (module 'core'): std::string ns3::DoubleValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## double.h (module 'core'): void ns3::DoubleValue::Set(double const & value) [member function]
cls.add_method('Set',
'void',
[param('double const &', 'value')])
return
def register_Ns3EmpiricalRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): ns3::EmpiricalRandomVariable::EmpiricalRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): void ns3::EmpiricalRandomVariable::CDF(double v, double c) [member function]
cls.add_method('CDF',
'void',
[param('double', 'v'), param('double', 'c')])
## random-variable-stream.h (module 'core'): uint32_t ns3::EmpiricalRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::EmpiricalRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): double ns3::EmpiricalRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): double ns3::EmpiricalRandomVariable::Interpolate(double c1, double c2, double v1, double v2, double r) [member function]
cls.add_method('Interpolate',
'double',
[param('double', 'c1'), param('double', 'c2'), param('double', 'v1'), param('double', 'v2'), param('double', 'r')],
visibility='private', is_virtual=True)
## random-variable-stream.h (module 'core'): void ns3::EmpiricalRandomVariable::Validate() [member function]
cls.add_method('Validate',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3EmptyAttributeAccessor_methods(root_module, cls):
## attribute.h (module 'core'): ns3::EmptyAttributeAccessor::EmptyAttributeAccessor(ns3::EmptyAttributeAccessor const & arg0) [constructor]
cls.add_constructor([param('ns3::EmptyAttributeAccessor const &', 'arg0')])
## attribute.h (module 'core'): ns3::EmptyAttributeAccessor::EmptyAttributeAccessor() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): bool ns3::EmptyAttributeAccessor::Get(ns3::ObjectBase const * object, ns3::AttributeValue & attribute) const [member function]
cls.add_method('Get',
'bool',
[param('ns3::ObjectBase const *', 'object'), param('ns3::AttributeValue &', 'attribute')],
is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::EmptyAttributeAccessor::HasGetter() const [member function]
cls.add_method('HasGetter',
'bool',
[],
is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::EmptyAttributeAccessor::HasSetter() const [member function]
cls.add_method('HasSetter',
'bool',
[],
is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::EmptyAttributeAccessor::Set(ns3::ObjectBase * object, ns3::AttributeValue const & value) const [member function]
cls.add_method('Set',
'bool',
[param('ns3::ObjectBase *', 'object'), param('ns3::AttributeValue const &', 'value')],
is_const=True, is_virtual=True)
return
def register_Ns3EmptyAttributeChecker_methods(root_module, cls):
## attribute.h (module 'core'): ns3::EmptyAttributeChecker::EmptyAttributeChecker(ns3::EmptyAttributeChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::EmptyAttributeChecker const &', 'arg0')])
## attribute.h (module 'core'): ns3::EmptyAttributeChecker::EmptyAttributeChecker() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): bool ns3::EmptyAttributeChecker::Check(ns3::AttributeValue const & value) const [member function]
cls.add_method('Check',
'bool',
[param('ns3::AttributeValue const &', 'value')],
is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::EmptyAttributeChecker::Copy(ns3::AttributeValue const & source, ns3::AttributeValue & destination) const [member function]
cls.add_method('Copy',
'bool',
[param('ns3::AttributeValue const &', 'source'), param('ns3::AttributeValue &', 'destination')],
is_const=True, is_virtual=True)
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EmptyAttributeChecker::Create() const [member function]
cls.add_method('Create',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## attribute.h (module 'core'): std::string ns3::EmptyAttributeChecker::GetUnderlyingTypeInformation() const [member function]
cls.add_method('GetUnderlyingTypeInformation',
'std::string',
[],
is_const=True, is_virtual=True)
## attribute.h (module 'core'): std::string ns3::EmptyAttributeChecker::GetValueTypeName() const [member function]
cls.add_method('GetValueTypeName',
'std::string',
[],
is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::EmptyAttributeChecker::HasUnderlyingTypeInformation() const [member function]
cls.add_method('HasUnderlyingTypeInformation',
'bool',
[],
is_const=True, is_virtual=True)
return
def register_Ns3EmptyAttributeValue_methods(root_module, cls):
## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue(ns3::EmptyAttributeValue const & arg0) [constructor]
cls.add_constructor([param('ns3::EmptyAttributeValue const &', 'arg0')])
## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EmptyAttributeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, visibility='private', is_virtual=True)
## attribute.h (module 'core'): bool ns3::EmptyAttributeValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
visibility='private', is_virtual=True)
## attribute.h (module 'core'): std::string ns3::EmptyAttributeValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, visibility='private', is_virtual=True)
return
def register_Ns3EnumChecker_methods(root_module, cls):
## enum.h (module 'core'): ns3::EnumChecker::EnumChecker(ns3::EnumChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::EnumChecker const &', 'arg0')])
## enum.h (module 'core'): ns3::EnumChecker::EnumChecker() [constructor]
cls.add_constructor([])
## enum.h (module 'core'): void ns3::EnumChecker::Add(int value, std::string name) [member function]
cls.add_method('Add',
'void',
[param('int', 'value'), param('std::string', 'name')])
## enum.h (module 'core'): void ns3::EnumChecker::AddDefault(int value, std::string name) [member function]
cls.add_method('AddDefault',
'void',
[param('int', 'value'), param('std::string', 'name')])
## enum.h (module 'core'): bool ns3::EnumChecker::Check(ns3::AttributeValue const & value) const [member function]
cls.add_method('Check',
'bool',
[param('ns3::AttributeValue const &', 'value')],
is_const=True, is_virtual=True)
## enum.h (module 'core'): bool ns3::EnumChecker::Copy(ns3::AttributeValue const & src, ns3::AttributeValue & dst) const [member function]
cls.add_method('Copy',
'bool',
[param('ns3::AttributeValue const &', 'src'), param('ns3::AttributeValue &', 'dst')],
is_const=True, is_virtual=True)
## enum.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EnumChecker::Create() const [member function]
cls.add_method('Create',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): std::string ns3::EnumChecker::GetUnderlyingTypeInformation() const [member function]
cls.add_method('GetUnderlyingTypeInformation',
'std::string',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): std::string ns3::EnumChecker::GetValueTypeName() const [member function]
cls.add_method('GetValueTypeName',
'std::string',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): bool ns3::EnumChecker::HasUnderlyingTypeInformation() const [member function]
cls.add_method('HasUnderlyingTypeInformation',
'bool',
[],
is_const=True, is_virtual=True)
return
def register_Ns3EnumValue_methods(root_module, cls):
## enum.h (module 'core'): ns3::EnumValue::EnumValue(ns3::EnumValue const & arg0) [constructor]
cls.add_constructor([param('ns3::EnumValue const &', 'arg0')])
## enum.h (module 'core'): ns3::EnumValue::EnumValue() [constructor]
cls.add_constructor([])
## enum.h (module 'core'): ns3::EnumValue::EnumValue(int value) [constructor]
cls.add_constructor([param('int', 'value')])
## enum.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EnumValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): bool ns3::EnumValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## enum.h (module 'core'): int ns3::EnumValue::Get() const [member function]
cls.add_method('Get',
'int',
[],
is_const=True)
## enum.h (module 'core'): std::string ns3::EnumValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## enum.h (module 'core'): void ns3::EnumValue::Set(int value) [member function]
cls.add_method('Set',
'void',
[param('int', 'value')])
return
def register_Ns3ErlangRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ErlangRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::ErlangRandomVariable::ErlangRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): uint32_t ns3::ErlangRandomVariable::GetK() const [member function]
cls.add_method('GetK',
'uint32_t',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ErlangRandomVariable::GetLambda() const [member function]
cls.add_method('GetLambda',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ErlangRandomVariable::GetValue(uint32_t k, double lambda) [member function]
cls.add_method('GetValue',
'double',
[param('uint32_t', 'k'), param('double', 'lambda')])
## random-variable-stream.h (module 'core'): uint32_t ns3::ErlangRandomVariable::GetInteger(uint32_t k, uint32_t lambda) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'k'), param('uint32_t', 'lambda')])
## random-variable-stream.h (module 'core'): double ns3::ErlangRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::ErlangRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3EventImpl_methods(root_module, cls):
## event-impl.h (module 'core'): ns3::EventImpl::EventImpl(ns3::EventImpl const & arg0) [constructor]
cls.add_constructor([param('ns3::EventImpl const &', 'arg0')])
## event-impl.h (module 'core'): ns3::EventImpl::EventImpl() [constructor]
cls.add_constructor([])
## event-impl.h (module 'core'): void ns3::EventImpl::Cancel() [member function]
cls.add_method('Cancel',
'void',
[])
## event-impl.h (module 'core'): void ns3::EventImpl::Invoke() [member function]
cls.add_method('Invoke',
'void',
[])
## event-impl.h (module 'core'): bool ns3::EventImpl::IsCancelled() [member function]
cls.add_method('IsCancelled',
'bool',
[])
## event-impl.h (module 'core'): void ns3::EventImpl::Notify() [member function]
cls.add_method('Notify',
'void',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
return
def register_Ns3ExponentialRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ExponentialRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::ExponentialRandomVariable::ExponentialRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::ExponentialRandomVariable::GetMean() const [member function]
cls.add_method('GetMean',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ExponentialRandomVariable::GetBound() const [member function]
cls.add_method('GetBound',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ExponentialRandomVariable::GetValue(double mean, double bound) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'mean'), param('double', 'bound')])
## random-variable-stream.h (module 'core'): uint32_t ns3::ExponentialRandomVariable::GetInteger(uint32_t mean, uint32_t bound) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'mean'), param('uint32_t', 'bound')])
## random-variable-stream.h (module 'core'): double ns3::ExponentialRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::ExponentialRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3GammaRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::GammaRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::GammaRandomVariable::GammaRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::GammaRandomVariable::GetAlpha() const [member function]
cls.add_method('GetAlpha',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::GammaRandomVariable::GetBeta() const [member function]
cls.add_method('GetBeta',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::GammaRandomVariable::GetValue(double alpha, double beta) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'alpha'), param('double', 'beta')])
## random-variable-stream.h (module 'core'): uint32_t ns3::GammaRandomVariable::GetInteger(uint32_t alpha, uint32_t beta) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'alpha'), param('uint32_t', 'beta')])
## random-variable-stream.h (module 'core'): double ns3::GammaRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::GammaRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3IntegerValue_methods(root_module, cls):
## integer.h (module 'core'): ns3::IntegerValue::IntegerValue() [constructor]
cls.add_constructor([])
## integer.h (module 'core'): ns3::IntegerValue::IntegerValue(int64_t const & value) [constructor]
cls.add_constructor([param('int64_t const &', 'value')])
## integer.h (module 'core'): ns3::IntegerValue::IntegerValue(ns3::IntegerValue const & arg0) [constructor]
cls.add_constructor([param('ns3::IntegerValue const &', 'arg0')])
## integer.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::IntegerValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## integer.h (module 'core'): bool ns3::IntegerValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## integer.h (module 'core'): int64_t ns3::IntegerValue::Get() const [member function]
cls.add_method('Get',
'int64_t',
[],
is_const=True)
## integer.h (module 'core'): std::string ns3::IntegerValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## integer.h (module 'core'): void ns3::IntegerValue::Set(int64_t const & value) [member function]
cls.add_method('Set',
'void',
[param('int64_t const &', 'value')])
return
def register_Ns3Ipv4_methods(root_module, cls):
## ipv4.h (module 'internet'): ns3::Ipv4::Ipv4(ns3::Ipv4 const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv4 const &', 'arg0')])
## ipv4.h (module 'internet'): ns3::Ipv4::Ipv4() [constructor]
cls.add_constructor([])
## ipv4.h (module 'internet'): bool ns3::Ipv4::AddAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
cls.add_method('AddAddress',
'bool',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): uint32_t ns3::Ipv4::AddInterface(ns3::Ptr<ns3::NetDevice> device) [member function]
cls.add_method('AddInterface',
'uint32_t',
[param('ns3::Ptr< ns3::NetDevice >', 'device')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): ns3::Ptr<ns3::Socket> ns3::Ipv4::CreateRawSocket() [member function]
cls.add_method('CreateRawSocket',
'ns3::Ptr< ns3::Socket >',
[],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::DeleteRawSocket(ns3::Ptr<ns3::Socket> socket) [member function]
cls.add_method('DeleteRawSocket',
'void',
[param('ns3::Ptr< ns3::Socket >', 'socket')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): ns3::Ipv4InterfaceAddress ns3::Ipv4::GetAddress(uint32_t interface, uint32_t addressIndex) const [member function]
cls.add_method('GetAddress',
'ns3::Ipv4InterfaceAddress',
[param('uint32_t', 'interface'), param('uint32_t', 'addressIndex')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): int32_t ns3::Ipv4::GetInterfaceForAddress(ns3::Ipv4Address address) const [member function]
cls.add_method('GetInterfaceForAddress',
'int32_t',
[param('ns3::Ipv4Address', 'address')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): int32_t ns3::Ipv4::GetInterfaceForDevice(ns3::Ptr<const ns3::NetDevice> device) const [member function]
cls.add_method('GetInterfaceForDevice',
'int32_t',
[param('ns3::Ptr< ns3::NetDevice const >', 'device')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): int32_t ns3::Ipv4::GetInterfaceForPrefix(ns3::Ipv4Address address, ns3::Ipv4Mask mask) const [member function]
cls.add_method('GetInterfaceForPrefix',
'int32_t',
[param('ns3::Ipv4Address', 'address'), param('ns3::Ipv4Mask', 'mask')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): uint16_t ns3::Ipv4::GetMetric(uint32_t interface) const [member function]
cls.add_method('GetMetric',
'uint16_t',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): uint16_t ns3::Ipv4::GetMtu(uint32_t interface) const [member function]
cls.add_method('GetMtu',
'uint16_t',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): uint32_t ns3::Ipv4::GetNAddresses(uint32_t interface) const [member function]
cls.add_method('GetNAddresses',
'uint32_t',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): uint32_t ns3::Ipv4::GetNInterfaces() const [member function]
cls.add_method('GetNInterfaces',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): ns3::Ptr<ns3::NetDevice> ns3::Ipv4::GetNetDevice(uint32_t interface) [member function]
cls.add_method('GetNetDevice',
'ns3::Ptr< ns3::NetDevice >',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): ns3::Ptr<ns3::IpL4Protocol> ns3::Ipv4::GetProtocol(int protocolNumber) const [member function]
cls.add_method('GetProtocol',
'ns3::Ptr< ns3::IpL4Protocol >',
[param('int', 'protocolNumber')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): ns3::Ptr<ns3::IpL4Protocol> ns3::Ipv4::GetProtocol(int protocolNumber, int32_t interfaceIndex) const [member function]
cls.add_method('GetProtocol',
'ns3::Ptr< ns3::IpL4Protocol >',
[param('int', 'protocolNumber'), param('int32_t', 'interfaceIndex')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): ns3::Ptr<ns3::Ipv4RoutingProtocol> ns3::Ipv4::GetRoutingProtocol() const [member function]
cls.add_method('GetRoutingProtocol',
'ns3::Ptr< ns3::Ipv4RoutingProtocol >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): static ns3::TypeId ns3::Ipv4::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::Insert(ns3::Ptr<ns3::IpL4Protocol> protocol) [member function]
cls.add_method('Insert',
'void',
[param('ns3::Ptr< ns3::IpL4Protocol >', 'protocol')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::Insert(ns3::Ptr<ns3::IpL4Protocol> protocol, uint32_t interfaceIndex) [member function]
cls.add_method('Insert',
'void',
[param('ns3::Ptr< ns3::IpL4Protocol >', 'protocol'), param('uint32_t', 'interfaceIndex')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): bool ns3::Ipv4::IsDestinationAddress(ns3::Ipv4Address address, uint32_t iif) const [member function]
cls.add_method('IsDestinationAddress',
'bool',
[param('ns3::Ipv4Address', 'address'), param('uint32_t', 'iif')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): bool ns3::Ipv4::IsForwarding(uint32_t interface) const [member function]
cls.add_method('IsForwarding',
'bool',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): bool ns3::Ipv4::IsUp(uint32_t interface) const [member function]
cls.add_method('IsUp',
'bool',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::Remove(ns3::Ptr<ns3::IpL4Protocol> protocol) [member function]
cls.add_method('Remove',
'void',
[param('ns3::Ptr< ns3::IpL4Protocol >', 'protocol')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::Remove(ns3::Ptr<ns3::IpL4Protocol> protocol, uint32_t interfaceIndex) [member function]
cls.add_method('Remove',
'void',
[param('ns3::Ptr< ns3::IpL4Protocol >', 'protocol'), param('uint32_t', 'interfaceIndex')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): bool ns3::Ipv4::RemoveAddress(uint32_t interface, uint32_t addressIndex) [member function]
cls.add_method('RemoveAddress',
'bool',
[param('uint32_t', 'interface'), param('uint32_t', 'addressIndex')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): bool ns3::Ipv4::RemoveAddress(uint32_t interface, ns3::Ipv4Address address) [member function]
cls.add_method('RemoveAddress',
'bool',
[param('uint32_t', 'interface'), param('ns3::Ipv4Address', 'address')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4::SelectSourceAddress(ns3::Ptr<const ns3::NetDevice> device, ns3::Ipv4Address dst, ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e scope) [member function]
cls.add_method('SelectSourceAddress',
'ns3::Ipv4Address',
[param('ns3::Ptr< ns3::NetDevice const >', 'device'), param('ns3::Ipv4Address', 'dst'), param('ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e', 'scope')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::Send(ns3::Ptr<ns3::Packet> packet, ns3::Ipv4Address source, ns3::Ipv4Address destination, uint8_t protocol, ns3::Ptr<ns3::Ipv4Route> route) [member function]
cls.add_method('Send',
'void',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'destination'), param('uint8_t', 'protocol'), param('ns3::Ptr< ns3::Ipv4Route >', 'route')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SendWithHeader(ns3::Ptr<ns3::Packet> packet, ns3::Ipv4Header ipHeader, ns3::Ptr<ns3::Ipv4Route> route) [member function]
cls.add_method('SendWithHeader',
'void',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Ipv4Header', 'ipHeader'), param('ns3::Ptr< ns3::Ipv4Route >', 'route')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetDown(uint32_t interface) [member function]
cls.add_method('SetDown',
'void',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetForwarding(uint32_t interface, bool val) [member function]
cls.add_method('SetForwarding',
'void',
[param('uint32_t', 'interface'), param('bool', 'val')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetMetric(uint32_t interface, uint16_t metric) [member function]
cls.add_method('SetMetric',
'void',
[param('uint32_t', 'interface'), param('uint16_t', 'metric')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetRoutingProtocol(ns3::Ptr<ns3::Ipv4RoutingProtocol> routingProtocol) [member function]
cls.add_method('SetRoutingProtocol',
'void',
[param('ns3::Ptr< ns3::Ipv4RoutingProtocol >', 'routingProtocol')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetUp(uint32_t interface) [member function]
cls.add_method('SetUp',
'void',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4::SourceAddressSelection(uint32_t interface, ns3::Ipv4Address dest) [member function]
cls.add_method('SourceAddressSelection',
'ns3::Ipv4Address',
[param('uint32_t', 'interface'), param('ns3::Ipv4Address', 'dest')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): ns3::Ipv4::IF_ANY [variable]
cls.add_static_attribute('IF_ANY', 'uint32_t const', is_const=True)
## ipv4.h (module 'internet'): bool ns3::Ipv4::GetIpForward() const [member function]
cls.add_method('GetIpForward',
'bool',
[],
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
## ipv4.h (module 'internet'): bool ns3::Ipv4::GetWeakEsModel() const [member function]
cls.add_method('GetWeakEsModel',
'bool',
[],
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetIpForward(bool forward) [member function]
cls.add_method('SetIpForward',
'void',
[param('bool', 'forward')],
is_pure_virtual=True, visibility='private', is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetWeakEsModel(bool model) [member function]
cls.add_method('SetWeakEsModel',
'void',
[param('bool', 'model')],
is_pure_virtual=True, visibility='private', is_virtual=True)
return
def register_Ns3Ipv4AddressChecker_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker::Ipv4AddressChecker() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker::Ipv4AddressChecker(ns3::Ipv4AddressChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv4AddressChecker const &', 'arg0')])
return
def register_Ns3Ipv4AddressValue_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue(ns3::Ipv4Address const & value) [constructor]
cls.add_constructor([param('ns3::Ipv4Address const &', 'value')])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue(ns3::Ipv4AddressValue const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv4AddressValue const &', 'arg0')])
## ipv4-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv4AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4AddressValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-address.h (module 'network'): std::string ns3::Ipv4AddressValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4AddressValue::Set(ns3::Ipv4Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv4Address const &', 'value')])
return
def register_Ns3Ipv4MaskChecker_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker::Ipv4MaskChecker() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker::Ipv4MaskChecker(ns3::Ipv4MaskChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv4MaskChecker const &', 'arg0')])
return
def register_Ns3Ipv4MaskValue_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue(ns3::Ipv4Mask const & value) [constructor]
cls.add_constructor([param('ns3::Ipv4Mask const &', 'value')])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue(ns3::Ipv4MaskValue const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv4MaskValue const &', 'arg0')])
## ipv4-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv4MaskValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4MaskValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv4-address.h (module 'network'): ns3::Ipv4Mask ns3::Ipv4MaskValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv4Mask',
[],
is_const=True)
## ipv4-address.h (module 'network'): std::string ns3::Ipv4MaskValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4MaskValue::Set(ns3::Ipv4Mask const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv4Mask const &', 'value')])
return
def register_Ns3Ipv4MulticastRoute_methods(root_module, cls):
## ipv4-route.h (module 'internet'): ns3::Ipv4MulticastRoute::Ipv4MulticastRoute(ns3::Ipv4MulticastRoute const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv4MulticastRoute const &', 'arg0')])
## ipv4-route.h (module 'internet'): ns3::Ipv4MulticastRoute::Ipv4MulticastRoute() [constructor]
cls.add_constructor([])
## ipv4-route.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4MulticastRoute::GetGroup() const [member function]
cls.add_method('GetGroup',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4MulticastRoute::GetOrigin() const [member function]
cls.add_method('GetOrigin',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h (module 'internet'): std::map<unsigned int, unsigned int, std::less<unsigned int>, std::allocator<std::pair<const unsigned int, unsigned int> > > ns3::Ipv4MulticastRoute::GetOutputTtlMap() const [member function]
cls.add_method('GetOutputTtlMap',
'std::map< unsigned int, unsigned int >',
[],
is_const=True)
## ipv4-route.h (module 'internet'): uint32_t ns3::Ipv4MulticastRoute::GetParent() const [member function]
cls.add_method('GetParent',
'uint32_t',
[],
is_const=True)
## ipv4-route.h (module 'internet'): void ns3::Ipv4MulticastRoute::SetGroup(ns3::Ipv4Address const group) [member function]
cls.add_method('SetGroup',
'void',
[param('ns3::Ipv4Address const', 'group')])
## ipv4-route.h (module 'internet'): void ns3::Ipv4MulticastRoute::SetOrigin(ns3::Ipv4Address const origin) [member function]
cls.add_method('SetOrigin',
'void',
[param('ns3::Ipv4Address const', 'origin')])
## ipv4-route.h (module 'internet'): void ns3::Ipv4MulticastRoute::SetOutputTtl(uint32_t oif, uint32_t ttl) [member function]
cls.add_method('SetOutputTtl',
'void',
[param('uint32_t', 'oif'), param('uint32_t', 'ttl')])
## ipv4-route.h (module 'internet'): void ns3::Ipv4MulticastRoute::SetParent(uint32_t iif) [member function]
cls.add_method('SetParent',
'void',
[param('uint32_t', 'iif')])
## ipv4-route.h (module 'internet'): ns3::Ipv4MulticastRoute::MAX_INTERFACES [variable]
cls.add_static_attribute('MAX_INTERFACES', 'uint32_t const', is_const=True)
## ipv4-route.h (module 'internet'): ns3::Ipv4MulticastRoute::MAX_TTL [variable]
cls.add_static_attribute('MAX_TTL', 'uint32_t const', is_const=True)
return
def register_Ns3Ipv4Route_methods(root_module, cls):
cls.add_output_stream_operator()
## ipv4-route.h (module 'internet'): ns3::Ipv4Route::Ipv4Route(ns3::Ipv4Route const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv4Route const &', 'arg0')])
## ipv4-route.h (module 'internet'): ns3::Ipv4Route::Ipv4Route() [constructor]
cls.add_constructor([])
## ipv4-route.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4Route::GetDestination() const [member function]
cls.add_method('GetDestination',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4Route::GetGateway() const [member function]
cls.add_method('GetGateway',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h (module 'internet'): ns3::Ptr<ns3::NetDevice> ns3::Ipv4Route::GetOutputDevice() const [member function]
cls.add_method('GetOutputDevice',
'ns3::Ptr< ns3::NetDevice >',
[],
is_const=True)
## ipv4-route.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4Route::GetSource() const [member function]
cls.add_method('GetSource',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h (module 'internet'): void ns3::Ipv4Route::SetDestination(ns3::Ipv4Address dest) [member function]
cls.add_method('SetDestination',
'void',
[param('ns3::Ipv4Address', 'dest')])
## ipv4-route.h (module 'internet'): void ns3::Ipv4Route::SetGateway(ns3::Ipv4Address gw) [member function]
cls.add_method('SetGateway',
'void',
[param('ns3::Ipv4Address', 'gw')])
## ipv4-route.h (module 'internet'): void ns3::Ipv4Route::SetOutputDevice(ns3::Ptr<ns3::NetDevice> outputDevice) [member function]
cls.add_method('SetOutputDevice',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'outputDevice')])
## ipv4-route.h (module 'internet'): void ns3::Ipv4Route::SetSource(ns3::Ipv4Address src) [member function]
cls.add_method('SetSource',
'void',
[param('ns3::Ipv4Address', 'src')])
return
def register_Ns3Ipv6AddressChecker_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker::Ipv6AddressChecker() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker::Ipv6AddressChecker(ns3::Ipv6AddressChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv6AddressChecker const &', 'arg0')])
return
def register_Ns3Ipv6AddressValue_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue(ns3::Ipv6Address const & value) [constructor]
cls.add_constructor([param('ns3::Ipv6Address const &', 'value')])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue(ns3::Ipv6AddressValue const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv6AddressValue const &', 'arg0')])
## ipv6-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv6AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6AddressValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv6-address.h (module 'network'): ns3::Ipv6Address ns3::Ipv6AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv6Address',
[],
is_const=True)
## ipv6-address.h (module 'network'): std::string ns3::Ipv6AddressValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6AddressValue::Set(ns3::Ipv6Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv6Address const &', 'value')])
return
def register_Ns3Ipv6PrefixChecker_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker::Ipv6PrefixChecker() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker::Ipv6PrefixChecker(ns3::Ipv6PrefixChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv6PrefixChecker const &', 'arg0')])
return
def register_Ns3Ipv6PrefixValue_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue(ns3::Ipv6Prefix const & value) [constructor]
cls.add_constructor([param('ns3::Ipv6Prefix const &', 'value')])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue(ns3::Ipv6PrefixValue const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv6PrefixValue const &', 'arg0')])
## ipv6-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv6PrefixValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6PrefixValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix ns3::Ipv6PrefixValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv6Prefix',
[],
is_const=True)
## ipv6-address.h (module 'network'): std::string ns3::Ipv6PrefixValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6PrefixValue::Set(ns3::Ipv6Prefix const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv6Prefix const &', 'value')])
return
def register_Ns3LogNormalRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::LogNormalRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::LogNormalRandomVariable::LogNormalRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::LogNormalRandomVariable::GetMu() const [member function]
cls.add_method('GetMu',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::LogNormalRandomVariable::GetSigma() const [member function]
cls.add_method('GetSigma',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::LogNormalRandomVariable::GetValue(double mu, double sigma) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'mu'), param('double', 'sigma')])
## random-variable-stream.h (module 'core'): uint32_t ns3::LogNormalRandomVariable::GetInteger(uint32_t mu, uint32_t sigma) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'mu'), param('uint32_t', 'sigma')])
## random-variable-stream.h (module 'core'): double ns3::LogNormalRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::LogNormalRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3Mac48AddressChecker_methods(root_module, cls):
## mac48-address.h (module 'network'): ns3::Mac48AddressChecker::Mac48AddressChecker() [constructor]
cls.add_constructor([])
## mac48-address.h (module 'network'): ns3::Mac48AddressChecker::Mac48AddressChecker(ns3::Mac48AddressChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::Mac48AddressChecker const &', 'arg0')])
return
def register_Ns3Mac48AddressValue_methods(root_module, cls):
## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue() [constructor]
cls.add_constructor([])
## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue(ns3::Mac48Address const & value) [constructor]
cls.add_constructor([param('ns3::Mac48Address const &', 'value')])
## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue(ns3::Mac48AddressValue const & arg0) [constructor]
cls.add_constructor([param('ns3::Mac48AddressValue const &', 'arg0')])
## mac48-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Mac48AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## mac48-address.h (module 'network'): bool ns3::Mac48AddressValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## mac48-address.h (module 'network'): ns3::Mac48Address ns3::Mac48AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Mac48Address',
[],
is_const=True)
## mac48-address.h (module 'network'): std::string ns3::Mac48AddressValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## mac48-address.h (module 'network'): void ns3::Mac48AddressValue::Set(ns3::Mac48Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Mac48Address const &', 'value')])
return
def register_Ns3Mac64AddressChecker_methods(root_module, cls):
## mac64-address.h (module 'network'): ns3::Mac64AddressChecker::Mac64AddressChecker() [constructor]
cls.add_constructor([])
## mac64-address.h (module 'network'): ns3::Mac64AddressChecker::Mac64AddressChecker(ns3::Mac64AddressChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::Mac64AddressChecker const &', 'arg0')])
return
def register_Ns3Mac64AddressValue_methods(root_module, cls):
## mac64-address.h (module 'network'): ns3::Mac64AddressValue::Mac64AddressValue() [constructor]
cls.add_constructor([])
## mac64-address.h (module 'network'): ns3::Mac64AddressValue::Mac64AddressValue(ns3::Mac64Address const & value) [constructor]
cls.add_constructor([param('ns3::Mac64Address const &', 'value')])
## mac64-address.h (module 'network'): ns3::Mac64AddressValue::Mac64AddressValue(ns3::Mac64AddressValue const & arg0) [constructor]
cls.add_constructor([param('ns3::Mac64AddressValue const &', 'arg0')])
## mac64-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Mac64AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## mac64-address.h (module 'network'): bool ns3::Mac64AddressValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## mac64-address.h (module 'network'): ns3::Mac64Address ns3::Mac64AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Mac64Address',
[],
is_const=True)
## mac64-address.h (module 'network'): std::string ns3::Mac64AddressValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## mac64-address.h (module 'network'): void ns3::Mac64AddressValue::Set(ns3::Mac64Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Mac64Address const &', 'value')])
return
def register_Ns3MinMaxAvgTotalCalculator__Double_methods(root_module, cls):
## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator<double>::MinMaxAvgTotalCalculator(ns3::MinMaxAvgTotalCalculator<double> const & arg0) [constructor]
cls.add_constructor([param('ns3::MinMaxAvgTotalCalculator< double > const &', 'arg0')])
## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator<double>::MinMaxAvgTotalCalculator() [constructor]
cls.add_constructor([])
## basic-data-calculators.h (module 'stats'): static ns3::TypeId ns3::MinMaxAvgTotalCalculator<double>::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<double>::Output(ns3::DataOutputCallback & callback) const [member function]
cls.add_method('Output',
'void',
[param('ns3::DataOutputCallback &', 'callback')],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<double>::Reset() [member function]
cls.add_method('Reset',
'void',
[])
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<double>::Update(double const i) [member function]
cls.add_method('Update',
'void',
[param('double const', 'i')])
## basic-data-calculators.h (module 'stats'): long int ns3::MinMaxAvgTotalCalculator<double>::getCount() const [member function]
cls.add_method('getCount',
'long int',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getMax() const [member function]
cls.add_method('getMax',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getMean() const [member function]
cls.add_method('getMean',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getMin() const [member function]
cls.add_method('getMin',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getSqrSum() const [member function]
cls.add_method('getSqrSum',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getStddev() const [member function]
cls.add_method('getStddev',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getSum() const [member function]
cls.add_method('getSum',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getVariance() const [member function]
cls.add_method('getVariance',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<double>::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3NetDevice_methods(root_module, cls):
## net-device.h (module 'network'): ns3::NetDevice::NetDevice() [constructor]
cls.add_constructor([])
## net-device.h (module 'network'): ns3::NetDevice::NetDevice(ns3::NetDevice const & arg0) [constructor]
cls.add_constructor([param('ns3::NetDevice const &', 'arg0')])
## net-device.h (module 'network'): void ns3::NetDevice::AddLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
cls.add_method('AddLinkChangeCallback',
'void',
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetAddress() const [member function]
cls.add_method('GetAddress',
'ns3::Address',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetBroadcast() const [member function]
cls.add_method('GetBroadcast',
'ns3::Address',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Ptr<ns3::Channel> ns3::NetDevice::GetChannel() const [member function]
cls.add_method('GetChannel',
'ns3::Ptr< ns3::Channel >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): uint32_t ns3::NetDevice::GetIfIndex() const [member function]
cls.add_method('GetIfIndex',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): uint16_t ns3::NetDevice::GetMtu() const [member function]
cls.add_method('GetMtu',
'uint16_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv4Address multicastGroup) const [member function]
cls.add_method('GetMulticast',
'ns3::Address',
[param('ns3::Ipv4Address', 'multicastGroup')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv6Address addr) const [member function]
cls.add_method('GetMulticast',
'ns3::Address',
[param('ns3::Ipv6Address', 'addr')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Ptr<ns3::Node> ns3::NetDevice::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): static ns3::TypeId ns3::NetDevice::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsBridge() const [member function]
cls.add_method('IsBridge',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsBroadcast() const [member function]
cls.add_method('IsBroadcast',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsLinkUp() const [member function]
cls.add_method('IsLinkUp',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsMulticast() const [member function]
cls.add_method('IsMulticast',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsPointToPoint() const [member function]
cls.add_method('IsPointToPoint',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::NeedsArp() const [member function]
cls.add_method('NeedsArp',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::Send(ns3::Ptr<ns3::Packet> packet, ns3::Address const & dest, uint16_t protocolNumber) [member function]
cls.add_method('Send',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::SendFrom(ns3::Ptr<ns3::Packet> packet, ns3::Address const & source, ns3::Address const & dest, uint16_t protocolNumber) [member function]
cls.add_method('SendFrom',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'source'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetAddress(ns3::Address address) [member function]
cls.add_method('SetAddress',
'void',
[param('ns3::Address', 'address')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetIfIndex(uint32_t const index) [member function]
cls.add_method('SetIfIndex',
'void',
[param('uint32_t const', 'index')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::SetMtu(uint16_t const mtu) [member function]
cls.add_method('SetMtu',
'bool',
[param('uint16_t const', 'mtu')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetPromiscReceiveCallback(ns3::NetDevice::PromiscReceiveCallback cb) [member function]
cls.add_method('SetPromiscReceiveCallback',
'void',
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'cb')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetReceiveCallback(ns3::NetDevice::ReceiveCallback cb) [member function]
cls.add_method('SetReceiveCallback',
'void',
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::SupportsSendFrom() const [member function]
cls.add_method('SupportsSendFrom',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3NixVector_methods(root_module, cls):
cls.add_output_stream_operator()
## nix-vector.h (module 'network'): ns3::NixVector::NixVector() [constructor]
cls.add_constructor([])
## nix-vector.h (module 'network'): ns3::NixVector::NixVector(ns3::NixVector const & o) [constructor]
cls.add_constructor([param('ns3::NixVector const &', 'o')])
## nix-vector.h (module 'network'): void ns3::NixVector::AddNeighborIndex(uint32_t newBits, uint32_t numberOfBits) [member function]
cls.add_method('AddNeighborIndex',
'void',
[param('uint32_t', 'newBits'), param('uint32_t', 'numberOfBits')])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::BitCount(uint32_t numberOfNeighbors) const [member function]
cls.add_method('BitCount',
'uint32_t',
[param('uint32_t', 'numberOfNeighbors')],
is_const=True)
## nix-vector.h (module 'network'): ns3::Ptr<ns3::NixVector> ns3::NixVector::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::NixVector >',
[],
is_const=True)
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::Deserialize(uint32_t const * buffer, uint32_t size) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('uint32_t const *', 'buffer'), param('uint32_t', 'size')])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::ExtractNeighborIndex(uint32_t numberOfBits) [member function]
cls.add_method('ExtractNeighborIndex',
'uint32_t',
[param('uint32_t', 'numberOfBits')])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::GetRemainingBits() [member function]
cls.add_method('GetRemainingBits',
'uint32_t',
[])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::Serialize(uint32_t * buffer, uint32_t maxSize) const [member function]
cls.add_method('Serialize',
'uint32_t',
[param('uint32_t *', 'buffer'), param('uint32_t', 'maxSize')],
is_const=True)
return
def register_Ns3Node_methods(root_module, cls):
## node.h (module 'network'): ns3::Node::Node(ns3::Node const & arg0) [constructor]
cls.add_constructor([param('ns3::Node const &', 'arg0')])
## node.h (module 'network'): ns3::Node::Node() [constructor]
cls.add_constructor([])
## node.h (module 'network'): ns3::Node::Node(uint32_t systemId) [constructor]
cls.add_constructor([param('uint32_t', 'systemId')])
## node.h (module 'network'): uint32_t ns3::Node::AddApplication(ns3::Ptr<ns3::Application> application) [member function]
cls.add_method('AddApplication',
'uint32_t',
[param('ns3::Ptr< ns3::Application >', 'application')])
## node.h (module 'network'): uint32_t ns3::Node::AddDevice(ns3::Ptr<ns3::NetDevice> device) [member function]
cls.add_method('AddDevice',
'uint32_t',
[param('ns3::Ptr< ns3::NetDevice >', 'device')])
## node.h (module 'network'): static bool ns3::Node::ChecksumEnabled() [member function]
cls.add_method('ChecksumEnabled',
'bool',
[],
is_static=True)
## node.h (module 'network'): ns3::Ptr<ns3::Application> ns3::Node::GetApplication(uint32_t index) const [member function]
cls.add_method('GetApplication',
'ns3::Ptr< ns3::Application >',
[param('uint32_t', 'index')],
is_const=True)
## node.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::Node::GetDevice(uint32_t index) const [member function]
cls.add_method('GetDevice',
'ns3::Ptr< ns3::NetDevice >',
[param('uint32_t', 'index')],
is_const=True)
## node.h (module 'network'): uint32_t ns3::Node::GetId() const [member function]
cls.add_method('GetId',
'uint32_t',
[],
is_const=True)
## node.h (module 'network'): ns3::Time ns3::Node::GetLocalTime() const [member function]
cls.add_method('GetLocalTime',
'ns3::Time',
[],
is_const=True)
## node.h (module 'network'): uint32_t ns3::Node::GetNApplications() const [member function]
cls.add_method('GetNApplications',
'uint32_t',
[],
is_const=True)
## node.h (module 'network'): uint32_t ns3::Node::GetNDevices() const [member function]
cls.add_method('GetNDevices',
'uint32_t',
[],
is_const=True)
## node.h (module 'network'): uint32_t ns3::Node::GetSystemId() const [member function]
cls.add_method('GetSystemId',
'uint32_t',
[],
is_const=True)
## node.h (module 'network'): static ns3::TypeId ns3::Node::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## node.h (module 'network'): void ns3::Node::RegisterDeviceAdditionListener(ns3::Node::DeviceAdditionListener listener) [member function]
cls.add_method('RegisterDeviceAdditionListener',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'listener')])
## node.h (module 'network'): void ns3::Node::RegisterProtocolHandler(ns3::Node::ProtocolHandler handler, uint16_t protocolType, ns3::Ptr<ns3::NetDevice> device, bool promiscuous=false) [member function]
cls.add_method('RegisterProtocolHandler',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'handler'), param('uint16_t', 'protocolType'), param('ns3::Ptr< ns3::NetDevice >', 'device'), param('bool', 'promiscuous', default_value='false')])
## node.h (module 'network'): void ns3::Node::UnregisterDeviceAdditionListener(ns3::Node::DeviceAdditionListener listener) [member function]
cls.add_method('UnregisterDeviceAdditionListener',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'listener')])
## node.h (module 'network'): void ns3::Node::UnregisterProtocolHandler(ns3::Node::ProtocolHandler handler) [member function]
cls.add_method('UnregisterProtocolHandler',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'handler')])
## node.h (module 'network'): void ns3::Node::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## node.h (module 'network'): void ns3::Node::DoInitialize() [member function]
cls.add_method('DoInitialize',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3NormalRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): ns3::NormalRandomVariable::INFINITE_VALUE [variable]
cls.add_static_attribute('INFINITE_VALUE', 'double const', is_const=True)
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::NormalRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::NormalRandomVariable::NormalRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetMean() const [member function]
cls.add_method('GetMean',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetVariance() const [member function]
cls.add_method('GetVariance',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetBound() const [member function]
cls.add_method('GetBound',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetValue(double mean, double variance, double bound=ns3::NormalRandomVariable::INFINITE_VALUE) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'mean'), param('double', 'variance'), param('double', 'bound', default_value='ns3::NormalRandomVariable::INFINITE_VALUE')])
## random-variable-stream.h (module 'core'): uint32_t ns3::NormalRandomVariable::GetInteger(uint32_t mean, uint32_t variance, uint32_t bound) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'mean'), param('uint32_t', 'variance'), param('uint32_t', 'bound')])
## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::NormalRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3ObjectFactoryChecker_methods(root_module, cls):
## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker() [constructor]
cls.add_constructor([])
## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker(ns3::ObjectFactoryChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::ObjectFactoryChecker const &', 'arg0')])
return
def register_Ns3ObjectFactoryValue_methods(root_module, cls):
## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue() [constructor]
cls.add_constructor([])
## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue(ns3::ObjectFactory const & value) [constructor]
cls.add_constructor([param('ns3::ObjectFactory const &', 'value')])
## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue(ns3::ObjectFactoryValue const & arg0) [constructor]
cls.add_constructor([param('ns3::ObjectFactoryValue const &', 'arg0')])
## object-factory.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::ObjectFactoryValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## object-factory.h (module 'core'): bool ns3::ObjectFactoryValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## object-factory.h (module 'core'): ns3::ObjectFactory ns3::ObjectFactoryValue::Get() const [member function]
cls.add_method('Get',
'ns3::ObjectFactory',
[],
is_const=True)
## object-factory.h (module 'core'): std::string ns3::ObjectFactoryValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## object-factory.h (module 'core'): void ns3::ObjectFactoryValue::Set(ns3::ObjectFactory const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::ObjectFactory const &', 'value')])
return
def register_Ns3Packet_methods(root_module, cls):
cls.add_output_stream_operator()
## packet.h (module 'network'): ns3::Packet::Packet() [constructor]
cls.add_constructor([])
## packet.h (module 'network'): ns3::Packet::Packet(ns3::Packet const & o) [constructor]
cls.add_constructor([param('ns3::Packet const &', 'o')])
## packet.h (module 'network'): ns3::Packet::Packet(uint32_t size) [constructor]
cls.add_constructor([param('uint32_t', 'size')])
## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size, bool magic) [constructor]
cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size'), param('bool', 'magic')])
## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size) [constructor]
cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## packet.h (module 'network'): void ns3::Packet::AddAtEnd(ns3::Ptr<const ns3::Packet> packet) [member function]
cls.add_method('AddAtEnd',
'void',
[param('ns3::Ptr< ns3::Packet const >', 'packet')])
## packet.h (module 'network'): void ns3::Packet::AddByteTag(ns3::Tag const & tag) const [member function]
cls.add_method('AddByteTag',
'void',
[param('ns3::Tag const &', 'tag')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::AddHeader(ns3::Header const & header) [member function]
cls.add_method('AddHeader',
'void',
[param('ns3::Header const &', 'header')])
## packet.h (module 'network'): void ns3::Packet::AddPacketTag(ns3::Tag const & tag) const [member function]
cls.add_method('AddPacketTag',
'void',
[param('ns3::Tag const &', 'tag')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::AddPaddingAtEnd(uint32_t size) [member function]
cls.add_method('AddPaddingAtEnd',
'void',
[param('uint32_t', 'size')])
## packet.h (module 'network'): void ns3::Packet::AddTrailer(ns3::Trailer const & trailer) [member function]
cls.add_method('AddTrailer',
'void',
[param('ns3::Trailer const &', 'trailer')])
## packet.h (module 'network'): ns3::PacketMetadata::ItemIterator ns3::Packet::BeginItem() const [member function]
cls.add_method('BeginItem',
'ns3::PacketMetadata::ItemIterator',
[],
is_const=True)
## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::Packet >',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::CopyData(uint8_t * buffer, uint32_t size) const [member function]
cls.add_method('CopyData',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::CopyData(std::ostream * os, uint32_t size) const [member function]
cls.add_method('CopyData',
'void',
[param('std::ostream *', 'os'), param('uint32_t', 'size')],
is_const=True)
## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::CreateFragment(uint32_t start, uint32_t length) const [member function]
cls.add_method('CreateFragment',
'ns3::Ptr< ns3::Packet >',
[param('uint32_t', 'start'), param('uint32_t', 'length')],
is_const=True)
## packet.h (module 'network'): static void ns3::Packet::EnableChecking() [member function]
cls.add_method('EnableChecking',
'void',
[],
is_static=True)
## packet.h (module 'network'): static void ns3::Packet::EnablePrinting() [member function]
cls.add_method('EnablePrinting',
'void',
[],
is_static=True)
## packet.h (module 'network'): bool ns3::Packet::FindFirstMatchingByteTag(ns3::Tag & tag) const [member function]
cls.add_method('FindFirstMatchingByteTag',
'bool',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet.h (module 'network'): ns3::ByteTagIterator ns3::Packet::GetByteTagIterator() const [member function]
cls.add_method('GetByteTagIterator',
'ns3::ByteTagIterator',
[],
is_const=True)
## packet.h (module 'network'): ns3::Ptr<ns3::NixVector> ns3::Packet::GetNixVector() const [member function]
cls.add_method('GetNixVector',
'ns3::Ptr< ns3::NixVector >',
[],
is_const=True)
## packet.h (module 'network'): ns3::PacketTagIterator ns3::Packet::GetPacketTagIterator() const [member function]
cls.add_method('GetPacketTagIterator',
'ns3::PacketTagIterator',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::GetSize() const [member function]
cls.add_method('GetSize',
'uint32_t',
[],
is_const=True)
## packet.h (module 'network'): uint64_t ns3::Packet::GetUid() const [member function]
cls.add_method('GetUid',
'uint64_t',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::PeekHeader(ns3::Header & header) const [member function]
cls.add_method('PeekHeader',
'uint32_t',
[param('ns3::Header &', 'header')],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::PeekHeader(ns3::Header & header, uint32_t size) const [member function]
cls.add_method('PeekHeader',
'uint32_t',
[param('ns3::Header &', 'header'), param('uint32_t', 'size')],
is_const=True)
## packet.h (module 'network'): bool ns3::Packet::PeekPacketTag(ns3::Tag & tag) const [member function]
cls.add_method('PeekPacketTag',
'bool',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::PeekTrailer(ns3::Trailer & trailer) [member function]
cls.add_method('PeekTrailer',
'uint32_t',
[param('ns3::Trailer &', 'trailer')])
## packet.h (module 'network'): void ns3::Packet::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::PrintByteTags(std::ostream & os) const [member function]
cls.add_method('PrintByteTags',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::PrintPacketTags(std::ostream & os) const [member function]
cls.add_method('PrintPacketTags',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::RemoveAllByteTags() [member function]
cls.add_method('RemoveAllByteTags',
'void',
[])
## packet.h (module 'network'): void ns3::Packet::RemoveAllPacketTags() [member function]
cls.add_method('RemoveAllPacketTags',
'void',
[])
## packet.h (module 'network'): void ns3::Packet::RemoveAtEnd(uint32_t size) [member function]
cls.add_method('RemoveAtEnd',
'void',
[param('uint32_t', 'size')])
## packet.h (module 'network'): void ns3::Packet::RemoveAtStart(uint32_t size) [member function]
cls.add_method('RemoveAtStart',
'void',
[param('uint32_t', 'size')])
## packet.h (module 'network'): uint32_t ns3::Packet::RemoveHeader(ns3::Header & header) [member function]
cls.add_method('RemoveHeader',
'uint32_t',
[param('ns3::Header &', 'header')])
## packet.h (module 'network'): uint32_t ns3::Packet::RemoveHeader(ns3::Header & header, uint32_t size) [member function]
cls.add_method('RemoveHeader',
'uint32_t',
[param('ns3::Header &', 'header'), param('uint32_t', 'size')])
## packet.h (module 'network'): bool ns3::Packet::RemovePacketTag(ns3::Tag & tag) [member function]
cls.add_method('RemovePacketTag',
'bool',
[param('ns3::Tag &', 'tag')])
## packet.h (module 'network'): uint32_t ns3::Packet::RemoveTrailer(ns3::Trailer & trailer) [member function]
cls.add_method('RemoveTrailer',
'uint32_t',
[param('ns3::Trailer &', 'trailer')])
## packet.h (module 'network'): bool ns3::Packet::ReplacePacketTag(ns3::Tag & tag) [member function]
cls.add_method('ReplacePacketTag',
'bool',
[param('ns3::Tag &', 'tag')])
## packet.h (module 'network'): uint32_t ns3::Packet::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function]
cls.add_method('Serialize',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::SetNixVector(ns3::Ptr<ns3::NixVector> nixVector) [member function]
cls.add_method('SetNixVector',
'void',
[param('ns3::Ptr< ns3::NixVector >', 'nixVector')])
## packet.h (module 'network'): std::string ns3::Packet::ToString() const [member function]
cls.add_method('ToString',
'std::string',
[],
is_const=True)
return
def register_Ns3ParetoRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ParetoRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::ParetoRandomVariable::ParetoRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::ParetoRandomVariable::GetMean() const [member function]
cls.add_method('GetMean',
'double',
[],
deprecated=True, is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ParetoRandomVariable::GetScale() const [member function]
cls.add_method('GetScale',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ParetoRandomVariable::GetShape() const [member function]
cls.add_method('GetShape',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ParetoRandomVariable::GetBound() const [member function]
cls.add_method('GetBound',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ParetoRandomVariable::GetValue(double scale, double shape, double bound) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'scale'), param('double', 'shape'), param('double', 'bound')])
## random-variable-stream.h (module 'core'): uint32_t ns3::ParetoRandomVariable::GetInteger(uint32_t scale, uint32_t shape, uint32_t bound) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'scale'), param('uint32_t', 'shape'), param('uint32_t', 'bound')])
## random-variable-stream.h (module 'core'): double ns3::ParetoRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::ParetoRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3Ping6_methods(root_module, cls):
## ping6.h (module 'internet-apps'): ns3::Ping6::Ping6(ns3::Ping6 const & arg0) [constructor]
cls.add_constructor([param('ns3::Ping6 const &', 'arg0')])
## ping6.h (module 'internet-apps'): ns3::Ping6::Ping6() [constructor]
cls.add_constructor([])
## ping6.h (module 'internet-apps'): static ns3::TypeId ns3::Ping6::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ping6.h (module 'internet-apps'): void ns3::Ping6::SetIfIndex(uint32_t ifIndex) [member function]
cls.add_method('SetIfIndex',
'void',
[param('uint32_t', 'ifIndex')])
## ping6.h (module 'internet-apps'): void ns3::Ping6::SetLocal(ns3::Ipv6Address ipv6) [member function]
cls.add_method('SetLocal',
'void',
[param('ns3::Ipv6Address', 'ipv6')])
## ping6.h (module 'internet-apps'): void ns3::Ping6::SetRemote(ns3::Ipv6Address ipv6) [member function]
cls.add_method('SetRemote',
'void',
[param('ns3::Ipv6Address', 'ipv6')])
## ping6.h (module 'internet-apps'): void ns3::Ping6::SetRouters(std::vector<ns3::Ipv6Address, std::allocator<ns3::Ipv6Address> > routers) [member function]
cls.add_method('SetRouters',
'void',
[param('std::vector< ns3::Ipv6Address >', 'routers')])
## ping6.h (module 'internet-apps'): void ns3::Ping6::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## ping6.h (module 'internet-apps'): void ns3::Ping6::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## ping6.h (module 'internet-apps'): void ns3::Ping6::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3Radvd_methods(root_module, cls):
## radvd.h (module 'internet-apps'): ns3::Radvd::Radvd(ns3::Radvd const & arg0) [constructor]
cls.add_constructor([param('ns3::Radvd const &', 'arg0')])
## radvd.h (module 'internet-apps'): ns3::Radvd::Radvd() [constructor]
cls.add_constructor([])
## radvd.h (module 'internet-apps'): void ns3::Radvd::AddConfiguration(ns3::Ptr<ns3::RadvdInterface> routerInterface) [member function]
cls.add_method('AddConfiguration',
'void',
[param('ns3::Ptr< ns3::RadvdInterface >', 'routerInterface')])
## radvd.h (module 'internet-apps'): int64_t ns3::Radvd::AssignStreams(int64_t stream) [member function]
cls.add_method('AssignStreams',
'int64_t',
[param('int64_t', 'stream')])
## radvd.h (module 'internet-apps'): static ns3::TypeId ns3::Radvd::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## radvd.h (module 'internet-apps'): ns3::Radvd::MAX_INITIAL_RTR_ADVERTISEMENTS [variable]
cls.add_static_attribute('MAX_INITIAL_RTR_ADVERTISEMENTS', 'uint32_t const', is_const=True)
## radvd.h (module 'internet-apps'): ns3::Radvd::MAX_INITIAL_RTR_ADVERT_INTERVAL [variable]
cls.add_static_attribute('MAX_INITIAL_RTR_ADVERT_INTERVAL', 'uint32_t const', is_const=True)
## radvd.h (module 'internet-apps'): ns3::Radvd::MAX_RA_DELAY_TIME [variable]
cls.add_static_attribute('MAX_RA_DELAY_TIME', 'uint32_t const', is_const=True)
## radvd.h (module 'internet-apps'): ns3::Radvd::MIN_DELAY_BETWEEN_RAS [variable]
cls.add_static_attribute('MIN_DELAY_BETWEEN_RAS', 'uint32_t const', is_const=True)
## radvd.h (module 'internet-apps'): void ns3::Radvd::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## radvd.h (module 'internet-apps'): void ns3::Radvd::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## radvd.h (module 'internet-apps'): void ns3::Radvd::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3RadvdInterface_methods(root_module, cls):
## radvd-interface.h (module 'internet-apps'): ns3::RadvdInterface::RadvdInterface(ns3::RadvdInterface const & arg0) [constructor]
cls.add_constructor([param('ns3::RadvdInterface const &', 'arg0')])
## radvd-interface.h (module 'internet-apps'): ns3::RadvdInterface::RadvdInterface(uint32_t interface) [constructor]
cls.add_constructor([param('uint32_t', 'interface')])
## radvd-interface.h (module 'internet-apps'): ns3::RadvdInterface::RadvdInterface(uint32_t interface, uint32_t maxRtrAdvInterval, uint32_t minRtrAdvInterval) [constructor]
cls.add_constructor([param('uint32_t', 'interface'), param('uint32_t', 'maxRtrAdvInterval'), param('uint32_t', 'minRtrAdvInterval')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::AddPrefix(ns3::Ptr<ns3::RadvdPrefix> routerPrefix) [member function]
cls.add_method('AddPrefix',
'void',
[param('ns3::Ptr< ns3::RadvdPrefix >', 'routerPrefix')])
## radvd-interface.h (module 'internet-apps'): uint8_t ns3::RadvdInterface::GetCurHopLimit() const [member function]
cls.add_method('GetCurHopLimit',
'uint8_t',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): uint32_t ns3::RadvdInterface::GetDefaultLifeTime() const [member function]
cls.add_method('GetDefaultLifeTime',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): uint8_t ns3::RadvdInterface::GetDefaultPreference() const [member function]
cls.add_method('GetDefaultPreference',
'uint8_t',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): uint32_t ns3::RadvdInterface::GetHomeAgentLifeTime() const [member function]
cls.add_method('GetHomeAgentLifeTime',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): uint32_t ns3::RadvdInterface::GetHomeAgentPreference() const [member function]
cls.add_method('GetHomeAgentPreference',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): uint32_t ns3::RadvdInterface::GetInterface() const [member function]
cls.add_method('GetInterface',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): ns3::Time ns3::RadvdInterface::GetLastRaTxTime() [member function]
cls.add_method('GetLastRaTxTime',
'ns3::Time',
[])
## radvd-interface.h (module 'internet-apps'): uint32_t ns3::RadvdInterface::GetLinkMtu() const [member function]
cls.add_method('GetLinkMtu',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): uint32_t ns3::RadvdInterface::GetMaxRtrAdvInterval() const [member function]
cls.add_method('GetMaxRtrAdvInterval',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): uint32_t ns3::RadvdInterface::GetMinDelayBetweenRAs() const [member function]
cls.add_method('GetMinDelayBetweenRAs',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): uint32_t ns3::RadvdInterface::GetMinRtrAdvInterval() const [member function]
cls.add_method('GetMinRtrAdvInterval',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): ns3::RadvdInterface::RadvdPrefixList ns3::RadvdInterface::GetPrefixes() const [member function]
cls.add_method('GetPrefixes',
'ns3::RadvdInterface::RadvdPrefixList',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): uint32_t ns3::RadvdInterface::GetReachableTime() const [member function]
cls.add_method('GetReachableTime',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): uint32_t ns3::RadvdInterface::GetRetransTimer() const [member function]
cls.add_method('GetRetransTimer',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): bool ns3::RadvdInterface::IsHomeAgentFlag() const [member function]
cls.add_method('IsHomeAgentFlag',
'bool',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): bool ns3::RadvdInterface::IsHomeAgentInfo() const [member function]
cls.add_method('IsHomeAgentInfo',
'bool',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): bool ns3::RadvdInterface::IsInitialRtrAdv() [member function]
cls.add_method('IsInitialRtrAdv',
'bool',
[])
## radvd-interface.h (module 'internet-apps'): bool ns3::RadvdInterface::IsIntervalOpt() const [member function]
cls.add_method('IsIntervalOpt',
'bool',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): bool ns3::RadvdInterface::IsManagedFlag() const [member function]
cls.add_method('IsManagedFlag',
'bool',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): bool ns3::RadvdInterface::IsMobRtrSupportFlag() const [member function]
cls.add_method('IsMobRtrSupportFlag',
'bool',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): bool ns3::RadvdInterface::IsOtherConfigFlag() const [member function]
cls.add_method('IsOtherConfigFlag',
'bool',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): bool ns3::RadvdInterface::IsSendAdvert() const [member function]
cls.add_method('IsSendAdvert',
'bool',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): bool ns3::RadvdInterface::IsSourceLLAddress() const [member function]
cls.add_method('IsSourceLLAddress',
'bool',
[],
is_const=True)
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetCurHopLimit(uint8_t curHopLimit) [member function]
cls.add_method('SetCurHopLimit',
'void',
[param('uint8_t', 'curHopLimit')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetDefaultLifeTime(uint32_t defaultLifeTime) [member function]
cls.add_method('SetDefaultLifeTime',
'void',
[param('uint32_t', 'defaultLifeTime')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetDefaultPreference(uint8_t defaultPreference) [member function]
cls.add_method('SetDefaultPreference',
'void',
[param('uint8_t', 'defaultPreference')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetHomeAgentFlag(bool homeAgentFlag) [member function]
cls.add_method('SetHomeAgentFlag',
'void',
[param('bool', 'homeAgentFlag')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetHomeAgentInfo(bool homeAgentFlag) [member function]
cls.add_method('SetHomeAgentInfo',
'void',
[param('bool', 'homeAgentFlag')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetHomeAgentLifeTime(uint32_t homeAgentLifeTime) [member function]
cls.add_method('SetHomeAgentLifeTime',
'void',
[param('uint32_t', 'homeAgentLifeTime')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetHomeAgentPreference(uint32_t homeAgentPreference) [member function]
cls.add_method('SetHomeAgentPreference',
'void',
[param('uint32_t', 'homeAgentPreference')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetIntervalOpt(bool intervalOpt) [member function]
cls.add_method('SetIntervalOpt',
'void',
[param('bool', 'intervalOpt')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetLastRaTxTime(ns3::Time now) [member function]
cls.add_method('SetLastRaTxTime',
'void',
[param('ns3::Time', 'now')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetLinkMtu(uint32_t linkMtu) [member function]
cls.add_method('SetLinkMtu',
'void',
[param('uint32_t', 'linkMtu')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetManagedFlag(bool managedFlag) [member function]
cls.add_method('SetManagedFlag',
'void',
[param('bool', 'managedFlag')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetMaxRtrAdvInterval(uint32_t maxRtrAdvInterval) [member function]
cls.add_method('SetMaxRtrAdvInterval',
'void',
[param('uint32_t', 'maxRtrAdvInterval')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetMinDelayBetweenRAs(uint32_t minDelayBetweenRAs) [member function]
cls.add_method('SetMinDelayBetweenRAs',
'void',
[param('uint32_t', 'minDelayBetweenRAs')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetMinRtrAdvInterval(uint32_t minRtrAdvInterval) [member function]
cls.add_method('SetMinRtrAdvInterval',
'void',
[param('uint32_t', 'minRtrAdvInterval')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetMobRtrSupportFlag(bool mobRtrSupportFlag) [member function]
cls.add_method('SetMobRtrSupportFlag',
'void',
[param('bool', 'mobRtrSupportFlag')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetOtherConfigFlag(bool otherConfigFlag) [member function]
cls.add_method('SetOtherConfigFlag',
'void',
[param('bool', 'otherConfigFlag')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetReachableTime(uint32_t reachableTime) [member function]
cls.add_method('SetReachableTime',
'void',
[param('uint32_t', 'reachableTime')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetRetransTimer(uint32_t retransTimer) [member function]
cls.add_method('SetRetransTimer',
'void',
[param('uint32_t', 'retransTimer')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetSendAdvert(bool sendAdvert) [member function]
cls.add_method('SetSendAdvert',
'void',
[param('bool', 'sendAdvert')])
## radvd-interface.h (module 'internet-apps'): void ns3::RadvdInterface::SetSourceLLAddress(bool sourceLLAddress) [member function]
cls.add_method('SetSourceLLAddress',
'void',
[param('bool', 'sourceLLAddress')])
return
def register_Ns3RadvdPrefix_methods(root_module, cls):
## radvd-prefix.h (module 'internet-apps'): ns3::RadvdPrefix::RadvdPrefix(ns3::RadvdPrefix const & arg0) [constructor]
cls.add_constructor([param('ns3::RadvdPrefix const &', 'arg0')])
## radvd-prefix.h (module 'internet-apps'): ns3::RadvdPrefix::RadvdPrefix(ns3::Ipv6Address network, uint8_t prefixLength, uint32_t preferredLifeTime=604800, uint32_t validLifeTime=2592000, bool onLinkFlag=true, bool autonomousFlag=true, bool routerAddrFlag=false) [constructor]
cls.add_constructor([param('ns3::Ipv6Address', 'network'), param('uint8_t', 'prefixLength'), param('uint32_t', 'preferredLifeTime', default_value='604800'), param('uint32_t', 'validLifeTime', default_value='2592000'), param('bool', 'onLinkFlag', default_value='true'), param('bool', 'autonomousFlag', default_value='true'), param('bool', 'routerAddrFlag', default_value='false')])
## radvd-prefix.h (module 'internet-apps'): ns3::Ipv6Address ns3::RadvdPrefix::GetNetwork() const [member function]
cls.add_method('GetNetwork',
'ns3::Ipv6Address',
[],
is_const=True)
## radvd-prefix.h (module 'internet-apps'): uint32_t ns3::RadvdPrefix::GetPreferredLifeTime() const [member function]
cls.add_method('GetPreferredLifeTime',
'uint32_t',
[],
is_const=True)
## radvd-prefix.h (module 'internet-apps'): uint8_t ns3::RadvdPrefix::GetPrefixLength() const [member function]
cls.add_method('GetPrefixLength',
'uint8_t',
[],
is_const=True)
## radvd-prefix.h (module 'internet-apps'): uint32_t ns3::RadvdPrefix::GetValidLifeTime() const [member function]
cls.add_method('GetValidLifeTime',
'uint32_t',
[],
is_const=True)
## radvd-prefix.h (module 'internet-apps'): bool ns3::RadvdPrefix::IsAutonomousFlag() const [member function]
cls.add_method('IsAutonomousFlag',
'bool',
[],
is_const=True)
## radvd-prefix.h (module 'internet-apps'): bool ns3::RadvdPrefix::IsOnLinkFlag() const [member function]
cls.add_method('IsOnLinkFlag',
'bool',
[],
is_const=True)
## radvd-prefix.h (module 'internet-apps'): bool ns3::RadvdPrefix::IsRouterAddrFlag() const [member function]
cls.add_method('IsRouterAddrFlag',
'bool',
[],
is_const=True)
## radvd-prefix.h (module 'internet-apps'): void ns3::RadvdPrefix::SetAutonomousFlag(bool autonomousFlag) [member function]
cls.add_method('SetAutonomousFlag',
'void',
[param('bool', 'autonomousFlag')])
## radvd-prefix.h (module 'internet-apps'): void ns3::RadvdPrefix::SetNetwork(ns3::Ipv6Address network) [member function]
cls.add_method('SetNetwork',
'void',
[param('ns3::Ipv6Address', 'network')])
## radvd-prefix.h (module 'internet-apps'): void ns3::RadvdPrefix::SetOnLinkFlag(bool onLinkFlag) [member function]
cls.add_method('SetOnLinkFlag',
'void',
[param('bool', 'onLinkFlag')])
## radvd-prefix.h (module 'internet-apps'): void ns3::RadvdPrefix::SetPreferredLifeTime(uint32_t preferredLifeTime) [member function]
cls.add_method('SetPreferredLifeTime',
'void',
[param('uint32_t', 'preferredLifeTime')])
## radvd-prefix.h (module 'internet-apps'): void ns3::RadvdPrefix::SetPrefixLength(uint8_t prefixLength) [member function]
cls.add_method('SetPrefixLength',
'void',
[param('uint8_t', 'prefixLength')])
## radvd-prefix.h (module 'internet-apps'): void ns3::RadvdPrefix::SetRouterAddrFlag(bool routerAddrFlag) [member function]
cls.add_method('SetRouterAddrFlag',
'void',
[param('bool', 'routerAddrFlag')])
## radvd-prefix.h (module 'internet-apps'): void ns3::RadvdPrefix::SetValidLifeTime(uint32_t validLifeTime) [member function]
cls.add_method('SetValidLifeTime',
'void',
[param('uint32_t', 'validLifeTime')])
return
def register_Ns3TimeValue_methods(root_module, cls):
## nstime.h (module 'core'): ns3::TimeValue::TimeValue() [constructor]
cls.add_constructor([])
## nstime.h (module 'core'): ns3::TimeValue::TimeValue(ns3::Time const & value) [constructor]
cls.add_constructor([param('ns3::Time const &', 'value')])
## nstime.h (module 'core'): ns3::TimeValue::TimeValue(ns3::TimeValue const & arg0) [constructor]
cls.add_constructor([param('ns3::TimeValue const &', 'arg0')])
## nstime.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TimeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## nstime.h (module 'core'): bool ns3::TimeValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## nstime.h (module 'core'): ns3::Time ns3::TimeValue::Get() const [member function]
cls.add_method('Get',
'ns3::Time',
[],
is_const=True)
## nstime.h (module 'core'): std::string ns3::TimeValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## nstime.h (module 'core'): void ns3::TimeValue::Set(ns3::Time const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Time const &', 'value')])
return
def register_Ns3TypeIdChecker_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker(ns3::TypeIdChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::TypeIdChecker const &', 'arg0')])
return
def register_Ns3TypeIdValue_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeId const & value) [constructor]
cls.add_constructor([param('ns3::TypeId const &', 'value')])
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeIdValue const & arg0) [constructor]
cls.add_constructor([param('ns3::TypeIdValue const &', 'arg0')])
## type-id.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TypeIdValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## type-id.h (module 'core'): bool ns3::TypeIdValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeIdValue::Get() const [member function]
cls.add_method('Get',
'ns3::TypeId',
[],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeIdValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## type-id.h (module 'core'): void ns3::TypeIdValue::Set(ns3::TypeId const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::TypeId const &', 'value')])
return
def register_Ns3UintegerValue_methods(root_module, cls):
## uinteger.h (module 'core'): ns3::UintegerValue::UintegerValue() [constructor]
cls.add_constructor([])
## uinteger.h (module 'core'): ns3::UintegerValue::UintegerValue(uint64_t const & value) [constructor]
cls.add_constructor([param('uint64_t const &', 'value')])
## uinteger.h (module 'core'): ns3::UintegerValue::UintegerValue(ns3::UintegerValue const & arg0) [constructor]
cls.add_constructor([param('ns3::UintegerValue const &', 'arg0')])
## uinteger.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::UintegerValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## uinteger.h (module 'core'): bool ns3::UintegerValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## uinteger.h (module 'core'): uint64_t ns3::UintegerValue::Get() const [member function]
cls.add_method('Get',
'uint64_t',
[],
is_const=True)
## uinteger.h (module 'core'): std::string ns3::UintegerValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## uinteger.h (module 'core'): void ns3::UintegerValue::Set(uint64_t const & value) [member function]
cls.add_method('Set',
'void',
[param('uint64_t const &', 'value')])
return
def register_Ns3V4Ping_methods(root_module, cls):
## v4ping.h (module 'internet-apps'): ns3::V4Ping::V4Ping(ns3::V4Ping const & arg0) [constructor]
cls.add_constructor([param('ns3::V4Ping const &', 'arg0')])
## v4ping.h (module 'internet-apps'): ns3::V4Ping::V4Ping() [constructor]
cls.add_constructor([])
## v4ping.h (module 'internet-apps'): static ns3::TypeId ns3::V4Ping::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## v4ping.h (module 'internet-apps'): void ns3::V4Ping::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='private', is_virtual=True)
## v4ping.h (module 'internet-apps'): void ns3::V4Ping::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## v4ping.h (module 'internet-apps'): void ns3::V4Ping::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3AddressChecker_methods(root_module, cls):
## address.h (module 'network'): ns3::AddressChecker::AddressChecker() [constructor]
cls.add_constructor([])
## address.h (module 'network'): ns3::AddressChecker::AddressChecker(ns3::AddressChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::AddressChecker const &', 'arg0')])
return
def register_Ns3AddressValue_methods(root_module, cls):
## address.h (module 'network'): ns3::AddressValue::AddressValue() [constructor]
cls.add_constructor([])
## address.h (module 'network'): ns3::AddressValue::AddressValue(ns3::Address const & value) [constructor]
cls.add_constructor([param('ns3::Address const &', 'value')])
## address.h (module 'network'): ns3::AddressValue::AddressValue(ns3::AddressValue const & arg0) [constructor]
cls.add_constructor([param('ns3::AddressValue const &', 'arg0')])
## address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## address.h (module 'network'): bool ns3::AddressValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## address.h (module 'network'): ns3::Address ns3::AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Address',
[],
is_const=True)
## address.h (module 'network'): std::string ns3::AddressValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## address.h (module 'network'): void ns3::AddressValue::Set(ns3::Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Address const &', 'value')])
return
def register_Ns3CallbackImpl__Bool_Ns3Ptr__lt__ns3Socket__gt___Const_ns3Address___amp___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<bool, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<bool, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<bool, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< bool, ns3::Ptr< ns3::Socket >, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<bool, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<bool, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): bool ns3::CallbackImpl<bool, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ptr<ns3::Socket> arg0, ns3::Address const & arg1) [member operator]
cls.add_method('operator()',
'bool',
[param('ns3::Ptr< ns3::Socket >', 'arg0'), param('ns3::Address const &', 'arg1')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Ns3ObjectBase___star___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): ns3::ObjectBase * ns3::CallbackImpl<ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()() [member operator]
cls.add_method('operator()',
'ns3::ObjectBase *',
[],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Void_Const_ns3Ipv4Address___amp___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, const ns3::Ipv4Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<void, const ns3::Ipv4Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, const ns3::Ipv4Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< void, ns3::Ipv4Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<void, const ns3::Ipv4Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<void, const ns3::Ipv4Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackImpl<void, const ns3::Ipv4Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ipv4Address const & arg0) [member operator]
cls.add_method('operator()',
'void',
[param('ns3::Ipv4Address const &', 'arg0')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3NetDevice__gt___Ns3Ptr__lt__const_ns3Packet__gt___Unsigned_short_Const_ns3Address___amp___Const_ns3Address___amp___Ns3NetDevicePacketType_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ptr<ns3::NetDevice> arg0, ns3::Ptr<const ns3::Packet> arg1, short unsigned int arg2, ns3::Address const & arg3, ns3::Address const & arg4, ns3::NetDevice::PacketType arg5) [member operator]
cls.add_method('operator()',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'arg0'), param('ns3::Ptr< ns3::Packet const >', 'arg1'), param('short unsigned int', 'arg2'), param('ns3::Address const &', 'arg3'), param('ns3::Address const &', 'arg4'), param('ns3::NetDevice::PacketType', 'arg5')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3NetDevice__gt___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ptr<ns3::NetDevice> arg0) [member operator]
cls.add_method('operator()',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'arg0')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3Socket__gt___Const_ns3Address___amp___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< void, ns3::Ptr< ns3::Socket >, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ptr<ns3::Socket> arg0, ns3::Address const & arg1) [member operator]
cls.add_method('operator()',
'void',
[param('ns3::Ptr< ns3::Socket >', 'arg0'), param('ns3::Address const &', 'arg1')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3Socket__gt___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ptr<ns3::Socket> arg0) [member operator]
cls.add_method('operator()',
'void',
[param('ns3::Ptr< ns3::Socket >', 'arg0')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3Socket__gt___Unsigned_int_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< void, ns3::Ptr< ns3::Socket >, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ptr<ns3::Socket> arg0, unsigned int arg1) [member operator]
cls.add_method('operator()',
'void',
[param('ns3::Ptr< ns3::Socket >', 'arg0'), param('unsigned int', 'arg1')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Void_Ns3Time_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Time, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Time, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, ns3::Time, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< void, ns3::Time, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<void, ns3::Time, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<void, ns3::Time, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackImpl<void, ns3::Time, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Time arg0) [member operator]
cls.add_method('operator()',
'void',
[param('ns3::Time', 'arg0')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3HashImplementation_methods(root_module, cls):
## hash-function.h (module 'core'): ns3::Hash::Implementation::Implementation(ns3::Hash::Implementation const & arg0) [constructor]
cls.add_constructor([param('ns3::Hash::Implementation const &', 'arg0')])
## hash-function.h (module 'core'): ns3::Hash::Implementation::Implementation() [constructor]
cls.add_constructor([])
## hash-function.h (module 'core'): uint32_t ns3::Hash::Implementation::GetHash32(char const * buffer, std::size_t const size) [member function]
cls.add_method('GetHash32',
'uint32_t',
[param('char const *', 'buffer'), param('std::size_t const', 'size')],
is_pure_virtual=True, is_virtual=True)
## hash-function.h (module 'core'): uint64_t ns3::Hash::Implementation::GetHash64(char const * buffer, std::size_t const size) [member function]
cls.add_method('GetHash64',
'uint64_t',
[param('char const *', 'buffer'), param('std::size_t const', 'size')],
is_virtual=True)
## hash-function.h (module 'core'): void ns3::Hash::Implementation::clear() [member function]
cls.add_method('clear',
'void',
[],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3HashFunctionFnv1a_methods(root_module, cls):
## hash-fnv.h (module 'core'): ns3::Hash::Function::Fnv1a::Fnv1a(ns3::Hash::Function::Fnv1a const & arg0) [constructor]
cls.add_constructor([param('ns3::Hash::Function::Fnv1a const &', 'arg0')])
## hash-fnv.h (module 'core'): ns3::Hash::Function::Fnv1a::Fnv1a() [constructor]
cls.add_constructor([])
## hash-fnv.h (module 'core'): uint32_t ns3::Hash::Function::Fnv1a::GetHash32(char const * buffer, size_t const size) [member function]
cls.add_method('GetHash32',
'uint32_t',
[param('char const *', 'buffer'), param('size_t const', 'size')],
is_virtual=True)
## hash-fnv.h (module 'core'): uint64_t ns3::Hash::Function::Fnv1a::GetHash64(char const * buffer, size_t const size) [member function]
cls.add_method('GetHash64',
'uint64_t',
[param('char const *', 'buffer'), param('size_t const', 'size')],
is_virtual=True)
## hash-fnv.h (module 'core'): void ns3::Hash::Function::Fnv1a::clear() [member function]
cls.add_method('clear',
'void',
[],
is_virtual=True)
return
def register_Ns3HashFunctionHash32_methods(root_module, cls):
## hash-function.h (module 'core'): ns3::Hash::Function::Hash32::Hash32(ns3::Hash::Function::Hash32 const & arg0) [constructor]
cls.add_constructor([param('ns3::Hash::Function::Hash32 const &', 'arg0')])
## hash-function.h (module 'core'): ns3::Hash::Function::Hash32::Hash32(ns3::Hash::Hash32Function_ptr hp) [constructor]
cls.add_constructor([param('ns3::Hash::Hash32Function_ptr', 'hp')])
## hash-function.h (module 'core'): uint32_t ns3::Hash::Function::Hash32::GetHash32(char const * buffer, std::size_t const size) [member function]
cls.add_method('GetHash32',
'uint32_t',
[param('char const *', 'buffer'), param('std::size_t const', 'size')],
is_virtual=True)
## hash-function.h (module 'core'): void ns3::Hash::Function::Hash32::clear() [member function]
cls.add_method('clear',
'void',
[],
is_virtual=True)
return
def register_Ns3HashFunctionHash64_methods(root_module, cls):
## hash-function.h (module 'core'): ns3::Hash::Function::Hash64::Hash64(ns3::Hash::Function::Hash64 const & arg0) [constructor]
cls.add_constructor([param('ns3::Hash::Function::Hash64 const &', 'arg0')])
## hash-function.h (module 'core'): ns3::Hash::Function::Hash64::Hash64(ns3::Hash::Hash64Function_ptr hp) [constructor]
cls.add_constructor([param('ns3::Hash::Hash64Function_ptr', 'hp')])
## hash-function.h (module 'core'): uint32_t ns3::Hash::Function::Hash64::GetHash32(char const * buffer, std::size_t const size) [member function]
cls.add_method('GetHash32',
'uint32_t',
[param('char const *', 'buffer'), param('std::size_t const', 'size')],
is_virtual=True)
## hash-function.h (module 'core'): uint64_t ns3::Hash::Function::Hash64::GetHash64(char const * buffer, std::size_t const size) [member function]
cls.add_method('GetHash64',
'uint64_t',
[param('char const *', 'buffer'), param('std::size_t const', 'size')],
is_virtual=True)
## hash-function.h (module 'core'): void ns3::Hash::Function::Hash64::clear() [member function]
cls.add_method('clear',
'void',
[],
is_virtual=True)
return
def register_Ns3HashFunctionMurmur3_methods(root_module, cls):
## hash-murmur3.h (module 'core'): ns3::Hash::Function::Murmur3::Murmur3(ns3::Hash::Function::Murmur3 const & arg0) [constructor]
cls.add_constructor([param('ns3::Hash::Function::Murmur3 const &', 'arg0')])
## hash-murmur3.h (module 'core'): ns3::Hash::Function::Murmur3::Murmur3() [constructor]
cls.add_constructor([])
## hash-murmur3.h (module 'core'): uint32_t ns3::Hash::Function::Murmur3::GetHash32(char const * buffer, std::size_t const size) [member function]
cls.add_method('GetHash32',
'uint32_t',
[param('char const *', 'buffer'), param('std::size_t const', 'size')],
is_virtual=True)
## hash-murmur3.h (module 'core'): uint64_t ns3::Hash::Function::Murmur3::GetHash64(char const * buffer, std::size_t const size) [member function]
cls.add_method('GetHash64',
'uint64_t',
[param('char const *', 'buffer'), param('std::size_t const', 'size')],
is_virtual=True)
## hash-murmur3.h (module 'core'): void ns3::Hash::Function::Murmur3::clear() [member function]
cls.add_method('clear',
'void',
[],
is_virtual=True)
return
def register_functions(root_module):
module = root_module
register_functions_ns3_FatalImpl(module.add_cpp_namespace('FatalImpl'), root_module)
register_functions_ns3_Hash(module.add_cpp_namespace('Hash'), root_module)
register_functions_ns3_TracedValueCallback(module.add_cpp_namespace('TracedValueCallback'), root_module)
register_functions_ns3_internal(module.add_cpp_namespace('internal'), root_module)
return
def register_functions_ns3_FatalImpl(module, root_module):
return
def register_functions_ns3_Hash(module, root_module):
register_functions_ns3_Hash_Function(module.add_cpp_namespace('Function'), root_module)
return
def register_functions_ns3_Hash_Function(module, root_module):
return
def register_functions_ns3_TracedValueCallback(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return
def main():
out = FileCodeSink(sys.stdout)
root_module = module_init()
register_types(root_module)
register_methods(root_module)
register_functions(root_module)
root_module.generate(out)
if __name__ == '__main__':
main()
| named-data-ndnSIM/ns-3-dev | src/internet-apps/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 523,787 |
import os
def find_database(dbname):
cwd = os.getcwd()
while True:
dbpath = os.path.join(cwd,dbname)
if os.path.isfile(dbpath):
return dbpath
nwd = os.path.dirname(cwd)
if (nwd == cwd or not os.path.isdir(nwd)):
return None
cwd = nwd
database = find_database('taqi.db')
wiki_root = os.path.dirname(database)
print wiki_root
| lionicsheriff/tagi | tagi/tagi.py | Python | mit | 440 |
import pytest
@pytest.mark.bashcomp(cmd="deja-dup")
class TestDejaDup:
@pytest.mark.complete("deja-dup -", require_cmd=True)
def test_1(self, completion):
assert completion
@pytest.mark.complete("deja-dup --help ")
def test_2(self, completion):
assert not completion
| algorythmic/bash-completion | test/t/test_deja_dup.py | Python | gpl-2.0 | 302 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""
Objects relating to sourcing connections from metastore database
"""
from typing import List
from airflow.models.connection import Connection
from airflow.secrets import BaseSecretsBackend
from airflow.utils.session import provide_session
class MetastoreBackend(BaseSecretsBackend):
"""
Retrieves Connection object from airflow metastore database.
"""
# pylint: disable=missing-docstring
@provide_session
def get_connections(self, conn_id, session=None) -> List[Connection]:
conn_list = session.query(Connection).filter(Connection.conn_id == conn_id).all()
session.expunge_all()
return conn_list
@provide_session
def get_variable(self, key: str, session=None):
"""
Get Airflow Variable from Metadata DB
:param key: Variable Key
:return: Variable Value
"""
from airflow.models.variable import Variable
var_value = session.query(Variable).filter(Variable.key == key).first()
session.expunge_all()
if var_value:
return var_value.val
return None
| wooga/airflow | airflow/secrets/metastore.py | Python | apache-2.0 | 1,888 |
from __future__ import with_statement
__license__ = 'GPL 3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
'''
Command line interface to conversion sub-system
'''
import sys, os
from optparse import OptionGroup, Option
from collections import OrderedDict
from calibre.utils.config import OptionParser
from calibre.utils.logging import Log
from calibre.customize.conversion import OptionRecommendation
from calibre import patheq
from calibre.ebooks.conversion import ConversionUserFeedBack
USAGE = '%prog ' + _('''\
input_file output_file [options]
Convert an ebook from one format to another.
input_file is the input and output_file is the output. Both must be \
specified as the first two arguments to the command.
The output ebook format is guessed from the file extension of \
output_file. output_file can also be of the special format .EXT where \
EXT is the output file extension. In this case, the name of the output \
file is derived from the name of the input file. Note that the filenames must \
not start with a hyphen. Finally, if output_file has no extension, then \
it is treated as a directory and an "open ebook" (OEB) consisting of HTML \
files is written to that directory. These files are the files that would \
normally have been passed to the output plugin.
After specifying the input \
and output file you can customize the conversion by specifying various \
options. The available options depend on the input and output file types. \
To get help on them specify the input and output file and then use the -h \
option.
For full documentation of the conversion system see
''') + 'http://manual.calibre-ebook.com/conversion.html'
HEURISTIC_OPTIONS = ['markup_chapter_headings',
'italicize_common_cases', 'fix_indents',
'html_unwrap_factor', 'unwrap_lines',
'delete_blank_paragraphs', 'format_scene_breaks',
'dehyphenate', 'renumber_headings',
'replace_scene_breaks']
DEFAULT_TRUE_OPTIONS = HEURISTIC_OPTIONS + ['remove_fake_margins']
def print_help(parser, log):
parser.print_help()
def check_command_line_options(parser, args, log):
if len(args) < 3 or args[1].startswith('-') or args[2].startswith('-'):
print_help(parser, log)
log.error('\n\nYou must specify the input AND output files')
raise SystemExit(1)
input = os.path.abspath(args[1])
if not input.endswith('.recipe') and not os.access(input, os.R_OK) and not \
('-h' in args or '--help' in args):
log.error('Cannot read from', input)
raise SystemExit(1)
if input.endswith('.recipe') and not os.access(input, os.R_OK):
input = args[1]
output = args[2]
if (output.startswith('.') and output[:2] not in {'..', '.'} and '/' not in
output and '\\' not in output):
output = os.path.splitext(os.path.basename(input))[0]+output
output = os.path.abspath(output)
return input, output
def option_recommendation_to_cli_option(add_option, rec):
opt = rec.option
switches = ['-'+opt.short_switch] if opt.short_switch else []
switches.append('--'+opt.long_switch)
attrs = dict(dest=opt.name, help=opt.help,
choices=opt.choices, default=rec.recommended_value)
if isinstance(rec.recommended_value, type(True)):
attrs['action'] = 'store_false' if rec.recommended_value else \
'store_true'
else:
if isinstance(rec.recommended_value, int):
attrs['type'] = 'int'
if isinstance(rec.recommended_value, float):
attrs['type'] = 'float'
if opt.long_switch == 'verbose':
attrs['action'] = 'count'
attrs.pop('type', '')
if opt.name == 'read_metadata_from_opf':
switches.append('--from-opf')
if opt.name in DEFAULT_TRUE_OPTIONS and rec.recommended_value is True:
switches = ['--disable-'+opt.long_switch]
add_option(Option(*switches, **attrs))
def group_titles():
return _('INPUT OPTIONS'), _('OUTPUT OPTIONS')
def recipe_test(option, opt_str, value, parser):
assert value is None
value = []
def floatable(str):
try:
float(str)
return True
except ValueError:
return False
for arg in parser.rargs:
# stop on --foo like options
if arg[:2] == "--":
break
# stop on -a, but not on -3 or -3.0
if arg[:1] == "-" and len(arg) > 1 and not floatable(arg):
break
try:
value.append(int(arg))
except (TypeError, ValueError, AttributeError):
break
if len(value) == 2:
break
del parser.rargs[:len(value)]
while len(value) < 2:
value.append(2)
setattr(parser.values, option.dest, tuple(value))
def add_input_output_options(parser, plumber):
input_options, output_options = \
plumber.input_options, plumber.output_options
def add_options(group, options):
for opt in options:
if plumber.input_fmt == 'recipe' and opt.option.long_switch == 'test':
group(Option('--test', dest='test', action='callback', callback=recipe_test))
else:
option_recommendation_to_cli_option(group, opt)
if input_options:
title = group_titles()[0]
io = OptionGroup(parser, title, _('Options to control the processing'
' of the input %s file')%plumber.input_fmt)
add_options(io.add_option, input_options)
parser.add_option_group(io)
if output_options:
title = group_titles()[1]
oo = OptionGroup(parser, title, _('Options to control the processing'
' of the output %s')%plumber.output_fmt)
add_options(oo.add_option, output_options)
parser.add_option_group(oo)
def add_pipeline_options(parser, plumber):
groups = OrderedDict((
('' , ('',
[
'input_profile',
'output_profile',
]
)),
(_('LOOK AND FEEL') , (
_('Options to control the look and feel of the output'),
[
'base_font_size', 'disable_font_rescaling',
'font_size_mapping', 'embed_font_family',
'subset_embedded_fonts', 'embed_all_fonts',
'line_height', 'minimum_line_height',
'linearize_tables',
'extra_css', 'filter_css', 'expand_css',
'smarten_punctuation', 'unsmarten_punctuation',
'margin_top', 'margin_left', 'margin_right',
'margin_bottom', 'change_justification',
'insert_blank_line', 'insert_blank_line_size',
'remove_paragraph_spacing',
'remove_paragraph_spacing_indent_size',
'asciiize', 'keep_ligatures',
]
)),
(_('HEURISTIC PROCESSING') , (
_('Modify the document text and structure using common'
' patterns. Disabled by default. Use %(en)s to enable. '
' Individual actions can be disabled with the %(dis)s options.')
% dict(en='--enable-heuristics', dis='--disable-*'),
['enable_heuristics'] + HEURISTIC_OPTIONS
)),
(_('SEARCH AND REPLACE') , (
_('Modify the document text and structure using user defined patterns.'),
[
'sr1_search', 'sr1_replace',
'sr2_search', 'sr2_replace',
'sr3_search', 'sr3_replace',
'search_replace',
]
)),
(_('STRUCTURE DETECTION') , (
_('Control auto-detection of document structure.'),
[
'chapter', 'chapter_mark',
'prefer_metadata_cover', 'remove_first_image',
'insert_metadata', 'page_breaks_before',
'remove_fake_margins', 'start_reading_at',
]
)),
(_('TABLE OF CONTENTS') , (
_('Control the automatic generation of a Table of Contents. By '
'default, if the source file has a Table of Contents, it will '
'be used in preference to the automatically generated one.'),
[
'level1_toc', 'level2_toc', 'level3_toc',
'toc_threshold', 'max_toc_links', 'no_chapters_in_toc',
'use_auto_toc', 'toc_filter', 'duplicate_links_in_toc',
]
)),
(_('METADATA') , (_('Options to set metadata in the output'),
plumber.metadata_option_names + ['read_metadata_from_opf'],
)),
(_('DEBUG'), (_('Options to help with debugging the conversion'),
[
'verbose',
'debug_pipeline',
])),
))
for group, (desc, options) in groups.iteritems():
if group:
group = OptionGroup(parser, group, desc)
parser.add_option_group(group)
add_option = group.add_option if group != '' else parser.add_option
for name in options:
rec = plumber.get_option_by_name(name)
if rec.level < rec.HIGH:
option_recommendation_to_cli_option(add_option, rec)
def option_parser():
parser = OptionParser(usage=USAGE)
parser.add_option('--list-recipes', default=False, action='store_true',
help=_('List builtin recipe names. You can create an ebook from '
'a builtin recipe like this: ebook-convert "Recipe Name.recipe" '
'output.epub'))
return parser
class ProgressBar(object):
def __init__(self, log):
self.log = log
def __call__(self, frac, msg=''):
if msg:
percent = int(frac*100)
self.log('%d%% %s'%(percent, msg))
def create_option_parser(args, log):
if '--version' in args:
from calibre.constants import __appname__, __version__, __author__
log(os.path.basename(args[0]), '('+__appname__, __version__+')')
log('Created by:', __author__)
raise SystemExit(0)
if '--list-recipes' in args:
from calibre.web.feeds.recipes.collection import get_builtin_recipe_titles
log('Available recipes:')
titles = sorted(get_builtin_recipe_titles())
for title in titles:
try:
log('\t'+title)
except:
log('\t'+repr(title))
log('%d recipes available'%len(titles))
raise SystemExit(0)
parser = option_parser()
if len(args) < 3:
print_help(parser, log)
raise SystemExit(1)
input, output = check_command_line_options(parser, args, log)
from calibre.ebooks.conversion.plumber import Plumber
reporter = ProgressBar(log)
if patheq(input, output):
raise ValueError('Input file is the same as the output file')
plumber = Plumber(input, output, log, reporter)
add_input_output_options(parser, plumber)
add_pipeline_options(parser, plumber)
return parser, plumber
def abspath(x):
if x.startswith('http:') or x.startswith('https:'):
return x
return os.path.abspath(os.path.expanduser(x))
def read_sr_patterns(path, log=None):
import json, re, codecs
pats = []
with codecs.open(path, 'r', 'utf-8') as f:
pat = None
for line in f.readlines():
if line.endswith(u'\n'):
line = line[:-1]
if pat is None:
if not line.strip():
continue
try:
re.compile(line)
except:
msg = u'Invalid regular expression: %r from file: %r'%(
line, path)
if log is not None:
log.error(msg)
raise SystemExit(1)
else:
raise ValueError(msg)
pat = line
else:
pats.append((pat, line))
pat = None
return json.dumps(pats)
def main(args=sys.argv):
log = Log()
parser, plumber = create_option_parser(args, log)
opts, leftover_args = parser.parse_args(args)
if len(leftover_args) > 3:
log.error('Extra arguments not understood:', u', '.join(leftover_args[3:]))
return 1
for x in ('read_metadata_from_opf', 'cover'):
if getattr(opts, x, None) is not None:
setattr(opts, x, abspath(getattr(opts, x)))
if opts.search_replace:
opts.search_replace = read_sr_patterns(opts.search_replace, log)
recommendations = [(n.dest, getattr(opts, n.dest),
OptionRecommendation.HIGH)
for n in parser.options_iter()
if n.dest]
plumber.merge_ui_recommendations(recommendations)
try:
plumber.run()
except ConversionUserFeedBack as e:
ll = {'info': log.info, 'warn': log.warn,
'error':log.error}.get(e.level, log.info)
ll(e.title)
if e.det_msg:
log.debug(e.detmsg)
ll(e.msg)
raise SystemExit(1)
log(_('Output saved to'), ' ', plumber.output)
return 0
def manual_index_strings():
return _('''\
The options and default values for the options change depending on both the
input and output formats, so you should always check with::
%s
Below are the options that are common to all conversion, followed by the
options specific to every input and output format.''')
if __name__ == '__main__':
sys.exit(main())
| sharad/calibre | src/calibre/ebooks/conversion/cli.py | Python | gpl-3.0 | 14,226 |
#!/usr/bin/env python
'''
demo using ansible to gen config files
'''
# imports
try:
import ansible
import yaml
except ImportError:
print "Could not import a required module.\n Exiting"
raise SystemExit
# Variables
device_file = 'device_list01.yaml'
def main():
'''
main app
'''
# get list of devices to gen configs for
with open(device_file,'r') as yaml_file:
device_list = yaml.load(yaml_file)
print device_list
if __name__ == "__main__":
main()
| jlcjunk/pynet_pac | class5/exer01.py | Python | gpl-3.0 | 509 |
"""
polaris.ext.world
~~~~~~~~~~~~~~~~~
:copyright: (c) 2013 Eleme, http://polaris.eleme.io
:license: MIT
The world extension will return country geojson based on name.
This extension is mainly for example demo.
"""
import json
from urllib.request import urlopen
from polaris.ext import PolarisCacheExtension
class World(PolarisCacheExtension):
"""Return country geojson based on name.
"""
category = "map"
def __init__(self, **kwargs):
super(World, self).__init__(**kwargs)
self.url_tpl = ("http://rawgithub.com/johan/world.geo.json/"
"master/countries/{}.geo.json")
def get(self, name="CHN", **kwargs):
"""Request johan/world.geo.json to get geojson and return it as result.
"""
url = self.url_tpl.format(name)
req = urlopen(url)
if not req.status == 200:
return {}
_json = json.loads(req.read().decode('utf-8'))
# here we'll add the source link as geojson info.
# this is a demo of how to embed additional info into geojson
for feature in _json["features"]:
atag = "<a href='{0}'>{1}.geo.json</a>".format(url, name)
feature["properties"]["source"] = atag
return {"geojson": _json}
| eleme/polaris | polaris/ext/world.py | Python | mit | 1,296 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses.
#
# http://numenta.org/licenses/
# ----------------------------------------------------------------------
"""
This file defines RotatePictureExplorer, an explorer for
PictureSensor.
"""
from nupic.regions.PictureSensor import PictureSensor
class RotatePictureExplorer(PictureSensor.PictureExplorer):
@classmethod
def queryRelevantParams(klass):
"""
Returns a sequence of parameter names that are relevant to
the operation of the explorer.
May be extended or overridden by sub-classes as appropriate.
"""
return super(RotatePictureExplorer, klass).queryRelevantParams() + \
( 'radialLength', 'radialStep' )
def initSequence(self, state, params):
self._presentNextRotation(state, params)
def updateSequence(self, state, params):
self._presentNextRotation(state, params)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Internal helper method(s)
def _presentNextRotation(self, state, params):
"""
We will visit each grid position. For each grid position,
we rotate the object in 2D
"""
# Compute iteration indices
numRotations = 1 + int((params['maxAngularPosn'] - params['minAngularPosn'])
/ params['minAngularVelocity'])
edgeLen = 2 * params['radialLength'] + 1
numItersPerCat = edgeLen * edgeLen * numRotations
numCats = self._getNumCategories()
numIters = numItersPerCat * numCats
catIndex = self._getIterCount() // numItersPerCat
index = self._getIterCount() % numItersPerCat
blockIndex = index / numRotations
rotationIndex = index % numRotations
# Compute position within onion block
posnX = ((blockIndex % edgeLen) - params['radialLength']) * params['radialStep']
posnY = ((blockIndex // edgeLen) - params['radialLength']) * params['radialStep']
# Compute rotation angle
angularPosn = params['maxAngularPosn'] - params['minAngularVelocity'] * rotationIndex
# Update state
state['posnX'] = posnX
state['posnY'] = posnY
state['velocityX'] = 0
state['velocityY'] = 0
state['angularVelocity'] = params['minAngularVelocity']
state['angularPosn'] = angularPosn
state['catIndex'] = catIndex
| david-ragazzi/nupic | nupic/regions/PictureSensorExplorers/rotate_block.py | Python | gpl-3.0 | 3,079 |
import pygame
import os
import sys
from pygame.locals import *
pygame.init()
def parse_message(message,typeMessage=""):
messageList = []
count = 0
part = ''
for char in message:
if count != 0:
if count > len(typeMessage)-1:
if char == "_" or char == "|":
messageList.append(part)
part = ''
else:
part += char
if count == len(message) - 1:
messageList.append(part)
part = ''
count += 1
return messageList
def load_image(name, colorkey=None):
fullname = os.path.join('data', name)
try:
image = pygame.image.load(fullname)
except pygame.error as message:
print('Cannot load image: ' + str(name))
raise SystemExit,message
image = image.convert_alpha()
if colorkey is not None:
if colorkey is -1:
colorkey = image.get_at((0,0))
image.set_colorkey(colorkey, RLEACCEL)
return image, image.get_rect()
def load_sound(name):
class NoneSound:
def play(self): pass
if not pygame.mixer:
return NoneSound()
fullname = os.path.join('data', name)
try:
sound = pygame.mixer.Sound(fullname)
except pygame.error as message:
print('Cannot load sound: ' + str(wav))
raise SystemExit, message
return sound
| mstubinis/Tic-Tac-Pi | Tic-Tac-Pi/resourceManager.py | Python | mit | 1,449 |
from django.conf.urls.defaults import *
GROUP_URL = r'(?P<slug>[-\w]+)/'
PAGE_URL = r'%spages/(?P<page_slug>[-\w]+)/' % GROUP_URL
TOPIC_URL = r'%stopics/(?P<topic_id>\d+)/' % GROUP_URL
MESSAGE_URL = r'%smessages/(?P<message_id>\d+)/' % TOPIC_URL
urlpatterns = patterns('groups.views.groups',
url(r'^create/$', 'group_create', name='create'),
url(r'^%s$' % GROUP_URL, 'group_detail', name='group'),
url(r'^%sedit/$' % GROUP_URL, 'group_edit', name='edit'),
url(r'^%sremove/$' % GROUP_URL, 'group_remove', name='remove'),
url(r'^%sjoin/$' % GROUP_URL, 'group_join', name='join'),
url(r'^%smembers/$' % GROUP_URL, 'group_members', name='members'),
url(r'^%sinvite/$' % GROUP_URL, 'group_invite', name='invite'),
url(r'^$', 'group_list', name='groups'),
)
# Topics
urlpatterns += patterns('groups.views.topics',
url(r'^%stopics/create/$' % GROUP_URL, 'topic_create', name='topic_create'),
url(r'^%s$' % TOPIC_URL, 'topic_detail', name='topic'),
url(r'^%sedit/$' % TOPIC_URL, 'topic_edit', name='topic_edit'),
url(r'^%sremove/$' % TOPIC_URL, 'topic_remove', name='topic_remove'),
url(r'^%stopics/$' % GROUP_URL, 'topic_list', name='topics'),
)
# Pages
urlpatterns += patterns('groups.views.pages',
url(r'^%spages/create/$' % GROUP_URL, 'page_create', name='page_create'),
url(r'^%s$' % PAGE_URL, 'page_detail', name='page'),
url(r'^%sedit/$' % PAGE_URL, 'page_edit', name='page_edit'),
url(r'^%sremove/$' % PAGE_URL, 'page_remove', name='page_remove'),
url(r'^%spages/$' % GROUP_URL, 'page_list', name='pages'),
)
# Messages
urlpatterns += patterns('groups.views.messages',
url(r'^%smessages/create/$' % TOPIC_URL, 'message_create', name='message_create'),
url(r'^%s$' % MESSAGE_URL, 'message_detail', name='message'),
url(r'^%sedit/$' % MESSAGE_URL, 'message_edit', name='message_edit'),
url(r'^%sremove/$' % MESSAGE_URL, 'message_remove', name='message_remove'),
url(r'^%smessages/$' % TOPIC_URL, 'message_list', name='messages'),
)
| hzlf/openbroadcast | website/apps/groups/urls.py | Python | gpl-3.0 | 2,547 |
# -*- coding: utf-8 -*-
import datetime as dt
import httplib as http
import urllib
import urlparse
from django.apps import apps
from django.utils import timezone
from django.db.models import Q
import bson.objectid
import itsdangerous
from flask import request
import furl
from weakref import WeakKeyDictionary
from werkzeug.local import LocalProxy
from framework.flask import redirect
from framework.sessions.utils import remove_session
from website import settings
def add_key_to_url(url, scheme, key):
"""Redirects the user to the requests URL with the given key appended to the query parameters."""
query = request.args.to_dict()
query['view_only'] = key
replacements = {'query': urllib.urlencode(query)}
if scheme:
replacements['scheme'] = scheme
parsed_url = urlparse.urlparse(url)
if parsed_url.fragment:
# Fragments should exists server side so this mean some one set up a # in the url
# WSGI sucks and auto unescapes it so we just shove it back into the path with the escaped hash
replacements['path'] = '{}%23{}'.format(parsed_url.path, parsed_url.fragment)
replacements['fragment'] = ''
parsed_redirect_url = parsed_url._replace(**replacements)
return urlparse.urlunparse(parsed_redirect_url)
def prepare_private_key():
"""
`before_request` handler that checks the Referer header to see if the user
is requesting from a view-only link. If so, re-append the view-only key.
NOTE: In order to ensure the execution order of the before_request callbacks,
this is attached in website.app.init_app rather than using @app.before_request.
"""
# Done if not GET request
if request.method != 'GET':
return
# Done if private_key in args
if request.args.get('view_only', ''):
return
# Grab query key from previous request for not logged-in users
if request.referrer:
referrer_parsed = urlparse.urlparse(request.referrer)
scheme = referrer_parsed.scheme
key = urlparse.parse_qs(urlparse.urlparse(request.referrer).query).get('view_only')
if key:
key = key[0]
else:
scheme = None
key = None
# Update URL and redirect
if key and not session.is_authenticated:
new_url = add_key_to_url(request.url, scheme, key)
return redirect(new_url, code=http.TEMPORARY_REDIRECT)
def get_session():
Session = apps.get_model('osf.Session')
user_session = sessions.get(request._get_current_object())
if not user_session:
user_session = Session()
set_session(user_session)
return user_session
def set_session(session):
sessions[request._get_current_object()] = session
def create_session(response, data=None):
Session = apps.get_model('osf.Session')
current_session = get_session()
if current_session:
current_session.data.update(data or {})
current_session.save()
cookie_value = itsdangerous.Signer(settings.SECRET_KEY).sign(current_session._id)
else:
session_id = str(bson.objectid.ObjectId())
new_session = Session(_id=session_id, data=data or {})
new_session.save()
cookie_value = itsdangerous.Signer(settings.SECRET_KEY).sign(session_id)
set_session(new_session)
if response is not None:
response.set_cookie(settings.COOKIE_NAME, value=cookie_value, domain=settings.OSF_COOKIE_DOMAIN,
secure=settings.SESSION_COOKIE_SECURE, httponly=settings.SESSION_COOKIE_HTTPONLY)
return response
sessions = WeakKeyDictionary()
session = LocalProxy(get_session)
# Request callbacks
# NOTE: This gets attached in website.app.init_app to ensure correct callback order
def before_request():
# TODO: Fix circular import
from framework.auth.core import get_user
from framework.auth import cas
from website.util import time as util_time
Session = apps.get_model('osf.Session')
# Central Authentication Server Ticket Validation and Authentication
ticket = request.args.get('ticket')
if ticket:
service_url = furl.furl(request.url)
service_url.args.pop('ticket')
# Attempt to authenticate wih CAS, and return a proper redirect response
return cas.make_response_from_ticket(ticket=ticket, service_url=service_url.url)
if request.authorization:
user = get_user(
email=request.authorization.username,
password=request.authorization.password
)
# Create an empty session
# TODO: Shoudn't need to create a session for Basic Auth
user_session = Session()
set_session(user_session)
if user:
user_addon = user.get_addon('twofactor')
if user_addon and user_addon.is_confirmed:
otp = request.headers.get('X-OSF-OTP')
if otp is None or not user_addon.verify_code(otp):
# Must specify two-factor authentication OTP code or invalid two-factor authentication OTP code.
user_session.data['auth_error_code'] = http.UNAUTHORIZED
return
user_session.data['auth_user_username'] = user.username
user_session.data['auth_user_fullname'] = user.fullname
if user_session.data.get('auth_user_id', None) != user._primary_key:
user_session.data['auth_user_id'] = user._primary_key
user_session.save()
else:
# Invalid key: Not found in database
user_session.data['auth_error_code'] = http.UNAUTHORIZED
return
cookie = request.cookies.get(settings.COOKIE_NAME)
if cookie:
try:
session_id = itsdangerous.Signer(settings.SECRET_KEY).unsign(cookie)
user_session = Session.load(session_id) or Session(_id=session_id)
except itsdangerous.BadData:
return
if not util_time.throttle_period_expired(user_session.date_created, settings.OSF_SESSION_TIMEOUT):
# Update date last login when making non-api requests
if user_session.data.get('auth_user_id') and 'api' not in request.url:
OSFUser = apps.get_model('osf.OSFUser')
(
OSFUser.objects
.filter(guids___id__isnull=False, guids___id=user_session.data['auth_user_id'])
# Throttle updates
.filter(Q(date_last_login__isnull=True) | Q(date_last_login__lt=timezone.now() - dt.timedelta(seconds=settings.DATE_LAST_LOGIN_THROTTLE)))
).update(date_last_login=timezone.now())
set_session(user_session)
else:
remove_session(user_session)
def after_request(response):
# Disallow embedding in frames
response.headers['X-Frame-Options'] = 'SAMEORIGIN'
return response
| aaxelb/osf.io | framework/sessions/__init__.py | Python | apache-2.0 | 6,887 |
from django.contrib import admin
from bemtevi.apps.reports.models import TestimonyEntry
class TestimonyEntryModelAdmin(admin.ModelAdmin):
date_hierarchy = 'date'
list_display = ('path', 'testcases', 'automated_testcases',
'manual_testcases', 'no_docstring_testcases', 'date')
list_filter = ('date', 'path')
admin.site.register(TestimonyEntry, TestimonyEntryModelAdmin)
| elyezer/bem-te-vi | bemtevi/apps/reports/admin.py | Python | gpl-3.0 | 404 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import collections
import struct
import sys
import gdb
import pwndbg.events
import pwndbg.memoize
import pwndbg.memory
import pwndbg.regs
import pwndbg.typeinfo
from capstone import *
current = 'i386'
ptrmask = 0xfffffffff
endian = 'little'
ptrsize = pwndbg.typeinfo.ptrsize
fmt = '=I'
def fix_arch(arch):
arches = ['x86-64', 'i386', 'mips', 'powerpc', 'sparc', 'arm', 'aarch64', arch]
return next(a for a in arches if a in arch)
@pwndbg.events.stop
def update():
m = sys.modules[__name__]
m.current = fix_arch(gdb.selected_frame().architecture().name())
m.ptrsize = pwndbg.typeinfo.ptrsize
m.ptrmask = (1 << 8*pwndbg.typeinfo.ptrsize)-1
if 'little' in gdb.execute('show endian', to_string=True):
m.endian = 'little'
else:
m.endian = 'big'
m.fmt = {
(4, 'little'): '<I',
(4, 'big'): '>I',
(8, 'little'): '<Q',
(8, 'big'): '>Q',
}.get((m.ptrsize, m.endian))
def pack(integer):
return struct.pack(fmt, integer & ptrmask)
def unpack(data):
return struct.unpack(fmt, data)[0]
def signed(integer):
return unpack(pack(integer), signed=True)
def unsigned(integer):
return unpack(pack(integer))
| bj7/pwndbg | pwndbg/arch.py | Python | mit | 1,242 |
#!/usr/bin/env python
# Copyright 2014-2020 The PySCF Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: Hong-Zhou Ye <hzyechem@gmail.com>
#
r'''
Range-separated Gaussian Density Fitting (RSGDF)
ref.:
[1] For the RSGDF method:
Hong-Zhou Ye and Timothy C. Berkelbach, J. Chem. Phys. 154, 131104 (2021).
[2] For the SR lattice sum integral screening:
Hong-Zhou Ye and Timothy C. Berkelbach, arXiv:2107.09704.
In RSGDF, the two-center and three-center Coulomb integrals are calculated in two pars:
j2c = j2c_SR(omega) + j2c_LR(omega)
j3c = j3c_SR(omega) + j3c_LR(omega)
where the SR and LR integrals correpond to using the following potentials
g_SR(r_12;omega) = erfc(omega * r_12) / r_12
g_LR(r_12;omega) = erf(omega * r_12) / r_12
The SR integrals are evaluated in real space using a lattice summation, while
the LR integrals are evaluated in reciprocal space with a plane wave basis.
'''
import os
import h5py
import scipy.linalg
import tempfile
import numpy as np
from pyscf import gto as mol_gto
from pyscf.pbc import df
from pyscf.pbc.df import ft_ao
from pyscf.pbc.df import rsdf_helper
from pyscf.df.outcore import _guess_shell_ranges
from pyscf.pbc import tools as pbctools
from pyscf.pbc.lib.kpts_helper import (is_zero, gamma_point, member, unique,
KPT_DIFF_TOL)
from pyscf import lib
from pyscf.lib import logger
def kpts_to_kmesh(cell, kpts):
""" Check if kpt mesh includes the Gamma point. Generate the bvk kmesh
only if it does.
"""
kpts = np.reshape(kpts, (-1,3))
nkpts = len(kpts)
if nkpts == 1: # single-kpt (either Gamma or shifted)
return None
scaled_k = cell.get_scaled_kpts(kpts).round(8)
if np.any(abs(scaled_k).sum(axis=1) < KPT_DIFF_TOL):
kmesh = (len(np.unique(scaled_k[:,0])),
len(np.unique(scaled_k[:,1])),
len(np.unique(scaled_k[:,2])))
else:
kmesh = None
return kmesh
def weighted_coulG(mydf, omega, kpt=np.zeros(3), exx=False, mesh=None):
cell = mydf.cell
if cell.omega != 0:
raise RuntimeError('RSGDF cannot be used '
'to evaluate the long-range HF exchange in RSH '
'functional')
Gv, Gvbase, kws = cell.get_Gv_weights(mesh)
if abs(omega) < 1.e-10:
omega_ = None
else:
omega_ = omega
coulG = pbctools.get_coulG(cell, kpt, False, mydf, mesh, Gv,
omega=omega_)
coulG *= kws
return coulG
def get_aux_chg(auxcell):
r""" Compute charge of the auxiliary basis, \int_Omega dr chi_P(r)
Returns:
The function returns a 1d numpy array of size auxcell.nao_nr().
"""
def get_nd(l):
if auxcell.cart:
return (l+1) * (l+2) // 2
else:
return 2 * l + 1
naux = auxcell.nao_nr()
qs = np.zeros(naux)
shift = 0
half_sph_norm = np.sqrt(4*np.pi)
for ib in range(auxcell.nbas):
l = auxcell.bas_angular(ib)
if l == 0:
npm = auxcell.bas_nprim(ib)
nc = auxcell.bas_nctr(ib)
es = auxcell.bas_exp(ib)
ptr = auxcell._bas[ib,mol_gto.PTR_COEFF]
cs = auxcell._env[ptr:ptr+npm*nc].reshape(nc,npm).T
norms = mol_gto.gaussian_int(l+2, es)
q = np.einsum("i,ij->j",norms,cs)[0] * half_sph_norm
else: # higher angular momentum AOs carry no charge
q = 0.
nd = get_nd(l)
qs[shift:shift+nd] = q
shift += nd
return qs
# kpti == kptj: s2 symmetry
# kpti == kptj == 0 (gamma point): real
def _make_j3c(mydf, cell, auxcell, kptij_lst, cderi_file):
t1 = (logger.process_clock(), logger.perf_counter())
log = logger.Logger(mydf.stdout, mydf.verbose)
max_memory = max(2000, mydf.max_memory-lib.current_memory()[0])
omega = abs(mydf.omega)
if mydf.use_bvk and mydf.kpts_band is None:
bvk_kmesh = kpts_to_kmesh(cell, mydf.kpts)
if bvk_kmesh is None:
log.debug("Single-kpt or non-Gamma-inclusive kmesh is found. "
"bvk kmesh is not used.")
else:
log.debug("Using bvk kmesh= [%d %d %d]", *bvk_kmesh)
else:
bvk_kmesh = None
# The ideal way to hold the temporary integrals is to store them in the
# cderi_file and overwrite them inplace in the second pass. The current
# HDF5 library does not have an efficient way to manage free space in
# overwriting. It often leads to the cderi_file ~2 times larger than the
# necessary size. For now, dumping the DF integral intermediates to a
# separated temporary file can avoid this issue. The DF intermediates may
# be terribly huge. The temporary file should be placed in the same disk
# as cderi_file.
swapfile = tempfile.NamedTemporaryFile(dir=os.path.dirname(cderi_file))
fswap = lib.H5TmpFile(swapfile.name)
# Unlink swapfile to avoid trash
swapfile = None
# get charge of auxbasis
if cell.dimension == 3:
qaux = get_aux_chg(auxcell)
else:
qaux = np.zeros(auxcell.nao_nr())
nao = cell.nao_nr()
naux = auxcell.nao_nr()
kptis = kptij_lst[:,0]
kptjs = kptij_lst[:,1]
kpt_ji = kptjs - kptis
uniq_kpts, uniq_index, uniq_inverse = unique(kpt_ji)
log.debug('Num uniq kpts %d', len(uniq_kpts))
log.debug2('uniq_kpts %s', uniq_kpts)
# compute j2c first as it informs the integral screening in computing j3c
# short-range part of j2c ~ (-kpt_ji | kpt_ji)
omega_j2c = abs(mydf.omega_j2c)
j2c = rsdf_helper.intor_j2c(auxcell, omega_j2c, kpts=uniq_kpts)
# Add (1) short-range G=0 (i.e., charge) part and (2) long-range part
qaux2 = None
g0_j2c = np.pi/omega_j2c**2./cell.vol
mesh_j2c = mydf.mesh_j2c
Gv, Gvbase, kws = cell.get_Gv_weights(mesh_j2c)
b = cell.reciprocal_vectors()
gxyz = lib.cartesian_prod([np.arange(len(x)) for x in Gvbase])
ngrids = gxyz.shape[0]
max_memory = max(2000, mydf.max_memory - lib.current_memory()[0])
blksize = max(2048, int(max_memory*.5e6/16/auxcell.nao_nr()))
log.debug2('max_memory %s (MB) blocksize %s', max_memory, blksize)
for k, kpt in enumerate(uniq_kpts):
# short-range charge part
if is_zero(kpt) and cell.dimension == 3:
if qaux2 is None:
qaux2 = np.outer(qaux,qaux)
j2c[k] -= qaux2 * g0_j2c
# long-range part via aft
coulG_lr = mydf.weighted_coulG(omega_j2c, kpt, False, mesh_j2c)
for p0, p1 in lib.prange(0, ngrids, blksize):
aoaux = ft_ao.ft_ao(auxcell, Gv[p0:p1], None, b, gxyz[p0:p1],
Gvbase, kpt).T
LkR = np.asarray(aoaux.real, order='C')
LkI = np.asarray(aoaux.imag, order='C')
aoaux = None
if is_zero(kpt): # kpti == kptj
j2c[k] += lib.ddot(LkR*coulG_lr[p0:p1], LkR.T)
j2c[k] += lib.ddot(LkI*coulG_lr[p0:p1], LkI.T)
else:
j2cR, j2cI = df.df_jk.zdotCN(LkR*coulG_lr[p0:p1],
LkI*coulG_lr[p0:p1], LkR.T, LkI.T)
j2c[k] += j2cR + j2cI * 1j
LkR = LkI = None
fswap['j2c/%d'%k] = j2c[k]
j2c = coulG_lr = None
t1 = log.timer_debug1('2c2e', *t1)
def cholesky_decomposed_metric(uniq_kptji_id):
j2c = np.asarray(fswap['j2c/%d'%uniq_kptji_id])
j2c_negative = None
try:
if mydf.j2c_eig_always:
raise scipy.linalg.LinAlgError
j2c = scipy.linalg.cholesky(j2c, lower=True)
j2ctag = 'CD'
except scipy.linalg.LinAlgError:
#msg =('===================================\n'
# 'J-metric not positive definite.\n'
# 'It is likely that mesh is not enough.\n'
# '===================================')
#log.error(msg)
#raise scipy.linalg.LinAlgError('\n'.join([str(e), msg]))
w, v = scipy.linalg.eigh(j2c)
ndrop = np.count_nonzero(w<mydf.linear_dep_threshold)
if ndrop > 0:
log.debug('DF metric linear dependency for kpt %s',
uniq_kptji_id)
log.debug('cond = %.4g, drop %d bfns', w[-1]/w[0], ndrop)
v1 = v[:,w>mydf.linear_dep_threshold].conj().T
v1 /= np.sqrt(w[w>mydf.linear_dep_threshold]).reshape(-1,1)
j2c = v1
if cell.dimension == 2 and cell.low_dim_ft_type != 'inf_vacuum':
idx = np.where(w < -mydf.linear_dep_threshold)[0]
if len(idx) > 0:
j2c_negative = (v[:,idx]/np.sqrt(-w[idx])).conj().T
w = v = None
j2ctag = 'eig'
return j2c, j2c_negative, j2ctag
# compute j3c
# inverting j2c, and use it's column max to determine an extra precision for 3c2e prescreening
# short-range part
rsdf_helper._aux_e2_nospltbas(
cell, auxcell, omega, fswap, 'int3c2e', aosym='s2',
kptij_lst=kptij_lst, dataname='j3c-junk',
max_memory=max_memory,
bvk_kmesh=bvk_kmesh,
precision=mydf.precision_R)
t1 = log.timer_debug1('3c2e', *t1)
# recompute g0 and Gvectors for j3c
g0 = np.pi/omega**2./cell.vol
mesh = mydf.mesh_compact
Gv, Gvbase, kws = cell.get_Gv_weights(mesh)
gxyz = lib.cartesian_prod([np.arange(len(x)) for x in Gvbase])
ngrids = gxyz.shape[0]
# Add (1) short-range G=0 (i.e., charge) part and (2) long-range part
tspans = np.zeros((3,2)) # lr, j2c_inv, j2c_cntr
tspannames = ["ftaop+pw", "j2c_inv", "j2c_cntr"]
feri = h5py.File(cderi_file, 'w')
feri['j3c-kptij'] = kptij_lst
nsegs = len(fswap['j3c-junk/0'])
def make_kpt(uniq_kptji_id, cholesky_j2c):
kpt = uniq_kpts[uniq_kptji_id] # kpt = kptj - kpti
log.debug1('kpt = %s', kpt)
adapted_ji_idx = np.where(uniq_inverse == uniq_kptji_id)[0]
adapted_kptjs = kptjs[adapted_ji_idx]
nkptj = len(adapted_kptjs)
log.debug1('adapted_ji_idx = %s', adapted_ji_idx)
j2c, j2c_negative, j2ctag = cholesky_j2c
shls_slice = (0, auxcell.nbas)
Gaux = ft_ao.ft_ao(auxcell, Gv, shls_slice, b, gxyz, Gvbase, kpt)
wcoulG_lr = mydf.weighted_coulG(omega, kpt, False, mesh)
Gaux *= wcoulG_lr.reshape(-1,1)
kLR = Gaux.real.copy('C')
kLI = Gaux.imag.copy('C')
Gaux = None
if is_zero(kpt): # kpti == kptj
aosym = 's2'
nao_pair = nao*(nao+1)//2
if cell.dimension == 3:
vbar = qaux * g0
ovlp = cell.pbc_intor('int1e_ovlp', hermi=1, kpts=adapted_kptjs)
ovlp = [lib.pack_tril(s) for s in ovlp]
else:
aosym = 's1'
nao_pair = nao**2
mem_now = lib.current_memory()[0]
log.debug2('memory = %s', mem_now)
max_memory = max(2000, mydf.max_memory-mem_now)
# nkptj for 3c-coulomb arrays plus 1 Lpq array
buflen = min(max(int(max_memory*.38e6/16/naux/(nkptj+1)), 1), nao_pair)
shranges = _guess_shell_ranges(cell, buflen, aosym)
buflen = max([x[2] for x in shranges])
# +1 for a pqkbuf
if aosym == 's2':
Gblksize = max(16, int(max_memory*.1e6/16/buflen/(nkptj+1)))
else:
Gblksize = max(16, int(max_memory*.2e6/16/buflen/(nkptj+1)))
Gblksize = min(Gblksize, ngrids, 16384)
def load(aux_slice):
col0, col1 = aux_slice
j3cR = []
j3cI = []
for k, idx in enumerate(adapted_ji_idx):
v = np.vstack([fswap['j3c-junk/%d/%d'%(idx,i)][0,col0:col1].T
for i in range(nsegs)])
# vbar is the interaction between the background charge
# and the auxiliary basis. 0D, 1D, 2D do not have vbar.
if is_zero(kpt) and cell.dimension == 3:
for i in np.where(vbar != 0)[0]:
v[i] -= vbar[i] * ovlp[k][col0:col1]
j3cR.append(np.asarray(v.real, order='C'))
if is_zero(kpt) and gamma_point(adapted_kptjs[k]):
j3cI.append(None)
else:
j3cI.append(np.asarray(v.imag, order='C'))
v = None
return j3cR, j3cI
pqkRbuf = np.empty(buflen*Gblksize)
pqkIbuf = np.empty(buflen*Gblksize)
# buf for ft_aopair
buf = np.empty(nkptj*buflen*Gblksize, dtype=np.complex128)
cols = [sh_range[2] for sh_range in shranges]
locs = np.append(0, np.cumsum(cols))
tasks = zip(locs[:-1], locs[1:])
for istep, (j3cR, j3cI) in enumerate(lib.map_with_prefetch(load, tasks)):
bstart, bend, ncol = shranges[istep]
log.debug1('int3c2e [%d/%d], AO [%d:%d], ncol = %d',
istep+1, len(shranges), bstart, bend, ncol)
if aosym == 's2':
shls_slice = (bstart, bend, 0, bend)
else:
shls_slice = (bstart, bend, 0, cell.nbas)
tick_ = np.asarray((logger.process_clock(), logger.perf_counter()))
for p0, p1 in lib.prange(0, ngrids, Gblksize):
dat = ft_ao.ft_aopair_kpts(cell, Gv[p0:p1], shls_slice, aosym,
b, gxyz[p0:p1], Gvbase, kpt,
adapted_kptjs, out=buf,
bvk_kmesh=bvk_kmesh)
nG = p1 - p0
for k, ji in enumerate(adapted_ji_idx):
aoao = dat[k].reshape(nG,ncol)
pqkR = np.ndarray((ncol,nG), buffer=pqkRbuf)
pqkI = np.ndarray((ncol,nG), buffer=pqkIbuf)
pqkR[:] = aoao.real.T
pqkI[:] = aoao.imag.T
lib.dot(kLR[p0:p1].T, pqkR.T, 1, j3cR[k][:], 1)
lib.dot(kLI[p0:p1].T, pqkI.T, 1, j3cR[k][:], 1)
if not (is_zero(kpt) and gamma_point(adapted_kptjs[k])):
lib.dot(kLR[p0:p1].T, pqkI.T, 1, j3cI[k][:], 1)
lib.dot(kLI[p0:p1].T, pqkR.T, -1, j3cI[k][:], 1)
tock_ = np.asarray((logger.process_clock(), logger.perf_counter()))
tspans[0] += tock_ - tick_
for k, ji in enumerate(adapted_ji_idx):
if is_zero(kpt) and gamma_point(adapted_kptjs[k]):
v = j3cR[k]
else:
v = j3cR[k] + j3cI[k] * 1j
if j2ctag == 'CD':
v = scipy.linalg.solve_triangular(j2c, v, lower=True, overwrite_b=True)
feri['j3c/%d/%d'%(ji,istep)] = v
else:
feri['j3c/%d/%d'%(ji,istep)] = lib.dot(j2c, v)
# low-dimension systems
if j2c_negative is not None:
feri['j3c-/%d/%d'%(ji,istep)] = lib.dot(j2c_negative, v)
j3cR = j3cI = None
tick_ = np.asarray((logger.process_clock(), logger.perf_counter()))
tspans[2] += tick_ - tock_
for ji in adapted_ji_idx:
del(fswap['j3c-junk/%d'%ji])
# Wrapped around boundary and symmetry between k and -k can be used
# explicitly for the metric integrals. We consider this symmetry
# because it is used in the df_ao2mo module when contracting two 3-index
# integral tensors to the 4-index 2e integral tensor. If the symmetry
# related k-points are treated separately, the resultant 3-index tensors
# may have inconsistent dimension due to the numerial noise when handling
# linear dependency of j2c.
def conj_j2c(cholesky_j2c):
j2c, j2c_negative, j2ctag = cholesky_j2c
if j2c_negative is None:
return j2c.conj(), None, j2ctag
else:
return j2c.conj(), j2c_negative.conj(), j2ctag
a = cell.lattice_vectors() / (2*np.pi)
def kconserve_indices(kpt):
'''search which (kpts+kpt) satisfies momentum conservation'''
kdif = np.einsum('wx,ix->wi', a, uniq_kpts + kpt)
kdif_int = np.rint(kdif)
mask = np.einsum('wi->i', abs(kdif - kdif_int)) < KPT_DIFF_TOL
uniq_kptji_ids = np.where(mask)[0]
return uniq_kptji_ids
done = np.zeros(len(uniq_kpts), dtype=bool)
for k, kpt in enumerate(uniq_kpts):
if done[k]:
continue
log.debug1('Cholesky decomposition for j2c at kpt %s', k)
tick_ = np.asarray((logger.process_clock(), logger.perf_counter()))
cholesky_j2c = cholesky_decomposed_metric(k)
tock_ = np.asarray((logger.process_clock(), logger.perf_counter()))
tspans[1] += tock_ - tick_
# The k-point k' which has (k - k') * a = 2n pi. Metric integrals have the
# symmetry S = S
uniq_kptji_ids = kconserve_indices(-kpt)
log.debug1("Symmetry pattern (k - %s)*a= 2n pi", kpt)
log.debug1(" make_kpt for uniq_kptji_ids %s", uniq_kptji_ids)
for uniq_kptji_id in uniq_kptji_ids:
if not done[uniq_kptji_id]:
make_kpt(uniq_kptji_id, cholesky_j2c)
done[uniq_kptji_ids] = True
# The k-point k' which has (k + k') * a = 2n pi. Metric integrals have the
# symmetry S = S*
uniq_kptji_ids = kconserve_indices(kpt)
log.debug1("Symmetry pattern (k + %s)*a= 2n pi", kpt)
log.debug1(" make_kpt for %s", uniq_kptji_ids)
cholesky_j2c = conj_j2c(cholesky_j2c)
for uniq_kptji_id in uniq_kptji_ids:
if not done[uniq_kptji_id]:
make_kpt(uniq_kptji_id, cholesky_j2c)
done[uniq_kptji_ids] = True
feri.close()
# report time for aft part
for tspan, tspanname in zip(tspans, tspannames):
log.debug1(" CPU time for %s %9.2f sec, wall time %9.2f sec",
"%10s"%tspanname, *tspan)
log.debug1("%s", "")
class RSGDF(df.df.GDF):
'''Range Separated Gaussian Density Fitting
'''
# class methods defined outside the class
_make_j3c = _make_j3c
weighted_coulG = weighted_coulG
def __init__(self, cell, kpts=np.zeros((1,3))):
if cell.dimension < 3:
raise NotImplementedError("""
RSGDF for low-dimensional systems are not available yet. We recommend using
cell.dimension=3 with large vacuum.""")
# if True and kpts are gamma-inclusive, RSDF will use the bvk cell
# trick for computing both j3c_SR and j3c_LR. If kpts are not
# gamma-inclusive, this attribute will be ignored.
self.use_bvk = True
# precision for real-space lattice sum (R) and reciprocal-space
# Fourier transform (G).
self.precision_R = cell.precision * 1e-2
self.precision_G = cell.precision
# omega and PW mesh size for j3c.
# 1. If 'omega' is given, the code can search an appropriate PW mesh of
# size 'mesh_compact' that computes the LR-AFT of j3c to 'precision_G'.
# 2. If 'omega' is not given, the code will search for the maximum
# omega such that the size of 'mesh_compact' does not exceed 'npw_max'.
# The default for 'npw_max' is 350 (i.e., 7x7x7 for a 3D cubic
# lattice). If thus determined 'omega' is smaller than '_omega_min'
# (default: 0.3), 'omega' will be set to '_omega_min' and 'mesh_compact'
# is determined from the new 'omega' (ignoring 'npw_max').
# Note 1: In both cases, the user can manually overwrite the
# auto-determined 'mesh_compact'.
# Note 2: 'ke_cutoff' is not an input option. Use 'mesh_compact' directly.
self.npw_max = 350
self._omega_min = 0.3
self.omega = None
self.ke_cutoff = None
self.mesh_compact = None
# omega and PW mesh size for j2c.
# Like for j3c, if 'omega_j2c' is given, the code can determine an
# appropriate PW mesh of size 'mesh_j2c' that computes the LR-AFT of j2c
# to 'precision_j2c'.
# The default ('omega_j2c' = 0.4 and 'precision_j2c' = 1e-14) is recommended.
# Like for j3c, 'mesh_j2c' can be overwritten manually.
self.omega_j2c = 0.4
self.mesh_j2c = None
self.precision_j2c = 1e-14
# set True to force calculating j2c^(-1/2) using eigenvalue
# decomposition (ED); otherwise, Cholesky decomposition (CD) is used
# first, and ED is called only if CD fails.
self.j2c_eig_always = False
df.df.GDF.__init__(self, cell, kpts=kpts)
self.kpts = np.reshape(self.kpts, (-1,3))
def dump_flags(self, verbose=None):
cell = self.cell
log = logger.new_logger(self, verbose)
log.info('\n')
log.info('******** %s ********', self.__class__)
log.info('cell num shells = %d, num cGTOs = %d, num pGTOs = %d',
cell.nbas, cell.nao_nr(), cell.npgto_nr())
log.info('use_bvk = %s', self.use_bvk)
log.info('precision_R = %s', self.precision_R)
log.info('precision_G = %s', self.precision_G)
log.info('j2c_eig_always = %s', self.j2c_eig_always)
log.info('omega = %s', self.omega)
log.info('ke_cutoff = %s', self.ke_cutoff)
log.info('mesh = %s (%d PWs)', self.mesh, np.prod(self.mesh))
log.info('mesh_compact = %s (%d PWs)', self.mesh_compact,
np.prod(self.mesh_compact))
if self.auxcell is None:
log.info('auxbasis = %s', self.auxbasis)
else:
log.info('auxbasis = %s', self.auxcell.basis)
log.info('auxcell precision= %s', self.auxcell.precision)
log.info('auxcell rcut = %s', self.auxcell.rcut)
log.info('omega_j2c = %s', self.omega_j2c)
log.info('mesh_j2c = %s (%d PWs)', self.mesh_j2c,
np.prod(self.mesh_j2c))
auxcell = self.auxcell
log.info('auxcell num shells = %d, num cGTOs = %d, num pGTOs = %d',
auxcell.nbas, auxcell.nao_nr(),
auxcell.npgto_nr())
log.info('exp_to_discard = %s', self.exp_to_discard)
if isinstance(self._cderi, str):
log.info('_cderi = %s where DF integrals are loaded (readonly).',
self._cderi)
elif isinstance(self._cderi_to_save, str):
log.info('_cderi_to_save = %s', self._cderi_to_save)
else:
log.info('_cderi_to_save = %s', self._cderi_to_save.name)
log.info('len(kpts) = %d', len(self.kpts))
log.debug1(' kpts = %s', self.kpts)
if self.kpts_band is not None:
log.info('len(kpts_band) = %d', len(self.kpts_band))
log.debug1(' kpts_band = %s', self.kpts_band)
return self
def _rs_build(self):
log = logger.Logger(self.stdout, self.verbose)
# find kmax
kpts = self.kpts if self.kpts_band is None else np.vstack(
[self.kpts, self.kpts_band])
b = self.cell.reciprocal_vectors()
scaled_kpts = np.linalg.solve(b.T, kpts.T).T
scaled_kpts[scaled_kpts > 0.49999999] -= 1
kpts = np.dot(scaled_kpts, b)
kmax = np.linalg.norm(kpts, axis=-1).max()
scaled_kpts = kpts = None
if kmax < 1.e-3: kmax = (0.75/np.pi/self.cell.vol)**0.33333333*2*np.pi
# If omega is not given, estimate it from npw_max
r2o = True
if self.omega is None:
self.omega, self.ke_cutoff, mesh_compact = \
rsdf_helper.estimate_omega_for_npw(
self.cell, self.npw_max,
self.precision_G,
kmax=kmax,
round2odd=r2o)
# if omega from npw_max is too small, use omega_min
if self.omega < self._omega_min:
self.omega = self._omega_min
self.ke_cutoff, mesh_compact = \
rsdf_helper.estimate_mesh_for_omega(
self.cell, self.omega,
self.precision_G,
kmax=kmax,
round2odd=r2o)
# Use the thus determined mesh_compact only if not p[rovided
if self.mesh_compact is None:
self.mesh_compact = mesh_compact
# If omega is provded but mesh_compact is not
elif self.mesh_compact is None:
self.ke_cutoff, self.mesh_compact = \
rsdf_helper.estimate_mesh_for_omega(
self.cell, self.omega,
self.precision_G,
kmax=kmax,
round2odd=r2o)
# build auxcell
from pyscf.df.addons import make_auxmol
auxcell = make_auxmol(self.cell, self.auxbasis)
# drop exponents
drop_eta = self.exp_to_discard
if drop_eta is not None and drop_eta > 0:
log.info("Drop primitive fitting functions with exponent < %s",
drop_eta)
auxbasis = rsdf_helper.remove_exp_basis(auxcell._basis,
amin=drop_eta)
auxcellnew = make_auxmol(self.cell, auxbasis)
auxcell = auxcellnew
# determine mesh for computing j2c
auxcell.precision = self.precision_j2c
auxcell.rcut = max([auxcell.bas_rcut(ib, auxcell.precision)
for ib in range(auxcell.nbas)])
if self.mesh_j2c is None:
self.mesh_j2c = rsdf_helper.estimate_mesh_for_omega(
auxcell, self.omega_j2c, round2odd=True)[1]
self.auxcell = auxcell
def _kpts_build(self, kpts_band=None):
if self.kpts_band is not None:
self.kpts_band = np.reshape(self.kpts_band, (-1,3))
if kpts_band is not None:
kpts_band = np.reshape(kpts_band, (-1,3))
if self.kpts_band is None:
self.kpts_band = kpts_band
else:
self.kpts_band = unique(np.vstack((self.kpts_band,kpts_band)))[0]
def _gdf_build(self, j_only=None, with_j3c=True):
# Remove duplicated k-points. Duplicated kpts may lead to a buffer
# located in incore.wrap_int3c larger than necessary. Integral code
# only fills necessary part of the buffer, leaving some space in the
# buffer unfilled.
uniq_idx = unique(self.kpts)[1]
kpts = np.asarray(self.kpts)[uniq_idx]
if self.kpts_band is None:
kband_uniq = np.zeros((0,3))
else:
kband_uniq = [k for k in self.kpts_band if len(member(k, kpts))==0]
if j_only is None:
j_only = self._j_only
if j_only:
kall = np.vstack([kpts,kband_uniq])
kptij_lst = np.hstack((kall,kall)).reshape(-1,2,3)
else:
kptij_lst = [(ki, kpts[j]) for i, ki in enumerate(kpts) for j in range(i+1)]
kptij_lst.extend([(ki, kj) for ki in kband_uniq for kj in kpts])
kptij_lst.extend([(ki, ki) for ki in kband_uniq])
kptij_lst = np.asarray(kptij_lst)
if with_j3c:
if isinstance(self._cderi_to_save, str):
cderi = self._cderi_to_save
else:
cderi = self._cderi_to_save.name
if isinstance(self._cderi, str):
if self._cderi == cderi and os.path.isfile(cderi):
logger.warn(self, 'DF integrals in %s (specified by '
'._cderi) is overwritten by GDF '
'initialization. ', cderi)
else:
logger.warn(self, 'Value of ._cderi is ignored. '
'DF integrals will be saved in file %s .',
cderi)
self._cderi = cderi
t1 = (logger.process_clock(), logger.perf_counter())
self._make_j3c(self.cell, self.auxcell, kptij_lst, cderi)
t1 = logger.timer_debug1(self, 'j3c', *t1)
def build(self, j_only=None, with_j3c=True, kpts_band=None):
# formatting k-points
self._kpts_build(kpts_band=kpts_band)
# build for range-separation hybrid
self._rs_build()
# dump flags before the final build
self.check_sanity()
self.dump_flags()
# do normal gdf build with the modified _make_j3c
self._gdf_build(j_only=j_only, with_j3c=with_j3c)
return self
RSDF = RSGDF
if __name__ == "__main__":
from pyscf.pbc import gto
cell = gto.Cell(
atom="H 0 0 0; H 0.75 0 0",
a = np.eye(3)*2.5,
basis={"H": [[0,(0.5,1.)],[1,(0.3,1.)]]},
)
cell.build()
cell.verbose = 0
scaled_center = None
# scaled_center = np.random.rand(3)
log = logger.Logger(cell.stdout, 6)
for kmesh in ([1,1,1,],[2,1,1]):
kpts = cell.make_kpts(kmesh, scaled_center=scaled_center)
log.info("kmesh= %s", kmesh)
log.info("kpts = %s", kpts)
from pyscf.pbc import scf, mp, cc
mf = scf.KRHF(cell, kpts=kpts).rs_density_fit()
mf.kernel()
mf2 = scf.KRHF(cell, kpts=kpts).density_fit()
mf2.kernel()
log.info("HF/GDF energy : % .10f", mf2.e_tot)
log.info("HF/RSGDF energy : % .10f", mf.e_tot)
log.info("difference : % .3g", (mf.e_tot-mf2.e_tot))
mc = cc.KCCSD(mf)
mc.kernel()
mc2 = cc.KCCSD(mf2)
mc2.kernel()
log.info("CCSD/GDF energy : % .10f", mc2.e_corr)
log.info("CCSD/RSGDF energy : % .10f", mc.e_corr)
log.info("difference : % .3g\n", (mc.e_corr-mc2.e_corr))
| sunqm/pyscf | pyscf/pbc/df/rsdf.py | Python | apache-2.0 | 30,824 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Container',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=36)),
('has_dangerous_goods', models.BooleanField(default=False, verbose_name='has a fire and/or chemical hazard.')),
],
options={
'ordering': ('name',),
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Dock',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=36)),
('employees', models.ManyToManyField(to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ('name',),
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Ship',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=36)),
('code', models.CharField(unique=True, max_length=24, verbose_name='unique identifier', validators=[django.core.validators.RegexValidator(b'^[\\d\\w]+$', 'Ship identifier must be composed of letters and numbers')])),
],
options={
'ordering': ('name',),
},
bases=(models.Model,),
),
migrations.CreateModel(
name='ShipInDock',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('is_active', models.BooleanField(default=True)),
('dock', models.ForeignKey(to='port.Dock')),
('ship', models.ForeignKey(to='port.Ship')),
],
options={
},
bases=(models.Model,),
),
migrations.AddField(
model_name='container',
name='ship',
field=models.ForeignKey(to='port.Ship'),
preserve_default=True,
),
]
| vero4karu/port_management | port/migrations/0001_initial.py | Python | mit | 2,622 |
import os
import logging
import json
import math
from aiotg import Bot
from database import db, text_search
greeting = """
✋ Welcome to Telegram Music Catalog! 🎧
We are a community of music fans who are eager to share what we love.
Just send your favourite tracks as audio files and they'll be available for everyone, on any device.
To search through the catalog, just type artist name or track title. Nothing found? Feel free to fix it!
"""
help = """
To search through the catalog, just type artist name or track title.
Inside a group chat you can use /music command, for example:
/music Summer of Haze
By default, the search is fuzzy but you can use double quotes to filter results:
"summer of haze"
"sad family"
To make an even stricter search, just quote both terms:
"aes dana" "haze"
"""
not_found = """
We don't have anything matching your search yet :/
But you can fix it by sending us the tracks you love as audio files!
"""
bot = Bot(
api_token=os.environ.get("424195032:AAGtwKsqZxjoFyayE1bOI8q4P4ul6-yTwDU"),
name=os.environ.get("iromoozik_bot"),
botan_token=os.environ.get("424195032:AAGtwKsqZxjoFyayE1bOI8q4P4ul6-yTwDU")
)
logger = logging.getLogger("musicbot")
@bot.handle("audio")
async def add_track(chat, audio):
if (await db.tracks.find_one({ "file_id": audio["file_id"] })):
return
if "title" not in audio:
await chat.send_text("Sorry, but your track is missing title")
return
doc = audio.copy()
doc["sender"] = chat.sender["id"]
await db.tracks.insert(doc)
logger.info("%s added %s %s",
chat.sender, doc.get("performer"), doc.get("title"))
@bot.command(r'@%s (.+)' % bot.name)
@bot.command(r'/music@%s (.+)' % bot.name)
@bot.command(r'/music (.+)')
def music(chat, match):
return search_tracks(chat, match.group(1))
@bot.command(r'\((\d+)/\d+\) show more for "(.+)"')
def more(chat, match):
page = int(match.group(1)) + 1
return search_tracks(chat, match.group(2), page)
@bot.default
def default(chat, message):
return search_tracks(chat, message["text"])
@bot.inline
async def inline(iq):
logger.info("%s searching for %s", iq.sender, iq.query)
cursor = text_search(iq.query)
results = [inline_result(t) for t in await cursor.to_list(10)]
await iq.answer(results)
@bot.command(r'/music(@%s)?$' % bot.name)
def usage(chat, match):
return chat.send_text(greeting)
@bot.command(r'/start')
async def start(chat, match):
tuid = chat.sender["id"]
if not (await db.users.find_one({ "id": tuid })):
logger.info("new user %s", chat.sender)
await db.users.insert(chat.sender.copy())
await chat.send_text(greeting)
@bot.command(r'/stop')
async def stop(chat, match):
tuid = chat.sender["id"]
await db.users.remove({ "id": tuid })
logger.info("%s quit", chat.sender)
await chat.send_text("Goodbye! We will miss you 😢")
@bot.command(r'/?help')
def usage(chat, match):
return chat.send_text(help)
@bot.command(r'/stats')
async def stats(chat, match):
count = await db.tracks.count()
group = {
"$group": {
"_id": None,
"size": {"$sum": "$file_size"}
}
}
cursor = db.tracks.aggregate([group])
aggr = await cursor.to_list(1)
if len(aggr) == 0:
return (await chat.send_text("Stats are not yet available"))
size = human_size(aggr[0]["size"])
text = '%d tracks, %s' % (count, size)
return (await chat.send_text(text))
def human_size(nbytes):
suffixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']
rank = int((math.log10(nbytes)) / 3)
rank = min(rank, len(suffixes) - 1)
human = nbytes / (1024.0 ** rank)
f = ('%.2f' % human).rstrip('0').rstrip('.')
return '%s %s' % (f, suffixes[rank])
def send_track(chat, keyboard, track):
return chat.send_audio(
audio=track["file_id"],
title=track.get("title"),
performer=track.get("performer"),
duration=track.get("duration"),
reply_markup=json.dumps(keyboard)
)
async def search_tracks(chat, query, page=1):
logger.info("%s searching for %s", chat.sender, query)
limit = 3
offset = (page - 1) * limit
cursor = text_search(query).skip(offset).limit(limit)
count = await cursor.count()
results = await cursor.to_list(limit)
if count == 0:
await chat.send_text(not_found)
return
# Return single result if we have exact match for title and performer
if results[0]['score'] > 2:
limit = 1
results = results[:1]
newoff = offset + limit
show_more = count > newoff
if show_more:
pages = math.ceil(count / limit)
kb = [['(%d/%d) Show more for "%s"' % (page, pages, query)]]
keyboard = {
"keyboard": kb,
"resize_keyboard": True
}
else:
keyboard = { "hide_keyboard": True }
for track in results:
await send_track(chat, keyboard, track)
def inline_result(track):
return {
"type": "audio",
"id": track["file_id"],
"audio_file_id": track["file_id"],
"title": "{} - {}".format(
track.get("performer", "Unknown Artist"),
track.get("title", "Untitled")
)
}
| bytecrash/iromoozik | bot/bot.py | Python | mit | 5,275 |
#!/usr/bin/env python
# encoding: utf-8
import sys
import requests
from Naked.settings import debug as DEBUG_FLAG
#------------------------------------------------------------------------------
#[ HTTP class]
# handle HTTP requests
# Uses the requests external library to handle HTTP requests and response object (available on PyPI)
#------------------------------------------------------------------------------
class HTTP():
def __init__(self, url="", request_timeout=10):
self.url = url
self.request_timeout = request_timeout
#------------------------------------------------------------------------------
# HTTP response properties (assignment occurs with the HTTP request methods)
#------------------------------------------------------------------------------
self.res = None # assigned with the requests external library response object after a HTTP method call
#------------------------------------------------------------------------------
# [ get method ] (string) -
# HTTP GET request - returns text string
# returns data stream read from the URL (string)
# Default timeout = 10 s from class constructor
# Re-throws ConnectionError on failed connection (e.g. no site at URL)
# Test : test_NETWORK.py :: test_http_get, test_http_get_response_change,
# test_http_post_reponse_change, test_http_get_response_check
#------------------------------------------------------------------------------
def get(self, follow_redirects=True):
try:
response = requests.get(self.url, timeout=self.request_timeout, allow_redirects=follow_redirects)
self.res = response # assign the response object from requests to a property on the instance of HTTP class
return response.text
except requests.exceptions.ConnectionError as ce:
return False
except Exception as e:
if DEBUG_FLAG:
sys.stderr.write("Naked Framework Error: Unable to perform GET request with the URL " + self.url + " using the get() method (Naked.toolshed.network.py)")
raise e
#------------------------------------------------------------------------------
# [ get_data method ] (binary data)
# HTTP GET request, return binary data
# returns data stream with raw binary data
#------------------------------------------------------------------------------
def get_bin(self):
try:
response = requests.get(self.url, timeout=self.request_timeout)
self.res = response # assign the response object from requests to a property on the instance
return response.content # return binary data instead of text (get() returns text)
except requests.exceptions.ConnectionError as ce:
return False
except Exception as e:
if DEBUG_FLAG:
sys.stderr.write("Naked Framework Error: Unable to perform GET request with the URL " + self.url + " using the get_data() method (Naked.toolshed.network.py)")
raise e
#------------------------------------------------------------------------------
# [ get_bin_write_file method ] (boolean)
# open HTTP data stream with GET request, make file with the returned binary data
# file path is passed to the method by the developer
# set suppress_output to True if you want to suppress the d/l status information that is printed to the standard output stream
# return True on successful pull and write to disk
# Tests: test_NETWORK.py :: test_http_get_binary
#------------------------------------------------------------------------------
def get_bin_write_file(self, filepath="", suppress_output = False, overwrite_existing = False):
try:
import os # used for os.fsync() method in the write
# Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
if not overwrite_existing:
from Naked.toolshed.system import file_exists
if file_exists(filepath):
if not suppress_output:
print("Download aborted. A local file with the requested filename exists on the path.")
return False
if (filepath == "" and len(self.url) > 1):
filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
if not suppress_output:
sys.stdout.write("Downloading file from " + self.url + "...")
sys.stdout.flush()
response = requests.get(self.url, timeout=self.request_timeout, stream=True)
self.res = response
with open(filepath, 'wb') as f: # write as binary data
for chunk in response.iter_content(chunk_size=2048):
f.write(chunk)
f.flush()
os.fsync(f.fileno()) # flush all internal buffers to disk
if not suppress_output:
print(" ")
print("Download complete.")
return True # return True if successful write
except requests.exceptions.ConnectionError as ce:
return False
except Exception as e:
if DEBUG_FLAG:
sys.stderr.write("Naked Framework Error: Unable to perform GET request and write file with the URL " + self.url + " using the get_bin_write_file() method (Naked.toolshed.network.py)")
raise e
#------------------------------------------------------------------------------
# [ get_txt_write_file method ] (boolean)
# open HTTP data stream with GET request, write file with utf-8 encoded text using returned text data
# file path is passed to the method by the developer (default is the base filename in the URL if not specified)
# return True on successful pull and write to disk
# Tests: test_NETWORK.py :: test_http_get_text
#------------------------------------------------------------------------------
def get_txt_write_file(self, filepath="", suppress_output = False, overwrite_existing = False):
try:
import os # used for os.fsync() method in the write
# Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
if not overwrite_existing:
from Naked.toolshed.system import file_exists
if file_exists(filepath):
if not suppress_output:
print("Download aborted. A local file with the requested filename exists on the path.")
return False
if (filepath == "" and len(self.url) > 1):
filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
if not suppress_output:
sys.stdout.write("Downloading file from " + self.url + "...")
sys.stdout.flush()
response = requests.get(self.url, timeout=self.request_timeout, stream=True)
self.res = response
import codecs
with codecs.open(filepath, mode='w', encoding="utf-8") as f: #write as text
for chunk in response.iter_content(chunk_size=2048):
chunk = chunk.decode('utf-8')
f.write(chunk)
f.flush()
os.fsync(f.fileno()) # flush all internal buffers to disk
if not suppress_output:
print(" ")
print("Download complete.")
return True # return True if successful write
except requests.exceptions.ConnectionError as ce:
return False
except Exception as e:
if DEBUG_FLAG:
sys.stderr.write("Naked Framework Error: Unable to perform GET request and write file with the URL " + self.url + " using the get_data_write_txt() method (Naked.toolshed.network.py)")
raise e
#------------------------------------------------------------------------------
# [ head method ] (dictionary of strings)
# HTTP HEAD request
# returns a dictionary of the header strings
# test for a specific header on either the response dictionary or the instance res property
# Usage example:
# content_type = instance.res['content-type']
# Tests: test_NETWORK.py :: test_http_head
#------------------------------------------------------------------------------
def head(self):
try:
response = requests.head(self.url, timeout=self.request_timeout)
self.res = response # assign the response object from requests to a property on the instance of HTTP class
return response.headers
except requests.exceptions.ConnectionError as ce:
return False
except Exception as e:
if DEBUG_FLAG:
sys.stderr.write("Naked Framework Error: Unable to perform a HEAD request with the head() method (Naked.toolshed.network.py).")
raise e
#------------------------------------------------------------------------------
# [ post method ] (string)
# HTTP POST request for text
# returns text from the URL as a string
#------------------------------------------------------------------------------
def post(self, follow_redirects=True):
try:
response = requests.post(self.url, timeout=self.request_timeout, allow_redirects=follow_redirects)
self.res = response # assign the response object from requests to a property on the instance of HTTP class
return response.text
except requests.exceptions.ConnectionError as ce:
return False
except Exception as e:
if DEBUG_FLAG:
sys.stderr.exit("Naked Framework Error: Unable to perform a POST request with the post() method (Naked.toolshed.network.py).")
raise e
#------------------------------------------------------------------------------
# [ post_bin method ] (binary data)
# HTTP POST request for binary data
# returns binary data from the URL
#------------------------------------------------------------------------------
def post_bin(self):
try:
response = requests.post(self.url, timeout=self.request_timeout)
self.res = response # assign the response object from requests to a property on the instance of HTTP class
return response.content
except requests.exceptions.ConnectionError as ce:
return False
except Exception as e:
if DEBUG_FLAG:
sys.stderr.exit("Naked Framework Error: Unable to perform POST request with the post_bin() method (Naked.toolshed.network.py).")
raise e
#------------------------------------------------------------------------------
# [ post_bin_write_file method ] (boolean = success of write)
# HTTP POST request, write binary file with the response data
# default filepath is the basename of the URL file, may be set by passing an argument to the method
# returns a boolean that indicates the success of the file write
#------------------------------------------------------------------------------
def post_bin_write_file(self, filepath="", suppress_output = False, overwrite_existing = False):
try:
import os # used for os.fsync() method in the write
# Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
if not overwrite_existing:
from Naked.toolshed.system import file_exists
if file_exists(filepath):
if not suppress_output:
print("Download aborted. A local file with the requested filename exists on the path.")
return False
if (filepath == "" and len(self.url) > 1):
filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
if not suppress_output:
sys.stdout.write("Downloading file from " + self.url + "...") #provide information about the download to user
sys.stdout.flush()
response = requests.post(self.url, timeout=self.request_timeout, stream=True)
self.res = response
with open(filepath, 'wb') as f: # write as binary data
for chunk in response.iter_content(chunk_size=2048):
f.write(chunk)
f.flush()
os.fsync(f.fileno()) # flush all internal buffers to disk
if not suppress_output:
print(" ")
print("Download complete.") # provide user with completion information
return True # return True if successful write
except requests.exceptions.ConnectionError as ce:
return False
except Exception as e:
if DEBUG_FLAG:
sys.stderr.write("Naked Framework Error: Unable to perform POST request and write file with the URL " + self.url + " using the post_data_write_bin() method (Naked.toolshed.network.py)")
raise e
#------------------------------------------------------------------------------
# [ post_txt_write_file method ] (boolean = success of file write)
# HTTP POST request, write utf-8 encoded text file with the response data
# default filepath is the basename of the URL file, may be set by passing an argument to the method
# returns a boolean that indicates the success of the file write
#------------------------------------------------------------------------------
def post_txt_write_file(self, filepath="", suppress_output = False, overwrite_existing = False):
try:
import os # used for os.fsync() method in the write
# Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
if not overwrite_existing:
from Naked.toolshed.system import file_exists
if file_exists(filepath):
if not suppress_output:
print("Download aborted. A local file with the requested filename exists on the path.")
return False
if (filepath == "" and len(self.url) > 1):
filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
if not suppress_output:
sys.stdout.write("Downloading file from " + self.url + "...") #provide information about the download to user
sys.stdout.flush()
response = requests.post(self.url, timeout=self.request_timeout, stream=True)
self.res = response
import codecs
with codecs.open(filepath, mode='w', encoding="utf-8") as f: # write as binary data
for chunk in response.iter_content(chunk_size=2048):
chunk = chunk.decode('utf-8')
f.write(chunk)
f.flush()
os.fsync(f.fileno()) # flush all internal buffers to disk
if not suppress_output:
print(" ")
print("Download complete.") # provide user with completion information
return True # return True if successful write
except requests.exceptions.ConnectionError as ce:
return False
except Exception as e:
if DEBUG_FLAG:
sys.stderr.write("Naked Framework Error: Unable to perform POST request and write file with the URL " + self.url + " using the post_data_write_bin() method (Naked.toolshed.network.py)")
raise e
#------------------------------------------------------------------------------
# [ response method ]
# getter method for the requests library object that is assigned as a property
# on the HTTP class after a HTTP request method is run (e.g. get())
# Note: must run one of the HTTP request verbs to assign this property before use of getter (=None by default)
# Tests: test_NETWORK.py :: test_http_get_response_check
#------------------------------------------------------------------------------
def response(self):
try:
return self.res
except Exception as e:
if DEBUG_FLAG:
sys.stderr.write("Naked Framework Error: Unable to return the response from your HTTP request with the response() method (Naked.toolshed.network.py).")
raise e
#------------------------------------------------------------------------------
# [ get_status_ok method ] (boolean)
# return boolean whether HTTP response was in 200 status code range for GET request
# Note: this method runs its own GET request, does not need to be run separately
# Tests: test_NETWORK.py ::
#------------------------------------------------------------------------------
def get_status_ok(self):
try:
self.get() #run the get request
if self.res and self.res.status_code:
return (self.res.status_code == requests.codes.ok)
else:
return False
except requests.exceptions.ConnectionError as ce:
return False
except Exception as e:
if DEBUG_FLAG:
sys.stderr.write("Naked Framework Error: Unable to obtain the HTTP status with the get_status_ok() method (Naked.toolshed.network.py).")
raise e
#------------------------------------------------------------------------------
# [ post_status_ok method ] (boolean)
# return boolean whether HTTP response was in 200 status code range for POST request
# Note: method runs its own post method, not necessary to run separately
#------------------------------------------------------------------------------
def post_status_ok(self):
try:
self.post() #run the post request
if self.res and self.res.status_code:
return (self.res.status_code == requests.codes.ok)
else:
return False
except requests.exceptions.ConnectionError as ce:
return False
except Exception as e:
if DEBUG_FLAG:
sys.stderr.write("Naked Framework Error: Unable to obtain the HTTP status with the post_status_ok() method (Naked.toolshed.network.py).")
raise e
if __name__ == '__main__':
pass
#------------------------------------------------------------------------------
# HTTP GET 1
#------------------------------------------------------------------------------
# http = HTTP("http://www.google.com")
# data = http.get()
# print(data)
# from Naked.toolshed.file import FileWriter
# w = FileWriter("testfile.txt")
# w.write_utf8(data)
#------------------------------------------------------------------------------
# HTTP GET 2
#------------------------------------------------------------------------------
# http = HTTP()
# http.url = "http://www.google.com"
# print(http.get())
| xmission/d-note | venv/lib/python2.7/site-packages/Naked/toolshed/network.py | Python | agpl-3.0 | 19,525 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webmath.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| tmwebmath/webmath | manage.py | Python | gpl-2.0 | 250 |
def histograms():
temp = {'DMmass':
{#'column' : 25,
'column' : 12,
'file' : 'DMmass',
'bins' : 20,
'min' : 1.,
'max' : 7000.}
,
'vmax':
{'column' : 28,
'file' : 'vmax',
'bins' : 25,
'min' : 10.,
'max' : 1000.}
,
'coldGas':
{'column' : 29,
'file' : 'coldGas',
'bins' : 25,
'min' : 1.,
'max' : 3.0}
,
'stellarMass':
{'column' : 30,
'file' : 'stellarMass',
'bins' : 25,
'min' : 1.,
'max' : 30.}
,
'sfr':
{'column' : 40,
'file' : 'sfr',
'bins' : 15,
'min' : 1,
'max' : 10}
,
'magb':
{'column' : 45,
'file' : 'magb',
'bins' : 20,
'min' : -24,
'max' : -19}
,
'massWeightedAge':
{'column' : 60,
'file' : 'massWeightedAge',
'bins' : 20,
'min' : 1,
'max' : 13}
,
'colour':
{'column' : 'xx',
'file' : 'colour',
'bins' : 30,
'min' : 0.2,
'max' : 2.0}
,
'companions':
{'column': 'yy',
'file' : 'companions',
'bins' : 35,
'min' : 0,
'max' : 35}
,
'morphology':
{'column': 62,
'file' : 'morphology',
'bins' : 20,
'min' : -9,
'max' : -4}
}
return temp
def SMNhistogram(file, data1, data2, bins, min, max, save, volume):
import numpy as N
import pylab as P
from math import log
fig = P.figure()
ax = fig.add_subplot(111)
colour1 = "0.8" # "r"
colour2 = "0.4" # "b"
pattern1 = 'x'
pattern2 = '/'
if file == 'DMmass':
#E histogram
(nE, binsE) = N.histogram(N.log(data2), bins=bins, range = (log(min),log(max)))
widE = binsE[0] - binsE[1]
#fEs histogram
(nfE, binsfE) = N.histogram(N.log(data1), bins=bins, range = (log(min),log(max)))
widfE = binsfE[0] - binsfE[1]
else:
#E histogram
(nE, binsE) = N.histogram(data2, bins=bins, range = (min,max))
widE = binsE[0] - binsE[1]
#fEs histogram
(nfE, binsfE) = N.histogram(data1, bins=bins, range = (min,max))
widfE = binsfE[0] - binsfE[1]
#print nE/volume
#E histogram
if file == 'companions':
#bars1 = ax.bar((binsfE-widfE), nfE/volume, width=(widfE*0.9), log=True, label = 'Large Sphere', align = 'edge',
# color = colour1, edgecolor = 'k', alpha = 0.6, lw = 1.5)
bars1 = ax.bar((binsfE[:bins]-widfE), nfE/volume, width=(widfE*0.8), log=True, label = 'Large Sphere',
color = colour1, edgecolor = 'k', alpha = 0.6, lw = 1.5)
for bar in bars1: bar.set_hatch(pattern1)
else:
# bars1 = ax.bar((binsE-widE), nE/volume, width=(widE*0.9), log=True, label = 'Es', align = 'edge',
# color = colour1, edgecolor = 'k', alpha = 0.4, lw = 1.5)
bars1 = ax.bar((binsE[:bins]-widE), nE/volume, width=(widE*0.8), log=True, label = 'Es', align = 'edge',
color = colour1, edgecolor = 'k', alpha = 0.4, lw = 1.5)
for bar in bars1: bar.set_hatch(pattern1)
#fE histogram
if file == 'companions':
# bars2 = ax.bar((binsE-widE), nE/volume, width=(widE*.9), log=True, label = 'Small Sphere', align = 'edge',
# color = colour2, edgecolor = 'k', alpha = 0.4, lw = 1.5)
bars2 = ax.bar((binsE[:bins]-widE), nE/volume, width=(widE*.8), log=True, label = 'Small Sphere', align = 'edge',
color = colour2, edgecolor = 'k', alpha = 0.4, lw = 1.5)
for bar in bars2: bar.set_hatch(pattern2)
else:
# bars2 = ax.bar((binsfE-widfE), nfE/volume, width=(widfE*.9), log=True, label = 'IfEs', align = 'edge',
# color = colour2, edgecolor = 'k', alpha = 0.6, lw = 1.5)
bars2 = ax.bar((binsfE[:bins]-widfE), nfE/volume, width=(widfE*.8), log=True, label = 'IfEs', align = 'edge',
color = colour2, edgecolor = 'k', alpha = 0.6, lw = 1.5)
for bar in bars2: bar.set_hatch(pattern2)
if (file == 'vmax'): P.xlabel("$V_{max}$ (kms$^{-1}$)")
if (file == 'coldGas'): P.xlabel('Mass in cold gas $(10^{10}h^{-1}$M$_{\odot}$)')
if (file == 'stellarMass'): P.xlabel('Stellar Mass $(10^{10}h^{-1}$M$_{\odot}$)')
if (file == 'sfr'): P.xlabel('Star Formation Rate (M$_{\odot})$yr$^{-1}$')
if (file == 'magb'): P.xlabel('Absolute rest frame B Magnitude (Vega)')
if (file == 'massWeightedAge'): P.xlabel('Mass Weighted Age ($10^{9}$yr)')
if (file == 'DMmass'): P.xlabel('$\log$(Virial Dark Matter Mass) $(10^{10}h^{-1}$M$_{\odot}$)')
if (file == 'colour'): P.xlabel('B - R (mag)')
if (file == 'companions'): P.xlabel('Number of Companions')
if (file == 'morphology'): P.xlabel('Morphology T')
#P.title("Mass Distributions")
P.ylabel("Number Density ($h^{3}$Mpc$^{-3}$)")
P.ylim(3.*10.**-8., 10.**-4.)
P.legend()
if file == 'DMmass':
#P.xscale('log')
P.ylim(3.*10.**-8., 10.**-4.)
if save : P.savefig(file+'.eps')
else: P.show()
P.close()
def main(saved):
import scipy.stats as S
import numpy as N
#Constants
save = saved
bmag = 45
volume = 5.*194.**3.
type = 9
#Reads data
ET4 = N.loadtxt("EllipticalsT4.out")
fEsall = N.loadtxt("FieldEllipticals.out")
#marks only the ones which fulfil criterion
indices = N.where(ET4[:,bmag] <= -19.)
ET4magb = ET4[indices]
#Takes away three that are actually subhaloes...
ind = N.where(fEsall[:,type] == 0)
fEs = fEsall[ind]
hists = histograms()
print '\nNumber of fEs and Es:\n %i %i' % (len(fEs), len(ET4magb))
for plot in hists:
column = hists[plot]['column']
file = hists[plot]['file']
bins = hists[plot]['bins']
min = hists[plot]['min']
max = hists[plot]['max']
if (file == 'colour'):
temp = fEs[:,45] - fEs[:,47]
temp1 = ET4magb[:,45] - ET4magb[:,47]
elif (file == 'companions'):
temp = fEs[:,63] + fEs[:,64]
temp1 = fEs[:,64]
else:
temp = fEs[:,column]
temp1 = ET4magb[:,column]
SMNhistogram(file, temp, temp1, bins, min, max, save, volume)
D, p = S.ks_2samp(temp, temp1)
print '\nKolmogorov-Smirnov statistics for %s:' % file
print 'D-value = %e \np-value = %e' % (D, p)
print '\nStatistics 1st fEs and then Es:'
print ("%20s" + "%15s"*7) % ("Name", "1st Quart", "Median", "3rd Quart", "Max", "Min", "Mean", "Stdev")
frmt = "%14s & %12.2f & %12.2f & %12.2f & %12.2f & %12.2f & %12.2f & %12.2f"
frmt1 = "IfEs &" + frmt
frmt2 = "Es &" + frmt
print frmt1 % (file, S.scoreatpercentile(temp, 25),
N.median(temp), S.scoreatpercentile(temp, 75),
N.max(temp), N.min(temp), N.mean(temp), N.std(temp))
print frmt2 % (file, S.scoreatpercentile(temp1, 25),
N.median(temp1), S.scoreatpercentile(temp1, 75),
N.max(temp1), N.min(temp1), N.mean(temp1), N.std(temp1))
if (__name__ == '__main__'):
main(saved = True)
| sniemi/SamPy | sandbox/src2/AnalyseFieldEs.py | Python | bsd-2-clause | 7,757 |
# /usr/bin/env python
'''
Written by Kong Xiaolu and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
'''
import os
import numpy as np
import torch
import CBIG_pMFM_basic_functions as fc
def CBIG_mfm_test_desikan_main(gpu_index=0):
'''
This function is to implement the testing processes of mean field model.
The objective function is the summation of FC correlation cost and FCD KS statistics cost.
Args:
gpu_index: index of gpu used for optimization
input_path: input directory to load validation data
output_path: output directory for saving selected model parameters and costs on test set
Returns:
None
'''
input_path = '../output/rsfcpc2_rsfc/validation/'
output_path = '../output/rsfcpc2_rsfc/test/'
if not os.path.isdir(output_path):
os.makedirs(output_path)
torch.cuda.set_device(gpu_index)
torch.cuda.manual_seed(1)
n_set = 100
n_dup = 10
n_node = 68
vali_raw_all = np.zeros((3 * n_node + 1 + 8, 1))
print('Get data')
for i in range(1, 11):
load_file = 'random_seed_' + str(i) + '.csv'
load_path = os.path.join(input_path, load_file)
xmin = fc.csv_matrix_read(load_path)
index_mat = np.zeros((2, xmin.shape[1]))
index_mat[0, :] = i
index_mat[1, :] = np.arange(xmin.shape[1])
xmin = np.concatenate((index_mat, xmin), axis=0)
vali_raw_all = np.concatenate((vali_raw_all, xmin), axis=1)
vali_raw_all = vali_raw_all[:, 1:]
vali_index = np.argsort(vali_raw_all[7, :])
vali_sort_all = vali_raw_all[:, vali_index]
vali_sel_num = 10
i = 0
vali_sel = np.zeros((vali_raw_all.shape[0], vali_sel_num))
p = 0
p_set = np.zeros(vali_sel_num)
print('select data')
while i < vali_sel_num and p < vali_raw_all.shape[1]:
corr_t = np.zeros(vali_sel_num, dtype=bool)
corr_tr = np.zeros((vali_sel_num, 3))
for j in range(vali_sel_num):
w_corr = np.corrcoef(vali_sel[8:8 + n_node, j:j + 1].T,
vali_sort_all[8:8 + n_node, p:p + 1].T)
i_corr = np.corrcoef(
vali_sel[8 + n_node:8 + 2 * n_node, j:j + 1].T,
vali_sort_all[8 + n_node:8 + 2 * n_node, p:p + 1].T)
s_corr = np.corrcoef(vali_sel[9 + 2 * n_node:, j:j + 1].T,
vali_sort_all[9 + 2 * n_node:, p:p + 1].T)
corr_tr[j, 0] = w_corr[0, 1]
corr_tr[j, 1] = i_corr[0, 1]
corr_tr[j, 2] = s_corr[0, 1]
for k in range(vali_sel_num):
corr_t[k] = (corr_tr[k, :] > 0.98).all()
if not corr_t.any():
vali_sel[:, i] = vali_sort_all[:, p]
p_set[i] = p
i += 1
p += 1
result_save = np.zeros((3 * n_node + 1 + 11, vali_sel_num))
result_save[0:8, :] = vali_sel[0:8, :]
result_save[11:, :] = vali_sel[8:, :]
print('Start testing')
for j in range(vali_sel_num):
test_cost = np.zeros((3, n_set))
for k in range(1):
arx = np.tile(vali_sel[8:, j:j + 1], [1, n_set])
total_cost, fc_cost, fcd_cost = fc.CBIG_combined_cost_test(
arx, n_dup)
test_cost[0, n_set * k:n_set * (k + 1)] = fc_cost
test_cost[1, n_set * k:n_set * (k + 1)] = fcd_cost
test_cost[2, n_set * k:n_set * (k + 1)] = total_cost
test_file = os.path.join(output_path,
'test_num_' + str(j + 1) + '.csv')
np.savetxt(test_file, test_cost, delimiter=',')
result_save[8, j] = np.nanmean(test_cost[0, :])
result_save[9, j] = np.nanmean(test_cost[1, :])
result_save[10, j] = np.nanmean(test_cost[2, :])
print('**************** finish top ' + str(j + 1) +
' test ****************')
test_file_all = os.path.join(output_path, 'test_all.csv')
np.savetxt(test_file_all, result_save, delimiter=',')
if __name__ == '__main__':
CBIG_mfm_test_desikan_main(gpu_index=0)
| ThomasYeoLab/CBIG | stable_projects/fMRI_dynamics/Kong2021_pMFM/part2_pMFM_control_analysis/Primary_gradients/scripts/CBIG_pMFM_step33_test_GradPC2Grad.py | Python | mit | 4,115 |
import sys
import os
import time
import logging
import tempfile
import subprocess
import _thread
import traceback
import tornado.web
import tornado.ioloop
import tornado.gen
import requests
import psutil
from .ssh import SSHRemoteForward
log = logging.getLogger('curlbomb.server')
class CurlbombBaseRequestHandler(tornado.web.RequestHandler):
"""Base RequestHandler
Implementations:
- CurlbombResourceRequestHandler
- CurlbombStreamRequestHandler
"""
def initialize(self, resource, state, allowed_gets=1, knock=None,
mime_type='text/plain', allow_post_backs=False,
log_post_backs=False, postback_log_file=None, get_callback=None):
"""Arguments:
resource - A file like object to serve the contents of
state - State dictionary to maintain across requests
allowed_gets - Number of gets allowed before quiting
knock - The required X-knock header the client must send, or None
mime_type - The mime type the server should declare the content as
allow_post_backs - Allow client to post data back to the server.
Delays server termination until post_backs == allowed_gets
log_post_backs - Log post backs to stdout
postback_log_file - Log post backs to file
get_callback - callback to run when get is finished, passes request
*args - The rest of the RequestHandler args
**kwargs - The rest of the RequestHandler kwargs
"""
self._resource = resource
self._allowed_gets = allowed_gets
self._knock = knock
self._mime_type = mime_type
self._allow_post_backs = allow_post_backs
self._get_callback = get_callback
self._log_post_backs = log_post_backs
self._postback_log_file = postback_log_file
self._state = state
def prepare(self):
self.request.start_time = time.time()
# Validate X-knock header if one is required:
if self._knock is not None:
x_knock = self.get_argument(
'knock', self.request.headers.get('X-knock', None))
if x_knock != self._knock:
log.info("Invalid knock")
raise tornado.web.HTTPError(401, 'Invalid knock')
def shutdown_if_ready(self):
"""Shutdown if it's time to shutdown"""
# If the resource has been retrieved all the times it's allowed:
if self._allowed_gets > 0 and self._allowed_gets <= self._state['num_gets']:
num_post_backs = self._state['num_posts']
# If we're still waiting for post backs:
if self._allow_post_backs and num_post_backs < self._allowed_gets:
log.info("Waiting for {} more post backs from client".format(
self._allowed_gets - num_post_backs))
else:
# Shutdown:
log.info("Served resource {} times. Done. Waiting for network buffers to clear".format(self._state['num_gets']))
# Query psutil for ongoing socket connections that we don't want to kill yet:
proc = psutil.Process(os.getpid())
while True:
for conn in proc.connections():
if conn.status == 'ESTABLISHED':
time.sleep(1)
break
else:
break
tornado.ioloop.IOLoop.current().stop()
def write_error(self, status_code, **kwargs):
try:
log_message = kwargs.get('exc_info')[1].log_message
except (TypeError, AttributeError, IndexError):
log_message = 'unknown reason'
self.finish(log_message+'\r\n')
class CurlbombResourceWrapperRequestHandler(tornado.web.RequestHandler):
"""Serve a script that wraps another curlbomb"""
def initialize(self, curlbomb_command):
self.__curlbomb_command = curlbomb_command
def get(self):
self.set_status(200)
self.write(self.__curlbomb_command)
self.finish()
def head(self):
"""Allow head requests, does not count towards num_gets and does not require a knock"""
pass
class CurlbombResourceRequestHandler(CurlbombBaseRequestHandler):
"""Serve a file like resource a limited number of times.
Allow response data to be posted back."""
def get(self):
if self._allowed_gets == 0 or self._state['num_gets'] < self._allowed_gets:
# Client is allowed to get:
self.set_status(200)
self.add_header("Content-type", self._mime_type)
self.write(self._resource.read())
self._state['num_gets'] += 1
else:
# Client is not allowed to get any more:
log.info("Resource denied (max gets reached) to: {}".format(
self.request.remote_ip))
raise tornado.web.HTTPError(405, 'Client is not allowed to GET anymore')
self.finish()
if self._state['num_gets'] < self._allowed_gets or self._allowed_gets == 0:
self._resource.seek(0)
if self._get_callback is not None:
self._get_callback(self.request)
self.shutdown_if_ready()
def head(self):
"""Allow head requests, does not count towards num_gets and does not require a knock"""
pass
@tornado.web.stream_request_body
class CurlbombStreamRequestHandler(CurlbombBaseRequestHandler):
"""Stream output of script from client back to the server"""
def data_received(self, data):
"""Handle incoming PUT data"""
if self._log_post_backs:
sys.stdout.buffer.write(data)
if self._postback_log_file:
self._postback_log_file.write(data)
self._postback_log_file.flush()
def put(self):
"""Finish streamed PUT request"""
self._state['num_posts_in_progress'] -= 1
self._state['num_posts'] += 1
self.finish()
self.shutdown_if_ready()
def post(self):
self.put()
def prepare(self):
CurlbombBaseRequestHandler.prepare(self)
log.info("Stream prepare")
if not self._allow_post_backs:
raise tornado.web.HTTPError(405, 'This server is not configured to allow data upload')
if (self._state['num_posts'] +
self._state['num_posts_in_progress']) >= self._allowed_gets and self._allowed_gets != 0:
raise tornado.web.HTTPError(403, 'Maximum number of posts reached')
self._state['num_posts_in_progress'] += 1
class ErrorRequestHandler(tornado.web.RequestHandler):
def get(self):
raise tornado.web.HTTPError(404, 'Not Found')
def run_server(settings):
settings['state'] = {'num_gets': 0, 'num_posts': 0, 'num_posts_in_progress': 0}
curlbomb_args = dict(
resource=settings['resource'],
state=settings['state'],
allowed_gets=settings['num_gets'],
knock=settings['knock'],
mime_type=settings['mime_type'],
allow_post_backs=settings['receive_postbacks'],
log_post_backs=settings['log_post_backs'],
postback_log_file=settings['postback_log_file'],
get_callback=settings.get('get_callback', None)
)
unwrapped_script = settings['get_curlbomb_command'](settings, unwrapped=True)
if not settings['client_quiet'] and settings['time_command']:
unwrapped_script = "time "+unwrapped_script
app = tornado.web.Application(
[
(r"/", CurlbombResourceWrapperRequestHandler,
dict(curlbomb_command=unwrapped_script)),
(r"/r", CurlbombResourceRequestHandler, curlbomb_args),
(r"/s", CurlbombStreamRequestHandler, curlbomb_args)
], default_handler_class=ErrorRequestHandler
)
global httpd
httpd = app.listen(
settings['port'],
ssl_options=settings['ssl_context'],
max_buffer_size=1024E9)
## Start SSH tunnel if requested:
httpd.ssh_conn = None
if settings['ssh']:
if settings['ssl'] is False:
log.warn("Using --ssh without --ssl is probably not a great idea")
httpd.ssh_conn = SSHRemoteForward(
settings['ssh_host'], settings['ssh_forward'], settings['ssh_port'])
httpd.ssh_conn.start()
if not httpd.ssh_conn.wait_connected():
log.error(httpd.ssh_conn.last_msg)
sys.exit(1)
cmd = settings['get_curlbomb_command'](settings)
if not settings['quiet']:
if settings['stdout'].isatty():
sys.stderr.write("Paste this command on the client:\n\n")
sys.stderr.write(" {}\n\n".format(cmd))
if settings['passphrase']:
sys.stderr.write("Client passphrase: {}\n\n".format(settings['passphrase']))
else:
# Print the client command to stdout as long as we aren't logging post backs:
if not settings['log_post_backs']:
sys.stdout.write("{}\n".format(cmd))
sys.stdout.flush()
try:
log.debug("server ready on local port {}".format(settings['port']))
tornado.ioloop.IOLoop.current().start()
except KeyboardInterrupt:
if settings['verbose']:
traceback.print_exc()
finally:
httpd.stop()
if httpd.ssh_conn is not None:
httpd.ssh_conn.kill()
settings['resource'].close()
if settings['log_process']:
if settings['postback_log_file']:
settings['postback_log_file'].close()
settings['log_process'].wait()
log.info("run_server done")
return settings.get('return_code', 0)
| EnigmaCurry/curlbomb | curlbomb/server.py | Python | mit | 9,906 |
#!/usr/bin/env python
#
# Gaze tracking calibration
# - use calibration video heatmap and priors
#
# AUTHOR : Mike Tyszka
# PLACE : Caltech
# DATES : 2014-05-15 JMT From scratch
#
# This file is part of mrgaze.
#
# mrgaze 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.
#
# mrgaze is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with mrgaze. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright 2014 California Institute of Technology.
import os
import cv2
import json
import numpy as np
import pylab as plt
from skimage import filters, exposure
from scipy import ndimage
from mrgaze import moco, engine
def AutoCalibrate(ss_res_dir, cfg):
'''
Automatic calibration transform from pupil center timeseries
'''
# Get fixation heatmap percentile limits and Gaussian blur sigma
pmin = cfg.getfloat('CALIBRATION', 'heatpercmin')
pmax = cfg.getfloat('CALIBRATION', 'heatpercmax')
plims = (pmin, pmax)
sigma = cfg.getfloat('CALIBRATION', 'heatsigma')
# Get target coordinates
targetx = json.loads(cfg.get('CALIBRATION', 'targetx'))
targety = json.loads(cfg.get('CALIBRATION', 'targety'))
# Gaze space target coordinates (n x 2)
targets = np.array([targetx, targety]).transpose()
# Calibration pupilometry file
cal_pupils_csv = os.path.join(ss_res_dir,'cal_pupils.csv')
if not os.path.isfile(cal_pupils_csv):
print('* Calibration pupilometry not found - returning')
return False
# Read raw pupilometry data
p = engine.ReadPupilometry(cal_pupils_csv)
# Extract useful timeseries
t = p[:,0] # Video soft timestamp
px = p[:,2] # Video pupil center, x
py = p[:,3] # Video pupil center, y
blink = p[:,4] # Video blink
# Remove NaNs (blinks, etc) from t, x and y
ok = np.where(blink == 0)
t, x, y = t[ok], px[ok], py[ok]
# Find spatial fixations and sort temporally
# Returns heatmap with axes
fixations, hmap, xedges, yedges = FindFixations(x, y, plims, sigma)
# Temporally sort fixations - required for matching to targets
fixations = SortFixations(t, x, y, fixations)
# Plot labeled calibration heatmap to results directory
PlotCalibration(ss_res_dir, hmap, xedges, yedges, fixations)
# Check for autocalibration problems
n_targets = targets.shape[0]
n_fixations = fixations.shape[0]
if n_targets == n_fixations:
# Compute calibration mapping video to gaze space
C = CalibrationModel(fixations, targets)
# Determine central fixation coordinate in video space
central_fix = CentralFixation(fixations, targets)
# Write calibration results to CSV files in the results subdir
WriteCalibration(ss_res_dir, fixations, C, central_fix)
else:
print('* Number of detected fixations (%d) and targets (%d) differ - exiting' % (n_fixations, n_targets))
# Return empty/dummy values
C = np.array([])
central_fix = 0.0, 0.0
return C, central_fix
def FindFixations(x, y, plims=(5,95), sigma=2.0):
'''
Find fixations by blob location in pupil center heat map
Fixations returned are not time ordered
'''
# Find robust ranges
xmin, xmax = np.percentile(x, plims)
ymin, ymax = np.percentile(y, plims)
# Expand bounding box by 30%
sf = 1.30
hx, hy = (xmax - xmin) * sf * 0.5, (ymax - ymin) * sf * 0.5
cx, cy = (xmin + xmax) * 0.5, (ymin + ymax) * 0.5
xmin, xmax = cx - hx, cx + hx
ymin, ymax = cy - hy, cy + hy
# Compute calibration video heatmap
hmap, xedges, yedges = HeatMap(x, y, (xmin, xmax), (ymin, ymax), sigma)
# Heatmap dimensions
# *** Note y/row, x/col ordering
ny, nx = hmap.shape
# Determine blob threshold for heatmap
# Need to accommodate hotspots from longer fixations
# particularly at center.
# A single fixation blob shouldn't exceed 1% of total frame
# area so clamp heatmap to 99th percentile
pA, pB = np.percentile(hmap, (0, 99))
hmap = exposure.rescale_intensity(hmap, in_range = (pA, pB))
# Otsu threshold clamped heatmap
th = filters.threshold_otsu(hmap)
blobs = np.array(hmap > th, np.uint8)
# Morphological opening (circle 2 pixels diameter)
# kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (3,3))
# blobs = cv2.morphologyEx(blobs, cv2.MORPH_OPEN, kernel)
# Label connected components
labels, n_labels = ndimage.label(blobs)
# Find blob centroids
# Transpose before assigning to x and y arrays
pnts = np.array(ndimage.measurements.center_of_mass(hmap, labels, range(1, n_labels+1)))
# Parse x and y coordinates
# *** Note y/row, x/col ordering
fix_x, fix_y = pnts[:,1], pnts[:,0]
# Map blob centroids to video pixel space using xedges and yedges
# of histogram2d bins (heatmap pixels). Note that pixels are centered
# on their coordinates when rendered by imshow. So a pixel at (1,2) is
# rendered as a rectangle with corners at (0.5,1.5) and (1.5, 2.5)
fix_xi = np.interp(fix_x, np.linspace(-0.5, nx-0.5, nx+1), xedges)
fix_yi = np.interp(fix_y, np.linspace(-0.5, ny-0.5, ny+1), yedges)
# Fixation centroids (n x 2)
fixations = np.array((fix_xi, fix_yi)).T
return fixations, hmap, xedges, yedges
def SortFixations(t, x, y, fixations):
'''
Temporally sort detected spatial fixations
Arguments
----
t : float vector
Sample time points in seconds
x : float vector
Pupil center x coordinate timeseries
y : float vector
Pupil center y coordinate timeseries
fixations : n x 2 float array
Detected spatial fixation coordinates
Returns
----
fixations_sorted : 2 x n float array
Spatial fixations sorted temporally
central_fix : float tuple
Pupil center in video space for central fixation
'''
# Count number of fixations and timepoints
nt = x.shape[0]
nf = fixations.shape[0]
# Put coordinate timeseries in columns
X = np.zeros([nt,2])
X[:,0] = x
X[:,1] = y
# Map each pupil center to nearest fixation
idx = NearestFixation(X, fixations)
# Median time of each fixation
t_fix = np.zeros(nf)
for fc in np.arange(0,nf):
t_fix[fc] = np.median(t[idx==fc])
# Temporally sort fixations
fix_order = np.argsort(t_fix)
fixations_sorted = fixations[fix_order,:]
return fixations_sorted
def NearestFixation(X, fixations):
'''
Map pupil centers to index of nearest fixation
'''
# Number of time points and fixations
nt = X.shape[0]
nf = fixations.shape[0]
# Distance array
dist2fix = np.zeros((nt, nf))
# Fill distance array (nt x nfix)
for (fix_i, fix) in enumerate(fixations):
dx, dy = X[:,0] - fix[0], X[:,1] - fix[1]
dist2fix[:, fix_i] = np.sqrt(dx**2 + dy**2)
# Find index of minimum distance fixation for each timepoint
return np.argmin(dist2fix, axis=1)
def CalibrationModel(fixations, targets):
'''
Construct biquadratic transform from video space to gaze space
BIQUADRATIC CALIBRATION MODEL
----
We need to solve the matrix equation C * R = R0 where
C = biquadratic transform matrix (2 x 6) (rank 2, full row rank)
R = fixation matrix (6 x n) in video space (rank 6)
R0 = fixation targets (2 x n) in gaze space (rank 2)
R has rows xx, xy, yy, x, y, 1
Arguments
----
fixations : n x 2 float array
Fixation coordinates in video space. n >= 6
targets : n x 2 float array
Fixation targets in normalized gazed space
Returns
----
C : 2 x 6 float array
Biquadratic video-gaze post-multiply transform matrix
'''
# Init biquadratic coefficient array
C = np.zeros((2,6))
# Need at least 6 points for biquadratic mapping
if fixations.shape[0] < 6:
print('Too few fixations for biquadratic video to gaze mapping')
return C
# Create fixation biquadratic matrix, R
R = MakeR(fixations)
# R0t is the transposed target coordinate array (n x 2)
R0 = targets.transpose()
# Compute C by pseudoinverse of R (R+)
# C.R = R0
# C.R.R+ = R0.R+ = C
Rplus = np.linalg.pinv(R)
C = R0.dot(Rplus)
# Check that C maps correctly
# print(C.dot(R).transpose())
# print(R0.transpose())
return C
def MakeR(points):
# Extract coordinates from n x 2 points matrix
x, y = points[:,0], points[:,1]
# Additional binomial coordinates
xx = x * x
yy = y * y
xy = x * y;
# Construct R (n x 6)
R = np.array((xx, xy, yy, x, y, np.ones_like(x)))
return R
def HeatMap(x, y, xlims, ylims, sigma=1.0):
'''
Convert pupil center timeseries to 2D heatmap
'''
# Eliminate NaNs in x, y (from blinks)
x = x[np.isfinite(x)]
y = y[np.isfinite(y)]
# Parse out limits
xmin, xmax = xlims
ymin, ymax = ylims
#---
# NOTE: heatmap dimensions are y (1st) then x (2nd)
# corresponding to rows then columns.
# All coordinate orderings are adjusted accordingly
#---
# Composite histogram axis ranges
# Make bin count different for x and y for debugging
# *** Note y/row, x/col ordering
hbins = [np.linspace(ymin, ymax, 64), np.linspace(xmin, xmax, 65)]
# Construct histogram
# *** Note y/row, x/col ordering
hmap, yedges, xedges = np.histogram2d(y, x, bins=hbins)
# Gaussian blur
if sigma > 0:
hmap = cv2.GaussianBlur(hmap, (0,0), sigma, sigma)
return hmap, xedges, yedges
def ApplyCalibration(ss_dir, C, central_fix, cfg):
'''
Apply calibration transform to gaze pupil center timeseries
- apply motion correction if requested (highpass or known fixations)
- Save calibrated gaze to text file in results directory
Arguments
----
Returns
----
'''
print(' Calibrating pupilometry timeseries')
# Uncalibrated gaze pupilometry file
gaze_uncal_csv = os.path.join(ss_dir,'results','gaze_pupils.csv')
# Known central fixations file
fixations_txt = os.path.join(ss_dir,'videos','fixations.txt')
if not os.path.isfile(gaze_uncal_csv):
print('* Uncalibrated gaze pupilometry not found - returning')
return False
# Read raw pupilometry data
p = engine.ReadPupilometry(gaze_uncal_csv)
# Extract useful timeseries
t = p[:,0] # Video soft timestamp
x = p[:,2] # Pupil x
y = p[:,3] # Pupil y
# Retrospective motion correction - only use when consistent glint is unavailable
motioncorr = cfg.get('ARTIFACTS','motioncorr')
mocokernel = cfg.getint('ARTIFACTS','mocokernel')
if motioncorr == 'knownfixations':
print(' Motion correction using known fixations')
print(' Central fixation at (%0.3f, %0.3f)' % (central_fix[0], central_fix[1]))
x, y, bx, by = moco.KnownFixations(t, x, y, fixations_txt, central_fix)
elif motioncorr == 'highpass':
print(' Motion correction by high pass filtering (%d sample kernel)' % mocokernel)
print(' Central fixation at (%0.3f, %0.3f)' % (central_fix[0], central_fix[1]))
x, y, bx, by = moco.HighPassFilter(t, x, y, mocokernel, central_fix)
elif motioncorr == 'glint':
print(' Using glint for motion correction. Skipping here, in calibrate.py (for now)')
# Return dummy x and y baseline estimates
bx, by = np.zeros_like(x), np.zeros_like(y)
else:
print('* Unknown motion correction requested (%s) - skipping' % (motioncorr))
# Return dummy x and y baseline estimates
bx, by = np.zeros_like(x), np.zeros_like(y)
# Additional binomial coordinates
xx = x * x
yy = y * y
xy = x * y
# Construct R
R = np.array((xx, xy, yy, x, y, np.ones_like(x)))
# Apply calibration transform to pupil-glint vector timeseries
# (2 x n) = (2 x 6) x (6 x n)
gaze = C.dot(R)
# Write calibrated gaze to CSV file in results directory
gaze_csv = os.path.join(ss_dir,'results','gaze_calibrated.csv')
WriteGaze(gaze_csv, t, gaze[0,:], gaze[1,:], bx, by)
return True
def CentralFixation(fixations, targets):
'''
Find video coordinate corresponding to gaze fixation at (0.5, 0.5)
'''
idx = -1
central_fix = np.array([np.NaN, np.NaN])
for ii in range(targets.shape[0]):
if targets[ii,0] == 0.5 and targets[ii,1] == 0.5:
idx = ii
central_fix = fixations[idx,:]
if idx < 0:
print('* Central fixation target not found')
central_fix = np.array([np.NaN, np.NaN])
return central_fix
def WriteGaze(gaze_csv, t, gaze_x, gaze_y, bline_x, bline_y):
'''
Write calibrated gaze to CSV file
'''
# Open calibrated gaze CSV file to write
try:
gaze_stream = open(gaze_csv, 'w')
except:
print('* Problem opening gaze CSV file to write - skipping')
return False
'''
Write gaze line to file
Timeseries in columns. Column order is:
0 : Time (s)
1 : Calibrated gaze x
2 : Calibrated gaze y
'''
for (tc,tt) in enumerate(t):
gaze_stream.write('%0.3f,%0.3f,%0.3f,%0.3f,%0.3f\n' %
(tt, gaze_x[tc], gaze_y[tc], bline_x[tc], bline_y[tc]))
# Close gaze CSV file
gaze_stream.close()
return True
def ReadGaze(gaze_csv):
'''
Read calibrated gaze timerseries from CSV file
'''
# Read time series in rows
gt = np.genfromtxt(gaze_csv, delimiter=',')
# Parse out array
t, gaze_x, gaze_y = gt[:,0], gt[:,1], gt[:,2]
return t, gaze_x, gaze_y
def PlotCalibration(res_dir, hmap, xedges, yedges, fixations):
'''
Plot the calibration heatmap and temporally sorted fixation labels
'''
# Create a new figure
fig = plt.figure(figsize = (6,6))
# Plot spatial heatmap with fixation centroids
plt.imshow(hmap, interpolation='nearest', aspect='equal',
extent=[xedges[0], xedges[-1], yedges[-1], yedges[0]])
# Fixation coordinate vectors
fx, fy = fixations[:,0], fixations[:,1]
# Overlay fixation centroids with temporal order labels
plt.scatter(fx, fy, c='w', s=40)
alignment = {'horizontalalignment':'center', 'verticalalignment':'center'}
for fc in np.arange(0,fx.shape[0]):
plt.text(fx[fc], fy[fc], '%d' % fc, backgroundcolor='w', color='k', **alignment)
# Save figure without displaying
plt.savefig(os.path.join(res_dir, 'cal_fix_space.png'), dpi=150, bbox_inches='tight')
# Close figure without showing it
plt.close(fig)
def WriteCalibration(ss_res_dir, fixations, C, central_fix):
'''
Write calibration matrix and fixations to CSV files in results subdirectory
'''
# Write calibration matrix to text file in results subdir
calmat_csv = os.path.join(ss_res_dir, 'calibration_matrix.csv')
# Write calibration matrix to CSV file
try:
np.savetxt(calmat_csv, C, delimiter=",")
except:
print('* Problem saving calibration matrix to CSV file - skipping')
return False
# Write calibration fixations in video space to results subdir
calfix_csv = os.path.join(ss_res_dir, 'calibration_fixations.csv')
# Write calibration fixations to CSV file
try:
np.savetxt(calfix_csv, fixations, delimiter=",")
except:
print('* Problem saving calibration fixations to CSV file - skipping')
return False
# Write central fixation in video space to results subdir
ctrfix_csv = os.path.join(ss_res_dir, 'central_fixation.csv')
# Write calibration fixations to CSV file
try:
np.savetxt(ctrfix_csv, central_fix, delimiter=",")
except:
print('* Problem saving central fixation to CSV file - skipping')
return False
return True
| jmtyszka/mrgaze | mrgaze/calibrate.py | Python | mit | 16,369 |
from CGATReport.Tracker import *
from cpgReport import *
##########################################################################
class IntervalsSummary(cpgTracker):
"""Summary stats of intervals called by the peak finder. """
mPattern = "_macs_intervals$"
def __call__(self, track, slice=None):
data = self.getRow(
"SELECT COUNT(*) as Intervals, round(AVG(length),0) as Mean_length, round(AVG(nprobes),0) as Mean_reads FROM %(track)s_macs_intervals" % locals())
return data
##########################################################################
class IntervalsSummaryFiltered(cpgTracker):
"""Summary stats of intervals after filtering by fold change and merging nearby intervals. """
mPattern = "_macs_merged_intervals$"
def __call__(self, track, slice=None):
data = self.getRow(
"SELECT COUNT(*) as Intervals, round(AVG(length),0) as Mean_length, round(AVG(nprobes),0) as Mean_reads FROM %(track)s_macs_merged_intervals" % locals())
return data
##########################################################################
class IntervalLengths(cpgTracker):
"""Distribution of interval length. """
mPattern = "_macs_merged_intervals$"
def __call__(self, track, slice=None):
data = self.getAll(
"SELECT length FROM %(track)s_macs_merged_intervals" % locals())
return data
##########################################################################
class IntervalPeakValues(cpgTracker):
"""Distribution of maximum interval coverage (the number of reads at peak). """
mPattern = "_macs_merged_intervals$"
def __call__(self, track, slice=None):
data = self.getAll(
"SELECT peakval FROM %(track)s_macs_merged_intervals" % locals())
return data
##########################################################################
class IntervalAverageValues(cpgTracker):
"""Distribution of average coverage (the average number of reads within the interval) """
mPattern = "_macs_merged_intervals$"
def __call__(self, track, slice=None):
data = self.getAll(
"SELECT avgval FROM %(track)s_macs_merged_intervals" % locals())
return data
##########################################################################
class IntervalFoldChange(cpgTracker):
"""return fold changes for all intervals. """
mPattern = "_macs_merged_intervals$"
def __call__(self, track, slice=None):
data = self.getAll(
"SELECT fold FROM %(track)s_macs_merged_intervals" % locals())
return data
##########################################################################
##########################################################################
##########################################################################
class PeakLocation(cpgTracker):
mPattern = "_macs_merged_intervals$"
def __call__(self, track, slice=None):
data1 = self.getValues(
"SELECT (PeakCenter - start) / CAST( Length as FLOAT) - 0.5 FROM %(track)s_macs_merged_intervals" % locals())
data2 = self.getValues(
"SELECT (end - PeakCenter) / CAST( Length as FLOAT) - 0.5 FROM %(track)s_macs_merged_intervals" % locals())
return {"distance": data1 + data2}
##########################################################################
class PeakDistance(cpgTracker):
mPattern = "_macs_merged_intervals$"
def __call__(self, track, slice=None):
data1 = self.getValues(
"SELECT PeakCenter - start FROM %(track)s_macs_merged_intervals" % locals())
data2 = self.getValues(
"SELECT end - PeakCenter FROM %(track)s_macs_merged_intervals" % locals())
return {"distance": data1 + data2}
##########################################################################
##########################################################################
##########################################################################
class CpGDensity(cpgTracker):
mPattern = "_composition$"
def __call__(self, track, slice=None):
data = self.getAll("SELECT pCpG FROM %(track)s_composition" % locals())
return data
##########################################################################
class CpGObsExp1(cpgTracker):
pattern = "(?<!replicated)_composition$"
def __call__(self, track, slice=None):
data = self.getAll(
"SELECT CpG_ObsExp1 FROM %(track)s_composition" % locals())
return data
##########################################################################
class CpGObsExp2(cpgTracker):
mPattern = "_composition$"
def __call__(self, track, slice=None):
data = self.getAll(
"SELECT CpG_ObsExp2 FROM %(track)s_composition" % locals())
return data
##########################################################################
class CpGNumber(cpgTracker):
mPattern = "_composition$"
def __call__(self, track, slice=None):
data = self.getAll("SELECT nCpG FROM %(track)s_composition" % locals())
return data
##########################################################################
class GCContent(cpgTracker):
mPattern = "_composition$"
def __call__(self, track, slice=None):
data = self.getAll("SELECT pGC FROM %(track)s_composition" % locals())
return data
| CGATOxford/CGATPipelines | CGATPipelines/pipeline_docs/pipeline_cpg/trackers/macs_intervals.py | Python | mit | 5,417 |
# -*- coding: utf-8 -*-
import collections
import httplib as http
import pytz
from flask import request
from modularodm import Q
from framework.exceptions import HTTPError
from framework.auth.decorators import must_be_logged_in
from framework.auth.utils import privacy_info_handle
from framework.forms.utils import sanitize
from website import settings
from website.notifications.emails import notify
from website.filters import gravatar
from website.models import Guid, Comment
from website.project.decorators import must_be_contributor_or_public
from datetime import datetime
from website.project.model import has_anonymous_link
def resolve_target(node, guid):
if not guid:
return node
target = Guid.load(guid)
if target is None:
raise HTTPError(http.BAD_REQUEST)
return target.referent
def collect_discussion(target, users=None):
users = users or collections.defaultdict(list)
for comment in getattr(target, 'commented', []):
if not comment.is_deleted:
users[comment.user].append(comment)
collect_discussion(comment, users=users)
return users
@must_be_contributor_or_public
def comment_discussion(**kwargs):
node = kwargs['node'] or kwargs['project']
auth = kwargs['auth']
users = collect_discussion(node)
anonymous = has_anonymous_link(node, auth)
# Sort users by comment frequency
# TODO: Allow sorting by recency, combination of frequency and recency
sorted_users = sorted(
users.keys(),
key=lambda item: len(users[item]),
reverse=True,
)
return {
'discussion': [
{
'id': privacy_info_handle(user._id, anonymous),
'url': privacy_info_handle(user.url, anonymous),
'fullname': privacy_info_handle(user.fullname, anonymous, name=True),
'isContributor': node.is_contributor(user),
'gravatarUrl': privacy_info_handle(
gravatar(
user, use_ssl=True, size=settings.GRAVATAR_SIZE_DISCUSSION,
),
anonymous
),
}
for user in sorted_users
]
}
def serialize_comment(comment, auth, anonymous=False):
return {
'id': comment._id,
'author': {
'id': privacy_info_handle(comment.user._id, anonymous),
'url': privacy_info_handle(comment.user.url, anonymous),
'name': privacy_info_handle(
comment.user.fullname, anonymous, name=True
),
'gravatarUrl': privacy_info_handle(
gravatar(
comment.user, use_ssl=True,
size=settings.GRAVATAR_SIZE_DISCUSSION
),
anonymous
),
},
'dateCreated': comment.date_created.isoformat(),
'dateModified': comment.date_modified.isoformat(),
'content': comment.content,
'hasChildren': bool(getattr(comment, 'commented', [])),
'canEdit': comment.user == auth.user,
'modified': comment.modified,
'isDeleted': comment.is_deleted,
'isAbuse': auth.user and auth.user._id in comment.reports,
}
def serialize_comments(record, auth, anonymous=False):
return [
serialize_comment(comment, auth, anonymous)
for comment in getattr(record, 'commented', [])
]
def kwargs_to_comment(kwargs, owner=False):
comment = Comment.load(kwargs.get('cid'))
if comment is None:
raise HTTPError(http.BAD_REQUEST)
if owner:
auth = kwargs['auth']
if auth.user != comment.user:
raise HTTPError(http.FORBIDDEN)
return comment
@must_be_logged_in
@must_be_contributor_or_public
def add_comment(**kwargs):
auth = kwargs['auth']
node = kwargs['node'] or kwargs['project']
if not node.comment_level:
raise HTTPError(http.BAD_REQUEST)
if not node.can_comment(auth):
raise HTTPError(http.FORBIDDEN)
guid = request.json.get('target')
target = resolve_target(node, guid)
content = request.json.get('content').strip()
content = sanitize(content)
if not content:
raise HTTPError(http.BAD_REQUEST)
if len(content) > settings.COMMENT_MAXLENGTH:
raise HTTPError(http.BAD_REQUEST)
comment = Comment.create(
auth=auth,
node=node,
target=target,
user=auth.user,
content=content,
)
comment.save()
context = dict(
gravatar_url=auth.user.gravatar_url,
content=content,
target_user=target.user if is_reply(target) else None,
parent_comment=target.content if is_reply(target) else "",
url=node.absolute_url
)
time_now = datetime.utcnow().replace(tzinfo=pytz.utc)
sent_subscribers = notify(
uid=node._id,
event="comments",
user=auth.user,
node=node,
timestamp=time_now,
**context
)
if is_reply(target):
if target.user and target.user not in sent_subscribers:
notify(
uid=target.user._id,
event='comment_replies',
user=auth.user,
node=node,
timestamp=time_now,
**context
)
return {
'comment': serialize_comment(comment, auth)
}, http.CREATED
def is_reply(target):
return isinstance(target, Comment)
@must_be_contributor_or_public
def list_comments(auth, **kwargs):
node = kwargs['node'] or kwargs['project']
anonymous = has_anonymous_link(node, auth)
guid = request.args.get('target')
target = resolve_target(node, guid)
serialized_comments = serialize_comments(target, auth, anonymous)
n_unread = 0
if node.is_contributor(auth.user):
if auth.user.comments_viewed_timestamp is None:
auth.user.comments_viewed_timestamp = {}
auth.user.save()
n_unread = n_unread_comments(target, auth.user)
return {
'comments': serialized_comments,
'nUnread': n_unread
}
def n_unread_comments(node, user):
"""Return the number of unread comments on a node for a user."""
default_timestamp = datetime(1970, 1, 1, 12, 0, 0)
view_timestamp = user.comments_viewed_timestamp.get(node._id, default_timestamp)
return Comment.find(Q('node', 'eq', node) &
Q('user', 'ne', user) &
Q('date_created', 'gt', view_timestamp) &
Q('date_modified', 'gt', view_timestamp)).count()
@must_be_logged_in
@must_be_contributor_or_public
def edit_comment(**kwargs):
auth = kwargs['auth']
comment = kwargs_to_comment(kwargs, owner=True)
content = request.json.get('content').strip()
content = sanitize(content)
if not content:
raise HTTPError(http.BAD_REQUEST)
if len(content) > settings.COMMENT_MAXLENGTH:
raise HTTPError(http.BAD_REQUEST)
comment.edit(
content=content,
auth=auth,
save=True
)
return serialize_comment(comment, auth)
@must_be_logged_in
@must_be_contributor_or_public
def delete_comment(**kwargs):
auth = kwargs['auth']
comment = kwargs_to_comment(kwargs, owner=True)
comment.delete(auth=auth, save=True)
return {}
@must_be_logged_in
@must_be_contributor_or_public
def undelete_comment(**kwargs):
auth = kwargs['auth']
comment = kwargs_to_comment(kwargs, owner=True)
comment.undelete(auth=auth, save=True)
return {}
@must_be_logged_in
@must_be_contributor_or_public
def update_comments_timestamp(auth, **kwargs):
node = kwargs['node'] or kwargs['project']
if node.is_contributor(auth.user):
auth.user.comments_viewed_timestamp[node._id] = datetime.utcnow()
auth.user.save()
list_comments(**kwargs)
return {node._id: auth.user.comments_viewed_timestamp[node._id].isoformat()}
else:
return {}
@must_be_logged_in
@must_be_contributor_or_public
def report_abuse(**kwargs):
auth = kwargs['auth']
user = auth.user
comment = kwargs_to_comment(kwargs)
category = request.json.get('category')
text = request.json.get('text', '')
if not category:
raise HTTPError(http.BAD_REQUEST)
try:
comment.report_abuse(user, save=True, category=category, text=text)
except ValueError:
raise HTTPError(http.BAD_REQUEST)
return {}
@must_be_logged_in
@must_be_contributor_or_public
def unreport_abuse(**kwargs):
auth = kwargs['auth']
user = auth.user
comment = kwargs_to_comment(kwargs)
try:
comment.unreport_abuse(user, save=True)
except ValueError:
raise HTTPError(http.BAD_REQUEST)
return {}
| lamdnhan/osf.io | website/project/views/comment.py | Python | apache-2.0 | 8,811 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# updater.py
#
# Copyright 2013 Antergos
#
# This program 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) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
import urllib.request
import urllib.error
from urllib.request import urlopen
import json
import hashlib
import os
import info
import logging
#_url_prefix = "https://raw.github.com/Antergos/Cnchi/stable/"
_url_prefix = "https://raw.github.com/Antergos/Cnchi/master/"
_src_dir = os.path.dirname(__file__) or '.'
_base_dir = os.path.join(_src_dir, "..")
class Updater():
def __init__(self, force_update):
self.web_version = ""
self.web_files = []
response = ""
try:
update_info_url = _url_prefix + "update.info"
request = urlopen(update_info_url)
response = request.read().decode('utf-8')
except urllib.HTTPError as e:
logging.exception('Unable to get latest version info - HTTPError = %s' % e.reason)
except urllib.URLError as e:
logging.exception('Unable to get latest version info - URLError = %s' % e.reason)
except httplib.HTTPException as e:
logging.exception('Unable to get latest version info - HTTPException')
except Exception as e:
import traceback
logging.exception('Unable to get latest version info - Exception = %s' % traceback.format_exc())
if len(response) > 0:
updateInfo = json.loads(response)
self.web_version = updateInfo['version']
self.web_files = updateInfo['files']
logging.info("Cnchi Internet version: %s" % self.web_version)
self.force = force_update
def is_web_version_newer(self):
if self.force:
return True
#version is always: x.y.z
cur_ver = info.cnchi_VERSION.split(".")
web_ver = self.web_version.split(".")
cur = [int(cur_ver[0]),int(cur_ver[1]),int(cur_ver[2])]
web = [int(web_ver[0]),int(web_ver[1]),int(web_ver[2])]
if web[0] > cur[0]:
return True
if web[0] == cur[0] and web[1] > cur[1]:
return True
if web[0] == cur[0] and web[1] == cur[1] and web[2] > cur[2]:
return True
return False
# This will update all files only if necessary (or forced)
def update(self):
if self.is_web_version_newer():
logging.info("New version found. Updating installer...")
num_files = len(self.web_files)
i = 1
for f in self.web_files:
name = f['name']
md5 = f['md5']
print("Downloading %s (%d/%d)" % (name, i, num_files))
if self.download(name, md5) is False:
# download has failed
logging.error("Download of %s has failed" % name)
return False
i = i + 1
# replace old files with the new ones
self.replace_old_with_new_versions()
return True
else:
return False
def get_md5(self, text):
md5 = hashlib.md5()
md5.update(text)
return md5.hexdigest()
def download(self, name, md5):
url = _url_prefix + name
response = ""
try:
request = urlopen(url)
txt = request.read()
#.decode('utf-8')
except urllib.error.HTTPError as e:
logging.exception('Unable to get %s - HTTPError = %s' % (name, e.reason))
return False
except urllib.error.URLError as e:
logging.exception('Unable to get %s - URLError = %s' % (name, e.reason))
return False
except httplib.error.HTTPException as e:
logging.exception('Unable to get %s - HTTPException' % name)
return False
except Exception as e:
import traceback
logging.exception('Unable to get %s - Exception = %s' % (name, traceback.format_exc()))
return False
web_md5 = self.get_md5(txt)
if web_md5 != md5:
logging.error("Checksum error in %s. Download aborted" % name)
return False
new_name = os.path.join(_base_dir, name + "." + self.web_version.replace(".", "_"))
with open(new_name, "wb") as f:
f.write(txt)
return True
def replace_old_with_new_versions(self):
logging.info("Replacing version %s with version %s..." % (info.cnchi_VERSION, self.web_version))
for f in self.web_files:
name = f['name']
old_name = os.path.join(_base_dir, name + "." + info.cnchi_VERSION.replace(".", "_"))
new_name = os.path.join(_base_dir, name + "." + self.web_version.replace(".", "_"))
cur_name = os.path.join(_base_dir, name)
if os.path.exists(name):
os.rename(name, old_name)
if os.path.exists(new_name):
os.rename(new_name, cur_name)
| Acidburn0zzz/archiso-gui | releng/root-image/usr/share/cnchi/src/updater.py | Python | gpl-3.0 | 5,862 |
from atomicbot.cli import main
def test_main():
assert main([]) == 0
| Amunak/AtomicBot | tests/test_atomicbot.py | Python | gpl-3.0 | 76 |
"""
REFERENCES:
1. https://www.blog.pythonlibrary.org/2016/07/26/python-3-an-intro-to-asyncio/
2. https://github.com/python/asyncio/blob/master/examples/simple_tcp_server.py
3. https://hackernoon.com/asyncio-for-the-working-python-developer-5c468e6e2e8e
4. http://asyncio.readthedocs.io/en/latest/hello_world.html
Example of a simple TCP server that is written in (mostly) coroutine
style and uses asyncio.streams.start_server() and
asyncio.streams.open_connection().
Note that running this example starts both the TCP server and client
in the same process. It listens on port 7201 on 127.0.0.1, so it will
fail if this port is currently in use.
"""
import sys
import asyncio
import asyncio.streams
import struct
class NSEServer:
"""
This is just an example of how a TCP server might be potentially
structured. This class has basically 3 methods: start the server,
handle a client, and stop the server.
"""
def __init__(self):
self.server = None
self.clients = {}
"""
This method accepts a new client connection and creates a Task
to handle this client. self.clients is updated to keep track
of the new client.
"""
def _accept_client(self, client_reader, client_writer):
task = asyncio.Task(self._handle_client(client_reader, client_writer))
self.clients[task] = (client_reader, client_writer)
def client_done(task):
print("client task done:", task, file=sys.stderr)
del self.clients[task]
task.add_done_callback(client_done)
"""
This method actually does the work to handle the requests for
a specific client. The protocol is line oriented, so there is
a main loop that reads a line with a request and then sends
out one or more lines back to the client with the result.
"""
def _handle_client(self, client_reader, client_writer):
while True:
try:
data = (yield from client_reader.read(4))
except IOError as io_error:
print("IO Error! Closing connection now!")
print(io_error)
if not data:
client_writer.close()
packed = struct.pack('!2H2I', 12, 521, 0, 2)
try:
client_writer.write(packed)
except:
print("Client response failed, closing connection!")
return
"""
Starts the TCP server, so that it listens on port 7002.
For each client that connects, the accept_client method gets
called. This method runs the loop until the server sockets
are ready to accept connections.
"""
def start(self, loop):
self.server = loop.run_until_complete(
asyncio.streams.start_server(self._accept_client,'127.0.0.1', '7002', loop=loop))
"""
Stops the TCP server, i.e. closes the listening socket(s).
This method runs the loop until the server sockets are closed.
"""
def stop(self, loop):
if self.server is not None:
self.server.close()
loop.run_until_complete(self.server.wait_closed())
self.server = None
"""
Cleans up all tasks
"""
def cleanup(loop):
tasks = asyncio.Task.all_tasks(loop)
for t in tasks:
t.cancel()
loop.run_until_complete(asyncio.sleep(0))
if __name__ == "__main__":
print("This module connects to the server") | ansin218/p2p-voidphone-nse | code/tcp_connect.py | Python | mit | 3,541 |
import logging
from django.conf import settings
from civil_registry.utils import get_citizen_by_national_id
from libya_elections import constants
from text_messages.utils import get_message
from .models import RegistrationCenter, Registration, SMS
from .utils import remaining_registrations
logger = logging.getLogger(__name__)
class Result(object):
"""
Represent the result of processing someone's message.
:param string phone_number: The user's phone number
:param integer message_code: Identifies the message we're responding with
:param dict context: Any parameters needed when we format the message
:raise ValueError: If an invalid message code is provided.
"""
def __init__(self, phone_number, message_code, context=None):
self.message_code = message_code
self.phone_number = phone_number
context = context or {}
message = get_message(self.message_code)
# If we've sent the same message code to the same phone number
# at least 3 times, after that start using an enhanced error
# message text for that code. (If we have one.)
text = message.msg
if message.enhanced and self._should_enhance():
text = message.enhanced
# :self.message is the formatted, final message
# Default (if everything goes haywire below) to the message without parameters
# filled in
self.message = text
try:
self.message = text.format(**context)
except KeyError as e:
logger.error("Translated message appears to have a parameter that we don't have a "
"value for. text = %r. Exception = %s.", text, e)
# Try just leaving it blank.
try:
key = e.args[0]
context[key] = ''
self.message = text.format(**context)
except Exception as e:
logger.error("Got second error. text = %r. Exception = %s.", text, e)
def _should_enhance(self):
"""
Return True if the last 3 messages we sent to this phone number were
this same message code.
"""
MIN_REPEATS = 3
messages_sent = SMS.objects.filter(to_number=self.phone_number)\
.order_by('-creation_date')[:MIN_REPEATS]
# If the last 3 messages all had this same error code, we need to use the enhanced message
return messages_sent.count() == MIN_REPEATS and \
all([msg.message_code == self.message_code for msg in messages_sent])
def process_registration_request(center_id, national_id, sms):
"""
Process a well formatted registration request message and returns a
translated response message.
Attempts to retrieve a Citizen instance
+ searches our database for match.
Updates SMS instance
+ all incoming messages get logged.
Registers citizen
+ Verifies that citizen has only registered once.
+ Updates registration if allowed
+ Does nothing if registering to same center twice.
Returns a Result object.
"""
try:
logger.debug("Getting registration centre")
center = RegistrationCenter.objects\
.get(reg_open=True, copy_of=None, center_id=center_id)
except RegistrationCenter.DoesNotExist:
return Result(sms.from_number, constants.RESPONSE_CENTER_ID_INVALID)
citizen = get_citizen_by_national_id(national_id)
if not citizen:
return Result(sms.from_number, constants.RESPONSE_NID_INVALID)
sms.citizen = citizen
if not citizen.is_eligible():
logger.debug("Citizen is not eligible.")
return Result(sms.from_number, constants.RESPONSE_NID_INVALID)
try:
registration = Registration.objects.get(citizen=citizen)
except Registration.DoesNotExist:
logger.debug("Citizen not already registered")
registration = None
remaining = remaining_registrations(sms.from_number)
if registration:
logger.debug("Citizen already registered")
same_phone = registration.sms.from_number == sms.from_number
unlocked = False
if registration.unlocked:
unlocked = True
if same_phone or unlocked:
# Same phone, or they've been granted an exception
if not same_phone and remaining == 0:
# They're trying to change to a phone that is already
# at its maximum # of registrations.
return Result(sms.from_number, constants.TOO_MANY_REGISTRATIONS_ON_PHONE,
dict(maximum=settings.MAX_REGISTRATIONS_PER_PHONE))
# If they're out of changes, sending from same phone, they always get message 6
if registration.change_count >= registration.max_changes:
logger.debug("Out of changes, send message 6")
return Result(sms.from_number, constants.MESSAGE_6,
dict(centre=registration.registration_center.name,
code=registration.registration_center.center_id,
person=str(citizen)))
if registration.registration_center == center:
# same location - but they could be changing their registered phone
if not same_phone:
# Save the SMS object, so we can archive this registration
sms.save()
registration.sms = sms
logger.debug("Updating phone number")
registration.repeat_count = 0
registration.save_with_archive_version()
else:
logger.debug("registration is exact repeat")
registration.repeat_count += 1
# We're just counting their calls, not changing their
# registration; no need to make an archive copy.
registration.save()
return Result(sms.from_number, constants.MESSAGE_1,
dict(centre=center.name,
code=center.center_id,
person=str(citizen)))
# different voting center
logger.debug("registration changing center, count=%d" % registration.change_count)
# We know they still have changes left because we checked above
registration.change_count += 1
registration.repeat_count = 1
registration.registration_center = center
sms.save()
registration.sms = sms
if unlocked:
# they've used their exception
registration.unlocked_until = None
registration.save_with_archive_version()
if not registration.remaining_changes:
# Last time
return Result(sms.from_number, constants.MESSAGE_5,
dict(centre=center.name,
code=center.center_id,
person=str(citizen)))
elif registration.remaining_changes == 1:
# one more allowed
return Result(sms.from_number, constants.MESSAGE_4,
dict(centre=center.name,
code=center.center_id,
person=str(citizen)))
else:
return Result(sms.from_number, constants.RESPONSE_VALID_REGISTRATION,
dict(centre=center.name,
code=center.center_id,
person=str(citizen)))
# Different phone
if registration.registration_center == center:
# same registration - don't do anything
return Result(sms.from_number, constants.MESSAGE_7,
dict(centre=registration.registration_center.name,
number=registration.sms.from_number[-4:]))
# Cannot change anything from a different phone
# Sorry, this NID is already registered at {centre} with a phone
# ending in {number}. You must use this phone to re-register. If
# you do not have access to this phone or need help, call 1441.
# (message number 3)'}
return Result(sms.from_number, constants.MESSAGE_2,
dict(centre=registration.registration_center.name,
number=registration.sms.from_number[-4:]))
logger.debug("new registration")
kwargs = {"citizen": citizen, "registration_center": center, "sms": sms}
if remaining == 0:
# They're trying to create a new registration, but
# there are the maximum (or more) registrations from
# this phone already.
return Result(sms.from_number, constants.TOO_MANY_REGISTRATIONS_ON_PHONE,
dict(maximum=settings.MAX_REGISTRATIONS_PER_PHONE))
# We have to save the SMS before we can save the Registration that refers to it
sms.save()
Registration.objects.create(**kwargs)
remaining -= 1
if remaining == 0:
# Send a warning message - no more regs on this phone
msg_code = constants.AT_MAXIMUM_REGISTRATIONS_ON_PHONE
elif remaining == 1:
# Send a warning message - only one more reg on this phone
msg_code = constants.ONE_MORE_REGISTRATION_ON_PHONE
else:
# Normal message
msg_code = constants.RESPONSE_VALID_REGISTRATION
return Result(sms.from_number, msg_code,
dict(centre=center.name,
code=center.center_id,
person=str(citizen)))
def process_registration_lookup(national_id, sms):
"""
Given the national ID string and the sms object from a syntactically
valid registration lookup message, check the registration of the
citizen with the given NID and respond with a message containing the
current registration status.
"""
citizen = get_citizen_by_national_id(national_id)
if not citizen:
return Result(sms.from_number, constants.VOTER_QUERY_NOT_FOUND)
sms.citizen = citizen
sms.save()
registrations = citizen.registrations.all()
context = {'person': citizen} # Used for formatting messages, so key='person' is okay
if registrations:
if registrations.count() == 1:
# Citizen has one confirmed registration
registration = registrations[0]
center = registration.registration_center
context.update({'centre': center.name, 'code': center.center_id})
return Result(sms.from_number, constants.VOTER_QUERY_REGISTERED_AT, context)
else: # pragma: no cover
# Multiple confirmed registrations - this should never happen, due to
# database constraints
logger.error("Voter %s has multiple confirmed registrations", national_id)
return Result(sms.from_number, constants.VOTER_QUERY_PROBLEM_ENCOUNTERED, context)
# Citizen has not registered.
return Result(sms.from_number, constants.VOTER_QUERY_NOT_REGISTERED, context)
| SmartElect/SmartElect | register/processors.py | Python | apache-2.0 | 11,302 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# REF [site] >> https://github.com/lumyjuwon/KoreaNewsCrawler
def naver_news_crawling_example():
from korea_news_crawler.articlecrawler import ArticleCrawler
crawler = ArticleCrawler()
crawler.set_category('정치', 'IT과학', 'economy')
#crawler.set_category('politics', 'IT_science', 'economy')
crawler.set_date_range(2017, 1, 2018, 4)
crawler.start()
# Output: CSV file.
# Column: 기사 날짜, 기사 카테고리, 언론사, 기사 제목, 기사 본문, 기사 주소.
def main():
# Scrapy.
# Refer to ./scrapy_test.py
naver_news_crawling_example()
#--------------------------------------------------------------------
if '__main__' == __name__:
main()
| sangwook236/general-development-and-testing | sw_dev/python/ext/test/networking/web_crawling_test.py | Python | gpl-2.0 | 732 |
"""The tests for the Home Assistant API component."""
# pylint: disable=protected-access
import json
from unittest.mock import patch
from aiohttp import web
import pytest
import voluptuous as vol
from homeassistant import const
from homeassistant.bootstrap import DATA_LOGGING
import homeassistant.core as ha
from homeassistant.setup import async_setup_component
from tests.common import async_mock_service
@pytest.fixture
def mock_api_client(hass, hass_client):
"""Start the Home Assistant HTTP component and return admin API client."""
hass.loop.run_until_complete(async_setup_component(hass, "api", {}))
return hass.loop.run_until_complete(hass_client())
async def test_api_list_state_entities(hass, mock_api_client):
"""Test if the debug interface allows us to list state entities."""
hass.states.async_set("test.entity", "hello")
resp = await mock_api_client.get(const.URL_API_STATES)
assert resp.status == 200
json = await resp.json()
remote_data = [ha.State.from_dict(item) for item in json]
assert remote_data == hass.states.async_all()
async def test_api_get_state(hass, mock_api_client):
"""Test if the debug interface allows us to get a state."""
hass.states.async_set("hello.world", "nice", {"attr": 1})
resp = await mock_api_client.get(const.URL_API_STATES_ENTITY.format("hello.world"))
assert resp.status == 200
json = await resp.json()
data = ha.State.from_dict(json)
state = hass.states.get("hello.world")
assert data.state == state.state
assert data.last_changed == state.last_changed
assert data.attributes == state.attributes
async def test_api_get_non_existing_state(hass, mock_api_client):
"""Test if the debug interface allows us to get a state."""
resp = await mock_api_client.get(
const.URL_API_STATES_ENTITY.format("does_not_exist")
)
assert resp.status == 404
async def test_api_state_change(hass, mock_api_client):
"""Test if we can change the state of an entity that exists."""
hass.states.async_set("test.test", "not_to_be_set")
await mock_api_client.post(
const.URL_API_STATES_ENTITY.format("test.test"),
json={"state": "debug_state_change2"},
)
assert hass.states.get("test.test").state == "debug_state_change2"
# pylint: disable=invalid-name
async def test_api_state_change_of_non_existing_entity(hass, mock_api_client):
"""Test if changing a state of a non existing entity is possible."""
new_state = "debug_state_change"
resp = await mock_api_client.post(
const.URL_API_STATES_ENTITY.format("test_entity.that_does_not_exist"),
json={"state": new_state},
)
assert resp.status == 201
assert hass.states.get("test_entity.that_does_not_exist").state == new_state
# pylint: disable=invalid-name
async def test_api_state_change_with_bad_data(hass, mock_api_client):
"""Test if API sends appropriate error if we omit state."""
resp = await mock_api_client.post(
const.URL_API_STATES_ENTITY.format("test_entity.that_does_not_exist"), json={}
)
assert resp.status == 400
# pylint: disable=invalid-name
async def test_api_state_change_to_zero_value(hass, mock_api_client):
"""Test if changing a state to a zero value is possible."""
resp = await mock_api_client.post(
const.URL_API_STATES_ENTITY.format("test_entity.with_zero_state"),
json={"state": 0},
)
assert resp.status == 201
resp = await mock_api_client.post(
const.URL_API_STATES_ENTITY.format("test_entity.with_zero_state"),
json={"state": 0.0},
)
assert resp.status == 200
# pylint: disable=invalid-name
async def test_api_state_change_push(hass, mock_api_client):
"""Test if we can push a change the state of an entity."""
hass.states.async_set("test.test", "not_to_be_set")
events = []
@ha.callback
def event_listener(event):
"""Track events."""
events.append(event)
hass.bus.async_listen(const.EVENT_STATE_CHANGED, event_listener)
await mock_api_client.post(
const.URL_API_STATES_ENTITY.format("test.test"), json={"state": "not_to_be_set"}
)
await hass.async_block_till_done()
assert len(events) == 0
await mock_api_client.post(
const.URL_API_STATES_ENTITY.format("test.test"),
json={"state": "not_to_be_set", "force_update": True},
)
await hass.async_block_till_done()
assert len(events) == 1
# pylint: disable=invalid-name
async def test_api_fire_event_with_no_data(hass, mock_api_client):
"""Test if the API allows us to fire an event."""
test_value = []
@ha.callback
def listener(event):
"""Record that our event got called."""
test_value.append(1)
hass.bus.async_listen_once("test.event_no_data", listener)
await mock_api_client.post(const.URL_API_EVENTS_EVENT.format("test.event_no_data"))
await hass.async_block_till_done()
assert len(test_value) == 1
# pylint: disable=invalid-name
async def test_api_fire_event_with_data(hass, mock_api_client):
"""Test if the API allows us to fire an event."""
test_value = []
@ha.callback
def listener(event):
"""Record that our event got called.
Also test if our data came through.
"""
if "test" in event.data:
test_value.append(1)
hass.bus.async_listen_once("test_event_with_data", listener)
await mock_api_client.post(
const.URL_API_EVENTS_EVENT.format("test_event_with_data"), json={"test": 1}
)
await hass.async_block_till_done()
assert len(test_value) == 1
# pylint: disable=invalid-name
async def test_api_fire_event_with_invalid_json(hass, mock_api_client):
"""Test if the API allows us to fire an event."""
test_value = []
@ha.callback
def listener(event):
"""Record that our event got called."""
test_value.append(1)
hass.bus.async_listen_once("test_event_bad_data", listener)
resp = await mock_api_client.post(
const.URL_API_EVENTS_EVENT.format("test_event_bad_data"),
data=json.dumps("not an object"),
)
await hass.async_block_till_done()
assert resp.status == 400
assert len(test_value) == 0
# Try now with valid but unusable JSON
resp = await mock_api_client.post(
const.URL_API_EVENTS_EVENT.format("test_event_bad_data"),
data=json.dumps([1, 2, 3]),
)
await hass.async_block_till_done()
assert resp.status == 400
assert len(test_value) == 0
async def test_api_get_config(hass, mock_api_client):
"""Test the return of the configuration."""
resp = await mock_api_client.get(const.URL_API_CONFIG)
result = await resp.json()
if "components" in result:
result["components"] = set(result["components"])
if "whitelist_external_dirs" in result:
result["whitelist_external_dirs"] = set(result["whitelist_external_dirs"])
assert hass.config.as_dict() == result
async def test_api_get_components(hass, mock_api_client):
"""Test the return of the components."""
resp = await mock_api_client.get(const.URL_API_COMPONENTS)
result = await resp.json()
assert set(result) == hass.config.components
async def test_api_get_event_listeners(hass, mock_api_client):
"""Test if we can get the list of events being listened for."""
resp = await mock_api_client.get(const.URL_API_EVENTS)
data = await resp.json()
local = hass.bus.async_listeners()
for event in data:
assert local.pop(event["event"]) == event["listener_count"]
assert len(local) == 0
async def test_api_get_services(hass, mock_api_client):
"""Test if we can get a dict describing current services."""
resp = await mock_api_client.get(const.URL_API_SERVICES)
data = await resp.json()
local_services = hass.services.async_services()
for serv_domain in data:
local = local_services.pop(serv_domain["domain"])
assert serv_domain["services"] == local
async def test_api_call_service_no_data(hass, mock_api_client):
"""Test if the API allows us to call a service."""
test_value = []
@ha.callback
def listener(service_call):
"""Record that our service got called."""
test_value.append(1)
hass.services.async_register("test_domain", "test_service", listener)
await mock_api_client.post(
const.URL_API_SERVICES_SERVICE.format("test_domain", "test_service")
)
await hass.async_block_till_done()
assert len(test_value) == 1
async def test_api_call_service_with_data(hass, mock_api_client):
"""Test if the API allows us to call a service."""
test_value = []
@ha.callback
def listener(service_call):
"""Record that our service got called.
Also test if our data came through.
"""
if "test" in service_call.data:
test_value.append(1)
hass.services.async_register("test_domain", "test_service", listener)
await mock_api_client.post(
const.URL_API_SERVICES_SERVICE.format("test_domain", "test_service"),
json={"test": 1},
)
await hass.async_block_till_done()
assert len(test_value) == 1
async def test_api_template(hass, mock_api_client):
"""Test the template API."""
hass.states.async_set("sensor.temperature", 10)
resp = await mock_api_client.post(
const.URL_API_TEMPLATE,
json={"template": "{{ states.sensor.temperature.state }}"},
)
body = await resp.text()
assert body == "10"
async def test_api_template_error(hass, mock_api_client):
"""Test the template API."""
hass.states.async_set("sensor.temperature", 10)
resp = await mock_api_client.post(
const.URL_API_TEMPLATE, json={"template": "{{ states.sensor.temperature.state"}
)
assert resp.status == 400
async def test_stream(hass, mock_api_client):
"""Test the stream."""
listen_count = _listen_count(hass)
resp = await mock_api_client.get(const.URL_API_STREAM)
assert resp.status == 200
assert listen_count + 1 == _listen_count(hass)
hass.bus.async_fire("test_event")
data = await _stream_next_event(resp.content)
assert data["event_type"] == "test_event"
async def test_stream_with_restricted(hass, mock_api_client):
"""Test the stream with restrictions."""
listen_count = _listen_count(hass)
resp = await mock_api_client.get(
"{}?restrict=test_event1,test_event3".format(const.URL_API_STREAM)
)
assert resp.status == 200
assert listen_count + 1 == _listen_count(hass)
hass.bus.async_fire("test_event1")
data = await _stream_next_event(resp.content)
assert data["event_type"] == "test_event1"
hass.bus.async_fire("test_event2")
hass.bus.async_fire("test_event3")
data = await _stream_next_event(resp.content)
assert data["event_type"] == "test_event3"
async def _stream_next_event(stream):
"""Read the stream for next event while ignoring ping."""
while True:
last_new_line = False
data = b""
while True:
dat = await stream.read(1)
if dat == b"\n" and last_new_line:
break
data += dat
last_new_line = dat == b"\n"
conv = data.decode("utf-8").strip()[6:]
if conv != "ping":
break
return json.loads(conv)
def _listen_count(hass):
"""Return number of event listeners."""
return sum(hass.bus.async_listeners().values())
async def test_api_error_log(hass, aiohttp_client, hass_access_token, hass_admin_user):
"""Test if we can fetch the error log."""
hass.data[DATA_LOGGING] = "/some/path"
await async_setup_component(hass, "api", {})
client = await aiohttp_client(hass.http.app)
resp = await client.get(const.URL_API_ERROR_LOG)
# Verify auth required
assert resp.status == 401
with patch(
"aiohttp.web.FileResponse", return_value=web.Response(status=200, text="Hello")
) as mock_file:
resp = await client.get(
const.URL_API_ERROR_LOG,
headers={"Authorization": "Bearer {}".format(hass_access_token)},
)
assert len(mock_file.mock_calls) == 1
assert mock_file.mock_calls[0][1][0] == hass.data[DATA_LOGGING]
assert resp.status == 200
assert await resp.text() == "Hello"
# Verify we require admin user
hass_admin_user.groups = []
resp = await client.get(
const.URL_API_ERROR_LOG,
headers={"Authorization": "Bearer {}".format(hass_access_token)},
)
assert resp.status == 401
async def test_api_fire_event_context(hass, mock_api_client, hass_access_token):
"""Test if the API sets right context if we fire an event."""
test_value = []
@ha.callback
def listener(event):
"""Record that our event got called."""
test_value.append(event)
hass.bus.async_listen("test.event", listener)
await mock_api_client.post(
const.URL_API_EVENTS_EVENT.format("test.event"),
headers={"authorization": "Bearer {}".format(hass_access_token)},
)
await hass.async_block_till_done()
refresh_token = await hass.auth.async_validate_access_token(hass_access_token)
assert len(test_value) == 1
assert test_value[0].context.user_id == refresh_token.user.id
async def test_api_call_service_context(hass, mock_api_client, hass_access_token):
"""Test if the API sets right context if we call a service."""
calls = async_mock_service(hass, "test_domain", "test_service")
await mock_api_client.post(
"/api/services/test_domain/test_service",
headers={"authorization": "Bearer {}".format(hass_access_token)},
)
await hass.async_block_till_done()
refresh_token = await hass.auth.async_validate_access_token(hass_access_token)
assert len(calls) == 1
assert calls[0].context.user_id == refresh_token.user.id
async def test_api_set_state_context(hass, mock_api_client, hass_access_token):
"""Test if the API sets right context if we set state."""
await mock_api_client.post(
"/api/states/light.kitchen",
json={"state": "on"},
headers={"authorization": "Bearer {}".format(hass_access_token)},
)
refresh_token = await hass.auth.async_validate_access_token(hass_access_token)
state = hass.states.get("light.kitchen")
assert state.context.user_id == refresh_token.user.id
async def test_event_stream_requires_admin(hass, mock_api_client, hass_admin_user):
"""Test user needs to be admin to access event stream."""
hass_admin_user.groups = []
resp = await mock_api_client.get("/api/stream")
assert resp.status == 401
async def test_states_view_filters(hass, mock_api_client, hass_admin_user):
"""Test filtering only visible states."""
hass_admin_user.mock_policy({"entities": {"entity_ids": {"test.entity": True}}})
hass.states.async_set("test.entity", "hello")
hass.states.async_set("test.not_visible_entity", "invisible")
resp = await mock_api_client.get(const.URL_API_STATES)
assert resp.status == 200
json = await resp.json()
assert len(json) == 1
assert json[0]["entity_id"] == "test.entity"
async def test_get_entity_state_read_perm(hass, mock_api_client, hass_admin_user):
"""Test getting a state requires read permission."""
hass_admin_user.mock_policy({})
resp = await mock_api_client.get("/api/states/light.test")
assert resp.status == 401
async def test_post_entity_state_admin(hass, mock_api_client, hass_admin_user):
"""Test updating state requires admin."""
hass_admin_user.groups = []
resp = await mock_api_client.post("/api/states/light.test")
assert resp.status == 401
async def test_delete_entity_state_admin(hass, mock_api_client, hass_admin_user):
"""Test deleting entity requires admin."""
hass_admin_user.groups = []
resp = await mock_api_client.delete("/api/states/light.test")
assert resp.status == 401
async def test_post_event_admin(hass, mock_api_client, hass_admin_user):
"""Test sending event requires admin."""
hass_admin_user.groups = []
resp = await mock_api_client.post("/api/events/state_changed")
assert resp.status == 401
async def test_rendering_template_admin(hass, mock_api_client, hass_admin_user):
"""Test rendering a template requires admin."""
hass_admin_user.groups = []
resp = await mock_api_client.post(const.URL_API_TEMPLATE)
assert resp.status == 401
async def test_rendering_template_legacy_user(
hass, mock_api_client, aiohttp_client, legacy_auth
):
"""Test rendering a template with legacy API password."""
hass.states.async_set("sensor.temperature", 10)
client = await aiohttp_client(hass.http.app)
resp = await client.post(
const.URL_API_TEMPLATE,
json={"template": "{{ states.sensor.temperature.state }}"},
)
assert resp.status == 401
async def test_api_call_service_not_found(hass, mock_api_client):
"""Test if the API fails 400 if unknown service."""
resp = await mock_api_client.post(
const.URL_API_SERVICES_SERVICE.format("test_domain", "test_service")
)
assert resp.status == 400
async def test_api_call_service_bad_data(hass, mock_api_client):
"""Test if the API fails 400 if unknown service."""
test_value = []
@ha.callback
def listener(service_call):
"""Record that our service got called."""
test_value.append(1)
hass.services.async_register(
"test_domain", "test_service", listener, schema=vol.Schema({"hello": str})
)
resp = await mock_api_client.post(
const.URL_API_SERVICES_SERVICE.format("test_domain", "test_service"),
json={"hello": 5},
)
assert resp.status == 400
| postlund/home-assistant | tests/components/api/test_init.py | Python | apache-2.0 | 17,840 |
# coding: utf-8
# Copyright 2014 Globo.com Player authors. All rights reserved.
# Use of this source code is governed by a MIT License
# license that can be found in the LICENSE file.
ext_x_targetduration = '#EXT-X-TARGETDURATION'
ext_x_media_sequence = '#EXT-X-MEDIA-SEQUENCE'
ext_x_program_date_time = '#EXT-X-PROGRAM-DATE-TIME'
ext_x_media = '#EXT-X-MEDIA'
ext_x_playlist_type = '#EXT-X-PLAYLIST-TYPE'
ext_x_key = '#EXT-X-KEY'
ext_x_stream_inf = '#EXT-X-STREAM-INF'
ext_x_version = '#EXT-X-VERSION'
ext_x_allow_cache = '#EXT-X-ALLOW-CACHE'
ext_x_endlist = '#EXT-X-ENDLIST'
extinf = '#EXTINF'
ext_i_frames_only = '#EXT-X-I-FRAMES-ONLY'
ext_x_byterange = '#EXT-X-BYTERANGE'
ext_x_i_frame_stream_inf = '#EXT-X-I-FRAME-STREAM-INF'
ext_x_discontinuity = '#EXT-X-DISCONTINUITY'
| mx3L/archivczsk | build/plugin/src/resources/libraries/m3u8/protocol.py | Python | gpl-2.0 | 776 |
#---This is the class part---#
class Arit:
def add(self,a,b):
return a+b
def subs(self,a,b):
return a-b
#---This is the part that uses the class---#
n1=10
n2=4
operation=Arit()
print "The addition is", operation.add(n1,n2)
print "The substraction is", operation.subs(n1,n2)
| ActiveState/code | recipes/Python/572212_Simple_Class/recipe-572212.py | Python | mit | 303 |
import os
def unlink_recursive(dir):
if os.path.isdir(dir):
for file in os.listdir(dir):
file_path = os.path.join(dir, file)
if os.path.isdir(file_path):
unlink_recursive(file_path)
else:
os.unlink(file_path)
os.rmdir(dir)
else:
os.unlink(dir)
def create_files(*files, **kwargs):
base_dir = os.getcwd() if 'base_dir' not in kwargs else kwargs['base_dir']
mode = 0777 if 'mode' not in kwargs else kwargs['mode']
for file in files:
# Allow calling create_files with base_dir and a file starting with /
if file[0] == '/' and 'base_dir' in kwargs:
file = file[1:]
# Interpret a calling without base_dir and a start different to /
if 'base_dir' not in kwargs and file[0] != '/' and not file.startswith('./'):
file = '/' + file
path = os.path.join(base_dir, file)
file_dir = os.path.dirname(path)
if not os.path.exists(file_dir):
os.makedirs(file_dir, mode)
if os.path.isdir(file_dir):
open(path, "a").close()
| kudrom/genesis2 | genesis2/utils/filesystem.py | Python | gpl-3.0 | 1,132 |
# -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2013 European Organization for Nuclear Research (CERN).
##
## Indico 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.
##
## Indico is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Indico;if not, see <http://www.gnu.org/licenses/>.
from MaKaC.user import GroupHolder
from MaKaC.conference import CategoryManager
from MaKaC.webinterface.urlHandlers import UHCategoryDisplay, UHConferenceDisplay
from indico.core.db import DBMgr
def checkGroup (obj, group):
ac = obj.getAccessController()
if group in ac.allowed:
return True
return False
def showSubCategory(cat, group):
if checkGroup(cat, group):
print "%s - %s"%(cat.getName(), UHCategoryDisplay.getURL(cat))
if cat.hasSubcategories():
for subcat in cat.getSubCategoryList():
showSubCategory(subcat,group)
else:
for conference in cat.getConferenceList():
if checkGroup(conference, group):
print "%s - %s"%(conference.getName(), UHConferenceDisplay.getURL(conference))
DBMgr.getInstance().startRequest()
cm=CategoryManager()
cat=cm.getById("XXXX")
group = GroupHolder().getById("YYYYY")
showSubCategory(cat, group)
DBMgr.getInstance().endRequest()
| pferreir/indico-backup | bin/utils/getAllCatAccess.py | Python | gpl-3.0 | 1,739 |
#!/us/bin/env python3
'''manage fight'''
class Fight:
def __init__(self, entityOne, entityTwo):
self.entityOne = entityOne
self.entityTwo = entityTwo
def faster(self):
vel_ent1 = self.entityOne.velocity * self.entityOne.lvl
vel_ent2 = self.entityTwo.velocity * self.entityTwo.lvl
if vel_ent1 > vel_ent2:
return self.entityOne, self.entityTwo
elif vel_ent1 == vel_ent2:
from random import choice
ents = [self.entityTwo, self.entityOne]
a = choice(ents)
ents.remove(a)
return a, ents[0]
else:
return self.entityTwo, self.entityOne
def calculate_damage(self, player):
try:
dam = player.strength * player.lvl * player.hand.damage
except:
dam = player.strenght * player.lvl
return dam
def missed(self, player):
from random import random
try:
accuracy = player.hand.accuracy * random()
except:
accuracy = 10 * random()
if accuracy >= 3:
return False
else:
return True
def is_alive(self, player):
if player.hp > 0:
return True
else:
return False
def fight(self):
(frist, second) = self.faster()
if self.missed(frist) is True:
continue
else:
self.second.hp = self.second.hp - self.calculate_damage(frist)
if self.is_alive(second) is True:
if self.missed(second) is True:
continue
else:
self.frist.hp = self.frist.hp - self.calculate_damage(second)
| rmariotti/py_cli_rpg | fight.py | Python | gpl-3.0 | 1,699 |
# -*- coding: utf-8 -*-
"""
Created on Aug 14, 2013
@author: Tyranic-Moron
"""
import random
from CommandInterface import CommandInterface
from IRCMessage import IRCMessage
from IRCResponse import IRCResponse, ResponseType
class EightBall(CommandInterface):
triggers = ['8ball', 'eightball']
help = '8ball (question) - swirls a magic 8-ball to give you the answer to your questions'
def execute(self, message):
"""
@type message: IRCMessage
"""
answers = ['It is certain', # positive
'It is decidedly so',
'Without a doubt',
'Yes definitely',
'You may rely on it',
'As I see it yes',
'Most likely',
'Outlook good',
'Yes',
'Signs point to yes',
'Reply hazy try again', # non-committal
'Ask again later',
'Better not tell you now',
'Cannot predict now',
'Concentrate and ask again',
"Don't count on it", # negative
'My reply is no',
'My sources say no',
'Outlook not so good',
'Very doubtful']
return IRCResponse(ResponseType.Say,
'The Magic 8-ball says... {}'.format(random.choice(answers)),
message.ReplyTo)
| Heufneutje/PyMoronBot | Commands/EightBall.py | Python | mit | 1,487 |
from itertools import combinations as combinations
from operator import attrgetter
import Player as P
###
class PokerPool(P.Player):
'''Derived class for pool of common cards'''
max_cards = 5
def __init__(self, name):
P.Player.__init__(self, name)
self.hand.max_cards = self.max_cards
###
class PokerHand():
'''Class for finding best hand with pool'''
max_cards = 5
#_____________________________
def __init__(self, hand, pool):
self.hand = hand.cards
self.pool = pool.cards
self.score = 0
#_____________________________
def is_tie(self, score, rank_cards, kicker_cards):
'''
Returns true if score is same, rank cards are identical,
and kicker cards are identical
'''
if score != self.score:
return False
if rank_cards != self.rank_cards:
return False
if kicker_cards != self.kicker_cards:
return False
return True
#_______________________
def is_better(self, score, rank_cards, kicker_cards):
'''Returns true if input score, rank, kicker
is better than current hand
'''
if score > self.score:
return True
elif score == self.score:
# Better rank of hand (e.g. KK vs QQ) FIXME be careful about two or more rank cards, order
if rank_cards > self.rank_cards:
return True
# Better kickers (e.g. KK, Ace High vs KK, J high)
elif rank_cards == self.rank_cards and kicker_cards > self.kicker_cards:
return True
# Current hand is better
return False
#__________________
def get_score(self):
my_poker = Poker()
card_pool = self.hand + self.pool
hands = list(combinations(card_pool, self.max_cards))
for h in hands:
i_s, i_rc, i_kc = my_poker.eval_hand(h)
if self.is_better(i_s, i_rc, i_kc):
self.update_hand(i_s, h, i_rc, i_kc)
#_______________________________
def update_hand(self, s, fh, rc, kc):
self.score = s
self.rank_cards = rc
self.kicker_cards = kc
final_hand = P.Hand()
for c in fh:
final_hand.add_card(c)
self.final_hand = final_hand
###
class Poker:
'''Class to evaluate Poker hand'''
def __init__(self):
v = []
s = []
pass
def values(self, cards):
'''Returns sorted values'''
#return sorted([c.value for c in cards], reverse=True)
return [c.value for c in cards]
def suits(self, cards):
'''Returns suits'''
return [c.suit for c in cards]
def n_kind(self, n, values):
'''Returns n-of-a-kind value if exists'''
return set( v for v in values if values.count(v) >= n)
def is_straight(self, values):
'''Returns straight, and ace-low'''
ace_low = len(set(values)) == 5 and values[0]-values[-1] == 12 and values[1] ==5
straight = (len(set(values)) == 5 and values[0]-values[-1] == 4) or ace_low
return straight, ace_low
def is_flush(self, suits):
'''Returns true if all same suit'''
return len(set(suits)) == 1
#______________________________________
def straight_flush(self, cards, rc, kc):
st, al = self.is_straight(self.v)
fl = self.is_flush(self.s)
# Royal Flush
if st and fl:
if self.v[-1] == 10:
sc = 10
#vAce-low straight flush
elif al and fl:
sc = 9
rc.add_card(cards[1])
# Other straight flush
elif st and fl:
sc = 9
rc.add_card(cards[0])
return sc, rc, kc
return False
#______________________________________
def four_of_a_kind(self, cards, rc, kc):
if self.k_4:
sc = 8
for c in cards:
if c.value in self.k_4: rc.add_card(c)
else: kc.add_card(c)
return sc, rc, kc
return False
#__________________________________
def full_house(self, cards, rc, kc):
if self.k_3 and self.k_2 and len(self.k_2-self.k_3) > 0:
sc = 7
for c in cards:
if c.value in self.k_3: rc.add_card(c)
for c in cards:
if c.value in (self.k_2 - self.k_3): rc.add_card(c)
return sc, rc, kc
return False
#______________________________
def flush(self, cards, rc, kc):
if self.is_flush(self.s):
sc = 6
for c in cards:
rc.add_card(c)
return sc, rc, kc
return False
#________________________________
def straight(self, cards, rc, kc):
st, al = self.is_straight(self.v)
if st:
sc = 5
rc.add_card(cards[1]) if al else rc.add_card(cards[0])
return sc, rc, kc
return False
#_______________________________________
def three_of_a_kind(self, cards, rc, kc):
if self.k_3:
sc = 4
for c in cards:
if c.value in self.k_3: rc.add_card(c)
else: kc.add_card(c)
return sc, rc, kc
return False
#________________________________
def pair(self, cards, rc, kc):
# Two pair
if len(self.k_2) > 1:
sc = 3
for c in cards:
if c.value == max(self.k_2): rc.add_card(c)
elif c.value not in self.k_2: kc.add_card(c)
for c in cards:
if c.value == min(self.k_2): rc.add_card(c)
# Pair
elif self.k_2:
sc = 2
for c in cards:
if c.value in self.k_2: rc.add_card(c)
else: kc.add_card(c)
# High card
else:
sc = 1
for c in cards:
if c.value == self.v[0]: rc.add_card(c)
else: kc.add_card(c)
return sc, rc, kc
#_________________________
def eval_hand(self, cards):
poker_hands = [self.straight_flush,self.four_of_a_kind,self.full_house,
self.flush,self.straight,self.three_of_a_kind,self.pair]
s_cards = sorted(cards, key=attrgetter('value','suits'), reverse=True)
self.v = self.values(s_cards)
self.s = self.suits(s_cards)
self.k_4 = self.n_kind(4, self.v)
self.k_3 = self.n_kind(3, self.v)
self.k_2 = self.n_kind(2, self.v)
rank_cards = P.Hand()
kicker_cards = P.Hand()
for ranker in poker_hands:
rank = ranker(s_cards, rank_cards, kicker_cards)
if rank: break
return rank[0], rank[1], rank[2]
| rynecarbone/Pokerly | Game.py | Python | mit | 6,020 |
#
# Copyright 2009
# Greg Swift <gregswift@gmail.com>
#
# This software may be freely redistributed under the terms of the GNU
# general public license.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
import func_module
from func.minion import sub_process
class DiskModule(func_module.FuncModule):
version = "0.0.1"
api_version = "0.0.1"
description = "Gathering disk related information"
def usage(self, partition=None):
"""
Returns the results of df -P
"""
results = {}
# splitting the command variable out into a list does not seem to function
# in the tests I have run
command = '/bin/df -P'
if (partition):
command += ' %s' % (partition)
cmdref = sub_process.Popen(command, stdout=sub_process.PIPE,
stderr=sub_process.PIPE, shell=True,
close_fds=True)
(stdout, stderr) = cmdref.communicate()
for disk in stdout.split('\n'):
if (disk.startswith('Filesystem') or not disk):
continue
(device, total, used, available, percentage, mount) = disk.split()
results[mount] = {'device':device,
'total':str(total),
'used':str(used),
'available':str(available),
'percentage':int(percentage[:-1])}
return results
def register_method_args(self):
"""
The argument export method
"""
return {
'usage':{
'args':{
'partition': {
'type':'string',
'optional':True,
'description':'A specific partition to get usage data for',
}
},
'description':'Gather disk usage information'
}
}
| ralphbean/func-ralphbean-devel | func/minion/modules/disk.py | Python | gpl-2.0 | 2,165 |
# -*- coding: utf-8 -*-
# support.py
# Copyright (C) 2015 LEAP
#
# This program 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
"""
Monkey patches and temporary code that may be removed with version changes.
"""
# for bigcouch
# TODO: Remove if bigcouch support is dropped
class MultipartWriter(object):
"""
A multipart writer adapted from python-couchdb's one so we can PUT
documents using couch's multipart PUT.
This stripped down version does not allow for nested structures, and
contains only the essential things we need to PUT SoledadDocuments to the
couch backend. Also, please note that this is a patch. The couchdb lib has
another implementation that works fine with CouchDB 1.6, but removing this
now will break compatibility with bigcouch.
"""
CRLF = '\r\n'
def __init__(self, fileobj, headers=None, boundary=None):
"""
Initialize the multipart writer.
"""
self.fileobj = fileobj
if boundary is None:
boundary = self._make_boundary()
self._boundary = boundary
self._build_headers('related', headers)
def add(self, mimetype, content, headers=None):
"""
Add a part to the multipart stream.
"""
self.fileobj.write('--')
self.fileobj.write(self._boundary)
self.fileobj.write(self.CRLF)
headers = headers or {}
headers['Content-Type'] = mimetype
self._write_headers(headers)
if content:
# XXX: throw an exception if a boundary appears in the content??
self.fileobj.write(content)
self.fileobj.write(self.CRLF)
def close(self):
"""
Close the multipart stream.
"""
self.fileobj.write('--')
self.fileobj.write(self._boundary)
# be careful not to have anything after '--', otherwise old couch
# versions (including bigcouch) will fail.
self.fileobj.write('--')
def _make_boundary(self):
"""
Create a boundary to discern multi parts.
"""
try:
from uuid import uuid4
return '==' + uuid4().hex + '=='
except ImportError:
from random import randrange
token = randrange(sys.maxint)
format = '%%0%dd' % len(repr(sys.maxint - 1))
return '===============' + (format % token) + '=='
def _write_headers(self, headers):
"""
Write a part header in the buffer stream.
"""
if headers:
for name in sorted(headers.keys()):
value = headers[name]
self.fileobj.write(name)
self.fileobj.write(': ')
self.fileobj.write(value)
self.fileobj.write(self.CRLF)
self.fileobj.write(self.CRLF)
def _build_headers(self, subtype, headers):
"""
Build the main headers of the multipart stream.
This is here so we can send headers separete from content using
python-couchdb API.
"""
self.headers = {}
self.headers['Content-Type'] = 'multipart/%s; boundary="%s"' % \
(subtype, self._boundary)
if headers:
for name in sorted(headers.keys()):
value = headers[name]
self.headers[name] = value
| leapcode/soledad | src/leap/soledad/common/couch/support.py | Python | gpl-3.0 | 3,954 |
""".. Ignore pydocstyle D400.
=======================
Elastic Signal Handlers
=======================
"""
from django.db.models.signals import post_delete, post_save
from django.dispatch import receiver
from guardian.models import GroupObjectPermission, UserObjectPermission
from .builder import index_builder
def _process_permission(perm):
"""Rebuild indexes affected by the given permission."""
# XXX: Optimize: rebuild only permissions, not whole document
codename = perm.permission.codename
if not codename.startswith('view') and not codename.startswith('owner'):
return
index_builder.build(perm.content_object)
@receiver(post_save, sender=UserObjectPermission)
def add_user_permission(sender, instance, **kwargs):
"""Process indexes after adding user permission."""
_process_permission(instance)
@receiver(post_save, sender=GroupObjectPermission)
def add_group_permission(sender, instance, **kwargs):
"""Process indexes after adding group permission."""
_process_permission(instance)
@receiver(post_delete, sender=UserObjectPermission)
def remove_user_permission(sender, instance, **kwargs):
"""Process indexes after removing user permission."""
_process_permission(instance)
@receiver(post_delete, sender=GroupObjectPermission)
def remove_group_permission(sender, instance, **kwargs):
"""Process indexes after removing group permission."""
_process_permission(instance)
| jberci/resolwe | resolwe/elastic/signals.py | Python | apache-2.0 | 1,451 |
# flake8: noqa I201
from Child import Child
from Node import Node
DECL_NODES = [
# type-assignment -> '=' type
Node('TypeInitializerClause', kind='Syntax',
children=[
Child('Equal', kind='EqualToken'),
Child('Value', kind='Type'),
]),
# typealias-declaration -> attributes? access-level-modifier? 'typealias'
# typealias-name generic-parameter-clause?
# type-assignment
# typealias-name -> identifier
Node('TypealiasDecl', kind='Decl', traits=['IdentifiedDecl'],
children=[
Child('Attributes', kind='AttributeList',
is_optional=True),
Child('Modifiers', kind='ModifierList', is_optional=True),
Child('TypealiasKeyword', kind='TypealiasToken'),
Child('Identifier', kind='IdentifierToken'),
Child('GenericParameterClause', kind='GenericParameterClause',
is_optional=True),
Child('Initializer', kind='TypeInitializerClause',
is_optional=True),
Child('GenericWhereClause', kind='GenericWhereClause',
is_optional=True),
]),
# associatedtype-declaration -> attributes? access-level-modifier?
# 'associatedtype' associatedtype-name
# inheritance-clause? type-assignment?
# generic-where-clause?
# associatedtype-name -> identifier
Node('AssociatedtypeDecl', kind='Decl', traits=['IdentifiedDecl'],
children=[
Child('Attributes', kind='AttributeList',
is_optional=True),
Child('Modifiers', kind='ModifierList', is_optional=True),
Child('AssociatedtypeKeyword', kind='AssociatedtypeToken'),
Child('Identifier', kind='IdentifierToken'),
Child('InheritanceClause', kind='TypeInheritanceClause',
is_optional=True),
Child('Initializer', kind='TypeInitializerClause',
is_optional=True),
Child('GenericWhereClause', kind='GenericWhereClause',
is_optional=True),
]),
Node('FunctionParameterList', kind='SyntaxCollection',
element='FunctionParameter'),
Node('ParameterClause', kind='Syntax',
traits=['Parenthesized'],
children=[
Child('LeftParen', kind='LeftParenToken'),
Child('ParameterList', kind='FunctionParameterList'),
Child('RightParen', kind='RightParenToken'),
]),
# -> Type
Node('ReturnClause', kind='Syntax',
children=[
Child('Arrow', kind='ArrowToken'),
Child('ReturnType', kind='Type'),
]),
# function-signature ->
# '(' parameter-list? ')' (throws | rethrows)? '->'? type?
Node('FunctionSignature', kind='Syntax',
children=[
Child('Input', kind='ParameterClause'),
Child('ThrowsOrRethrowsKeyword', kind='Token',
is_optional=True,
token_choices=[
'ThrowsToken',
'RethrowsToken',
]),
Child('Output', kind='ReturnClause', is_optional=True),
]),
# if-config-clause ->
# ('#if' | '#elseif' | '#else') expr? (stmt-list | switch-case-list)
Node('IfConfigClause', kind='Syntax',
children=[
Child('PoundKeyword', kind='Token',
token_choices=[
'PoundIfToken',
'PoundElseifToken',
'PoundElseToken',
]),
Child('Condition', kind='Expr',
is_optional=True),
Child('Elements', kind='Syntax',
node_choices=[
Child('Statements', kind='CodeBlockItemList'),
Child('SwitchCases', kind='SwitchCaseList')]),
]),
Node('IfConfigClauseList', kind='SyntaxCollection',
element='IfConfigClause'),
# if-config-decl -> '#if' expr stmt-list else-if-directive-clause-list
# else-clause? '#endif'
Node('IfConfigDecl', kind='Decl',
children=[
Child('Clauses', kind='IfConfigClauseList'),
Child('PoundEndif', kind='PoundEndifToken'),
]),
Node('PoundErrorDecl', kind='Decl',
traits=['Parenthesized'],
children=[
Child('PoundError', kind='PoundErrorToken'),
Child('LeftParen', kind='LeftParenToken'),
Child('Message', kind='StringLiteralExpr'),
Child('RightParen', kind='RightParenToken')
]),
Node('PoundWarningDecl', kind='Decl',
traits=['Parenthesized'],
children=[
Child('PoundWarning', kind='PoundWarningToken'),
Child('LeftParen', kind='LeftParenToken'),
Child('Message', kind='StringLiteralExpr'),
Child('RightParen', kind='RightParenToken')
]),
Node('DeclModifier', kind='Syntax',
children=[
Child('Name', kind='Token',
text_choices=[
'class', 'convenience', 'dynamic', 'final', 'infix',
'lazy', 'optional', 'override', 'postfix', 'prefix',
'required', 'static', 'unowned', 'weak', 'private',
'fileprivate', 'internal', 'public', 'open',
'mutating', 'nonmutating', 'indirect',
]),
Child('Detail', kind='TokenList', is_optional=True),
]),
Node('InheritedType', kind='Syntax',
traits=['WithTrailingComma'],
children=[
Child('TypeName', kind='Type'),
Child('TrailingComma', kind='CommaToken', is_optional=True),
]),
Node('InheritedTypeList', kind='SyntaxCollection',
element='InheritedType'),
# type-inheritance-clause -> ':' type
Node('TypeInheritanceClause', kind='Syntax',
children=[
Child('Colon', kind='ColonToken'),
Child('InheritedTypeCollection', kind='InheritedTypeList'),
]),
# class-declaration -> attributes? access-level-modifier?
# 'class' class-name
# generic-parameter-clause?
# type-inheritance-clause?
# generic-where-clause?
# '{' class-members '}'
# class-name -> identifier
Node('ClassDecl', kind='Decl',
traits=['DeclGroup', 'IdentifiedDecl'],
children=[
Child('Attributes', kind='AttributeList',
is_optional=True),
Child('Modifiers', kind='ModifierList', is_optional=True),
Child('ClassKeyword', kind='ClassToken'),
Child('Identifier', kind='IdentifierToken'),
Child('GenericParameterClause', kind='GenericParameterClause',
is_optional=True),
Child('InheritanceClause', kind='TypeInheritanceClause',
is_optional=True),
Child('GenericWhereClause', kind='GenericWhereClause',
is_optional=True),
Child('Members', kind='MemberDeclBlock'),
]),
# struct-declaration -> attributes? access-level-modifier?
# 'struct' struct-name
# generic-parameter-clause?
# type-inheritance-clause?
# generic-where-clause?
# '{' struct-members '}'
# struct-name -> identifier
Node('StructDecl', kind='Decl',
traits=['DeclGroup', 'IdentifiedDecl'],
children=[
Child('Attributes', kind='AttributeList',
is_optional=True),
Child('Modifiers', kind='ModifierList', is_optional=True),
Child('StructKeyword', kind='StructToken'),
Child('Identifier', kind='IdentifierToken'),
Child('GenericParameterClause', kind='GenericParameterClause',
is_optional=True),
Child('InheritanceClause', kind='TypeInheritanceClause',
is_optional=True),
Child('GenericWhereClause', kind='GenericWhereClause',
is_optional=True),
Child('Members', kind='MemberDeclBlock'),
]),
Node('ProtocolDecl', kind='Decl',
traits=['DeclGroup', 'IdentifiedDecl'],
children=[
Child('Attributes', kind='AttributeList',
is_optional=True),
Child('Modifiers', kind='ModifierList', is_optional=True),
Child('ProtocolKeyword', kind='ProtocolToken'),
Child('Identifier', kind='IdentifierToken'),
Child('InheritanceClause', kind='TypeInheritanceClause',
is_optional=True),
Child('GenericWhereClause', kind='GenericWhereClause',
is_optional=True),
Child('Members', kind='MemberDeclBlock'),
]),
# extension-declaration -> attributes? access-level-modifier?
# 'extension' extended-type
# type-inheritance-clause?
# generic-where-clause?
# '{' extension-members '}'
# extension-name -> identifier
Node('ExtensionDecl', kind='Decl', traits=['DeclGroup'],
children=[
Child('Attributes', kind='AttributeList',
is_optional=True),
Child('Modifiers', kind='ModifierList', is_optional=True),
Child('ExtensionKeyword', kind='ExtensionToken'),
Child('ExtendedType', kind='Type'),
Child('InheritanceClause', kind='TypeInheritanceClause',
is_optional=True),
Child('GenericWhereClause', kind='GenericWhereClause',
is_optional=True),
Child('Members', kind='MemberDeclBlock'),
]),
Node('MemberDeclBlock', kind='Syntax', traits=['Braced'],
children=[
Child('LeftBrace', kind='LeftBraceToken'),
Child('Members', kind='DeclList'),
Child('RightBrace', kind='RightBraceToken'),
]),
# decl-list = decl decl-list?
Node('DeclList', kind='SyntaxCollection',
element='Decl'),
# source-file = code-block-item-list eof
Node('SourceFile', kind='Syntax',
traits=['WithStatements'],
children=[
Child('Statements', kind='CodeBlockItemList'),
Child('EOFToken', kind='EOFToken')
]),
# initializer -> '=' expr
Node('InitializerClause', kind='Syntax',
children=[
Child('Equal', kind='EqualToken'),
Child('Value', kind='Expr'),
]),
# parameter ->
# external-parameter-name? local-parameter-name ':'
# type '...'? '='? expression? ','?
Node('FunctionParameter', kind='Syntax',
traits=['WithTrailingComma'],
children=[
Child('Attributes', kind='AttributeList',
is_optional=True),
Child('FirstName', kind='Token',
token_choices=[
'IdentifierToken',
'WildcardToken',
],
is_optional=True),
# One of these two names needs be optional, we choose the second
# name to avoid backtracking.
Child('SecondName', kind='Token',
token_choices=[
'IdentifierToken',
'WildcardToken',
],
is_optional=True),
Child('Colon', kind='ColonToken',
is_optional=True),
Child('Type', kind='Type',
is_optional=True),
Child('Ellipsis', kind='Token',
is_optional=True),
Child('DefaultArgument', kind='InitializerClause',
is_optional=True),
Child('TrailingComma', kind='CommaToken',
is_optional=True),
]),
# declaration-modifier -> access-level-modifier
# | mutation-modifier
# | 'class'
# | 'convenience'
# | 'dynamic'
# | 'final'
# | 'infix'
# | 'lazy'
# | 'optional'
# | 'override'
# | 'postfix'
# | 'prefix'
# | 'required'
# | 'static'
# | 'unowned'
# | 'unowned(safe)'
# | 'unowned(unsafe)'
# | 'weak'
# mutation-modifier -> 'mutating' | 'nonmutating'
Node('ModifierList', kind='SyntaxCollection',
element='DeclModifier',
element_name='Modifier'),
Node('FunctionDecl', kind='Decl', traits=['IdentifiedDecl'],
children=[
Child('Attributes', kind='AttributeList',
is_optional=True),
Child('Modifiers', kind='ModifierList',
is_optional=True),
Child('FuncKeyword', kind='FuncToken'),
Child('Identifier', kind='Token',
token_choices=[
'IdentifierToken',
'UnspacedBinaryOperatorToken',
'SpacedBinaryOperatorToken',
'PrefixOperatorToken',
'PostfixOperatorToken',
]),
Child('GenericParameterClause', kind='GenericParameterClause',
is_optional=True),
Child('Signature', kind='FunctionSignature'),
Child('GenericWhereClause', kind='GenericWhereClause',
is_optional=True),
# the body is not necessary inside a protocol definition
Child('Body', kind='CodeBlock', is_optional=True),
]),
Node('InitializerDecl', kind='Decl',
children=[
Child('Attributes', kind='AttributeList',
is_optional=True),
Child('Modifiers', kind='ModifierList',
is_optional=True),
Child('InitKeyword', kind='InitToken'),
Child('OptionalMark', kind='Token',
token_choices=[
'PostfixQuestionMarkToken',
'InfixQuestionMarkToken',
'ExclamationMarkToken',
],
is_optional=True),
Child('GenericParameterClause', kind='GenericParameterClause',
is_optional=True),
Child('Parameters', kind='ParameterClause'),
Child('ThrowsOrRethrowsKeyword', kind='Token',
is_optional=True,
token_choices=[
'ThrowsToken',
'RethrowsToken',
]),
Child('GenericWhereClause', kind='GenericWhereClause',
is_optional=True),
# the body is not necessary inside a protocol definition
Child('Body', kind='CodeBlock', is_optional=True),
]),
Node('DeinitializerDecl', kind='Decl',
children=[
Child('Attributes', kind='AttributeList',
is_optional=True),
Child('Modifiers', kind='ModifierList',
is_optional=True),
Child('DeinitKeyword', kind='DeinitToken'),
Child('Body', kind='CodeBlock'),
]),
Node('SubscriptDecl', kind='Decl',
children=[
Child('Attributes', kind='AttributeList',
is_optional=True),
Child('Modifiers', kind='ModifierList',
is_optional=True),
Child('SubscriptKeyword', kind='SubscriptToken'),
Child('GenericParameterClause', kind='GenericParameterClause',
is_optional=True),
Child('Indices', kind='ParameterClause'),
Child('Result', kind='ReturnClause'),
Child('GenericWhereClause', kind='GenericWhereClause',
is_optional=True),
# the body is not necessary inside a protocol definition
Child('Accessor', kind='AccessorBlock', is_optional=True),
]),
# access-level-modifier -> 'private' | 'private' '(' 'set' ')'
# | 'fileprivate' | 'fileprivate' '(' 'set' ')'
# | 'internal' | 'internal' '(' 'set' ')'
# | 'public' | 'public' '(' 'set' ')'
# | 'open' | 'open' '(' 'set' ')'
Node('AccessLevelModifier', kind='Syntax',
children=[
Child('Name', kind='IdentifierToken'),
Child('LeftParen', kind='LeftParenToken',
is_optional=True),
Child('Modifier', kind='IdentifierToken',
is_optional=True),
Child('RightParen', kind='RightParenToken',
is_optional=True),
]),
Node('AccessPathComponent', kind='Syntax',
children=[
Child('Name', kind='IdentifierToken'),
Child('TrailingDot', kind='PeriodToken', is_optional=True),
]),
Node('AccessPath', kind='SyntaxCollection', element='AccessPathComponent'),
Node('ImportDecl', kind='Decl',
children=[
Child('Attributes', kind='AttributeList', is_optional=True),
Child('Modifiers', kind='ModifierList',
is_optional=True),
Child('ImportTok', kind='ImportToken'),
Child('ImportKind', kind='Token', is_optional=True,
token_choices=[
'TypealiasToken', 'StructToken', 'ClassToken',
'EnumToken', 'ProtocolToken', 'VarToken', 'LetToken',
'FuncToken',
]),
Child('Path', kind='AccessPath'),
]),
# (value)
Node('AccessorParameter', kind='Syntax',
traits=['Parenthesized'],
children=[
Child('LeftParen', kind='LeftParenToken'),
Child('Name', kind='IdentifierToken'),
Child('RightParen', kind='RightParenToken'),
]),
Node('AccessorDecl', kind='Decl',
children=[
Child('Attributes', kind='AttributeList', is_optional=True),
Child('Modifier', kind='DeclModifier', is_optional=True),
Child('AccessorKind', kind='Token',
text_choices=[
'get', 'set', 'didSet', 'willSet',
]),
Child('Parameter', kind='AccessorParameter', is_optional=True),
Child('Body', kind='CodeBlock', is_optional=True),
]),
Node('AccessorList', kind="SyntaxCollection", element='AccessorDecl'),
Node('AccessorBlock', kind="Syntax", traits=['Braced'],
children=[
Child('LeftBrace', kind='LeftBraceToken'),
Child('AccessorListOrStmtList', kind='Syntax',
node_choices=[
Child('Accessors', kind='AccessorList'),
Child('Statements', kind='CodeBlockItemList')]),
Child('RightBrace', kind='RightBraceToken'),
]),
# Pattern: Type = Value { get {} },
Node('PatternBinding', kind="Syntax",
traits=['WithTrailingComma'],
children=[
Child('Pattern', kind='Pattern'),
Child('TypeAnnotation', kind='TypeAnnotation', is_optional=True),
Child('Initializer', kind='InitializerClause', is_optional=True),
Child('Accessor', kind='AccessorBlock', is_optional=True),
Child('TrailingComma', kind='CommaToken', is_optional=True),
]),
Node('PatternBindingList', kind="SyntaxCollection",
element='PatternBinding'),
Node('VariableDecl', kind='Decl',
children=[
Child('Attributes', kind='AttributeList', is_optional=True),
Child('Modifiers', kind='ModifierList', is_optional=True),
Child('LetOrVarKeyword', kind='Token',
token_choices=[
'LetToken', 'VarToken',
]),
Child('Bindings', kind='PatternBindingList'),
]),
Node('EnumCaseElement', kind='Syntax',
description='''
An element of an enum case, containing the name of the case and, \
optionally, either associated values or an assignment to a raw value.
''',
traits=['WithTrailingComma'],
children=[
Child('Identifier', kind='IdentifierToken',
description='The name of this case.'),
Child('AssociatedValue', kind='ParameterClause', is_optional=True,
description='The set of associated values of the case.'),
Child('RawValue', kind='InitializerClause', is_optional=True,
description='''
The raw value of this enum element, if present.
'''),
Child('TrailingComma', kind='CommaToken', is_optional=True,
description='''
The trailing comma of this element, if the case has \
multiple elements.
'''),
]),
Node('EnumCaseElementList', kind='SyntaxCollection',
description='A collection of 0 or more `EnumCaseElement`s.',
element='EnumCaseElement'),
Node('EnumCaseDecl', kind='Decl',
description='''
A `case` declaration of a Swift `enum`. It can have 1 or more \
`EnumCaseElement`s inside, each declaring a different case of the
enum.
''',
children=[
Child('Attributes', kind='AttributeList', is_optional=True,
description='''
The attributes applied to the case declaration.
'''),
Child('Modifiers', kind='ModifierList', is_optional=True,
description='''
The declaration modifiers applied to the case declaration.
'''),
Child('CaseKeyword', kind='CaseToken',
description='The `case` keyword for this case.'),
Child('Elements', kind='EnumCaseElementList',
description='The elements this case declares.')
]),
Node('EnumDecl', kind='Decl', traits=['IdentifiedDecl'],
description='A Swift `enum` declaration.',
children=[
Child('Attributes', kind='AttributeList', is_optional=True,
description='''
The attributes applied to the enum declaration.
'''),
Child('Modifiers', kind='ModifierList', is_optional=True,
description='''
The declaration modifiers applied to the enum declaration.
'''),
Child('EnumKeyword', kind='EnumToken',
description='''
The `enum` keyword for this declaration.
'''),
Child('Identifier', kind='IdentifierToken',
description='''
The name of this enum.
'''),
Child('GenericParameters', kind='GenericParameterClause',
is_optional=True,
description='''
The generic parameters, if any, for this enum.
'''),
Child('InheritanceClause', kind='TypeInheritanceClause',
is_optional=True,
description='''
The inheritance clause describing conformances or raw \
values for this enum.
'''),
Child('GenericWhereClause', kind='GenericWhereClause',
is_optional=True,
description='''
The `where` clause that applies to the generic parameters of \
this enum.
'''),
Child('Members', kind='MemberDeclBlock',
description='''
The cases and other members of this enum.
''')
]),
# operator-decl -> attribute? modifiers? 'operator' operator
Node('OperatorDecl', kind='Decl', traits=['IdentifiedDecl'],
description='A Swift `operator` declaration.',
children=[
Child('Attributes', kind='AttributeList', is_optional=True,
description='''
The attributes applied to the 'operator' declaration.
'''),
Child('Modifiers', kind='ModifierList', is_optional=True,
description='''
The declaration modifiers applied to the 'operator'
declaration.
'''),
Child('OperatorKeyword', kind='OperatorToken'),
Child('Identifier', kind='Token',
token_choices=[
'UnspacedBinaryOperatorToken',
'SpacedBinaryOperatorToken',
'PrefixOperatorToken',
'PostfixOperatorToken',
]),
Child('InfixOperatorGroup', kind='InfixOperatorGroup',
description='''
Optionally specifiy a precedence group
''',
is_optional=True),
]),
# infix-operator-group -> ':' identifier
Node('InfixOperatorGroup', kind='Syntax',
description='''
A clause to specify precedence group in infix operator declaration.
''',
children=[
Child('Colon', kind='ColonToken'),
Child('PrecedenceGroupName', kind='IdentifierToken',
description='''
The name of the precedence group for the operator
'''),
]),
# precedence-group-decl -> attributes? modifiers? 'precedencegroup'
# identifier '{' precedence-group-attribute-list
# '}'
Node('PrecedenceGroupDecl', kind='Decl', traits=['IdentifiedDecl'],
description='A Swift `precedencegroup` declaration.',
children=[
Child('Attributes', kind='AttributeList', is_optional=True,
description='''
The attributes applied to the 'precedencegroup' declaration.
'''),
Child('Modifiers', kind='ModifierList', is_optional=True,
description='''
The declaration modifiers applied to the 'precedencegroup'
declaration.
'''),
Child('PrecedencegroupKeyword', kind='PrecedencegroupToken'),
Child('Identifier', kind='IdentifierToken',
description='''
The name of this precedence group.
'''),
Child('LeftBrace', kind='LeftBraceToken'),
Child('GroupAttributes', kind='PrecedenceGroupAttributeList',
description='''
The characteristics of this precedence group.
'''),
Child('RightBrace', kind='RightBraceToken'),
]),
# precedence-group-attribute-list ->
# (precedence-group-relation | precedence-group-assignment |
# precedence-group-associativity )*
Node('PrecedenceGroupAttributeList', kind='SyntaxCollection',
element='Syntax',
element_choices=[
'PrecedenceGroupRelation',
'PrecedenceGroupAssignment',
'PrecedenceGroupAssociativity'
]),
# precedence-group-relation ->
# ('higherThan' | 'lowerThan') ':' precedence-group-name-list
Node('PrecedenceGroupRelation', kind='Syntax',
description='''
Specify the new precedence group's relation to existing precedence
groups.
''',
children=[
Child('HigherThanOrLowerThan', kind='IdentifierToken',
text_choices=[
'higherThan', 'lowerThan',
],
description='''
The relation to specified other precedence groups.
'''),
Child('Colon', kind='ColonToken'),
Child('OtherNames', kind='PrecedenceGroupNameList',
description='''
The name of other precedence group to which this precedence
group relates.
'''),
]),
# precedence-group-name-list ->
# identifier (',' identifier)*
Node('PrecedenceGroupNameList', kind='SyntaxCollection',
element='PrecedenceGroupNameElement'),
Node('PrecedenceGroupNameElement', kind='Syntax',
children=[
Child('Name', kind='IdentifierToken'),
Child('TrailingComma', kind='CommaToken',
is_optional=True),
]),
# precedence-group-assignment ->
# 'assignment' ':' ('true' | 'false')
Node('PrecedenceGroupAssignment', kind='Syntax',
description='''
Specifies the precedence of an operator when used in an operation
that includes optional chaining.
''',
children=[
Child('AssignmentKeyword', kind='IdentifierToken',
text_choices=['assignment']),
Child('Colon', kind='ColonToken'),
Child('Flag', kind='Token',
token_choices=[
'TrueToken',
'FalseToken',
],
description='''
When true, an operator in the corresponding precedence group
uses the same grouping rules during optional chaining as the
assignment operators from the standard library. Otherwise,
operators in the precedence group follows the same optional
chaining rules as operators that don't perform assignment.
'''),
]),
# precedence-group-associativity ->
# 'associativity' ':' ('left' | 'right' | 'none')
Node('PrecedenceGroupAssociativity', kind='Syntax',
description='''
Specifies how a sequence of operators with the same precedence level
are grouped together in the absence of grouping parentheses.
''',
children=[
Child('AssociativityKeyword', kind='IdentifierToken',
text_choices=['associativity']),
Child('Colon', kind='ColonToken'),
Child('Value', kind='IdentifierToken',
text_choices=['left', 'right', 'none'],
description='''
Operators that are `left`-associative group left-to-right.
Operators that are `right`-associative group right-to-left.
Operators that are specified with an associativity of `none`
don't associate at all
'''),
]),
]
| tjw/swift | utils/gyb_syntax_support/DeclNodes.py | Python | apache-2.0 | 31,769 |
# -*- coding: utf-8 -*-
"""
adam.domain.common.py
~~~~~~~~~~~~~~~~~~~~~
Commonly used schema and domain definitions.
:copyright: (c) 2015 by Nicola Iarocci and CIR2000.
:license: BSD, see LICENSE for more details.
"""
from collections import namedtuple
SchemaKey = namedtuple('SchemaKey', 'company, account, amount, date, type, ' +
'total, quantity')
key = SchemaKey(
company='c',
account='ac',
amount='a',
date='d',
type='ty',
total='t',
quantity='q'
)
# common data types
required_integer = {
'type': 'integer',
'required': True
}
unique_integer = required_integer.copy()
unique_integer['unique'] = True
required_string = {
'type': 'string',
'required': True,
'empty': False
}
unique_string = required_string.copy()
unique_string['unique'] = True
required_datetime = {
'type': 'datetime',
'required': True
}
# common fields
company = {
'type': 'objectid',
'required': True,
'data_relation': {
'resource': 'companies',
'field': '_id',
},
}
# most resources share the following settings
base_def = {
'auth_field': key.account
}
# most collections share the following schema definition
base_schema = {
key.company: company,
}
| kidaa/adam | adam/domain/common.py | Python | bsd-3-clause | 1,274 |
ISO3166 = [
(_("Afghanistan"), "AF", "AFG"),
(_("Aland Islands"), "AX", "ALA"),
(_("Albania"), "AL", "ALB"),
(_("Algeria"), "DZ", "DZA"),
(_("American Samoa"), "AS", "ASM"),
(_("Andorra"), "AD", "AND"),
(_("Angola"), "AO", "AGO"),
(_("Anguilla"), "AI", "AIA"),
(_("Antarctica"), "AQ", "ATA"),
(_("Antigua and Barbuda"), "AG", "ATG"),
(_("Argentina"), "AR", "ARG"),
(_("Armenia"), "AM", "ARM"),
(_("Aruba"), "AW", "ABW"),
(_("Australia"), "AU", "AUS"),
(_("Austria"), "AT", "AUT"),
(_("Azerbaijan"), "AZ", "AZE"),
(_("Bahamas"), "BS", "BHS"),
(_("Bahrain"), "BH", "BHR"),
(_("Bangladesh"), "BD", "BGD"),
(_("Barbados"), "BB", "BRB"),
(_("Belarus"), "BY", "BLR"),
(_("Belgium"), "BE", "BEL"),
(_("Belize"), "BZ", "BLZ"),
(_("Benin"), "BJ", "BEN"),
(_("Bermuda"), "BM", "BMU"),
(_("Bhutan"), "BT", "BTN"),
(_("Bolivia (Plurinational State of)"), "BO", "BOL"),
(_("Bonaire, Sint Eustatius and Saba"), "BQ", "BES"),
(_("Bosnia and Herzegovina"), "BA", "BIH"),
(_("Botswana"), "BW", "BWA"),
(_("Bouvet Island"), "BV", "BVT"),
(_("Brazil"), "BR", "BRA"),
(_("British Indian Ocean Territory"), "IO", "IOT"),
(_("Brunei Darussalam"), "BN", "BRN"),
(_("Bulgaria"), "BG", "BGR"),
(_("Burkina Faso"), "BF", "BFA"),
(_("Burundi"), "BI", "BDI"),
(_("Cabo Verde"), "CV", "CPV"),
(_("Cambodia"), "KH", "KHM"),
(_("Cameroon"), "CM", "CMR"),
(_("Canada"), "CA", "CAN"),
(_("Cayman Islands"), "KY", "CYM"),
(_("Central African Republic"), "CF", "CAF"),
(_("Chad"), "TD", "TCD"),
(_("Chile"), "CL", "CHL"),
(_("China"), "CN", "CHN"),
(_("Christmas Island"), "CX", "CXR"),
(_("Cocos (Keeling) Islands"), "CC", "CCK"),
(_("Colombia"), "CO", "COL"),
(_("Comoros"), "KM", "COM"),
(_("Congo"), "CG", "COG"),
(_("Congo (Democratic Republic of the)"), "CD", "COD"),
(_("Cook Islands"), "CK", "COK"),
(_("Costa Rica"), "CR", "CRI"),
(_("Cote d'Ivoire"), "CI", "CIV"),
(_("Croatia"), "HR", "HRV"),
(_("Cuba"), "CU", "CUB"),
(_("Curacao"), "CW", "CUW"),
(_("Cyprus"), "CY", "CYP"),
(_("Czechia"), "CZ", "CZE"),
(_("Denmark"), "DK", "DNK"),
(_("Djibouti"), "DJ", "DJI"),
(_("Dominica"), "DM", "DMA"),
(_("Dominican Republic"), "DO", "DOM"),
(_("Ecuador"), "EC", "ECU"),
(_("Egypt"), "EG", "EGY"),
(_("El Salvador"), "SV", "SLV"),
(_("Equatorial Guinea"), "GQ", "GNQ"),
(_("Eritrea"), "ER", "ERI"),
(_("Estonia"), "EE", "EST"),
(_("Ethiopia"), "ET", "ETH"),
(_("Falkland Islands (Malvinas)"), "FK", "FLK"),
(_("Faroe Islands"), "FO", "FRO"),
(_("Fiji"), "FJ", "FJI"),
(_("Finland"), "FI", "FIN"),
(_("France"), "FR", "FRA"),
(_("French Guiana"), "GF", "GUF"),
(_("French Polynesia"), "PF", "PYF"),
(_("French Southern Territories"), "TF", "ATF"),
(_("Gabon"), "GA", "GAB"),
(_("Gambia"), "GM", "GMB"),
(_("Georgia"), "GE", "GEO"),
(_("Germany"), "DE", "DEU"),
(_("Ghana"), "GH", "GHA"),
(_("Gibraltar"), "GI", "GIB"),
(_("Greece"), "GR", "GRC"),
(_("Greenland"), "GL", "GRL"),
(_("Grenada"), "GD", "GRD"),
(_("Guadeloupe"), "GP", "GLP"),
(_("Guam"), "GU", "GUM"),
(_("Guatemala"), "GT", "GTM"),
(_("Guernsey"), "GG", "GGY"),
(_("Guinea"), "GN", "GIN"),
(_("Guinea-Bissau"), "GW", "GNB"),
(_("Guyana"), "GY", "GUY"),
(_("Haiti"), "HT", "HTI"),
(_("Heard Island and McDonald Islands"), "HM", "HMD"),
(_("Holy See"), "VA", "VAT"),
(_("Honduras"), "HN", "HND"),
(_("Hong Kong"), "HK", "HKG"),
(_("Hungary"), "HU", "HUN"),
(_("Iceland"), "IS", "ISL"),
(_("India"), "IN", "IND"),
(_("Indonesia"), "ID", "IDN"),
(_("Iran (Islamic Republic of)"), "IR", "IRN"),
(_("Iraq"), "IQ", "IRQ"),
(_("Ireland"), "IE", "IRL"),
(_("Isle of Man"), "IM", "IMN"),
(_("Israel"), "IL", "ISR"),
(_("Italy"), "IT", "ITA"),
(_("Jamaica"), "JM", "JAM"),
(_("Japan"), "JP", "JPN"),
(_("Jersey"), "JE", "JEY"),
(_("Jordan"), "JO", "JOR"),
(_("Kazakhstan"), "KZ", "KAZ"),
(_("Kenya"), "KE", "KEN"),
(_("Kiribati"), "KI", "KIR"),
(_("Korea (Democratic People's Republic of)"), "KP", "PRK"),
(_("Korea (Republic of)"), "KR", "KOR"),
(_("Kuwait"), "KW", "KWT"),
(_("Kyrgyzstan"), "KG", "KGZ"),
(_("Lao People's Democratic Republic"), "LA", "LAO"),
(_("Latvia"), "LV", "LVA"),
(_("Lebanon"), "LB", "LBN"),
(_("Lesotho"), "LS", "LSO"),
(_("Liberia"), "LR", "LBR"),
(_("Libya"), "LY", "LBY"),
(_("Liechtenstein"), "LI", "LIE"),
(_("Lithuania"), "LT", "LTU"),
(_("Luxembourg"), "LU", "LUX"),
(_("Macao"), "MO", "MAC"),
(_("Madagascar"), "MG", "MDG"),
(_("Malawi"), "MW", "MWI"),
(_("Malaysia"), "MY", "MYS"),
(_("Maldives"), "MV", "MDV"),
(_("Mali"), "ML", "MLI"),
(_("Malta"), "MT", "MLT"),
(_("Marshall Islands"), "MH", "MHL"),
(_("Martinique"), "MQ", "MTQ"),
(_("Mauritania"), "MR", "MRT"),
(_("Mauritius"), "MU", "MUS"),
(_("Mayotte"), "YT", "MYT"),
(_("Mexico"), "MX", "MEX"),
(_("Micronesia (Federated States of)"), "FM", "FSM"),
(_("Moldova (Republic of)"), "MD", "MDA"),
(_("Monaco"), "MC", "MCO"),
(_("Mongolia"), "MN", "MNG"),
(_("Montenegro"), "ME", "MNE"),
(_("Montserrat"), "MS", "MSR"),
(_("Morocco"), "MA", "MAR"),
(_("Mozambique"), "MZ", "MOZ"),
(_("Myanmar"), "MM", "MMR"),
(_("Namibia"), "NA", "NAM"),
(_("Nauru"), "NR", "NRU"),
(_("Nepal"), "NP", "NPL"),
(_("Netherlands"), "NL", "NLD"),
(_("New Caledonia"), "NC", "NCL"),
(_("New Zealand"), "NZ", "NZL"),
(_("Nicaragua"), "NI", "NIC"),
(_("Niger"), "NE", "NER"),
(_("Nigeria"), "NG", "NGA"),
(_("Niue"), "NU", "NIU"),
(_("Norfolk Island"), "NF", "NFK"),
(_("North Macedonia (The Republic of)"), "MK", "MKD"),
(_("Northern Mariana Islands"), "MP", "MNP"),
(_("Norway"), "NO", "NOR"),
(_("Oman"), "OM", "OMN"),
(_("Pakistan"), "PK", "PAK"),
(_("Palau"), "PW", "PLW"),
(_("Palestine, State of"), "PS", "PSE"),
(_("Panama"), "PA", "PAN"),
(_("Papua New Guinea"), "PG", "PNG"),
(_("Paraguay"), "PY", "PRY"),
(_("Peru"), "PE", "PER"),
(_("Philippines"), "PH", "PHL"),
(_("Pitcairn"), "PN", "PCN"),
(_("Poland"), "PL", "POL"),
(_("Portugal"), "PT", "PRT"),
(_("Puerto Rico"), "PR", "PRI"),
(_("Qatar"), "QA", "QAT"),
(_("Reunion"), "RE", "REU"),
(_("Romania"), "RO", "ROU"),
(_("Russian Federation"), "RU", "RUS"),
(_("Rwanda"), "RW", "RWA"),
(_("Saint Barthelemy"), "BL", "BLM"),
(_("Saint Helena, Ascension and Tristan da Cunha"), "SH", "SHN"),
(_("Saint Kitts and Nevis"), "KN", "KNA"),
(_("Saint Lucia"), "LC", "LCA"),
(_("Saint Martin (French part)"), "MF", "MAF"),
(_("Saint Pierre and Miquelon"), "PM", "SPM"),
(_("Saint Vincent and the Grenadines"), "VC", "VCT"),
(_("Samoa"), "WS", "WSM"),
(_("San Marino"), "SM", "SMR"),
(_("Sao Tome and Principe"), "ST", "STP"),
(_("Saudi Arabia"), "SA", "SAU"),
(_("Senegal"), "SN", "SEN"),
(_("Serbia"), "RS", "SRB"),
(_("Seychelles"), "SC", "SYC"),
(_("Sierra Leone"), "SL", "SLE"),
(_("Singapore"), "SG", "SGP"),
(_("Sint Maarten (Dutch part)"), "SX", "SXM"),
(_("Slovakia"), "SK", "SVK"),
(_("Slovenia"), "SI", "SVN"),
(_("Solomon Islands"), "SB", "SLB"),
(_("Somalia"), "SO", "SOM"),
(_("South Africa"), "ZA", "ZAF"),
(_("South Georgia and the South Sandwich Islands"), "GS", "SGS"),
(_("South Sudan"), "SS", "SSD"),
(_("Spain"), "ES", "ESP"),
(_("Sri Lanka"), "LK", "LKA"),
(_("Sudan"), "SD", "SDN"),
(_("Suriname"), "SR", "SUR"),
(_("Svalbard and Jan Mayen"), "SJ", "SJM"),
(_("Swaziland"), "SZ", "SWZ"),
(_("Sweden"), "SE", "SWE"),
(_("Switzerland"), "CH", "CHE"),
(_("Syrian Arab Republic"), "SY", "SYR"),
(_("Taiwan"), "TW", "TWN"),
(_("Tajikistan"), "TJ", "TJK"),
(_("Tanzania, United Republic of"), "TZ", "TZA"),
(_("Thailand"), "TH", "THA"),
(_("Timor-Leste"), "TL", "TLS"),
(_("Togo"), "TG", "TGO"),
(_("Tokelau"), "TK", "TKL"),
(_("Tonga"), "TO", "TON"),
(_("Trinidad and Tobago"), "TT", "TTO"),
(_("Tunisia"), "TN", "TUN"),
(_("Turkey"), "TR", "TUR"),
(_("Turkmenistan"), "TM", "TKM"),
(_("Turks and Caicos Islands"), "TC", "TCA"),
(_("Tuvalu"), "TV", "TUV"),
(_("Uganda"), "UG", "UGA"),
(_("Ukraine"), "UA", "UKR"),
(_("United Arab Emirates"), "AE", "ARE"),
(_("United Kingdom"), "GB", "GBR"),
(_("United States of America"), "US", "USA"),
(_("United States Minor Outlying Islands"), "UM", "UMI"),
(_("Uruguay"), "UY", "URY"),
(_("Uzbekistan"), "UZ", "UZB"),
(_("Vanuatu"), "VU", "VUT"),
(_("Venezuela (Bolivarian Republic of)"), "VE", "VEN"),
(_("Viet Nam"), "VN", "VNM"),
(_("Virgin Islands (British)"), "VG", "VGB"),
(_("Virgin Islands (U.S.)"), "VI", "VIR"),
(_("Wallis and Futuna"), "WF", "WLF"),
(_("Western Sahara"), "EH", "ESH"),
(_("Yemen"), "YE", "YEM"),
(_("Zambia"), "ZM", "ZMB"),
(_("Zimbabwe"), "ZW", "ZWE")
] | OpenPLi/enigma2 | lib/python/Tools/CountryCodes.py | Python | gpl-2.0 | 8,527 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('firestation', '0052_auto_20170731_1345'),
('weather', '0002_auto_20171003_2229'),
]
operations = [
migrations.AlterModelOptions(
name='departmentwarnings',
options={},
),
migrations.AddField(
model_name='departmentwarnings',
name='department',
field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, blank=True, to='firestation.FireDepartment', null=True),
),
migrations.AlterField(
model_name='departmentwarnings',
name='departmentfdid',
field=models.CharField(max_length=10, null=True, blank=True),
),
]
| FireCARES/firecares | firecares/weather/migrations/0003_auto_20171004_0852.py | Python | mit | 897 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cherrypy
import htpc
import logging
from htpc.manageusers import Manageusers
from sqlobject import SQLObject, SQLObjectNotFound
from sqlobject.col import StringCol
SESSION_KEY = '_cp_username'
logger = logging.getLogger('authentication')
def check_credentials(username, password):
"""Verifies credentials for username and password.
Returns None on success or a string describing the error on failure"""
# Adapt to your needs
try:
#Select one item with in username col with username (there is only one as its unique)
userexist = Manageusers.selectBy(username=username).getOne()
if userexist and userexist.password == password:
logger.debug("%s %s logged in from %s" % (userexist.role.upper(), userexist.username, cherrypy.request.remote.ip))
return None
else:
logger.warning("Failed login attempt with username: %s password: %s from ip: %s" % (username, password, cherrypy.request.remote.ip))
return u"Incorrect username or password."
except Exception as e:
logger.warning("Failed login attempt with username: %s password: %s from IP: %s" % (username, password, cherrypy.request.remote.ip))
return u"Incorrect username or password."
def check_auth(*args, **kwargs):
"""A tool that looks in config for 'auth.require'. If found and it
is not None, a login is required and the entry is evaluated as a list of
conditions that the user must fulfill"""
p = '%sauth/login' % htpc.WEBDIR
conditions = cherrypy.request.config.get('auth.require', None)
if conditions is not None:
username = cherrypy.session.get(SESSION_KEY)
if username:
cherrypy.request.login = username
for condition in conditions:
# A condition is just a callable that returns true or false
if not condition():
raise cherrypy.HTTPRedirect(p)
else:
raise cherrypy.HTTPRedirect(p)
cherrypy.tools.auth = cherrypy.Tool('before_handler', check_auth)
def require(*conditions):
"""A decorator that appends conditions to the auth.require config
variable."""
def decorate(f):
if not hasattr(f, '_cp_config'):
f._cp_config = dict()
if 'auth.require' not in f._cp_config:
f._cp_config['auth.require'] = []
f._cp_config['auth.require'].extend(conditions)
return f
return decorate
# Conditions are callables that return True
# if the user fulfills the conditions they define, False otherwise
#
# They can access the current username as cherrypy.request.login
#
# Define those at will however suits the application.
def member_of(groupname):
def check():
userexist = Manageusers.selectBy(username=cherrypy.request.login).getOne()
if userexist and userexist.role in groupname:
return cherrypy.request.login == userexist.username and userexist.role in groupname
return check
def name_is(reqd_username):
return lambda: reqd_username == cherrypy.request.login
def any_of(*conditions):
"""Returns True if any of the conditions match"""
def check():
for c in conditions:
if c():
return True
return False
return check
# By default all conditions are required, but this might still be
# needed if you want to use it inside of an any_of(...) condition
def all_of(*conditions):
"""Returns True if all of the conditions match"""
def check():
for c in conditions:
if not c():
return False
return True
return check
# Controller to provide login and logout actions
class AuthController(object):
def get_loginform(self, username, msg="Enter login information", from_page="/"):
return htpc.LOOKUP.get_template('loginform.html').render(scriptname='formlogin', from_page=htpc.WEBDIR, msg=msg)
@cherrypy.expose()
def login(self, username=None, password=None, from_page="/"):
if username is None or password is None:
return self.get_loginform("", from_page=htpc.WEBDIR)
error_msg = check_credentials(username, password)
if error_msg:
return self.get_loginform(username, error_msg, from_page)
else:
cherrypy.session.regenerate()
cherrypy.session[SESSION_KEY] = cherrypy.request.login = username
raise cherrypy.HTTPRedirect(str(htpc.WEBDIR) or from_page)
| scith/htpc-manager_ynh | sources/libs/cherrypy/lib/auth2.py | Python | gpl-3.0 | 4,546 |
# Touchy is Copyright (c) 2009 Chris Radek <chris@timeguy.com>
#
# Touchy 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) any later version.
#
# Touchy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
import os
class filechooser:
def __init__(self, gtk, emc, labels, eventboxes, listing):
self.labels = labels
self.eventboxes = eventboxes
self.numlabels = len(labels)
self.listing = listing
self.gtk = gtk
self.emc = emc
self.emccommand = emc.command()
self.fileoffset = 0
self.dir = os.path.join(os.getenv('HOME'), 'linuxcnc', 'nc_files')
self.reload(0)
def populate(self):
files = self.files[self.fileoffset:]
for i in range(self.numlabels):
l = self.labels[i]
e = self.eventboxes[i]
if i < len(files):
l.set_text(files[i])
else:
l.set_text('')
if self.selected == self.fileoffset + i:
e.modify_bg(self.gtk.STATE_NORMAL, self.gtk.gdk.color_parse('#fff'))
else:
e.modify_bg(self.gtk.STATE_NORMAL, self.gtk.gdk.color_parse('#ccc'))
def select(self, eventbox, event):
n = int(eventbox.get_name()[20:])
self.selected = self.fileoffset + n
self.emccommand.mode(self.emc.MODE_MDI)
fn = os.path.join(self.dir, self.labels[n].get_text())
self.emccommand.program_open(fn)
self.listing.readfile(fn)
self.populate()
def select_and_open(self,fn):
self.reload(0)
numfiles = len(self.files)
fn = os.path.basename(fn)
self.fileoffset = 0
found = False
while True:
for k in range(self.numlabels):
n = k + self.fileoffset
if n >= numfiles: return # notfound
if self.files[n] == fn:
found = True
break # from for
if found: break # from while
self.fileoffset += self.numlabels
self.selected = n
self.emccommand.mode(self.emc.MODE_MDI)
fn = os.path.join(self.dir, fn)
self.emccommand.program_open(fn)
self.listing.readfile(fn)
self.populate()
def up(self, b):
self.fileoffset -= self.numlabels
if self.fileoffset < 0:
self.fileoffset = 0
self.populate()
def down(self, b):
self.fileoffset += self.numlabels
self.populate()
def reload(self, b):
self.files = os.listdir(self.dir)
self.files = [i for i in self.files if i.endswith('.ngc') and
os.path.isfile(os.path.join(self.dir, i))]
self.files.sort()
self.selected = -1
self.populate()
| ianmcmahon/linuxcnc-mirror | src/emc/usr_intf/touchy/filechooser.py | Python | lgpl-2.1 | 3,122 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2014 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""This file contains the airport plist plugin in Plaso."""
from plaso.events import plist_event
from plaso.parsers.plist_plugins import interface
__author__ = 'Joaquin Moreno Garijo (Joaquin.MorenoGarijo.2013@live.rhul.ac.uk)'
class AirportPlugin(interface.PlistPlugin):
"""Plist plugin that extracts WiFi information."""
NAME = 'plist_airport'
PLIST_PATH = 'com.apple.airport.preferences.plist'
PLIST_KEYS = frozenset(['RememberedNetworks'])
def GetEntries(self, match, **unused_kwargs):
"""Extracts relevant Airport entries.
Args:
match: A dictionary containing keys extracted from PLIST_KEYS.
Yields:
EventObject objects extracted from the plist.
"""
for wifi in match['RememberedNetworks']:
description = (
u'[WiFi] Connected to network: <{}> '
u'using security {}').format(
wifi['SSIDString'], wifi['SecurityType'])
yield plist_event.PlistEvent(
u'/RememberedNetworks', u'item', wifi['LastConnected'], description)
| iwm911/plaso | plaso/parsers/plist_plugins/airport.py | Python | apache-2.0 | 1,728 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Christophe Benz
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
try:
from configparser import RawConfigParser, DEFAULTSECT
except ImportError:
from ConfigParser import RawConfigParser, DEFAULTSECT
from collections import OrderedDict
from decimal import Decimal
import os
import io
import sys
from weboob.tools.compat import basestring, unicode
from .iconfig import IConfig
from .util import LOGGER
__all__ = ['INIConfig']
class INIConfig(IConfig):
ROOTSECT = 'ROOT'
def __init__(self, path):
self.path = path
self.values = OrderedDict()
self.config = RawConfigParser()
def load(self, default={}):
self.values = OrderedDict(default)
if os.path.exists(self.path):
LOGGER.debug(u'Loading application configuration file: %s.' % self.path)
if sys.version_info.major < 3:
self.config.readfp(io.open(self.path, "r", encoding='utf-8'))
else:
self.config.read(self.path, encoding='utf-8')
for section in self.config.sections():
args = section.split(':')
if args[0] == self.ROOTSECT:
args.pop(0)
for key, value in self.config.items(section):
self.set(*(args + [key, value]))
# retro compatibility
if len(self.config.sections()) == 0:
first = True
for key, value in self.config.items(DEFAULTSECT):
if first:
LOGGER.warning('The configuration file "%s" uses an old-style' % self.path)
LOGGER.warning('Please rename the %s section to %s' % (DEFAULTSECT, self.ROOTSECT))
first = False
self.set(key, value)
LOGGER.debug(u'Application configuration file loaded: %s.' % self.path)
else:
self.save()
LOGGER.debug(u'Application configuration file created with default values: %s. '
'Please customize it.' % self.path)
return self.values
def save(self):
def save_section(values, root_section=self.ROOTSECT):
for k, v in values.items():
if isinstance(v, (int, Decimal, float, basestring)):
if not self.config.has_section(root_section):
self.config.add_section(root_section)
self.config.set(root_section, k, unicode(v))
elif isinstance(v, dict):
new_section = ':'.join((root_section, k)) if (root_section != self.ROOTSECT or k == self.ROOTSECT) else k
if not self.config.has_section(new_section):
self.config.add_section(new_section)
save_section(v, new_section)
save_section(self.values)
with io.open(self.path, 'w', encoding='utf-8') as f:
self.config.write(f)
def get(self, *args, **kwargs):
default = None
if 'default' in kwargs:
default = kwargs['default']
v = self.values
for k in args[:-1]:
if k in v:
v = v[k]
else:
return default
try:
return v[args[-1]]
except KeyError:
return default
def set(self, *args):
v = self.values
for k in args[:-2]:
if k not in v:
v[k] = OrderedDict()
v = v[k]
v[args[-2]] = args[-1]
def delete(self, *args):
v = self.values
for k in args[:-1]:
if k not in v:
return
v = v[k]
v.pop(args[-1], None)
| laurentb/weboob | weboob/tools/config/iniconfig.py | Python | lgpl-3.0 | 4,388 |
import re
from django.test import TestCase
from iitgauth.constants import LOGIN_SERVERS
class TestServerList(TestCase):
def test_server_ips(self):
"""
Test for login server IPs to match IP pattern.
:return: None
"""
server_ips = [item[0] for item in LOGIN_SERVERS]
ip_pattern = re.compile(r"^202.141.80.[0-9]+$")
self.assertTrue(all([bool(ip_pattern.match(ip)) for ip in server_ips]))
def test_server_names(self):
"""
Test for login server names to match name pattern.
:return: None
"""
server_names = [item[1] for item in LOGIN_SERVERS]
name_pattern = re.compile(r"[a-zA-Z]+$")
self.assertTrue(all([bool(name_pattern.match(name)) for name in server_names]))
| narenchoudhary/django-iitg-auth | tests/test_constants.py | Python | bsd-3-clause | 787 |
__author__ = 'Byoungwoo'
import __init__
this={
"currentTime": 0,
"startTime": 0,
"state": "NONE",
}
q = {}
logger = __init__.LoggerFactory.getLogger("fecs.FloodCircumstance")
FloorType = __init__.FloorType
def setParameter(key,val):
if key in this : this[key]=val
def trigger():
engine = __init__.Fecs.getApplicationContext().getBean("engine")
ui = __init__.Fecs.getApplicationContext().getBean("userInterface")
startTime = this["startTime"]
currentTime = this["currentTime"]
if this["state"] == "NONE":
q["LEFT"] = []
q["RIGHT"] = []
for cabinType in engine.getCabins().keySet():
cabin = engine.getCabins().get(cabinType)
q[cabinType.toString()].append(cabin.getTarget())
while not cabin.getQueue().isEmpty():
q[cabinType.toString()].append(cabin.getQueue().poll())
q[cabinType.toString()].reverse()
cabin.stop()
cabin.move(engine.getFloors().get(FloorType.TENTH))
engine.getFloors().get(FloorType.FIRST).getPassengers().clear()
this["state"] = "MOVING"
elif this["state"] == "MOVING":
stopped = True
for cabin in engine.getCabins().values():
if cabin.getState() != cabin.State.STOP:
stopped = False
if stopped:
this["state"] = "STOP"
elif this["state"] == "STOP":
if currentTime - startTime > 60000:
for cabinType in engine.getCabins().keySet():
cabin = engine.getCabins().get(cabinType)
while len(q[cabinType.toString()]) != 0:
cabin.move(q[cabinType.toString()].pop())
this["state"] = "NONE"
engine.setCircumstanceState(__init__.CircumstanceType.DEFAULT.state())
ui.endFail()
| jcooky/fecs | src/main/scripts/FloodCircumstance.py | Python | gpl-2.0 | 1,833 |
# -*- coding: utf-8 -*-
"""
End-to-end tests for the main LMS Dashboard (aka, Student Dashboard).
"""
import six
from common.test.acceptance.fixtures.course import CourseFixture, XBlockFixtureDesc
from common.test.acceptance.pages.common.auto_auth import AutoAuthPage
from common.test.acceptance.pages.lms.dashboard import DashboardPage
from common.test.acceptance.tests.helpers import UniqueCourseTest, generate_course_key
DEFAULT_SHORT_DATE_FORMAT = u'{dt:%b} {dt.day}, {dt.year}'
TEST_DATE_FORMAT = u'{dt:%b} {dt.day}, {dt.year} {dt.hour:02}:{dt.minute:02}'
class BaseLmsDashboardTestMultiple(UniqueCourseTest):
""" Base test suite for the LMS Student Dashboard with Multiple Courses"""
def setUp(self):
"""
Initializes the components (page objects, courses, users) for this test suite
"""
# Some parameters are provided by the parent setUp() routine, such as the following:
# self.course_id, self.course_info, self.unique_id
super(BaseLmsDashboardTestMultiple, self).setUp()
# Load page objects for use by the tests
self.dashboard_page = DashboardPage(self.browser)
# Configure some aspects of the test course and install the settings into the course
self.courses = {
'A': {
'org': 'test_org',
'number': self.unique_id,
'run': 'test_run_A',
'display_name': 'Test Course A',
'enrollment_mode': 'audit',
'cert_name_long': 'Certificate of Audit Achievement'
},
'B': {
'org': 'test_org',
'number': self.unique_id,
'run': 'test_run_B',
'display_name': 'Test Course B',
'enrollment_mode': 'verified',
'cert_name_long': 'Certificate of Verified Achievement'
},
'C': {
'org': 'test_org',
'number': self.unique_id,
'run': 'test_run_C',
'display_name': 'Test Course C',
'enrollment_mode': 'credit',
'cert_name_long': 'Certificate of Credit Achievement'
}
}
self.username = "test_{uuid}".format(uuid=self.unique_id[0:6])
self.email = "{user}@example.com".format(user=self.username)
self.course_keys = {}
self.course_fixtures = {}
for key, value in six.iteritems(self.courses):
course_key = generate_course_key(
value['org'],
value['number'],
value['run'],
)
course_fixture = CourseFixture(
value['org'],
value['number'],
value['run'],
value['display_name'],
)
course_fixture.add_advanced_settings({
u"social_sharing_url": {u"value": "http://custom/course/url"},
u"cert_name_long": {u"value": value['cert_name_long']}
})
course_fixture.add_children(
XBlockFixtureDesc('chapter', 'Test Section 1').add_children(
XBlockFixtureDesc('sequential', 'Test Subsection 1,1').add_children(
XBlockFixtureDesc('problem', 'Test Problem 1', data='<problem>problem 1 dummy body</problem>'),
XBlockFixtureDesc('html', 'html 1', data="<html>html 1 dummy body</html>"),
XBlockFixtureDesc('problem', 'Test Problem 2', data="<problem>problem 2 dummy body</problem>"),
XBlockFixtureDesc('html', 'html 2', data="<html>html 2 dummy body</html>"),
),
XBlockFixtureDesc('sequential', 'Test Subsection 1,2').add_children(
XBlockFixtureDesc('problem', 'Test Problem 3', data='<problem>problem 3 dummy body</problem>'),
),
XBlockFixtureDesc(
'sequential', 'Test HIDDEN Subsection', metadata={'visible_to_staff_only': True}
).add_children(
XBlockFixtureDesc('problem', 'Test HIDDEN Problem', data='<problem>hidden problem</problem>'),
),
)
).install()
self.course_keys[key] = course_key
self.course_fixtures[key] = course_fixture
# Create the test user, register them for the course, and authenticate
AutoAuthPage(
self.browser,
username=self.username,
email=self.email,
course_id=course_key,
enrollment_mode=value['enrollment_mode']
).visit()
# Navigate the authenticated, enrolled user to the dashboard page and get testing!
self.dashboard_page.visit()
class LmsDashboardA11yTest(BaseLmsDashboardTestMultiple):
"""
Class to test lms student dashboard accessibility.
"""
a11y = True
def test_dashboard_course_listings_a11y(self):
"""
Test the accessibility of the course listings
"""
self.dashboard_page.a11y_audit.config.set_rules({
"ignore": [
'aria-valid-attr', # TODO: LEARNER-6611 & LEARNER-6865
'button-name', # TODO: AC-935
'landmark-no-duplicate-banner', # TODO: AC-934
'landmark-complementary-is-top-level', # TODO: AC-939
'region' # TODO: AC-932
]
})
course_listings = self.dashboard_page.get_courses()
self.assertEqual(len(course_listings), 3)
self.dashboard_page.a11y_audit.check_for_accessibility_errors()
| msegado/edx-platform | common/test/acceptance/tests/lms/test_lms_dashboard.py | Python | agpl-3.0 | 5,727 |
# -*- coding: UTF-8 -*-
# Authors: Thomas Hartmann <thomas.hartmann@th-ht.de>
# Dirk Gütlin <dirk.guetlin@stud.sbg.ac.at>
#
# License: BSD-3-Clause
| bloyl/mne-python | mne/io/fieldtrip/tests/__init__.py | Python | bsd-3-clause | 158 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-08-08 00:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0004_auto_20160807_2046'),
]
operations = [
migrations.AlterField(
model_name='joblisting',
name='area_of_focus',
field=models.CharField(blank=True, default=b'', max_length=500),
),
migrations.AlterField(
model_name='joblisting',
name='employment_type',
field=models.CharField(blank=True, default=b'', max_length=250),
),
migrations.AlterField(
model_name='joblisting',
name='job_function',
field=models.CharField(blank=True, default=b'', max_length=500),
),
]
| MarconiMediaGroup/JobTrak | web/code/mmg/jobtrak/core/migrations/0005_auto_20160807_2047.py | Python | apache-2.0 | 865 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
import multiprocessing
import os
import platform
logger = logging.getLogger(__name__)
_ARCH_TRANSLATIONS = {
'armv7l': {
'kernel': 'arm',
'deb': 'armhf',
'cross-compiler-prefix': 'arm-linux-gnueabihf-',
'cross-build-packages': ['gcc-arm-linux-gnueabihf'],
'triplet': 'arm-linux-gnueabihf',
},
'aarch64': {
'kernel': 'arm64',
'deb': 'arm64',
'cross-compiler-prefix': 'aarch64-linux-gnu-',
'cross-build-packages': ['gcc-aarch64-linux-gnu'],
'triplet': 'aarch64-linux-gnu',
},
'i686': {
'kernel': 'x86',
'deb': 'i386',
'triplet': 'i386-linux-gnu',
},
'ppc64le': {
'kernel': 'powerpc',
'deb': 'ppc64el',
'cross-compiler-prefix': 'powerpc64le-linux-gnu-',
'cross-build-packages': ['gcc-powerpc64le-linux-gnu'],
'triplet': 'powerpc64le-linux-gnu',
},
'ppc': {
'kernel': 'powerpc',
'deb': 'powerpc',
'cross-compiler-prefix': 'powerpc-linux-gnu-',
'cross-build-packages': ['gcc-powerpc-linux-gnu'],
'triplet': 'powerpc-linux-gnu',
},
'x86_64': {
'kernel': 'x86',
'deb': 'amd64',
'triplet': 'x86_64-linux-gnu',
},
's390x': {
'kernel': 's390x',
'deb': 's390x',
'cross-compiler-prefix': 's390x-linux-gnu-',
'cross-build-packages': ['gcc-s390x-linux-gnu'],
'triplet': 's390x-linux-gnu',
}
}
class ProjectOptions:
@property
def use_geoip(self):
return self.__use_geoip
@property
def parallel_builds(self):
return self.__parallel_builds
@property
def parallel_build_count(self):
build_count = 1
if self.__parallel_builds:
try:
build_count = multiprocessing.cpu_count()
except NotImplementedError:
logger.warning(
'Unable to determine CPU count; disabling parallel builds')
return build_count
@property
def is_cross_compiling(self):
return self.__target_machine != self.__host_machine
@property
def cross_compiler_prefix(self):
try:
return self.__machine_info['cross-compiler-prefix']
except KeyError:
raise EnvironmentError(
'Cross compilation not support for target arch {!}'.format(
self.__machine_target))
@property
def additional_build_packages(self):
packages = []
if self.is_cross_compiling:
packages.extend(self.__machine_info.get(
'cross-build-packages', []))
return packages
@property
def arch_triplet(self):
return self.__machine_info['triplet']
@property
def deb_arch(self):
return self.__machine_info['deb']
@property
def kernel_arch(self):
return self.__machine_info['kernel']
@property
def local_plugins_dir(self):
return os.path.join(self.parts_dir, 'plugins')
@property
def parts_dir(self):
return os.path.join(self.__project_dir, 'parts')
@property
def stage_dir(self):
return os.path.join(self.__project_dir, 'stage')
@property
def snap_dir(self):
return os.path.join(self.__project_dir, 'prime')
@property
def debug(self):
return self.__debug
def __init__(self, use_geoip=False, parallel_builds=True,
target_deb_arch=None, debug=False):
# TODO: allow setting a different project dir and check for
# snapcraft.yaml
self.__project_dir = os.getcwd()
self.__use_geoip = use_geoip
self.__parallel_builds = parallel_builds
self._set_machine(target_deb_arch)
self.__debug = debug
def _set_machine(self, target_deb_arch):
self.__host_machine = platform.machine()
if not target_deb_arch:
self.__target_machine = self.__host_machine
else:
self.__target_machine = _find_machine(target_deb_arch)
logger.info('Setting target machine to {!r}'.format(
target_deb_arch))
self.__machine_info = _ARCH_TRANSLATIONS[self.__target_machine]
def _find_machine(deb_arch):
for machine in _ARCH_TRANSLATIONS:
if _ARCH_TRANSLATIONS[machine].get('deb', '') == deb_arch:
return machine
raise EnvironmentError(
'Cannot set machine from deb_arch {!r}'.format(deb_arch))
| stgraber/snapcraft | snapcraft/_options.py | Python | gpl-3.0 | 5,191 |
# -*- coding: utf-8 -*-
#
# Copyright 2015-2019 Gabriel Acosta <acostadariogabriel@gmail.com>
#
# This file is part of Pireal.
#
# Pireal 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
# any later version.
#
# Pireal is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Pireal; If not, see <http://www.gnu.org/licenses/>.
"""Run Pireal user interface"""
import sys
import os
import logging
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QIcon, QFont, QFontDatabase
from PyQt5.QtCore import QTranslator
from PyQt5.QtCore import QLocale
from PyQt5.QtCore import QLibraryInfo
from pireal.gui.theme import apply_theme
from pireal.settings import SETTINGS
logger = logging.getLogger("main")
def start_pireal(args):
# OS
# if settings.IS_LINUX:
# system, os_name = platform.uname()[:2]
# else:
# system = platform.uname()[0]
# os_name = platform.uname()[2]
# # Python version
# python_version = platform.python_version()
# print(f'Running Pireal {__version__}...\n'
# f'Python {python_version} on {system}-{os_name}, Qt {QT_VERSION_STR}')
# logger.info('Running Pireal %s with Python %s on %r',
# __version__, sys.version_info, sys.platform)
app = QApplication(sys.argv)
app.setApplicationName("Pireal")
app.setApplicationDisplayName("Pireal")
app.setWindowIcon(QIcon(":img/icon"))
SETTINGS.load()
app.setStyle("fusion")
apply_theme(app)
# Add Font Awesome
family = QFontDatabase.applicationFontFamilies(
QFontDatabase.addApplicationFont(":font/awesome")
)[0]
font = QFont(family)
font.setStyleName("Solid")
app.setFont(font)
# Install translators
# Qt translations
system_locale_name = QLocale.system().name()
qt_languages_path = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
qt_translator = QTranslator()
translator_loaded = qt_translator.load(
os.path.join(qt_languages_path, f"qt_{SETTINGS.language}.qm")
)
if not translator_loaded:
qt_translator.load(
os.path.join(
qt_languages_path, "qt_{}.qml".format(system_locale_name.split("_")[0])
)
)
app.installTranslator(qt_translator)
# App translator
translator = QTranslator()
if translator.load(f":lang/{SETTINGS.language}"):
app.installTranslator(translator)
# Load services
from pireal.gui import central_widget # noqa
from pireal.gui.main_window import Pireal
check_updates = not args.no_check_updates
pireal_gui = Pireal(check_updates)
pireal_gui.show()
sys.exit(app.exec_())
| centaurialpha/pireal | src/pireal/main.py | Python | gpl-3.0 | 3,061 |
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Saverio Giallorenzo
# Copyright (c) 2018 Saverio Giallorenzo
#
# License: MIT
#
from SublimeLinter.lint import Linter, util # or NodeLinter, PythonLinter, ComposerLinter, RubyLinter
class Lacheck(Linter):
cmd = 'lacheck ${file}'
error_stream = util.STREAM_BOTH
regex = (
r'.+, line (?P<line>\d+): (?:(possible unwanted space at "{")|(?P<message>.+))'
)
defaults = {
'selector': 'text.tex.latex - meta.block.parameters.knitr - source.r.embedded.knitr',
}
multiline = True
line_col_base = (1, 1) | thesave/SublimeLinter-contrib-lacheck | linter.py | Python | mit | 650 |
import re
def snake_to_camel(snake, upper_first=False):
# title-cased words
words = [word.title() for word in snake.split('_')]
if words and not upper_first:
words[0] = words[0].lower()
return ''.join(words)
def camel_to_snake(camel):
# first upper-cased camel
camel = camel[0].upper() + camel[1:]
return '_'.join(re.findall(r'[A-Z][^A-Z]*', camel)).lower()
| jfcherng/sublime-TypeShort | functions.py | Python | mit | 401 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Chris Hoffman <christopher.hoffman@gmail.com>
#
# 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 Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
DOCUMENTATION = '''
---
module: npm
short_description: Manage node.js packages with npm
description:
- Manage node.js packages with Node Package Manager (npm)
version_added: 1.2
author: "Chris Hoffman (@chrishoffman)"
options:
name:
description:
- The name of a node.js library to install
required: false
path:
description:
- The base path where to install the node.js libraries
required: false
version:
description:
- The version to be installed
required: false
global:
description:
- Install the node.js library globally
required: false
default: no
choices: [ "yes", "no" ]
executable:
description:
- The executable location for npm.
- This is useful if you are using a version manager, such as nvm
required: false
ignore_scripts:
description:
- Use the --ignore-scripts flag when installing.
required: false
choices: [ "yes", "no" ]
default: no
version_added: "1.8"
production:
description:
- Install dependencies in production mode, excluding devDependencies
required: false
choices: [ "yes", "no" ]
default: no
registry:
description:
- The registry to install modules from.
required: false
version_added: "1.6"
state:
description:
- The state of the node.js library
required: false
default: present
choices: [ "present", "absent", "latest" ]
'''
EXAMPLES = '''
description: Install "coffee-script" node.js package.
- npm: name=coffee-script path=/app/location
description: Install "coffee-script" node.js package on version 1.6.1.
- npm: name=coffee-script version=1.6.1 path=/app/location
description: Install "coffee-script" node.js package globally.
- npm: name=coffee-script global=yes
description: Remove the globally package "coffee-script".
- npm: name=coffee-script global=yes state=absent
description: Install "coffee-script" node.js package from custom registry.
- npm: name=coffee-script registry=http://registry.mysite.com
description: Install packages based on package.json.
- npm: path=/app/location
description: Update packages based on package.json to their latest version.
- npm: path=/app/location state=latest
description: Install packages based on package.json using the npm installed with nvm v0.10.1.
- npm: path=/app/location executable=/opt/nvm/v0.10.1/bin/npm state=present
'''
import os
try:
import json
except ImportError:
import simplejson as json
class Npm(object):
def __init__(self, module, **kwargs):
self.module = module
self.glbl = kwargs['glbl']
self.name = kwargs['name']
self.version = kwargs['version']
self.path = kwargs['path']
self.registry = kwargs['registry']
self.production = kwargs['production']
self.ignore_scripts = kwargs['ignore_scripts']
if kwargs['executable']:
self.executable = kwargs['executable'].split(' ')
else:
self.executable = [module.get_bin_path('npm', True)]
if kwargs['version']:
self.name_version = self.name + '@' + self.version
else:
self.name_version = self.name
def _exec(self, args, run_in_check_mode=False, check_rc=True):
if not self.module.check_mode or (self.module.check_mode and run_in_check_mode):
cmd = self.executable + args
if self.glbl:
cmd.append('--global')
if self.production:
cmd.append('--production')
if self.ignore_scripts:
cmd.append('--ignore-scripts')
if self.name:
cmd.append(self.name_version)
if self.registry:
cmd.append('--registry')
cmd.append(self.registry)
#If path is specified, cd into that path and run the command.
cwd = None
if self.path:
self.path = os.path.abspath(os.path.expanduser(self.path))
if not os.path.exists(self.path):
os.makedirs(self.path)
if not os.path.isdir(self.path):
self.module.fail_json(msg="path %s is not a directory" % self.path)
cwd = self.path
rc, out, err = self.module.run_command(cmd, check_rc=check_rc, cwd=cwd)
return out
return ''
def list(self):
cmd = ['list', '--json']
installed = list()
missing = list()
data = json.loads(self._exec(cmd, True, False))
if 'dependencies' in data:
for dep in data['dependencies']:
if 'missing' in data['dependencies'][dep] and data['dependencies'][dep]['missing']:
missing.append(dep)
elif 'invalid' in data['dependencies'][dep] and data['dependencies'][dep]['invalid']:
missing.append(dep)
else:
installed.append(dep)
if self.name and self.name not in installed:
missing.append(self.name)
#Named dependency not installed
else:
missing.append(self.name)
return installed, missing
def install(self):
return self._exec(['install'])
def update(self):
return self._exec(['update'])
def uninstall(self):
return self._exec(['uninstall'])
def list_outdated(self):
outdated = list()
data = self._exec(['outdated'], True, False)
for dep in data.splitlines():
if dep:
# node.js v0.10.22 changed the `npm outdated` module separator
# from "@" to " ". Split on both for backwards compatibility.
pkg, other = re.split('\s|@', dep, 1)
outdated.append(pkg)
return outdated
def main():
arg_spec = dict(
name=dict(default=None),
path=dict(default=None),
version=dict(default=None),
production=dict(default='no', type='bool'),
executable=dict(default=None),
registry=dict(default=None),
state=dict(default='present', choices=['present', 'absent', 'latest']),
ignore_scripts=dict(default=False, type='bool'),
)
arg_spec['global'] = dict(default='no', type='bool')
module = AnsibleModule(
argument_spec=arg_spec,
supports_check_mode=True
)
name = module.params['name']
path = module.params['path']
version = module.params['version']
glbl = module.params['global']
production = module.params['production']
executable = module.params['executable']
registry = module.params['registry']
state = module.params['state']
ignore_scripts = module.params['ignore_scripts']
if not path and not glbl:
module.fail_json(msg='path must be specified when not using global')
if state == 'absent' and not name:
module.fail_json(msg='uninstalling a package is only available for named packages')
npm = Npm(module, name=name, path=path, version=version, glbl=glbl, production=production, \
executable=executable, registry=registry, ignore_scripts=ignore_scripts)
changed = False
if state == 'present':
installed, missing = npm.list()
if len(missing):
changed = True
npm.install()
elif state == 'latest':
installed, missing = npm.list()
outdated = npm.list_outdated()
if len(missing) or len(outdated):
changed = True
npm.update()
else: #absent
installed, missing = npm.list()
if name in installed:
changed = True
npm.uninstall()
module.exit_json(changed=changed)
# import module snippets
from ansible.module_utils.basic import *
main()
| chepazzo/ansible-modules-extras | packaging/language/npm.py | Python | gpl-3.0 | 8,565 |
# -*- coding: utf-8 -*-
import pytest
from model.group import Group
from fixture.application import Application
@pytest.fixture
def app(request):
fixture = Application()
request.addfinalizer(fixture.destroy)
return fixture
def test_add_group(app):
app.session.login(username="admin", password="secret")
app.group.create(Group(name="fgfg", header="fgfg", footer="fgfgfgfg"))
app.session.logout()
| fleksso99/python_training | test/test_add_group.py | Python | apache-2.0 | 422 |
# -*- Mode:Python; test-case-name:flumotion.test.test_common_eventcalendar -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Public License version 2 as published by
# the Free Software Foundation.
# This file is distributed without any warranty; without even the implied
# warranty of merchantability or fitness for a particular purpose.
# See "LICENSE.GPL" in the source distribution for more information.
# Licensees having purchased or holding a valid Flumotion Advanced
# Streaming Server license and using this file together with a Flumotion
# Advanced Streaming Server may only use this file in accordance with the
# Flumotion Advanced Streaming Server Commercial License Agreement.
# See "LICENSE.Flumotion" in the source distribution for more information.
# Headers in this file shall remain intact.
import datetime
import time
HAS_ICALENDAR = False
try:
import icalendar
HAS_ICALENDAR = True
except ImportError:
pass
# for documentation on dateutil, see http://labix.org/python-dateutil
HAS_DATEUTIL = False
try:
from dateutil import rrule, tz
HAS_DATEUTIL = True
except ImportError:
pass
from flumotion.extern.log import log
"""
Implementation of a calendar that can inform about events beginning and
ending, as well as active event instances at a given time.
This uses iCalendar as defined in
http://www.ietf.org/rfc/rfc2445.txt
The users of this module should check if it has both HAS_ICALENDAR
and HAS_DATEUTIL properties and if any of them is False, they should
withhold from further using the module.
"""
def _toDateTime(d):
"""
If d is a L{datetime.date}, convert it to L{datetime.datetime}.
@type d: anything
@rtype: L{datetime.datetime} or anything
@returns: The equivalent datetime.datetime if d is a datetime.date;
d if not
"""
if isinstance(d, datetime.date) and not isinstance(d, datetime.datetime):
return datetime.datetime(d.year, d.month, d.day, tzinfo=UTC)
return d
class LocalTimezone(datetime.tzinfo):
"""A tzinfo class representing the system's idea of the local timezone"""
STDOFFSET = datetime.timedelta(seconds=-time.timezone)
if time.daylight:
DSTOFFSET = datetime.timedelta(seconds=-time.altzone)
else:
DSTOFFSET = STDOFFSET
DSTDIFF = DSTOFFSET - STDOFFSET
ZERO = datetime.timedelta(0)
def utcoffset(self, dt):
if self._isdst(dt):
return self.DSTOFFSET
else:
return self.STDOFFSET
def dst(self, dt):
if self._isdst(dt):
return self.DSTDIFF
else:
return self.ZERO
def tzname(self, dt):
return time.tzname[self._isdst(dt)]
def _isdst(self, dt):
tt = (dt.year, dt.month, dt.day,
dt.hour, dt.minute, dt.second,
dt.weekday(), 0, -1)
return time.localtime(time.mktime(tt)).tm_isdst > 0
LOCAL = LocalTimezone()
# A UTC class; see datetime.tzinfo documentation
class UTCTimezone(datetime.tzinfo):
"""A tzinfo class representing UTC"""
ZERO = datetime.timedelta(0)
def utcoffset(self, dt):
return self.ZERO
def tzname(self, dt):
return "UTC"
def dst(self, dt):
return self.ZERO
UTC = UTCTimezone()
class Point(log.Loggable):
"""
I represent a start or an end point linked to an event instance
of an event.
@type eventInstance: L{EventInstance}
@type which: str
@type dt: L{datetime.datetime}
"""
def __init__(self, eventInstance, which, dt):
"""
@param eventInstance: An instance of an event.
@type eventInstance: L{EventInstance}
@param which: 'start' or 'end'
@type which: str
@param dt: Timestamp of this point. It will
be used when comparing Points.
@type dt: L{datetime.datetime}
"""
self.which = which
self.dt = dt
self.eventInstance = eventInstance
def __repr__(self):
return "Point '%s' at %r for %r" % (
self.which, self.dt, self.eventInstance)
def __cmp__(self, other):
# compare based on dt, then end before start
# relies on alphabetic order of end before start
return cmp(self.dt, other.dt) \
or cmp(self.which, other.which)
class EventInstance(log.Loggable):
"""
I represent one event instance of an event.
@type event: L{Event}
@type start: L{datetime.datetime}
@type end: L{datetime.datetime}
"""
def __init__(self, event, start, end):
"""
@type event: L{Event}
@type start: L{datetime.datetime}
@type end: L{datetime.datetime}
"""
self.event = event
self.start = start
self.end = end
def getPoints(self):
"""
Get a list of start and end points.
@rtype: list of L{Point}
"""
ret = []
ret.append(Point(self, 'start', self.start))
ret.append(Point(self, 'end', self.end))
return ret
def __eq__(self, other):
return self.start == other.start and self.end == other.end and \
self.event == other.event
def __ne__(self, other):
return not self.__eq__(other)
class Event(log.Loggable):
"""
I represent a VEVENT entry in a calendar for our purposes.
I can have recurrence.
I can be scheduled between a start time and an end time,
returning a list of start and end points.
I can have exception dates.
"""
def __init__(self, uid, start, end, content, rrules=None,
recurrenceid=None, exdates=None):
"""
@param uid: identifier of the event
@type uid: str
@param start: start time of the event
@type start: L{datetime.datetime}
@param end: end time of the event
@type end: L{datetime.datetime}
@param content: label to describe the content
@type content: unicode
@param rrules: a list of RRULE string
@type rrules: list of str
@param recurrenceid: a RECURRENCE-ID, used with
recurrence events
@type recurrenceid: L{datetime.datetime}
@param exdates: list of exceptions to the recurrence rule
@type exdates: list of L{datetime.datetime} or None
"""
self.start = self._ensureTimeZone(start)
self.end = self._ensureTimeZone(end)
self.content = content
self.uid = uid
self.rrules = rrules
if rrules and len(rrules) > 1:
raise NotImplementedError(
"Events with multiple RRULE are not yet supported")
self.recurrenceid = recurrenceid
if exdates:
self.exdates = []
for exdate in exdates:
exdate = self._ensureTimeZone(exdate)
self.exdates.append(exdate)
else:
self.exdates = None
def _ensureTimeZone(self, dateTime, tz=UTC):
# add timezone information if it is not specified for some reason
if dateTime.tzinfo:
return dateTime
return datetime.datetime(dateTime.year, dateTime.month, dateTime.day,
dateTime.hour, dateTime.minute, dateTime.second,
dateTime.microsecond, tz)
def __repr__(self):
return "<Event %r >" % (self.toTuple(), )
def toTuple(self):
return (self.uid, self.start, self.end, self.content, self.rrules,
self.exdates)
# FIXME: these are only here so the rrdmon stuff can use Event instances
# in an avltree
def __lt__(self, other):
return self.toTuple() < other.toTuple()
def __gt__(self, other):
return self.toTuple() > other.toTuple()
# FIXME: but these should be kept, so that events with different id
# but same properties are the same
def __eq__(self, other):
return self.toTuple() == other.toTuple()
def __ne__(self, other):
return not self.__eq__(other)
class EventSet(log.Loggable):
"""
I represent a set of VEVENT entries in a calendar sharing the same uid.
I can have recurrence.
I can be scheduled between a start time and an end time,
returning a list of start and end points in UTC.
I can have exception dates.
"""
def __init__(self, uid):
"""
@param uid: the uid shared among the events on this set
@type uid: str
"""
self.uid = uid
self._events = []
def __repr__(self):
return "<EventSet for uid %r >" % (
self.uid)
def addEvent(self, event):
"""
Add an event to the set. The event must have the same uid as the set.
@param event: the event to add.
@type event: L{Event}
"""
assert self.uid == event.uid, \
"my uid %s does not match Event uid %s" % (self.uid, event.uid)
assert event not in self._events, "event %r already in set %r" % (
event, self._events)
self._events.append(event)
def removeEvent(self, event):
"""
Remove an event from the set.
@param event: the event to add.
@type event: L{Event}
"""
assert self.uid == event.uid, \
"my uid %s does not match Event uid %s" % (self.uid, event.uid)
self._events.remove(event)
def getPoints(self, start=None, delta=None, clip=True):
"""
Get an ordered list of start and end points from the given start
point, with the given delta, in this set of Events.
start defaults to now.
delta defaults to 0, effectively returning all points at this time.
the returned list includes the extremes (start and start + delta)
@param start: the start time
@type start: L{datetime.datetime}
@param delta: the delta
@type delta: L{datetime.timedelta}
@param clip: whether to clip all event instances to the given
start and end
"""
if start is None:
start = datetime.datetime.now(UTC)
if delta is None:
delta = datetime.timedelta(seconds=0)
points = []
eventInstances = self._getEventInstances(start, start + delta, clip)
for i in eventInstances:
for p in i.getPoints():
if p.dt >= start and p.dt <= start + delta:
points.append(p)
points.sort()
return points
def _getRecurringEvent(self):
recurring = None
# get the event in the event set that is recurring, if any
for v in self._events:
if v.rrules:
assert not recurring, \
"Cannot have two RRULE VEVENTs with UID %s" % self.uid
recurring = v
else:
if len(self._events) > 1:
assert v.recurrenceid, \
"With multiple VEVENTs with UID %s, " \
"each VEVENT should either have a " \
"reccurrence rule or have a recurrence id" % self.uid
return recurring
def _getEventInstances(self, start, end, clip):
# get all instances whose start and/or end fall between the given
# datetimes
# clips the event to the given start and end if asked for
# FIXME: decide if clip is inclusive or exclusive; maybe compare
# to dateutil's solution
eventInstances = []
recurring = self._getRecurringEvent()
# find all instances between the two given times
if recurring:
eventInstances = self._getEventInstancesRecur(
recurring, start, end)
# an event that has a recurrence id overrides the instance of the
# recurrence with a start time matching the recurrence id, so
# throw it out
for event in self._events:
# skip the main event
if event is recurring:
continue
if event.recurrenceid:
# Remove recurrent instance(s) that start at this recurrenceid
for i in eventInstances[:]:
if i.start == event.recurrenceid:
eventInstances.remove(i)
break
i = self._getEventInstanceSingle(event, start, end)
if i:
eventInstances.append(i)
if clip:
# fix all incidences that lie partly outside of the range
# to be in the range
for i in eventInstances[:]:
if i.start < start:
i.start = start
if start >= i.end:
eventInstances.remove(i)
if i.end > end:
i.end = end
return eventInstances
def _getEventInstanceSingle(self, event, start, end):
# is this event within the range asked for ?
if start > event.end:
return None
if end < event.start:
return None
return EventInstance(event, event.start, event.end)
def _getEventInstancesRecur(self, event, start, end):
# get all event instances for this recurring event that start before
# the given end time and end after the given start time.
# The UNTIL value applies to the start of a recurring event,
# not to the end. So if you would calculate based on the end for the
# recurrence rule, and there is a recurring instance that starts before
# UNTIL but ends after UNTIL, it would not be taken into account.
ret = []
# don't calculate endPoint based on end recurrence rule, because
# if the next one after a start point is past UNTIL then the rrule
# returns None
delta = event.end - event.start
# FIXME: support multiple RRULE; see 4.8.5.4 Recurrence Rule
r = None
if event.rrules:
r = event.rrules[0]
startRecurRule = rrule.rrulestr(r, dtstart=event.start)
for startTime in startRecurRule:
# ignore everything stopping before our start time
if startTime + delta < start:
continue
# stop looping if it's past the requested end time
if startTime >= end:
break
# skip if it's on our list of exceptions
if event.exdates:
if startTime in event.exdates:
self.debug("startTime %r is listed as EXDATE, skipping",
startTime)
continue
endTime = startTime + delta
i = EventInstance(event, startTime, endTime)
ret.append(i)
return ret
def getActiveEventInstances(self, dt=None):
"""
Get all event instances active at the given dt.
@type dt: L{datetime.datetime}
@rtype: list of L{EventInstance}
"""
if not dt:
dt = datetime.datetime.now(tz=UTC)
result = []
# handle recurrence events first
recurring = self._getRecurringEvent()
if recurring:
# FIXME: support multiple RRULE; see 4.8.5.4 Recurrence Rule
startRecurRule = rrule.rrulestr(recurring.rrules[0],
dtstart=recurring.start)
dtstart = startRecurRule.before(dt)
if dtstart:
skip = False
# ignore if we have another event with this recurrence-id
for event in self._events:
if event.recurrenceid:
if event.recurrenceid == dtstart:
self.log(
'event %r, recurrenceid %r matches dtstart %r',
event, event.recurrenceid, dtstart)
skip = True
# add if it's not on our list of exceptions
if recurring.exdates and dtstart in recurring.exdates:
self.log('recurring event %r has exdate for %r',
recurring, dtstart)
skip = True
if not skip:
delta = recurring.end - recurring.start
dtend = dtstart + delta
if dtend >= dt:
# starts before our dt, and ends after, so add
result.append(EventInstance(recurring, dtstart, dtend))
# handle all other events
for event in self._events:
if event is recurring:
continue
if event.start < dt < event.end:
result.append(EventInstance(event, event.start, event.end))
self.log('events active at %s: %r', str(dt), result)
return result
def getEvents(self):
"""
Return the list of events.
@rtype: list of L{Event}
"""
return self._events
class Calendar(log.Loggable):
"""
I represent a parsed iCalendar resource.
I have a list of VEVENT sets from which I can be asked to schedule
points marking the start or end of event instances.
"""
logCategory = 'calendar'
def __init__(self):
self._eventSets = {} # uid -> EventSet
def addEvent(self, event):
"""
Add a parsed VEVENT definition.
@type event: L{Event}
"""
uid = event.uid
self.log("adding event %s with content %r", uid, event.content)
if uid not in self._eventSets:
self._eventSets[uid] = EventSet(uid)
self._eventSets[uid].addEvent(event)
def getPoints(self, start=None, delta=None):
"""
Get all points from the given start time within the given delta.
End Points will be ordered before Start Points with the same time.
All points have a dt in the timezone as specified in the calendar.
start defaults to now.
delta defaults to 0, effectively returning all points at this time.
@type start: L{datetime.datetime}
@type delta: L{datetime.timedelta}
@rtype: list of L{Point}
"""
result = []
for eventSet in self._eventSets.values():
points = eventSet.getPoints(start, delta=delta, clip=False)
result.extend(points)
result.sort()
return result
def getActiveEventInstances(self, when=None):
"""
Get a list of active event instances at the given time.
@param when: the time to check; defaults to right now
@type when: L{datetime.datetime}
@rtype: list of L{EventInstance}
"""
result = []
if not when:
when = datetime.datetime.now(UTC)
for eventSet in self._eventSets.values():
result.extend(eventSet.getActiveEventInstances(when))
self.debug('%d active event instances at %s', len(result), str(when))
return result
def vDDDToDatetime(v):
"""
Convert a vDDDType to a datetime, respecting timezones.
@param v: the time to convert
@type v: L{icalendar.prop.vDDDTypes}
"""
dt = _toDateTime(v.dt)
if dt.tzinfo is None:
# We might have a "floating" DATE-TIME value here, in
# which case we will not have a TZID parameter; see
# 4.3.5, FORM #3
# Using None as the parameter for tz.gettz will create a
# tzinfo object representing local time, which is the
# Right Thing
tzinfo = tz.gettz(v.params.get('TZID', None))
dt = datetime.datetime(dt.year, dt.month, dt.day,
dt.hour, dt.minute, dt.second,
dt.microsecond, tzinfo)
return dt
def fromICalendar(iCalendar):
"""
Parse an icalendar Calendar object into our Calendar object.
@param iCalendar: The calendar to parse
@type iCalendar: L{icalendar.Calendar}
@rtype: L{Calendar}
"""
calendar = Calendar()
for event in iCalendar.walk('vevent'):
# extract to function ?
# DTSTART is REQUIRED in VEVENT; see 4.8.2.4
start = vDDDToDatetime(event.get('dtstart'))
# DTEND is optional; see 4.8.2.3
end = vDDDToDatetime(event.get('dtend', None))
# FIXME: this implementation does not yet handle DURATION, which
# is an alternative to DTEND
# an event without DURATION or DTEND is defined to not consume any
# time; see 6; so we skip it
if not end:
continue
if end == start:
continue
assert end >= start, "end %r should not be before start %r" % (
end, start)
summary = event.decoded('SUMMARY', None)
uid = event['UID']
# When there is only one rrule, we don't get a list, but the
# single rrule Bad API
recur = event.get('RRULE', [])
if not isinstance(recur, list):
recur = [recur, ]
recur = [r.ical() for r in recur]
recurrenceid = event.get('RECURRENCE-ID', None)
if recurrenceid:
recurrenceid = vDDDToDatetime(recurrenceid)
exdates = event.get('EXDATE', [])
# When there is only one exdate, we don't get a list, but the
# single exdate. Bad API
if not isinstance(exdates, list):
exdates = [exdates, ]
# this is a list of icalendar.propvDDDTypes on which we can call
# .dt() or .ical()
exdates = [vDDDToDatetime(i) for i in exdates]
if event.get('RDATE'):
raise NotImplementedError("We don't handle RDATE yet")
if event.get('EXRULE'):
raise NotImplementedError("We don't handle EXRULE yet")
#if not start:
# raise AssertionError, "event %r does not have start" % event
#if not end:
# raise AssertionError, "event %r does not have end" % event
e = Event(uid, start, end, summary, recur, recurrenceid, exdates)
calendar.addEvent(e)
return calendar
def fromFile(file):
"""
Create a new calendar from an open file object.
@type file: file object
@rtype: L{Calendar}
"""
data = file.read()
# FIXME Google calendar recently started introducing things like
# CREATED:0000XXXXTXXXXXXZ, which means: created in year 0000
# this breaks the icalendar parsing code. Guard against that.
data = data.replace('\nCREATED:0000', '\nCREATED:2008')
cal = icalendar.Calendar.from_string(data)
return fromICalendar(cal)
| flyapen/UgFlu | flumotion/common/eventcalendar.py | Python | gpl-2.0 | 23,019 |
# 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):
from django.contrib.auth.models import User
user, created = User.objects.get_or_create(username='kumbu')
# Adding field 'CD4Document.user'
db.add_column('cd4_cd4document', 'user', self.gf('django.db.models.fields.related.ForeignKey')(default=user.pk, to=orm['auth.User']), keep_default=False)
# Deleting field 'CD4Document.user'
db.delete_column('cd4_cd4document', 'group_id')
def backwards(self, orm):
# Deleting field 'CD4Document.user'
db.delete_column('cd4_cd4document', 'user_id')
from django.contrib.auth.models import Group
group, created = Group.objects.get_or_create(name='Temba Lethu')
# Adding field 'CD4Document.user'
db.add_column('cd4_cd4document', 'group', self.gf('django.db.models.fields.related.ForeignKey')(default=group.pk, to=orm['auth.Group']), keep_default=False)
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'cd4.cd4document': {
'Meta': {'object_name': 'CD4Document'},
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'original': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'cd4.cd4record': {
'Meta': {'object_name': 'CD4Record'},
'cd4count': ('django.db.models.fields.IntegerField', [], {}),
'cd4document': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'record_set'", 'to': "orm['cd4.CD4Document']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'lab_id_number': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'msisdn': ('django.db.models.fields.CharField', [], {'max_length': '11'}),
'sms': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['gateway.SendSMS']", 'null': 'True', 'blank': 'True'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'gateway.sendsms': {
'Meta': {'object_name': 'SendSMS'},
'delivery': ('django.db.models.fields.DateTimeField', [], {}),
'delivery_timestamp': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
'expiry': ('django.db.models.fields.DateTimeField', [], {}),
'group': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.Group']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'identifier': ('django.db.models.fields.CharField', [], {'max_length': '8'}),
'msisdn': ('django.db.models.fields.CharField', [], {'max_length': '12'}),
'priority': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
'receipt': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
'smstext': ('django.db.models.fields.TextField', [], {}),
'status': ('django.db.models.fields.CharField', [], {'default': "'v'", 'max_length': '1'})
}
}
complete_apps = ['cd4']
| praekelt/txtalert | txtalert/apps/cd4/migrations/0003_auto__add_field_cd4record_cd4document__chg_field_cd4record_msisdn__add.py | Python | gpl-3.0 | 6,651 |
#!/usr/bin/env python3
import re
class Sigma:
# definição do alfabeto da língua.
# TODO: Ler esse alfabeto a partir de um arquivo, a fim de tornar o script
# mais flexível.
v = r'[aeiouãõáéóíú]'
c = r'[bcçdfgjklLmnñpqrstvxwyz]'
n = r'[mn]'
L = r'(?P<sil>'
R = r')'
Z = r'(' + c[:-1] + r']|$)'
# Estes são os moldes silábicos da língua. É preciso traduzi-los em expressões
# regulares; assim, cada caractere é um marcador que será substituído pelas
# definições feitas acima. L e R representam, respectivamente '(' e ')', e Z
# representa uma consoante (ou fim de palavra) que não pode mais ser incluída
# no molde e, portanto, indica que a sílaba acabou.
moldes = ['LccvvcRZ', 'LccvvRZ', 'LcvvcRZ', 'LcvvRZ', 'LvvRZ',
'LccvncRZ', 'LccvcRZ', 'LccvRZ', 'LcvncRZ', 'LcvcRZ',
'LcvR', 'LvncRZ', 'LvcRZ', 'LvRZ']
model = []
def __init__(self):
# tradução dos moldes em expressões regulares.
for m in self.moldes:
regex = ''.join(map(lambda x: getattr(self, x), [x for x in m]))
self.model.append(re.compile(regex))
def syll(self, s):
'''
Input: string, contendo a palavra a ser silabificada.
Output: list, contendo as sílabas encontradas na palavra.
O script processa cada palavra sequencialmente, da esquerda para direita,
testando todas as expressões regulares em cada posição, a fim de encontrar
a mais inclusiva delas, que não desrespeite as restrições da língua.
'''
silabas = []
i = 0
while i < len(s):
sigma = ''
for molde in self.model:
m = molde.match(s[i:])
if m:
if len(m.group('sil')) > len(sigma):
sigma = m.group('sil')
if sigma:
silabas.append(sigma)
i += len(sigma)
else:
i += 1
return silabas
if __name__ == '__main__':
s = Sigma()
teste = ['casa', 'monstro', 'transporte', 'caixa', 'distração', 'recado',
'oLos', 'felicidade', 'expresões', 'encantada', 'encanamento']
for w in teste:
print('.'.join(s.syll(w)))
| shoeki/ling | silabas/silabas.py | Python | gpl-2.0 | 2,326 |
VERSION = 1
NAME = _("Poison")
DESCRIPTION = _("Poison your enemy, causing him to lose HP every turn.")
ABILITY_TYPE = ACTION
COST = 5
TARGET_TYPE = HOSTILE
RANGE = Diamond(1, 5, 16)
AOE = Single()
EFFECTS = [Status(Status.POISON, power=0.03, duration=5)]
| jemofthewest/GalaxyMage | data/core/abilities/poison.py | Python | gpl-2.0 | 265 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# gnetplus -- Python module for interfacing with PROMAG RFID card reader
# Copyright © 2013 Red Hat Inc.
#
# Authors:
#
# Chow Loong Jin <lchow@redhat.com>
# Harish Pillay <hpillay@redhat.com>
#
# Initial release: July 31, 2013
# Minor edits: July 31, 2013: giving an example of how to invoke it
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
"""
Module for interfacing with the PROMAG card reader using the GNetPlus®
Protocol.
Usage:
from gnetplus import Handle
handle = Handle("/dev/ttyUSB0")
print "S/N: " + hex(handle.get_sn())
"""
import collections
import serial
import struct
import sys
import time
class InvalidMessage(Exception):
pass
class Message(object):
"""
Base message class for representing a message
"""
SOH = 0x01
def __init__(self, address, function, data):
"""
@arg address 8-bit int containing device address (Use 0 unless you know
what you're doing)
@arg function 8-bit int containing the function of this message
@arg data String containing payload of this message
"""
self.address = address
self.function = function
self.data = data
def __str__(self):
"""
Converts Message to raw binary form suitable for transmission
"""
msgstr = struct.pack('BBB', self.address, self.function,
len(self.data)) + self.data
crc = self.gencrc(msgstr)
return chr(self.SOH) + msgstr + struct.pack('>H', crc)
def __repr__(self):
return ("{name}(address={address}, "
"function={function}, "
"data={data})").format(name=self.__class__.__name__,
address=hex(self.address),
function=hex(self.function),
data=repr(self.data))
def sendto(self, serial):
"""
Sends this message to `serial´
"""
serial.write(str(self))
@classmethod
def readfrom(cls, serial):
"""
Reads one message from `serial' and constructs a message from `cls'
@arg serial serial.Serial interface to read message from
@returns Constructed Message instance
"""
header = serial.read(4)
soh, address, function, length = struct.unpack('BBBB', header)
if soh != cls.SOH:
raise InvalidMessage("SOH does not match")
data = serial.read(length)
crc = serial.read(2)
msg = cls(address=address, function=function, data=data)
if str(msg)[-2:] != crc:
raise InvalidMessage("CRC does not match")
return msg
@staticmethod
def gencrc(msgstr):
"""
Generate CRC for the string `msgstr'
@arg msgstr string containing data to be checksummed
@returns 16-bit integer containing CRC checksum
"""
crc = 0xFFFF
for char in msgstr:
crc ^= ord(char)
for i in xrange(8):
if (crc & 1) == 1:
crc = (crc >> 1) ^ 0xA001
else:
crc >>= 1
return crc
class QueryMessage(Message):
"""
A query message to be sent from host machine to card reader device. Magical
constants taken from protocol documentation.
"""
POLLING = 0x00
GET_VERSION = 0x01
SET_SLAVE_ADDR = 0x02
LOGON = 0x03
LOGOFF = 0x04
SET_PASSWORD = 0x05
CLASSNAME = 0x06
SET_DATETIME = 0x07
GET_DATETIME = 0x08
GET_REGISTER = 0x09
SET_REGISTER = 0x0A
RECORD_COUNT = 0x0B
GET_FIRST_RECORD = 0x0C
GET_NEXT_RECORD = 0x0D
ERASE_ALL_RECORDS = 0x0E
ADD_RECORD = 0x0F
RECOVER_ALL_RECORDS = 0x10
DO = 0x11
DI = 0x12
ANALOG_INPUT = 0x13
THERMOMETER = 0x14
GET_NODE = 0x15
GET_SN = 0x16
SILENT_MODE = 0x17
RESERVE = 0x18
ENABLE_AUTO_MODE = 0x19
GET_TIME_ADJUST = 0x1A
ECHO = 0x18
SET_TIME_ADJUST = 0x1C
DEBUG = 0x1D
RESET = 0x1E
GO_TO_ISP = 0x1F
REQUEST = 0x20
ANTI_COLLISION = 0x21
SELECT_CARD = 0x22
AUTHENTICATE = 0x23
READ_BLOCK = 0x24
WRITE_BLOCk = 0x25
SET_VALUE = 0x26
READ_VALUE = 0x27
CREATE_VALUE_BLOCK = 0x28
ACCESS_CONDITION = 0x29
HALT = 0x2A
SAVE_KEY = 0x2B
GET_SECOND_SN = 0x2C
GET_ACCESS_CONDITION = 0x2D
AUTHENTICATE_KEY = 0x2E
REQUEST_ALL = 0x2F
SET_VALUEEX = 0x32
TRANSFER = 0x33
RESTORE = 0x34
GET_SECTOR = 0x3D
RF_POWER_ONOFF = 0x3E
AUTO_MODE = 0x3F
class GNetPlusError(Exception):
"""
Exception thrown when receiving a ResponseMessage with function=NAK
"""
pass
class ResponseMessage(Message):
"""
Message received from card reader
"""
ACK = 0x06
NAK = 0x15
EVN = 0x12
def to_error(self):
"""
Construct a GNetPlusError for NAK response.
@returns Constructed instance of GNetPlusError for this response
"""
if self.function != self.NAK:
return None
return GNetPlusError("Error: " + repr(self.data))
class Handle(object):
"""
Main class used for interfacing with the card reader.
"""
def __init__(self, port, baudrate=19200, deviceaddr=0):
"""
Initializes a Handle instance.
@arg port String containing name of serial port, e.g. /dev/ttyUSB0
@arg baudrate Baudrate for interfacing with the device. Don't change
this unless you know what you're doing.
@arg deviceaddr Integer containing the device address. Defaults to 0.
"""
self.baudrate = baudrate
self.port = port
self.serial = serial.Serial(port, baudrate=baudrate)
self.deviceaddr = deviceaddr
def sendmsg(self, function, data=''):
"""
Constructs and sends a QueryMessage to the device
@arg function @see Message.function
@arg data @see Message.data
"""
QueryMessage(self.deviceaddr, function, data).sendto(self.serial)
def readmsg(self, sink_events=False):
"""
Reads a message, optionally ignoring event (EVN) messages which are
device-driven.
@arg sink_events Boolean dictating whether or not events should be
ignored.
"""
while True:
response = ResponseMessage.readfrom(self.serial)
# skip over events. spec doesn't say what to do with them
if sink_events and response.function == ResponseMessage.EVN:
continue
break
if response.function == ResponseMessage.NAK:
raise response.to_error()
return response
def get_sn(self):
"""
Get serial number of the card currently scanned.
@returns 16-bit integer containing serial number of the scanned card.
"""
self.sendmsg(QueryMessage.REQUEST)
self.readmsg(sink_events=True)
self.sendmsg(QueryMessage.ANTI_COLLISION)
response = self.readmsg(sink_events=True)
return struct.unpack('>L', response.data)[0]
def get_version(self):
"""
Get product version string. May contain null bytes, so be careful when
using it.
@returns Product version string of the device connected to this handle.
"""
self.sendmsg(QueryMessage.GET_VERSION)
return self.readmsg().data
def set_auto_mode(self, enabled=True):
"""
Toggle auto mode, i.e. whether the device emits events when a card
comes close.
@arg enabled Whether to enable or disable auto mode.
"""
self.sendmsg(QueryMessage.AUTO_MODE, chr(enabled))
self.readmsg(sink_events=True)
def wait_for_card(self):
"""
Block until card is present at the device. Does not check if a card is
already present before entering the function.
"""
self.set_auto_mode()
while True:
response = self.readmsg()
if ((response.function == ResponseMessage.EVN and
response.data == 'I')):
return
if __name__ == '__main__':
try:
port = sys.argv[1]
except IndexError:
sys.stderr.write("Usage: {0} <serial port>, example /dev/ttyUSB0\n".format(sys.argv[0]))
handle = Handle(port)
while True:
handle.wait_for_card()
try:
print "Found card: {0}".format(hex(handle.get_sn()))
except GNetPlusError:
print "Tap card again."
| harishpillay/gnetplus | gnetplus.py | Python | lgpl-2.1 | 9,372 |
#!/usr/bin/env python
"""
Developer script to convert yaml periodic table to json format.
Created on Nov 15, 2011
"""
import json
import re
from itertools import product
import ruamel.yaml as yaml
from monty.serialization import dumpfn, loadfn
from pymatgen.core import Element
from pymatgen.core.periodic_table import get_el_sp
def test_yaml():
with open("periodic_table.yaml") as f:
data = yaml.load(f)
print(data)
def test_json():
with open("periodic_table.json") as f:
data = json.load(f)
print(data)
def parse_oxi_state():
with open("periodic_table.yaml") as f:
data = yaml.load(f)
f = open("oxidation_states.txt")
oxidata = f.read()
f.close()
oxidata = re.sub("[\n\r]", "", oxidata)
patt = re.compile("<tr>(.*?)</tr>", re.MULTILINE)
for m in patt.finditer(oxidata):
line = m.group(1)
line = re.sub("</td>", "", line)
line = re.sub("(<td>)+", "<td>", line)
line = re.sub("</*a[^>]*>", "", line)
el = None
oxistates = []
common_oxi = []
for tok in re.split("<td>", line.strip()):
m2 = re.match(r"<b>([A-Z][a-z]*)</b>", tok)
if m2:
el = m2.group(1)
else:
m3 = re.match(r"(<b>)*([\+\-]\d)(</b>)*", tok)
if m3:
oxistates.append(int(m3.group(2)))
if m3.group(1):
common_oxi.append(int(m3.group(2)))
if el in data:
del data[el]["Max oxidation state"]
del data[el]["Min oxidation state"]
del data[el]["Oxidation_states"]
del data[el]["Common_oxidation_states"]
data[el]["Oxidation states"] = oxistates
data[el]["Common oxidation states"] = common_oxi
else:
print(el)
with open("periodic_table2.yaml", "w") as f:
yaml.dump(data, f)
def parse_ionic_radii():
with open("periodic_table.yaml") as f:
data = yaml.load(f)
f = open("ionic_radii.csv")
radiidata = f.read()
f.close()
radiidata = radiidata.split("\r")
header = radiidata[0].split(",")
for i in range(1, len(radiidata)):
line = radiidata[i]
toks = line.strip().split(",")
suffix = ""
name = toks[1]
if len(name.split(" ")) > 1:
suffix = "_" + name.split(" ")[1]
el = toks[2]
ionic_radii = {}
for j in range(3, len(toks)):
m = re.match(r"^\s*([0-9\.]+)", toks[j])
if m:
ionic_radii[int(header[j])] = float(m.group(1))
if el in data:
data[el]["Ionic_radii" + suffix] = ionic_radii
if suffix == "_hs":
data[el]["Ionic_radii"] = ionic_radii
else:
print(el)
with open("periodic_table2.yaml", "w") as f:
yaml.dump(data, f)
def parse_radii():
with open("periodic_table.yaml") as f:
data = yaml.load(f)
f = open("radii.csv")
radiidata = f.read()
f.close()
radiidata = radiidata.split("\r")
for i in range(1, len(radiidata)):
line = radiidata[i]
toks = line.strip().split(",")
el = toks[1]
try:
atomic_radii = float(toks[3]) / 100
except Exception:
atomic_radii = toks[3]
try:
atomic_radii_calc = float(toks[4]) / 100
except Exception:
atomic_radii_calc = toks[4]
try:
vdw_radii = float(toks[5]) / 100
except Exception:
vdw_radii = toks[5]
if el in data:
data[el]["Atomic radius"] = atomic_radii
data[el]["Atomic radius calculated"] = atomic_radii_calc
data[el]["Van der waals radius"] = vdw_radii
else:
print(el)
with open("periodic_table2.yaml", "w") as f:
yaml.dump(data, f)
with open("periodic_table.json", "w") as f:
json.dump(data, f)
def update_ionic_radii():
with open("periodic_table.yaml") as f:
data = yaml.load(f)
for el, d in data.items():
if "Ionic_radii" in d:
d["Ionic radii"] = {k: v / 100 for k, v in d["Ionic_radii"].items()}
del d["Ionic_radii"]
if "Ionic_radii_hs" in d:
d["Ionic radii hs"] = {k: v / 100 for k, v in d["Ionic_radii_hs"].items()}
del d["Ionic_radii_hs"]
if "Ionic_radii_ls" in d:
d["Ionic radii ls"] = {k: v / 100 for k, v in d["Ionic_radii_ls"].items()}
del d["Ionic_radii_ls"]
with open("periodic_table2.yaml", "w") as f:
yaml.dump(data, f)
with open("periodic_table.json", "w") as f:
json.dump(data, f)
def parse_shannon_radii():
with open("periodic_table.yaml") as f:
data = yaml.load(f)
import collections
from openpyxl import load_workbook
wb = load_workbook("Shannon Radii.xlsx")
print(wb.get_sheet_names())
sheet = wb["Sheet1"]
i = 2
radii = collections.defaultdict(dict)
while sheet["E%d" % i].value:
if sheet["A%d" % i].value:
el = sheet["A%d" % i].value
if sheet["B%d" % i].value:
charge = int(sheet["B%d" % i].value)
radii[el][charge] = dict()
if sheet["C%d" % i].value:
cn = sheet["C%d" % i].value
if cn not in radii[el][charge]:
radii[el][charge][cn] = dict()
if sheet["D%d" % i].value is not None:
spin = sheet["D%d" % i].value
else:
spin = ""
# print("%s - %d - %s" % (el, charge, cn))
radii[el][charge][cn][spin] = {
"crystal_radius": float(sheet["E%d" % i].value),
"ionic_radius": float(sheet["F%d" % i].value),
}
i += 1
for el in radii.keys():
if el in data:
data[el]["Shannon radii"] = dict(radii[el])
with open("periodic_table.yaml", "w") as f:
yaml.safe_dump(data, f)
with open("periodic_table.json", "w") as f:
json.dump(data, f)
def gen_periodic_table():
with open("periodic_table.yaml") as f:
data = yaml.load(f)
with open("periodic_table.json", "w") as f:
json.dump(data, f)
def gen_iupac_ordering():
periodic_table = loadfn("periodic_table.json")
order = [
([18], range(6, 0, -1)), # noble gasses
([1], range(7, 1, -1)), # alkali metals
([2], range(7, 1, -1)), # alkali earth metals
(range(17, 2, -1), [9]), # actinides
(range(17, 2, -1), [8]), # lanthanides
([3], (5, 4)), # Y, Sc
([4], (6, 5, 4)), # Hf -> Ti
([5], (6, 5, 4)), # Ta -> V
([6], (6, 5, 4)), # W -> Cr
([7], (6, 5, 4)), # Re -> Mn
([8], (6, 5, 4)), # Os -> Fe
([9], (6, 5, 4)), # Ir -> Co
([10], (6, 5, 4)), # Pt -> Ni
([11], (6, 5, 4)), # Au -> Cu
([12], (6, 5, 4)), # Hg -> Zn
([13], range(6, 1, -1)), # Tl -> B
([14], range(6, 1, -1)), # Pb -> C
([15], range(6, 1, -1)), # Bi -> N
([1], [1]), # Hydrogen
([16], range(6, 1, -1)), # Po -> O
([17], range(6, 1, -1)),
] # At -> F
order = sum((list(product(x, y)) for x, y in order), [])
iupac_ordering_dict = dict(zip([Element.from_row_and_group(row, group) for group, row in order], range(len(order))))
# first clean periodic table of any IUPAC ordering
for el in periodic_table:
periodic_table[el].pop("IUPAC ordering", None)
# now add iupac ordering
for el in periodic_table:
if "IUPAC ordering" in periodic_table[el]:
# sanity check that we don't cover the same element twice
raise KeyError(f"IUPAC ordering already exists for {el}")
periodic_table[el]["IUPAC ordering"] = iupac_ordering_dict[get_el_sp(el)]
def add_electron_affinities():
"""
Update the periodic table data file with electron affinities.
"""
import requests
from bs4 import BeautifulSoup
req = requests.get("https://en.wikipedia.org/wiki/Electron_affinity_(data_page)")
soup = BeautifulSoup(req.text, "html.parser")
for t in soup.find_all("table"):
if "Hydrogen" in t.text:
break
data = []
for tr in t.find_all("tr"):
row = []
for td in tr.find_all("td"):
row.append(td.get_text().strip())
data.append(row)
data.pop(0)
ea = {int(r[0]): float(re.sub(r"[\s\(\)]", "", r[3].strip("()[]"))) for r in data}
assert set(ea.keys()).issuperset(range(1, 93)) # Ensure that we have data for up to U.
print(ea)
pt = loadfn("../pymatgen/core/periodic_table.json")
for k, v in pt.items():
v["Electron affinity"] = ea.get(Element(k).Z, None)
dumpfn(pt, "../pymatgen/core/periodic_table.json")
def add_ionization_energies():
"""
Update the periodic table data file with ground level and ionization energies from NIST.
"""
import collections
from bs4 import BeautifulSoup
with open("NIST Atomic Ionization Energies Output.html") as f:
soup = BeautifulSoup(f.read(), "html.parser")
for t in soup.find_all("table"):
if "Hydrogen" in t.text:
break
data = collections.defaultdict(list)
for tr in t.find_all("tr"):
row = [td.get_text().strip() for td in tr.find_all("td")]
if row:
Z = int(row[0])
val = re.sub(r"\s", "", row[8].strip("()[]"))
if val == "":
val = None
else:
val = float(val)
data[Z].append(val)
print(data)
print(data[51])
assert set(data.keys()).issuperset(range(1, 93)) # Ensure that we have data for up to U.
pt = loadfn("../pymatgen/core/periodic_table.json")
for k, v in pt.items():
del v["Ionization energy"]
v["Ionization energies"] = data.get(Element(k).Z, [])
dumpfn(pt, "../pymatgen/core/periodic_table.json")
if __name__ == "__main__":
# parse_shannon_radii()
# add_ionization_energies()
add_electron_affinities()
# gen_periodic_table()
| vorwerkc/pymatgen | dev_scripts/update_pt_data.py | Python | mit | 10,164 |
from time import time
start = time()
sum = 0
for i in range(1, 1001):
sum += i ** i
print(str(sum)[-10:])
end = time()
print(end - start)
| kayson-hansen/Project-Euler | Python/048_self_powers.py | Python | mit | 156 |
# -*- coding: utf-8 -*-
"""
WSGI config for studlan project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'studlan.settings.settings')
application = get_wsgi_application()
| CasualGaming/studlan | studlan/wsgi.py | Python | mit | 425 |
import unittest
import requests
class TranslationTests(unittest.TestCase):
def setUp(self):
self.url = 'http://127.0.0.1/api/translate'
def test_given_words(self):
"""Should pass for the basic test cases provided"""
test_words = ['pig', 'banana', 'trash', 'happy', 'duck', 'glove',
'eat', 'omelet', 'are']
expected_words = ['igpay', 'ananabay', 'ashtray', 'appyhay', 'uckday',
'oveglay', 'eatyay', 'omeletyay', 'areyay']
responses = [requests.post(self.url, x).text for x in test_words]
self.assertEqual(responses, expected_words,
'Should pass for the basic test cases provided')
def test_capitalization(self):
"""Should preserve capitalization in words"""
test_words = ['Capitalized', 'Words', 'Should', 'Work']
expected_words = ['Apitalizedcay', 'Ordsway', 'Ouldshay', 'Orkway']
responses = [requests.post(self.url, x).text for x in test_words]
self.assertEqual(responses, expected_words,
'Words should preserve their capitalization')
def test_sentences(self):
"""Should translate sentences with preserved punctuation"""
test_sentence = ('Long sentences should retain their capitalization, '
'as well as punctuation - hopefully!!')
expected_result = ('Onglay entencessay ouldshay etainray eirthay '
'apitalizationcay, asyay ellway asyay unctuationpay'
' - opefullyhay!!')
response = requests.post(self.url, test_sentence).text
self.assertEqual(response, expected_result,
'Should translate sentences accurately')
def test_edge_cases(self):
"""Should be able to handle words with no vowels"""
test_word = 'sky'
expected_result = 'skyay'
response = requests.post(self.url, test_word).text
self.assertEqual(response, expected_result,
'Should be able to translate words without vowels')
def test_error_cases(self):
"""Should return errors for invalid input"""
self.assertEqual(requests.post(self.url, '').status_code, 406,
'Should return HTTP/406 for empty strings')
def test_long_paragraphs(self):
"""Should translate long paragraphs with new lines intact"""
self.maxDiff = None
expected_result = ''
test_paragraph = ''
with open('tests/lorem_ipsum.txt') as input_paragraph:
test_paragraph = input_paragraph.read()
with open('tests/lorem_ipsum_translated.txt') as expected:
expected_result = expected.read()
response = requests.post(self.url, test_paragraph).text
self.assertEqual(response, expected_result,
'Should translate long paragraphs accurately')
if __name__ == '__main__':
unittest.main() | chrswt/vicarious-microservice | tests/translation.py | Python | mit | 2,992 |
from sqlalchemy import Table, Column, Integer, String
from metadata import metadata
__all__ = ["t_restaurant", "t_menu"]
t_restaurant = Table("t_restaurant", metadata,
Column("FId", Integer, primary_key = True),
Column("FName", String(128)),
Column("FType", Integer),
Column("FAddress", String(128)),
Column("FBlock1", Integer),
Column("FBlock2", Integer),
Column("FCoordinate", String(128)),
)
t_menu = Table("t_menu", metadata,
Column("FId", Integer, primary_key = True),
Column("FRestaurantId", Integer),
Column("FName", String(128)),
Column("FType", Integer),
Column("FPrice", Integer),
)
| peixinchen/TravisCITest | src/togo/models/t_restaurant.py | Python | mit | 644 |
from __future__ import print_function, unicode_literals
import pprint
from django.contrib.auth import authenticate
from django.shortcuts import resolve_url
from django.utils.html import escape
from django_functest import FuncBaseMixin
from wiki import models
from wiki.forms import validate_slug_numbers
from wiki.models import URLPath
from ..base import (ArticleWebTestUtils, DjangoClientTestBase,
RequireRootArticleMixin, SeleniumBase, WebTestBase)
class RootArticleViewTestsBase(FuncBaseMixin):
"""Tests for creating/viewing the root article."""
def test_root_article(self):
"""
Test redirecting to /create-root/,
creating the root article and a simple markup.
"""
self.get_url('wiki:root')
self.assertUrlsEqual(resolve_url('wiki:root_create'))
self.fill({
'#id_content': 'test heading h1\n====\n',
'#id_title': 'Wiki Test',
})
self.submit('input[name="save_changes"]')
self.assertUrlsEqual('/')
self.assertTextPresent('test heading h1')
article = URLPath.root().article
self.assertIn('test heading h1', article.current_revision.content)
class RootArticleViewTestsWebTest(RootArticleViewTestsBase, WebTestBase):
pass
class RootArticleViewTestsSelenium(RootArticleViewTestsBase, SeleniumBase):
pass
class ArticleViewViewTests(RequireRootArticleMixin, ArticleWebTestUtils, DjangoClientTestBase):
"""
Tests for article views, assuming a root article already created.
"""
def dump_db_status(self, message=''):
"""Debug printing of the complete important database content."""
print('*** db status *** {}'.format(message))
from wiki.models import Article, ArticleRevision
for klass in (Article, ArticleRevision, URLPath):
print('* {} *'.format(klass.__name__))
pprint.pprint(list(klass.objects.values()), width=240)
def test_redirects_to_create_if_the_slug_is_unknown(self):
response = self.get_by_path('unknown/')
self.assertRedirects(
response,
resolve_url('wiki:create', path='') + '?slug=unknown'
)
def test_redirects_to_create_with_lowercased_slug(self):
response = self.get_by_path('Unknown_Linked_Page/')
self.assertRedirects(
response,
resolve_url('wiki:create', path='') + '?slug=unknown_linked_page'
)
def test_article_list_update(self):
"""
Test automatic adding and removing the new article to/from article_list.
"""
root_data = {
'content': '[article_list depth:2]',
'current_revision': str(URLPath.root().article.current_revision.id),
'preview': '1',
'title': 'Root Article'
}
response = self.client.post(resolve_url('wiki:edit', path=''), root_data)
self.assertRedirects(response, resolve_url('wiki:root'))
# verify the new article is added to article_list
response = self.client.post(
resolve_url('wiki:create', path=''),
{'title': 'Sub Article 1', 'slug': 'SubArticle1'}
)
self.assertRedirects(
response,
resolve_url('wiki:get', path='subarticle1/')
)
self.assertContains(self.get_by_path(''), 'Sub Article 1')
self.assertContains(self.get_by_path(''), 'subarticle1/')
# verify the deleted article is removed from article_list
response = self.client.post(
resolve_url('wiki:delete', path='SubArticle1/'),
{'confirm': 'on',
'purge': 'on',
'revision': str(URLPath.objects.get(slug='subarticle1').article.current_revision.id),
}
)
message = getattr(self.client.cookies['messages'], 'value')
self.assertRedirects(
response,
resolve_url('wiki:get', path='')
)
self.assertIn(
'This article together with all '
'its contents are now completely gone',
message)
self.assertNotContains(self.get_by_path(''), 'Sub Article 1')
class CreateViewTest(RequireRootArticleMixin, ArticleWebTestUtils, DjangoClientTestBase):
def test_create_nested_article_in_article(self):
response = self.client.post(
resolve_url('wiki:create', path=''),
{'title': 'Level 1', 'slug': 'Level1', 'content': 'Content level 1'}
)
self.assertRedirects(
response,
resolve_url('wiki:get', path='level1/')
)
response = self.client.post(
resolve_url('wiki:create', path='Level1/'),
{'title': 'test', 'slug': 'Test', 'content': 'Content on level 2'}
)
self.assertRedirects(
response,
resolve_url('wiki:get', path='level1/test/')
)
response = self.client.post(
resolve_url('wiki:create', path=''),
{'title': 'test',
'slug': 'Test',
'content': 'Other content on level 1'
}
)
self.assertRedirects(
response,
resolve_url('wiki:get', path='test/')
)
self.assertContains(
self.get_by_path('Test/'),
'Other content on level 1'
)
self.assertContains(
self.get_by_path('Level1/Test/'),
'Content'
) # on level 2')
def test_illegal_slug(self):
# A slug cannot be '123' because it gets confused with an article ID.
response = self.client.post(
resolve_url('wiki:create', path=''),
{'title': 'Illegal slug', 'slug': '123', 'content': 'blah'}
)
self.assertContains(
response,
escape(validate_slug_numbers.message)
)
class MoveViewTest(RequireRootArticleMixin, ArticleWebTestUtils, DjangoClientTestBase):
def test_illegal_slug(self):
# A slug cannot be '123' because it gets confused with an article ID.
response = self.client.post(
resolve_url('wiki:move', path=''),
{'destination': '', 'slug': '123', 'redirect': ''}
)
self.assertContains(
response,
escape(validate_slug_numbers.message)
)
def test_move(self):
# Create a hierarchy of pages
self.client.post(
resolve_url('wiki:create', path=''),
{'title': 'Test', 'slug': 'test0', 'content': 'Content .0.'}
)
self.client.post(
resolve_url('wiki:create', path='test0/'),
{'title': 'Test00', 'slug': 'test00', 'content': 'Content .00.'}
)
self.client.post(
resolve_url('wiki:create', path=''),
{'title': 'Test1', 'slug': 'test1', 'content': 'Content .1.'}
)
self.client.post(
resolve_url('wiki:create', path='test1/'),
{'title': 'Tes10', 'slug': 'test10', 'content': 'Content .10.'}
)
self.client.post(
resolve_url('wiki:create', path='test1/test10/'),
{'title': 'Test100', 'slug': 'test100', 'content': 'Content .100.'}
)
# Move /test1 => /test0 (an already existing destination slug!)
response = self.client.post(
resolve_url('wiki:move', path='test1/'),
{
'destination': str(URLPath.root().article.current_revision.id),
'slug': 'test0',
'redirect': ''
}
)
self.assertContains(response, 'A slug named')
self.assertContains(response, 'already exists.')
# Move /test1 >= /test2 (valid slug), no redirect
test0_id = URLPath.objects.get(slug='test0').article.current_revision.id
response = self.client.post(
resolve_url('wiki:move', path='test1/'),
{'destination': str(test0_id), 'slug': 'test2', 'redirect': ''}
)
self.assertRedirects(
response,
resolve_url('wiki:get', path='test0/test2/')
)
# Check that there is no article displayed in this path anymore
response = self.get_by_path('test1/')
self.assertRedirects(response, '/_create/?slug=test1')
# Create /test0/test2/test020
response = self.client.post(
resolve_url('wiki:create', path='test0/test2/'),
{'title': 'Test020', 'slug': 'test020', 'content': 'Content .020.'}
)
# Move /test0/test2 => /test1new + create redirect
response = self.client.post(
resolve_url('wiki:move', path='test0/test2/'),
{
'destination': str(URLPath.root().article.current_revision.id),
'slug': 'test1new', 'redirect': 'true'
}
)
self.assertRedirects(
response,
resolve_url('wiki:get', path='test1new/')
)
# Check that /test1new is a valid path
response = self.get_by_path('test1new/')
self.assertContains(response, 'Content .1.')
# Check that the child article test0/test2/test020 was also moved
response = self.get_by_path('test1new/test020/')
self.assertContains(response, 'Content .020.')
response = self.get_by_path('test0/test2/')
self.assertContains(response, 'Moved: Test1')
self.assertContains(response, 'moved to <a>wiki:/test1new/')
response = self.get_by_path('test0/test2/test020/')
self.assertContains(response, 'Moved: Test020')
self.assertContains(response, 'moved to <a>wiki:/test1new/test020')
# Check that moved_to was correctly set
urlsrc = URLPath.get_by_path('/test0/test2/')
urldst = URLPath.get_by_path('/test1new/')
self.assertEqual(urlsrc.moved_to, urldst)
# Check that moved_to was correctly set on the child's previous path
urlsrc = URLPath.get_by_path('/test0/test2/test020/')
urldst = URLPath.get_by_path('/test1new/test020/')
self.assertEqual(urlsrc.moved_to, urldst)
class DeleteViewTest(RequireRootArticleMixin, ArticleWebTestUtils, DjangoClientTestBase):
def test_articles_cache_is_cleared_after_deleting(self):
# That bug is tested by one individual test, otherwise it could be
# revealed only by sequence of tests in some particular order
response = self.client.post(
resolve_url('wiki:create', path=''),
{'title': 'Test cache', 'slug': 'testcache', 'content': 'Content 1'}
)
self.assertRedirects(
response,
resolve_url('wiki:get', path='testcache/')
)
response = self.client.post(
resolve_url('wiki:delete', path='testcache/'),
{'confirm': 'on', 'purge': 'on',
'revision': str(URLPath.objects.get(slug='testcache').article.current_revision.id)}
)
self.assertRedirects(
response,
resolve_url('wiki:get', path='')
)
response = self.client.post(
resolve_url('wiki:create', path=''),
{'title': 'Test cache', 'slug': 'TestCache', 'content': 'Content 2'}
)
self.assertRedirects(
response,
resolve_url('wiki:get', path='testcache/')
)
# test the cache
self.assertContains(self.get_by_path('TestCache/'), 'Content 2')
class EditViewTest(RequireRootArticleMixin, ArticleWebTestUtils, DjangoClientTestBase):
def test_preview_save(self):
"""Test edit preview, edit save and messages."""
example_data = {
'content': 'The modified text',
'current_revision': str(URLPath.root().article.current_revision.id),
'preview': '1',
# 'save': '1', # probably not too important
'summary': 'why edited',
'title': 'wiki test'
}
# test preview
response = self.client.post(
resolve_url('wiki:preview', path=''), # url: '/_preview/'
example_data
)
self.assertContains(response, 'The modified text')
def test_revision_conflict(self):
"""
Test the warning if the same article is being edited concurrently.
"""
example_data = {
'content': 'More modifications',
'current_revision': str(URLPath.root().article.current_revision.id),
'preview': '0',
'save': '1',
'summary': 'why edited',
'title': 'wiki test'
}
response = self.client.post(
resolve_url('wiki:edit', path=''),
example_data
)
self.assertRedirects(response, resolve_url('wiki:root'))
response = self.client.post(
resolve_url('wiki:edit', path=''),
example_data
)
self.assertContains(
response,
'While you were editing, someone else changed the revision.'
)
class EditViewTestsBase(RequireRootArticleMixin, FuncBaseMixin):
def test_edit_save(self):
old_revision = URLPath.root().article.current_revision
self.get_url('wiki:edit', path='')
self.fill({
'#id_content': 'Something 2',
'#id_summary': 'why edited',
'#id_title': 'wiki test'
})
self.submit('#id_save')
self.assertTextPresent('Something 2')
self.assertTextPresent('successfully added')
new_revision = URLPath.root().article.current_revision
self.assertIn('Something 2', new_revision.content)
self.assertEqual(new_revision.revision_number, old_revision.revision_number + 1)
class EditViewTestsWebTest(EditViewTestsBase, WebTestBase):
pass
class EditViewTestsSelenium(EditViewTestsBase, SeleniumBase):
# Javascript only tests:
def test_preview_and_save(self):
self.get_url('wiki:edit', path='')
self.fill({
'#id_content': 'Some changed stuff',
'#id_summary': 'why edited',
'#id_title': 'wiki test'
})
self.click('#id_preview')
self.submit('#id_preview_save_changes')
new_revision = URLPath.root().article.current_revision
self.assertIn("Some changed stuff", new_revision.content)
class SearchViewTest(RequireRootArticleMixin, ArticleWebTestUtils, DjangoClientTestBase):
def test_query_string(self):
response = self.client.get(resolve_url('wiki:search'), {'q': 'Article'})
self.assertContains(response, 'Root Article')
def test_empty_query_string(self):
response = self.client.get(resolve_url('wiki:search'), {'q': ''})
self.assertFalse(response.context['articles'])
class DeletedListViewTest(RequireRootArticleMixin, ArticleWebTestUtils, DjangoClientTestBase):
def test_deleted_articles_list(self):
response = self.client.post(
resolve_url('wiki:create', path=''),
{'title': 'Delete Me', 'slug': 'deleteme', 'content': 'delete me please!'}
)
self.assertRedirects(
response,
resolve_url('wiki:get', path='deleteme/')
)
response = self.client.post(
resolve_url('wiki:delete', path='deleteme/'),
{'confirm': 'on',
'revision': URLPath.objects.get(slug='deleteme').article.current_revision.id}
)
self.assertRedirects(
response,
resolve_url('wiki:get', path='')
)
response = self.client.get(resolve_url('wiki:deleted_list'))
self.assertContains(response, 'Delete Me')
class UpdateProfileViewTest(RequireRootArticleMixin, ArticleWebTestUtils, DjangoClientTestBase):
def test_update_profile(self):
self.client.post(
resolve_url('wiki:profile_update'),
{"email": "test@test.com", "password1": "newPass", "password2": "newPass"},
follow=True
)
test_auth = authenticate(username='admin', password='newPass')
self.assertNotEqual(test_auth, None)
self.assertEqual(test_auth.email, 'test@test.com')
class MergeViewTest(RequireRootArticleMixin, ArticleWebTestUtils, DjangoClientTestBase):
def test_merge_preview(self):
"""Test merge preview"""
first_revision = self.root_article.current_revision
example_data = {
'content': 'More modifications\n\nMerge new line',
'current_revision': str(first_revision.id),
'preview': '0',
'save': '1',
'summary': 'testing merge',
'title': 'wiki test'
}
# save a new revision
self.client.post(
resolve_url('wiki:edit', path=''),
example_data
)
new_revision = models.Article.objects.get(
id=self.root_article.id
).current_revision
response = self.client.get(
resolve_url(
'wiki:merge_revision_preview',
article_id=self.root_article.id, revision_id=first_revision.id
),
)
self.assertContains(
response,
'Previewing merge between:'
)
self.assertContains(
response,
'#{rev_number}'.format(rev_number=first_revision.revision_number)
)
self.assertContains(
response,
'#{rev_number}'.format(rev_number=new_revision.revision_number)
)
| cXhristian/django-wiki | tests/core/test_views.py | Python | gpl-3.0 | 17,595 |
#imports
import RPi.GPIO as GPIO
from threading import Thread
import time
#init
print('start')
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.cleanup()
#declaring inputs
buttonLeftSwitch = 17
buttonRightSwitch = 18
buttonGarbageUnit = 21
#declaring outputs
LedBlue = 22
LedYellow = 25
LedGreen = 23
LedRed = 24
#declaring variables
ParkingState = 'Unparked'
Dumping = False
GreenLedStatus = 0
YellowLedStatus = 0
BlueLedStatus = 0
blinking = False
#configure inputs
GPIO.setup(buttonLeftSwitch, GPIO.IN, GPIO.PUD_UP)
GPIO.setup(buttonRightSwitch, GPIO.IN, GPIO.PUD_UP)
GPIO.setup(buttonGarbageUnit, GPIO.IN, GPIO.PUD_UP)
#configure outputs
GPIO.setup(LedBlue, GPIO.OUT)
GPIO.setup(LedYellow, GPIO.OUT)
GPIO.setup(LedGreen, GPIO.OUT)
GPIO.setup(LedRed, GPIO.OUT)
GPIO.output(LedGreen, 0)
GPIO.output(LedBlue, 0)
GPIO.output(LedYellow, 0)
GPIO.output(LedGreen, 0)
GPIO.output(LedRed, 1)
#Functions
class BlinkThread(Thread):
def __init__(self, pin):
self.pin = pin
self.delay = 0.5
self.running = True
super(BlinkThread, self).__init__()
def run(self):
while (self.running):
GPIO.output(self.pin, True)
time.sleep(self.delay)
GPIO.output(self.pin, False)
time.sleep(self.delay)
def stop(self):
self.running = False
def running(self):
return running
class CheckContainer(Thread):
def __init__(self, pin):
self.blinkingPin = pin
self.delay = 1
self.running = True
super(CheckContainer, self).__init__()
def run(self):
container = None
while (self.running):
if(GPIO.input(buttonGarbageUnit)== True):
if(container == None):
container = BlinkThread(self.blinkingPin)
container.name = 'container missing blinking'
container.start()
else:
if(not container == None):
container.stop()
container = None
GPIO.output(self.blinkingPin, True)
time.sleep(0.05)
def stop(self):
self.running = False
#Program
while (True):
#There are 4 possibilities:
#The Car is Parking
#The car is Parked
#The car is Unparking
#The car is UnParked
containerCheck = CheckContainer(LedGreen)
containerCheck.start()
if((ParkingState == 'Parking')):
print(ParkingState)
#EDIT: Start both motors forwards
while(True):
if((GPIO.input(buttonLeftSwitch) == False)and(GPIO.input(buttonRightSwitch)==False)):
ParkingState = 'Parked'
#EDIT: Timeout error
break
if((ParkingState == 'Parked')):
print(ParkingState)
#EDIT: Stop both motors
while(True):
Command = input ('Give command "Dump" or "Unpark" or "Charge": ')
if(Command == 'Unpark'):
ParkingState = 'Unparking'
break
elif(Command == 'Dump'):
if(GPIO.input(buttonGarbageUnit)== False):
print('Dumping')
print('.....')
print('Dumping Finished')
elif(GPIO.input(buttonGarbageUnit)== True):
print('Place Garbage Unit back')
elif(Command == 'Charge'):
print('Charging')
print('.....')
blink = BlinkThread(LedBlue)
blink.name = 'robot charging'
blink.start()
time.sleep(5)
print('Charged')
blink.stop()
GPIO.output(LedBlue, True)
if((ParkingState == 'Unparking')):
print(ParkingState)
#EDIT: Start both motors backwards
while(True):
if((GPIO.input(buttonLeftSwitch) == True)and(GPIO.input(buttonRightSwitch)== True)):
ParkingState = 'Unparked'
#EDIT: Timeout error
break
if((ParkingState == 'Unparked')):
print(ParkingState)
GPIO.output(LedGreen, 0)
#EDIT: Let robot do its task
while(True):
if(buttonGarbageUnit==False):
GPIO.output(LedGreen, False)
elif(buttonGarbageUnit==True):
GPIO.output(LedGreen, True)
Command = input ('Give command "Park": ')
if(Command == 'Park'):
ParkingState = 'Parking'
break
GPIO.cleanup()
| InnovationCentre/CommandCentrePrototypes | prototype_logic.py | Python | gpl-2.0 | 4,694 |
import os
import sys
from subprocess import call
from ci import enum
from ci import prettyprint, COLOR as Color
import ci.jenkins.util as util
TASKS = enum(FILECOPY=1, DIRCOPY=2, FILECREATE=3, \
DIRCREATE=4, USERCREATE=5, PERMISSION=6, DAEMON=7)
class TaskException(Exception):
'''
Basic Exception from task execution.
'''
def __init__(self, message):
Exception.__init__(self, message)
class Task():
'''
Base Task class.
* Methods should be overridden.
'''
def __init__(self, typeid, path=None):
self.typeid = typeid
self.path = path
def execute(self, **kwargs):
raise TaskException('execute() needs to be overridden by Task subclass.')
def undo(self):
raise TaskException('undo() needs to be overridden by Task subclass.')
def serialize(self):
return {
'typeid': self.typeid,
'path': self.path
}
class FileCopyTask(Task):
def __init__(self):
Task.__init__(self, TASKS.FILECOPY)
self.created_dir = False
def execute(self, source, destination):
try:
# prettyprint(Color.WHITE, \
# 'Copying file from %s to %s.' % (source, destination))
if not os.path.exists(os.path.dirname(destination)):
os.makedirs(os.path.dirname(destination))
self.created_dir = True
util.copyfile(source, destination)
self.path = destination
except:
raise TaskException('Could not copy file to %s, from source %s. %r' \
% (destination, source, sys.exc_info()[0]))
def undo(self):
try:
if self.path is not None:
prettyprint(Color.WHITE, 'Removing %s...' % self.path)
directory = os.path.dirname(self.path)
util.removefile(self.path)
if self.created_dir and os.path.exists(directory):
util.removedir(directory)
except:
print 'Could not undo FileCopyTask. %r' % sys.exc_info()[0]
class DirCopyTask(Task):
def __init__(self):
Task.__init__(self, TASKS.DIRCOPY)
def execute(self, source, destination):
try:
# prettyprint(Color.WHITE, \
# 'Copying directory from %s to %s' % (source, destination))
util.copydir(source, destination)
self.path = destination
except:
raise TaskException('Could not copy directory to %s, from source %s. %r' \
% (destination, source, sys.exc_info()[0]))
def undo(self):
try:
if self.path is not None:
prettyprint(Color.WHITE, 'Removing %s' % self.path)
util.removedir(self.path)
except:
print 'Could not undo DirCopyTask. %r' % sys.exc_info()[0]
class DirCreateTask(Task):
def __init__(self):
Task.__init__(self, TASKS.DIRCREATE)
def execute(self, dirpath):
try:
# prettyprint(Color.WHITE, 'Creating %s' % dirpath)
if not os.path.exists(dirpath):
os.makedirs(dirpath)
self.path = dirpath
except:
raise TaskException('Could not create directory at %s. %r' \
% (dirpath, sys.exc_info[0]))
def undo(self):
try:
if self.path is not None:
prettyprint(Color.WHITE, 'Removing %s' % self.path)
util.removedir(self.path)
except:
print 'Could not undo DirCreateTask. %r' % sys.exc_info()[0]
class CreateUserTask(Task):
def __init__(self):
Task.__init__(self, TASKS.USERCREATE)
def execute(self, username):
try:
# prettyprint(Color.WHITE, 'Creating user %s' % username)
call(['useradd', username])
self.path = username
except:
raise TaskException('Could not create new user %s. %r' \
% (username, sys.exc_info[0]))
def undo(self):
try:
if self.path is not None:
prettyprint(Color.WHITE, 'Removing user %s' % self.path)
call(['userdel', '-r', self.path])
except:
print 'Could not undo CreateUserTask. %r' % sys.exc_info()[0]
class StartDaemonTask(Task):
def __init__(self):
Task.__init__(self, TASKS.DAEMON)
def execute(self, path):
try:
# prettyprint(Color.WHITE, 'Starting daemon at %s.' % path)
call(['sudo', path, 'start'])
self.path = path
except:
print 'Could not start daemon at %s. %r' % (path, sys.exc_info()[0])
def undo(self):
try:
if self.path is not None:
prettyprint(Color.WHITE, 'Stopping daemon at %s.' % self.path)
call(['sudo', self.path, 'stop'])
except:
print 'Could not stop daemon at %s. %r' % (self.path, sys.exc_info()[0])
FACTORY = {
TASKS.FILECOPY: FileCopyTask,
TASKS.DIRCOPY: DirCopyTask,
TASKS.DIRCREATE: DirCreateTask,
TASKS.USERCREATE: CreateUserTask,
TASKS.DAEMON: StartDaemonTask
}
def create(plain):
for key, value in plain.items():
if key == 'typeid':
if value in FACTORY:
task = FACTORY[value]()
task.path = plain['path']
return task
else:
prettyprint(Color.YELLOW, 'Could not find task with typeid: %d' % value)
return None
| infrared5/dev-ops | continuous-integration/ci/jenkins/task.py | Python | mit | 4,900 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from argparse import Namespace
from idb.cli import ClientCommand
from idb.common.types import Client
class KeychainClearCommand(ClientCommand):
@property
def description(self) -> str:
return "Clear the targets keychain"
@property
def name(self) -> str:
return "clear-keychain"
async def run_with_client(self, args: Namespace, client: Client) -> None:
await client.clear_keychain()
| facebook/FBSimulatorControl | idb/cli/commands/keychain.py | Python | mit | 631 |
# Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import re
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.openstack.common import processutils
from nova import utils
from nova.volume.encryptors import cryptsetup
LOG = logging.getLogger(__name__)
class LuksEncryptor(cryptsetup.CryptsetupEncryptor):
"""A VolumeEncryptor based on LUKS.
This VolumeEncryptor uses dm-crypt to encrypt the specified volume.
"""
def __init__(self, connection_info, **kwargs):
super(LuksEncryptor, self).__init__(connection_info, **kwargs)
def _format_volume(self, passphrase, **kwargs):
"""Creates a LUKS header on the volume.
:param passphrase: the passphrase used to access the volume
"""
LOG.debug(_("formatting encrypted volume %s"), self.dev_path)
# NOTE(joel-coffman): cryptsetup will strip trailing newlines from
# input specified on stdin unless --key-file=- is specified.
cmd = ["cryptsetup", "--batch-mode", "luksFormat", "--key-file=-"]
cipher = kwargs.get("cipher", None)
if cipher is not None:
cmd.extend(["--cipher", cipher])
key_size = kwargs.get("key_size", None)
if key_size is not None:
cmd.extend(["--key-size", key_size])
cmd.extend([self.dev_path])
utils.execute(*cmd, process_input=passphrase,
check_exit_code=True, run_as_root=True)
def _open_volume(self, passphrase, **kwargs):
"""Opens the LUKS partition on the volume using the specified
passphrase.
:param passphrase: the passphrase used to access the volume
"""
LOG.debug(_("opening encrypted volume %s"), self.dev_path)
utils.execute('cryptsetup', 'luksOpen', '--key-file=-',
self.dev_path, self.dev_name, process_input=passphrase,
run_as_root=True, check_exit_code=True)
def attach_volume(self, context, **kwargs):
"""Shadows the device and passes an unencrypted version to the
instance.
Transparent disk encryption is achieved by mounting the volume via
dm-crypt and passing the resulting device to the instance. The
instance is unaware of the underlying encryption due to modifying the
original symbolic link to refer to the device mounted by dm-crypt.
"""
key = self._get_key(context).get_encoded()
# LUKS uses a passphrase rather than a raw key -- convert to string
passphrase = ''.join(hex(x).replace('0x', '') for x in key)
try:
self._open_volume(passphrase, **kwargs)
except processutils.ProcessExecutionError as e:
pattern = re.compile('Device \S+ is not a valid LUKS device.')
if e.exit_code == 1 and pattern.search(e.stderr):
# the device has never been formatted; format it and try again
self._format_volume(passphrase, **kwargs)
self._open_volume(passphrase, **kwargs)
else:
raise
# modify the original symbolic link to refer to the decrypted device
utils.execute('ln', '--symbolic', '--force',
'/dev/mapper/%s' % self.dev_name, self.symlink_path,
run_as_root=True, check_exit_code=True)
def _close_volume(self, **kwargs):
"""Closes the device (effectively removes the dm-crypt mapping)."""
LOG.debug(_("closing encrypted volume %s"), self.dev_path)
utils.execute('cryptsetup', 'luksClose', self.dev_name,
run_as_root=True, check_exit_code=True,
attempts=3)
| luogangyi/bcec-nova | nova/volume/encryptors/luks.py | Python | apache-2.0 | 4,355 |
# -*- coding: utf-8 -*-
# Space Syntax Toolkit
# Set of tools for essential space syntax network analysis and results exploration
# -------------------
# begin : 2020-09-10
# copyright : (C) 2020 by Petros Koutsolampros / Space Syntax Ltd.
# author : Petros Koutsolampros
# email : p.koutsolampros@spacesyntax.com
#
# This program 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) any later version.
import unittest
from qgis.core import (QgsApplication, QgsVectorLayer, QgsFeature, QgsLineString, QgsPoint)
from esstoolkit.network_segmenter.segment_tools import segmentor
from esstoolkit.rcl_cleaner.road_network_cleaner_dialog import RoadNetworkCleanerDialog
from esstoolkit.rcl_cleaner.sGraph.sGraph import sGraph
from esstoolkit.rcl_cleaner.sGraph.utilityFunctions import clean_features_iter
qgs = QgsApplication([], False)
qgs.initQgis()
class TestRCLCleaner(unittest.TestCase):
@staticmethod
def make_geometry_feature_layer(layertype: str, geometries):
vl = QgsVectorLayer(layertype, 'temp', "memory")
pr = vl.dataProvider()
for geometry in geometries:
f = QgsFeature()
f.setGeometry(geometry)
pr.addFeature(f)
vl.updateExtents()
return vl
def test_merge_nodes(self):
error_tolerance = 0.0001
axial_lines = TestRCLCleaner.make_geometry_feature_layer(
"LineString",
[QgsLineString([QgsPoint(535088.141198, 185892.128181),
QgsPoint(535037.617992, 186342.145327)]),
QgsLineString([QgsPoint(534931.347277, 186103.472964),
QgsPoint(535285.548630, 186203.990233)]),
QgsLineString([QgsPoint(534952.224080, 186285.463215),
QgsPoint(535248.881516, 185907.343107)])])
unlinks = TestRCLCleaner.make_geometry_feature_layer(
"Point", [])
# segment the axial lines without removing stubs
stub_ratio = 0
buffer = 1
errors = True
my_segmentor = segmentor(axial_lines, unlinks, stub_ratio, buffer, errors)
my_segmentor.step = 10 / float(my_segmentor.layer.featureCount())
my_segmentor.load_graph()
# self.step specified in load_graph
# progress emitted by break_segm & break_feats_iter
cross_p_list = [my_segmentor.break_segm(feat) for feat in
my_segmentor.list_iter(list(my_segmentor.feats.values()))]
my_segmentor.step = 20 / float(len(cross_p_list))
segmented_feats = [my_segmentor.copy_feat(feat_geom_fid[0], feat_geom_fid[1], feat_geom_fid[2]) for
feat_geom_fid in my_segmentor.break_feats_iter(cross_p_list)]
segmented_geometry = [segmented_feat.geometry() for segmented_feat in segmented_feats]
segment_layer = TestRCLCleaner.make_geometry_feature_layer(
"LineString", segmented_geometry)
# segment the axial lines without removing stubs
self.assertEqual(segment_layer.featureCount(), 9)
# cleaning settings
snap_threshold = 10 # TODO: Test
break_at_vertices = True # TODO: Test
merge_type = 'intersections' # TODO: Test
# merge_type = 'colinear' # TODO: Test
collinear_threshold = 0 # TODO: Test
angle_threshold = 10 # TODO: Test
fix_unlinks = True # TODO: Test
orphans = True # TODO: Test
get_unlinks = True # TODO: Test
[load_range, cl1_range, cl2_range, cl3_range, break_range, merge_range, snap_range, unlinks_range,
fix_range] = RoadNetworkCleanerDialog.get_progress_ranges(break_at_vertices, merge_type, snap_threshold,
get_unlinks, fix_unlinks)
points = []
multiparts = []
pseudo_graph = sGraph({}, {})
if break_at_vertices:
pseudo_graph.step = load_range / float(segment_layer.featureCount())
graph = sGraph({}, {})
graph.total_progress = load_range
pseudo_graph.load_edges_w_o_topology(clean_features_iter(segment_layer.getFeatures()))
# QgsMessageLog.logMessage('pseudo_graph edges added %s' % load_range, level=Qgis.Critical)
pseudo_graph.step = break_range / float(len(pseudo_graph.sEdges))
graph.load_edges(
pseudo_graph.break_features_iter(get_unlinks, angle_threshold, fix_unlinks),
angle_threshold)
# QgsMessageLog.logMessage('pseudo_graph edges broken %s' % break_range, level=Qgis.Critical)
else:
graph = sGraph({}, {})
graph.step = load_range / float(segment_layer.featureCount())
graph.load_edges(clean_features_iter(segment_layer.getFeatures()), angle_threshold)
# QgsMessageLog.logMessage('graph edges added %s' % load_range, level=Qgis.Critical)
graph.step = cl1_range / (float(len(graph.sEdges)) * 2.0)
if orphans:
graph.clean(True, False, snap_threshold, True)
else:
graph.clean(True, False, snap_threshold, False)
# QgsMessageLog.logMessage('graph clean parallel and closed pl %s' % cl1_range, level=Qgis.Critical)
if fix_unlinks:
graph.step = fix_range / float(len(graph.sEdges))
graph.fix_unlinks()
# QgsMessageLog.logMessage('unlinks added %s' % fix_range, level=Qgis.Critical)
if snap_threshold != 0:
graph.step = snap_range / float(len(graph.sNodes))
graph.snap_endpoints(snap_threshold)
# QgsMessageLog.logMessage('snap %s' % snap_range, level=Qgis.Critical)
graph.step = cl2_range / (float(len(graph.sEdges)) * 2.0)
if orphans:
graph.clean(True, False, snap_threshold, True)
else:
graph.clean(True, False, snap_threshold, False)
# QgsMessageLog.logMessage('clean %s' % cl2_range, level=Qgis.Critical)
if merge_type == 'intersections':
graph.step = merge_range / float(len(graph.sNodes))
graph.merge_b_intersections(angle_threshold)
# QgsMessageLog.logMessage('merge %s %s angle_threshold ' % (merge_range, angle_threshold),
# level=Qgis.Critical)
elif merge_type == 'collinear':
graph.step = merge_range / float(len(graph.sEdges))
graph.merge_collinear(collinear_threshold, angle_threshold)
# QgsMessageLog.logMessage('merge %s' % merge_range, level=Qgis.Critical)
# cleaned multiparts so that unlinks are generated properly
if orphans:
graph.step = cl3_range / (float(len(graph.sEdges)) * 2.0)
graph.clean(True, orphans, snap_threshold, False, True)
else:
graph.step = cl3_range / (float(len(graph.sEdges)) * 2.0)
graph.clean(True, False, snap_threshold, False, True)
if get_unlinks:
graph.step = unlinks_range / float(len(graph.sEdges))
graph.generate_unlinks()
unlinks = graph.unlinks
else:
unlinks = []
cleaned_features = [e.feature for e in list(graph.sEdges.values())]
# add to errors multiparts and points
graph.errors += multiparts
graph.errors += points
expected_segments = [
QgsLineString([QgsPoint(535088.141198, 185892.128181), QgsPoint(535061.604423, 186143.502228)]),
QgsLineString([QgsPoint(535061.604423, 186143.502228), QgsPoint(535037.617992, 186342.145327)]),
QgsLineString([QgsPoint(534931.347277, 186103.472964), QgsPoint(535061.604423, 186143.502228)]),
QgsLineString([QgsPoint(535061.604423, 186143.502228), QgsPoint(535285.548630, 186203.990233)]),
QgsLineString([QgsPoint(534952.224080, 186285.463215), QgsPoint(535061.604423, 186143.502228)]),
QgsLineString([QgsPoint(535061.604423, 186143.502228), QgsPoint(535248.881516, 185907.343107)])
]
self.assertEqual(len(cleaned_features), len(expected_segments))
for cleaned_feature in cleaned_features:
cleaned_line = cleaned_feature.geometry().asPolyline()
for expected_segment in expected_segments:
x1eq = abs(cleaned_line[0].x() - expected_segment[0].x()) < error_tolerance
y1eq = abs(cleaned_line[0].y() - expected_segment[0].y()) < error_tolerance
x2eq = abs(cleaned_line[1].x() - expected_segment[1].x()) < error_tolerance
y2eq = abs(cleaned_line[1].y() - expected_segment[1].y()) < error_tolerance
if x1eq and y1eq and x2eq and y2eq:
expected_segments.remove(expected_segment)
break
# all the expected features should have been found and removed
self.assertEqual(len(expected_segments), 0)
expected_errors = [
QgsPoint(535060.304968, 186140.069309),
QgsPoint(535059.304801, 186148.977932),
QgsPoint(535065.203499, 186141.459442)
]
self.assertEqual(len(graph.errors), len(expected_errors))
for break_point_feat in graph.errors:
break_point = break_point_feat.geometry().asPoint()
for expected_break_point in expected_errors:
xeq = abs(break_point.x() - expected_break_point.x()) < error_tolerance
yeq = abs(break_point.y() - expected_break_point.y()) < error_tolerance
if xeq and yeq:
expected_errors.remove(expected_break_point)
break
# all the expected errors should have been found and removed
self.assertEqual(len(expected_errors), 0)
if __name__ == '__main__':
unittest.main()
qgs.exitQgis()
| SpaceGroupUCL/qgisSpaceSyntaxToolkit | esstoolkit/tests/test_rcl_cleaner.py | Python | gpl-3.0 | 10,092 |
__docformat__ = "restructuredtext en"
import mdp
from ica_nodes import ICANode
numx, numx_rand, numx_linalg = mdp.numx, mdp.numx_rand, mdp.numx_linalg
mult = mdp.utils.mult
class JADENode(ICANode):
"""
Perform Independent Component Analysis using the JADE algorithm.
Note that JADE is a batch-algorithm. This means that it needs
all input data before it can start and compute the ICs.
The algorithm is here given as a Node for convenience, but it
actually accumulates all inputs it receives. Remember that to avoid
running out of memory when you have many components and many time samples.
JADE does not support the telescope mode.
Main references:
* Cardoso, Jean-Francois and Souloumiac, Antoine (1993).
Blind beamforming for non Gaussian signals.
Radar and Signal Processing, IEE Proceedings F, 140(6): 362-370.
* Cardoso, Jean-Francois (1999).
High-order contrasts for independent component analysis.
Neural Computation, 11(1): 157-192.
Original code contributed by:
Gabriel Beckers (2008).
History:
- May 2005 version 1.8 for MATLAB released by Jean-Francois Cardoso
- Dec 2007 MATLAB version 1.8 ported to Python/NumPy by Gabriel Beckers
- Feb 15 2008 Python/NumPy version adapted for MDP by Gabriel Beckers
"""
def __init__(self, limit = 0.001, max_it=1000, verbose = False,
whitened = False, white_comp = None, white_parm = None,
input_dim = None, dtype = None):
"""
Input arguments:
General:
whitened -- Set whitened == True if input data are already whitened.
Otherwise the node will whiten the data itself
white_comp -- If whitened == False, you can set 'white_comp' to the
number of whitened components to keep during the
calculation (i.e., the input dimensions are reduced to
white_comp by keeping the components of largest variance).
white_parm -- a dictionary with additional parameters for whitening.
It is passed directly to the WhiteningNode constructor.
Ex: white_parm = { 'svd' : True }
limit -- convergence threshold.
Specific for JADE:
max_it -- maximum number of iterations
"""
super(JADENode, self).__init__(limit, False, verbose, whitened,
white_comp, white_parm, input_dim,
dtype)
self.max_it = max_it
def core(self, data):
# much of the code here is a more or less line by line translation of
# the original matlab code by Jean-Francois Cardoso.
append = numx.append
arange = numx.arange
arctan2 = numx.arctan2
array = numx.array
concatenate = numx.concatenate
cos = numx.cos
sin = numx.sin
sqrt = numx.sqrt
dtype = self.dtype
verbose = self.verbose
max_it = self.max_it
(T, m) = data.shape
X = data
if verbose:
print "jade -> Estimating cumulant matrices"
# Dim. of the space of real symm matrices
dimsymm = (m*(m+1)) // 2
# number of cumulant matrices
nbcm = dimsymm
# Storage for cumulant matrices
CM = numx.zeros((m, m*nbcm), dtype=dtype)
R = numx.eye(m, dtype=dtype)
# Temp for a cum. matrix
Qij = numx.zeros((m, m), dtype=dtype)
# Temp
Xim = numx.zeros(m, dtype=dtype)
# Temp
Xijm = numx.zeros(m, dtype=dtype)
# I am using a symmetry trick to save storage. I should write a short
# note one of these days explaining what is going on here.
# will index the columns of CM where to store the cum. mats.
Range = arange(m)
for im in xrange(m):
Xim = X[:, im]
Xijm = Xim*Xim
# Note to myself: the -R on next line can be removed: it does not
# affect the joint diagonalization criterion
Qij = ( mult(Xijm*X.T, X) / float(T)
- R - 2 * numx.outer(R[:,im], R[:,im]) )
CM[:, Range] = Qij
Range += m
for jm in xrange(im):
Xijm = Xim*X[:, jm]
Qij = ( sqrt(2) * mult(Xijm*X.T, X) / T
- numx.outer(R[:,im], R[:,jm]) - numx.outer(R[:,jm],
R[:,im]) )
CM[:, Range] = Qij
Range += m
# Now we have nbcm = m(m+1)/2 cumulants matrices stored in a big
# m x m*nbcm array.
# Joint diagonalization of the cumulant matrices
# ==============================================
V = numx.eye(m, dtype=dtype)
Diag = numx.zeros(m, dtype=dtype)
On = 0.0
Range = arange(m)
for im in xrange(nbcm):
Diag = numx.diag(CM[:, Range])
On = On + (Diag*Diag).sum(axis=0)
Range += m
Off = (CM*CM).sum(axis=0) - On
# A statistically scaled threshold on `small" angles
seuil = (self.limit*self.limit) / sqrt(T)
# sweep number
encore = True
sweep = 0
# Total number of rotations
updates = 0
# Number of rotations in a given seep
upds = 0
g = numx.zeros((2, nbcm), dtype=dtype)
gg = numx.zeros((2, 2), dtype=dtype)
G = numx.zeros((2, 2), dtype=dtype)
c = 0
s = 0
ton = 0
toff = 0
theta = 0
Gain = 0
# Joint diagonalization proper
# ============================
if verbose:
print "jade -> Contrast optimization by joint diagonalization"
while encore:
encore = False
if verbose:
print "jade -> Sweep #%3d" % sweep ,
sweep += 1
upds = 0
for p in xrange(m-1):
for q in xrange(p+1, m):
Ip = arange(p, m*nbcm, m)
Iq = arange(q, m*nbcm, m)
# computation of Givens angle
g = concatenate([numx.atleast_2d(CM[p, Ip] - CM[q, Iq]),
numx.atleast_2d(CM[p, Iq] + CM[q, Ip])])
gg = mult(g, g.T)
ton = gg[0, 0] - gg[1, 1]
toff = gg[0, 1] + gg[1, 0]
theta = 0.5 * arctan2(toff, ton + sqrt(ton*ton+toff*toff))
Gain = (sqrt(ton * ton + toff * toff) - ton) / 4.0
# Givens update
if abs(theta) > seuil:
encore = True
upds = upds + 1
c = cos(theta)
s = sin(theta)
G = array([[c, -s] , [s, c] ])
pair = array([p, q])
V[:, pair] = mult(V[:, pair], G)
CM[pair, :] = mult(G.T, CM[pair, :])
CM[:, concatenate([Ip, Iq])]= append(c*CM[:, Ip]+
s*CM[:, Iq],
-s*CM[:, Ip]+
c*CM[:, Iq],
axis=1)
On = On + Gain
Off = Off - Gain
if verbose:
print "completed in %d rotations" % upds
updates += upds
if updates > max_it:
err_msg = 'No convergence after %d iterations.' % max_it
raise mdp.NodeException(err_msg)
if verbose:
print "jade -> Total of %d Givens rotations" % updates
# A separating matrix
# ===================
# B is whitening matrix
B = V.T
# Permute the rows of the separating matrix B to get the most energetic
# components first. Here the **signals** are normalized to unit
# variance. Therefore, the sort is according to the norm of the
# columns of A = pinv(B)
if verbose:
print "jade -> Sorting the components"
A = numx_linalg.pinv(B)
B = B[numx.argsort((A*A).sum(axis=0))[::-1], :]
if verbose:
print "jade -> Fixing the signs"
b = B[:, 0]
# just a trick to deal with sign == 0
signs = numx.sign(numx.sign(b)+0.1)
B = mult(numx.diag(signs), B)
self.filters = B.T
return theta
| ME-ICA/me-ica | meica.libs/mdp/nodes/jade.py | Python | lgpl-2.1 | 8,744 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-10-29 11:25
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('base', '0378_auto_20181026_1612'),
]
operations = [
migrations.AlterField(
model_name='externallearningunityear',
name='external_acronym',
field=models.CharField(blank=True, db_index=True, default='', max_length=15, verbose_name='external_code'),
preserve_default=False,
),
migrations.AlterField(
model_name='externallearningunityear',
name='learning_unit_year',
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='base.LearningUnitYear', verbose_name='learning unit year'),
),
migrations.AlterField(
model_name='externallearningunityear',
name='requesting_entity',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='base.Entity', verbose_name='requesting_entity'),
),
migrations.AlterField(
model_name='externallearningunityear',
name='url',
field=models.URLField(blank=True, default='', max_length=255, verbose_name='url of the learning unit'),
preserve_default=False,
),
]
| uclouvain/osis_louvain | base/migrations/0379_auto_20181029_1125.py | Python | agpl-3.0 | 1,428 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
import unittest
from unittest import mock
from airflow import DAG, models
from airflow.bin import cli
from airflow.cli.commands import sync_perm_command
from airflow.settings import Session
class TestCliSyncPerm(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.dagbag = models.DagBag(include_examples=True)
cls.parser = cli.CLIFactory.get_parser()
def setUp(self):
from airflow.www import app as application
self.app, self.appbuilder = application.create_app(session=Session, testing=True)
@mock.patch("airflow.cli.commands.sync_perm_command.DagBag")
def test_cli_sync_perm(self, dagbag_mock):
self.expect_dagbag_contains([
DAG('has_access_control',
access_control={
'Public': {'can_dag_read'}
}),
DAG('no_access_control')
], dagbag_mock)
self.appbuilder.sm = mock.Mock()
args = self.parser.parse_args([
'sync_perm'
])
sync_perm_command.sync_perm(args)
assert self.appbuilder.sm.sync_roles.call_count == 1
self.assertEqual(2,
len(self.appbuilder.sm.sync_perm_for_dag.mock_calls))
self.appbuilder.sm.sync_perm_for_dag.assert_any_call(
'has_access_control',
{'Public': {'can_dag_read'}}
)
self.appbuilder.sm.sync_perm_for_dag.assert_any_call(
'no_access_control',
None,
)
def expect_dagbag_contains(self, dags, dagbag_mock):
dagbag = mock.Mock()
dagbag.dags = {dag.dag_id: dag for dag in dags}
dagbag_mock.return_value = dagbag
| wileeam/airflow | tests/cli/commands/test_sync_perm_command.py | Python | apache-2.0 | 2,470 |
import unittest
import numpy
import chainer
from chainer.backends import cuda
import chainer.functions as F
from chainer import testing
from chainer.testing import attr
from chainer.testing import backend
@testing.parameterize(*(testing.product({
'c_contiguous': [True, False],
'cover_all': [True, False],
'x_dtype': [numpy.float32],
'W_dtype': [numpy.float32],
'dilate': [1],
'groups': [1, 2],
'nobias': [True, False],
}) + testing.product({
'c_contiguous': [False],
'cover_all': [False],
'x_dtype': [numpy.float16, numpy.float32, numpy.float64],
'W_dtype': [numpy.float16, numpy.float32, numpy.float64],
'dilate': [1],
'groups': [1, 2],
'nobias': [True, False],
})))
@backend.inject_backend_tests(
None,
# ChainerX tests
testing.product({
'use_chainerx': [True],
'chainerx_device': ['native:0', 'cuda:0'],
})
# CPU tests
+ testing.product({
'use_cuda': [False],
'use_ideep': ['never', 'always'],
})
# GPU tests
+ testing.product([
[{'use_cuda': True}],
# Without cuDNN
testing.product({
'use_cudnn': ['never'],
})
# With cuDNN
+ testing.product({
'use_cudnn': ['always'],
'cudnn_deterministic': [True, False],
'autotune': [True, False],
})]))
class TestConvolution2DFunction(testing.FunctionTestCase):
def setUp(self):
self.batches = 2
self.in_channels_a_group = 3
self.out_channels_a_group = 2
self.in_channels = self.in_channels_a_group * self.groups
self.out_channels = self.out_channels_a_group * self.groups
self.kh, self.kw = (3, 3)
self.stride = 2
self.pad = (
int(self.kh / 2) * self.dilate, int(self.kw / 2) * self.dilate)
self.check_forward_options.update({
'atol': 5e-4, 'rtol': 5e-3
})
self.check_backward_options.update({
'atol': 5e-4, 'rtol': 5e-3
})
self.check_double_backward_options.update({
'atol': 5e-4, 'rtol': 5e-3
})
if numpy.float16 in (self.x_dtype, self.W_dtype):
self.check_forward_options.update({
'atol': 1e-3, 'rtol': 1e-2
})
self.check_backward_options.update({
'atol': 1e-3, 'rtol': 1e-3
})
self.check_double_backward_options.update({
'atol': 1e-3, 'rtol': 1e-3
})
def generate_inputs(self):
W = numpy.random.normal(
0, numpy.sqrt(1. / (self.kh * self.kw * self.in_channels_a_group)),
(self.out_channels, self.in_channels_a_group, self.kh, self.kw)
).astype(self.W_dtype)
x = numpy.random.uniform(
-1, 1, (self.batches, self.in_channels, 4, 3)).astype(self.x_dtype)
if self.nobias:
return x, W
else:
b = numpy.random.uniform(
-1, 1, self.out_channels).astype(self.x_dtype)
return x, W, b
def forward_expected(self, inputs):
if self.nobias:
x, W = inputs
b = None
else:
x, W, b = inputs
with chainer.using_config('use_ideep', 'never'):
y_expected = F.convolution_2d(
x, W, b, stride=self.stride, pad=self.pad,
cover_all=self.cover_all, dilate=self.dilate,
groups=self.groups)
return y_expected.array,
def forward(self, inputs, device):
if self.nobias:
x, W = inputs
b = None
else:
x, W, b = inputs
return F.convolution_2d(
x, W, b, stride=self.stride, pad=self.pad,
cover_all=self.cover_all, dilate=self.dilate,
groups=self.groups),
@testing.parameterize(*(testing.product({
'use_cudnn': ['always', 'auto', 'never'],
'cudnn_deterministic': [False, True],
'dtype': [numpy.float16, numpy.float32, numpy.float64],
'dilate': [1],
'groups': [1, 2],
}) + testing.product({
'use_cudnn': ['always', 'auto', 'never'],
'cudnn_deterministic': [False],
'dtype': [numpy.float16, numpy.float32, numpy.float64],
'dilate': [2],
'groups': [1, 2],
})))
@attr.cudnn
class TestConvolution2DCudnnCall(unittest.TestCase):
def setUp(self):
batches = 2
in_channels_a_group = 3
out_channels_a_group = 2
in_channels = in_channels_a_group * self.groups
out_channels = out_channels_a_group * self.groups
kh, kw = (3, 3)
self.stride = 2
self.pad = (int(kh / 2) * self.dilate, int(kw / 2) * self.dilate)
self.x = cuda.cupy.random.uniform(
-1, 1, (batches, in_channels, 4, 3)).astype(self.dtype)
self.W = cuda.cupy.random.normal(
0, numpy.sqrt(1. / (kh * kw * in_channels_a_group)),
(out_channels, in_channels_a_group, kh, kw)).astype(self.dtype)
self.gy = cuda.cupy.random.uniform(
-1, 1, (batches, out_channels, 2, 2)).astype(self.dtype)
with chainer.using_config('use_cudnn', self.use_cudnn):
self.should_call_cudnn = chainer.should_use_cudnn('>=auto')
if self.dilate > 1 and cuda.cuda.cudnn.getVersion() < 6000:
self.should_call_cudnn = False
if self.groups > 1 and cuda.cuda.cudnn.getVersion() < 7000:
self.should_call_cudnn = False
def forward(self):
x = chainer.Variable(self.x)
W = chainer.Variable(self.W)
return F.convolution_2d(x, W, None, stride=self.stride, pad=self.pad,
dilate=self.dilate, groups=self.groups)
def test_call_cudnn_forward(self):
with chainer.using_config('use_cudnn', self.use_cudnn):
with chainer.using_config('cudnn_deterministic',
self.cudnn_deterministic):
with testing.patch('cupy.cudnn.convolution_forward') as func:
self.forward()
self.assertEqual(func.called, self.should_call_cudnn)
def test_call_cudnn_backward(self):
with chainer.using_config('use_cudnn', self.use_cudnn):
with chainer.using_config('cudnn_deterministic',
self.cudnn_deterministic):
y = self.forward()
y.grad = self.gy
name = 'cupy.cudnn.convolution_backward_data'
with testing.patch(name) as func:
y.backward()
self.assertEqual(func.called, self.should_call_cudnn)
@testing.parameterize(*testing.product({
'c_contiguous': [True, False],
'nobias': [True, False],
'groups': [1, 2],
}))
@attr.gpu
@attr.cudnn
class TestConvolution2DFunctionCudnnDeterministic(unittest.TestCase):
def setUp(self):
self.stride = 2
self.pad = 1
batch_sz = 2
in_channels_a_group = 64
out_channels_a_group = 64
in_channels = in_channels_a_group * self.groups
out_channels = out_channels_a_group * self.groups
kh, kw = (3, 3)
in_h, in_w = (32, 128)
out_h, out_w = (16, 64)
# should be same types for cudnn test
x_dtype = numpy.float32
W_dtype = numpy.float32
self.W = numpy.random.normal(
0, numpy.sqrt(1. / (kh * kw * in_channels_a_group)),
(out_channels, in_channels_a_group, kh, kw)).astype(W_dtype)
self.b = numpy.random.uniform(-1, 1, out_channels).astype(x_dtype)
self.x = numpy.random.uniform(
-1, 1, (batch_sz, in_channels, in_h, in_w)).astype(x_dtype)
self.gy = numpy.random.uniform(
-1, 1, (batch_sz, out_channels, out_h, out_w)).astype(x_dtype)
self.should_call_cudnn = True
if self.groups > 1 and cuda.cuda.cudnn.getVersion() < 7000:
self.should_call_cudnn = False
def test_called(self):
with testing.patch(
'cupy.cudnn.convolution_backward_filter', autospec=True) as f:
# cuDNN version >= v3 supports `cudnn_deterministic` option
self._run()
# in Convolution2DFunction.backward_gpu()
assert f.called == self.should_call_cudnn
def test_cudnn_deterministic(self):
x1, W1, b1, y1 = self._run()
x2, W2, b2, y2 = self._run()
cuda.cupy.testing.assert_array_equal(x1.grad, x2.grad)
cuda.cupy.testing.assert_array_equal(y1.data, y2.data)
cuda.cupy.testing.assert_array_equal(W1.grad, W2.grad)
def _contiguous(self, x_data, W_data, b_data, gy_data):
if not self.c_contiguous:
x_data = numpy.asfortranarray(x_data)
W_data = numpy.asfortranarray(W_data)
gy_data = numpy.asfortranarray(gy_data)
self.assertFalse(x_data.flags.c_contiguous)
self.assertFalse(W_data.flags.c_contiguous)
self.assertFalse(gy_data.flags.c_contiguous)
b = numpy.empty((len(b_data) * 2,), dtype=self.b.dtype)
b[::2] = b_data
b_data = b[::2]
self.assertFalse(b_data.flags.c_contiguous)
return x_data, W_data, b_data, gy_data
def _run(self):
with chainer.using_config('use_cudnn', 'always'):
with chainer.using_config('cudnn_deterministic', True):
# verify data continuity and move to gpu
x_data, W_data, b_data, gy_data = tuple(
cuda.to_gpu(data) for data in self._contiguous(
self.x, self.W, self.b, self.gy))
x, W, b, y = self._run_forward(x_data, W_data, b_data)
y.grad = gy_data
y.backward()
return x, W, b, y
def _run_forward(self, x_data, W_data, b_data):
x = chainer.Variable(x_data)
W = chainer.Variable(W_data)
b = None if self.nobias else chainer.Variable(b_data)
y = F.convolution_2d(x, W, b, stride=self.stride, pad=self.pad,
cover_all=False, groups=self.groups)
return x, W, b, y
class TestConvolution2DBackwardNoncontiguousGradOutputs(unittest.TestCase):
# NumPy raises an error when the inputs of dot operation are not
# contiguous. This test ensures this issue is correctly handled.
# (https://github.com/chainer/chainer/issues/2744)
# This test depdends on that backward() of F.sum generates
# a non-contiguous array.
def test_1(self):
n_batches = 2
in_channels = 3
out_channels = 1 # important
x_shape = (n_batches, in_channels, 10, 10)
w_shape = (out_channels, in_channels, 3, 3)
x = numpy.ones(x_shape, numpy.float32)
w = numpy.ones(w_shape, numpy.float32)
y = F.convolution_2d(x, chainer.Variable(w))
z = F.sum(y)
z.backward()
class TestConvolution2DInvalidDilation(unittest.TestCase):
n_batches = 2
in_channels = 3
out_channels = 2
dilate = 0
x_shape = (n_batches, in_channels, 10, 10)
w_shape = (out_channels, in_channels, 3, 3)
def check_invalid_dilation(self, x_data, w_data):
x = chainer.Variable(x_data)
w = chainer.Variable(w_data)
F.convolution_2d(x, w, dilate=self.dilate)
def test_invalid_dilation_cpu(self):
x = numpy.ones(self.x_shape, numpy.float32)
w = numpy.ones(self.w_shape, numpy.float32)
with self.assertRaises(ValueError):
with chainer.using_config('use_ideep', 'never'):
self.check_invalid_dilation(x, w)
@attr.ideep
def test_invalid_dilation_cpu_ideep(self):
x = numpy.ones(self.x_shape, numpy.float32)
w = numpy.ones(self.w_shape, numpy.float32)
with self.assertRaises(ValueError):
with chainer.using_config('use_ideep', 'always'):
self.check_invalid_dilation(x, w)
@attr.gpu
def test_invalid_dilation_gpu(self):
x = cuda.cupy.ones(self.x_shape, numpy.float32)
w = cuda.cupy.ones(self.w_shape, numpy.float32)
with self.assertRaises(ValueError):
with chainer.using_config('use_cudnn', 'never'):
self.check_invalid_dilation(x, w)
@attr.cudnn
def test_invalid_dilation_gpu_cudnn(self):
x = cuda.cupy.ones(self.x_shape, numpy.float32)
w = cuda.cupy.ones(self.w_shape, numpy.float32)
with self.assertRaises(ValueError):
with chainer.using_config('use_cudnn', 'always'):
self.check_invalid_dilation(x, w)
testing.run_module(__name__, __file__)
| okuta/chainer | tests/chainer_tests/functions_tests/connection_tests/test_convolution_2d.py | Python | mit | 12,685 |
'''
Distributed under the MIT License, see accompanying file LICENSE.txt
'''
import tornado.gen
import tornadoredis
import tornado.websocket
class LatestSocket(tornado.websocket.WebSocketHandler):
channel = 'block_channel'
@tornado.gen.engine
def open(self):
self.client = tornadoredis.Client()
self.client.connect()
yield tornado.gen.Task(self.client.subscribe, self.channel)
self.client.listen(self.on_message)
def on_message(self, msg):
if msg.kind == 'message':
self.write_message(msg.body)
if msg.kind == 'disconnect':
self.close()
def on_close(self):
if self.client.subscribed:
self.client.unsubscribe(self.channel)
self.client.disconnect()
def check_origin(self, origin):
return True
class LatestBlockSocket(LatestSocket):
channel = 'block_channel'
class LatestTxSocket(LatestSocket):
channel = 'tx_channel'
| NewEconomyMovement/blockexplorer | handlers/SocketHandler.py | Python | mit | 996 |
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Test for google.protobuf.internal.well_known_types."""
__author__ = 'jieluo@google.com (Jie Luo)'
from datetime import datetime
try:
import unittest2 as unittest #PY26
except ImportError:
import unittest
from google.protobuf import any_pb2
from google.protobuf import duration_pb2
from google.protobuf import field_mask_pb2
from google.protobuf import struct_pb2
from google.protobuf import timestamp_pb2
from google.protobuf import unittest_pb2
from google.protobuf.internal import any_test_pb2
from google.protobuf.internal import test_util
from google.protobuf.internal import well_known_types
from google.protobuf import descriptor
from google.protobuf import text_format
class TimeUtilTestBase(unittest.TestCase):
def CheckTimestampConversion(self, message, text):
self.assertEqual(text, message.ToJsonString())
parsed_message = timestamp_pb2.Timestamp()
parsed_message.FromJsonString(text)
self.assertEqual(message, parsed_message)
def CheckDurationConversion(self, message, text):
self.assertEqual(text, message.ToJsonString())
parsed_message = duration_pb2.Duration()
parsed_message.FromJsonString(text)
self.assertEqual(message, parsed_message)
class TimeUtilTest(TimeUtilTestBase):
def testTimestampSerializeAndParse(self):
message = timestamp_pb2.Timestamp()
# Generated output should contain 3, 6, or 9 fractional digits.
message.seconds = 0
message.nanos = 0
self.CheckTimestampConversion(message, '1970-01-01T00:00:00Z')
message.nanos = 10000000
self.CheckTimestampConversion(message, '1970-01-01T00:00:00.010Z')
message.nanos = 10000
self.CheckTimestampConversion(message, '1970-01-01T00:00:00.000010Z')
message.nanos = 10
self.CheckTimestampConversion(message, '1970-01-01T00:00:00.000000010Z')
# Test min timestamps.
message.seconds = -62135596800
message.nanos = 0
self.CheckTimestampConversion(message, '0001-01-01T00:00:00Z')
# Test max timestamps.
message.seconds = 253402300799
message.nanos = 999999999
self.CheckTimestampConversion(message, '9999-12-31T23:59:59.999999999Z')
# Test negative timestamps.
message.seconds = -1
self.CheckTimestampConversion(message, '1969-12-31T23:59:59.999999999Z')
# Parsing accepts an fractional digits as long as they fit into nano
# precision.
message.FromJsonString('1970-01-01T00:00:00.1Z')
self.assertEqual(0, message.seconds)
self.assertEqual(100000000, message.nanos)
# Parsing accpets offsets.
message.FromJsonString('1970-01-01T00:00:00-08:00')
self.assertEqual(8 * 3600, message.seconds)
self.assertEqual(0, message.nanos)
def testDurationSerializeAndParse(self):
message = duration_pb2.Duration()
# Generated output should contain 3, 6, or 9 fractional digits.
message.seconds = 0
message.nanos = 0
self.CheckDurationConversion(message, '0s')
message.nanos = 10000000
self.CheckDurationConversion(message, '0.010s')
message.nanos = 10000
self.CheckDurationConversion(message, '0.000010s')
message.nanos = 10
self.CheckDurationConversion(message, '0.000000010s')
# Test min and max
message.seconds = 315576000000
message.nanos = 999999999
self.CheckDurationConversion(message, '315576000000.999999999s')
message.seconds = -315576000000
message.nanos = -999999999
self.CheckDurationConversion(message, '-315576000000.999999999s')
# Parsing accepts an fractional digits as long as they fit into nano
# precision.
message.FromJsonString('0.1s')
self.assertEqual(100000000, message.nanos)
message.FromJsonString('0.0000001s')
self.assertEqual(100, message.nanos)
def testTimestampIntegerConversion(self):
message = timestamp_pb2.Timestamp()
message.FromNanoseconds(1)
self.assertEqual('1970-01-01T00:00:00.000000001Z',
message.ToJsonString())
self.assertEqual(1, message.ToNanoseconds())
message.FromNanoseconds(-1)
self.assertEqual('1969-12-31T23:59:59.999999999Z',
message.ToJsonString())
self.assertEqual(-1, message.ToNanoseconds())
message.FromMicroseconds(1)
self.assertEqual('1970-01-01T00:00:00.000001Z',
message.ToJsonString())
self.assertEqual(1, message.ToMicroseconds())
message.FromMicroseconds(-1)
self.assertEqual('1969-12-31T23:59:59.999999Z',
message.ToJsonString())
self.assertEqual(-1, message.ToMicroseconds())
message.FromMilliseconds(1)
self.assertEqual('1970-01-01T00:00:00.001Z',
message.ToJsonString())
self.assertEqual(1, message.ToMilliseconds())
message.FromMilliseconds(-1)
self.assertEqual('1969-12-31T23:59:59.999Z',
message.ToJsonString())
self.assertEqual(-1, message.ToMilliseconds())
message.FromSeconds(1)
self.assertEqual('1970-01-01T00:00:01Z',
message.ToJsonString())
self.assertEqual(1, message.ToSeconds())
message.FromSeconds(-1)
self.assertEqual('1969-12-31T23:59:59Z',
message.ToJsonString())
self.assertEqual(-1, message.ToSeconds())
message.FromNanoseconds(1999)
self.assertEqual(1, message.ToMicroseconds())
# For negative values, Timestamp will be rounded down.
# For example, "1969-12-31T23:59:59.5Z" (i.e., -0.5s) rounded to seconds
# will be "1969-12-31T23:59:59Z" (i.e., -1s) rather than
# "1970-01-01T00:00:00Z" (i.e., 0s).
message.FromNanoseconds(-1999)
self.assertEqual(-2, message.ToMicroseconds())
def testDurationIntegerConversion(self):
message = duration_pb2.Duration()
message.FromNanoseconds(1)
self.assertEqual('0.000000001s',
message.ToJsonString())
self.assertEqual(1, message.ToNanoseconds())
message.FromNanoseconds(-1)
self.assertEqual('-0.000000001s',
message.ToJsonString())
self.assertEqual(-1, message.ToNanoseconds())
message.FromMicroseconds(1)
self.assertEqual('0.000001s',
message.ToJsonString())
self.assertEqual(1, message.ToMicroseconds())
message.FromMicroseconds(-1)
self.assertEqual('-0.000001s',
message.ToJsonString())
self.assertEqual(-1, message.ToMicroseconds())
message.FromMilliseconds(1)
self.assertEqual('0.001s',
message.ToJsonString())
self.assertEqual(1, message.ToMilliseconds())
message.FromMilliseconds(-1)
self.assertEqual('-0.001s',
message.ToJsonString())
self.assertEqual(-1, message.ToMilliseconds())
message.FromSeconds(1)
self.assertEqual('1s', message.ToJsonString())
self.assertEqual(1, message.ToSeconds())
message.FromSeconds(-1)
self.assertEqual('-1s',
message.ToJsonString())
self.assertEqual(-1, message.ToSeconds())
# Test truncation behavior.
message.FromNanoseconds(1999)
self.assertEqual(1, message.ToMicroseconds())
# For negative values, Duration will be rounded towards 0.
message.FromNanoseconds(-1999)
self.assertEqual(-1, message.ToMicroseconds())
def testDatetimeConverison(self):
message = timestamp_pb2.Timestamp()
dt = datetime(1970, 1, 1)
message.FromDatetime(dt)
self.assertEqual(dt, message.ToDatetime())
message.FromMilliseconds(1999)
self.assertEqual(datetime(1970, 1, 1, 0, 0, 1, 999000),
message.ToDatetime())
def testTimedeltaConversion(self):
message = duration_pb2.Duration()
message.FromNanoseconds(1999999999)
td = message.ToTimedelta()
self.assertEqual(1, td.seconds)
self.assertEqual(999999, td.microseconds)
message.FromNanoseconds(-1999999999)
td = message.ToTimedelta()
self.assertEqual(-1, td.days)
self.assertEqual(86398, td.seconds)
self.assertEqual(1, td.microseconds)
message.FromMicroseconds(-1)
td = message.ToTimedelta()
self.assertEqual(-1, td.days)
self.assertEqual(86399, td.seconds)
self.assertEqual(999999, td.microseconds)
converted_message = duration_pb2.Duration()
converted_message.FromTimedelta(td)
self.assertEqual(message, converted_message)
def testInvalidTimestamp(self):
message = timestamp_pb2.Timestamp()
self.assertRaisesRegexp(
ValueError,
'time data \'10000-01-01T00:00:00\' does not match'
' format \'%Y-%m-%dT%H:%M:%S\'',
message.FromJsonString, '10000-01-01T00:00:00.00Z')
self.assertRaisesRegexp(
well_known_types.ParseError,
'nanos 0123456789012 more than 9 fractional digits.',
message.FromJsonString,
'1970-01-01T00:00:00.0123456789012Z')
self.assertRaisesRegexp(
well_known_types.ParseError,
(r'Invalid timezone offset value: \+08.'),
message.FromJsonString,
'1972-01-01T01:00:00.01+08',)
self.assertRaisesRegexp(
ValueError,
'year is out of range',
message.FromJsonString,
'0000-01-01T00:00:00Z')
message.seconds = 253402300800
self.assertRaisesRegexp(
OverflowError,
'date value out of range',
message.ToJsonString)
def testInvalidDuration(self):
message = duration_pb2.Duration()
self.assertRaisesRegexp(
well_known_types.ParseError,
'Duration must end with letter "s": 1.',
message.FromJsonString, '1')
self.assertRaisesRegexp(
well_known_types.ParseError,
'Couldn\'t parse duration: 1...2s.',
message.FromJsonString, '1...2s')
class FieldMaskTest(unittest.TestCase):
def testStringFormat(self):
mask = field_mask_pb2.FieldMask()
self.assertEqual('', mask.ToJsonString())
mask.paths.append('foo')
self.assertEqual('foo', mask.ToJsonString())
mask.paths.append('bar')
self.assertEqual('foo,bar', mask.ToJsonString())
mask.FromJsonString('')
self.assertEqual('', mask.ToJsonString())
mask.FromJsonString('foo')
self.assertEqual(['foo'], mask.paths)
mask.FromJsonString('foo,bar')
self.assertEqual(['foo', 'bar'], mask.paths)
def testDescriptorToFieldMask(self):
mask = field_mask_pb2.FieldMask()
msg_descriptor = unittest_pb2.TestAllTypes.DESCRIPTOR
mask.AllFieldsFromDescriptor(msg_descriptor)
self.assertEqual(75, len(mask.paths))
self.assertTrue(mask.IsValidForDescriptor(msg_descriptor))
for field in msg_descriptor.fields:
self.assertTrue(field.name in mask.paths)
mask.paths.append('optional_nested_message.bb')
self.assertTrue(mask.IsValidForDescriptor(msg_descriptor))
mask.paths.append('repeated_nested_message.bb')
self.assertFalse(mask.IsValidForDescriptor(msg_descriptor))
def testCanonicalFrom(self):
mask = field_mask_pb2.FieldMask()
out_mask = field_mask_pb2.FieldMask()
# Paths will be sorted.
mask.FromJsonString('baz.quz,bar,foo')
out_mask.CanonicalFormFromMask(mask)
self.assertEqual('bar,baz.quz,foo', out_mask.ToJsonString())
# Duplicated paths will be removed.
mask.FromJsonString('foo,bar,foo')
out_mask.CanonicalFormFromMask(mask)
self.assertEqual('bar,foo', out_mask.ToJsonString())
# Sub-paths of other paths will be removed.
mask.FromJsonString('foo.b1,bar.b1,foo.b2,bar')
out_mask.CanonicalFormFromMask(mask)
self.assertEqual('bar,foo.b1,foo.b2', out_mask.ToJsonString())
# Test more deeply nested cases.
mask.FromJsonString(
'foo.bar.baz1,foo.bar.baz2.quz,foo.bar.baz2')
out_mask.CanonicalFormFromMask(mask)
self.assertEqual('foo.bar.baz1,foo.bar.baz2',
out_mask.ToJsonString())
mask.FromJsonString(
'foo.bar.baz1,foo.bar.baz2,foo.bar.baz2.quz')
out_mask.CanonicalFormFromMask(mask)
self.assertEqual('foo.bar.baz1,foo.bar.baz2',
out_mask.ToJsonString())
mask.FromJsonString(
'foo.bar.baz1,foo.bar.baz2,foo.bar.baz2.quz,foo.bar')
out_mask.CanonicalFormFromMask(mask)
self.assertEqual('foo.bar', out_mask.ToJsonString())
mask.FromJsonString(
'foo.bar.baz1,foo.bar.baz2,foo.bar.baz2.quz,foo')
out_mask.CanonicalFormFromMask(mask)
self.assertEqual('foo', out_mask.ToJsonString())
def testUnion(self):
mask1 = field_mask_pb2.FieldMask()
mask2 = field_mask_pb2.FieldMask()
out_mask = field_mask_pb2.FieldMask()
mask1.FromJsonString('foo,baz')
mask2.FromJsonString('bar,quz')
out_mask.Union(mask1, mask2)
self.assertEqual('bar,baz,foo,quz', out_mask.ToJsonString())
# Overlap with duplicated paths.
mask1.FromJsonString('foo,baz.bb')
mask2.FromJsonString('baz.bb,quz')
out_mask.Union(mask1, mask2)
self.assertEqual('baz.bb,foo,quz', out_mask.ToJsonString())
# Overlap with paths covering some other paths.
mask1.FromJsonString('foo.bar.baz,quz')
mask2.FromJsonString('foo.bar,bar')
out_mask.Union(mask1, mask2)
self.assertEqual('bar,foo.bar,quz', out_mask.ToJsonString())
def testIntersect(self):
mask1 = field_mask_pb2.FieldMask()
mask2 = field_mask_pb2.FieldMask()
out_mask = field_mask_pb2.FieldMask()
# Test cases without overlapping.
mask1.FromJsonString('foo,baz')
mask2.FromJsonString('bar,quz')
out_mask.Intersect(mask1, mask2)
self.assertEqual('', out_mask.ToJsonString())
# Overlap with duplicated paths.
mask1.FromJsonString('foo,baz.bb')
mask2.FromJsonString('baz.bb,quz')
out_mask.Intersect(mask1, mask2)
self.assertEqual('baz.bb', out_mask.ToJsonString())
# Overlap with paths covering some other paths.
mask1.FromJsonString('foo.bar.baz,quz')
mask2.FromJsonString('foo.bar,bar')
out_mask.Intersect(mask1, mask2)
self.assertEqual('foo.bar.baz', out_mask.ToJsonString())
mask1.FromJsonString('foo.bar,bar')
mask2.FromJsonString('foo.bar.baz,quz')
out_mask.Intersect(mask1, mask2)
self.assertEqual('foo.bar.baz', out_mask.ToJsonString())
def testMergeMessage(self):
# Test merge one field.
src = unittest_pb2.TestAllTypes()
test_util.SetAllFields(src)
for field in src.DESCRIPTOR.fields:
if field.containing_oneof:
continue
field_name = field.name
dst = unittest_pb2.TestAllTypes()
# Only set one path to mask.
mask = field_mask_pb2.FieldMask()
mask.paths.append(field_name)
mask.MergeMessage(src, dst)
# The expected result message.
msg = unittest_pb2.TestAllTypes()
if field.label == descriptor.FieldDescriptor.LABEL_REPEATED:
repeated_src = getattr(src, field_name)
repeated_msg = getattr(msg, field_name)
if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:
for item in repeated_src:
repeated_msg.add().CopyFrom(item)
else:
repeated_msg.extend(repeated_src)
elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:
getattr(msg, field_name).CopyFrom(getattr(src, field_name))
else:
setattr(msg, field_name, getattr(src, field_name))
# Only field specified in mask is merged.
self.assertEqual(msg, dst)
# Test merge nested fields.
nested_src = unittest_pb2.NestedTestAllTypes()
nested_dst = unittest_pb2.NestedTestAllTypes()
nested_src.child.payload.optional_int32 = 1234
nested_src.child.child.payload.optional_int32 = 5678
mask = field_mask_pb2.FieldMask()
mask.FromJsonString('child.payload')
mask.MergeMessage(nested_src, nested_dst)
self.assertEqual(1234, nested_dst.child.payload.optional_int32)
self.assertEqual(0, nested_dst.child.child.payload.optional_int32)
mask.FromJsonString('child.child.payload')
mask.MergeMessage(nested_src, nested_dst)
self.assertEqual(1234, nested_dst.child.payload.optional_int32)
self.assertEqual(5678, nested_dst.child.child.payload.optional_int32)
nested_dst.Clear()
mask.FromJsonString('child.child.payload')
mask.MergeMessage(nested_src, nested_dst)
self.assertEqual(0, nested_dst.child.payload.optional_int32)
self.assertEqual(5678, nested_dst.child.child.payload.optional_int32)
nested_dst.Clear()
mask.FromJsonString('child')
mask.MergeMessage(nested_src, nested_dst)
self.assertEqual(1234, nested_dst.child.payload.optional_int32)
self.assertEqual(5678, nested_dst.child.child.payload.optional_int32)
# Test MergeOptions.
nested_dst.Clear()
nested_dst.child.payload.optional_int64 = 4321
# Message fields will be merged by default.
mask.FromJsonString('child.payload')
mask.MergeMessage(nested_src, nested_dst)
self.assertEqual(1234, nested_dst.child.payload.optional_int32)
self.assertEqual(4321, nested_dst.child.payload.optional_int64)
# Change the behavior to replace message fields.
mask.FromJsonString('child.payload')
mask.MergeMessage(nested_src, nested_dst, True, False)
self.assertEqual(1234, nested_dst.child.payload.optional_int32)
self.assertEqual(0, nested_dst.child.payload.optional_int64)
# By default, fields missing in source are not cleared in destination.
nested_dst.payload.optional_int32 = 1234
self.assertTrue(nested_dst.HasField('payload'))
mask.FromJsonString('payload')
mask.MergeMessage(nested_src, nested_dst)
self.assertTrue(nested_dst.HasField('payload'))
# But they are cleared when replacing message fields.
nested_dst.Clear()
nested_dst.payload.optional_int32 = 1234
mask.FromJsonString('payload')
mask.MergeMessage(nested_src, nested_dst, True, False)
self.assertFalse(nested_dst.HasField('payload'))
nested_src.payload.repeated_int32.append(1234)
nested_dst.payload.repeated_int32.append(5678)
# Repeated fields will be appended by default.
mask.FromJsonString('payload.repeated_int32')
mask.MergeMessage(nested_src, nested_dst)
self.assertEqual(2, len(nested_dst.payload.repeated_int32))
self.assertEqual(5678, nested_dst.payload.repeated_int32[0])
self.assertEqual(1234, nested_dst.payload.repeated_int32[1])
# Change the behavior to replace repeated fields.
mask.FromJsonString('payload.repeated_int32')
mask.MergeMessage(nested_src, nested_dst, False, True)
self.assertEqual(1, len(nested_dst.payload.repeated_int32))
self.assertEqual(1234, nested_dst.payload.repeated_int32[0])
class StructTest(unittest.TestCase):
def testStruct(self):
struct = struct_pb2.Struct()
struct_class = struct.__class__
struct['key1'] = 5
struct['key2'] = 'abc'
struct['key3'] = True
struct.get_or_create_struct('key4')['subkey'] = 11.0
struct_list = struct.get_or_create_list('key5')
struct_list.extend([6, 'seven', True, False, None])
struct_list.add_struct()['subkey2'] = 9
self.assertTrue(isinstance(struct, well_known_types.Struct))
self.assertEquals(5, struct['key1'])
self.assertEquals('abc', struct['key2'])
self.assertIs(True, struct['key3'])
self.assertEquals(11, struct['key4']['subkey'])
inner_struct = struct_class()
inner_struct['subkey2'] = 9
self.assertEquals([6, 'seven', True, False, None, inner_struct],
list(struct['key5'].items()))
serialized = struct.SerializeToString()
struct2 = struct_pb2.Struct()
struct2.ParseFromString(serialized)
self.assertEquals(struct, struct2)
self.assertTrue(isinstance(struct2, well_known_types.Struct))
self.assertEquals(5, struct2['key1'])
self.assertEquals('abc', struct2['key2'])
self.assertIs(True, struct2['key3'])
self.assertEquals(11, struct2['key4']['subkey'])
self.assertEquals([6, 'seven', True, False, None, inner_struct],
list(struct2['key5'].items()))
struct_list = struct2['key5']
self.assertEquals(6, struct_list[0])
self.assertEquals('seven', struct_list[1])
self.assertEquals(True, struct_list[2])
self.assertEquals(False, struct_list[3])
self.assertEquals(None, struct_list[4])
self.assertEquals(inner_struct, struct_list[5])
struct_list[1] = 7
self.assertEquals(7, struct_list[1])
struct_list.add_list().extend([1, 'two', True, False, None])
self.assertEquals([1, 'two', True, False, None],
list(struct_list[6].items()))
text_serialized = str(struct)
struct3 = struct_pb2.Struct()
text_format.Merge(text_serialized, struct3)
self.assertEquals(struct, struct3)
struct.get_or_create_struct('key3')['replace'] = 12
self.assertEquals(12, struct['key3']['replace'])
class AnyTest(unittest.TestCase):
def testAnyMessage(self):
# Creates and sets message.
msg = any_test_pb2.TestAny()
msg_descriptor = msg.DESCRIPTOR
all_types = unittest_pb2.TestAllTypes()
all_descriptor = all_types.DESCRIPTOR
all_types.repeated_string.append(u'\u00fc\ua71f')
# Packs to Any.
msg.value.Pack(all_types)
self.assertEqual(msg.value.type_url,
'type.googleapis.com/%s' % all_descriptor.full_name)
self.assertEqual(msg.value.value,
all_types.SerializeToString())
# Tests Is() method.
self.assertTrue(msg.value.Is(all_descriptor))
self.assertFalse(msg.value.Is(msg_descriptor))
# Unpacks Any.
unpacked_message = unittest_pb2.TestAllTypes()
self.assertTrue(msg.value.Unpack(unpacked_message))
self.assertEqual(all_types, unpacked_message)
# Unpacks to different type.
self.assertFalse(msg.value.Unpack(msg))
# Only Any messages have Pack method.
try:
msg.Pack(all_types)
except AttributeError:
pass
else:
raise AttributeError('%s should not have Pack method.' %
msg_descriptor.full_name)
def testMessageName(self):
# Creates and sets message.
submessage = any_test_pb2.TestAny()
submessage.int_value = 12345
msg = any_pb2.Any()
msg.Pack(submessage)
self.assertEqual(msg.TypeName(), 'google.protobuf.internal.TestAny')
def testPackWithCustomTypeUrl(self):
submessage = any_test_pb2.TestAny()
submessage.int_value = 12345
msg = any_pb2.Any()
# Pack with a custom type URL prefix.
msg.Pack(submessage, 'type.myservice.com')
self.assertEqual(msg.type_url,
'type.myservice.com/%s' % submessage.DESCRIPTOR.full_name)
# Pack with a custom type URL prefix ending with '/'.
msg.Pack(submessage, 'type.myservice.com/')
self.assertEqual(msg.type_url,
'type.myservice.com/%s' % submessage.DESCRIPTOR.full_name)
# Pack with an empty type URL prefix.
msg.Pack(submessage, '')
self.assertEqual(msg.type_url,
'/%s' % submessage.DESCRIPTOR.full_name)
# Test unpacking the type.
unpacked_message = any_test_pb2.TestAny()
self.assertTrue(msg.Unpack(unpacked_message))
self.assertEqual(submessage, unpacked_message)
if __name__ == '__main__':
unittest.main()
| danakj/chromium | third_party/protobuf/python/google/protobuf/internal/well_known_types_test.py | Python | bsd-3-clause | 24,651 |
# -*- coding: utf-8 -*-
"""
Tests for auth manager PKI access to postgres.
This is an integration test for QGIS Desktop Auth Manager postgres provider that
checks if QGIS can use a stored auth manager auth configuration to access
a PKI protected postgres.
From build dir, run: ctest -R PyQgsAuthManagerPKIPostgresTest -V
It uses a docker container as postgres/postgis server with certificates from tests/testdata/auth_system/certs_keys_2048
Use docker-compose -f .docker/docker-compose-testing-postgres.yml up postgres to start the server.
TODO:
- Document how to restore the server data
- Document how to use docker inspect to find the IP of the docker postgres server and set a host alias (or some other smart idea to do the same)
.. note:: This program 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) any later version.
"""
import os
import time
import signal
import stat
import subprocess
import tempfile
import glob
from shutil import rmtree
from utilities import unitTestDataPath
from qgis.core import (
QgsApplication,
QgsAuthManager,
QgsAuthMethodConfig,
QgsVectorLayer,
QgsDataSourceUri,
QgsWkbTypes,
)
from qgis.PyQt.QtNetwork import QSslCertificate
from qgis.PyQt.QtCore import QFile
from qgis.testing import (
start_app,
unittest,
)
__author__ = 'Alessandro Pasotti'
__date__ = '25/10/2016'
__copyright__ = 'Copyright 2016, The QGIS Project'
qgis_app = start_app()
class TestAuthManager(unittest.TestCase):
@classmethod
def setUpAuth(cls):
"""Run before all tests and set up authentication"""
authm = QgsApplication.authManager()
assert (authm.setMasterPassword('masterpassword', True))
# Client side
cls.sslrootcert_path = os.path.join(cls.certsdata_path, 'qgis_ca.crt')
cls.sslcert = os.path.join(cls.certsdata_path, 'docker.crt')
cls.sslkey = os.path.join(cls.certsdata_path, 'docker.key')
assert os.path.isfile(cls.sslcert)
assert os.path.isfile(cls.sslkey)
assert os.path.isfile(cls.sslrootcert_path)
os.chmod(cls.sslcert, stat.S_IRUSR)
os.chmod(cls.sslkey, stat.S_IRUSR)
os.chmod(cls.sslrootcert_path, stat.S_IRUSR)
cls.auth_config = QgsAuthMethodConfig("PKI-Paths")
cls.auth_config.setConfig('certpath', cls.sslcert)
cls.auth_config.setConfig('keypath', cls.sslkey)
cls.auth_config.setName('test_pki_auth_config')
cls.pg_user = 'docker'
cls.pg_pass = 'docker'
cls.pg_host = 'postgres'
cls.pg_port = '5432'
cls.pg_dbname = 'qgis_test'
cls.sslrootcert = QSslCertificate.fromPath(cls.sslrootcert_path)
assert cls.sslrootcert is not None
authm.storeCertAuthorities(cls.sslrootcert)
authm.rebuildCaCertsCache()
authm.rebuildTrustedCaCertsCache()
authm.rebuildCertTrustCache()
assert (authm.storeAuthenticationConfig(cls.auth_config)[0])
assert cls.auth_config.isValid()
@classmethod
def setUpClass(cls):
"""Run before all tests:
Creates an auth configuration"""
cls.certsdata_path = os.path.join(unitTestDataPath('auth_system'), 'certs_keys_2048')
cls.setUpAuth()
@classmethod
def tearDownClass(cls):
"""Run after all tests"""
super().tearDownClass()
def setUp(self):
"""Run before each test."""
super().setUp()
def tearDown(self):
"""Run after each test."""
super().tearDown()
@classmethod
def _getPostGISLayer(cls, type_name, layer_name=None, authcfg=None):
"""
PG layer factory
"""
if layer_name is None:
layer_name = 'pg_' + type_name
uri = QgsDataSourceUri()
uri.setWkbType(QgsWkbTypes.Point)
uri.setConnection(cls.pg_host, cls.pg_port, cls.pg_dbname, cls.pg_user, cls.pg_pass, QgsDataSourceUri.SslVerifyFull, authcfg)
uri.setKeyColumn('pk')
uri.setSrid('EPSG:4326')
uri.setDataSource('qgis_test', 'someData', "geom", "", "pk")
# Note: do not expand here!
layer = QgsVectorLayer(uri.uri(False), layer_name, 'postgres')
return layer
def testValidAuthAccess(self):
"""
Access the protected layer with valid credentials
"""
pg_layer = self._getPostGISLayer('testlayer_èé', authcfg=self.auth_config.id())
self.assertTrue(pg_layer.isValid())
def testInvalidAuthAccess(self):
"""
Access the protected layer with not valid credentials
"""
pg_layer = self._getPostGISLayer('testlayer_èé')
self.assertFalse(pg_layer.isValid())
def testRemoveTemporaryCerts(self):
"""
Check that no temporary cert remain after connection with
postgres provider
"""
def cleanTempPki():
pkies = glob.glob(os.path.join(tempfile.gettempdir(), 'tmp*_{*}.pem'))
for fn in pkies:
f = QFile(fn)
f.setPermissions(QFile.WriteOwner)
f.remove()
# remove any temppki in temporary path to check that no
# other pki remain after connection
cleanTempPki()
# connect using postgres provider
pg_layer = self._getPostGISLayer('testlayer_èé', authcfg=self.auth_config.id())
self.assertTrue(pg_layer.isValid())
# do test no certs remained
pkies = glob.glob(os.path.join(tempfile.gettempdir(), 'tmp*_{*}.pem'))
self.assertEqual(len(pkies), 0)
if __name__ == '__main__':
unittest.main()
| gacarrillor/QGIS | tests/src/python/test_authmanager_pki_postgres.py | Python | gpl-2.0 | 5,746 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# iPhone Application Script
#
import os,sys,shutil
template_dir = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
sys.path.append(os.path.join(template_dir,'../'))
from tiapp import *
from projector import *
class IPhone(object):
def __init__(self,name,appid):
self.name = name
self.id = appid
def create(self,dir,release=False):
if release:
project_dir = dir
iphone_dir = dir
else:
project_dir = os.path.join(dir,self.name)
iphone_dir = os.path.join(project_dir,'build','iphone')
if not os.path.exists(project_dir):
os.makedirs(project_dir)
if not os.path.exists(iphone_dir):
os.makedirs(iphone_dir)
version = os.path.basename(os.path.abspath(os.path.join(template_dir,'../')))
project = Projector(self.name,version,template_dir,project_dir,self.id)
project.create(template_dir,iphone_dir)
iphone_project_resources = os.path.join(project_dir,'Resources','iphone')
if os.path.exists(iphone_project_resources):
shutil.rmtree(iphone_project_resources)
shutil.copytree(os.path.join(template_dir,'resources'),iphone_project_resources)
plist = open(os.path.join(template_dir,'Info.plist'),'r').read()
# Sometimes we actually need app properties!
tiapp = TiAppXML(os.path.join(project_dir,'tiapp.xml'))
if not release:
plist = plist.replace('__PROJECT_NAME__',self.name)
plist = plist.replace('__PROJECT_ID__',self.id)
plist = plist.replace('__URL__',self.id)
urlscheme = self.name.replace('.','_').replace(' ','').lower()
plist = plist.replace('__URLSCHEME__',urlscheme)
if ti.has_app_property('ti.facebook.appid'):
fbid = ti.get_app_property('ti.facebook.appid')
plist = plist.replace('__ADDITIONAL_URL_SCHEMES__', '<string>fb%s</string>' % fbid)
else:
plist = plist.replace('__ADDITIONAL_URL_SCHEMES__','')
out_plist = open(os.path.join(iphone_dir,'Info.plist'),'w')
out_plist.write(plist)
out_plist.close()
# NOTE: right now we leave this in since the pre-1.3 releases required it
# and only wrote on project create
out_plist = open(os.path.join(iphone_dir,'Info.plist.template'),'w')
out_plist.write(plist)
out_plist.close()
# create the iphone resources
iphone_resources_dir = os.path.join(iphone_dir,'Resources')
if not os.path.exists(iphone_resources_dir):
os.makedirs(iphone_resources_dir)
# copy main.m to iphone directory
main_template = open(os.path.join(template_dir,'main.m'),'r').read()
# write .gitignore
gitignore = open(os.path.join(iphone_dir,'.gitignore'),'w')
# exclude generated files
for i in ["Classes","tmp","build","headers","lib","Resources","*.xcodeproj","*.xcconfig","main.m","*.plist","*.pch"]:
gitignore.write("%s\n" % i)
gitignore.close()
gitignore = open(os.path.join(iphone_dir,'%s.xcodeproj'%self.name,'.gitignore'),'w')
# exclude generated files
gitignore.write("*.pbxuser\n")
gitignore.write("*.pbxproj\n")
gitignore.write("*.perspectivev3\n")
gitignore.close()
gitignore = open(os.path.join(iphone_dir,'Resources','.gitignore'),'w')
# exclude generated files
gitignore.write(".simulator\n")
gitignore.write("libTiCore.a\n")
gitignore.write("libTitanium.a\n")
gitignore.close()
gitignore = open(os.path.join(iphone_dir,'lib','.gitignore'),'w')
# exclude lib since it's dynamic
gitignore.write("libTiCore.a\n")
gitignore.close()
main_dest = open(os.path.join(iphone_dir,'main.m'),'w')
main_dest.write(main_template)
main_dest.close()
# copy over the entitlements for distribution
if not release:
shutil.copy(os.path.join(template_dir,'Entitlements.plist'),iphone_resources_dir)
# copy README to iphone directory
shutil.copy(os.path.join(template_dir,'README'),os.path.join(iphone_dir,'README'))
# symlink
libticore = os.path.join(template_dir,'libTiCore.a')
libtiverify = os.path.join(template_dir,'libtiverify.a')
cwd = os.getcwd()
os.chdir(os.path.join(iphone_dir,'lib'))
os.symlink(libticore,"libTiCore.a")
# small, just copy
shutil.copy(libtiverify,"libtiverify.a")
os.chdir(cwd)
if __name__ == '__main__':
# this is for testing only for the time being
if len(sys.argv) != 4 or sys.argv[1]=='--help':
print "Usage: %s <name> <id> <directory>" % os.path.basename(sys.argv[0])
sys.exit(1)
iphone = IPhone(sys.argv[1],sys.argv[2])
iphone.create(sys.argv[3])
| arnaudsj/titanium_mobile | support/iphone/iphone.py | Python | apache-2.0 | 4,434 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.paging import Paged
class SchedulePaged(Paged):
"""
A paging container for iterating over a list of Schedule object
"""
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[Schedule]'}
}
def __init__(self, *args, **kwargs):
super(SchedulePaged, self).__init__(*args, **kwargs)
| v-iam/azure-sdk-for-python | azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/schedule_paged.py | Python | mit | 874 |
class WhitespaceTokenizer(object):
def tokenize(self, text):
return text.split()
| kreuks/liven | nlp/tokenizers/whitespace_tokenizer.py | Python | apache-2.0 | 93 |
# -*- coding: utf-8 -*-
# File: base.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com>
from abc import ABCMeta, abstractmethod
import signal
import re
from six.moves import range
import tqdm
import tensorflow as tf
from .config import TrainConfig
from ..utils import *
from ..utils.timer import *
from ..utils.concurrency import start_proc_mask_signal
from ..callbacks import StatHolder
from ..tfutils import *
from ..tfutils.summary import create_summary
__all__ = ['Trainer']
class Trainer(object):
"""
Base class for a trainer.
Available Attritbutes:
stat_holder: a `StatHolder` instance
summary_writer: a `tf.SummaryWriter`
config: a `TrainConfig`
model: a `ModelDesc`
global_step: a `int`
"""
__metaclass__ = ABCMeta
def __init__(self, config):
"""
:param config: a `TrainConfig` instance
"""
assert isinstance(config, TrainConfig), type(config)
self.config = config
self.model = config.model
self.model.get_input_vars() # ensure they are present
self._extra_threads_procs = config.extra_threads_procs
@abstractmethod
def train(self):
""" Start training"""
pass
@abstractmethod
def run_step(self):
""" run an iteration"""
pass
@abstractmethod
def get_predict_func(self, input_names, output_names):
""" return a online predictor"""
pass
def get_predict_funcs(self, input_names, output_names, n):
""" return n predictor functions.
Can be overwritten by subclasses to exploit more
parallelism among funcs.
"""
return [self.get_predict_func(input_names, output_names) for k in range(n)]
def trigger_epoch(self):
self._trigger_epoch()
self.config.callbacks.trigger_epoch()
self.summary_writer.flush()
@abstractmethod
def _trigger_epoch(self):
""" This is called right after all steps in an epoch are finished"""
pass
def _init_summary(self):
if not hasattr(logger, 'LOG_DIR'):
raise RuntimeError("Please use logger.set_logger_dir at the beginning of your script.")
self.summary_writer = tf.train.SummaryWriter(
logger.LOG_DIR, graph=self.sess.graph)
self.summary_op = tf.merge_all_summaries()
# create an empty StatHolder
self.stat_holder = StatHolder(logger.LOG_DIR)
# save global_step in stat.json, but don't print it
self.stat_holder.add_blacklist_tag(['global_step'])
def _process_summary(self, summary_str):
summary = tf.Summary.FromString(summary_str)
for val in summary.value:
if val.WhichOneof('value') == 'simple_value':
val.tag = re.sub('tower[p0-9]+/', '', val.tag) # TODO move to subclasses
self.stat_holder.add_stat(val.tag, val.simple_value)
self.summary_writer.add_summary(summary, self.global_step)
def write_scalar_summary(self, name, val):
self.summary_writer.add_summary(
create_summary(name, val),
get_global_step())
self.stat_holder.add_stat(name, val)
def main_loop(self):
# some final operations that might modify the graph
self._init_summary()
get_global_step_var() # ensure there is such var, before finalizing the graph
logger.info("Setup callbacks ...")
callbacks = self.config.callbacks
callbacks.setup_graph(self) # TODO use weakref instead?
logger.info("Initializing graph variables ...")
self.sess.run(tf.initialize_all_variables())
self.config.session_init.init(self.sess)
tf.get_default_graph().finalize()
self._start_concurrency()
with self.sess.as_default():
try:
self.global_step = get_global_step()
logger.info("Start training with global_step={}".format(self.global_step))
callbacks.before_train()
for epoch in range(self.config.starting_epoch, self.config.max_epoch+1):
with timed_operation(
'Epoch {}, global_step={}'.format(
epoch, self.global_step + self.config.step_per_epoch)):
for step in tqdm.trange(
self.config.step_per_epoch,
**get_tqdm_kwargs(leave=True)):
if self.coord.should_stop():
return
self.run_step()
#callbacks.trigger_step() # not useful?
self.global_step += 1
self.trigger_epoch()
except (KeyboardInterrupt, Exception):
raise
finally:
# Do I need to run queue.close?
callbacks.after_train()
self.coord.request_stop()
self.summary_writer.close()
self.sess.close()
def init_session_and_coord(self):
self.sess = tf.Session(config=self.config.session_config)
self.coord = tf.train.Coordinator()
def _start_concurrency(self):
"""
Run all threads before starting training
"""
logger.info("Starting all threads & procs ...")
tf.train.start_queue_runners(
sess=self.sess, coord=self.coord, daemon=True, start=True)
with self.sess.as_default():
# avoid sigint get handled by other processes
start_proc_mask_signal(self._extra_threads_procs)
def process_grads(self, grads):
g = []
for grad, var in grads:
if grad is None:
logger.warn("No Gradient w.r.t {}".format(var.op.name))
else:
g.append((grad, var))
procs = self.config.model.get_gradient_processor()
for proc in procs:
g = proc.process(g)
return g
| czhu95/ternarynet | tensorpack/train/base.py | Python | apache-2.0 | 6,036 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "expense_track.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| zheli/simple-expense | manage.py | Python | apache-2.0 | 256 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Brainly.com sp. z o.o.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
from setuptools import setup
setup(name='check_zonesync',
version='1',
author='Pawel Rozlach',
author_email='pawel.rozlach@brainly.com',
license='ASF2.0',
url='https://github.com/brainly/check_zonesync',
description='Zone replication synchronization check',
packages=['check_zonesync'],
scripts=['bin/check-zonesync'],
)
| brainly/check-zonesync | setup.py | Python | apache-2.0 | 1,009 |
"""Abstraction of an OF table."""
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2017 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import hashlib
import struct
from faucet import valve_of
class ValveTable(object):
"""Wrapper for an OpenFlow table."""
def __init__(self, table_id, name, restricted_match_types,
flow_cookie, notify_flow_removed=False):
self.table_id = table_id
self.name = name
self.restricted_match_types = None
if restricted_match_types:
self.restricted_match_types = set(restricted_match_types)
self.flow_cookie = flow_cookie
self.notify_flow_removed = notify_flow_removed
def match(self, in_port=None, vlan=None,
eth_type=None, eth_src=None,
eth_dst=None, eth_dst_mask=None,
ipv6_nd_target=None, icmpv6_type=None,
nw_proto=None, nw_src=None, nw_dst=None):
"""Compose an OpenFlow match rule."""
match_dict = valve_of.build_match_dict(
in_port, vlan, eth_type, eth_src,
eth_dst, eth_dst_mask, ipv6_nd_target, icmpv6_type,
nw_proto, nw_src, nw_dst)
match = valve_of.match(match_dict)
if self.restricted_match_types is not None:
for match_type in match_dict:
assert match_type in self.restricted_match_types, '%s match in table %s' % (
match_type, self.name)
return match
def flowmod(self, match=None, priority=None,
inst=None, command=valve_of.ofp.OFPFC_ADD, out_port=0,
out_group=0, hard_timeout=0, idle_timeout=0):
"""Helper function to construct a flow mod message with cookie."""
if match is None:
match = self.match()
if priority is None:
priority = 0 # self.dp.lowest_priority
if inst is None:
inst = []
flags = 0
if self.notify_flow_removed:
flags = valve_of.ofp.OFPFF_SEND_FLOW_REM
return valve_of.flowmod(
self.flow_cookie,
command,
self.table_id,
priority,
out_port,
out_group,
match,
inst,
hard_timeout,
idle_timeout,
flags)
def flowdel(self, match=None, priority=None, out_port=valve_of.ofp.OFPP_ANY, strict=False):
"""Delete matching flows from a table."""
command = valve_of.ofp.OFPFC_DELETE
if strict:
command = valve_of.ofp.OFPFC_DELETE_STRICT
return [
self.flowmod(
match=match,
priority=priority,
command=command,
out_port=out_port,
out_group=valve_of.ofp.OFPG_ANY)]
def flowdrop(self, match=None, priority=None, hard_timeout=0):
"""Add drop matching flow to a table."""
return self.flowmod(
match=match,
priority=priority,
hard_timeout=hard_timeout,
inst=[])
def flowcontroller(self, match=None, priority=None, inst=None, max_len=96):
"""Add flow outputting to controller."""
if inst is None:
inst = []
return self.flowmod(
match=match,
priority=priority,
inst=[valve_of.apply_actions(
[valve_of.output_controller(max_len)])] + inst)
class ValveGroupEntry(object):
"""Abstraction for a single OpenFlow group entry."""
def __init__(self, table, group_id, buckets):
self.table = table
self.group_id = group_id
self.update_buckets(buckets)
def update_buckets(self, buckets):
self.buckets = tuple(buckets)
def add(self):
"""Return flows to add this entry to the group table."""
ofmsgs = []
ofmsgs.append(self.delete())
ofmsgs.append(valve_of.groupadd(
group_id=self.group_id, buckets=self.buckets))
self.table.entries[self.group_id] = self
return ofmsgs
def modify(self):
"""Return flow to modify an existing group entry."""
assert self.group_id in self.table.entries
self.table.entries[self.group_id] = self
return valve_of.groupmod(group_id=self.group_id, buckets=self.buckets)
def delete(self):
"""Return flow to delete an existing group entry."""
if self.group_id in self.table.entries:
del self.table.entries[self.group_id]
return valve_of.groupdel(group_id=self.group_id)
class ValveGroupTable(object):
"""Wrap access to group table."""
entries = {}
@staticmethod
def group_id_from_str(key_str):
"""Return a group ID based on a string key."""
# TODO: does not handle collisions
digest = hashlib.sha256(key_str.encode('utf-8')).digest()
return struct.unpack('<L', digest[:4])[0]
def get_entry(self, group_id, buckets):
if group_id in self.entries:
self.entries[group_id].update_buckets(buckets)
else:
self.entries[group_id] = ValveGroupEntry(
self, group_id, buckets)
return self.entries[group_id]
def delete_all(self):
"""Delete all groups."""
self.entries = {}
return valve_of.groupdel()
| byllyfish/faucet | faucet/valve_table.py | Python | apache-2.0 | 5,959 |
"""
Commands for running the examples files in various ways.
Like a Makefile: contains a list of targets (and groups of targets)
that specify various commands to run.
E.g.
topographica -c 'from topo.misc.genexamples import generate; generate(targets=["all_quick","saved_examples"])'
Runs the 'all_quick' target if called without any arguments:
topographica -c 'from topo.misc.genexamples import generate; generate()'
To add new single targets, add to the targets dictionary;
for groups of targets, add to the group_targets dictionary.
$Id$
"""
__version__='$Revision$'
# JABALERT: Should be cut down and simplified; most of what it does is
# for historical rather than functional reasons. E.g. the quick
# options should be in the tests, rather than here, and then the other
# options need not specify how long they should be run; instead that
# should be set by a parameter in the .ty file and then respected by
# this file. The .ty file could also specify a set of default
# analysis functions to run, e.g. selecting from some options to be
# made available in topo.command.basic, and if so this file need not
# have any handling for specific scripts. Meanwhile, at least it works.
# Note: has none of the Makefile's dependency processing, so just does
# what you tell it (i.e. over-writes existing files).
import sys
import os.path
from os import system
import param
from param import ParamOverrides
### Convenience functions
def snapshot(filename):
"""Return a command for saving a snapshot named filename."""
return "from topo.command.basic import save_snapshot ; save_snapshot('%s')"%filename
def or_analysis():
"""Return a command for orientation analysis."""
return """
from topo.command.analysis import measure_or_pref; \
from topo.command.pylabplot import measure_position_pref,measure_cog,measure_or_tuning_fullfield; \
measure_or_pref(); \
#measure_position_pref(); \
measure_cog(); \
#measure_or_tuning_fullfield()
"""
def retinotopy_analysis():
"""Return a command for retinotopy analysis."""
return "from topo.command.pylabplot import measure_position_pref,measure_cog ;\
measure_position_pref(); \
measure_cog()"
###
def run(examples,script_name,density=None,commands=["topo.sim.run(1)"]):
"""
Return a complete command for running the given topographica
example script (i.e. a script in the examples/ directory) at the
given density, along with any additional commands.
"""
if density:
density_cmd = ' -c "default_density='+`density`+'" '
else:
density_cmd = " "
cmds = ""
for c in commands:
cmds+=' -c "'+c+'"'
topographica = sys.argv[0]
script = os.path.join(examples,script_name)
return topographica+density_cmd+script+' '+cmds
scripts = {
'hierarchical':'hierarchical.ty',
'lissom_or' :'lissom_or.ty',
'lissom_oo_or':'lissom_oo_or.ty',
'som_retinotopy':'som_retinotopy.ty',
'trickysyntax':'hierarchical.ty',
'obermayer_pnas90':'obermayer_pnas90.ty',
'lissom_fsa':'lissom_fsa.ty',
'gcal':'gcal.ty',
'lissom_oo_or_10000.typ':'lissom_oo_or.ty',
'lissom_fsa_10000.typ':'obermayer_pnas90.ty',
'obermayer_pnas90_40000.typ':'obermayer_pnas90.ty',
'som_retinotopy_40000.typ':'som_retinotopy.ty',
'gcal_10000.typ':'gcal.ty'}
def copy_examples():
# topographica -c "from topo.misc.genexamples import copy_examples; copy_examples()"
examples = find_examples()
locn = os.path.join(param.normalize_path.prefix,"examples")
if os.path.exists(locn):
print "%s already exists; delete or rename it if you want to re-copy the examples."%locn
return
else:
print "Creating %s"%locn
import shutil
print "Copying %s to %s"%(examples,locn)
shutil.copytree(examples,locn)
def print_examples_dir(**kw):
examples = find_examples(**kw)
if examples:
print "Found examples in %s"%examples
def find_examples(specified_examples=None,dirs=None):
import topo
if not specified_examples:
# CEBALERT: hack!
specified_examples = ["hierarchical","lissom_oo_or","som_retinotopy"]
if not dirs:
candidate_example_dirs = [
os.path.join(os.path.expanduser("~"),'topographica/examples'),
# version-controlled topographica dir
os.path.join(topo._package_path,"../examples"),
# debian package
os.path.join(topo._package_path,"../../../share/topographica/examples"),
# setup.py package
os.path.join(topo._package_path,"../../../../share/topographica/examples"),
# egg
os.path.join(topo._package_path,"../share/topographica/examples"),
# expected bdist_mpkg location...
"/usr/local/share/topographica/examples",
# ...but actually this; not sure why
"/usr/local/share/share/topographica/examples"]
else:
candidate_example_dirs = dirs
ced = [os.path.normpath(d) for d in candidate_example_dirs]
candidate_example_dirs = ced
# CEBALERT: horrible way to find directory that contains all the
# examples specified.
examples = None
for d in candidate_example_dirs:
if not examples:
for cmd in specified_examples:
if os.path.isfile(os.path.join(d,scripts[cmd])):
examples = d
else:
examples = False
if examples is False:
break
return examples
# CEBALERT: should be rewritten!
def _stuff(specified_targets):
# shortcuts for executing multiple targets
group_targets = dict( all_quick=["hierarchical","som_retinotopy","lissom_oo_or"],
all_long=["lissom_oo_or_10000.typ","som_retinotopy_40000.typ",
"lissom_or_10000.typ","lissom_fsa_10000.typ"],
saved_examples=["lissom_oo_or_10000.typ"])
### Create the list of commands to execute either by getting the
### command labels from a target, or by inserting the command label
# CB: I don't know any string methods; I'm sure this can
# be simplified!
command_labels=[]
for a in specified_targets:
if a in group_targets:
command_labels+=group_targets[a]
else:
command_labels.append(a)
examples = find_examples(specified_examples=command_labels)
if not examples:
raise IOError("Could not find examples.")
else:
print "Found examples in %s"%examples
# CB: so much repeated typing...
available_targets = {
"hierarchical": run(examples,scripts["hierarchical"],density=4),
"lissom_or": run(examples,scripts["lissom_or"],density=4),
"lissom_oo_or": run(examples,scripts["lissom_oo_or"],density=4),
"som_retinotopy": run(examples,scripts["som_retinotopy"],density=4),
"trickysyntax":run(examples,scripts["hierarchical"],commands=["topo.sim.run(1)",
"print 'printing a string'"]),
"lissom_oo_or_10000.typ":run(examples,scripts["lissom_oo_or"],
commands=["topo.sim.run(10000)",
or_analysis(),
snapshot("lissom_oo_or_10000.typ")]),
"lissom_or_10000.typ":run(examples,scripts["lissom_or"],
commands=["topo.sim.run(10000)",
or_analysis(),
snapshot("lissom_or_10000.typ")]),
"lissom_fsa_10000.typ":run(examples,scripts["lissom_fsa"],
commands=["topo.sim.run(10000)",
snapshot("lissom_fsa_10000.typ")]),
"obermayer_pnas90_40000.typ":run(examples,scripts["obermayer_pnas90"],
commands=["topo.sim.run(40000)",
or_analysis(),
snapshot("obermayer_pnas90_30000.typ")]),
"som_retinotopy_40000.typ":run(examples,scripts["som_retinotopy"],
commands=["topo.sim.run(40000)",
retinotopy_analysis(),
snapshot("som_retinotopy_40000.typ")]),
"gcal_10000.typ":run(examples,scripts["gcal"],
commands=["topo.sim.run(10000)",
or_analysis(),
snapshot("gcal_10000.typ")])
}
return command_labels,available_targets
class generate(param.ParameterizedFunction):
targets = param.List(default=['all_quick'])
def __call__(self,**params):
p = ParamOverrides(self,params)
command_labels,available_targets = _stuff(p.targets)
for cmd in command_labels:
c = available_targets[cmd]
print c
system(c)
| jesuscript/topo-mpi | topo/misc/genexamples.py | Python | bsd-3-clause | 9,221 |
import math
class Solution(object):
def integerBreak(self, n):
"""
:type n: int
:rtype: int
"""
if n < 4:
return n - 1
if n % 3 == 1:
return 3 ** ((n - 4) // 3) * 4
elif n % 3 == 2:
return 3 ** ((n - 2) // 3) * 2
else:
return 3 ** (n // 3)
# # 事实上, n / math.exp(math.log1p(n) - 1), 可以画简为 e
# # 注 log1p 是错的, 等价于 log(1 + n), 应改为 log
# if n == 3:
# return 2
# lof = n / math.exp(math.log1p(n) - 1)
# if lo == lof:
# hi = lo
# else:
# hi = lo + 1
# theMax = 0
# for k in range(int(math.ceil((n + 0.) / hi)),
# int(math.floor((n + 0.) / lo)) + 1): # python2
# if k > 1:
# n1 = n - lo * k
# theMax = max(theMax, lo ** (k - n1) * (lo + 1) ** n1)
# return theMax
# # actually lo == 2
# kf = math.exp(math.log(n) - 1)
# k = int(kf) if kf >= 2 else 2
# lo = n // k
# n1 = n - lo * k
# theMax = lo ** (k - n1) * (lo + 1) ** n1
# if k < kf:
# k += 1
# lo = n // k
# n1 = n - lo * k
# theMax = max(theMax, lo ** (k - n1) * (lo + 1) ** n1)
# return theMax
assert Solution().integerBreak(10) == 36
assert Solution().integerBreak(2) == 1
assert Solution().integerBreak(1) == 0
assert Solution().integerBreak(21) == 2187
assert Solution().integerBreak(3) == 2
assert Solution().integerBreak(30) == 59049
| wufangjie/leetcode | 343. Integer Break.py | Python | gpl-3.0 | 1,639 |
import numpy as np
from pytest import fixture, raises, mark
from beyond.errors import UnknownFrameError, UnknownBodyError
from beyond.config import config
from beyond.env.jpl import get_orbit, list_frames, create_frames
from beyond.dates import Date
from beyond.orbits import Orbit
from beyond.utils.units import AU
from beyond.frames import get_frame
@mark.jpl
def test_get(jplfiles):
mars = get_orbit('Mars', Date(2018, 1, 14))
assert isinstance(mars, Orbit)
assert mars.date.scale.name == "TDB"
assert abs(32.184313430881999806842941325158 + mars.date._offset) <= np.finfo(float).eps
assert mars.date.change_scale("UTC") == Date(2018, 1, 14)
assert str(mars.frame) == "MarsBarycenter"
assert mars.frame.center.name == "MarsBarycenter"
assert str(mars.form) == "cartesian"
# Check if conversion to other frame works as espected
mars.frame = "EME2000"
assert np.allclose(mars, [
-1.69346160e+11, -2.00501413e+11, -8.26925988e+10,
36908.14137465, -7756.92562483, -4081.22549533
])
with raises(UnknownBodyError):
get_orbit('Jupiter', Date(2018, 1, 14))
@mark.jpl
def test_propagate(jplfiles):
venus = get_orbit('VenusBarycenter', Date(2018, 1, 14))
venus = venus.propagate(Date(2018, 1, 15, 12, 27))
assert abs(32.18435609745404946124835987575 + venus.date._offset) <= np.finfo(float).eps
assert str(venus.frame) == "SolarSystemBarycenter"
assert str(venus.form) == "cartesian"
assert np.allclose(venus, [
5.23110445e+10, -8.51235950e+10, -4.16279990e+10,
3.05086795e+04, 1.58745616e+04, 5.21182159e+03
])
@mark.jpl
def test_transform(jplfiles):
mars = get_orbit('Mars', Date(2018, 2, 25))
mars.frame = "SolarSystemBarycenter"
mars.form = "keplerian"
assert mars.frame.center.body.name == "Sun"
assert mars.frame.center.body.m > 1.9e30
assert 1.3 * AU <= mars.a <= 1.7 * AU
@mark.jpl
def test_list(jplfiles):
l = list(list_frames())
assert len(l) == 16
@mark.jpl
def test_create_frames(jplfiles):
mars = get_frame('Mars')
assert mars.name == "Mars"
venus = get_frame('Venus')
assert venus.name == "Venus"
| galactics/beyond | tests/env/test_jpl.py | Python | mit | 2,196 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
from CIM14.CPSM.Equipment.Core.IdentifiedObject import IdentifiedObject
class BaseVoltage(IdentifiedObject):
"""Defines a nominal base voltage which is referenced in the system.
"""
def __init__(self, nominalVoltage=0.0, ConductingEquipment=None, VoltageLevel=None, *args, **kw_args):
"""Initialises a new 'BaseVoltage' instance.
@param nominalVoltage: The PowerSystemResource's base voltage.
@param ConductingEquipment: Use association to ConductingEquipment only when there is no VoltageLevel container used.
@param VoltageLevel: The VoltageLevels having this BaseVoltage.
"""
#: The PowerSystemResource's base voltage.
self.nominalVoltage = nominalVoltage
self._ConductingEquipment = []
self.ConductingEquipment = [] if ConductingEquipment is None else ConductingEquipment
self._VoltageLevel = []
self.VoltageLevel = [] if VoltageLevel is None else VoltageLevel
super(BaseVoltage, self).__init__(*args, **kw_args)
_attrs = ["nominalVoltage"]
_attr_types = {"nominalVoltage": float}
_defaults = {"nominalVoltage": 0.0}
_enums = {}
_refs = ["ConductingEquipment", "VoltageLevel"]
_many_refs = ["ConductingEquipment", "VoltageLevel"]
def getConductingEquipment(self):
"""Use association to ConductingEquipment only when there is no VoltageLevel container used.
"""
return self._ConductingEquipment
def setConductingEquipment(self, value):
for x in self._ConductingEquipment:
x.BaseVoltage = None
for y in value:
y._BaseVoltage = self
self._ConductingEquipment = value
ConductingEquipment = property(getConductingEquipment, setConductingEquipment)
def addConductingEquipment(self, *ConductingEquipment):
for obj in ConductingEquipment:
obj.BaseVoltage = self
def removeConductingEquipment(self, *ConductingEquipment):
for obj in ConductingEquipment:
obj.BaseVoltage = None
def getVoltageLevel(self):
"""The VoltageLevels having this BaseVoltage.
"""
return self._VoltageLevel
def setVoltageLevel(self, value):
for x in self._VoltageLevel:
x.BaseVoltage = None
for y in value:
y._BaseVoltage = self
self._VoltageLevel = value
VoltageLevel = property(getVoltageLevel, setVoltageLevel)
def addVoltageLevel(self, *VoltageLevel):
for obj in VoltageLevel:
obj.BaseVoltage = self
def removeVoltageLevel(self, *VoltageLevel):
for obj in VoltageLevel:
obj.BaseVoltage = None
| rwl/PyCIM | CIM14/CPSM/Equipment/Core/BaseVoltage.py | Python | mit | 3,780 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# coding: utf-8
"""Predefined and pretrained models."""
from . import model_store
from . import vision
| Mega-DatA-Lab/mxnet | python/mxnet/gluon/model_zoo/__init__.py | Python | apache-2.0 | 891 |
from django.contrib import admin
from Assessment.models import Score, Result, Assignment, AssignmentResponse
# Register your models here.
admin.site.register(Score)
admin.site.register(Result)
admin.site.register(Assignment)
admin.site.register(AssignmentResponse)
| IEEEDTU/CMS | Assessment/admin.py | Python | mit | 266 |
# imei.py - functions for handling International Mobile Equipment Identity
# (IMEI) numbers
#
# Copyright (C) 2010, 2011, 2012, 2013 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
"""IMEI (International Mobile Equipment Identity).
The IMEI is used to identify mobile phones. The IMEI may optionally
include a check digit which is validated using the Luhn algorithm.
>>> validate('35686800-004141-20')
'3568680000414120'
>>> validate('35-417803-685978-1')
Traceback (most recent call last):
...
InvalidChecksum: ...
>>> compact('35686800-004141-20')
'3568680000414120'
>>> format('354178036859789')
'35-417803-685978-9'
>>> format('35686800-004141', add_check_digit=True)
'35-686800-004141-8'
>>> imei_type('35686800-004141-20')
'IMEISV'
>>> split('35686800-004141')
('35686800', '004141', '')
"""
from stdnum import luhn
from stdnum.exceptions import *
from stdnum.util import clean
def compact(number):
"""Convert the IMEI number to the minimal representation. This strips the
number of any valid separators and removes surrounding whitespace."""
return clean(number, ' -').strip().upper()
def validate(number):
"""Checks to see if the number provided is a valid IMEI (or IMEISV)
number."""
number = compact(number)
if not number.isdigit():
raise InvalidFormat()
if len(number) == 15:
# only 15 digit IMEI has check digit
luhn.validate(number)
elif len(number) not in (14, 16):
# neither IMEI without check digit or IMEISV (which doesn't have one)
raise InvalidLength()
return number
def imei_type(number):
"""Check the passed number and returns 'IMEI', 'IMEISV' or None (for
invalid) for checking the type of number passed."""
try:
number = validate(number)
except Exception:
return None
if len(number) in (14, 15):
return 'IMEI'
else: # len(number) == 16:
return 'IMEISV'
def is_valid(number):
"""Checks to see if the number provided is a valid IMEI (or IMEISV)
number."""
try:
return bool(validate(number))
except ValidationError:
return False
def split(number):
"""Split the number into a Type Allocation Code (TAC), serial number
and either the checksum (for IMEI) or the software version number (for
IMEISV)."""
number = compact(number)
return (number[:8], number[8:14], number[14:])
def format(number, separator='-', add_check_digit=False):
"""Reformat the passed number to the standard format."""
number = compact(number)
if len(number) == 14 and add_check_digit:
number += luhn.calc_check_digit(number)
number = (number[:2], number[2:8], number[8:14], number[14:])
return separator.join(x for x in number if x)
| dchoruzy/python-stdnum | stdnum/imei.py | Python | lgpl-2.1 | 3,467 |
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import Typed
from openpyxl.descriptors.excel import ExtensionList
from .shapes import GraphicalProperties
from .axis import ChartLines
from .descriptors import NestedGapAmount
class UpDownBars(Serialisable):
tagname = "upbars"
gapWidth = NestedGapAmount()
upBars = Typed(expected_type=ChartLines, allow_none=True)
downBars = Typed(expected_type=ChartLines, allow_none=True)
extLst = Typed(expected_type=ExtensionList, allow_none=True)
__elements__ = ('gapWidth', 'upBars', 'downBars')
def __init__(self,
gapWidth=150,
upBars=None,
downBars=None,
extLst=None,
):
self.gapWidth = gapWidth
self.upBars = upBars
self.downBars = downBars
| saukrIppl/seahub | thirdpart/openpyxl-2.3.0-py2.7.egg/openpyxl/chart/updown_bars.py | Python | apache-2.0 | 936 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import django
from django.conf import settings
from django.core.urlresolvers import reverse
from django import http
from mox3.mox import IsA # noqa
from openstack_dashboard import api
from openstack_dashboard.test import helpers as test
from novaclient.v2 import flavors
from openstack_dashboard.dashboards.admin.flavors import constants
from openstack_dashboard.dashboards.admin.flavors import tables
from openstack_dashboard.dashboards.admin.flavors import workflows
class FlavorsViewTests(test.BaseAdminViewTests):
@test.create_stubs({api.nova: ('flavor_list_paged',),
flavors.Flavor: ('get_keys',), })
def test_index(self):
api.nova.flavor_list_paged(IsA(http.HttpRequest), None,
marker=None, paginate=True) \
.AndReturn((self.flavors.list(), False))
flavors.Flavor.get_keys().MultipleTimes().AndReturn({})
self.mox.ReplayAll()
res = self.client.get(reverse(constants.FLAVORS_INDEX_URL))
self.assertTemplateUsed(res, constants.FLAVORS_TEMPLATE_NAME)
self.assertItemsEqual(res.context['table'].data, self.flavors.list())
@django.test.utils.override_settings(API_RESULT_PAGE_SIZE=1)
@test.create_stubs({api.nova: ('flavor_list_paged',),
flavors.Flavor: ('get_keys',), })
def test_index_form_action_with_pagination(self):
page_size = getattr(settings, 'API_RESULT_PAGE_SIZE', 1)
flavors_list = self.flavors.list()[:2]
api.nova.flavor_list_paged(IsA(http.HttpRequest), None,
marker=None, paginate=True) \
.AndReturn((flavors_list[:page_size], False))
api.nova.flavor_list_paged(IsA(http.HttpRequest), None,
marker=flavors_list[page_size - 1].id,
paginate=True) \
.AndReturn((flavors_list[page_size:], False))
flavors.Flavor.get_keys().MultipleTimes().AndReturn({})
self.mox.ReplayAll()
res = self.client.get(reverse(constants.FLAVORS_INDEX_URL))
self.assertTemplateUsed(res, constants.FLAVORS_TEMPLATE_NAME)
self.assertEqual(len(res.context['table'].data), page_size)
params = "=".join([tables.FlavorsTable._meta.pagination_param,
flavors_list[page_size - 1].id])
next_page_url = "?".join([reverse(constants.FLAVORS_INDEX_URL),
params])
form_action = 'action="%s"' % next_page_url
res = self.client.get(next_page_url)
self.assertEqual(len(res.context['table'].data), 1)
self.assertContains(res, form_action, count=1)
class BaseFlavorWorkflowTests(test.BaseAdminViewTests):
def _flavor_create_params(self, flavor, id=None):
eph = getattr(flavor, 'OS-FLV-EXT-DATA:ephemeral')
flavor_info = {"name": flavor.name,
"vcpu": flavor.vcpus,
"memory": flavor.ram,
"disk": flavor.disk,
"swap": flavor.swap,
"rxtx_factor": flavor.rxtx_factor,
"ephemeral": eph,
"is_public": flavor.is_public}
if id:
flavor_info["flavorid"] = id
return flavor_info
def _get_workflow_fields(self, flavor, id=None, access=None):
eph = getattr(flavor, 'OS-FLV-EXT-DATA:ephemeral')
flavor_info = {"name": flavor.name,
"vcpus": flavor.vcpus,
"memory_mb": flavor.ram,
"disk_gb": flavor.disk,
"swap_mb": flavor.swap,
"rxtx_factor": flavor.rxtx_factor,
"eph_gb": eph}
if access:
access_field_name = 'update_flavor_access_role_member'
flavor_info[access_field_name] = [p.id for p in access]
if id:
flavor_info['flavor_id'] = id
return flavor_info
def _get_workflow_data(self, flavor, id=None, access=None):
flavor_info = self._get_workflow_fields(flavor, access=access,
id=id)
return flavor_info
class CreateFlavorWorkflowTests(BaseFlavorWorkflowTests):
@test.create_stubs({api.keystone: ('tenant_list',), })
def test_workflow_get(self):
projects = self.tenants.list()
api.keystone.tenant_list(IsA(http.HttpRequest)).AndReturn([projects,
False])
self.mox.ReplayAll()
url = reverse(constants.FLAVORS_CREATE_URL)
res = self.client.get(url)
self.assertTemplateUsed(res, constants.FLAVORS_CREATE_VIEW_TEMPLATE)
workflow = res.context['workflow']
expected_name = workflows.CreateFlavor.name
self.assertEqual(res.context['workflow'].name, expected_name)
self.assertQuerysetEqual(
workflow.steps,
['<CreateFlavorInfo: createflavorinfoaction>',
'<UpdateFlavorAccess: update_flavor_access>'])
@test.create_stubs({api.keystone: ('tenant_list',),
api.nova: ('flavor_list',
'flavor_create',)})
def test_create_flavor_without_projects_post(self):
flavor = self.flavors.first()
projects = self.tenants.list()
# init
api.keystone.tenant_list(IsA(http.HttpRequest)).AndReturn([projects,
False])
api.nova.flavor_list(IsA(http.HttpRequest), None) \
.AndReturn([])
# handle
params = self._flavor_create_params(flavor, id='auto')
api.nova.flavor_create(IsA(http.HttpRequest), **params) \
.AndReturn(flavor)
self.mox.ReplayAll()
workflow_data = self._get_workflow_data(flavor)
url = reverse(constants.FLAVORS_CREATE_URL)
res = self.client.post(url, workflow_data)
self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res, reverse(constants.FLAVORS_INDEX_URL))
@test.create_stubs({api.keystone: ('tenant_list',),
api.nova: ('flavor_list',
'flavor_create',
'add_tenant_to_flavor',)})
def test_create_flavor_with_projects_post(self):
flavor = self.flavors.first()
projects = self.tenants.list()
# init
api.keystone.tenant_list(IsA(http.HttpRequest)).AndReturn([projects,
False])
api.nova.flavor_list(IsA(http.HttpRequest), None) \
.AndReturn([])
# handle
params = self._flavor_create_params(flavor, id='auto')
params['is_public'] = False
api.nova.flavor_create(IsA(http.HttpRequest), **params) \
.AndReturn(flavor)
for project in projects:
api.nova.add_tenant_to_flavor(IsA(http.HttpRequest),
flavor.id, project.id)
self.mox.ReplayAll()
workflow_data = self._get_workflow_data(flavor, access=projects)
url = reverse(constants.FLAVORS_CREATE_URL)
res = self.client.post(url, workflow_data)
self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res, reverse(constants.FLAVORS_INDEX_URL))
@test.create_stubs({api.keystone: ('tenant_list',),
api.nova: ('flavor_list',)})
def test_create_existing_flavor_name_error(self):
flavor = self.flavors.first()
projects = self.tenants.list()
# init
api.keystone.tenant_list(IsA(http.HttpRequest)).AndReturn([projects,
False])
# handle
api.nova.flavor_list(IsA(http.HttpRequest), None) \
.AndReturn(self.flavors.list())
self.mox.ReplayAll()
workflow_data = self._get_workflow_data(flavor)
url = reverse(constants.FLAVORS_CREATE_URL)
res = self.client.post(url, workflow_data)
self.assertFormErrors(res)
@test.create_stubs({api.keystone: ('tenant_list',),
api.nova: ('flavor_list',)})
def test_create_existing_flavor_id_error(self):
flavor = self.flavors.first()
projects = self.tenants.list()
# init
api.keystone.tenant_list(IsA(http.HttpRequest)).AndReturn([projects,
False])
# handle
api.nova.flavor_list(IsA(http.HttpRequest), None) \
.AndReturn(self.flavors.list())
self.mox.ReplayAll()
workflow_data = self._get_workflow_data(flavor)
# Name is okay.
workflow_data['name'] = 'newflavorname'
# Flavor id already exists.
workflow_data['flavor_id'] = flavor.id
url = reverse(constants.FLAVORS_CREATE_URL)
res = self.client.post(url, workflow_data)
self.assertFormErrors(res)
@test.create_stubs({api.keystone: ('tenant_list',),
api.nova: ('flavor_list',
'flavor_create',
'add_tenant_to_flavor',)})
def test_create_flavor_project_update_error(self):
flavor = self.flavors.first()
projects = self.tenants.list()
# init
api.keystone.tenant_list(IsA(http.HttpRequest)).AndReturn([projects,
False])
api.nova.flavor_list(IsA(http.HttpRequest), None) \
.AndReturn([])
# handle
params = self._flavor_create_params(flavor, id='auto')
params['is_public'] = False
api.nova.flavor_create(IsA(http.HttpRequest), **params) \
.AndReturn(flavor)
for project in projects:
expect = api.nova.add_tenant_to_flavor(IsA(http.HttpRequest),
flavor.id, project.id)
if project == projects[0]:
expect.AndRaise(self.exceptions.nova)
self.mox.ReplayAll()
workflow_data = self._get_workflow_data(flavor, access=projects)
url = reverse(constants.FLAVORS_CREATE_URL)
res = self.client.post(url, workflow_data)
self.assertNoFormErrors(res)
self.assertMessageCount(error=1, warning=0)
self.assertRedirectsNoFollow(res, reverse(constants.FLAVORS_INDEX_URL))
@test.create_stubs({api.keystone: ('tenant_list',),
api.nova: ('flavor_list',)})
def test_create_flavor_missing_field_error(self):
flavor = self.flavors.first()
projects = self.tenants.list()
# init
api.keystone.tenant_list(IsA(http.HttpRequest)).AndReturn([projects,
False])
api.nova.flavor_list(IsA(http.HttpRequest), None) \
.AndReturn([])
self.mox.ReplayAll()
workflow_data = self._get_workflow_data(flavor)
workflow_data["name"] = ""
url = reverse(constants.FLAVORS_CREATE_URL)
res = self.client.post(url, workflow_data)
self.assertFormErrors(res)
self.assertContains(res, "field is required")
@test.create_stubs({api.keystone: ('tenant_list',),
api.nova: ('flavor_list',)})
def test_create_flavor_missing_swap_and_ephemeral_fields(self):
flavor = self.flavors.first()
projects = self.tenants.list()
# init
api.keystone.tenant_list(IsA(http.HttpRequest)).AndReturn([projects,
False])
# handle
api.nova.flavor_list(IsA(http.HttpRequest), None) \
.AndReturn(self.flavors.list())
self.mox.ReplayAll()
workflow_data = self._get_workflow_data(flavor)
# Swap field empty
workflow_data['swap'] = None
# Ephemeral field empty
workflow_data['eph'] = None
url = reverse(constants.FLAVORS_CREATE_URL)
res = self.client.post(url, workflow_data)
self.assertFormErrors(res)
class UpdateFlavorWorkflowTests(BaseFlavorWorkflowTests):
@test.create_stubs({api.nova: ('flavor_get',
'flavor_access_list',),
api.keystone: ('tenant_list',)})
def test_update_flavor_get(self):
flavor = self.flavors.list()[2]
flavor_access = self.flavor_access.list()
projects = self.tenants.list()
# GET/init, set up expected behavior
api.nova.flavor_get(IsA(http.HttpRequest), flavor.id) \
.MultipleTimes().AndReturn(flavor)
api.keystone.tenant_list(IsA(http.HttpRequest)).AndReturn([projects,
False])
api.nova.flavor_access_list(IsA(http.HttpRequest), flavor.id) \
.AndReturn(flavor_access)
# Put all mocks created by mox into replay mode
self.mox.ReplayAll()
url = reverse(constants.FLAVORS_UPDATE_URL, args=[flavor.id])
res = self.client.get(url)
self.assertTemplateUsed(res, constants.FLAVORS_UPDATE_VIEW_TEMPLATE)
workflow = res.context['workflow']
expected_name = workflows.UpdateFlavor.name
self.assertEqual(res.context['workflow'].name, expected_name)
self.assertQuerysetEqual(
workflow.steps,
['<UpdateFlavorInfo: update_info>',
'<UpdateFlavorAccess: update_flavor_access>'])
step = workflow.get_step("update_info")
eph = getattr(flavor, 'OS-FLV-EXT-DATA:ephemeral')
self.assertEqual(step.action.initial['name'], flavor.name)
self.assertEqual(step.action.initial['vcpus'], flavor.vcpus)
self.assertEqual(step.action.initial['memory_mb'], flavor.ram)
self.assertEqual(step.action.initial['disk_gb'], flavor.disk)
self.assertEqual(step.action.initial['swap_mb'], flavor.swap)
self.assertEqual(step.action.initial['rxtx_factor'],
flavor.rxtx_factor)
self.assertEqual(step.action.initial['eph_gb'], eph)
step = workflow.get_step("update_flavor_access")
field_name = step.get_member_field_name('member')
self.assertEqual(step.action.fields[field_name].initial,
[fa.tenant_id for fa in flavor_access])
@test.create_stubs({api.nova: ('flavor_get',), })
def test_update_flavor_get_flavor_error(self):
flavor = self.flavors.first()
api.nova.flavor_get(IsA(http.HttpRequest), flavor.id) \
.AndRaise(self.exceptions.nova)
self.mox.ReplayAll()
url = reverse(constants.FLAVORS_UPDATE_URL, args=[flavor.id])
res = self.client.get(url)
self.assertRedirectsNoFollow(res, reverse(constants.FLAVORS_INDEX_URL))
@test.create_stubs({api.keystone: ('tenant_list',),
api.nova: ('flavor_get',
'flavor_get_extras',
'flavor_list',
'flavor_delete',
'flavor_create')})
def test_update_flavor_without_extra_specs(self):
# The first element has no extra specs
flavor = self.flavors.first()
projects = self.tenants.list()
eph = getattr(flavor, 'OS-FLV-EXT-DATA:ephemeral')
extra_specs = getattr(flavor, 'extra_specs')
new_flavor = flavors.Flavor(flavors.FlavorManager(None),
{'id':
"cccccccc-cccc-cccc-cccc-cccccccccccc",
'name': flavor.name,
'vcpus': flavor.vcpus + 1,
'disk': flavor.disk,
'ram': flavor.ram,
'rxtx_factor': flavor.rxtx_factor,
'swap': 0,
'OS-FLV-EXT-DATA:ephemeral': eph,
'extra_specs': extra_specs})
# GET/init, set up expected behavior
api.nova.flavor_get(IsA(http.HttpRequest), flavor.id) \
.MultipleTimes().AndReturn(flavor)
api.keystone.tenant_list(IsA(http.HttpRequest)) \
.MultipleTimes().AndReturn([projects, False])
api.nova.flavor_list(IsA(http.HttpRequest), None) \
.AndReturn(self.flavors.list())
# POST/init
api.nova.flavor_get_extras(IsA(http.HttpRequest),
flavor.id, raw=True) \
.AndReturn(extra_specs)
api.nova.flavor_delete(IsA(http.HttpRequest), flavor.id)
api.nova.flavor_create(IsA(http.HttpRequest),
new_flavor.name,
new_flavor.ram,
new_flavor.vcpus,
new_flavor.disk,
swap=new_flavor.swap,
rxtx_factor=new_flavor.rxtx_factor,
ephemeral=eph,
is_public=True).AndReturn(new_flavor)
# Put mocks in replay mode
self.mox.ReplayAll()
# run get test
url = reverse(constants.FLAVORS_UPDATE_URL, args=[flavor.id])
resp = self.client.get(url)
self.assertEqual(resp.status_code, 200)
self.assertTemplateUsed(resp, constants.FLAVORS_UPDATE_VIEW_TEMPLATE)
# run post test
workflow_data = {'flavor_id': flavor.id,
'name': new_flavor.name,
'vcpus': new_flavor.vcpus,
'memory_mb': new_flavor.ram,
'disk_gb': new_flavor.disk,
'swap_mb': new_flavor.swap,
'rxtx_factor': flavor.rxtx_factor,
'eph_gb': eph,
'is_public': True}
resp = self.client.post(url, workflow_data)
self.assertNoFormErrors(resp)
self.assertMessageCount(success=1)
self.assertRedirectsNoFollow(resp,
reverse(constants.FLAVORS_INDEX_URL))
@test.create_stubs({api.keystone: ('tenant_list',),
api.nova: ('flavor_get',
'flavor_get_extras',
'flavor_list',
'flavor_delete',
'flavor_create',
'flavor_extra_set')})
def test_update_flavor_with_extra_specs(self):
# The second element has extra specs
flavor = self.flavors.list()[1]
projects = self.tenants.list()
eph = getattr(flavor, 'OS-FLV-EXT-DATA:ephemeral')
extra_specs = getattr(flavor, 'extra_specs')
new_flavor = flavors.Flavor(flavors.FlavorManager(None),
{'id':
"cccccccc-cccc-cccc-cccc-cccccccccccc",
'name': flavor.name,
'vcpus': flavor.vcpus + 1,
'disk': flavor.disk,
'ram': flavor.ram,
'swap': flavor.swap,
'rxtx_factor': flavor.rxtx_factor,
'OS-FLV-EXT-DATA:ephemeral': eph,
'extra_specs': extra_specs})
# GET/init, set up expected behavior
api.nova.flavor_get(IsA(http.HttpRequest), flavor.id) \
.MultipleTimes().AndReturn(flavor)
api.keystone.tenant_list(IsA(http.HttpRequest)) \
.MultipleTimes().AndReturn([projects, False])
# POST/init
api.nova.flavor_list(IsA(http.HttpRequest), None) \
.AndReturn(self.flavors.list())
api.nova.flavor_get_extras(IsA(http.HttpRequest),
flavor.id, raw=True) \
.AndReturn(extra_specs)
api.nova.flavor_delete(IsA(http.HttpRequest), flavor.id)
api.nova.flavor_create(IsA(http.HttpRequest),
new_flavor.name,
new_flavor.ram,
new_flavor.vcpus,
new_flavor.disk,
swap=new_flavor.swap,
rxtx_factor=new_flavor.rxtx_factor,
ephemeral=eph,
is_public=True).AndReturn(new_flavor)
api.nova.flavor_extra_set(IsA(http.HttpRequest),
new_flavor.id, extra_specs)
self.mox.ReplayAll()
# run get test
url = reverse(constants.FLAVORS_UPDATE_URL, args=[flavor.id])
resp = self.client.get(url)
self.assertEqual(resp.status_code, 200)
self.assertTemplateUsed(resp, constants.FLAVORS_UPDATE_VIEW_TEMPLATE)
# run post test
workflow_data = {'flavor_id': flavor.id,
'name': new_flavor.name,
'vcpus': new_flavor.vcpus,
'memory_mb': new_flavor.ram,
'disk_gb': new_flavor.disk,
'swap_mb': new_flavor.swap,
'rxtx_factor': flavor.rxtx_factor,
'eph_gb': eph,
'is_public': True}
resp = self.client.post(url, workflow_data)
self.assertNoFormErrors(resp)
self.assertMessageCount(success=1)
self.assertRedirectsNoFollow(resp,
reverse(constants.FLAVORS_INDEX_URL))
@test.create_stubs({api.keystone: ('tenant_list',),
api.nova: ('flavor_get',
'flavor_get_extras',
'flavor_list',
'flavor_delete',
'flavor_create')})
def test_update_flavor_update_flavor_error(self):
# The first element has no extra specs
flavor = self.flavors.first()
projects = self.tenants.list()
eph = getattr(flavor, 'OS-FLV-EXT-DATA:ephemeral')
extra_specs = getattr(flavor, 'extra_specs')
new_flavor = flavors.Flavor(flavors.FlavorManager(None),
{'id':
"cccccccc-cccc-cccc-cccc-cccccccccccc",
'name': flavor.name,
'vcpus': flavor.vcpus + 1,
'disk': flavor.disk,
'ram': flavor.ram,
'rxtx_factor': flavor.rxtx_factor,
'swap': 0,
'OS-FLV-EXT-DATA:ephemeral': eph,
'extra_specs': extra_specs})
# GET/init, set up expected behavior
api.nova.flavor_get(IsA(http.HttpRequest), flavor.id) \
.MultipleTimes().AndReturn(flavor)
api.keystone.tenant_list(IsA(http.HttpRequest)) \
.MultipleTimes().AndReturn([projects, False])
# POST
api.nova.flavor_list(IsA(http.HttpRequest), None) \
.AndReturn(self.flavors.list())
# POST/init
api.nova.flavor_get_extras(IsA(http.HttpRequest),
flavor.id, raw=True) \
.AndReturn(extra_specs)
api.nova.flavor_delete(IsA(http.HttpRequest), flavor.id)
api.nova.flavor_create(IsA(http.HttpRequest),
new_flavor.name,
new_flavor.ram,
new_flavor.vcpus,
new_flavor.disk,
swap=new_flavor.swap,
rxtx_factor=new_flavor.rxtx_factor,
ephemeral=eph,
is_public=True)\
.AndRaise(self.exceptions.nova)
# Put mocks in replay mode
self.mox.ReplayAll()
# run get test
url = reverse(constants.FLAVORS_UPDATE_URL, args=[flavor.id])
resp = self.client.get(url)
self.assertEqual(resp.status_code, 200)
self.assertTemplateUsed(resp, constants.FLAVORS_UPDATE_VIEW_TEMPLATE)
# run post test
workflow_data = {'flavor_id': flavor.id,
'name': new_flavor.name,
'vcpus': new_flavor.vcpus,
'memory_mb': new_flavor.ram,
'disk_gb': new_flavor.disk,
'swap_mb': new_flavor.swap,
'rxtx_factor': flavor.rxtx_factor,
'eph_gb': eph,
'is_public': True}
resp = self.client.post(url, workflow_data)
self.assertNoFormErrors(resp)
self.assertMessageCount(error=1)
self.assertRedirectsNoFollow(resp,
reverse(constants.FLAVORS_INDEX_URL))
@test.create_stubs({api.keystone: ('tenant_list',),
api.nova: ('flavor_get',
'flavor_get_extras',
'flavor_list',
'flavor_delete',
'flavor_create',
'flavor_access_list',
'remove_tenant_from_flavor',
'add_tenant_to_flavor')})
def test_update_flavor_update_projects_error(self):
# The first element has no extra specs
flavor = self.flavors.first()
projects = self.tenants.list()
flavor_projects = [self.tenants.first()]
eph = getattr(flavor, 'OS-FLV-EXT-DATA:ephemeral')
extra_specs = getattr(flavor, 'extra_specs')
new_flavor = flavors.Flavor(flavors.FlavorManager(None),
{'id':
"cccccccc-cccc-cccc-cccc-cccccccccccc",
'name': flavor.name,
'vcpus': flavor.vcpus + 1,
'disk': flavor.disk,
'ram': flavor.ram,
'swap': 0,
'rxtx_factor': flavor.rxtx_factor,
'OS-FLV-EXT-DATA:ephemeral': eph,
'os-flavor-access:is_public': False,
'extra_specs': extra_specs})
# GET/init, set up expected behavior
api.nova.flavor_get(IsA(http.HttpRequest), flavor.id) \
.MultipleTimes().AndReturn(flavor)
api.keystone.tenant_list(IsA(http.HttpRequest)) \
.MultipleTimes().AndReturn([projects, False])
# POST/init
api.nova.flavor_list(IsA(http.HttpRequest), None) \
.AndReturn(self.flavors.list())
api.nova.flavor_get_extras(IsA(http.HttpRequest),
flavor.id, raw=True) \
.AndReturn(extra_specs)
api.nova.flavor_delete(IsA(http.HttpRequest), flavor.id)
api.nova.flavor_create(IsA(http.HttpRequest),
new_flavor.name,
new_flavor.ram,
new_flavor.vcpus,
new_flavor.disk,
swap=new_flavor.swap,
rxtx_factor=new_flavor.rxtx_factor,
ephemeral=eph,
is_public=new_flavor.is_public) \
.AndReturn(new_flavor)
new_flavor_projects = flavor_projects
for project in new_flavor_projects:
expect = api.nova.add_tenant_to_flavor(IsA(http.HttpRequest),
new_flavor.id, project.id)
if project == projects[0]:
expect.AndRaise(self.exceptions.nova)
# Put mocks in replay mode
self.mox.ReplayAll()
# run get test
url = reverse(constants.FLAVORS_UPDATE_URL, args=[flavor.id])
resp = self.client.get(url)
self.assertEqual(resp.status_code, 200)
self.assertTemplateUsed(resp, constants.FLAVORS_UPDATE_VIEW_TEMPLATE)
# run post test
data = self._get_workflow_data(new_flavor, access=flavor_projects)
data['flavor_id'] = flavor.id
resp = self.client.post(url, data)
self.assertNoFormErrors(resp)
self.assertMessageCount(error=1, warning=0)
self.assertRedirectsNoFollow(resp,
reverse(constants.FLAVORS_INDEX_URL))
@test.create_stubs({api.keystone: ('tenant_list',),
api.nova: ('flavor_get',
'flavor_list',)})
def test_update_flavor_set_invalid_name(self):
flavor = self.flavors.first()
projects = self.tenants.list()
eph = getattr(flavor, 'OS-FLV-EXT-DATA:ephemeral')
invalid_flavor_name = "m1.tiny()"
# init
api.nova.flavor_get(IsA(http.HttpRequest), flavor.id) \
.MultipleTimes().AndReturn(flavor)
api.keystone.tenant_list(IsA(http.HttpRequest)) \
.MultipleTimes().AndReturn([projects, False])
api.nova.flavor_list(IsA(http.HttpRequest), None) \
.AndReturn(self.flavors.list())
self.mox.ReplayAll()
# run get test
url = reverse(constants.FLAVORS_UPDATE_URL, args=[flavor.id])
resp = self.client.get(url)
self.assertEqual(resp.status_code, 200)
self.assertTemplateUsed(resp, constants.FLAVORS_UPDATE_VIEW_TEMPLATE)
# run post test
workflow_data = {'flavor_id': flavor.id,
'name': invalid_flavor_name,
'vcpus': flavor.vcpus + 1,
'memory_mb': flavor.ram,
'disk_gb': flavor.disk,
'swap_mb': flavor.swap,
'rxtx_factor': flavor.rxtx_factor,
'eph_gb': eph,
'is_public': True}
resp = self.client.post(url, workflow_data)
self.assertFormErrors(resp, 1, 'Name may only contain letters, '
'numbers, underscores, periods and hyphens.')
@test.create_stubs({api.keystone: ('tenant_list',),
api.nova: ('flavor_get',
'flavor_list',)})
def test_update_flavor_set_existing_name(self):
flavor_a = self.flavors.list()[0]
flavor_b = self.flavors.list()[1]
projects = self.tenants.list()
eph = getattr(flavor_a, 'OS-FLV-EXT-DATA:ephemeral')
extra_specs = getattr(flavor_a, 'extra_specs')
new_flavor = flavors.Flavor(flavors.FlavorManager(None),
{'id': flavor_a.id,
'name': flavor_b.name,
'vcpus': flavor_a.vcpus,
'disk': flavor_a.disk,
'ram': flavor_a.ram,
'swap': flavor_a.swap,
'rxtx_factor': flavor_a.rxtx_factor,
'OS-FLV-EXT-DATA:ephemeral': eph,
'extra_specs': extra_specs})
# GET
api.nova.flavor_get(IsA(http.HttpRequest), flavor_a.id) \
.MultipleTimes().AndReturn(flavor_a)
api.keystone.tenant_list(IsA(http.HttpRequest)) \
.MultipleTimes().AndReturn([projects, False])
# POST
api.nova.flavor_list(IsA(http.HttpRequest), None) \
.AndReturn(self.flavors.list())
self.mox.ReplayAll()
# get test
url = reverse(constants.FLAVORS_UPDATE_URL, args=[flavor_a.id])
resp = self.client.get(url)
self.assertEqual(resp.status_code, 200)
self.assertTemplateUsed(resp, constants.FLAVORS_UPDATE_VIEW_TEMPLATE)
# post test
data = {'flavor_id': new_flavor.id,
'name': new_flavor.name,
'vcpus': new_flavor.vcpus,
'memory_mb': new_flavor.ram,
'disk_gb': new_flavor.disk,
'swap_mb': new_flavor.swap,
'rxtx_factor': new_flavor.rxtx_factor,
'eph_gb': eph,
'is_public': True}
resp = self.client.post(url, data)
self.assertFormErrors(resp, 1, 'The name "m1.massive" '
'is already used by another flavor.')
@test.create_stubs({api.keystone: ('tenant_list',),
api.nova: ('flavor_get',
'flavor_list',)})
def generic_update_flavor_invalid_data_form_fails(self, override_data,
error_msg):
flavor = self.flavors.first()
projects = self.tenants.list()
eph = getattr(flavor, 'OS-FLV-EXT-DATA:ephemeral')
api.nova.flavor_get(IsA(http.HttpRequest), flavor.id) \
.MultipleTimes().AndReturn(flavor)
api.keystone.tenant_list(IsA(http.HttpRequest)) \
.MultipleTimes().AndReturn([projects, False])
api.nova.flavor_list(IsA(http.HttpRequest), None) \
.AndReturn(self.flavors.list())
self.mox.ReplayAll()
# run get test
url = reverse(constants.FLAVORS_UPDATE_URL, args=[flavor.id])
resp = self.client.get(url)
self.assertEqual(resp.status_code, 200)
self.assertTemplateUsed(resp, constants.FLAVORS_UPDATE_VIEW_TEMPLATE)
# run post test
workflow_data = {'flavor_id': flavor.id,
'name': flavor.name,
'vcpus': flavor.vcpus,
'memory_mb': flavor.ram,
'disk_gb': flavor.disk,
'swap_mb': flavor.swap,
'rxtx_factor': flavor.rxtx_factor,
'eph_gb': eph,
'is_public': True}
workflow_data.update(override_data)
resp = self.client.post(url, workflow_data)
self.assertFormErrors(resp, 1, error_msg)
def test_update_flavor_invalid_vcpu_fails(self):
error = 'Ensure this value is greater than or equal to 1.'
data = {'vcpus': 0}
self.generic_update_flavor_invalid_data_form_fails(override_data=data,
error_msg=error)
def test_update_flavor_invalid_ram_fails(self):
error = 'Ensure this value is greater than or equal to 1.'
data = {'memory_mb': 0}
self.generic_update_flavor_invalid_data_form_fails(override_data=data,
error_msg=error)
def test_update_flavor_invalid_disk_gb_fails(self):
error = 'Ensure this value is greater than or equal to 0.'
data = {'disk_gb': -1}
self.generic_update_flavor_invalid_data_form_fails(override_data=data,
error_msg=error)
def test_update_flavor_invalid_swap_mb_fails(self):
error = 'Ensure this value is greater than or equal to 0.'
data = {'swap_mb': -1}
self.generic_update_flavor_invalid_data_form_fails(override_data=data,
error_msg=error)
def test_update_flavor_invalid_eph_gb_fails(self):
error = 'Ensure this value is greater than or equal to 0.'
data = {'eph_gb': -1}
self.generic_update_flavor_invalid_data_form_fails(override_data=data,
error_msg=error)
def test_update_flavor_invalid_rxtx_factor_fails(self):
error = 'Ensure this value is greater than or equal to 1.'
data = {'rxtx_factor': 0}
self.generic_update_flavor_invalid_data_form_fails(override_data=data,
error_msg=error)
| davidcusatis/horizon | openstack_dashboard/dashboards/admin/flavors/tests.py | Python | apache-2.0 | 37,408 |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import io
import os
import setuptools
# Package metadata.
name = "google-cloud-os-login"
description = "Google Cloud OS Login API client library"
version = "0.2.0"
# Should be one of:
# 'Development Status :: 3 - Alpha'
# 'Development Status :: 4 - Beta'
# 'Development Status :: 5 - Production/Stable'
release_status = "Development Status :: 3 - Alpha"
dependencies = ["google-api-core[grpc] >= 1.14.0, < 2.0.0dev"]
extras = {}
# Setup boilerplate below this line.
package_root = os.path.abspath(os.path.dirname(__file__))
readme_filename = os.path.join(package_root, "README.rst")
with io.open(readme_filename, encoding="utf-8") as readme_file:
readme = readme_file.read()
# Only include packages under the 'google' namespace. Do not include tests,
# benchmarks, etc.
packages = [
package for package in setuptools.find_packages() if package.startswith("google")
]
# Determine which namespaces are needed.
namespaces = ["google"]
if "google.cloud" in packages:
namespaces.append("google.cloud")
setuptools.setup(
name=name,
version=version,
description=description,
long_description=readme,
author="Google LLC",
author_email="googleapis-packages@google.com",
license="Apache 2.0",
url="https://github.com/GoogleCloudPlatform/google-cloud-python",
classifiers=[
release_status,
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Operating System :: OS Independent",
"Topic :: Internet",
],
platforms="Posix; MacOS X; Windows",
packages=packages,
namespace_packages=namespaces,
install_requires=dependencies,
extras_require=extras,
python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*",
include_package_data=True,
zip_safe=False,
)
| tseaver/google-cloud-python | oslogin/setup.py | Python | apache-2.0 | 2,716 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.