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
|
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class ContactDetails(Document):
pass
|
Tejal011089/osmosis_erpnext
|
erpnext/selling/doctype/contact_details/contact_details.py
|
Python
|
agpl-3.0
| 297
|
# Write a function to decode the following.
Yms bgb gr! Cmlepyrsjyrgmlq! Dgb wms sqc qrpgle.kyicrpylq?
Id wms bgbl'r wms qfmsjb npmzyzjw em afcai gr msr.
Ir kyicq rfgq ksaf cyqgcp.
# A hint
# a = c
# z = b
# m = o
# maybe
# r = s
# g = i
# m = h
|
bobbybabra/codeGuild
|
codeChallenge_three.py
|
Python
|
bsd-2-clause
| 253
|
import datetime
from django.utils.html import linebreaks
from django.contrib.sites.models import Site
def camelcase(name):
return ''.join(x.capitalize() or ' ' for x in name.split(' '))
def camelcase_lower(name):
pname = camelcase(name)
return pname[0].lower() + pname[1:]
def split_thousands(n, sep=','):
s = str(n)
if len(s) <= 3: return s
return split_thousands(s[:-3], sep) + sep + s[-3:]
def dfs(node, all_nodes, depth):
"""
Performs a recursive depth-first search starting at ``node``.
"""
to_return = [node,]
for subnode in all_nodes:
if subnode.parent and subnode.parent.id == node.id:
to_return.extend(dfs(subnode, all_nodes, depth+1))
return to_return
def flattened_children(node, all_nodes, to_return):
to_return.append(node)
for subnode in all_nodes:
if subnode.parent and subnode.parent.id == node.id:
flattened_children(subnode, all_nodes, to_return)
return to_return
def flattened_children_by_association(node, all_associations, to_return): #works only for agents
#todo: figure out why this failed when AAs were ordered by from_agent
#import pdb; pdb.set_trace()
to_return.append(node)
for association in all_associations:
#if association.has_associate.id == node.id:
# import pdb; pdb.set_trace()
if association.has_associate.id == node.id and association.association_type.association_behavior == "child":
flattened_children_by_association(association.is_associate, all_associations, to_return)
return to_return
def flattened_group_associations(node, all_associations, to_return): #works only for agents
#import pdb; pdb.set_trace()
to_return.append(node)
for association in all_associations:
if association.has_associate.id == node.id and association.from_agent.agent_type.party_type!="individual":
flattened_group_associations(association.is_associate, all_associations, to_return)
return to_return
def agent_dfs_by_association(node, all_associations, depth): #works only for agents
#todo: figure out why this failed when AAs were ordered by from_agent
#import pdb; pdb.set_trace()
node.depth = depth
to_return = [node,]
for association in all_associations:
if association.has_associate.id == node.id and association.association_type.association_behavior == "child":
to_return.extend(agent_dfs_by_association(association.is_associate, all_associations, depth+1))
return to_return
def group_dfs_by_has_associate(root, node, all_associations, visited, depth):
#works only for agents, and only follows association_from
#import pdb; pdb.set_trace()
to_return = []
if node not in visited:
visited.append(node)
node.depth = depth
to_return.append(node)
for association in all_associations:
if association.has_associate.id == node.id:
to_return.extend(group_dfs_by_has_associate(root, association.is_associate, all_associations, visited, depth+1))
return to_return
def group_dfs_by_is_associate(root, node, all_associations, visited, depth):
#import pdb; pdb.set_trace()
to_return = []
if node not in visited:
visited.append(node)
node.depth = depth
to_return.append(node)
for association in all_associations:
if association.is_associate.id == node.id:
to_return.extend(group_dfs_by_is_associate(root, association.has_associate, all_associations, visited, depth+1))
return to_return
class Edge(object):
def __init__(self, from_node, to_node, label):
self.from_node = from_node
self.to_node = to_node
self.label = label
self.width = 1
def dictify(self):
d = {
"from_node": self.from_node.node_id(),
"to_node": self.to_node.node_id(),
"label": self.label,
"width": self.width,
}
return d
def process_link_label(from_process, to_process):
outputs = [oc.resource_type for oc in from_process.outgoing_commitments()]
inputs = [ic.resource_type for ic in to_process.incoming_commitments()]
intersect = set(outputs) & set(inputs)
label = ", ".join(rt.name for rt in intersect)
return label
def process_graph(processes):
nodes = []
visited = set()
connections = set()
edges = []
for p in processes:
if p not in visited:
visited.add(p)
project_id = ""
if p.context_agent:
project_id = p.context_agent.node_id()
d = {
"id": p.node_id(),
"name": p.name,
"project-id": project_id,
"start": p.start_date.strftime('%Y-%m-%d'),
"end": p.end_date.strftime('%Y-%m-%d'),
}
nodes.append(d)
next = p.next_processes()
for n in next:
if n not in visited:
visited.add(n)
project_id = ""
if p.context_agent:
project_id = p.context_agent.node_id()
d = {
"id": n.node_id(),
"name": n.name,
"project-id": project_id,
"start": n.start_date.strftime('%Y-%m-%d'),
"end": n.end_date.strftime('%Y-%m-%d'),
}
nodes.append(d)
c = "-".join([str(p.id), str(n.id)])
if c not in connections:
connections.add(c)
label = process_link_label(p, n)
edge = Edge(p, n, label)
edges.append(edge.dictify())
prev = p.previous_processes()
for n in prev:
if n not in visited:
visited.add(n)
project_id = ""
if p.context_agent:
project_id = p.context_agent.node_id()
d = {
"id": n.node_id(),
"name": n.name,
"project-id": project_id,
"start": n.start_date.strftime('%Y-%m-%d'),
"end": n.end_date.strftime('%Y-%m-%d'),
}
nodes.append(d)
c = "-".join([str(n.id), str(p.id)])
if c not in connections:
connections.add(c)
label = process_link_label(n, p)
edge = Edge(n, p, label)
edges.append(edge.dictify())
big_d = {
"nodes": nodes,
"edges": edges,
}
return big_d
def project_process_resource_agent_graph(project_list, process_list):
processes = {}
rt_set = set()
orders = {}
agents = {}
agent_dict = {}
for p in process_list:
dp = {
"name": p.name,
"type": "process",
"url": "".join([get_url_starter(), p.get_absolute_url()]),
"project-id": get_project_id(p),
"order-id": get_order_id(p),
"start": p.start_date.strftime('%Y-%m-%d'),
"end": p.end_date.strftime('%Y-%m-%d'),
"orphan": p.is_orphan(),
"next": []
}
processes[p.node_id()] = dp
for p in process_list:
order = p.independent_demand()
if order:
orders[order.node_id()] = get_order_details(order, get_url_starter(), processes)
orts = p.outgoing_commitments()
for ort in orts:
if ort not in rt_set:
rt_set.add(ort)
next_ids = [ort.resource_type_node_id() for ort in p.outgoing_commitments()]
processes[p.node_id()]["next"].extend(next_ids)
agnts = p.working_agents()
for a in agnts:
if a not in agent_dict:
agent_dict[a] = []
agent_dict[a].append(p)
for agnt, procs in agent_dict.items():
da = {
"name": agnt.name,
"type": "agent",
"processes": []
}
for p in procs:
da["processes"].append(p.node_id())
agents[agnt.node_id()] = da
big_d = {
"projects": get_projects(project_list),
"processes": processes,
"agents": agents,
"resource_types": get_resource_types(rt_set, processes),
"orders": orders,
}
return big_d
def get_order_id(p):
order = p.independent_demand()
order_id = ''
if order:
order_id = order.node_id()
return order_id
def get_resource_types(rt_set, processes):
resource_types = {}
for ort in rt_set:
rt = ort.resource_type
name = rt.name
if ort.stage:
name = "@".join([name, ort.stage.name])
drt = {
"name": name,
"type": "resourcetype",
"url": "".join([get_url_starter(), rt.get_absolute_url()]),
"photo-url": rt.photo_url,
"next": []
}
for wct in rt.wanting_commitments():
match = False
if ort.stage:
if wct.stage == ort.stage:
match = True
else:
match = True
if match:
if wct.process:
p_id = wct.process.node_id()
if p_id in processes:
drt["next"].append(p_id)
resource_types[ort.resource_type_node_id()] = drt
return resource_types
def get_projects(project_list):
projects = {}
for p in project_list:
d = {
"name": p.name,
}
projects[p.node_id()] = d
return projects
def get_project_id(p):
project_id = ""
if p.context_agent:
project_id = p.context_agent.node_id()
return project_id
def get_url_starter():
return "".join(["http://", Site.objects.get_current().domain])
def get_order_details(order, url_starter, processes):
receiver_name = ""
if order.receiver:
receiver_name = order.receiver.name
dord = {
"name": order.__unicode__(),
"type": "order",
"for": receiver_name,
"due": order.due_date.strftime('%Y-%m-%d'),
"url": "".join([url_starter, order.get_absolute_url()]),
"processes": []
}
return dord
def project_process_graph(project_list, process_list):
projects = {}
processes = {}
agents = {}
agent_dict = {}
for p in project_list:
d = {
"name": p.name,
}
projects[p.node_id()] = d
for p in process_list:
project_id = ""
if p.context_agent:
project_id = p.context_agent.node_id()
dp = {
"name": p.name,
"project-id": project_id,
"start": p.start_date.strftime('%Y-%m-%d'),
"end": p.end_date.strftime('%Y-%m-%d'),
"next": []
}
processes[p.node_id()] = dp
p.dp = dp
agnts = p.working_agents()
for a in agnts:
if a not in agent_dict:
agent_dict[a] = []
agent_dict[a].append(p)
for p in process_list:
next_ids = [n.node_id() for n in p.next_processes()]
p.dp["next"].extend(next_ids)
for agnt, procs in agent_dict.items():
da = {
"name": agnt.name,
"processes": []
}
for p in procs:
da["processes"].append(p.node_id())
agents[agnt.node_id()] = da
big_d = {
"projects": projects,
"processes": processes,
"agents": agents,
}
return big_d
def project_graph(producers):
nodes = []
edges = []
#import pdb; pdb.set_trace()
for p in producers:
for rt in p.produced_resource_type_relationships():
for pt in rt.resource_type.consuming_process_type_relationships():
if p.context_agent and pt.process_type.context_agent:
if p.context_agent != pt.process_type.context_agent:
nodes.extend([p.context_agent, pt.process_type.context_agent, rt.resource_type])
edges.append(Edge(p.context_agent, rt.resource_type, rt.event_type.label))
edges.append(Edge(rt.resource_type, pt.process_type.context_agent, pt.inverse_label()))
return [nodes, edges]
def explode(process_type_relationship, nodes, edges, depth, depth_limit):
if depth > depth_limit:
return
#if process_type_relationship.process_type.name.startswith('Q'):
# return
nodes.append(process_type_relationship.process_type)
edges.append(Edge(
process_type_relationship.process_type,
process_type_relationship.resource_type,
process_type_relationship.event_type.label
))
for rtr in process_type_relationship.process_type.consumed_and_used_resource_type_relationships():
nodes.append(rtr.resource_type)
edges.append(Edge(rtr.resource_type, process_type_relationship.process_type, rtr.inverse_label()))
for art in rtr.resource_type.producing_agent_relationships():
nodes.append(art.agent)
edges.append(Edge(art.agent, rtr.resource_type, art.event_type.label))
#todo pr: shd this use own or own_or_parent_recipes?
for pt in rtr.resource_type.producing_process_type_relationships():
explode(pt, nodes, edges, depth+1, depth_limit)
def graphify(focus, depth_limit):
nodes = [focus]
edges = []
for art in focus.consuming_agent_relationships():
nodes.append(art.agent)
edges.append(Edge(focus, art.agent, art.event_type.label))
#todo pr: shd this use own or own_or_parent_recipes?
for ptr in focus.producing_process_type_relationships():
explode(ptr, nodes, edges, 0, depth_limit)
return [nodes, edges]
def project_network():
producers = [p for p in ProcessType.objects.all() if p.produced_resource_types()]
nodes = []
edges = []
for p in producers:
for rt in p.produced_resource_types():
for pt in rt.consuming_process_types():
if p.context_agent != pt.context_agent:
nodes.extend([p.context_agent, pt.context_agent, rt])
edges.append(Edge(p.context_agent, rt))
edges.append(Edge(rt, pt.context_agent))
return [nodes, edges]
class TimelineEvent(object):
def __init__(self, node, start, end, title, link, description):
self.node = node
self.start = start
self.end = end
self.title = title
self.link = link
self.description = description
def dictify(self):
descrip = ""
if self.description:
descrip = self.description
d = {
"start": self.start.strftime("%b %e %Y 00:00:00 GMT-0600"),
"title": self.title,
"description": linebreaks(descrip),
}
if self.end:
d["end"] = self.end.strftime("%b %e %Y 00:00:00 GMT-0600")
d["durationEvent"] = True
else:
d["durationEvent"] = False
if self.link:
d["link"] = self.link
mrq = []
for mreq in self.node.consumed_input_requirements():
abbrev = mreq.unit_of_quantity.abbrev or ""
label = " ".join([
str(mreq.quantity),
abbrev,
mreq.resource_type.name])
mrq.append(label)
d["consumableReqmts"] = mrq
trq = []
for treq in self.node.used_input_requirements():
abbrev = treq.unit_of_quantity.abbrev or ""
label = " ".join([
str(treq.quantity),
abbrev,
treq.resource_type.name])
trq.append(label)
d["usableReqmts"] = trq
wrq = []
for wreq in self.node.work_requirements():
abbrev = wreq.unit_of_quantity.abbrev or ""
label = " ".join([
str(wreq.quantity),
abbrev,
wreq.resource_type.name])
wrq.append(label)
d["workReqmts"] = wrq
items = []
for item in self.node.order_items():
abbrev = item.unit_of_quantity.abbrev or ""
label = " ".join([
str(item.quantity),
abbrev,
item.resource_type.name])
items.append(label)
d["orderItems"] = items
prevs = []
try:
for p in self.node.previous_processes():
label = "~".join([
p.get_absolute_url(),
p.name])
prevs.append(label)
except:
pass
d["previous"] = prevs
next = []
try:
for p in self.node.next_processes():
label = "~".join([
p.get_absolute_url(),
p.name])
next.append(label)
except:
pass
d["next"] = next
return d
def create_events(orders, processes, events):
for order in orders:
te = TimelineEvent(
order,
order.due_date,
"",
order.timeline_title(),
order.get_absolute_url(),
order.timeline_description(),
)
events['events'].append(te.dictify())
for process in processes:
te = TimelineEvent(
process,
process.start_date,
process.end_date,
process.timeline_title(),
process.get_absolute_url(),
process.timeline_description(),
)
events['events'].append(te.dictify())
def explode_events(resource_type, backsked_date, events):
for art in resource_type.producing_agent_relationships():
order_date = backsked_date - datetime.timedelta(days=art.lead_time)
te = TimelineEvent(
art,
order_date,
"",
art.timeline_title(),
resource_type.url,
resource_type.description,
)
events['events'].append(te.dictify())
for pp in resource_type.producing_process_types():
start_date = backsked_date - datetime.timedelta(days=(pp.estimated_duration/1440))
ppte = TimelineEvent(
pp,
start_date,
backsked_date,
pp.timeline_title(),
pp.url,
pp.description,
)
events['events'].append(ppte.dictify())
for crt in pp.consumed_resource_types():
explode_events(crt, start_date, events)
def backschedule_process_types(commitment, process_type,events):
lead_time=1
arts = None
if commitment.from_agent:
arts = commitment.from_agent.resource_types.filter(resource_type=commitment.resource_type)
if arts:
lead_time = arts[0].lead_time
end_date = commitment.due_date - datetime.timedelta(days=lead_time)
start_date = end_date - datetime.timedelta(days=(process_type.estimated_duration/1440))
ppte = TimelineEvent(
process_type,
start_date,
end_date,
process_type.timeline_title(),
process_type.url,
process_type.description,
)
events['events'].append(ppte.dictify())
for crt in process_type.consumed_resource_types():
explode_events(crt, start_date, events)
def backschedule_process(order, process, events):
te = TimelineEvent(
process,
process.start_date,
process.end_date,
process.timeline_title(),
process.url,
process.notes,
)
events['events'].append(te.dictify())
for ic in process.incoming_commitments():
te = TimelineEvent(
ic,
ic.due_date,
"",
ic.timeline_title(),
ic.url,
ic.description,
)
events['events'].append(te.dictify())
resource_type = ic.resource_type
pcs = ic.associated_producing_commitments()
if pcs:
for pc in pcs:
if pc.order_item == ic.order_item:
te = TimelineEvent(
pc,
pc.due_date,
"",
pc.timeline_title(),
pc.url,
pc.description,
)
events['events'].append(te.dictify())
backschedule_process(order, pc.process, events)
return events
def backschedule_order(order, events):
te = TimelineEvent(
order,
order.due_date,
"",
order.timeline_title(),
"",
order.description,
)
events['events'].append(te.dictify())
for pc in order.producing_commitments():
te = TimelineEvent(
pc,
pc.due_date,
"",
pc.timeline_title(),
pc.url,
pc.description,
)
events['events'].append(te.dictify())
backschedule_process(order, pc.process, events)
class XbillNode(object):
def __init__(self, node, depth):
self.node = node
self.depth = depth
self.open = False
self.close = []
self.xbill_class = self.node.xbill_class()
def xbill_object(self):
return self.node.xbill_child_object()
def xbill_label(self):
return self.node.xbill_label()
def xbill_explanation(self):
return self.node.xbill_explanation()
#def category(self):
# return self.node.xbill_category()
def xbill_dfs(node, all_nodes, visited, depth):
"""
Performs a recursive depth-first search starting at ``node``.
"""
to_return = []
if node not in visited:
visited.append(node)
#to_return = [XbillNode(node,depth),]
to_return.append(XbillNode(node,depth))
#print "+created node:+", node, depth
for subnode in all_nodes:
parents = subnode.xbill_parent_object().xbill_parents()
xclass = subnode.xbill_class()
if subnode.node_id() != node.node_id():
if parents and node in parents:
#print "*active node:*", node, "*depth:*", depth, "*subnode:*", subnode, "*parent_object:*", subnode.xbill_parent_object(), "*parents:*", parents
#import pdb; pdb.set_trace()
to_return.extend(xbill_dfs(subnode, all_nodes, visited, depth+1))
return to_return
def explode_xbill_children(node, nodes, exploded):
if node not in nodes:
nodes.append(node)
#import pdb; pdb.set_trace()
xclass = node.xbill_class()
explode = True
if xclass == 'process-type':
#import pdb; pdb.set_trace()
pt = node.process_type
if pt in exploded:
explode = False
else:
exploded.append(pt)
if explode:
for kid in node.xbill_child_object().xbill_children():
explode_xbill_children(kid, nodes, exploded)
#todo: obsolete
def generate_xbill(resource_type):
nodes = []
exploded = []
for kid in resource_type.xbill_children():
explode_xbill_children(kid, nodes, exploded)
nodes = list(set(nodes))
#import pdb; pdb.set_trace()
to_return = []
visited = []
for kid in resource_type.xbill_children():
to_return.extend(xbill_dfs(kid, nodes, visited, 1))
annotate_tree_properties(to_return)
#to_return.sort(lambda x, y: cmp(x.xbill_object().name,
# y.xbill_object().name))
return to_return
#adapted from threaded_comments.util
def annotate_tree_properties(nodes):
"""
iterate through nodes and adds some magic properties to each of them
representing opening list of children and closing it
"""
if not nodes:
return
it = iter(nodes)
# get the first item, this will fail if no items !
old = it.next()
# first item starts a new thread
old.open = True
for c in it:
# increase the depth
if c.depth > old.depth:
c.open = True
else: # c.depth <= old.depth
# close some depths
old.close = range(old.depth - c.depth)
# iterate
old = c
old.close = range(old.depth)
|
valnet/valuenetwork
|
valuenetwork/valueaccounting/utils.py
|
Python
|
agpl-3.0
| 24,494
|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from rest_framework import viewsets
from permissions import CategoryPermissions, PostPermissions, AnnouncementPermissions
from models import Category, Post, Announcement
from serializers import CategorySerializer, PostSerializer, AnnouncementSerializer
# initiate logger
logging.getLogger(__name__)
class CategoryViewSet(viewsets.ModelViewSet):
""" CategoryViewSet
Returns all active categories which can be used for placing a new discussion under
* this web service only accessible for query
"""
queryset = Category.objects.all()
serializer_class = CategorySerializer
permission_classes = (CategoryPermissions, )
def get_queryset(self):
""" Only active categories
"""
return Category.objects.filter(is_active=True)
class PostViewSet(viewsets.ModelViewSet):
"""PostViewSet
Post API will be used to creating new discussion, listing, and replying to a post
"""
queryset = Post.objects.all()
serializer_class = PostSerializer
permission_classes = (PostPermissions, )
def pre_save(self, obj):
obj.created_by = self.request.user
def get_queryset(self):
"""
"""
return Post.objects.filter(reply_to__isnull=True)
class AnnouncementViewSet(viewsets.ModelViewSet):
"""AnnouncementViewSet
announcements can only be retrieved by authorized users
* if announcement has been retrieved by user X, user X will no more see the announcement
as it will be marked as read
"""
queryset = Announcement.objects.all()
serializer_class = AnnouncementSerializer
permission_classes = (AnnouncementPermissions, )
def retrieve(self, request, *args, **kwargs):
response = super(AnnouncementViewSet, self).retrieve(request, *args, **kwargs)
if self.object.mark_as_read.filter(id=request.user.id).count() is 0:
self.object.mark_as_read.add(request.user)
return response
|
Diwaniya-Labs/django-rest-forum
|
discussion/views.py
|
Python
|
lgpl-3.0
| 2,033
|
def foo():
pass
|
siddhika1889/Pydev-Editor
|
tests/pysrc/mod/utils.py
|
Python
|
epl-1.0
| 19
|
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import subprocess, tempfile, os, time
from setup import Command, installer_name
from setup.build_environment import HOST, PROJECT
BASE_RSYNC = ['rsync', '-avz', '--delete', '--force']
EXCLUDES = []
for x in [
'src/calibre/plugins', 'src/calibre/manual', 'src/calibre/trac',
'.bzr', '.build', '.svn', 'build', 'dist', 'imgsrc', '*.pyc', '*.pyo', '*.swp',
'*.swo', 'format_docs']:
EXCLUDES.extend(['--exclude', x])
SAFE_EXCLUDES = ['"%s"'%x if '*' in x else x for x in EXCLUDES]
def get_rsync_pw():
return open('/home/kovid/work/kde/conf/buildbot').read().partition(
':')[-1].strip()
def is_vm_running(name):
pat = '/%s/'%name
pids= [pid for pid in os.listdir('/proc') if pid.isdigit()]
for pid in pids:
cmdline = open(os.path.join('/proc', pid, 'cmdline'), 'rb').read()
if 'vmware-vmx' in cmdline and pat in cmdline:
return True
return False
class Rsync(Command):
description = 'Sync source tree from development machine'
SYNC_CMD = ' '.join(BASE_RSYNC+SAFE_EXCLUDES+
['rsync://buildbot@{host}/work/{project}', '..'])
def run(self, opts):
cmd = self.SYNC_CMD.format(host=HOST, project=PROJECT)
env = dict(os.environ)
env['RSYNC_PASSWORD'] = get_rsync_pw()
self.info(cmd)
subprocess.check_call(cmd, shell=True, env=env)
class Push(Command):
description = 'Push code to another host'
def run(self, opts):
from threading import Thread
threads = []
for host, vmname in {
r'Owner@winxp:/cygdrive/c/Documents\ and\ Settings/Owner/calibre':'winxp',
'kovid@ox:calibre':None,
r'kovid@win7:/cygdrive/c/Users/kovid/calibre':'Windows 7',
}.iteritems():
if vmname is None or is_vm_running(vmname):
rcmd = BASE_RSYNC + EXCLUDES + ['.', host]
print '\n\nPushing to:', vmname or host, '\n'
threads.append(Thread(target=subprocess.check_call, args=(rcmd,),
kwargs={'stdout':open(os.devnull, 'wb')}))
threads[-1].start()
for thread in threads:
thread.join()
class VMInstaller(Command):
EXTRA_SLEEP = 5
INSTALLER_EXT = None
VM = None
VM_NAME = None
VM_CHECK = None
FREEZE_COMMAND = None
FREEZE_TEMPLATE = 'python setup.py {freeze_command}'
SHUTDOWN_CMD = ['sudo', 'poweroff']
IS_64_BIT = False
BUILD_CMD = 'ssh -t %s bash build-calibre'
BUILD_PREFIX = ['#!/bin/bash', 'export CALIBRE_BUILDBOT=1']
BUILD_RSYNC = [r'cd ~/build/{project}', Rsync.SYNC_CMD]
BUILD_CLEAN = ['rm -rf dist/* build/* src/calibre/plugins/*']
BUILD_BUILD = ['python setup.py build',]
def add_options(self, parser):
if not parser.has_option('--dont-shutdown'):
parser.add_option('-s', '--dont-shutdown', default=False,
action='store_true', help='Dont shutdown the VM after building')
if not parser.has_option('--vm'):
parser.add_option('--vm', help='Path to VM launcher script')
def get_build_script(self):
rs = ['export RSYNC_PASSWORD=%s'%get_rsync_pw()]
ans = '\n'.join(self.BUILD_PREFIX + rs)+'\n\n'
ans += ' && \\\n'.join(self.BUILD_RSYNC) + ' && \\\n'
ans += ' && \\\n'.join(self.BUILD_CLEAN) + ' && \\\n'
ans += ' && \\\n'.join(self.BUILD_BUILD) + ' && \\\n'
ans += self.FREEZE_TEMPLATE.format(freeze_command=self.FREEZE_COMMAND) + '\n'
ans = ans.format(project=PROJECT, host=HOST)
return ans
def vmware_started(self):
return 'started' in subprocess.Popen('/etc/init.d/vmware status', shell=True, stdout=subprocess.PIPE).stdout.read()
def start_vmware(self):
if not self.vmware_started():
if os.path.exists('/dev/kvm'):
subprocess.check_call('sudo rmmod -w kvm-intel kvm', shell=True)
subprocess.Popen('sudo /etc/init.d/vmware start', shell=True)
def stop_vmware(self):
while True:
try:
subprocess.check_call('sudo /etc/init.d/vmware stop', shell=True)
break
except:
pass
while 'vmblock' in open('/proc/modules').read():
subprocess.check_call('sudo rmmod -f vmblock')
def run_vm(self):
if is_vm_running(self.VM_CHECK or self.VM_NAME): return
self.__p = subprocess.Popen([self.vm])
def start_vm(self, sleep=75):
ssh_host = self.VM_NAME
self.run_vm()
build_script = self.get_build_script()
t = tempfile.NamedTemporaryFile(suffix='.sh')
t.write(build_script)
t.flush()
print 'Waiting for VM to startup'
while subprocess.call('ping -q -c1 '+ssh_host, shell=True,
stdout=open('/dev/null', 'w')) != 0:
time.sleep(5)
time.sleep(self.EXTRA_SLEEP)
print 'Trying to SSH into VM'
subprocess.check_call(('scp', t.name, ssh_host+':build-calibre'))
subprocess.check_call(self.BUILD_CMD%ssh_host, shell=True)
def installer(self):
return installer_name(self.INSTALLER_EXT, self.IS_64_BIT)
def run(self, opts):
for x in ('dont_shutdown', 'vm'):
setattr(self, x, getattr(opts, x))
if self.vm is None:
self.vm = self.VM
if not self.vmware_started():
self.start_vmware()
subprocess.call(['chmod', '-R', '+r', 'recipes'])
self.start_vm()
self.download_installer()
if not self.dont_shutdown:
subprocess.call(['ssh', self.VM_NAME]+self.SHUTDOWN_CMD)
def download_installer(self):
installer = self.installer()
subprocess.check_call(['scp',
self.VM_NAME+':build/calibre/'+installer, 'dist'])
if not os.path.exists(installer):
self.warn('Failed to download installer: '+installer)
raise SystemExit(1)
def clean(self):
installer = self.installer()
if os.path.exists(installer):
os.remove(installer)
|
Eksmo/calibre
|
setup/installer/__init__.py
|
Python
|
gpl-3.0
| 6,405
|
#
# DAPLink Interface Firmware
# Copyright (c) 2016-2017, ARM Limited, All Rights Reserved
# SPDX-License-Identifier: Apache-2.0
#
# 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 mbed_lstools
import threading
import time
import pyocd
should_exit = False
exit_cond = threading.Condition()
print_mut = threading.RLock()
global_start_time = time.time()
def _get_time():
return time.time() - global_start_time
def sync_print(msg):
with print_mut:
print(msg)
def hid_main(thread_index, board_id):
global should_exit
count = 0
try:
device = pyocd.probe.pydapaccess.DAPAccess.get_device(board_id)
while not should_exit:
device.open()
info = device.vendor(0)
info = str(bytearray(info[1:1 + info[0]]))
assert info == board_id
device.close()
if count % 100 == 0:
sync_print("Thread %i on loop %10i at %.6f - %s - board %s" %
(thread_index, count, _get_time(),
time.strftime("%H:%M:%S"), board_id))
count += 1
except:
sync_print("Thread %i exception board %s" % (thread_index, board_id))
with exit_cond:
should_exit = 1
exit_cond.notify_all()
raise
def main():
global should_exit
lstools = mbed_lstools.create()
mbed_list = lstools.list_mbeds()
for thread_index, mbed in enumerate(mbed_list):
msd_thread = threading.Thread(target=hid_main,
args=(thread_index, mbed['target_id']))
msd_thread.start()
try:
with exit_cond:
while not should_exit:
exit_cond.wait(1)
except KeyboardInterrupt:
pass
should_exit = True
sync_print("Exiting")
if __name__ == "__main__":
main()
|
google/DAPLink-port
|
test/stress_tests/hid_usb_test.py
|
Python
|
apache-2.0
| 2,358
|
# -*- coding: utf-8 -*-
#
import re
import data_tree
from collections import OrderedDict
from itertools import chain
import logging
import datetime
import uuid
from functools import wraps
import time
import ipaddress
import psutil
from django.utils.translation import ugettext_lazy as _
from ..exceptions import JMSException
UUID_PATTERN = re.compile(r'\w{8}(-\w{4}){3}-\w{12}')
ipip_db = None
def combine_seq(s1, s2, callback=None):
for s in (s1, s2):
if not hasattr(s, '__iter__'):
return []
seq = chain(s1, s2)
if callback:
seq = map(callback, seq)
return seq
def get_logger(name=''):
return logging.getLogger('jumpserver.%s' % name)
def get_syslogger(name=''):
return logging.getLogger('syslog.%s' % name)
def timesince(dt, since='', default="just now"):
"""
Returns string representing "time since" e.g.
3 days, 5 hours.
"""
if not since:
since = datetime.datetime.utcnow()
if since is None:
return default
diff = since - dt
periods = (
(diff.days / 365, "year", "years"),
(diff.days / 30, "month", "months"),
(diff.days / 7, "week", "weeks"),
(diff.days, "day", "days"),
(diff.seconds / 3600, "hour", "hours"),
(diff.seconds / 60, "minute", "minutes"),
(diff.seconds, "second", "seconds"),
)
for period, singular, plural in periods:
if period:
return "%d %s" % (period, singular if period == 1 else plural)
return default
def setattr_bulk(seq, key, value):
def set_attr(obj):
setattr(obj, key, value)
return obj
return map(set_attr, seq)
def set_or_append_attr_bulk(seq, key, value):
for obj in seq:
ori = getattr(obj, key, None)
if ori:
value += " " + ori
setattr(obj, key, value)
def capacity_convert(size, expect='auto', rate=1000):
"""
:param size: '100MB', '1G'
:param expect: 'K, M, G, T
:param rate: Default 1000, may be 1024
:return:
"""
rate_mapping = (
('K', rate),
('KB', rate),
('M', rate**2),
('MB', rate**2),
('G', rate**3),
('GB', rate**3),
('T', rate**4),
('TB', rate**4),
)
rate_mapping = OrderedDict(rate_mapping)
std_size = 0 # To KB
for unit in rate_mapping:
if size.endswith(unit):
try:
std_size = float(size.strip(unit).strip()) * rate_mapping[unit]
except ValueError:
pass
if expect == 'auto':
for unit, rate_ in rate_mapping.items():
if rate > std_size/rate_ >= 1 or unit == "T":
expect = unit
break
if expect not in rate_mapping:
expect = 'K'
expect_size = std_size / rate_mapping[expect]
return expect_size, expect
def sum_capacity(cap_list):
total = 0
for cap in cap_list:
size, _ = capacity_convert(cap, expect='K')
total += size
total = '{} K'.format(total)
return capacity_convert(total, expect='auto')
def get_short_uuid_str():
return str(uuid.uuid4()).split('-')[-1]
def is_uuid(seq):
if isinstance(seq, uuid.UUID):
return True
elif isinstance(seq, str) and UUID_PATTERN.match(seq):
return True
elif isinstance(seq, (list, tuple)):
all([is_uuid(x) for x in seq])
return False
def get_request_ip(request):
x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR', '').split(',')
if x_forwarded_for and x_forwarded_for[0]:
login_ip = x_forwarded_for[0]
else:
login_ip = request.META.get('REMOTE_ADDR', '')
return login_ip
def get_request_ip_or_data(request):
ip = ''
if hasattr(request, 'data'):
ip = request.data.get('remote_addr', '')
ip = ip or get_request_ip(request)
return ip
def get_request_user_agent(request):
user_agent = request.META.get('HTTP_USER_AGENT', '')
return user_agent
def validate_ip(ip):
try:
ipaddress.ip_address(ip)
return True
except ValueError:
pass
return False
def with_cache(func):
cache = {}
key = "_{}.{}".format(func.__module__, func.__name__)
@wraps(func)
def wrapper(*args, **kwargs):
cached = cache.get(key)
if cached:
return cached
res = func(*args, **kwargs)
cache[key] = res
return res
return wrapper
def random_string(length):
import string
import random
charset = string.ascii_letters + string.digits
s = [random.choice(charset) for i in range(length)]
return ''.join(s)
logger = get_logger(__name__)
def timeit(func):
def wrapper(*args, **kwargs):
if hasattr(func, '__name__'):
name = func.__name__
else:
name = func
logger.debug("Start call: {}".format(name))
now = time.time()
result = func(*args, **kwargs)
using = (time.time() - now) * 1000
msg = "End call {}, using: {:.1f}ms".format(name, using)
logger.debug(msg)
return result
return wrapper
def group_obj_by_count(objs, count=50):
objs_grouped = [
objs[i:i + count] for i in range(0, len(objs), count)
]
return objs_grouped
def dict_get_any(d, keys):
for key in keys:
value = d.get(key)
if value:
return value
return None
class lazyproperty:
def __init__(self, func):
self.func = func
def __get__(self, instance, cls):
if instance is None:
return self
else:
value = self.func(instance)
setattr(instance, self.func.__name__, value)
return value
def get_disk_usage():
partitions = psutil.disk_partitions()
mount_points = [p.mountpoint for p in partitions]
usages = {p: psutil.disk_usage(p) for p in mount_points}
return usages
|
skyoo/jumpserver
|
apps/common/utils/common.py
|
Python
|
gpl-2.0
| 5,947
|
import numpy as np
from numpy.testing import assert_array_equal
from nose import with_setup
try:
from nose.tools import assert_is
except ImportError:
from landlab.testing.tools import assert_is
from landlab import RasterModelGrid
_GRIDS = {}
def setup_grids():
"""Set up test grids with unit and non-unit spacing."""
_GRIDS.update({
'unit': RasterModelGrid(4, 5),
'non_unit': RasterModelGrid(4, 5, 2.),
'non_square': RasterModelGrid((4, 5), spacing=(5, 2)),
})
@with_setup(setup_grids)
def test_unit_spacing():
"""Test with a grid with unit spacing."""
rmg, values_at_nodes = _GRIDS['unit'], np.arange(20)
grads = rmg.calc_grad_at_link(values_at_nodes)[rmg.active_links]
assert_array_equal(grads,
np.array([5.0, 5.0, 5.0,
1.0, 1.0, 1.0, 1.0,
5.0, 5.0, 5.0,
1.0, 1.0, 1.0, 1.0,
5.0, 5.0, 5.0,]))
diffs = rmg.calculate_diff_at_active_links(values_at_nodes)
assert_array_equal(grads, diffs)
@with_setup(setup_grids)
def test_non_unit_spacing():
"""Test with a grid with non-unit spacing."""
rmg, values_at_nodes = _GRIDS['non_square'], np.arange(20)
grads = rmg.calc_grad_at_link(values_at_nodes)[rmg.active_links]
assert_array_equal(grads,
np.array([1.0, 1.0, 1.0,
0.5, 0.5, 0.5, 0.5,
1.0, 1.0, 1.0,
0.5, 0.5, 0.5, 0.5,
1.0, 1.0, 1.0]))
diffs = rmg.calculate_diff_at_active_links(values_at_nodes)
assert_array_equal(diffs,
np.array([5.0, 5.0, 5.0,
1.0, 1.0, 1.0, 1.0,
5.0, 5.0, 5.0,
1.0, 1.0, 1.0, 1.0,
5.0, 5.0, 5.0,]))
@with_setup(setup_grids)
def test_out_array():
"""Test using the out keyword."""
rmg, values_at_nodes = _GRIDS['non_square'], np.arange(20)
output_array = np.empty(rmg.number_of_links)
rtn_array = rmg.calc_grad_at_link(values_at_nodes, out=output_array)
assert_array_equal(rtn_array[rmg.active_links],
np.array([1.0, 1.0, 1.0,
0.5, 0.5, 0.5, 0.5,
1.0, 1.0, 1.0,
0.5, 0.5, 0.5, 0.5,
1.0, 1.0, 1.0]))
assert_is(rtn_array, output_array)
@with_setup(setup_grids)
def test_diff_out_array():
"""Test returned array is the same as that passed as out keyword."""
rmg = RasterModelGrid(4, 5)
values = np.arange(20)
diff = np.empty(17)
rtn_diff = rmg.calculate_diff_at_active_links(values, out=diff)
assert_array_equal(
diff,
np.array([5, 5, 5,
1, 1, 1, 1,
5, 5, 5,
1, 1, 1, 1,
5, 5, 5]))
assert_is(rtn_diff, diff)
|
csherwood-usgs/landlab
|
landlab/grid/tests/test_raster_funcs/test_gradients_at_active_links.py
|
Python
|
mit
| 3,093
|
#!/usr/bin/env python
# Tests check_format.py. This must be run under docker via
# check_format_test.py, or you are liable to get the wrong clang, and
# all kinds of bad results.
import os
import shutil
import subprocess
def getenvFallback(envvar, fallback):
val = os.getenv(envvar)
if not val:
val = fallback
return val
tools = os.path.dirname(os.path.realpath(__file__))
tmp = os.path.join(getenvFallback('TEST_TMPDIR', "/tmp"), "check_format_test")
src = os.path.join(tools, 'testdata', 'check_format')
check_format = os.path.join(tools, 'check_format.py')
errors = 0
# Echoes and runs an OS command, returning exit status and the captured
# stdout+stderr as a string array.
def runCommand(command):
stdout = []
status = 0
try:
out = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT).strip()
if out:
stdout = out.split("\n")
except subprocess.CalledProcessError as e:
status = e.returncode
for line in e.output.splitlines():
stdout.append(line)
print("%s" % command)
return status, stdout
# Runs the 'check_format' operation, on the specified file, printing
# the comamnd run and the status code as well as the stdout, and returning
# all of that to the caller.
def runCheckFormat(operation, filename):
command = check_format + " " + operation + " " + filename
status, stdout = runCommand(command)
return (command, status, stdout)
def getInputFile(filename):
infile = os.path.join(src, filename)
shutil.copyfile(infile, filename)
return filename
# Attempts to fix file, returning a 4-tuple: the command, input file name,
# output filename, captured stdout as an array of lines, and the error status
# code.
def fixFileHelper(filename):
infile = os.path.join(src, filename)
shutil.copyfile(infile, filename)
command, status, stdout = runCheckFormat("fix", getInputFile(filename))
return (command, infile, filename, status, stdout)
# Attempts to fix a file, returning the status code and the generated output.
# If the fix was successful, the diff is returned as a string-array. If the file
# was not fixable, the error-messages are returned as a string-array.
def fixFileExpectingSuccess(file):
command, infile, outfile, status, stdout = fixFileHelper(file)
if status != 0:
return 1
status, stdout = runCommand('diff ' + outfile + ' ' + infile + '.gold')
if status != 0:
return 1
return 0
def fixFileExpectingNoChange(file):
command, infile, outfile, status, stdout = fixFileHelper(file)
if status != 0:
return 1
status, stdout = runCommand('diff ' + outfile + ' ' + infile)
if status != 0:
return 1
return 0
def emitStdout(stdout):
for line in stdout:
print(" %s" % line)
def expectError(status, stdout, expected_substring):
if status == 0:
print("Expected failure, but succeeded")
return 1
for line in stdout:
if expected_substring in line:
return 0
print("Could not find '%s' in:\n" % expected_substring)
emitStdout(stdout)
return 1
def fixFileExpectingFailure(filename, expected_substring):
command, infile, outfile, status, stdout = fixFileHelper(filename)
return expectError(status, stdout, expected_substring)
def checkFileExpectingError(filename, expected_substring):
command, status, stdout = runCheckFormat("check", getInputFile(filename))
return expectError(status, stdout, expected_substring)
def checkFileExpectingOK(filename):
command, status, stdout = runCheckFormat("check", getInputFile(filename))
if status != 0:
print("status=%d, output:\n" % status)
emitStdout(stdout)
return 0
if __name__ == "__main__":
errors = 0
# Now create a temp directory to copy the input files, so we can fix them
# without actually fixing our testdata. This requires chdiring to the temp
# directory, so it's annoying to comingle check-tests and fix-tests.
shutil.rmtree(tmp, True)
os.makedirs(tmp)
os.chdir(tmp)
errors += fixFileExpectingSuccess("over_enthusiastic_spaces.cc")
errors += fixFileExpectingFailure("no_namespace_envoy.cc",
"Unable to find Envoy namespace or NOLINT(namespace-envoy)")
errors += fixFileExpectingNoChange("ok_file.cc")
errors += checkFileExpectingError("over_enthusiastic_spaces.cc",
"./over_enthusiastic_spaces.cc:3: over-enthusiastic spaces")
errors += checkFileExpectingOK("ok_file.cc")
if errors != 0:
print("%d FAILURES" % errors)
exit(1)
print("PASS")
exit(0)
|
sebrandon1/envoy
|
tools/check_format_test_run_under_docker.py
|
Python
|
apache-2.0
| 4,508
|
"""
The :mod:`dic.video` module provides functions to export video frames and convert an image sequence to a video.
The latter assumes the FFMPEG is installed and available on your path.
"""
from __future__ import absolute_import, division, print_function
import itertools
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
import matplotlib.pyplot as plt
import multiprocessing as mp
import os
import subprocess
import sys
from tqdm import tqdm
__all__ = ["export_frames", "image_sequence_to_video"]
def _save_frame_worker(args):
"""
Saves a single frame in the video sequence.
Parameters
----------
args: (int, callable, str, dict)
Tuple containing ``(i, frame_creator, ftemplate, savefig_options)``, i.e. all the data
required to save the ``i``th frame.
"""
i, frame_creator, ftemplate, savefig_options = args
fig = frame_creator(i)
canvas = FigureCanvas(fig)
canvas.print_figure(ftemplate.format(i), **savefig_options)
plt.close(fig)
def export_frames(frame_creator, output_directory=None, output_filename="frame.png", savefig_options=None):
"""
Exports video frames by calling ``frame_creator(i)`` where ``i`` is the iteration number
belonging to the range ``[0, len(frame_creator)]``. Therefore, the ``frame_creator`` must be
callable and accept a single argument ``i``. The ``frame_creator`` must also define the
``__len__`` method that returns the number frames that the creator intends to create.
Parameters
----------
frame_creator : callable
Object responsible for creating the frame. As input the ``frame_creator`` will be called with the frame number
``i`` and is expected to return a figure of type ``matplotlib.figure.Figure``. The object must define
``__call__(self, i)`` and ``__len(self)__`` methods.
output_directory : str, optional
Directory to place the frames into, If ``None`` is specified the frames will be placed in the current
working directory.
output_filename : str, optional
Filename to save the frames as. The frame number will be appending to the output automatically.
savefig_options : dict, optional
Keyword arguments to pass to ``matplotlib.pyplot.savefig``.
"""
fbase, fext = os.path.splitext(output_filename)
ftemplate = fbase + "_{:03d}" + fext
num_frames = len(frame_creator)
if output_directory is not None:
if not os.path.exists(output_directory):
os.makedirs(output_directory)
ftemplate = os.path.join(output_directory, ftemplate)
if savefig_options is None:
savefig_options = {}
# create a single iterable to send arguments to each process
args = zip(range(num_frames),
itertools.repeat(frame_creator, num_frames),
itertools.repeat(ftemplate, num_frames),
itertools.repeat(savefig_options, num_frames))
if plt.get_backend().lower() == "agg":
num_processes = mp.cpu_count()
else:
num_processes = 1
plt.ioff()
pool = mp.Pool(processes=num_processes, maxtasksperchild=1)
for _ in tqdm(pool.imap(_save_frame_worker, args), total=num_frames, file=sys.stdout, desc="Exporting frames"):
pass
pool.close()
pool.join()
plt.ion()
print("Frames successfully exported.")
def _scale_to_ffmpeg_arg(scale):
"""
Returns the FFMPEG command line argument to set the scale to a value where both the width and height are
divisible by 2.
Parameters
----------
scale : (int, int) or None
Video scale in the format ``(width, height)`` in pixels. If ``None`` is specified then the scale is set
such that the dimensions are divisible by 2 but kept as close to the original resolution as possible.
Returns
-------
str
FFMPEG command line scale.
"""
if scale is None:
return "\"scale=trunc(iw/2)*2:trunc(ih/2)*2\""
if all(i == -1 for i in scale):
raise RuntimeError("Both width and height cannot be set to -1. "
"Use None if you would like to auto-scale both dimensions.")
if scale[0] != -1:
width = "{:d}".format(scale[0])
else:
width = "trunc(oh*a/2)*2"
if scale[1] != -1:
height = "{:d}".format(scale[1])
else:
height = "trunc(ow/a/2)*2"
return "\"scale={:s}:{:s}\"".format(width, height)
def image_sequence_to_video(input_template, output_filename, crf=23, scale=None, fps=24):
"""
Converts an image sequence into a video using FFMPEG.
Parameters
----------
input_template : str
The ``-i`` parameter passed to FFMPEG. This should specify the naming convention of the image sequence, e.g. ``frame_%03d.png``.
output_filename : str
Name of file to save the movie to, e.g. ``movie.mp4``.
scale : (int, int), optional
Video scale in the format ``(width, height)`` in pixels. If you'd like to keep the aspect ratio and scale only
one dimension, set the value for the direction desired and use the value ``-1`` for the other dimension,
e.g. ``(720, -1)`` for 720p video resolution. The default is ``None`` which resizes the image such that the width
and height are divisible by 2 (a requirement of the video encoder) but tries to keep the resolution as
close to the original image as possible.
crf : int [0-51], optional
The range of the quantizer scale is 0-51: where 0 is lossless, 23 is default, and 51 is worst possible.
A lower value is a higher quality and a subjectively sane range is 18-28. Consider 18 to be visually lossless
or nearly so: it should look the same or nearly the same as the input but it isn't technically lossless.
The range is exponential, so increasing the CRF value +6 is roughly half the bitrate while -6 is roughly
twice the bitrate. General usage is to choose the highest CRF value that still provides an acceptable quality.
If the output looks good, then try a higher value and if it looks bad then choose a lower value.
(credit: https://trac.ffmpeg.org/wiki/Encode/H.264)
fps : float, optional
Number of frames per second in the output video. The default is 24.
"""
fps_arg = str(fps)
crf_arg = "{:d}".format(crf)
input_arg = "\"{:s}\"".format(input_template)
scale_arg = _scale_to_ffmpeg_arg(scale)
output_arg = "\"{:s}\"".format(output_filename)
args = ["ffmpeg",
"-r", fps_arg,
"-i", input_arg,
"-r", fps_arg,
"-crf", crf_arg,
"-c:v", "libx264",
"-pix_fmt", "yuv420p",
"-vf", scale_arg,
"-y",
output_arg]
cmd = " ".join(args)
print(cmd)
print("Converting images into video...")
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1)
with p.stdout:
for line in iter(p.stdout.readline, b''):
sys.stdout.write(line)
sys.stdout.flush()
p.wait()
|
latture/dic
|
dic/video.py
|
Python
|
mit
| 7,111
|
# 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.
"""Example code to do convolution."""
import os
import numpy as np
import scipy.signal
import tvm
from tvm.contrib import nvcc
import topi
from topi.util import get_const_tuple
TASK = "conv2d_hwcn_map"
USE_MANUAL_CODE = False
@tvm.register_func
def tvm_callback_cuda_compile(code):
ptx = nvcc.compile_cuda(code, target="ptx")
return ptx
def write_code(code, fname):
with open(fname, "w") as f:
f.write(code)
@tvm.register_func
def tvm_callback_cuda_postproc(code):
if not os.path.exists("perf"):
os.mkdir("perf")
write_code(code, "perf/%s_generated.cu" % TASK)
if USE_MANUAL_CODE:
code = open("perf/%s_manual.cu" % TASK).read()
return code
def test_conv2d_hwcn_map():
batch = 64
in_channel = 128
in_height = 16
in_width = 16
num_filter = 128
kernel = 3
stride = 2
padding = 'SAME'
A = tvm.placeholder((in_height, in_width, in_channel, batch), name='A')
W = tvm.placeholder((kernel, kernel, in_channel, num_filter), name='W')
B = topi.nn.conv2d_hwcn(A, W, stride, padding)
C = topi.nn.relu(B)
s1 = topi.cuda.schedule_conv2d_hwcn([B])
s2 = topi.cuda.schedule_conv2d_hwcn([C])
a_np = np.random.uniform(size=get_const_tuple(A.shape)).astype(A.dtype)
w_np = np.random.uniform(size=get_const_tuple(W.shape)).astype(W.dtype)
b_np = topi.testing.conv2d_hwcn_python(a_np, w_np, stride, padding)
c_np = np.maximum(b_np, 0)
def check_device(device):
if not tvm.module.enabled(device):
print("Skip because %s is not enabled" % device)
return
ctx = tvm.context(device, 0)
a = tvm.nd.array(a_np, ctx)
w = tvm.nd.array(w_np, ctx)
b = tvm.nd.array(np.zeros(get_const_tuple(B.shape), dtype=B.dtype), ctx)
c = tvm.nd.array(np.zeros(get_const_tuple(C.shape), dtype=C.dtype), ctx)
with tvm.build_config(auto_unroll_max_step=128,
unroll_explicit=device == 'rocm'):
func1 = tvm.build(s1, [A, W, B], device)
func1(a, w, b)
tvm.testing.assert_allclose(b.asnumpy(), b_np, rtol=1e-5)
func2 = tvm.build(s2, [A, W, C], device)
func2(a, w, c)
tvm.testing.assert_allclose(c.asnumpy(), c_np, rtol=1e-5)
for device in ['cuda', 'opencl', 'rocm']:
check_device(device)
if __name__ == "__main__":
test_conv2d_hwcn_map()
|
Huyuwei/tvm
|
topi/recipe/conv/test_conv2d_hwcn_map.py
|
Python
|
apache-2.0
| 3,208
|
# This file has to be run in pure Python mode!
# Imports from the CO𝘕CEPT code
from commons import *
from snapshot import load
import species
# Absolute path and name of this test
this_dir = os.path.dirname(os.path.realpath(__file__))
this_test = os.path.basename(os.path.dirname(this_dir))
# Read in data from the CO𝘕CEPT snapshots
species.allow_similarly_named_components = True
def get_directory(subtest, ncomponents, nprocs, subtiling=None):
directory = f'{this_dir}/{subtest}/output_{ncomponents}components_{nprocs}procs'
if subtiling is not None:
directory += f'_subtiling{subtiling}'
return directory
def load_results(subtest):
ncomponents_values = set()
nprocs_values = set()
subtiling_values = set()
directory_pattern = get_directory(subtest, '*', '*',
subtiling={'domain': None, 'tile': '*'}[subtest],
)
for directory in glob(directory_pattern):
match = re.search(directory_pattern.replace('*', '(.+)'), directory)
ncomponents_values.add(int(match.group(1)))
nprocs_values.add(int(match.group(2)))
if subtest == 'tile':
subtiling_values.add(int(match.group(3)))
ncomponents_values = sorted(ncomponents_values)
nprocs_values = sorted(nprocs_values)
if subtest == 'domain':
subtiling_values = [None]
elif subtest == 'tile':
subtiling_values = sorted(subtiling_values)
pos = {}
times = set()
lattice_sites = None
for ncomponents in ncomponents_values:
for nprocs in nprocs_values:
for subtiling in subtiling_values:
directory = get_directory(subtest, ncomponents, nprocs, subtiling)
for fname in sorted(glob(f'{directory}/snapshot_t=*')):
if not fname.endswith('.hdf5'):
continue
t = float(re.search(rf't=(.+){unit_time}', fname).group(1))
times.add(t)
snapshot = load(fname)
if subtest == 'domain':
posx, posy, posz, = [], [], []
elif subtest == 'tile':
if lattice_sites is None:
N = sum([component.N for component in snapshot.components])
N_lin = int(round(cbrt(N)))
distance = boxsize/N_lin
lattice_sites = []
for i in range(N_lin):
x = (0.5 + i)*distance
for j in range(N_lin):
y = (0.5 + j)*distance
for k in range(N_lin):
z = (0.5 + k)*distance
lattice_sites.append((x, y, z))
lattice_sites = asarray(lattice_sites)
posx = empty(N_lin**3, dtype=float)
posy = empty(N_lin**3, dtype=float)
posz = empty(N_lin**3, dtype=float)
indices_all = []
for component in snapshot.components:
if component.N == 0:
continue
if subtest == 'domain':
posx += list(component.posx)
posy += list(component.posy)
posz += list(component.posz)
elif subtest == 'tile':
# Sort particles according to the lattice
indices = []
for x, y, z in zip(component.posx, component.posy, component.posz):
orders = np.argsort(
sum((asarray((x, y, z)) - lattice_sites)**2, 1)
)
for order in orders:
if order not in indices_all:
indices .append(order)
indices_all.append(order)
break
indices = asarray(indices)
posx[indices] = component.posx
posy[indices] = component.posy
posz[indices] = component.posz
if subtest == 'tile':
key = (ncomponents, nprocs, subtiling, t)
elif subtest == 'domain':
key = (ncomponents, nprocs, t)
pos[key] = [asarray(posx), asarray(posy), asarray(posz)]
times = sorted(times)
softening_length = is_selected(component, select_softening_length)
return ncomponents_values, nprocs_values, subtiling_values, times, pos, softening_length
ncomponents_values = {}
nprocs_values = {}
subtiling_values = {}
times = {}
pos = {}
softening_length = {}
for subtest in ('domain', 'tile'):
(
ncomponents_values[subtest],
nprocs_values [subtest],
subtiling_values [subtest],
times [subtest],
pos [subtest],
softening_length [subtest],
) = load_results(subtest)
# Analyse domain subtest data
masterprint(f'Analysing {this_test} data ...')
subtest = 'domain'
abs_tol = 1*softening_length[subtest]
for ncomponents in ncomponents_values[subtest]:
for nprocs in nprocs_values[subtest]:
directory = get_directory(subtest, ncomponents, nprocs)
for t in times[subtest]:
posx, posy, posz = pos[subtest][ncomponents, nprocs, t]
if not (
isclose(mean(posx), 0.5*boxsize, rel_tol=0, abs_tol=abs_tol)
and isclose(mean(posy), 0.5*boxsize, rel_tol=0, abs_tol=abs_tol)
and isclose(mean(posz), 0.5*boxsize, rel_tol=0, abs_tol=abs_tol)
):
abort(
f'Asymmetric results obtained from running with {ncomponents} '
f'particle components on {nprocs} processes, for t >= {t}.\n'
f'See the renders in "{directory}" for visualizations.'
)
if t < times[subtest][-1]:
if not (
isclose(np.std(posx), np.std(posy), rel_tol=0, abs_tol=abs_tol)
and isclose(np.std(posy), np.std(posz), rel_tol=0, abs_tol=abs_tol)
and isclose(np.std(posz), np.std(posx), rel_tol=0, abs_tol=abs_tol)
):
abort(
f'Anisotropic results obtained from running with {ncomponents} '
f'particle components on {nprocs} processes, for t >= {t}.\n'
f'See the renders in "{directory}" for visualizations.'
)
else:
if not (
isclose(np.std(posx), 0, rel_tol=0, abs_tol=abs_tol)
and isclose(np.std(posy), 0, rel_tol=0, abs_tol=abs_tol)
and isclose(np.std(posz), 0, rel_tol=0, abs_tol=abs_tol)
):
abort(
f'Spherical symmetric collapse did not take place within the '
f'correct amount of time when running with {ncomponents} '
f'particle components on {nprocs} processes.\n'
f'See the renders in "{directory}" for visualizations.'
)
# Analyse tile subtest data
subtest = 'tile'
abs_tol = 1e-9*softening_length[subtest]
for ncomponents in ncomponents_values[subtest]:
for nprocs in nprocs_values[subtest]:
for subtiling in subtiling_values[subtest]:
directory = get_directory(subtest, ncomponents, nprocs, subtiling)
for t in times[subtest]:
posx, posy, posz = pos[subtest][ncomponents, nprocs, subtiling, t]
if t == times[subtest][0]:
posx_0, posy_0, posz_0 = posx, posy, posz
continue
if not (
isclose(max(abs(posx - posx_0)), 0, rel_tol=0, abs_tol=abs_tol)
and isclose(max(abs(posy - posy_0)), 0, rel_tol=0, abs_tol=abs_tol)
and isclose(max(abs(posz - posz_0)), 0, rel_tol=0, abs_tol=abs_tol)
):
abort(
f'Non-trivial particle evolution resulted from homogeneous and static '
f'initial condition when running with {ncomponents} particle '
f'components on {nprocs} processes using subtiling = {subtiling}, '
f'for t >= {t}.\n'
f'See the renders in "{directory}" for visualizations.'
)
# Done analysing
masterprint('done')
|
jmd-dk/concept
|
test/multicomponent/analyze.py
|
Python
|
gpl-3.0
| 8,969
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#########################################################################
# Copyright/License Notice (BSD License) #
#########################################################################
#########################################################################
# Copyright (c) 2010-2012, Daniel Knaggs - 2E0DPK/M6DPK #
# All rights reserved. #
# #
# 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 the author 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. #
#########################################################################
from danlog import DanLog
from ddp import *
import os
import pickle
import sys
import xmlrpclib
from xml.dom import minidom
###########
# Globals #
###########
client_callsign = ""
log = DanLog("XRProxyServer")
#############
# Constants #
#############
ALLOW_UNSIGNED_PACKETS = False
BACKEND_DATAMODE = "PSK500R"
BACKEND_HOSTNAME = "localhost"
BACKEND_PORT = 7362
DEBUG_MODE = False
DISABLE_CRYPTO = False
SPECIFICATION = 0
USE_TCP = 0
XMLRPC_SERVER = "http://127.0.0.1:7397/xmlrpc/"
XML_SETTINGS_FILE = "xrproxyserver-settings.xml"
###############
# Subroutines #
###############
def cBool(value):
if str(value).lower() == "false" or str(value) == "0":
return False
elif str(value).lower() == "true" or str(value) == "1":
return True
else:
return False
def exitProgram():
sys.exit(0)
def main():
global client_callsign
log.info("""
#########################################################################
# Copyright/License Notice (BSD License) #
#########################################################################
#########################################################################
# Copyright (c) 2010-2012, Daniel Knaggs - 2E0DPK/M6DPK #
# All rights reserved. #
# #
# 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 the author 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. #
#########################################################################
""")
log.info("")
log.info("XMLRPC Proxy - Server")
log.info("=====================")
log.info("Checking settings...")
if os.path.exists(XML_SETTINGS_FILE) == False:
log.warn("The XML settings file doesn't exist, create one...")
xmlXRPSettingsWrite()
log.info("The XML settings file has been created using the default settings. Please edit it and restart the XMLRPC proxy server once you're happy with the settings.")
exitProgram()
else:
log.info("Reading XML settings...")
xmlXRPSettingsRead()
# This will ensure it will have any new settings in
if os.path.exists(XML_SETTINGS_FILE + ".bak"):
os.unlink(XML_SETTINGS_FILE + ".bak")
os.rename(XML_SETTINGS_FILE, XML_SETTINGS_FILE + ".bak")
xmlXRPSettingsWrite()
log.info("Setting up DDP...")
ddp = DDP(hostname = BACKEND_HOSTNAME, port = BACKEND_PORT, data_mode = BACKEND_DATAMODE, timeout = 60., ack_timeout = 30., tx_hangtime = 1.25, data_length = 1024, specification = SPECIFICATION, disable_ec = False, disable_crypto = DISABLE_CRYPTO, allow_unsigned_packets = ALLOW_UNSIGNED_PACKETS, application = "DDP Example: XMLRPC Proxy", ignore_broadcast_packets = True, debug_mode = DEBUG_MODE)
log.info("")
while client_callsign == "":
print "Please enter your callsign: ",
client_callsign = readInput().strip().upper()
log.info("")
ddp.setCallsign(client_callsign)
log.info("Waiting for a packet...")
while True:
try:
data = ddp.receiveDataFromAny("XMLRPC")
if data is not None:
# Check the flags
d = data[0]
packet = data[1]
# Send the query off to the XMLRPC server
log.info("A XMLRPC packet has arrived, forwarding it on...")
call = pickle.loads(d)
s = xmlrpclib.ServerProxy(XMLRPC_SERVER)
t = getattr(s, call[0])
args = call[1]
tosend = pickle.dumps(t(*args), protocol = 2)
s = None
# Send the results back to the client
log.info("Transmitting the results back to the client...")
ddp.transmitData("XMLRPC", "", packet[ddp.SECTION_SOURCE], tosend, USE_TCP, 1)
except KeyboardInterrupt:
break
except Exception, ex:
log.fatal(ex)
log.info("Cleaning up...")
ddp.dispose()
ddp = None
log.info("Exiting...")
exitProgram()
def readInput():
return sys.stdin.readline().replace("\r", "").replace("\n", "")
def xmlXRPSettingsRead():
global ALLOW_UNSIGNED_PACKETS, BACKEND_DATAMODE, BACKEND_HOSTNAME, BACKEND_PORT, DEBUG_MODE, DISABLE_CRYPTO, SPECIFICATION, USE_TCP, XMLRPC_SERVER
if os.path.exists(XML_SETTINGS_FILE):
xmldoc = minidom.parse(XML_SETTINGS_FILE)
myvars = xmldoc.getElementsByTagName("Setting")
for var in myvars:
for key in var.attributes.keys():
val = str(var.attributes[key].value)
# Now put the correct values to correct key
if key == "BackendDataMode":
BACKEND_DATAMODE = val.upper()
elif key == "BackendHostname":
BACKEND_HOSTNAME = val
elif key == "BackendPort":
BACKEND_PORT = val.upper()
elif key == "Specification":
SPECIFICATION = int(val)
elif key == "UseTCP":
USE_TCP = int(val)
elif key == "AllowUnsignedPackets":
ALLOW_UNSIGNED_PACKETS = cBool(val)
elif key == "DisableCrypto":
DISABLE_CRYPTO = cBool(val)
elif key == "DebugMode":
DEBUG_MODE = cBool(val)
elif key == "XMLRPCServer":
XMLRPC_SERVER = val
else:
log.warn("XML setting attribute \"%s\" isn't known. Ignoring..." % key)
def xmlXRPSettingsWrite():
if os.path.exists(XML_SETTINGS_FILE) == False:
xmloutput = file(XML_SETTINGS_FILE, "w")
xmldoc = minidom.Document()
# Create header
settings = xmldoc.createElement("XRPServer")
xmldoc.appendChild(settings)
# Write each of the details one at a time, makes it easier for someone to alter the file using a text editor
var = xmldoc.createElement("Setting")
var.setAttribute("BackendDataMode", str(BACKEND_DATAMODE))
settings.appendChild(var)
var = xmldoc.createElement("Setting")
var.setAttribute("BackendHostname", str(BACKEND_HOSTNAME))
settings.appendChild(var)
var = xmldoc.createElement("Setting")
var.setAttribute("BackendPort", str(BACKEND_PORT))
settings.appendChild(var)
var = xmldoc.createElement("Setting")
var.setAttribute("Specification", str(SPECIFICATION))
settings.appendChild(var)
var = xmldoc.createElement("Setting")
var.setAttribute("UseTCP", str(USE_TCP))
settings.appendChild(var)
var = xmldoc.createElement("Setting")
var.setAttribute("AllowUnsignedPackets", str(ALLOW_UNSIGNED_PACKETS))
settings.appendChild(var)
var = xmldoc.createElement("Setting")
var.setAttribute("DisableCrypto", str(DISABLE_CRYPTO))
settings.appendChild(var)
var = xmldoc.createElement("Setting")
var.setAttribute("DebugMode", str(DEBUG_MODE))
settings.appendChild(var)
var = xmldoc.createElement("Setting")
var.setAttribute("XMLRPCServer", str(XMLRPC_SERVER))
settings.appendChild(var)
# Finally, save to the file
xmloutput.write(xmldoc.toprettyxml())
xmloutput.close()
##########################
# Main
##########################
if __name__ == "__main__":
main()
|
haxwithaxe/ddp
|
examples/xrproxy_server.py
|
Python
|
bsd-3-clause
| 11,364
|
# ______________________________________________________________________________
# ******************************************************************************
# ______________________________________________________________________________
# ******************************************************************************
from dynamic_graph import plug
from dynamic_graph.sot.core import *
from dynamic_graph.sot.core.math_small_entities import Derivator_of_Matrix
from dynamic_graph.sot.dynamics import *
from dynamic_graph.sot.dyninv import *
import dynamic_graph.script_shortcuts
from dynamic_graph.script_shortcuts import optionalparentheses
from dynamic_graph.matlab import matlab
from dynamic_graph.sot.core.matrix_util import matrixToTuple, vectorToTuple,rotate, matrixToRPY
from dynamic_graph.sot.core.meta_task_6d import MetaTask6d,toFlags
from dynamic_graph.sot.core.meta_tasks import setGain
from dynamic_graph.sot.core.meta_tasks_kine import *
from dynamic_graph.sot.core.meta_task_posture import MetaTaskKinePosture
from dynamic_graph.sot.core.meta_task_visual_point import MetaTaskVisualPoint
from dynamic_graph.sot.core.utils.viewer_helper import addRobotViewer,VisualPinger,updateComDisplay
from dynamic_graph.sot.core.utils.attime import attime,ALWAYS,refset,sigset
from numpy import *
from dynamic_graph.sot.core.utils.history import History
from dynamic_graph.sot.dyninv.robot_specific import pkgDataRootDir,modelName,robotDimension,initialConfig,gearRatio,inertiaRotor,specificitiesName,jointRankName
# --- ROBOT SIMU ---------------------------------------------------------------
# --- ROBOT SIMU ---------------------------------------------------------------
# --- ROBOT SIMU ---------------------------------------------------------------
robotName = 'romeo'
robotDim=robotDimension[robotName]
robot = RobotSimu('romeo')
robot.resize(robotDim)
dt=5e-3
from dynamic_graph.sot.dyninv.robot_specific import halfSittingConfig
x0=-0.00949035111398315034
y0=0
z0=0.64870185118253043
# halfSittingConfig[robotName] = (x0,y0,z0,0,0,0)+initialConfig[robotName][6:]
halfSittingConfig[robotName] = initialConfig[robotName]
q0=list(halfSittingConfig[robotName])
initialConfig[robotName]=tuple(q0)
robot.set( initialConfig[robotName] )
addRobotViewer(robot,small=True,small_extra=24,verbose=False)
#-------------------------------------------------------------------------------
#----- MAIN LOOP ---------------------------------------------------------------
#-------------------------------------------------------------------------------
from dynamic_graph.sot.core.utils.thread_interruptible_loop import loopInThread,loopShortcuts
@loopInThread
def inc():
robot.increment(dt)
attime.run(robot.control.time)
updateComDisplay(robot,dyn.com)
history.record()
runner=inc()
[go,stop,next,n]=loopShortcuts(runner)
#-----------------------------------------------------------------------------
#---- DYN --------------------------------------------------------------------
#-----------------------------------------------------------------------------
modelDir = pkgDataRootDir[robotName]
xmlDir = pkgDataRootDir[robotName]
specificitiesPath = xmlDir + '/' + specificitiesName[robotName]
jointRankPath = xmlDir + '/' + jointRankName[robotName]
dyn = Dynamic("dyn")
dyn.setFiles(modelDir, modelName[robotName],specificitiesPath,jointRankPath)
dyn.parse()
dyn.inertiaRotor.value = inertiaRotor[robotName]
dyn.gearRatio.value = gearRatio[robotName]
plug(robot.state,dyn.position)
dyn.velocity.value = robotDim*(0.,)
dyn.acceleration.value = robotDim*(0.,)
dyn.ffposition.unplug()
dyn.ffvelocity.unplug()
dyn.ffacceleration.unplug()
dyn.setProperty('ComputeBackwardDynamics','true')
dyn.setProperty('ComputeAccelerationCoM','true')
robot.control.unplug()
# ---- SOT ---------------------------------------------------------------------
# ---- SOT ---------------------------------------------------------------------
# ---- SOT ---------------------------------------------------------------------
# The solver SOTH of dyninv is used, but normally, the SOT solver should be sufficient
from dynamic_graph.sot.dyninv import SolverKine
def toList(sot):
return map(lambda x: x[1:-1],sot.dispStack().split('|')[1:])
SolverKine.toList = toList
sot = SolverKine('sot')
sot.setSize(robotDim)
plug(sot.control,robot.control)
# ---- TASKS -------------------------------------------------------------------
# ---- TASKS -------------------------------------------------------------------
# ---- TASKS -------------------------------------------------------------------
# ---- TASK GRIP ---
taskRH=MetaTaskKine6d('rh',dyn,'rh','right-wrist')
handMgrip=eye(4); handMgrip[0:3,3] = (0.07,-0.02,0)
taskRH.opmodif = matrixToTuple(handMgrip)
taskRH.feature.frame('desired')
taskLH=MetaTaskKine6d('lh',dyn,'lh','left-wrist')
taskLH.opmodif = matrixToTuple(handMgrip)
taskLH.feature.frame('desired')
# --- STATIC COM (if not walking)
taskCom = MetaTaskKineCom(dyn)
# --- TASK AVOID
taskShoulder=MetaTaskKine6d('shoulder',dyn,'shoulder','LShoulderPitch')
taskShoulder.feature.frame('desired')
gotoNd(taskShoulder,(0,0,0),'010')
taskShoulder.task = TaskInequality('taskShoulderAvoid')
taskShoulder.task.add(taskShoulder.feature.name)
taskShoulder.task.referenceInf.value = (-10,) # Xmin, Ymin
taskShoulder.task.referenceSup.value = (0.20,) # Xmin, Ymin
taskShoulder.task.dt.value=dt
taskShoulder.task.controlGain.value = 0.9
taskElbow=MetaTaskKine6d('elbow',dyn,'elbow','LElbowYaw')
taskElbow.feature.frame('desired')
gotoNd(taskElbow,(0,0,0),'010')
taskElbow.task = TaskInequality('taskElbowAvoid')
taskElbow.task.add(taskElbow.feature.name)
taskElbow.task.referenceInf.value = (-10,) # Xmin, Ymin
taskElbow.task.referenceSup.value = (0.20,) # Xmin, Ymin
taskElbow.task.dt.value=dt
taskElbow.task.controlGain.value = 0.9
# --- TASK SUPPORT --------------------------------------------------
featureSupport = FeatureGeneric('featureSupport')
plug(dyn.com,featureSupport.errorIN)
plug(dyn.Jcom,featureSupport.jacobianIN)
taskSupport=TaskInequality('taskSupport')
taskSupport.add(featureSupport.name)
taskSupport.selec.value = '011'
taskSupport.referenceInf.value = (-0.08,-0.15,0) # Xmin, Ymin
taskSupport.referenceSup.value = (0.11,0.15,0) # Xmax, Ymax
taskSupport.dt.value=dt
# --- TASK SUPPORT SMALL --------------------------------------------
featureSupportSmall = FeatureGeneric('featureSupportSmall')
plug(dyn.com,featureSupportSmall.errorIN)
plug(dyn.Jcom,featureSupportSmall.jacobianIN)
taskSupportSmall=TaskInequality('taskSupportSmall')
taskSupportSmall.add(featureSupportSmall.name)
taskSupportSmall.selec.value = '011'
#taskSupportSmall.referenceInf.value = (-0.02,-0.02,0) # Xmin, Ymin
#askSupportSmall.referenceSup.value = (0.02,0.02,0) # Xmax, Ymax
taskSupportSmall.referenceInf.value = (-0.02,-0.05,0) # Xmin, Ymin
taskSupportSmall.referenceSup.value = (0.02,0.05,0) # Xmax, Ymax
taskSupportSmall.dt.value=dt
# --- POSTURE ---
taskPosture = MetaTaskKinePosture(dyn)
# --- GAZE ---
taskGaze = MetaTaskVisualPoint('gaze',dyn,'head','gaze')
# Head to camera matrix transform
# Camera RU headMcam=array([[0.0,0.0,1.0,0.0825],[1.,0.0,0.0,-0.029],[0.0,1.,0.0,0.102],[0.0,0.0,0.0,1.0]])
# Camera LL
headMcam=array([[0.0,0.0,1.0,0.081],[1.,0.0,0.0,0.072],[0.0,1.,0.0,0.031],[0.0,0.0,0.0,1.0]])
headMcam = dot(headMcam,rotate('x',10*pi/180))
taskGaze.opmodif = matrixToTuple(headMcam)
# --- FOV ---
taskFoV = MetaTaskVisualPoint('FoV',dyn,'head','gaze')
taskFoV.opmodif = matrixToTuple(headMcam)
taskFoV.task=TaskInequality('taskFoVineq')
taskFoV.task.add(taskFoV.feature.name)
[Xmax,Ymax]=[0.38,0.28]
taskFoV.task.referenceInf.value = (-Xmax,-Ymax) # Xmin, Ymin
taskFoV.task.referenceSup.value = (Xmax,Ymax) # Xmax, Ymax
taskFoV.task.dt.value=dt
taskFoV.task.controlGain.value=0.01
taskFoV.featureDes.xy.value = (0,0)
# --- Task Joint Limits -----------------------------------------
dyn.upperJl.recompute(0)
dyn.lowerJl.recompute(0)
taskJL = TaskJointLimits('taskJL')
plug(dyn.position,taskJL.position)
taskJL.controlGain.value = 10
taskJL.referenceInf.value = dyn.lowerJl.value
taskJL.referenceSup.value = dyn.upperJl.value
taskJL.dt.value = dt
taskJL.selec.value = toFlags(range(6,22)+range(22,28)+range(29,35))
# --- CONTACTS
# define contactLF and contactRF
for name,joint in [ ['LF','left-ankle'], ['RF','right-ankle' ] ]:
contact = MetaTaskKine6d('contact'+name,dyn,name,joint)
contact.feature.frame('desired')
contact.gain.setConstant(10)
locals()['contact'+name] = contact
# --- TRACER -----------------------------------------------------------------
from dynamic_graph.tracer import *
tr = Tracer('tr')
tr.open('/tmp/','','.dat')
tr.start()
robot.after.addSignal('tr.triger')
tr.add('dyn.com','com')
history = History(dyn,1)
# --- SHORTCUTS ----------------------------------------------------------------
qn = taskJL.normalizedPosition
@optionalparentheses
def pqn(details=True):
''' Display the normalized configuration vector. '''
qn.recompute(robot.state.time)
s = [ "{0:.1f}".format(v) for v in qn.value]
if details:
print("Rleg: "+" ".join(s[:6]))
print("Lleg: "+" ".join(s[6:12]))
print("Body: "+" ".join(s[12:16]))
print("Rarm: "+" ".join(s[16:23]))
print("Larm :"+" ".join(s[23:30]))
else:
print(" ".join(s[:30]))
def jlbound(t=None):
'''Display the velocity bound induced by the JL as a double-column matrix.'''
if t==None: t=robot.state.time
taskJL.task.recompute(t)
return matrix([ [float(x),float(y)] for x,y
in [ c.split(',') for c in taskJL.task.value[6:-3].split('),(') ] ])
def p6d(R,t):
M=eye(4)
M[0:3,0:3]=R
M[0:3,3]=t
return M
def push(task):
if isinstance(task,str): taskName=task
elif "task" in task.__dict__: taskName=task.task.name
else: taskName=task.name
if taskName not in sot.toList():
sot.push(taskName)
if taskName!="taskposture" and "taskposture" in sot.toList():
sot.down("taskposture")
def pop(task):
if isinstance(task,str): taskName=task
elif "task" in task.__dict__: taskName=task.task.name
else: taskName=task.name
if taskName in sot.toList(): sot.rm(taskName)
# --- DISPLAY ------------------------------------------------------------------
# --- DISPLAY ------------------------------------------------------------------
# --- DISPLAY ------------------------------------------------------------------
RAD=pi/180
comproj = [0.1,-0.95,1.6]
#robot.viewer.updateElementConfig('footproj',[0.5,0.15,1.6+0.08,0,-pi/2,0 ])
robot.viewer.updateElementConfig('footproj',comproj+[0,-pi/2,0 ])
robot.viewer.updateElementConfig('zmp2',[0,0,-10,0,0,0])
class BallPosition:
def __init__(self,xyz=(0,-1.1,0.9)):
self.ball = xyz
self.prec = 0
self.t = 0
self.duration = 0
self.f = 0
self.xyz= self.ball
def move(self,xyz,duration=50):
self.prec = self.ball
self.ball = xyz
self.t = 0
self.duration = duration
self.changeTargets()
if duration>0:
self.f = lambda : self.moveDisplay()
attime(ALWAYS,self.f)
else:
self.moveDisplay()
def moveDisplay(self):
tau = 1.0 if self.duration<=0 else float(self.t) / self.duration
xyz = tau * array(self.ball) + (1-tau) * array(self.prec)
robot.viewer.updateElementConfig('zmp',vectorToTuple(xyz)+(0,0,0))
self.t += 1
if self.t>self.duration and self.duration>0:
attime.stop(self.f)
self.xyz= xyz
def changeTargets(self):
gotoNd(taskRH,self.ball,'111',(4.9,0.9,0.01,0.9))
taskFoV.goto3D(self.ball)
b = BallPosition()
tr.add(taskJL.name+".normalizedPosition","qn")
tr.add('dyn.com','com')
tr.add(taskRH.task.name+'.error','erh')
tr.add(taskFoV.feature.name+'.error','fov')
tr.add(taskFoV.task.name+'.normalizedPosition','fovn')
tr.add(taskSupportSmall.name+".normalizedPosition",'comsmalln')
tr.add(taskSupport.name+".normalizedPosition",'comn')
robot.after.addSignal(taskJL.name+".normalizedPosition")
robot.after.addSignal(taskSupportSmall.name+".normalizedPosition")
robot.after.addSignal(taskFoV.task.name+".normalizedPosition")
robot.after.addSignal(taskFoV.feature.name+'.error')
robot.after.addSignal(taskSupport.name+".normalizedPosition")
# --- RUN ----------------------------------------------------------------------
# --- RUN ----------------------------------------------------------------------
# --- RUN ----------------------------------------------------------------------
dyn.com.recompute(0)
taskCom.featureDes.errorIN.value = dyn.com.value
taskCom.task.controlGain.value = 10
ball = BallPosition((0,-1.1,0.9))
push(taskRH)
ball.move((0.5,-0.2,1.0),0)
next()
next()
next()
def config(ref=0):
if ref==0:
print '''Only the task RH'''
elif ref==1:
print '''Task RH + foot constraint, balance is kept'''
sot.addContact(contactRF)
sot.addContact(contactLF)
elif ref==2:
print '''Task RH + foot constraint, balance is lost'''
sot.addContact(contactRF)
sot.addContact(contactLF)
ball.move((-0.15,-0.2,1.3),0)
print 'pouet'
elif ref==3:
print '''Task RH + foot constraint + COM='''
sot.addContact(contactRF)
sot.addContact(contactLF)
push(taskCom)
ball.move((0.15,0.1,1),0)
elif ref==4:
print '''Task RH + foot constraint + COM= + JL'''
qu = list(dyn.upperJl.value)
qu[19]=0
taskJL.referenceSup.value =tuple(qu)
push(taskJL)
sot.addContact(contactRF)
sot.addContact(contactLF)
push(taskCom)
ball.move((0.15,0.1,1),0)
elif ref==5:
print '''Task RH + foot constraint + COM<'''
sot.addContact(contactRF)
sot.addContact(contactLF)
push(taskSupport)
ball.move((0.15,-0.2,1.3),0)
elif ref==6:
print '''Task RH + foot constraint + COM= + SINGULARITE '''
print '''(press 4x i to reach it)'''
sot.addContact(contactRF)
sot.addContact(contactLF)
push(taskCom)
ball.move((0.15,-0.2,1.3),0)
elif ref==7:
print '''Task RH + foot constraint + COM= + SINGULARITE + DAMPING'''
sot.addContact(contactRF)
sot.addContact(contactLF)
push(taskCom)
ball.move((0.15,-0.2,1.3),0)
sot.down(taskRH.task.name)
sot.down(taskRH.task.name)
sot.damping.value = 0.1
else:
print '''Not a correct config.'''
return
go()
c=config
@optionalparentheses
def i():
xyz=ball.xyz
xyz[0] += 0.1
ball.move(vectorToTuple(xyz),30)
def menu(ref=0):
print '\n\n\n\n\n\n\n\n\n'
print '''0: Only the task RH'''
print '''1: Task RH + foot constraint, balance is kept'''
print '''2: Task RH + foot constraint, balance is lost'''
print '''3: Task RH + foot constraint + COM='''
print '''4: Task RH + foot constraint + COM= + JL'''
print '''5: Task RH + foot constraint + COM<'''
print '''6: Task RH + foot constraint + COM= + SINGULARITE '''
print '''7: Task RH + foot constraint + COM= + SINGULARITE + DAMPING'''
print ''
uinp = raw_input(' Config? >> ')
config(int(uinp))
menu()
|
stack-of-tasks/sot-dyninv
|
python/2013_coursens/p105_demo_romeo.py
|
Python
|
lgpl-3.0
| 15,440
|
#! /usr/bin/python
from __future__ import print_function
from time import time
# Project Euler # 39
def is_solution(a, b, c):
return a ** 2 + b ** 2 == c ** 2
def find_solutions(p):
solutions = []
for i in range(1, p - 2):
for j in range(2, p - i - 2):
k = p - i - j
# this if statement is for performance
if k > j and k > i:
if is_solution(i, j, k):
solutions.append((i, j, k))
else:
break
return solutions
if __name__ == '__main__':
most = 0
start_time = time()
for i in range(6, 1000):
solutions = find_solutions(i)
if len(solutions) > most:
most = len(solutions)
most_solutions = i
if solutions:
print("solutions for", i, "are", solutions)
print("number with most solutions is",
most_solutions,
"with",
most,
"solutions found in time:",
time() - start_time)
|
henry808/euler
|
039/eul039.py
|
Python
|
mit
| 1,017
|
# coding: utf-8
import sys
import os
import os.path
import time
import copy
from flask import Flask, request, render_template, Response, abort, \
redirect, url_for, g, flash, session
sys.path = ([sys.path[0]]
+ [os.path.join(os.path.dirname(__file__), "../lib")]
+ sys.path[1:])
import dataprocessor as dp
sys.path = [sys.path[0]] + sys.path[2:]
app = Flask(__name__)
@app.before_request
def before_request():
g.data_path = app.config["DATA_PATH"]
@app.route('/')
def show_projectlist():
with dp.io.SyncDataHandler(g.data_path) as dh:
nl = dh.get()
projects = dp.filter.node_type(nl, "project")
for p in projects:
p["num_children"] = len(p["children"])
return render_template('projectlist.html', projects=projects)
@app.route('/ipynblist')
def show_ipynblist():
nl = dp.io.load([], g.data_path)
ipynb = dp.filter.node_type(nl, "ipynb")
nb = dp.ipynb.gather_notebooks()
for n in ipynb:
p = n["path"]
try:
n["url"] = dp.ipynb.resolve_url(p, nb)
except dp.exception.DataProcessorError:
n["url"] = ""
n["name"] = dp.ipynb.resolve_name(p)
n["mtime"] = os.stat(p).st_mtime
n["mtime_str"] = time.strftime("%Y/%m/%d-%H:%M:%S",
time.localtime(n["mtime"]))
# for tag
ipynb = copy.deepcopy(ipynb)
for n in ipynb:
n["tag-nodes"] = []
for p in n["parents"]:
n["tag-nodes"].append(dp.nodes.get(nl, p))
return render_template(
"ipynblist.html",
ipynb=sorted(ipynb, key=lambda n: n["mtime"], reverse=True),
)
@app.route('/node/<path:path>')
def show_node(path):
path = "/" + path
with dp.io.SyncDataHandler(g.data_path) as dh:
nl = dh.get()
node = dp.nodes.get(nl, path)
show_function = {"run": show_run, "project": show_project}
return show_function[node["type"]](node, nl)
def show_run(node, node_list):
# for tag
parent_nodes = []
for p in node["parents"]:
parent_nodes.append(dp.nodes.get(node_list, p))
# for completion of add tag
project_id_nodes = dp.filter.prefix_path(node_list, dp.basket.get_project_basket())
project_ids = [n["name"] for n in project_id_nodes]
# for ipynb
ipynb_nodes = []
for p in node["children"]:
n = dp.nodes.get(node_list, p).copy()
if n["type"] != "ipynb":
continue
try:
n["url"] = dp.ipynb.resolve_url(p)
except dp.exception.DataProcessorError:
n["url"] = ""
n["name"] = dp.ipynb.resolve_name(p)
ipynb_nodes.append(n)
ipynb_names = [n["name"] for n in ipynb_nodes]
# files
path = node["path"]
non_seq, seq = dp.utility.detect_sequence(os.listdir(path))
dirs = sorted([name for name in non_seq if os.path.isdir(os.path.join(path, name))])
files = sorted([(dp.utility.expect_filetype(name), name)
for name in non_seq if name not in dirs and name not in ipynb_names], reverse=True)
patterns = [(pat, len(seq[pat])) for pat in sorted(seq.keys())]
return render_template("run.html", node=node, ipynb=ipynb_nodes, files=files, dirs=dirs,
sequences=patterns, parents=parent_nodes, project_ids=project_ids)
def show_project(node, node_list):
# for tag
parent_nodes = []
for p in node["parents"]:
parent_nodes.append(dp.nodes.get(node_list, p))
# for completion of add tag
project_id_nodes = dp.filter.prefix_path(node_list, dp.basket.get_project_basket())
project_ids = [n["name"] for n in project_id_nodes]
df = dp.dataframe.get_project(node_list, node["path"], properties=["comment"])
if not df.empty:
index = sorted(df.columns, reverse=True, key=lambda col: len(set(df[col])))
cfg = [c for c in index if c not in ["name", "comment"]]
else:
cfg = None
return render_template("project.html", df=df, cfg=cfg, node=node,
parents=parent_nodes, project_ids=project_ids)
@app.route('/api/pipe', methods=['POST'])
def execute_pipe():
def _parse_req(req):
name = req.json["name"]
args = req.json["args"]
kwds = req.json["kwds"] if "kwds" in req.json else {}
return name, args, kwds
try:
name, args, kwds = _parse_req(request)
_execute_pipe(g.data_path, name, args, kwds)
except KeyError as key:
app.logger.error("Request must include {}".format(key))
abort(400)
except dp.exception.DataProcessorError as e:
app.logger.error(e.msg)
abort(400)
return Response()
def _execute_pipe(data_path, name, args, kwds):
with dp.io.SyncDataHandler(data_path) as dh:
nl = dh.get()
nl = dp.execute.pipe(name, args, kwds, nl)
dh.update(nl)
@app.route('/add_tag/<path:path>', methods=['POST'])
def add_tag(path):
session['logged_in'] = True
if request.form['tagname'] == "":
flash("Specify tagname")
return redirect(url_for('show_node', path=path))
else:
flash("Added tag '{}'".format(request.form['tagname']))
_execute_pipe(g.data_path,
"add_tag", ["/" + path, request.form['tagname']], {})
return redirect(url_for('show_node', path=path))
@app.route('/untag/<path:path>?project_path=<path:project_path>')
def untag(path, project_path):
session['logged_in'] = True
flash("Removed tag '{}'".format(os.path.basename(project_path)))
_execute_pipe(g.data_path,
"untag", ["/" + path, "/" + project_path], {})
return redirect(url_for('show_node', path=path))
@app.route('/delete_project', methods=['POST'])
def delete_project():
path = request.form['path']
session['logged_in'] = True
_execute_pipe(g.data_path, "remove_node", [path], {})
return Response()
|
termoshtt/DataProcessor
|
server/webapp.py
|
Python
|
gpl-3.0
| 5,921
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name = "crypto",
version = "1.1.0",
url = 'http://ondrejsika.com/docs/python-crypto',
download_url = 'https://github.com/sikaondrej/python-crypto',
license = 'GNU LGPL v.3',
description = "Simply tool for cryptography",
author = 'Ondrej Sika',
author_email = 'dev@ondrejsika.com',
packages = find_packages(),
install_requires = ["rsa"],
include_package_data = True,
)
|
inna92/python-crypto
|
setup.py
|
Python
|
lgpl-3.0
| 511
|
# -*- coding: utf-8 -*-
from model.group import Group
import pytest
import allure
# ТЕСТ
# json_groups - берем данные из data\group.json
# data_groups - берем данные из data\groups.py
@allure.feature('Feature1')
@allure.story('Story1')
def test_create_group(app, db, json_groups):
group = json_groups
with pytest.allure.step('Запоминаем список групп на странице'):
old_groups = db.get_group_list()
with pytest.allure.step('Добавляем новую группу'):
app.group.create(group)
with pytest.allure.step('Проверяем что новая группа добавлена'):
new_groups = db.get_group_list()
old_groups.append(group)
assert sorted(old_groups, key=Group.id_or_max) == sorted(new_groups, key=Group.id_or_max)
# BACKUP
'''''
import pytest
from data.groups import constant as testdata
# ТЕСТ
@pytest.mark.parametrize("group", testdata, ids=[repr(x) for x in testdata])
def test_create_empty_group(app, group):
old_groups = app.group.get_group_list()
app.group.create(group)
assert len(old_groups) + 1 == app.group.count()
new_groups = app.group.get_group_list()
old_groups.append(group)
assert sorted(old_groups, key=Group.id_or_max) == sorted(new_groups, key=Group.id_or_max)
'''
|
MaxDavion/Python_traning
|
test/test_add_group.py
|
Python
|
apache-2.0
| 1,364
|
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class ReservationOrderResponse(Model):
"""ReservationOrderResponse.
Variables are only populated by the server, and will be ignored when
sending a request.
:param etag:
:type etag: int
:ivar id: Identifier of the reservation
:vartype id: str
:ivar name: Name of the reservation
:vartype name: str
:param display_name: Friendly name for user to easily identified the
reservation.
:type display_name: str
:param request_date_time: This is the DateTime when the reservation was
initially requested for purchase.
:type request_date_time: datetime
:param created_date_time: This is the DateTime when the reservation was
created.
:type created_date_time: datetime
:param expiry_date: This is the date when the Reservation will expire.
:type expiry_date: date
:param original_quantity: Total Quantity of the SKUs purchased in the
Reservation.
:type original_quantity: int
:param term: Possible values include: 'P1Y', 'P3Y'
:type term: str or :class:`enum <reservations.models.enum>`
:param provisioning_state: Possible values include: 'Creating',
'PendingResourceHold', 'ConfirmedResourceHold', 'PendingBilling',
'ConfirmedBilling', 'Created', 'Succeeded', 'Cancelled', 'Expired',
'BillingFailed', 'Failed', 'Split', 'Merged'
:type provisioning_state: str or :class:`enum <reservations.models.enum>`
:param reservations_property:
:type reservations_property: list of :class:`ReservationResponse
<reservations.models.ReservationResponse>`
:ivar type: Type of resource. "Microsoft.Capacity/reservations"
:vartype type: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
}
_attribute_map = {
'etag': {'key': 'etag', 'type': 'int'},
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'display_name': {'key': 'properties.displayName', 'type': 'str'},
'request_date_time': {'key': 'properties.requestDateTime', 'type': 'iso-8601'},
'created_date_time': {'key': 'properties.createdDateTime', 'type': 'iso-8601'},
'expiry_date': {'key': 'properties.expiryDate', 'type': 'date'},
'original_quantity': {'key': 'properties.originalQuantity', 'type': 'int'},
'term': {'key': 'properties.term', 'type': 'str'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'reservations_property': {'key': 'properties.reservations', 'type': '[ReservationResponse]'},
'type': {'key': 'type', 'type': 'str'},
}
def __init__(self, etag=None, display_name=None, request_date_time=None, created_date_time=None, expiry_date=None, original_quantity=None, term=None, provisioning_state=None, reservations_property=None):
self.etag = etag
self.id = None
self.name = None
self.display_name = display_name
self.request_date_time = request_date_time
self.created_date_time = created_date_time
self.expiry_date = expiry_date
self.original_quantity = original_quantity
self.term = term
self.provisioning_state = provisioning_state
self.reservations_property = reservations_property
self.type = None
|
lmazuel/azure-sdk-for-python
|
azure-mgmt-reservations/azure/mgmt/reservations/models/reservation_order_response.py
|
Python
|
mit
| 3,717
|
import pyb
from pyb import I2C
i2c = I2C(1)
i2c2 = I2C(2)
i2c.init(I2C.MASTER, baudrate=400000)
print(i2c.scan())
i2c.deinit()
# use accelerometer to test i2c bus
accel_addr = 76
pyb.Accel() # this will init the bus for us
print(i2c.scan())
print(i2c.is_ready(accel_addr))
print(i2c.mem_read(1, accel_addr, 7, timeout=500))
i2c.mem_write(0, accel_addr, 0, timeout=500)
i2c.send(7, addr=accel_addr)
i2c.recv(1, addr=accel_addr)
|
warner83/micropython
|
tests/pyb/i2c.py
|
Python
|
mit
| 435
|
import json
import re
from datetime import datetime, timedelta
from os import path, unlink
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
import six
import olympia.core.logger
from olympia import amo
from olympia.addons.models import Addon
from olympia.stats.models import UpdateCount, update_inc
from . import get_date, get_stats_data
log = olympia.core.logger.getLogger('adi.updatecounts')
# Validate a locale: must be like 'fr', 'en-us', 'zap-MX-diiste', ...
LOCALE_REGEX = re.compile(r"""^[a-z]{2,3} # General: fr, en, dsb,...
(-[A-Z]{2,3})? # Region: -US, -GB, ...
(-[a-z]{2,12})?$ # Locality: -valencia, -diiste
""", re.VERBOSE)
VALID_STATUSES = ["userDisabled,incompatible", "userEnabled", "Unknown",
"userDisabled", "userEnabled,incompatible"]
UPDATE_COUNT_TRIGGER = "userEnabled"
VALID_APP_GUIDS = amo.APP_GUIDS.keys()
APPVERSION_REGEX = re.compile(
r"""^[0-9]{1,3} # Major version: 2, 35
\.[0-9]{1,3}([ab][0-9])? # Minor version + alpha or beta: .0a1, .0b2
(\.[0-9]{1,3})?$ # Patch version: .1, .23
""", re.VERBOSE)
class Command(BaseCommand):
"""Process hive results stored in different files and store them in the db.
Usage:
./manage.py update_counts_from_file \
<folder> --date=YYYY-MM-DD --stats_source={s3,file}
If no date is specified, the default is the day before.
If no stats_source is specified, the default is set to s3.
If stats_source is file:
If not folder is specified, the default is
`hive_results/<YYYY-MM-DD>/`.
This folder will be located in `<settings.SHARED_STORAGE>/tmp`.
Five files are processed:
- update_counts_by_version.hive
- update_counts_by_status.hive
- update_counts_by_app.hive
- update_counts_by_os.hive
- update_counts_by_locale.hive
If stats_source is s3:
This file will be located in
`<settings.AWS_STATS_S3_BUCKET>/<settings.AWS_STATS_S3_PREFIX>`.
Five files are processed:
- update_counts_by_version/YYYY-MM-DD/000000_0
- update_counts_by_status/YYYY-MM-DD/000000_0
- update_counts_by_app/YYYY-MM-DD/000000_0
- update_counts_by_os/YYYY-MM-DD/000000_0
- update_counts_by_locale/YYYY-MM-DD/000000_0
Each file has the following cols:
- date
- addon guid
- data: the data grouped on (eg version, status...).
- count
- update type
For the "app" file, the "data" col is in fact two cols: the application
guid and the application version.
"""
help = __doc__
def add_arguments(self, parser):
"""Handle command arguments."""
parser.add_argument('folder_name', default='hive_results', nargs='?')
parser.add_argument(
'--stats_source', default='s3',
choices=['s3', 'file'],
help='Source of stats data')
parser.add_argument(
'--date', action='store', type=str,
dest='date', help='Date in the YYYY-MM-DD format.')
parser.add_argument(
'--separator', action='store', type=str, default='\t',
dest='separator', help='Field separator in file.')
def handle(self, *args, **options):
sep = options['separator']
start = datetime.now() # Measure the time it takes to run the script.
day = options['date']
if not day:
day = (datetime.now() - timedelta(days=1)).strftime('%Y-%m-%d')
groups = ('app', 'locale', 'os', 'status', 'version')
group_filepaths = []
# Make sure we're not trying to update with mismatched data.
for group in groups:
if options['stats_source'] == 's3':
filepath = 's3://' + '/'.join([settings.AWS_STATS_S3_BUCKET,
settings.AWS_STATS_S3_PREFIX,
'update_counts_by_%s' % group,
day, '000000_0'])
elif options['stats_source'] == 'file':
folder = options['folder_name']
folder = path.join(settings.TMP_PATH, folder, day)
filepath = path.join(folder,
'update_counts_by_%s.hive' % group)
if get_date(filepath, sep) != day:
raise CommandError('%s file contains data for another day' %
filepath)
group_filepaths.append((group, filepath))
# First, make sure we don't have any existing counts for the same day,
# or it would just increment again the same data.
UpdateCount.objects.filter(date=day).delete()
# Memoize the addons and the UpdateCounts.
update_counts = {}
# Perf: preload all the addons once and for all.
# This builds a dict where each key (the addon guid we get from the
# hive query) has the addon_id as value.
guids_to_addon = (dict(
Addon.unfiltered
.exclude(status=amo.STATUS_NULL)
.exclude(guid__isnull=True)
.exclude(type=amo.ADDON_PERSONA)
.values_list('guid', 'id')))
for group, filepath in group_filepaths:
count_file = get_stats_data(filepath)
for index, line in enumerate(count_file):
if index and (index % 1000000) == 0:
log.info('Processed %s lines' % index)
splitted = line[:-1].split(sep)
if ((group == 'app' and len(splitted) != 6) or
(group != 'app' and len(splitted) != 5)):
log.debug('Badly formatted row: %s' % line)
continue
if group == 'app':
day, addon_guid, app_id, app_ver, count, \
update_type = splitted
else:
day, addon_guid, data, count, update_type = splitted
addon_guid = addon_guid.strip()
if update_type:
update_type.strip()
# Old versions of Firefox don't provide the update type.
# All the following are "empty-like" values.
if update_type in ['0', 'NULL', 'None', '', '\\N',
'%UPDATE_TYPE%']:
update_type = None
try:
count = int(count)
if update_type:
update_type = int(update_type)
except ValueError: # Badly formatted? Drop.
continue
# The following is magic that I don't understand. I've just
# been told that this is the way we can make sure a request
# is valid:
# > the lower bits for updateType (eg 112) should add to
# > 16, if not, ignore the request.
# > udpateType & 31 == 16 == valid request.
if update_type and update_type & 31 != 16:
log.debug("Update type doesn't add to 16: %s" %
update_type)
continue
# Does this addon exist?
if addon_guid and addon_guid in guids_to_addon:
addon_id = guids_to_addon[addon_guid]
else:
log.debug(u"Addon {guid} doesn't exist."
.format(guid=addon_guid.strip()))
continue
# Memoize the UpdateCount.
if addon_guid in update_counts:
uc = update_counts[addon_guid]
else:
uc = UpdateCount(date=day, addon_id=addon_id, count=0)
update_counts[addon_guid] = uc
# We can now fill the UpdateCount object.
if group == 'version':
self.update_version(uc, data, count)
elif group == 'status':
self.update_status(uc, data, count)
if data == UPDATE_COUNT_TRIGGER:
# Use this count to compute the global number
# of daily users for this addon.
uc.count += count
elif group == 'app':
self.update_app(uc, app_id, app_ver, count)
elif group == 'os':
self.update_os(uc, data, count)
elif group == 'locale':
self.update_locale(uc, data, count)
# Make sure the locales and versions fields aren't too big to fit in
# the database. Those two fields are the only ones that are not fully
# validated, so we could end up with just anything in there (spam,
# buffer overflow attempts and the like).
# We don't care that they will increase the numbers, but we do not want
# those to break the process because of a "Data too long for column
# 'version'" error.
# The database field (TEXT), can hold up to 2^16 = 64k characters.
# If the field is longer than that, we we drop the least used items
# (with the lower count) until the field fits.
for addon_guid, update_count in six.iteritems(update_counts):
self.trim_field(update_count.locales)
self.trim_field(update_count.versions)
# Create in bulk: this is much faster.
UpdateCount.objects.bulk_create(update_counts.values(), 100)
log.info('Processed a total of %s lines' % (index + 1))
log.debug('Total processing time: %s' % (datetime.now() - start))
# Clean up files.
if options['stats_source'] == 'file':
for _, filepath in group_filepaths:
log.debug('Deleting {path}'.format(path=filepath))
unlink(filepath)
def update_version(self, update_count, version, count):
"""Update the versions on the update_count with the given version."""
version = version[:32] # Limit the version to a (random) length.
update_count.versions = update_inc(update_count.versions, version,
count)
def update_status(self, update_count, status, count):
"""Update the statuses on the update_count with the given status."""
# Only update if the given status is valid.
if status in VALID_STATUSES:
update_count.statuses = update_inc(update_count.statuses, status,
count)
def update_app(self, update_count, app_id, app_ver, count):
"""Update the applications on the update_count with the given data."""
# Only update if app_id is a valid application guid, and if app_ver
# "could be" a valid version.
if (app_id not in VALID_APP_GUIDS or
not re.match(APPVERSION_REGEX, app_ver)):
return
# Applications is a dict of dicts, eg:
# {"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}":
# {"10.0": 2, "21.0": 1, ....},
# "some other application guid": ...
# }
if update_count.applications is None:
update_count.applications = {}
app = update_count.applications.get(app_id, {})
# Now overwrite this application's dict with
# incremented counts for its versions.
update_count.applications.update(
{app_id: update_inc(app, app_ver, count)})
def update_os(self, update_count, os, count):
"""Update the OSes on the update_count with the given OS."""
if os.lower() in amo.PLATFORM_DICT:
update_count.oses = update_inc(update_count.oses, os, count)
def update_locale(self, update_count, locale, count):
"""Update the locales on the update_count with the given locale."""
locale = locale.replace('_', '-')
# Only update if the locale "could be" valid. We can't simply restrict
# on locales that AMO know, because Firefox has many more, and custom
# packaged versions could have even more. Thus, we only restrict on the
# allowed characters, some kind of format, and the total length, and
# hope to not miss out on too many locales.
if re.match(LOCALE_REGEX, locale):
update_count.locales = update_inc(update_count.locales, locale,
count)
def trim_field(self, field):
"""Trim (in-place) the dict provided, keeping the most used items.
The "locales" and "versions" fields are dicts which have the locale
or version as the key, and the count as the value.
"""
def fits(field):
"""Does the json version of the field fits in the db TEXT field?"""
return len(json.dumps(field)) < (2 ** 16) # Max len of TEXT field.
if fits(field):
return
# Order by count (desc), for a dict like {'<locale>': <count>}.
values = list(reversed(sorted(field.items(), key=lambda v: v[1])))
while not fits(field):
key, count = values.pop() # Remove the least used (the last).
del field[key] # Remove this entry from the dict.
|
kumar303/addons-server
|
src/olympia/stats/management/commands/update_counts_from_file.py
|
Python
|
bsd-3-clause
| 13,457
|
# coding: utf-8
from __future__ import unicode_literals
"""
Yandex.Maps API wrapper
"""
import json
from six import text_type, binary_type
from six.moves.urllib.parse import urlencode
from six.moves.urllib.request import urlopen
STATIC_MAPS_URL = 'https://static-maps.yandex.ru/1.x/?'
HOSTED_MAPS_URL = 'https://maps.yandex.ru/?'
GEOCODE_URL = 'https://geocode-maps.yandex.ru/1.x/?'
def _format_point(longitude, latitude):
return '%0.7f,%0.7f' % (float(longitude), float(latitude),)
def get_map_url(longitude, latitude, zoom, width, height):
""" returns URL of static yandex map """
point = _format_point(longitude, latitude)
params = [
'll=%s' % point,
'size=%d,%d' % (width, height,),
'z=%d' % zoom,
'l=map',
'pt=%s' % point
]
return STATIC_MAPS_URL + '&'.join(params)
def get_external_map_url(longitude, latitude, zoom=14):
""" returns URL of hosted yandex map """
point = _format_point(longitude, latitude)
params = dict(
ll=point,
pt=point,
l='map',
)
if zoom is not None:
params['z'] = zoom
return HOSTED_MAPS_URL + urlencode(params)
def geocode(address, timeout=2):
""" returns (longtitude, latitude,) tuple for given address """
try:
json_data = _get_geocode_json(address, timeout)
return _get_coords(json_data)
except IOError:
return None, None
def _get_geocode_json(address, timeout=2):
url = _get_geocode_url(address)
response = urlopen(url, timeout=timeout).read()
return response
def _get_geocode_url(address):
if isinstance(address, text_type):
address = address.encode('utf8')
params = urlencode({'geocode': address, 'format': 'json', 'results': 1})
return GEOCODE_URL + params
def _get_coords(response):
if isinstance(response, binary_type):
response = response.decode('utf8')
try:
geocode_data = json.loads(response)
pos_data = geocode_data['response']['GeoObjectCollection']['featureMember'][0]['GeoObject']['Point']['pos']
return tuple(pos_data.split())
except (IndexError, KeyError):
return None, None
|
hovel/yandex-maps
|
yandex_maps/api.py
|
Python
|
mit
| 2,178
|
from setuptools import setup, find_packages
setup(
name="django-abtesting",
version = "1.0",
url='http://github.com/dalou/django-abtesting',
license='BSD',
platforms=['OS Independent'],
description="A/B Testing module allow separate versionned templates and views.",
setup_requires = [
],
install_requires = [
"django>=1.4",
],
long_description=open('README.md').read(),
author='Damien Autrusseau',
author_email='autrusseau.damien@gmail.com',
maintainer='Damien Autrusseau',
maintainer_email='autrusseau.damien@gmail.com',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
classifiers=[
'Development Status :: Beta',
'Framework :: Django',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Internet :: WWW/HTTP',
]
)
|
dalou/django-abtesting
|
setup.py
|
Python
|
gpl-2.0
| 998
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# --- BEGIN_HEADER ---
#
# uploadprogress - Plain file upload progress monitor back end
# Copyright (C) 2003-2014 The MiG Project lead by Brian Vinter
#
# This file is part of MiG.
#
# MiG 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.
#
# MiG 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.
#
# -- END_HEADER ---
#
"""Plain file upload progress monitor back end (obsoleted by fancyupload)"""
import os
import shared.returnvalues as returnvalues
from shared.base import client_id_dir
from shared.functional import validate_input_and_cert, REJECT_UNSET
from shared.init import initialize_main_variables, find_entry
from shared.validstring import valid_user_path
block_size = 1024 * 1024
def signature():
"""Signature of the main function"""
defaults = {
'path': REJECT_UNSET,
'size': REJECT_UNSET,
}
return ['html_form', defaults]
def main(client_id, user_arguments_dict):
"""Main function used by front end"""
(configuration, logger, output_objects, op_name) = \
initialize_main_variables(client_id, op_header=False)
client_dir = client_id_dir(client_id)
status = returnvalues.OK
defaults = signature()[1]
(validate_status, accepted) = validate_input_and_cert(
user_arguments_dict,
defaults,
output_objects,
client_id,
configuration,
allow_rejects=False,
)
if not validate_status:
return (accepted, returnvalues.CLIENT_ERROR)
path_list = accepted['path']
size_list = [int(size) for size in accepted['size']]
title_entry = find_entry(output_objects, 'title')
title_entry['text'] = '%s Upload Progress Monitor' % configuration.short_title
if not configuration.site_enable_griddk:
output_objects.append({'object_type': 'text', 'text':
'''Grid.dk features are disabled on this site.
Please contact the Grid admins %s if you think they should be enabled.
''' % configuration.admin_email})
return (output_objects, returnvalues.OK)
refresh_secs = 5
meta = '<meta http-equiv="refresh" content="%s" />' % refresh_secs
title_entry['meta'] = meta
# Please note that base_dir must end in slash to avoid access to other
# user dirs when own name is a prefix of another user name
base_dir = os.path.abspath(os.path.join(configuration.user_home,
client_dir)) + os.sep
output_objects.append({'object_type': 'header', 'text'
: 'Upload progress'})
done_list = [False for _ in path_list]
progress_items = []
index = -1
for path in path_list:
index += 1
# Check directory traversal attempts before actual handling to avoid
# leaking information about file system layout while allowing
# consistent error messages
real_path = os.path.abspath(os.path.join(base_dir, path))
if not valid_user_path(real_path, base_dir, True):
# out of bounds - save user warning for later to allow
# partial match:
# ../*/* is technically allowed to match own files.
logger.warning('%s tried to %s restricted path %s ! (%s)'
% (client_id, op_name, real_path, path))
output_objects.append({'object_type': 'file_not_found',
'name': path})
status = returnvalues.FILE_NOT_FOUND
continue
if not os.path.isfile(real_path):
output_objects.append({'object_type': 'error_text', 'text'
: "no such upload: %s" % path})
status = returnvalues.CLIENT_ERROR
continue
relative_path = real_path.replace(base_dir, '')
try:
logger.info('Checking size of upload %s' % real_path)
cur_size = os.path.getsize(real_path)
total_size = size_list[index]
percent = round(100.0 * cur_size / total_size, 1)
done_list[index] = (cur_size == total_size)
progress_items.append({'object_type': 'progress', 'path': path,
'cur_size': cur_size, 'total_size':
total_size, 'percent': percent,
'done': done_list[index], 'progress_type':
'upload'})
except Exception, exc:
# Don't give away information about actual fs layout
output_objects.append({'object_type': 'error_text', 'text'
: '%s upload could not be checked! (%s)'
% (path, str(exc).replace(base_dir, ''
))})
status = returnvalues.SYSTEM_ERROR
continue
# Stop reload when all done
if not False in done_list:
title_entry['meta'] = ''
output_objects.append({'object_type': 'progress_list',
'progress_list': progress_items})
return (output_objects, status)
|
heromod/migrid
|
mig/shared/functionality/uploadprogress.py
|
Python
|
gpl-2.0
| 5,743
|
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Romain Bignon
#
# 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/>.
from __future__ import print_function
from weboob.tools.application.repl import ReplApplication
__all__ = ['WeboobCli']
class WeboobCli(ReplApplication):
APPNAME = 'weboob-cli'
VERSION = '2.1'
COPYRIGHT = 'Copyright(C) 2010-YEAR Romain Bignon'
SYNOPSIS = 'Usage: %prog [-dqv] [-b backends] [-cnfs] capability method [arguments..]\n'
SYNOPSIS += ' %prog [--help] [--version]'
DESCRIPTION = "Weboob-Cli is a console application to call a specific method on backends " \
"which implement the given capability."
SHORT_DESCRIPTION = "call a method on backends"
DISABLE_REPL = True
def load_default_backends(self):
pass
def main(self, argv):
if len(argv) < 3:
print("Syntax: %s capability method [args ..]" % argv[0], file=self.stderr)
return 2
cap_s = argv[1]
cmd = argv[2]
args = argv[3:]
self.load_backends(cap_s)
for obj in self.do(cmd, *args):
self.format(obj)
self.flush()
return 0
|
laurentb/weboob
|
weboob/applications/weboobcli/weboobcli.py
|
Python
|
lgpl-3.0
| 1,802
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2004 Chris Liechti <cliechti@gmx.net>
# All Rights Reserved.
# Simplified BSD License (see LICENSE.txt for full text)
"""\
Using the MSP430 JTAG parallel port board as SPI interface.
Requires Python 2+, ctypes and HIL.dll/libHIL.so
"""
import HIL
#~ import psyco
#~ psyco.full()
def init(port='1'):
"""open the parallel port and prepare for SPI mode"""
HIL.Initialize(port)
HIL.Connect()
HIL.VCC(3000)
HIL.TST(0)
HIL.TCK(1)
HIL.TDI(1)
HIL.TMS(1)
def close():
"""close the parallel port"""
HIL.Release()
HIL.Close(1)
def _delay():
"""can be implemented if the SPI data rate has to be lowered"""
#~ HIL.DelayMSec(1)
#~ for i in range(10): HIL.DelayMSec(0)
#~ HIL.DelayMSec(0)
pass
def shift(data):
"""shift an binary string from/to the slave, returning the
answer string of the same length
"""
answer = []
for character in data:
shiftout = ord(character)
indata = 0
for i in range(8):
HIL.TCK(0)
HIL.TDI(shiftout & 0x80)
shiftout <<= 1
_delay()
HIL.TCK(1)
_delay()
indata = (indata << 1) | HIL.ReadTDO()
answer.append(chr(indata))
return ''.join(answer)
def sync():
"""read untlil something else as a 0xff arrives.
"""
while shift('\xff') != '\xff':
pass
def getNullTeminated(maxlen=80):
"""read a null terminated string over SPI."""
answer = []
while maxlen:
c = shift('\xff')
if c == '\0': break
answer.append(c)
maxlen -= 1
return ''.join(answer)
#test application
if __name__ == '__main__':
import time
init()
#reset target
HIL.RST(0)
HIL.DelayMSec(10)
HIL.RST(1)
HIL.DelayMSec(10)
#simple speed test
bytes = 0
t1 = time.time()
for i in range(200):
#~ print '%r' % getNullTeminated()
bytes += len(getNullTeminated()) + 1
dt = time.time() - t1
print "%d bytes in %.2f seconds -> %.2f bytes/second" % (bytes, dt, bytes/dt)
|
cetic/python-msp430-tools
|
msp430/jtag/hilspi.py
|
Python
|
bsd-3-clause
| 2,146
|
#!/usr/bin/python
import base64
from Crypto.Cipher import DES3
secret = base64.decodestring('2x2X7sgphyw/K9CM6LSGQASgmWFAtKWkAA4+oP7bBdk=')
password = base64.decodestring('/6g3lrMTok3Dp2HV++g0lg==')
print DES3.new(secret[:24], DES3.MODE_CBC, secret[24:]).decrypt(password)
|
sysadmiral/sysadmiral-puppet-control
|
site/users/files/amo/binfiles/remmpw.py
|
Python
|
mit
| 276
|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-14 08:21
from __future__ import unicode_literals
from django.conf import settings
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0008_alter_user_username_max_length'),
]
operations = [
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.ASCIIUsernameValidator()], verbose_name='username')),
('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
('last_name', models.CharField(blank=True, max_length=30, verbose_name='last name')),
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
],
options={
'abstract': False,
'verbose_name': 'user',
'verbose_name_plural': 'users',
},
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
migrations.CreateModel(
name='UserProfile',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)),
],
options={
'abstract': False,
},
),
]
|
unicef/un-partner-portal
|
backend/unpp_api/apps/account/migrations/0001_initial.py
|
Python
|
apache-2.0
| 3,754
|
#!/usr/bin/env python3
# -*- coding: utf8 -*-
# TODO: Add args for WEBSITE_TO_TARGET
import re
import sys
import urllib
import webbrowser
from bs4 import BeautifulSoup
import requests
HEADERS = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0'}
URL_RANDOM = "https://www.metal-archives.com/band/random"
URL_BAND_PAGE = "https://www.metal-archives.com/bands/{name:s}/{id:s}"
URL_DISCOGRAPHY = "https://www.metal-archives.com/band/discography/id/{id:s}/tab/all"
URL_YT_SEARCH = "https://www.youtube.com/results?search_query={query:s}"
URL_YT_VIDEO = "https://www.youtube.com/watch?v={key:s}"
# From the most interesting type of disco./website to the least one.
DISCOGRAPHY_CLASSES = ['album', 'single', 'other', 'demo']
WEBSITE_TO_TARGET = ['bandcamp', 'soundcloud', 'youtube', 'spotify', 'myspace']
PRED_MUSIC_LINK = lambda tag: tag.name == 'a' and tag.get('title') is not None and tag['title'].find('Go to:') != -1
PATTERN_YT_JSON_VIDEO_DATA = re.compile('window\["ytInitialData"\] = ')
def clean_name(name):
"""Clean the caracters who are not decoded."""
name = urllib.parse.unquote(name)
name = name.replace('_', ' ')
return name
def get_name_id(parser):
"""Get the name and the id of the band corresponding to the html page."""
band_name_tag = parser.find('h1', {"class": 'band_name'})
url_band_page = band_name_tag.find('a').get('href')
name, ide = url_band_page.split('bands/')[1].split('/')
return name, ide
def get_last_discography(ide):
"""Get the name of the newest album/demo/single of a band"""
url_disco = URL_DISCOGRAPHY.format(id=ide)
response = requests.get(url_disco, headers=HEADERS)
if not response.ok:
print("[!] Cannot get the band's discography (status code {status:d})."
.format(status=response.status_code), file=sys.stderr)
return ''
parser = BeautifulSoup(response.content, "html.parser")
for cls in DISCOGRAPHY_CLASSES:
discos = parser.findAll('a', {'class': cls})
if discos:
return discos[-1].text
print("[!] No discography for the band.", file=sys.stderr)
return ''
def get_related_links(parser):
"""Take the link in the 'Related links' onglet of archive-metal"""
related_links_tag = parser.find('a', {'title': 'Related links'})
if related_links_tag:
return related_links_tag['href']
else:
print("[!] No related link for this band.", file=sys.stderr)
return ''
def get_music_link(html, name):
"""Extract links to music websites"""
parser = BeautifulSoup(html, "html.parser")
a_tags = parser.findAll(PRED_MUSIC_LINK)
if a_tags:
return [a_tag['href'] for a_tag in a_tags]
print("[!] No related links for this band.", file=sys.stderr)
def chose_link(list_link):
"""Find the most interesting musical link"""
for site in WEBSITE_TO_TARGET:
for link in list_link:
if site in link:
return link
print("[!] No music links related to one of the following site: {sites:s}."
.format(sites=', '.join(WEBSITE_TO_TARGET)), file=sys.stderr)
return ''
def get_key_youtube(html):
"""Get the key of the first video in the result page."""
parser = BeautifulSoup(html, "html.parser")
script_content = parser.findAll('script', text=PATTERN_YT_JSON_VIDEO_DATA)[0]
for m in re.finditer('watch\?v=(.{11})",', script_content.text):
return m.group(1)
return ''
def request_youtube(args, name, last_disco):
""""Make a request to Youtube and return the first link."""
if last_disco:
query = '"{name:s}+-+{disco:s}"'.format(name=name, disco=last_disco)
else:
query = '"{name:s}"+metal+music'.format(name=name)
if args.verbose:
print("[*] YouTube query: " + query.replace('+', ' '))
url_yt = URL_YT_SEARCH.format(query=query)
response = requests.get(url_yt, headers=HEADERS)
if not response.ok:
print("[!] Cannot make the query on YouTube (status code {status:d})."
.format(status=response.status_code), file=sys.stderr)
return ''
return get_key_youtube(response.content)
def only_youtube(args, name, ide):
"""Search band last album/ep/demo/... on YouTube"""
last_disco = get_last_discography(ide)
if last_disco:
key = request_youtube(args, name, last_disco)
if key:
yt_link = URL_YT_VIDEO.format(key=key)
webbrowser.open(yt_link)
return yt_link
def search_music(args, name, ide, parser):
"""Search band's music via the 'Related links' of archive-metal or on YouTube"""
if args.youtube:
return only_youtube(args, name, ide)
else:
related_links_url = get_related_links(parser)
response = requests.get(related_links_url, headers=HEADERS)
if not response.ok:
print("[!] Cannot access the 'related links' page (status code {status:d})."
.format(status=response.status_code), file=sys.stderr)
return ''
list_link = get_music_link(response.content, name)
if list_link:
link = chose_link(list_link)
if link:
webbrowser.open(link)
return link
print("[!] Trying on youtube.", file=sys.stderr)
return only_youtube(args, name, ide)
def find_band(args):
""" Find url for one band and display it. """
response = requests.get(URL_RANDOM, headers=HEADERS)
if not response.ok:
print("[!] Cannot get a random band (status code {status:d})."
.format(status=response.status_code), file=sys.stderr)
return ''
parser = BeautifulSoup(response.content, "html.parser")
name, ide = get_name_id(parser)
name = clean_name(name)
if args.page:
webbrowser.open(URL_BAND_PAGE.format(name=name, id=ide))
print("[#] Band: {name:s}, ID: {id:s}".format(name=name, id=ide))
search_music(args, name, ide, parser)
def main(args):
for _ in range(args.nbr):
link = find_band(args)
if args.verbose and link is not None:
print("[*] Link : " + link + "\n ====")
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(
prog='randometal',
description='Randomly select bands from "metal-archives.com".',
usage="""
__ _ _ _
/__\ __ _ _ __ __| | ___ /\/\ ___| |_ __ _| |
/ \/// _` | '_ \ / _` |/ _ \ / \ / _ \ __/ _` | |
/ _ \ (_| | | | | (_| | (_) / /\/\ \ __/ || (_| | |
\/ \_/\__,_|_| |_|\__,_|\___/\/ \/\___|\__\__,_|_|
""")
parser.add_argument('-y', '--youtube', action='store_true', help='try to find an play songs only on YouTube')
parser.add_argument('-v', '--verbose', action='store_true', help='display more informations')
parser.add_argument('-p', '--page', action='store_true', help='open the archive-metal page of the band')
parser.add_argument('-n', '--nbr', default=1, type=int, help='number of bands to search. One by default')
args = parser.parse_args()
main(args)
|
Zar-rok/RandoMetal
|
RandoMetal.py
|
Python
|
mit
| 6,811
|
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
from django.http.response import Http404
from django.shortcuts import get_object_or_404
from django.views.generic import DetailView, ListView, TemplateView
from bedrock.careers.forms import PositionFilterForm
from bedrock.careers.models import Position
from bedrock.careers.utils import generate_position_meta_description
from bedrock.wordpress.models import BlogPost
from lib.l10n_utils import LangFilesMixin, render
class HomeView(LangFilesMixin, TemplateView):
template_name = "careers/home.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
posts = BlogPost.objects.filter_by_blogs("careers")
featured = posts.filter_by_tags("story").first()
if featured:
context["featured_post"] = featured
context["recent_posts"] = posts.exclude(id=featured.id)[:2]
else:
context["featured_post"] = None
context["recent_posts"] = posts[:3]
return context
class InternshipsView(LangFilesMixin, TemplateView):
template_name = "careers/internships.html"
class BenefitsView(LangFilesMixin, TemplateView):
template_name = "careers/benefits.html"
class PositionListView(LangFilesMixin, ListView):
model = Position
template_name = "careers/listings.html"
context_object_name = "positions"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["form"] = PositionFilterForm()
return context
class PositionDetailView(LangFilesMixin, DetailView):
model = Position
context_object_name = "position"
template_name = "careers/position.html"
def get_object(self, queryset=None):
if queryset is None:
queryset = self.get_queryset()
return get_object_or_404(queryset, **self.kwargs)
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
position = context["position"]
context["meta_description"] = generate_position_meta_description(position)
related_positions = Position.objects.filter(department=position.department).exclude(id=position.id)
context["related_positions"] = related_positions
return context
def dispatch(self, request, *args, **kwargs):
try:
return super().dispatch(request, *args, **kwargs)
except Http404:
return render(
self.request,
"careers/404.html",
status=404,
)
|
mozilla/bedrock
|
bedrock/careers/views.py
|
Python
|
mpl-2.0
| 2,736
|
"""Simple CLI-builder
Build interactive Command Line Interfaces, leaving the argument
validation and parsing logic to the `argparse` Standard Library module.
"""
import sys
import argparse
def reraise(e):
raise e
#TODO: use ArgumentParser.add_subparsers to implement external CLIs instead
class CLI(object):
"""The Command Line Interface runner
"""
def __init__(self, prompt="> "):
self.prompt = prompt
self.errfun = reraise
# Commands this CLI is responsible for
self.cmds = {}
self.aliases = {}
# Extension CLIs
self.clis = {}
# Build default commands
self.add_func(self.print_help, ['h', 'help'])
self.add_func(self.quit, ['q', 'quit'])
self.builtin_cmds = frozenset(('h', 'help', 'q', 'quit'))
def add_func(self, callback, names, *args):
"""Adds a command to the CLI - specify args as you would to
argparse.ArgumentParser.add_argument()
"""
if isinstance(names, list):
for name in names:
self.add_func(callback, name, *args)
self.aliases[name] = names
elif isinstance(names, str):
if names in self.cmds or names in self.clis:
raise ValueError('Attempting to overwrite cmd or extern CLI: %s' % names)
parser = argparse.ArgumentParser(prog=names)
for cmd, spec in args:
parser.add_argument(cmd, **spec)
self.cmds[names] = (callback, parser)
else:
raise TypeError("Command must be specified by str name or list of names")
def add_cli(self, prefix, other_cli):
"""Adds the functionality of the other CLI to this one, where all
commands to the other CLI are prefixed by the given prefix plus a hyphen.
e.g. To execute command `greet anson 5` on other cli given prefix cli2, you
can execute the following with this CLI:
cli2 greet anson 5
"""
if prefix not in self.clis and prefix not in self.cmds:
self.clis[prefix] = other_cli
else:
raise ValueError('Attempting to overwrite cmd or extern CLI: %s' % prefix)
def on_err(self, f):
self.errfun = f
def _dispatch(self, cmd, args):
"""Attempt to run the given command with the given arguments
"""
if cmd in self.clis:
extern_cmd, args = args[0], args[1:]
self.clis[cmd]._dispatch(extern_cmd, args)
else:
if cmd in self.cmds:
callback, parser = self.cmds[cmd]
try:
p_args = parser.parse_args(args)
except SystemExit:
return
callback(**dict(filter(lambda p:p[1] != None, p_args._get_kwargs())))
else:
self._invalid_cmd(command=cmd)
def exec_cmd(self, cmdstr):
"""Parse line from CLI read loop and execute provided command
"""
parts = cmdstr.split()
if len(parts):
cmd, args = parts[0], parts[1:]
self._dispatch(cmd, args)
else:
pass
def _invalid_cmd(self, command=''):
print("Invalid Command: %s" % command)
def print_help(self):
"""Prints usage of all registered commands, collapsing aliases
into one record
"""
seen_aliases = set()
print('-'*80)
for cmd in sorted(self.cmds):
if cmd not in self.builtin_cmds:
if cmd not in seen_aliases:
if cmd in self.aliases:
seen_aliases.update(self.aliases[cmd])
disp = '/'.join(self.aliases[cmd])
else:
disp = cmd
_, parser = self.cmds[cmd]
usage = parser.format_usage()
print('%s: %s' % (disp, ' '.join(usage.split()[2:])))
print('External CLIs: %s' % ', '.join(sorted(self.clis)))
def quit(self):
"""Quits the REPL
"""
print('Quitting.')
sys.exit(0)
def run(self, instream=sys.stdin):
"""Runs the CLI, reading from sys.stdin by default
"""
sys.stdout.write(self.prompt)
sys.stdout.flush()
while True:
line = instream.readline()
try:
self.exec_cmd(line)
except Exception as e:
self.errfun(e)
sys.stdout.write(self.prompt)
sys.stdout.flush()
|
anrosent/cli
|
cli.py
|
Python
|
mit
| 4,591
|
# Lint as: python3
# Copyright 2019 The TensorFlow Authors. 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.
# ==============================================================================
"""Test for data_split_person.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import unittest
from data_split_person import person_split
from data_split_person import read_data
class TestSplitPerson(unittest.TestCase):
def setUp(self): # pylint: disable=g-missing-super-call
self.data = read_data("./data/complete_data")
def test_person_split(self):
train_names = ["dengyl"]
valid_names = ["liucx"]
test_names = ["tangsy"]
dengyl_num = 63
liucx_num = 63
tangsy_num = 30
train_data, valid_data, test_data = person_split(self.data, train_names,
valid_names, test_names)
self.assertEqual(len(train_data), dengyl_num)
self.assertEqual(len(valid_data), liucx_num)
self.assertEqual(len(test_data), tangsy_num)
self.assertIsInstance(train_data, list)
self.assertIsInstance(valid_data, list)
self.assertIsInstance(test_data, list)
self.assertIsInstance(train_data[0], dict)
self.assertIsInstance(valid_data[0], dict)
self.assertIsInstance(test_data[0], dict)
if __name__ == "__main__":
unittest.main()
|
zephyrproject-rtos/zephyr
|
samples/modules/tflite-micro/magic_wand/train/data_split_person_test.py
|
Python
|
apache-2.0
| 2,039
|
# Copyright (c) 2014 OpenStack Foundation
# 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.
from neutron.plugins.ml2 import driver_api as api
class BulklessMechanismDriver(api.MechanismDriver):
"""Test mechanism driver for testing bulk emulation."""
def initialize(self):
self.native_bulk_support = False
|
samsu/neutron
|
tests/unit/ml2/drivers/mechanism_bulkless.py
|
Python
|
apache-2.0
| 872
|
import unittest
from zope.testing import doctestunit
from zope.component import testing
from Testing import ZopeTestCase as ztc
from Products.Five import zcml
from Products.Five import fiveconfigure
from Products.PloneTestCase import PloneTestCase as ptc
from Products.PloneTestCase.layer import PloneSite
ptc.setupPloneSite()
import uwosh.filariasis
class TestCase(ptc.PloneTestCase):
class layer(PloneSite):
@classmethod
def setUp(cls):
fiveconfigure.debug_mode = True
zcml.load_config('configure.zcml',
uwosh.filariasis)
fiveconfigure.debug_mode = False
@classmethod
def tearDown(cls):
pass
def test_suite():
return unittest.TestSuite([
# Unit tests
#doctestunit.DocFileSuite(
# 'README.txt', package='uwosh.filariasis',
# setUp=testing.setUp, tearDown=testing.tearDown),
#doctestunit.DocTestSuite(
# module='uwosh.filariasis.mymodule',
# setUp=testing.setUp, tearDown=testing.tearDown),
# Integration tests that use PloneTestCase
#ztc.ZopeDocFileSuite(
# 'README.txt', package='uwosh.filariasis',
# test_class=TestCase),
#ztc.FunctionalDocFileSuite(
# 'browser.txt', package='uwosh.filariasis',
# test_class=TestCase),
])
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
|
uwosh/uwosh.filariasis
|
uwosh/filariasis/tests.py
|
Python
|
gpl-2.0
| 1,472
|
# -*- coding: utf-8 -*-
# vim: set expandtab tabstop=4 shiftwidth=4 :
import sqlite3
class Database:
def __init__(self, dbfile):
self.database = sqlite3.connect(dbfile) # can be :memory: to run db in memory
self.db = self.database.cursor()
if not os.path.isfile(dbfile):
self.db.execute('create table hosts (ip text, name text, mac text, type text, ttl integer, ts integer)')
self.database.commit()
def add(self, vals):
# check for record
# do magic to remove old dups
self.db.execute("insert into hosts values ('%s', '%s', '%s')" % (vals['ip'], vals['name'], vals['mac'], vals['type']) )
self.database.commit()
def del(self, cond):
self.execute("delete from hosts where %s" % cond )
self.database.commit()
def check(self, name, rectype = 'A'):
records = []
rectype = rectype.upper()
self.db.execute("select * from hosts where name = '%s' and type = '%s'" % (name, rectype) )
for i in self.db:
records.append(i)
return records
def close(self):
self.database.close()
|
cmotc/Byzantium
|
distdns/records.py
|
Python
|
gpl-3.0
| 1,161
|
import sys
def _f(): pass
FunctionType = type(_f)
assert isinstance(_f, FunctionType)
LambdaType = type(lambda: None) # Same as FunctionType
assert isinstance(lambda: None, LambdaType)
CodeType = type(_f.__code__)
assert isinstance(_f.__code__, CodeType)
MappingProxyType = type(type.__dict__)
assert isinstance(type.__dict__, MappingProxyType)
SimpleNamespace = type(sys.implementation)
assert isinstance(sys.implementation, SimpleNamespace)
def _g():
yield 1
GeneratorType = type(_g())
assert isinstance(_g(), GeneratorType)
class _C:
def _m(self): pass
MethodType = type(_C()._m)
assert(_C()._m, MethodType)
BuiltinFunctionType = type(len)
assert isinstance(len, BuiltinFunctionType)
BuiltinMethodType = type([].append) # Same as BuiltinFunctionType
assert isinstance([].append, BuiltinMethodType)
ModuleType = type(sys)
assert isinstance(sys, ModuleType)
try:
raise TypeError
except TypeError:
tb = sys.exc_info()[2]
TracebackType = type(tb)
FrameType = type(tb.tb_frame)
assert isinstance(tb, TracebackType)
assert isinstance(tb.tb_frame, FrameType)
GetSetDescriptorType = type(FunctionType.__code__)
assert isinstance(FunctionType.__code__, GetSetDescriptorType)
MemberDescriptorType = type(FunctionType.__globals__)
assert isinstance(FunctionType.__globals__, MemberDescriptorType)
print("Passed all tests...")
|
Hasimir/brython
|
www/tests/test_types.py
|
Python
|
bsd-3-clause
| 1,373
|
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from froi.algorithm import imtool
class ROIFilterDialog(QDialog):
"""
A dialog for action of intersection.
"""
last_mask_idx = 0
def __init__(self, model, parent=None):
super(ROIFilterDialog, self).__init__(parent)
self._model = model
self._init_gui()
self._create_actions()
def _init_gui(self):
"""
Initialize GUI.
"""
# set dialog title
self.setWindowTitle("ROI Filter")
# initialize widgets
source_label = QLabel("Source")
self.source_combo = QComboBox()
mask_label = QLabel("Mask")
self.mask_combo = QComboBox()
vol_list = self._model.getItemList()
self.source_combo.addItems(QStringList(vol_list))
row = self._model.currentIndex().row()
self.source_combo.setCurrentIndex(row)
self.mask_combo.addItems(QStringList(vol_list))
self.mask_combo.setCurrentIndex(self.last_mask_idx)
filter_label = QLabel("Filter")
self.filter_combo = QComboBox()
mask_row = self.mask_combo.currentIndex()
mask_config, current_idx = self._model.data(self._model.index(mask_row),
Qt.UserRole + 7)
if mask_config is not None:
roi_list = mask_config.get_label_list()
else:
roi_list = []
self.filter_combo.addItems(QStringList(roi_list))
if roi_list:
self.filter_combo.setCurrentIndex(current_idx.row())
out_label = QLabel("Output volume name")
self.out_edit = QLineEdit()
self._create_output()
# layout config
grid_layout = QGridLayout()
#grid_layout.addWidget(source_label, 0, 0)
#grid_layout.addWidget(self.source_combo, 0, 1)
grid_layout.addWidget(mask_label, 0, 0)
grid_layout.addWidget(self.mask_combo, 0, 1)
grid_layout.addWidget(filter_label, 1, 0)
grid_layout.addWidget(self.filter_combo, 1, 1)
grid_layout.addWidget(out_label, 2, 0)
grid_layout.addWidget(self.out_edit, 2, 1)
# button config
self.run_button = QPushButton("Run")
self.cancel_button = QPushButton("Cancel")
hbox_layout = QHBoxLayout()
hbox_layout.addWidget(self.run_button)
hbox_layout.addWidget(self.cancel_button)
vbox_layout = QVBoxLayout()
vbox_layout.addLayout(grid_layout)
vbox_layout.addLayout(hbox_layout)
self.setLayout(vbox_layout)
def _create_actions(self):
self.mask_combo.currentIndexChanged.connect(self._update_filters)
self.filter_combo.currentIndexChanged.connect(self._create_output)
self.run_button.clicked.connect(self._run_filter)
self.cancel_button.clicked.connect(self.done)
def _update_filters(self):
mask_row = self.mask_combo.currentIndex()
#mask_config = self._model.data(self._model.index(mask_row),
# Qt.UserRole + 7)
#if mask_config is not None:
# roi_list = mask_config.get_label_list()
#else:
# roi_list = []
#self.filter_combo.clear()
#self.filter_combo.addItems(QStringList(roi_list))
ROIFilterDialog.last_mask_idx = mask_row
def _create_output(self):
output_name = self.filter_combo.currentText()
self.out_edit.setText(output_name)
def _run_filter(self):
"""
Run an intersecting processing.
"""
vol_name = str(self.out_edit.text())
source_row = self.source_combo.currentIndex()
mask_row = self.mask_combo.currentIndex()
filter = str(self.filter_combo.currentText())
if not vol_name:
self.out_edit.setFocus()
return
if not filter:
self.filter_combo.setFocus()
return
source_data = self._model.data(self._model.index(source_row),
Qt.UserRole + 6)
mask_data = self._model.data(self._model.index(mask_row),
Qt.UserRole + 6)
mask_config, _ = self._model.data(self._model.index(mask_row),
Qt.UserRole + 7)
filter_index = mask_config.get_label_index(filter)
mask_data[mask_data != filter_index] = 0
new_vol = imtool.roi_filtering(source_data, mask_data)
self._model.addItem(new_vol,
None,
vol_name,
self._model._data[0].get_header(),
None, None, 255, 'rainbow')
self.done(0)
|
liuzhaoguo/FreeROI
|
froi/gui/component/unused/roifilterdialog.py
|
Python
|
bsd-3-clause
| 4,860
|
from distutils import log
import distutils.command.sdist as orig
import os
import sys
import io
import contextlib
from setuptools.extern import six
from .py36compat import sdist_add_defaults
import pkg_resources
_default_revctrl = list
def walk_revctrl(dirname=''):
"""Find all files under revision control"""
for ep in pkg_resources.iter_entry_points('setuptools.file_finders'):
for item in ep.load()(dirname):
yield item
class sdist(sdist_add_defaults, orig.sdist):
"""Smart sdist that finds anything supported by revision control"""
user_options = [
('formats=', None,
"formats for source distribution (comma-separated list)"),
('keep-temp', 'k',
"keep the distribution tree around after creating " +
"archive file(s)"),
('dist-dir=', 'd',
"directory to put the source distribution archive(s) in "
"[default: dist]"),
]
negative_opt = {}
READMES = 'README', 'README.rst', 'README.txt'
def run(self):
self.run_command('egg_info')
ei_cmd = self.get_finalized_command('egg_info')
self.filelist = ei_cmd.filelist
self.filelist.append(os.path.join(ei_cmd.egg_info, 'SOURCES.txt'))
self.check_readme()
# Run sub commands
for cmd_name in self.get_sub_commands():
self.run_command(cmd_name)
# Call check_metadata only if no 'check' command
# (distutils <= 2.6)
import distutils.command
if 'check' not in distutils.command.__all__:
self.check_metadata()
self.make_distribution()
dist_files = getattr(self.distribution, 'dist_files', [])
for file in self.archive_files:
data = ('sdist', '', file)
if data not in dist_files:
dist_files.append(data)
def initialize_options(self):
orig.sdist.initialize_options(self)
self._default_to_gztar()
def _default_to_gztar(self):
# only needed on Python prior to 3.6.
if sys.version_info >= (3, 6, 0, 'beta', 1):
return
self.formats = ['gztar']
def make_distribution(self):
"""
Workaround for #516
"""
with self._remove_os_link():
orig.sdist.make_distribution(self)
@staticmethod
@contextlib.contextmanager
def _remove_os_link():
"""
In a context, remove and restore os.link if it exists
"""
class NoValue:
pass
orig_val = getattr(os, 'link', NoValue)
try:
del os.link
except Exception:
pass
try:
yield
finally:
if orig_val is not NoValue:
setattr(os, 'link', orig_val)
def __read_template_hack(self):
# This grody hack closes the template file (MANIFEST.in) if an
# exception occurs during read_template.
# Doing so prevents an error when easy_install attempts to delete the
# file.
try:
orig.sdist.read_template(self)
except Exception:
_, _, tb = sys.exc_info()
tb.tb_next.tb_frame.f_locals['template'].close()
raise
# Beginning with Python 2.7.2, 3.1.4, and 3.2.1, this leaky file handle
# has been fixed, so only override the method if we're using an earlier
# Python.
has_leaky_handle = (
sys.version_info < (2, 7, 2)
or (3, 0) <= sys.version_info < (3, 1, 4)
or (3, 2) <= sys.version_info < (3, 2, 1)
)
if has_leaky_handle:
read_template = __read_template_hack
def _add_defaults_python(self):
"""getting python files"""
if self.distribution.has_pure_modules():
build_py = self.get_finalized_command('build_py')
self.filelist.extend(build_py.get_source_files())
# This functionality is incompatible with include_package_data, and
# will in fact create an infinite recursion if include_package_data
# is True. Use of include_package_data will imply that
# distutils-style automatic handling of package_data is disabled
if not self.distribution.include_package_data:
for _, src_dir, _, filenames in build_py.data_files:
self.filelist.extend([os.path.join(src_dir, filename)
for filename in filenames])
def _add_defaults_data_files(self):
"""
Don't add any data files, but why?
"""
def check_readme(self):
for f in self.READMES:
if os.path.exists(f):
return
else:
self.warn(
"standard file not found: should have one of " +
', '.join(self.READMES)
)
def make_release_tree(self, base_dir, files):
orig.sdist.make_release_tree(self, base_dir, files)
# Save any egg_info command line options used to create this sdist
dest = os.path.join(base_dir, 'setup.cfg')
if hasattr(os, 'link') and os.path.exists(dest):
# unlink and re-copy, since it might be hard-linked, and
# we don't want to change the source version
os.unlink(dest)
self.copy_file('setup.cfg', dest)
self.get_finalized_command('egg_info').save_version_info(dest)
def _manifest_is_not_generated(self):
# check for special comment used in 2.7.1 and higher
if not os.path.isfile(self.manifest):
return False
with io.open(self.manifest, 'rb') as fp:
first_line = fp.readline()
return (first_line !=
'# file GENERATED by distutils, do NOT edit\n'.encode())
def read_manifest(self):
"""Read the manifest file (named by 'self.manifest') and use it to
fill in 'self.filelist', the list of files to include in the source
distribution.
"""
log.info("reading manifest file '%s'", self.manifest)
manifest = open(self.manifest, 'rb')
for line in manifest:
# The manifest must contain UTF-8. See #303.
if six.PY3:
try:
line = line.decode('UTF-8')
except UnicodeDecodeError:
log.warn("%r not UTF-8 decodable -- skipping" % line)
continue
# ignore comments and blank lines
line = line.strip()
if line.startswith('#') or not line:
continue
self.filelist.append(line)
manifest.close()
|
pdxwebdev/yadapy
|
yada/lib/python2.7/site-packages/setuptools/command/sdist.py
|
Python
|
gpl-3.0
| 6,650
|
import pandas as pd
import mymsms
import os
import myHAF
import time
import my_global_functions
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
matplotlib.rc('text', usetex=True)
matplotlib.rcParams['text.latex.preamble']=[r"\usepackage{amsmath}"]
color_map = plt.cm.Set1(np.linspace(0, 1, 10))
import multiprocessing as mp
def uniform_bp_position(L, m):
bp_pos = np.sort(np.random.choice(L-1,m, False))+1
return bp_pos
def one_cM_to_bp(window_size, Ne, rho):
r = rho/(4.0*Ne*window_size)
one_cM = 1/(100.0*r)
return one_cM
def creat_hap_genemap(the_file):
[Ne, n, theta, rho, window_size, ba_pos] = mymsms.get_msms_parameters(the_file)
[M, pos, ba_ix, oc] = mymsms.read_msms_file_info(the_file)
one_cM = one_cM_to_bp(window_size, Ne, rho)
m = M.shape[1]
bp_pos = uniform_bp_position(window_size, m)
cM_pos = bp_pos/1.0/one_cM
st = ""
for i in range(m):
st+="1 %i %s %i\n"%(i, cM_pos[i], bp_pos[i])
g = open(the_file+".map", 'w')
g.write(st)
g.close()
np.savetxt(the_file+".hap", M, fmt='%i', delimiter=' ')
def run_ihs(the_file):
creat_hap_genemap(the_file)
selscan = "/home/alek/mybin/selscan"
cmd="%s --ihs --hap %s.hap --map %s.map --out %s --threads 1 --trunc-ok"%(selscan, the_file, the_file, the_file)
os.system(cmd)
return the_file+".ihs.out"
def run_nsl(the_file, max_extend_nsl = 100):
creat_hap_genemap(the_file)
selscan = "/home/alek/mybin/selscan"
cmd="%s --nsl --hap %s.hap --map %s.map --out %s --threads 1 --trunc-ok --max-extend-nsl %i"%(selscan, the_file, the_file, the_file, max_extend_nsl)
os.system(cmd)
return the_file+".nsl.out"
def std_ihs_nsl(ihs):
freq_bins = np.arange(0.1,1,0.2)
std_ihs = np.zeros(ihs.shape[0])
for f in freq_bins:
I = np.nonzero((ihs[:,2]>f-0.1)&(ihs[:,2]<=f+0.1))[0]
m_f = np.mean(ihs[I,5])
s_f = np.std(ihs[I,5])
std_ihs[I] = (ihs[I,5]-m_f)/s_f
return std_ihs
def standardize_ihs(f, unstandardized_ihs):
tune = pd.read_csv("/media/alek/DATA/SAFE_repo/iHS/Tune_Freq/ihs_tune.csv")
dft = tune.set_index("freq").loc[np.round(f,3)].reset_index()
standardized_ihs = (unstandardized_ihs - dft["mean"]) / dft["std"]
return standardized_ihs.values
|
airanmehr/bio
|
Scripts/Miscellaneous/Ali/ihs_nsl.py
|
Python
|
mit
| 2,295
|
#
# 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.
"""Manages all plugins."""
# noinspection PyDeprecation
import imp # pylint: disable=deprecated-module
import inspect
import os
import re
import sys
from typing import Any, Callable, Dict, List, Optional, Set, Type
import pkg_resources
from airflow import settings
from airflow.utils.log.logging_mixin import LoggingMixin
log = LoggingMixin().log
import_errors = {}
class AirflowPluginException(Exception):
"""Exception when loading plugin."""
class AirflowPlugin:
"""Class used to define AirflowPlugin."""
name: Optional[str] = None
operators: List[Any] = []
sensors: List[Any] = []
hooks: List[Any] = []
executors: List[Any] = []
macros: List[Any] = []
admin_views: List[Any] = []
flask_blueprints: List[Any] = []
menu_links: List[Any] = []
appbuilder_views: List[Any] = []
appbuilder_menu_items: List[Any] = []
# A function that validate the statsd stat name, apply changes
# to the stat name if necessary and return the transformed stat name.
#
# The function should have the following signature:
# def func_name(stat_name: str) -> str:
stat_name_handler: Optional[Callable[[str], str]] = None
# A list of global operator extra links that can redirect users to
# external systems. These extra links will be available on the
# task page in the form of buttons.
#
# Note: the global operator extra link can be overridden at each
# operator level.
global_operator_extra_links: List[Any] = []
# A list of operator extra links to override or add operator links
# to existing Airflow Operators.
# These extra links will be available on the task page in form of
# buttons.
operator_extra_links: List[Any] = []
@classmethod
def validate(cls):
"""Validates that plugin has a name."""
if not cls.name:
raise AirflowPluginException("Your plugin needs a name.")
@classmethod
def on_load(cls, *args, **kwargs):
"""
Executed when the plugin is loaded.
This method is only called once during runtime.
:param args: If future arguments are passed in on call.
:param kwargs: If future arguments are passed in on call.
"""
def load_entrypoint_plugins(entry_points, airflow_plugins):
"""
Load AirflowPlugin subclasses from the entrypoints
provided. The entry_point group should be 'airflow.plugins'.
:param entry_points: A collection of entrypoints to search for plugins
:type entry_points: Generator[setuptools.EntryPoint, None, None]
:param airflow_plugins: A collection of existing airflow plugins to
ensure we don't load duplicates
:type airflow_plugins: list[type[airflow.plugins_manager.AirflowPlugin]]
:rtype: list[airflow.plugins_manager.AirflowPlugin]
"""
for entry_point in entry_points:
log.debug('Importing entry_point plugin %s', entry_point.name)
plugin_obj = entry_point.load()
if is_valid_plugin(plugin_obj, airflow_plugins):
if callable(getattr(plugin_obj, 'on_load', None)):
plugin_obj.on_load()
airflow_plugins.append(plugin_obj)
return airflow_plugins
def register_inbuilt_operator_links() -> None:
"""
Register all the Operators Links that are already defined for the operators
in the "airflow" project. Example: QDSLink (Operator Link for Qubole Operator)
This is required to populate the "whitelist" of allowed classes when deserializing operator links
"""
inbuilt_operator_links: Set[Type] = set()
try:
from airflow.gcp.operators.bigquery import BigQueryConsoleLink, BigQueryConsoleIndexableLink # noqa E501 # pylint: disable=R0401,line-too-long
inbuilt_operator_links.update([BigQueryConsoleLink, BigQueryConsoleIndexableLink])
except ImportError:
pass
try:
from airflow.contrib.operators.qubole_operator import QDSLink # pylint: disable=R0401
inbuilt_operator_links.update([QDSLink])
except ImportError:
pass
registered_operator_link_classes.update({
"{}.{}".format(link.__module__, link.__name__): link
for link in inbuilt_operator_links
})
def is_valid_plugin(plugin_obj, existing_plugins):
"""
Check whether a potential object is a subclass of
the AirflowPlugin class.
:param plugin_obj: potential subclass of AirflowPlugin
:param existing_plugins: Existing list of AirflowPlugin subclasses
:return: Whether or not the obj is a valid subclass of
AirflowPlugin
"""
if (
inspect.isclass(plugin_obj) and
issubclass(plugin_obj, AirflowPlugin) and
(plugin_obj is not AirflowPlugin)
):
plugin_obj.validate()
return plugin_obj not in existing_plugins
return False
plugins = [] # type: List[AirflowPlugin]
norm_pattern = re.compile(r'[/|.]')
if not settings.PLUGINS_FOLDER:
raise ValueError("Plugins folder is not set")
# Crawl through the plugins folder to find AirflowPlugin derivatives
for root, dirs, files in os.walk(settings.PLUGINS_FOLDER, followlinks=True):
for f in files:
filepath = os.path.join(root, f)
try:
if not os.path.isfile(filepath):
continue
mod_name, file_ext = os.path.splitext(
os.path.split(filepath)[-1])
if file_ext != '.py':
continue
log.debug('Importing plugin module %s', filepath)
# normalize root path as namespace
namespace = '_'.join([re.sub(norm_pattern, '__', root), mod_name])
m = imp.load_source(namespace, filepath)
for obj in list(m.__dict__.values()):
if is_valid_plugin(obj, plugins):
plugins.append(obj)
except Exception as e: # pylint: disable=broad-except
log.exception(e)
path = filepath or str(f)
log.error('Failed to import plugin %s', path)
import_errors[path] = str(e)
plugins = load_entrypoint_plugins(
pkg_resources.iter_entry_points('airflow.plugins'),
plugins
)
# pylint: disable=protected-access
# noinspection Mypy,PyTypeHints
def make_module(name: str, objects: List[Any]):
"""Creates new module."""
log.debug('Creating module %s', name)
name = name.lower()
module = imp.new_module(name)
module._name = name.split('.')[-1] # type: ignore
module._objects = objects # type: ignore
module.__dict__.update((o.__name__, o) for o in objects)
return module
# pylint: enable=protected-access
# Plugin components to integrate as modules
operators_modules = []
sensors_modules = []
hooks_modules = []
executors_modules = []
macros_modules = []
# Plugin components to integrate directly
admin_views: List[Any] = []
flask_blueprints: List[Any] = []
menu_links: List[Any] = []
flask_appbuilder_views: List[Any] = []
flask_appbuilder_menu_links: List[Any] = []
stat_name_handler: Any = None
global_operator_extra_links: List[Any] = []
operator_extra_links: List[Any] = []
registered_operator_link_classes: Dict[str, Type] = {}
"""Mapping of class names to class of OperatorLinks registered by plugins.
Used by the DAG serialization code to only allow specific classes to be created
during deserialization
"""
stat_name_handlers = []
for p in plugins:
if not p.name:
raise AirflowPluginException("Plugin name is missing.")
plugin_name: str = p.name
operators_modules.append(
make_module('airflow.operators.' + plugin_name, p.operators + p.sensors))
sensors_modules.append(
make_module('airflow.sensors.' + plugin_name, p.sensors)
)
hooks_modules.append(make_module('airflow.hooks.' + plugin_name, p.hooks))
executors_modules.append(
make_module('airflow.executors.' + plugin_name, p.executors))
macros_modules.append(make_module('airflow.macros.' + plugin_name, p.macros))
admin_views.extend(p.admin_views)
menu_links.extend(p.menu_links)
flask_appbuilder_views.extend(p.appbuilder_views)
flask_appbuilder_menu_links.extend(p.appbuilder_menu_items)
flask_blueprints.extend([{
'name': p.name,
'blueprint': bp
} for bp in p.flask_blueprints])
if p.stat_name_handler:
stat_name_handlers.append(p.stat_name_handler)
global_operator_extra_links.extend(p.global_operator_extra_links)
operator_extra_links.extend([ope for ope in p.operator_extra_links])
registered_operator_link_classes.update({
"{}.{}".format(link.__class__.__module__,
link.__class__.__name__): link.__class__
for link in p.operator_extra_links
})
if len(stat_name_handlers) > 1:
raise AirflowPluginException(
'Specified more than one stat_name_handler ({}) '
'is not allowed.'.format(stat_name_handlers))
stat_name_handler = stat_name_handlers[0] if len(stat_name_handlers) == 1 else None
def integrate_operator_plugins() -> None:
"""Integrate operators plugins to the context"""
for operators_module in operators_modules:
sys.modules[operators_module.__name__] = operators_module
# noinspection PyProtectedMember
globals()[operators_module._name] = operators_module # pylint: disable=protected-access
def integrate_sensor_plugins() -> None:
"""Integrate sensor plugins to the context"""
for sensors_module in sensors_modules:
sys.modules[sensors_module.__name__] = sensors_module
# noinspection PyProtectedMember
globals()[sensors_module._name] = sensors_module # pylint: disable=protected-access
def integrate_hook_plugins() -> None:
"""Integrate hook plugins to the context"""
for hooks_module in hooks_modules:
sys.modules[hooks_module.__name__] = hooks_module
# noinspection PyProtectedMember
globals()[hooks_module._name] = hooks_module # pylint: disable=protected-access
def integrate_executor_plugins() -> None:
"""Integrate executor plugins to the context."""
for executors_module in executors_modules:
sys.modules[executors_module.__name__] = executors_module
# noinspection PyProtectedMember
globals()[executors_module._name] = executors_module # pylint: disable=protected-access
def integrate_macro_plugins() -> None:
"""Integrate macro plugins to the context"""
for macros_module in macros_modules:
sys.modules[macros_module.__name__] = macros_module
# noinspection PyProtectedMember
globals()[macros_module._name] = macros_module # pylint: disable=protected-access
def integrate_plugins() -> None:
"""Integrates all types of plugins."""
integrate_operator_plugins()
integrate_sensor_plugins()
integrate_hook_plugins()
integrate_executor_plugins()
integrate_macro_plugins()
register_inbuilt_operator_links()
|
Fokko/incubator-airflow
|
airflow/plugins_manager.py
|
Python
|
apache-2.0
| 11,711
|
'''
Copyright (c) 2017 Vanessa Sochat
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 sendit.apps.main.models import (
Batch,
Image
)
from sendit.apps.main.utils import get_batch
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.contrib import messages
from django.http import (
HttpResponse,
JsonResponse
)
from django.http.response import (
HttpResponseRedirect,
HttpResponseForbidden,
Http404
)
from django.shortcuts import (
get_object_or_404,
render_to_response,
render,
redirect
)
import os
def get_batch_context(bid):
'''a repeated sequence of calls to get the context
for a batch based on id'''
batch = get_batch(bid)
context = {"active":"dashboard",
"batch" : batch,
"title": batch.uid }
return context
def batch_details(request,bid):
'''view details for a batch
'''
context = get_batch_context(bid)
return render(request, 'batch/batch_details.html', context)
|
pydicom/sendit
|
sendit/apps/main/views/batch.py
|
Python
|
mit
| 2,050
|
# Copyright (c) 2010-2013 OpenStack, 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.
""" In-Memory Object Server for Swift """
import os
from swift import gettext_ as _
from eventlet import Timeout
from swift.common.bufferedhttp import http_connect
from swift.common.exceptions import ConnectionTimeout
from swift.common.http import is_success
from swift.obj.mem_diskfile import InMemoryFileSystem
from swift.obj import server
class ObjectController(server.ObjectController):
"""
Implements the WSGI application for the Swift In-Memory Object Server.
"""
def setup(self, conf):
"""
Nothing specific to do for the in-memory version.
:param conf: WSGI configuration parameter
"""
self._filesystem = InMemoryFileSystem()
def get_diskfile(self, device, partition, account, container, obj,
**kwargs):
"""
Utility method for instantiating a DiskFile object supporting a given
REST API.
An implementation of the object server that wants to use a different
DiskFile class would simply over-ride this method to provide that
behavior.
"""
return self._filesystem.get_diskfile(account, container, obj, **kwargs)
def async_update(self, op, account, container, obj, host, partition,
contdevice, headers_out, objdevice):
"""
Sends or saves an async update.
:param op: operation performed (ex: 'PUT', or 'DELETE')
:param account: account name for the object
:param container: container name for the object
:param obj: object name
:param host: host that the container is on
:param partition: partition that the container is on
:param contdevice: device name that the container is on
:param headers_out: dictionary of headers to send in the container
request
:param objdevice: device name that the object is in
"""
headers_out['user-agent'] = 'obj-server %s' % os.getpid()
full_path = '/%s/%s/%s' % (account, container, obj)
if all([host, partition, contdevice]):
try:
with ConnectionTimeout(self.conn_timeout):
ip, port = host.rsplit(':', 1)
conn = http_connect(ip, port, contdevice, partition, op,
full_path, headers_out)
with Timeout(self.node_timeout):
response = conn.getresponse()
response.read()
if is_success(response.status):
return
else:
self.logger.error(_(
'ERROR Container update failed: %(status)d '
'response from %(ip)s:%(port)s/%(dev)s'),
{'status': response.status, 'ip': ip, 'port': port,
'dev': contdevice})
except (Exception, Timeout):
self.logger.exception(_(
'ERROR container update failed with '
'%(ip)s:%(port)s/%(dev)s'),
{'ip': ip, 'port': port, 'dev': contdevice})
# FIXME: For now don't handle async updates
def REPLICATE(self, request):
"""
Handle REPLICATE requests for the Swift Object Server. This is used
by the object replicator to get hashes for directories.
"""
pass
def app_factory(global_conf, **local_conf):
"""paste.deploy app factory for creating WSGI object server apps"""
conf = global_conf.copy()
conf.update(local_conf)
return ObjectController(conf)
|
NeCTAR-RC/swift
|
swift/obj/mem_server.py
|
Python
|
apache-2.0
| 4,239
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_txgeocodio
----------------------------------
Tests for `txgeocodio` module.
"""
from twisted.trial import unittest
import txgeocodio
class TestTxgeocodio(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_configure(self):
self.assertIdentical(txgeocodio._client.config.api_key, None)
key = 'TESTAPIKEY'
txgeocodio.configure(key)
self.assertEqual(txgeocodio._client.config.api_key, key)
|
trenton42/txgeocodio
|
tests/test_txgeocodio.py
|
Python
|
bsd-3-clause
| 536
|
from __future__ import print_function
import numpy as np
import pandas as pd
import regreg.api as rr
from ...tests.flags import SET_SEED, SMALL_SAMPLES
from ...tests.instance import logistic_instance
from ...tests.decorators import (wait_for_return_value,
set_seed_iftrue,
set_sampling_params_iftrue,
register_report)
import selection.tests.reports as reports
from ...api import (randomization,
glm_group_lasso,
pairs_bootstrap_glm,
multiple_queries,
discrete_family,
projected_langevin,
glm_group_lasso_parametric,
glm_target)
from ..glm import (glm_parametric_covariance,
glm_nonparametric_bootstrap,
restricted_Mest,
set_alpha_matrix)
@register_report(['truth', 'active'])
@set_sampling_params_iftrue(SMALL_SAMPLES, ndraw=10, burnin=10)
@set_seed_iftrue(SET_SEED)
@wait_for_return_value()
def test_multiple_queries(s=3,
n=200,
p=20,
signal=7,
rho=0.1,
lam_frac=0.7,
nview=4,
ndraw=100, burnin=0,
bootstrap=True,
test = 'global'):
#randomizer = randomization.laplace((p,), scale=1)
randomizer = randomization.logistic((p,), scale=1)
X, y, beta, _ = logistic_instance(n=n, p=p, s=s, rho=rho, signal=signal)
nonzero = np.where(beta)[0]
loss = rr.glm.logistic(X, y)
epsilon = 1.
lam = lam_frac * np.mean(np.fabs(np.dot(X.T, np.random.binomial(1, 1. / 2, (n, 10000)))).max(0))
W = np.ones(p)*lam
#W[0] = 0 # use at least some unpenalized
penalty = rr.group_lasso(np.arange(p),
weights=dict(zip(np.arange(p), W)), lagrange=1.)
view = []
for i in range(nview):
view.append(glm_group_lasso(loss, epsilon, penalty, randomizer))
mv = multiple_queries(view)
mv.solve()
active_union = np.zeros(p, np.bool)
for i in range(nview):
active_union += view[i].selection_variable['variables']
nactive = np.sum(active_union)
#print("nactive", nactive)
if set(nonzero).issubset(np.nonzero(active_union)[0]):
if nactive==s:
return None
active_set = np.nonzero(active_union)[0]
if test == 'selected zeros':
inactive_selected = np.array([active_union[i] and i not in nonzero for i in range(p)])
true_active = (beta != 0)
reference = np.zeros(inactive_selected.sum())
target_sampler, target_observed = glm_target(loss,
#true_active,
active_union,
mv,
subset=inactive_selected,
bootstrap=bootstrap,
reference=reference)
test_stat = lambda x: np.linalg.norm(x-reference)
else:
reference = beta[active_union]
target_sampler, target_observed = glm_target(loss,
active_union,
mv,
bootstrap=bootstrap,
reference = reference)
test_stat = lambda x: np.linalg.norm(x-beta[active_union])
observed_test_value = test_stat(target_observed)
pivot = target_sampler.hypothesis_test(test_stat,
observed_test_value,
alternative='twosided',
ndraw=ndraw,
burnin=burnin,
parameter=reference)
full_sample = target_sampler.sample(ndraw=ndraw,
burnin=burnin,
keep_opt=True)
return [pivot], [False]
@register_report(['pvalue', 'active'])
@set_sampling_params_iftrue(SMALL_SAMPLES, ndraw=100, burnin=100)
@set_seed_iftrue(SET_SEED)
@wait_for_return_value(max_tries=200)
def test_parametric_covariance(ndraw=10000, burnin=2000):
s, n, p = 3, 120, 10
randomizer = randomization.laplace((p,), scale=1)
X, y, beta, _ = logistic_instance(n=n, p=p, s=s, rho=0, signal=12)
nonzero = np.where(beta)[0]
lam_frac = 1.
loss = rr.glm.logistic(X, y)
epsilon = 1.
lam = lam_frac * np.mean(np.fabs(np.dot(X.T, np.random.binomial(1, 1. / 2, (n, 10000)))).max(0))
W = np.ones(p)*lam
W[0] = 0 # use at least some unpenalized
penalty = rr.group_lasso(np.arange(p),
weights=dict(zip(np.arange(p), W)), lagrange=1.)
# first randomization
M_est1 = glm_group_lasso_parametric(loss, epsilon, penalty, randomizer)
# second randomization
M_est2 = glm_group_lasso_parametric(loss, epsilon, penalty, randomizer)
mv = multiple_queries([M_est1, M_est2])
mv.solve()
target = M_est1.selection_variable['variables'].copy()
if target[-1] or M_est2.selection_variable['variables'][-1]:
return None
if target[-2] or M_est2.selection_variable['variables'][-2]:
return None
# we should check they are different sizes
target[-2:] = 1
if set(nonzero).issubset(np.nonzero(target)[0]):
form_covariances = glm_parametric_covariance(loss)
mv.setup_sampler(form_covariances)
target_observed = restricted_Mest(loss, target)
linear_func = np.zeros((2,target_observed.shape[0]))
linear_func[0,-1] = 1. # we know this one is null
linear_func[1,-2] = 1. # also null
target_observed = linear_func.dot(target_observed)
target_sampler = mv.setup_target((target, linear_func), target_observed,
parametric=True)
test_stat = lambda x: np.linalg.norm(x)
pval = target_sampler.hypothesis_test(test_stat,
test_stat(target_observed),
alternative='greater',
ndraw=ndraw,
burnin=burnin)
return [pval], [False]
@register_report(['pvalue', 'active'])
@set_sampling_params_iftrue(SMALL_SAMPLES, ndraw=10, burnin=10)
@set_seed_iftrue(SET_SEED)
@wait_for_return_value()
def test_multiple_queries(s=3, n=200, p=20,
signal=7,
rho=0.1,
lam_frac=0.7,
nview=4,
ndraw=10000, burnin=2000,
bootstrap=True):
randomizer = randomization.laplace((p,), scale=1)
X, y, beta, _ = logistic_instance(n=n, p=p, s=s, rho=rho, signal=signal)
nonzero = np.where(beta)[0]
lam_frac = 1.
loss = rr.glm.logistic(X, y)
epsilon = 1.
lam = lam_frac * np.mean(np.fabs(np.dot(X.T, np.random.binomial(1, 1. / 2, (n, 10000)))).max(0))
W = np.ones(p)*lam
W[0] = 0 # use at least some unpenalized
penalty = rr.group_lasso(np.arange(p),
weights=dict(zip(np.arange(p), W)), lagrange=1.)
view = []
for i in range(nview):
view.append(glm_group_lasso(loss, epsilon, penalty, randomizer))
mv = multiple_queries(view)
mv.solve()
active_union = np.zeros(p, np.bool)
for i in range(nview):
active_union += view[i].selection_variable['variables']
nactive = np.sum(active_union)
print("nactive", nactive)
if set(nonzero).issubset(np.nonzero(active_union)[0]):
if nactive==s:
return None
active_set = np.nonzero(active_union)[0]
inactive_selected = np.array([active_union[i] and i not in nonzero for i in range(p)])
true_active = (beta != 0)
reference = np.zeros(inactive_selected.sum())
target_sampler, target_observed = glm_target(loss,
active_union,
mv,
subset=inactive_selected,
bootstrap=bootstrap,
reference=reference)
test_stat = lambda x: np.linalg.norm(x)
observed_test_value = test_stat(target_observed)
full_sample = target_sampler.sample(ndraw=ndraw,
burnin=burnin,
keep_opt=True)
pivot = target_sampler.hypothesis_test(test_stat,
observed_test_value,
alternative='twosided',
ndraw=ndraw,
burnin=burnin,
parameter=reference)
return [pivot], [False]
def report(niter=1, **kwargs):
#kwargs = {'s':3, 'n':300, 'p':20, 'signal':7, 'nview':4, 'test': 'global'}
kwargs = {'s': 3, 'n': 300, 'p': 20, 'signal': 7, 'nview': 1}
kwargs['bootstrap'] = False
intervals_report = reports.reports['test_multiple_queries']
CLT_runs = reports.collect_multiple_runs(intervals_report['test'],
intervals_report['columns'],
niter,
reports.summarize_all,
**kwargs)
#fig = reports.pivot_plot(CLT_runs, color='b', label='CLT')
fig = reports.pivot_plot_2in1(CLT_runs, color='b', label='CLT')
kwargs['bootstrap'] = True
bootstrap_runs = reports.collect_multiple_runs(intervals_report['test'],
intervals_report['columns'],
niter,
reports.summarize_all,
**kwargs)
#fig = reports.pivot_plot(bootstrap_runs, color='g', label='Bootstrap', fig=fig)
fig = reports.pivot_plot_2in1(bootstrap_runs, color='g', label='Bootstrap', fig=fig)
fig.savefig('multiple_queries.pdf') # will have both bootstrap and CLT on plot
if __name__ == "__main__":
report()
|
selective-inference/selective-inference
|
sandbox/randomized_tests/test_multiple_queries.py
|
Python
|
bsd-3-clause
| 11,009
|
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-02-09 08:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0017_mentorinfo_availability'),
]
operations = [
migrations.AddField(
model_name='hackathonsponsor',
name='on_mobile',
field=models.BooleanField(default=False),
),
]
|
andrewsosa/hackfsu_com
|
api/api/migrations/0018_hackathonsponsor_on_mobile.py
|
Python
|
apache-2.0
| 466
|
"""
Created on 9 Nov 2012
@author: plish
"""
class TrelloObject(object):
"""
This class is a base object that should be used by all trello objects;
Board, List, Card, etc. It contains methods needed and used by all those
objects and masks the client calls as methods belonging to the object.
"""
def __init__(self, trello_client):
"""
A Trello client, Oauth of HTTP client is required for each object.
"""
super(TrelloObject, self).__init__()
self.client = trello_client
def fetch_json(self, uri_path, http_method='GET', query_params=None, body=None, headers=None):
return self.client.fetch_json(
uri_path=uri_path,
http_method=http_method,
query_params=query_params or {},
body=body,
headers=headers or {}
)
def get_organisations_json(self, base_uri):
return self.fetch_json(base_uri + '/organization')
def get_boards_json(self, base_uri):
return self.fetch_json(base_uri + '/boards')
def get_board_json(self, base_uri):
return self.fetch_json(base_uri + '/board')
def get_lists_json(self, base_uri):
return self.fetch_json(base_uri + '/lists')
def get_list_json(self, base_uri):
return self.fetch_json(base_uri + '/list')
def get_cards_json(self, base_uri):
return self.fetch_json(base_uri + '/cards')
def get_checklist_json(self, base_uri):
return self.fetch_json(base_uri + '/checklists')
def get_members_json(self, base_uri):
return self.fetch_json(base_uri + '/members')
def create_organisation(self, organisation_json, **kwargs):
return self.client.create_organisation(organisation_json, **kwargs)
def create_board(self, board_json, **kwargs):
return self.client.create_board(board_json, **kwargs)
def create_list(self, list_json, **kwargs):
return self.client.create_list(list_json, **kwargs)
def create_card(self, card_json, **kwargs):
return self.client.create_card(card_json, **kwargs)
def create_checklist(self, checklist_json, **kwargs):
return self.client.create_checklist(checklist_json, **kwargs)
def create_member(self, member_json, **kwargs):
return self.client.create_member(member_json, **kwargs)
# Deprecated method names
def fetchJson(self, uri_path, http_method='GET', query_params=None, body=None, headers=None):
return self.fetch_json(uri_path, http_method, query_params or {}, body, headers or {})
def getOrganisationsJson(self, base_uri):
return self.get_organisations_json(base_uri)
def getBoardsJson(self, base_uri):
return self.get_boards_json(base_uri)
def getBoardJson(self, base_uri):
return self.get_board_json(base_uri)
def getListsJson(self, base_uri):
return self.get_lists_json(base_uri)
def getListJson(self, base_uri):
return self.get_list_json(base_uri)
def getCardsJson(self, base_uri):
return self.get_cards_json(base_uri)
def getChecklistsJson(self, base_uri):
return self.get_checklist_json(base_uri)
def getMembersJson(self, base_uri):
return self.get_members_json(base_uri)
def createOrganisation(self, organisation_json, **kwargs):
return self.create_organisation(organisation_json, **kwargs)
def createBoard(self, board_json, **kwargs):
return self.create_board(board_json, **kwargs)
def createList(self, list_json, **kwargs):
return self.create_list(list_json, **kwargs)
def createCard(self, card_json, **kwargs):
return self.create_card(card_json, **kwargs)
def createChecklist(self, checklist_json, **kwargs):
return self.create_checklist(checklist_json, **kwargs)
def createMember(self, member_json, **kwargs):
return self.create_member(member_json, **kwargs)
|
Oksisane/RSS-Bot
|
Trolly-master/trolly/trelloobject.py
|
Python
|
gpl-3.0
| 3,944
|
# Copyright (c) 2014 Mirantis Inc.
#
# 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 cloud
import cloud_ferry
from cloudferrylib.base.action import copy_var, rename_info, merge, is_end_iter, get_info_iter, create_reference
from cloudferrylib.os.actions import identity_transporter
from cloudferrylib.scheduler import scheduler
from cloudferrylib.scheduler import namespace
from cloudferrylib.scheduler import cursor
from cloudferrylib.os.image import glance_image
from cloudferrylib.os.storage import cinder_storage
from cloudferrylib.os.network import neutron
from cloudferrylib.os.identity import keystone
from cloudferrylib.os.compute import nova_compute
from cloudferrylib.os.object_storage import swift_storage
from cloudferrylib.os.actions import get_info_images
from cloudferrylib.os.actions import transport_instance
from cloudferrylib.os.actions import attach_used_volumes_via_compute
from cloudferrylib.os.actions import cleanup_images
from cloudferrylib.os.actions import copy_g2g
from cloudferrylib.os.actions import convert_image_to_compute
from cloudferrylib.os.actions import convert_image_to_volume
from cloudferrylib.os.actions import convert_compute_to_image
from cloudferrylib.os.actions import convert_compute_to_volume
from cloudferrylib.os.actions import convert_volume_to_image
from cloudferrylib.os.actions import convert_volume_to_compute
from cloudferrylib.os.actions import attach_used_volumes
from cloudferrylib.os.actions import networks_transporter
from cloudferrylib.base.action import create_reference
from cloudferrylib.os.actions import prepare_volumes_data_map
from cloudferrylib.os.actions import get_info_instances
from cloudferrylib.os.actions import prepare_networks
from cloudferrylib.os.actions import dissociate_floatingip_via_compute
from cloudferrylib.os.actions import map_compute_info
from cloudferrylib.os.actions import deploy_volumes
from cloudferrylib.os.actions import start_vm
from cloudferrylib.os.actions import load_compute_image_to_file
from cloudferrylib.os.actions import merge_base_and_diff
from cloudferrylib.os.actions import convert_file
from cloudferrylib.os.actions import upload_file_to_image
from cloudferrylib.os.actions import post_transport_instance
from cloudferrylib.os.actions import transport_ephemeral
from cloudferrylib.os.actions import is_not_transport_image
from cloudferrylib.os.actions import is_not_merge_diff
from cloudferrylib.os.actions import stop_vm
from cloudferrylib.utils import utils as utl
from cloudferrylib.os.actions import transport_compute_resources
from cloudferrylib.os.actions import task_transfer
from cloudferrylib.os.actions import is_not_copy_diff_file
from cloudferrylib.utils.drivers import ssh_ceph_to_ceph
from cloudferrylib.utils.drivers import ssh_ceph_to_file
from cloudferrylib.utils.drivers import ssh_file_to_file
from cloudferrylib.utils.drivers import ssh_file_to_ceph
from cloudferrylib.os.actions import get_filter
from cloudferrylib.os.actions import deploy_snapshots
from cloudferrylib.base.action import is_option
from cloudferrylib.os.actions import get_info_volumes
from cloudferrylib.os.actions import get_info_objects
from cloudferrylib.os.actions import copy_object2object
from cloudferrylib.os.actions import fake_action
class OS2OSFerry(cloud_ferry.CloudFerry):
def __init__(self, config):
super(OS2OSFerry, self). __init__(config)
resources = {'identity': keystone.KeystoneIdentity,
'image': glance_image.GlanceImage,
'storage': cinder_storage.CinderStorage,
'network': neutron.NeutronNetwork,
'compute': nova_compute.NovaCompute,
'objstorage': swift_storage.SwiftStorage}
self.src_cloud = cloud.Cloud(resources, cloud.SRC, config)
self.dst_cloud = cloud.Cloud(resources, cloud.DST, config)
self.init = {
'src_cloud': self.src_cloud,
'dst_cloud': self.dst_cloud,
'cfg': self.config,
'SSHCephToCeph': ssh_ceph_to_ceph.SSHCephToCeph,
'SSHCephToFile': ssh_ceph_to_file.SSHCephToFile,
'SSHFileToFile': ssh_file_to_file.SSHFileToFile,
'SSHFileToCeph': ssh_file_to_ceph.SSHFileToCeph
}
def migrate(self, scenario=None):
namespace_scheduler = namespace.Namespace({
'__init_task__': self.init,
'info_result': {
utl.INSTANCES_TYPE: {}
}
})
if not scenario:
process_migration = self.process_migrate()
else:
scenario.init_tasks(self.init)
scenario.load_scenario()
process_migration = scenario.get_net()
process_migration = cursor.Cursor(process_migration)
scheduler_migr = scheduler.Scheduler(namespace=namespace_scheduler, cursor=process_migration)
scheduler_migr.start()
def process_migrate(self):
task_resources_transporting = self.transport_resources()
transport_instances_and_dependency_resources = self.migrate_instances()
return task_resources_transporting >> transport_instances_and_dependency_resources
def migrate_instances(self):
name_data = 'info'
name_result = 'info_result'
name_backup = 'info_backup'
name_iter = 'info_iter'
save_result = self.save_result(name_data, name_result, name_result, 'instances')
trans_one_inst = self.migrate_process_instance()
init_iteration_instance = self.init_iteration_instance(name_data, name_backup, name_iter)
act_get_filter = get_filter.GetFilter(self.init)
act_get_info_inst = get_info_instances.GetInfoInstances(self.init, cloud='src_cloud')
act_cleanup_images = cleanup_images.CleanupImages(self.init)
get_next_instance = get_info_iter.GetInfoIter(self.init)
rename_info_iter = rename_info.RenameInfo(self.init, name_result, name_data)
is_instances = is_end_iter.IsEndIter(self.init)
transport_instances_and_dependency_resources = \
act_get_filter >> \
act_get_info_inst >> \
init_iteration_instance >> \
get_next_instance >> \
trans_one_inst >> \
save_result >> \
(is_instances | get_next_instance) >>\
rename_info_iter >> \
act_cleanup_images
return transport_instances_and_dependency_resources
def init_iteration_instance(self, data, name_backup, name_iter):
init_iteration_instance = copy_var.CopyVar(self.init, data, name_backup, True) >>\
create_reference.CreateReference(self.init, data, name_iter)
return init_iteration_instance
def migration_images(self):
act_get_info_images = get_info_images.GetInfoImages(self.init, cloud='src_cloud')
act_deploy_images = copy_g2g.CopyFromGlanceToGlance(self.init)
return act_get_info_images >> act_deploy_images
def save_result(self, data1, data2, result, resources_name):
return merge.Merge(self.init, data1, data2, result, resources_name)
def transport_volumes_by_instance(self):
act_copy_g2g_vols = copy_g2g.CopyFromGlanceToGlance(self.init)
act_convert_c_to_v = convert_compute_to_volume.ConvertComputeToVolume(self.init, cloud='src_cloud')
act_convert_v_to_i = convert_volume_to_image.ConvertVolumeToImage(self.init, cloud='src_cloud')
act_convert_i_to_v = convert_image_to_volume.ConvertImageToVolume(self.init, cloud='dst_cloud')
act_convert_v_to_c = convert_volume_to_compute.ConvertVolumeToCompute(self.init, cloud='dst_cloud')
task_convert_c_to_v_to_i = act_convert_c_to_v >> act_convert_v_to_i
task_convert_i_to_v_to_c = act_convert_i_to_v >> act_convert_v_to_c
return task_convert_c_to_v_to_i >> act_copy_g2g_vols >> task_convert_i_to_v_to_c
def transport_volumes_by_instance_via_ssh(self):
act_convert_c_to_v = convert_compute_to_volume.ConvertComputeToVolume(self.init, cloud='src_cloud')
act_rename_inst_vol_src = create_reference.CreateReference(self.init, 'storage_info',
'src_storage_info')
act_convert_v_to_c = convert_volume_to_compute.ConvertVolumeToCompute(self.init, cloud='dst_cloud')
act_rename_inst_vol_dst = create_reference.CreateReference(self.init, 'storage_info',
'dst_storage_info')
act_inst_vol_data_map = prepare_volumes_data_map.PrepareVolumesDataMap(self.init,
'src_storage_info',
'dst_storage_info')
act_deploy_inst_volumes = deploy_volumes.DeployVolumes(self.init, cloud='dst_cloud')
act_inst_vol_transport_data = task_transfer.TaskTransfer(self.init,
'SSHCephToCeph',
input_info='storage_info')
act_deploy_snapshots = deploy_snapshots.DeployVolSnapshots(self.init, cloud='dst_cloud') - act_convert_v_to_c
is_snapshots = is_option.IsOption(self.init, 'keep_volume_snapshots')
task_get_inst_vol_info = act_convert_c_to_v >> act_rename_inst_vol_src
task_deploy_inst_vol = act_deploy_inst_volumes >> act_rename_inst_vol_dst
return task_get_inst_vol_info >> \
task_deploy_inst_vol >> act_inst_vol_data_map >> \
(is_snapshots | act_deploy_snapshots | act_inst_vol_transport_data) >> \
act_convert_v_to_c
def transport_available_volumes_via_ssh(self):
is_volume_snapshots = is_option.IsOption(self.init,
'keep_volume_snapshots')
final_action = fake_action.FakeAction(self.init)
act_get_info_available_volumes = get_info_volumes.GetInfoVolumes(self.init,
cloud='src_cloud',
search_opts={'status': 'available'})
act_rename_vol_src = create_reference.CreateReference(self.init,
'storage_info',
'src_storage_info')
task_get_available_vol_info = act_get_info_available_volumes >> act_rename_vol_src
act_deploy_vol = deploy_volumes.DeployVolumes(self.init,
cloud='dst_cloud')
act_rename_vol_dst = create_reference.CreateReference(self.init,
'storage_info',
'dst_storage_info')
task_deploy_available_volumes = act_deploy_vol >> act_rename_vol_dst
act_vol_data_map = prepare_volumes_data_map.PrepareVolumesDataMap(self.init,
'src_storage_info',
'dst_storage_info')
act_vol_transport_data = \
task_transfer.TaskTransfer(self.init,
'SSHCephToCeph',
input_info='storage_info') - final_action
act_deploy_vol_snapshots = \
deploy_snapshots.DeployVolSnapshots(self.init,cloud='dst_cloud') - final_action
return task_get_available_vol_info >> \
task_deploy_available_volumes >> \
act_vol_data_map >> \
(is_volume_snapshots | act_deploy_vol_snapshots | act_vol_transport_data) \
>> final_action
def transport_object_storage(self):
act_get_objects_info = get_info_objects.GetInfoObjects(self.init,
cloud='src_cloud')
act_transfer_objects = copy_object2object.CopyFromObjectToObject(self.init,
src_cloud='src_cloud',
dst_cloud='dst_cloud')
task_transfer_objects = act_get_objects_info >> act_transfer_objects
return task_transfer_objects
def transport_cold_data(self):
act_identity_trans = identity_transporter.IdentityTransporter(self.init)
task_transport_available_volumes = self.transport_available_volumes_via_ssh()
task_transport_objects = self.transport_object_storage()
task_transport_images = self.migration_images()
return act_identity_trans >> \
task_transport_available_volumes \
>> task_transport_objects \
>> task_transport_images
def transport_resources(self):
act_identity_trans = identity_transporter.IdentityTransporter(self.init)
task_images_trans = self.migration_images()
act_comp_res_trans = transport_compute_resources.TransportComputeResources(self.init)
act_network_trans = networks_transporter.NetworkTransporter(self.init)
return act_identity_trans >> task_images_trans >> act_network_trans >> act_comp_res_trans
def migrate_images_by_instances(self):
act_conv_comp_img = convert_compute_to_image.ConvertComputeToImage(self.init, cloud='src_cloud')
act_conv_image_comp = convert_image_to_compute.ConvertImageToCompute(self.init)
act_copy_inst_images = copy_g2g.CopyFromGlanceToGlance(self.init)
return act_conv_comp_img >> act_copy_inst_images >> act_conv_image_comp
def migrate_resources_by_instance(self):
transport_images = self.migrate_images_by_instances()
task_transport_volumes = self.transport_volumes_by_instance()
return transport_images >> task_transport_volumes
def migrate_resources_by_instance_via_ssh(self):
transport_images = self.migrate_images_by_instances()
task_transport_volumes = self.transport_volumes_by_instance_via_ssh()
return transport_images >> task_transport_volumes
def migrate_instance(self):
act_map_com_info = map_compute_info.MapComputeInfo(self.init)
act_net_prep = prepare_networks.PrepareNetworks(self.init, cloud='dst_cloud')
act_deploy_instances = transport_instance.TransportInstance(self.init)
act_i_to_f = load_compute_image_to_file.LoadComputeImageToFile(self.init, cloud='dst_cloud')
act_merge = merge_base_and_diff.MergeBaseDiff(self.init, cloud='dst_cloud')
act_convert_image = convert_file.ConvertFile(self.init, cloud='dst_cloud')
act_f_to_i = upload_file_to_image.UploadFileToImage(self.init, cloud='dst_cloud')
act_transfer_file = task_transfer.TaskTransfer(self.init, 'SSHCephToFile',
resource_name=utl.INSTANCES_TYPE,
resource_root_name=utl.DIFF_BODY)
act_f_to_i_after_transfer = upload_file_to_image.UploadFileToImage(self.init, cloud='dst_cloud')
act_is_not_trans_image = is_not_transport_image.IsNotTransportImage(self.init, cloud='src_cloud')
act_is_not_merge_diff = is_not_merge_diff.IsNotMergeDiff(self.init, cloud='src_cloud')
act_post_transport_instance = post_transport_instance.PostTransportInstance(self.init, cloud='dst_cloud')
act_transport_ephemeral = transport_ephemeral.TransportEphemeral(self.init, cloud='dst_cloud')
trans_file_to_file = task_transfer.TaskTransfer(
self.init,
'SSHFileToFile',
resource_name=utl.INSTANCES_TYPE,
resource_root_name=utl.DIFF_BODY)
act_trans_diff_file = task_transfer.TaskTransfer(
self.init,
'SSHFileToFile',
resource_name=utl.INSTANCES_TYPE,
resource_root_name=utl.DIFF_BODY)
act_is_not_copy_diff_file = is_not_copy_diff_file.IsNotCopyDiffFile(self.init)
process_merge_diff_and_base = act_i_to_f >> trans_file_to_file >> act_merge >> act_convert_image >> act_f_to_i
process_merge_diff_and_base = act_i_to_f
process_transport_image = act_transfer_file >> act_f_to_i_after_transfer
process_transport_image = act_transfer_file
act_pre_transport_instance = (act_is_not_trans_image | act_is_not_merge_diff) >> \
process_transport_image >> \
(act_is_not_merge_diff | act_deploy_instances) >> \
process_merge_diff_and_base
act_post_transport_instance = (act_is_not_copy_diff_file |
act_transport_ephemeral) >> act_trans_diff_file
return act_net_prep >> \
act_map_com_info >> \
act_pre_transport_instance >> \
act_deploy_instances >> \
act_post_transport_instance >> \
act_transport_ephemeral
def migrate_process_instance(self):
act_attaching = attach_used_volumes_via_compute.AttachVolumesCompute(self.init, cloud='dst_cloud')
act_stop_vms = stop_vm.StopVms(self.init, cloud='src_cloud')
act_start_vms = start_vm.StartVms(self.init, cloud='dst_cloud')
#transport_resource_inst = self.migrate_resources_by_instance_via_ssh()
transport_resource_inst = self.migrate_resources_by_instance()
transport_inst = self.migrate_instance()
act_dissociate_floatingip = dissociate_floatingip_via_compute.DissociateFloatingip(self.init, cloud='src_cloud')
return act_stop_vms >> transport_resource_inst >> transport_inst >> \
act_attaching >> act_dissociate_floatingip >> act_start_vms
|
mirrorcoder/CloudFerry
|
cloud/os2os.py
|
Python
|
apache-2.0
| 18,523
|
# -*- coding: utf-8 -*-
"""Model unit tests."""
import datetime as dt
import pytest
from fm_database.models.user import Role, User
from .factories import UserFactory
@pytest.mark.usefixtures("tables")
class TestUser:
"""User tests."""
@staticmethod
def test_get_by_id():
"""Get user by ID."""
user = User("foo", "foo@bar.com")
user.save()
retrieved = User.get_by_id(user.id)
assert retrieved.id == user.id
@staticmethod
def test_created_at_defaults_to_datetime():
"""Test creation date."""
user = User(username="foo", email="foo@bar.com")
user.save()
assert bool(user.created_at)
assert isinstance(user.created_at, dt.datetime)
@staticmethod
def test_password_is_nullable():
"""Test null password."""
user = User(username="foo", email="foo@bar.com")
user.save()
assert user.password is None
@staticmethod
def test_factory():
"""Test user factory."""
user = UserFactory(password="myprecious")
user.save()
assert bool(user.username)
assert bool(user.email)
assert bool(user.created_at)
assert user.is_admin is False
assert user.active is True
assert user.check_password("myprecious")
@staticmethod
def test_check_password():
"""Check password."""
user = User.create(
username="foo",
email="foo@bar.com",
password="foobarbaz123",
)
user.save()
assert user.check_password("foobarbaz123") is True
assert user.check_password("barfoobaz") is False
@staticmethod
def test_full_name():
"""User full name."""
user = UserFactory(first_name="Foo", last_name="Bar")
assert user.full_name == "Foo Bar"
@staticmethod
def test_roles():
"""Add a role to a user."""
role = Role(name="admin")
role.save()
user = UserFactory()
user.roles.append(role)
user.save()
assert role in user.roles
|
nstoik/farm_monitor
|
api/tests/test_models.py
|
Python
|
apache-2.0
| 2,089
|
#!/usr/bin/env python
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Run this script from the root of the repository to update all translations from
transifex.
It will do the following automatically:
- fetch all translations using the tx tool
- post-process them into valid and committable format
- remove invalid control characters
- remove location tags (makes diffs less noisy)
TODO:
- auto-add new translations to the build system according to the translation process
'''
from __future__ import division, print_function
import subprocess
import re
import sys
import os
import io
import xml.etree.ElementTree as ET
# Name of transifex tool
TX = 'tx'
# Name of source language file
SOURCE_LANG = 'crimson_en.ts'
# Directory with locale files
LOCALE_DIR = 'src/qt/locale'
# Minimum number of messages for translation to be considered at all
MIN_NUM_MESSAGES = 10
def check_at_repository_root():
if not os.path.exists('.git'):
print('No .git directory found')
print('Execute this script at the root of the repository', file=sys.stderr)
exit(1)
def fetch_all_translations():
if subprocess.call([TX, 'pull', '-f', '-a']):
print('Error while fetching translations', file=sys.stderr)
exit(1)
def find_format_specifiers(s):
'''Find all format specifiers in a string.'''
pos = 0
specifiers = []
while True:
percent = s.find('%', pos)
if percent < 0:
break
specifiers.append(s[percent+1])
pos = percent+2
return specifiers
def split_format_specifiers(specifiers):
'''Split format specifiers between numeric (Qt) and others (strprintf)'''
numeric = []
other = []
for s in specifiers:
if s in {'1','2','3','4','5','6','7','8','9'}:
numeric.append(s)
else:
other.append(s)
# If both numeric format specifiers and "others" are used, assume we're dealing
# with a Qt-formatted message. In the case of Qt formatting (see https://doc.qt.io/qt-5/qstring.html#arg)
# only numeric formats are replaced at all. This means "(percentage: %1%)" is valid, without needing
# any kind of escaping that would be necessary for strprintf. Without this, this function
# would wrongly detect '%)' as a printf format specifier.
if numeric:
other = []
# numeric (Qt) can be present in any order, others (strprintf) must be in specified order
return set(numeric),other
def sanitize_string(s):
'''Sanitize string for printing'''
return s.replace('\n',' ')
def check_format_specifiers(source, translation, errors, numerus):
source_f = split_format_specifiers(find_format_specifiers(source))
# assert that no source messages contain both Qt and strprintf format specifiers
# if this fails, go change the source as this is hacky and confusing!
assert(not(source_f[0] and source_f[1]))
try:
translation_f = split_format_specifiers(find_format_specifiers(translation))
except IndexError:
errors.append("Parse error in translation for '%s': '%s'" % (sanitize_string(source), sanitize_string(translation)))
return False
else:
if source_f != translation_f:
if numerus and source_f == (set(), ['n']) and translation_f == (set(), []) and translation.find('%') == -1:
# Allow numerus translations to omit %n specifier (usually when it only has one possible value)
return True
errors.append("Mismatch between '%s' and '%s'" % (sanitize_string(source), sanitize_string(translation)))
return False
return True
def all_ts_files(suffix=''):
for filename in os.listdir(LOCALE_DIR):
# process only language files, and do not process source language
if not filename.endswith('.ts'+suffix) or filename == SOURCE_LANG+suffix:
continue
if suffix: # remove provided suffix
filename = filename[0:-len(suffix)]
filepath = os.path.join(LOCALE_DIR, filename)
yield(filename, filepath)
FIX_RE = re.compile(b'[\x00-\x09\x0b\x0c\x0e-\x1f]')
def remove_invalid_characters(s):
'''Remove invalid characters from translation string'''
return FIX_RE.sub(b'', s)
# Override cdata escape function to make our output match Qt's (optional, just for cleaner diffs for
# comparison, disable by default)
_orig_escape_cdata = None
def escape_cdata(text):
text = _orig_escape_cdata(text)
text = text.replace("'", ''')
text = text.replace('"', '"')
return text
def postprocess_translations(reduce_diff_hacks=False):
print('Checking and postprocessing...')
if reduce_diff_hacks:
global _orig_escape_cdata
_orig_escape_cdata = ET._escape_cdata
ET._escape_cdata = escape_cdata
for (filename,filepath) in all_ts_files():
os.rename(filepath, filepath+'.orig')
have_errors = False
for (filename,filepath) in all_ts_files('.orig'):
# pre-fixups to cope with transifex output
parser = ET.XMLParser(encoding='utf-8') # need to override encoding because 'utf8' is not understood only 'utf-8'
with open(filepath + '.orig', 'rb') as f:
data = f.read()
# remove control characters; this must be done over the entire file otherwise the XML parser will fail
data = remove_invalid_characters(data)
tree = ET.parse(io.BytesIO(data), parser=parser)
# iterate over all messages in file
root = tree.getroot()
for context in root.findall('context'):
for message in context.findall('message'):
numerus = message.get('numerus') == 'yes'
source = message.find('source').text
translation_node = message.find('translation')
# pick all numerusforms
if numerus:
translations = [i.text for i in translation_node.findall('numerusform')]
else:
translations = [translation_node.text]
for translation in translations:
if translation is None:
continue
errors = []
valid = check_format_specifiers(source, translation, errors, numerus)
for error in errors:
print('%s: %s' % (filename, error))
if not valid: # set type to unfinished and clear string if invalid
translation_node.clear()
translation_node.set('type', 'unfinished')
have_errors = True
# Remove location tags
for location in message.findall('location'):
message.remove(location)
# Remove entire message if it is an unfinished translation
if translation_node.get('type') == 'unfinished':
context.remove(message)
# check if document is (virtually) empty, and remove it if so
num_messages = 0
for context in root.findall('context'):
for message in context.findall('message'):
num_messages += 1
if num_messages < MIN_NUM_MESSAGES:
print('Removing %s, as it contains only %i messages' % (filepath, num_messages))
continue
# write fixed-up tree
# if diff reduction requested, replace some XML to 'sanitize' to qt formatting
if reduce_diff_hacks:
out = io.BytesIO()
tree.write(out, encoding='utf-8')
out = out.getvalue()
out = out.replace(b' />', b'/>')
with open(filepath, 'wb') as f:
f.write(out)
else:
tree.write(filepath, encoding='utf-8')
return have_errors
if __name__ == '__main__':
check_at_repository_root()
fetch_all_translations()
postprocess_translations()
|
CrimsonDev14/crimsoncoin
|
contrib/devtools/update-translations.py
|
Python
|
lgpl-3.0
| 8,075
|
#
# Copyright (c) 2006 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/licenses/cpl.php.
#
# This program is distributed in the hope that it will be useful, but
# without any waranty; without even the implied warranty of merchantability
# or fitness for a particular purpose. See the Common Public License for
# full details.
#
import socket
import smtplib
import dns.resolver
from email import MIMEText
from nagpy.errors import MailError
def digMX(hostname):
try:
answers = dns.resolver.query(hostname, 'MX')
except dns.resolver.NoAnswer:
return None
return answers
def sendMailWithChecks(fromEmail, fromEmailName, toEmail, subject, body):
validateEmailDomain(toEmail)
try:
sendMail(fromEmail, fromEmailName, toEmail, subject, body)
except smtplib.SMTPRecipientsRefused:
raise MailError("Email could not be sent: Recipient refused by server.")
def validateEmailDomain(toEmail):
toDomain = smtplib.quoteaddr(toEmail).split('@')[-1][0:-1]
VALIDATED_DOMAINS = ('localhost', 'localhost.localdomain')
# basically if we don't implicitly know this domain,
# and we can't look up the DNS entry of the MX
# use gethostbyname to validate the email address
try:
if not ((toDomain in VALIDATED_DOMAINS) or digMX(toDomain)):
socket.gethostbyname(toDomain)
except (socket.gaierror, dns.resolver.NXDOMAIN):
raise MailError("Email could not be sent: Bad domain name.")
def sendMail(fromEmail, fromEmailName, toEmail, subject, body):
msg = MIMEText.MIMEText(str(body))
msg['Subject'] = subject
msg['From'] = '"%s" <%s>' % (fromEmailName, fromEmail)
msg['To'] = toEmail
s = smtplib.SMTP()
s.connect()
s.sendmail(fromEmail, [toEmail], msg.as_string())
s.close()
|
abelboldu/nagpy-pushover
|
nagpy/util/mail.py
|
Python
|
epl-1.0
| 2,039
|
import gettext as gettext_module
import importlib
import json
import os
from django import http
from django.apps import apps
from django.conf import settings
from django.template import Context, Engine
from django.utils import six
from django.utils._os import upath
from django.utils.encoding import smart_text
from django.utils.formats import get_format, get_format_modules
from django.utils.http import is_safe_url
from django.utils.translation import (
LANGUAGE_SESSION_KEY, check_for_language, get_language, to_locale,
)
def set_language(request):
"""
Redirect to a given url while setting the chosen language in the
session or cookie. The url and the language code need to be
specified in the request parameters.
Since this view changes how the user will see the rest of the site, it must
only be accessed as a POST request. If called as a GET request, it will
redirect to the page in the request (the 'next' parameter) without changing
any state.
"""
next = request.POST.get('next', request.GET.get('next'))
if not is_safe_url(url=next, host=request.get_host()):
next = request.META.get('HTTP_REFERER')
if not is_safe_url(url=next, host=request.get_host()):
next = '/'
response = http.HttpResponseRedirect(next)
if request.method == 'POST':
lang_code = request.POST.get('language', None)
if lang_code and check_for_language(lang_code):
if hasattr(request, 'session'):
request.session[LANGUAGE_SESSION_KEY] = lang_code
else:
response.set_cookie(settings.LANGUAGE_COOKIE_NAME, lang_code,
max_age=settings.LANGUAGE_COOKIE_AGE,
path=settings.LANGUAGE_COOKIE_PATH,
domain=settings.LANGUAGE_COOKIE_DOMAIN)
return response
def get_formats():
"""
Returns all formats strings required for i18n to work
"""
FORMAT_SETTINGS = (
'DATE_FORMAT', 'DATETIME_FORMAT', 'TIME_FORMAT',
'YEAR_MONTH_FORMAT', 'MONTH_DAY_FORMAT', 'SHORT_DATE_FORMAT',
'SHORT_DATETIME_FORMAT', 'FIRST_DAY_OF_WEEK', 'DECIMAL_SEPARATOR',
'THOUSAND_SEPARATOR', 'NUMBER_GROUPING',
'DATE_INPUT_FORMATS', 'TIME_INPUT_FORMATS', 'DATETIME_INPUT_FORMATS'
)
result = {}
for module in [settings] + get_format_modules(reverse=True):
for attr in FORMAT_SETTINGS:
result[attr] = get_format(attr)
formats = {}
for k, v in result.items():
if isinstance(v, (six.string_types, int)):
formats[k] = smart_text(v)
elif isinstance(v, (tuple, list)):
formats[k] = [smart_text(value) for value in v]
return formats
js_catalog_template = r"""
{% autoescape off %}
(function (globals) {
var django = globals.django || (globals.django = {});
{% if plural %}
django.pluralidx = function (n) {
var v={{ plural }};
if (typeof(v) == 'boolean') {
return v ? 1 : 0;
} else {
return v;
}
};
{% else %}
django.pluralidx = function (count) { return (count == 1) ? 0 : 1; };
{% endif %}
{% if catalog_str %}
/* gettext library */
django.catalog = {{ catalog_str }};
django.gettext = function (msgid) {
var value = django.catalog[msgid];
if (typeof(value) == 'undefined') {
return msgid;
} else {
return (typeof(value) == 'string') ? value : value[0];
}
};
django.ngettext = function (singular, plural, count) {
var value = django.catalog[singular];
if (typeof(value) == 'undefined') {
return (count == 1) ? singular : plural;
} else {
return value[django.pluralidx(count)];
}
};
django.gettext_noop = function (msgid) { return msgid; };
django.pgettext = function (context, msgid) {
var value = django.gettext(context + '\x04' + msgid);
if (value.indexOf('\x04') != -1) {
value = msgid;
}
return value;
};
django.npgettext = function (context, singular, plural, count) {
var value = django.ngettext(context + '\x04' + singular, context + '\x04' + plural, count);
if (value.indexOf('\x04') != -1) {
value = django.ngettext(singular, plural, count);
}
return value;
};
{% else %}
/* gettext identity library */
django.gettext = function (msgid) { return msgid; };
django.ngettext = function (singular, plural, count) { return (count == 1) ? singular : plural; };
django.gettext_noop = function (msgid) { return msgid; };
django.pgettext = function (context, msgid) { return msgid; };
django.npgettext = function (context, singular, plural, count) { return (count == 1) ? singular : plural; };
{% endif %}
django.interpolate = function (fmt, obj, named) {
if (named) {
return fmt.replace(/%\(\w+\)s/g, function(match){return String(obj[match.slice(2,-2)])});
} else {
return fmt.replace(/%s/g, function(match){return String(obj.shift())});
}
};
/* formatting library */
django.formats = {{ formats_str }};
django.get_format = function (format_type) {
var value = django.formats[format_type];
if (typeof(value) == 'undefined') {
return format_type;
} else {
return value;
}
};
/* add to global namespace */
globals.pluralidx = django.pluralidx;
globals.gettext = django.gettext;
globals.ngettext = django.ngettext;
globals.gettext_noop = django.gettext_noop;
globals.pgettext = django.pgettext;
globals.npgettext = django.npgettext;
globals.interpolate = django.interpolate;
globals.get_format = django.get_format;
}(this));
{% endautoescape %}
"""
def render_javascript_catalog(catalog=None, plural=None):
template = Engine().from_string(js_catalog_template)
indent = lambda s: s.replace('\n', '\n ')
context = Context({
'catalog_str': indent(json.dumps(
catalog, sort_keys=True, indent=2)) if catalog else None,
'formats_str': indent(json.dumps(
get_formats(), sort_keys=True, indent=2)),
'plural': plural,
})
return http.HttpResponse(template.render(context), 'text/javascript')
def get_javascript_catalog(locale, domain, packages):
default_locale = to_locale(settings.LANGUAGE_CODE)
app_configs = apps.get_app_configs()
allowable_packages = set(app_config.name for app_config in app_configs)
allowable_packages.add('django.conf')
packages = [p for p in packages if p in allowable_packages]
t = {}
paths = []
en_selected = locale.startswith('en')
en_catalog_missing = True
# paths of requested packages
for package in packages:
p = importlib.import_module(package)
path = os.path.join(os.path.dirname(upath(p.__file__)), 'locale')
paths.append(path)
# add the filesystem paths listed in the LOCALE_PATHS setting
paths.extend(list(reversed(settings.LOCALE_PATHS)))
# first load all english languages files for defaults
for path in paths:
try:
catalog = gettext_module.translation(domain, path, ['en'])
t.update(catalog._catalog)
except IOError:
pass
else:
# 'en' is the selected language and at least one of the packages
# listed in `packages` has an 'en' catalog
if en_selected:
en_catalog_missing = False
# next load the settings.LANGUAGE_CODE translations if it isn't english
if default_locale != 'en':
for path in paths:
try:
catalog = gettext_module.translation(domain, path, [default_locale])
except IOError:
catalog = None
if catalog is not None:
t.update(catalog._catalog)
# last load the currently selected language, if it isn't identical to the default.
if locale != default_locale:
# If the currently selected language is English but it doesn't have a
# translation catalog (presumably due to being the language translated
# from) then a wrong language catalog might have been loaded in the
# previous step. It needs to be discarded.
if en_selected and en_catalog_missing:
t = {}
else:
locale_t = {}
for path in paths:
try:
catalog = gettext_module.translation(domain, path, [locale])
except IOError:
catalog = None
if catalog is not None:
locale_t.update(catalog._catalog)
if locale_t:
t = locale_t
plural = None
if '' in t:
for l in t[''].split('\n'):
if l.startswith('Plural-Forms:'):
plural = l.split(':', 1)[1].strip()
if plural is not None:
# this should actually be a compiled function of a typical plural-form:
# Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 :
# n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;
plural = [el.strip() for el in plural.split(';') if el.strip().startswith('plural=')][0].split('=', 1)[1]
pdict = {}
maxcnts = {}
catalog = {}
for k, v in t.items():
if k == '':
continue
if isinstance(k, six.string_types):
catalog[k] = v
elif isinstance(k, tuple):
msgid = k[0]
cnt = k[1]
maxcnts[msgid] = max(cnt, maxcnts.get(msgid, 0))
pdict.setdefault(msgid, {})[cnt] = v
else:
raise TypeError(k)
for k, v in pdict.items():
catalog[k] = [v.get(i, '') for i in range(maxcnts[msgid] + 1)]
return catalog, plural
def null_javascript_catalog(request, domain=None, packages=None):
"""
Returns "identity" versions of the JavaScript i18n functions -- i.e.,
versions that don't actually do anything.
"""
return render_javascript_catalog()
def javascript_catalog(request, domain='djangojs', packages=None):
"""
Returns the selected language catalog as a javascript library.
Receives the list of packages to check for translations in the
packages parameter either from an infodict or as a +-delimited
string from the request. Default is 'django.conf'.
Additionally you can override the gettext domain for this view,
but usually you don't want to do that, as JavaScript messages
go to the djangojs domain. But this might be needed if you
deliver your JavaScript source from Django templates.
"""
locale = to_locale(get_language())
if request.GET and 'language' in request.GET:
if check_for_language(request.GET['language']):
locale = to_locale(request.GET['language'])
if packages is None:
packages = ['django.conf']
if isinstance(packages, six.string_types):
packages = packages.split('+')
catalog, plural = get_javascript_catalog(locale, domain, packages)
return render_javascript_catalog(catalog, plural)
|
diego-d5000/MisValesMd
|
env/lib/python2.7/site-packages/django/views/i18n.py
|
Python
|
mit
| 11,359
|
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Payment.payment_state'
db.add_column(u'payment_payment', 'payment_state',
self.gf('django.db.models.fields.SmallIntegerField')(default=1),
keep_default=False)
def backwards(self, orm):
# Deleting field 'Payment.payment_state'
db.delete_column(u'payment_payment', 'payment_state')
models = {
'build.contract': {
'Meta': {'object_name': 'Contract'},
'area': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'area_cmp': ('django.db.models.fields.IntegerField', [], {'default': '1', 'null': 'True', 'blank': 'True'}),
'budget': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True'}),
'clinic': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'creation_form': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
'date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
'developer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Developer']", 'null': 'True', 'blank': 'True'}),
'docs': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['build.ContractDocuments']", 'null': 'True', 'blank': 'True'}),
'driveways': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'electric_supply': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'entrance_door': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
'finish_year': ('django.db.models.fields.DateField', [], {'default': 'datetime.datetime(2018, 12, 31, 0, 0)'}),
'flats_amount': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'floors': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'gas_supply': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True', 'blank': 'True'}),
'hallway': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['core.Hallway']", 'null': 'True', 'blank': 'True'}),
'has_trouble_docs': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'heating': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'hot_water_supply': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'internal_doors': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
'is_balcony': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'is_clother_drying': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'is_dustbin_area': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'is_heat_boiler': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'is_intercom': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'is_loggia': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'is_parking': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'is_playground': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'is_routes': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'is_water_boiler': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'kindergarden': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'kitchen': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['core.Kitchen']", 'null': 'True', 'blank': 'True'}),
'market': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'mo': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['mo.MO']"}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}),
'num': ('django.db.models.fields.CharField', [], {'max_length': '2048'}),
'period_of_payment': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}),
'public_transport': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'room': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['core.Room']", 'null': 'True', 'blank': 'True'}),
'school': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'start_year': ('django.db.models.fields.DateField', [], {'default': 'datetime.datetime(2013, 1, 1, 0, 0)'}),
'summ_mo_money': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'summ_without_mo_money': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'summa': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'summa_fed': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'summa_reg': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'water_removal': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'water_settlement': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
'wc': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['core.WC']", 'null': 'True', 'blank': 'True'}),
'window_constructions': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'})
},
'build.contractdocuments': {
'Meta': {'object_name': 'ContractDocuments'},
'acceptance_acts': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'approval_citizen_statement': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'building_permissions': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'cost_infos': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'facility_permission': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'hiring_contract': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'land_right_stating': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'mo_certificate': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'mo_notice_to_citizen': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'mun_act_to_fond': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'mun_contracts': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'photos': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'protocols': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'tec_passport_tec_plan': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'transmission_acts': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'})
},
'core.basehallway': {
'Meta': {'object_name': 'BaseHallway'},
'ceiling_hook': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'heaters': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'lamp': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'smoke_filter': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'sockets': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'switches': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'})
},
'core.basekitchen': {
'Meta': {'object_name': 'BaseKitchen'},
'ceiling_hook': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'heaters': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'lamp': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'sink_with_mixer': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True', 'blank': 'True'}),
'smoke_filter': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'sockets': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'switches': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'})
},
'core.baseroom': {
'Meta': {'object_name': 'BaseRoom'},
'ceiling_hook': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'heaters': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'lamp': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'smoke_filter': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'sockets': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'switches': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'})
},
'core.basewc': {
'Meta': {'object_name': 'BaseWC'},
'bath_with_mixer': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True', 'blank': 'True'}),
'ceiling_hook': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'heaters': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_toilet': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'is_tower_dryer': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'lamp': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'sink_with_mixer': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True', 'blank': 'True'}),
'smoke_filter': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'sockets': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'switches': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'wc_switches': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'})
},
'core.developer': {
'Meta': {'object_name': 'Developer'},
'address': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}),
'boss_position': ('django.db.models.fields.CharField', [], {'max_length': '2048'}),
'face_list': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}),
'phone': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'})
},
u'core.hallway': {
'Meta': {'object_name': 'Hallway', '_ormbases': ['core.BaseHallway']},
u'basehallway_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['core.BaseHallway']", 'unique': 'True', 'primary_key': 'True'}),
'ceiling': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
'floor': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
'wall': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'})
},
u'core.kitchen': {
'Meta': {'object_name': 'Kitchen', '_ormbases': ['core.BaseKitchen']},
u'basekitchen_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['core.BaseKitchen']", 'unique': 'True', 'primary_key': 'True'}),
'ceiling': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
'floor': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
'stove': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
'wall': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'})
},
u'core.room': {
'Meta': {'object_name': 'Room', '_ormbases': ['core.BaseRoom']},
u'baseroom_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['core.BaseRoom']", 'unique': 'True', 'primary_key': 'True'}),
'ceiling': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
'floor': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
'wall': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'})
},
u'core.wc': {
'Meta': {'object_name': 'WC', '_ormbases': ['core.BaseWC']},
u'basewc_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['core.BaseWC']", 'unique': 'True', 'primary_key': 'True'}),
'ceiling': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
'floor': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
'separate': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
'wall': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
'wc_ceiling': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
'wc_floor': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
'wc_wall': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'})
},
'mo.federalbudget': {
'Meta': {'object_name': 'FederalBudget'},
'adm_coef': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'sub_orph_home': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'sub_sum': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'subvention_performance': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'})
},
'mo.mo': {
'Meta': {'object_name': 'MO'},
'common_amount': ('django.db.models.fields.FloatField', [], {'default': '0', 'null': 'True', 'blank': 'True'}),
'common_economy': ('django.db.models.fields.FloatField', [], {'default': '0', 'null': 'True', 'blank': 'True'}),
'common_percentage': ('django.db.models.fields.FloatField', [], {'default': '0', 'null': 'True', 'blank': 'True'}),
'common_spent': ('django.db.models.fields.FloatField', [], {'default': '0', 'null': 'True', 'blank': 'True'}),
'creation_form': ('django.db.models.fields.CommaSeparatedIntegerField', [], {'max_length': '24', 'null': 'True', 'blank': 'True'}),
'flats_amount': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True', 'blank': 'True'}),
'has_trouble': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'home_orphans': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '2048'})
},
'mo.regionalbudget': {
'Meta': {'object_name': 'RegionalBudget'},
'adm_coef': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'sub_orph_home': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'sub_sum': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'subvention_performance': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'})
},
'mo.subvention': {
'Meta': {'object_name': 'Subvention'},
'amount': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'date': ('django.db.models.fields.DateField', [], {'auto_now': 'True', 'blank': 'True'}),
'fed_budget': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['mo.FederalBudget']", 'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'reg_budget': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['mo.RegionalBudget']", 'null': 'True', 'blank': 'True'})
},
'payment.payment': {
'Meta': {'object_name': 'Payment'},
'amount': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'approve_status': ('django.db.models.fields.IntegerField', [], {'default': '2'}),
'contract': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['build.Contract']"}),
'date': ('django.db.models.fields.DateField', [], {'db_index': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'num': ('django.db.models.fields.CharField', [], {'max_length': '2048'}),
'pay_order': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'payment_state': ('django.db.models.fields.SmallIntegerField', [], {'default': '1'}),
'subvention': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['mo.Subvention']"})
}
}
complete_apps = ['payment']
|
zionist/mon
|
mon/apps/payment/migrations/0004_auto__add_field_payment_payment_state.py
|
Python
|
bsd-3-clause
| 20,627
|
#
# Copyright (C) 2012-2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties 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. Any Red Hat trademarks that are incorporated in the
# source code or documentation are not subject to the GNU General Public
# License and may only be used or replicated with the express permission of
# Red Hat, Inc.
#
"""
This module include functions and classes for dealing with multiple layouts in
Anaconda. It wraps the libxklavier functionality to protect Anaconda from
dealing with its "nice" API that looks like a Lisp-influenced "good old C" and
also systemd-localed functionality.
It provides a XklWrapper class with several methods that can be used for listing
and various modifications of keyboard layouts settings.
"""
import gi
gi.require_version("GdkX11", "3.0")
gi.require_version("Xkl", "1.0")
from gi.repository import GdkX11, Xkl
import threading
import gettext
from collections import namedtuple
from pyanaconda import flags
from pyanaconda.core import util
from pyanaconda.core.constants import DEFAULT_KEYBOARD
from pyanaconda.keyboard import join_layout_variant, parse_layout_variant, KeyboardConfigError, InvalidLayoutVariantSpec
from pyanaconda.core.async_utils import async_action_wait
from pyanaconda.anaconda_loggers import get_module_logger
log = get_module_logger(__name__)
Xkb_ = lambda x: gettext.translation("xkeyboard-config", fallback=True).gettext(x)
iso_ = lambda x: gettext.translation("iso_639", fallback=True).gettext(x)
# namedtuple for information about a keyboard layout (its language and description)
LayoutInfo = namedtuple("LayoutInfo", ["lang", "desc"])
class XklWrapperError(KeyboardConfigError):
"""Exception class for reporting libxklavier-related problems"""
pass
class XklWrapper(object):
"""
Class wrapping the libxklavier functionality
Use this class as a singleton class because it provides read-only data
and initialization (that takes quite a lot of time) reads always the
same data. It doesn't have sense to make multiple instances
"""
_instance = None
_instance_lock = threading.Lock()
@staticmethod
def get_instance():
with XklWrapper._instance_lock:
if not XklWrapper._instance:
XklWrapper._instance = XklWrapper()
return XklWrapper._instance
def __init__(self):
#initialize Xkl-related stuff
display = GdkX11.x11_get_default_xdisplay()
self._engine = Xkl.Engine.get_instance(display)
self._rec = Xkl.ConfigRec()
if not self._rec.get_from_server(self._engine):
raise XklWrapperError("Failed to get configuration from server")
#X is probably initialized to the 'us' layout without any variant and
#since we want to add layouts with variants we need the layouts and
#variants lists to have the same length. Add "" padding to variants.
#See docstring of the add_layout method for details.
diff = len(self._rec.layouts) - len(self._rec.variants)
if diff > 0 and flags.can_touch_runtime_system("activate layouts"):
self._rec.set_variants(self._rec.variants + (diff * [""]))
if not self._rec.activate(self._engine):
# failed to activate layouts given e.g. by a kickstart (may be
# invalid)
lay_var_str = ",".join(map(join_layout_variant,
self._rec.layouts,
self._rec.variants))
log.error("Failed to activate layouts: '%s', "
"falling back to default %s", lay_var_str, DEFAULT_KEYBOARD)
self._rec.set_layouts([DEFAULT_KEYBOARD])
self._rec.set_variants([""])
if not self._rec.activate(self._engine):
# failed to activate even the default layout, something is
# really wrong
raise XklWrapperError("Failed to initialize layouts")
#needed also for Gkbd.KeyboardDrawingDialog
self.configreg = Xkl.ConfigRegistry.get_instance(self._engine)
self.configreg.load(False)
self._layout_infos = dict()
self._layout_infos_lock = threading.RLock()
self._switch_opt_infos = dict()
self._switch_opt_infos_lock = threading.RLock()
#this might take quite a long time
self.configreg.foreach_language(self._get_language_variants, None)
self.configreg.foreach_country(self._get_country_variants, None)
#'grp' means that we want layout (group) switching options
self.configreg.foreach_option('grp', self._get_switch_option, None)
def _get_lang_variant(self, c_reg, item, subitem, lang):
if subitem:
name = item.get_name() + " (" + subitem.get_name() + ")"
description = subitem.get_description()
else:
name = item.get_name()
description = item.get_description()
#if this layout has already been added for some other language,
#do not add it again (would result in duplicates in our lists)
if name not in self._layout_infos:
with self._layout_infos_lock:
self._layout_infos[name] = LayoutInfo(lang, description)
def _get_country_variant(self, c_reg, item, subitem, country):
if subitem:
name = item.get_name() + " (" + subitem.get_name() + ")"
description = subitem.get_description()
else:
name = item.get_name()
description = item.get_description()
# if the layout was not added with any language, add it with a country
if name not in self._layout_infos:
with self._layout_infos_lock:
self._layout_infos[name] = LayoutInfo(country, description)
def _get_language_variants(self, c_reg, item, user_data=None):
lang_name, lang_desc = item.get_name(), item.get_description()
c_reg.foreach_language_variant(lang_name, self._get_lang_variant, lang_desc)
def _get_country_variants(self, c_reg, item, user_data=None):
country_name, country_desc = item.get_name(), item.get_description()
c_reg.foreach_country_variant(country_name, self._get_country_variant,
country_desc)
def _get_switch_option(self, c_reg, item, user_data=None):
"""Helper function storing layout switching options in foreach cycle"""
desc = item.get_description()
name = item.get_name()
with self._switch_opt_infos_lock:
self._switch_opt_infos[name] = desc
def get_current_layout(self):
"""
Get current activated X layout and variant
:return: current activated X layout and variant (e.g. "cz (qwerty)")
"""
# ported from the widgets/src/LayoutIndicator.c code
self._engine.start_listen(Xkl.EngineListenModes.TRACK_KEYBOARD_STATE)
state = self._engine.get_current_state()
cur_group = state.group
num_groups = self._engine.get_num_groups()
# BUG?: if the last layout in the list is activated and removed,
# state.group may be equal to n_groups
if cur_group >= num_groups:
cur_group = num_groups - 1
layout = self._rec.layouts[cur_group] # pylint: disable=unsubscriptable-object
try:
variant = self._rec.variants[cur_group] # pylint: disable=unsubscriptable-object
except IndexError:
# X server may have forgotten to add the "" variant for its default layout
variant = ""
self._engine.stop_listen(Xkl.EngineListenModes.TRACK_KEYBOARD_STATE)
return join_layout_variant(layout, variant)
def get_available_layouts(self):
"""A list of layouts"""
with self._layout_infos_lock:
return list(self._layout_infos.keys())
def get_switching_options(self):
"""Method returning list of available layout switching options"""
with self._switch_opt_infos_lock:
return list(self._switch_opt_infos.keys())
def get_layout_variant_description(self, layout_variant, with_lang=True, xlated=True):
"""
Get description of the given layout-variant.
:param layout_variant: layout-variant specification (e.g. 'cz (qwerty)')
:type layout_variant: str
:param with_lang: whether to include language of the layout-variant (if defined)
in the description or not
:type with_lang: bool
:param xlated: whethe to return translated or english version of the description
:type xlated: bool
:return: description of the layout-variant specification (e.g. 'Czech (qwerty)')
:rtype: str
"""
layout_info = self._layout_infos[layout_variant]
# translate language and upcase its first letter, translate the
# layout-variant description
if xlated:
lang = util.upcase_first_letter(iso_(layout_info.lang))
description = Xkb_(layout_info.desc)
else:
lang = util.upcase_first_letter(layout_info.lang)
description = layout_info.desc
if with_lang and lang and not description.startswith(lang):
return "%s (%s)" % (lang, description)
else:
return description
def get_switch_opt_description(self, switch_opt):
"""
Get description of the given layout switching option.
:param switch_opt: switching option name/ID (e.g. 'grp:alt_shift_toggle')
:type switch_opt: str
:return: description of the layout switching option (e.g. 'Alt + Shift')
:rtype: str
"""
# translate the description of the switching option
return Xkb_(self._switch_opt_infos[switch_opt])
@async_action_wait
def activate_default_layout(self):
"""
Activates default layout (the first one in the list of configured
layouts).
"""
self._engine.lock_group(0)
def is_valid_layout(self, layout):
"""Return if given layout is valid layout or not"""
return layout in self._layout_infos
@async_action_wait
def add_layout(self, layout):
"""
Method that tries to add a given layout to the current X configuration.
The X layouts configuration is handled by two lists. A list of layouts
and a list of variants. Index-matching items in these lists (as if they
were zipped) are used for the construction of real layouts (e.g.
'cz (qwerty)').
:param layout: either 'layout' or 'layout (variant)'
:raise XklWrapperError: if the given layout is invalid or cannot be added
"""
try:
#we can get 'layout' or 'layout (variant)'
(layout, variant) = parse_layout_variant(layout)
except InvalidLayoutVariantSpec as ilverr:
raise XklWrapperError("Failed to add layout: %s" % ilverr)
#do not add the same layout-variant combinanion multiple times
if (layout, variant) in list(zip(self._rec.layouts, self._rec.variants)):
return
self._rec.set_layouts(self._rec.layouts + [layout])
self._rec.set_variants(self._rec.variants + [variant])
if not self._rec.activate(self._engine):
raise XklWrapperError("Failed to add layout '%s (%s)'" % (layout,
variant))
@async_action_wait
def remove_layout(self, layout):
"""
Method that tries to remove a given layout from the current X
configuration.
See also the documentation for the add_layout method.
:param layout: either 'layout' or 'layout (variant)'
:raise XklWrapperError: if the given layout cannot be removed
"""
#we can get 'layout' or 'layout (variant)'
(layout, variant) = parse_layout_variant(layout)
layouts_variants = list(zip(self._rec.layouts, self._rec.variants))
if not (layout, variant) in layouts_variants:
msg = "'%s (%s)' not in the list of added layouts" % (layout,
variant)
raise XklWrapperError(msg)
idx = layouts_variants.index((layout, variant))
new_layouts = self._rec.layouts[:idx] + self._rec.layouts[(idx + 1):] # pylint: disable=unsubscriptable-object
new_variants = self._rec.variants[:idx] + self._rec.variants[(idx + 1):] # pylint: disable=unsubscriptable-object
self._rec.set_layouts(new_layouts)
self._rec.set_variants(new_variants)
if not self._rec.activate(self._engine):
raise XklWrapperError("Failed to remove layout '%s (%s)'" % (layout,
variant))
@async_action_wait
def replace_layouts(self, layouts_list):
"""
Method that replaces the layouts defined in the current X configuration
with the new ones given.
:param layouts_list: list of layouts defined as either 'layout' or
'layout (variant)'
:raise XklWrapperError: if layouts cannot be replaced with the new ones
"""
new_layouts = list()
new_variants = list()
for layout_variant in layouts_list:
(layout, variant) = parse_layout_variant(layout_variant)
new_layouts.append(layout)
new_variants.append(variant)
self._rec.set_layouts(new_layouts)
self._rec.set_variants(new_variants)
if not self._rec.activate(self._engine):
msg = "Failed to replace layouts with: %s" % ",".join(layouts_list)
raise XklWrapperError(msg)
@async_action_wait
def set_switching_options(self, options):
"""
Method that sets options for layout switching. It replaces the old
options with the new ones.
:param options: layout switching options to be set
:type options: list or generator
:raise XklWrapperError: if the old options cannot be replaced with the
new ones
"""
#preserve old "non-switching options"
new_options = [opt for opt in self._rec.options if "grp:" not in opt] # pylint: disable=not-an-iterable
new_options += options
self._rec.set_options(new_options)
if not self._rec.activate(self._engine):
msg = "Failed to set switching options to: %s" % ",".join(options)
raise XklWrapperError(msg)
|
vathpela/anaconda
|
pyanaconda/ui/gui/xkl_wrapper.py
|
Python
|
gpl-2.0
| 15,362
|
"""
==============
Non-linear SVM
==============
Perform binary classification using non-linear SVC
with RBF kernel. The target to predict is a XOR of the
inputs.
The color map illustrates the decision function learned by the SVC.
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from sklearn import svm
xx, yy = np.meshgrid(np.linspace(-3, 3, 500),
np.linspace(-3, 3, 500))
np.random.seed(0)
X = np.random.randn(300, 2)
Y = np.logical_xor(X[:, 0] > 0, X[:, 1] > 0)
# fit the model
clf = svm.NuSVC(gamma='auto')
clf.fit(X, Y)
# plot the decision function for each datapoint on the grid
Z = clf.decision_function(np.c_[xx.ravel(), yy.ravel()])
Z = Z.reshape(xx.shape)
plt.imshow(Z, interpolation='nearest',
extent=(xx.min(), xx.max(), yy.min(), yy.max()), aspect='auto',
origin='lower', cmap=plt.cm.PuOr_r)
contours = plt.contour(xx, yy, Z, levels=[0], linewidths=2,
linestyles='dashed')
plt.scatter(X[:, 0], X[:, 1], s=30, c=Y, cmap=plt.cm.Paired,
edgecolors='k')
plt.xticks(())
plt.yticks(())
plt.axis([-3, 3, -3, 3])
plt.show()
|
glemaitre/scikit-learn
|
examples/svm/plot_svm_nonlinear.py
|
Python
|
bsd-3-clause
| 1,136
|
'''
New Integration Test for resizing root volume.
@author: czhou25
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpecker.operations.volume_operations as vol_ops
import zstackwoodpecker.zstack_test.zstack_test_vm as test_vm_header
import time
import os
vm = None
test_stub = test_lib.lib_get_test_stub()
test_obj_dict = test_state.TestStateDict()
def test():
global vm
vm_creation_option = test_util.VmOption()
image_name = os.environ.get('imageName_net')
l3_name = os.environ.get('l3VlanNetworkName1')
vm = test_stub.create_vm("test_resize_vm", image_name, l3_name)
test_obj_dict.add_vm(vm)
vm.check()
vm.stop()
vm.check()
vol_size = test_lib.lib_get_root_volume(vm.get_vm()).size
volume_uuid = test_lib.lib_get_root_volume(vm.get_vm()).uuid
set_size = 1024*1024*1024*5
snapshots = test_obj_dict.get_volume_snapshot(volume_uuid)
snapshots.set_utility_vm(vm)
snapshots.create_snapshot('create_snapshot1')
snapshots.check()
vol_ops.resize_volume(volume_uuid, set_size)
vm.update()
vol_size_after = test_lib.lib_get_root_volume(vm.get_vm()).size
if set_size != vol_size_after:
test_util.test_fail('Resize Root Volume failed, size = %s' % vol_size_after)
snapshots.delete()
test_obj_dict.rm_volume_snapshot(snapshots)
test_lib.lib_error_cleanup(test_obj_dict)
test_util.test_pass('Resize VM Snapshot Test Success')
#Will be called only if exception happens in test().
def error_cleanup():
test_lib.lib_error_cleanup(test_obj_dict)
|
zstackorg/zstack-woodpecker
|
integrationtest/vm/multihosts/volumes/test_snapshot_resize_vm.py
|
Python
|
apache-2.0
| 1,782
|
# Xlib.protocol.__init__ -- glue for Xlib.protocol package
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# 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.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
__all__ = [
'display',
'event',
'request',
'rq',
'structs',
]
|
cristian99garcia/xjoy
|
xevents/Xlib/protocol/__init__.py
|
Python
|
gpl-3.0
| 951
|
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.csma', cpp_namespace='::ns3')
return root_module
def register_types(module):
root_module = module.get_root()
## queue-size.h (module 'network'): ns3::QueueSizeUnit [enumeration]
module.add_enum('QueueSizeUnit', ['PACKETS', 'BYTES'], import_from_module='ns.network')
## log.h (module 'core'): ns3::LogLevel [enumeration]
module.add_enum('LogLevel', ['LOG_NONE', 'LOG_ERROR', 'LOG_LEVEL_ERROR', 'LOG_WARN', 'LOG_LEVEL_WARN', 'LOG_DEBUG', 'LOG_LEVEL_DEBUG', 'LOG_INFO', 'LOG_LEVEL_INFO', 'LOG_FUNCTION', 'LOG_LEVEL_FUNCTION', 'LOG_LOGIC', 'LOG_LEVEL_LOGIC', 'LOG_ALL', 'LOG_LEVEL_ALL', 'LOG_PREFIX_FUNC', 'LOG_PREFIX_TIME', 'LOG_PREFIX_NODE', 'LOG_PREFIX_LEVEL', 'LOG_PREFIX_ALL'], import_from_module='ns.core')
## csma-channel.h (module 'csma'): ns3::WireState [enumeration]
module.add_enum('WireState', ['IDLE', 'TRANSMITTING', 'PROPAGATING'])
## 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')
## trace-helper.h (module 'network'): ns3::AsciiTraceHelper [class]
module.add_class('AsciiTraceHelper', import_from_module='ns.network')
## trace-helper.h (module 'network'): ns3::AsciiTraceHelperForDevice [class]
module.add_class('AsciiTraceHelperForDevice', import_from_module='ns.network', allow_subclassing=True)
## 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('std::list< ns3::AttributeConstructionList::Item > const_iterator', 'ns3::AttributeConstructionList::CIterator')
typehandlers.add_type_alias('std::list< ns3::AttributeConstructionList::Item > const_iterator*', 'ns3::AttributeConstructionList::CIterator*')
typehandlers.add_type_alias('std::list< ns3::AttributeConstructionList::Item > const_iterator&', 'ns3::AttributeConstructionList::CIterator&')
## backoff.h (module 'csma'): ns3::Backoff [class]
module.add_class('Backoff')
## 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')
## csma-channel.h (module 'csma'): ns3::CsmaDeviceRec [class]
module.add_class('CsmaDeviceRec')
## data-rate.h (module 'network'): ns3::DataRate [class]
module.add_class('DataRate', import_from_module='ns.network')
## 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::OutputStreamWrapper> [struct]
module.add_class('DefaultDeleter', import_from_module='ns.core', template_parameters=['ns3::OutputStreamWrapper'])
## 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::QueueItem> [struct]
module.add_class('DefaultDeleter', import_from_module='ns.core', template_parameters=['ns3::QueueItem'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::TraceSourceAccessor> [struct]
module.add_class('DefaultDeleter', import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor'])
## 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')
## 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-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')
## log.h (module 'core'): ns3::LogComponent [class]
module.add_class('LogComponent', import_from_module='ns.core')
typehandlers.add_type_alias('std::map< std::string, ns3::LogComponent * >', 'ns3::LogComponent::ComponentList')
typehandlers.add_type_alias('std::map< std::string, ns3::LogComponent * >*', 'ns3::LogComponent::ComponentList*')
typehandlers.add_type_alias('std::map< std::string, ns3::LogComponent * >&', 'ns3::LogComponent::ComponentList&')
## mac48-address.h (module 'network'): ns3::Mac48Address [class]
module.add_class('Mac48Address', import_from_module='ns.network')
typehandlers.add_type_alias('void ( * ) ( ns3::Mac48Address )', 'ns3::Mac48Address::TracedCallback')
typehandlers.add_type_alias('void ( * ) ( ns3::Mac48Address )*', 'ns3::Mac48Address::TracedCallback*')
typehandlers.add_type_alias('void ( * ) ( ns3::Mac48Address )&', 'ns3::Mac48Address::TracedCallback&')
## mac48-address.h (module 'network'): ns3::Mac48Address [class]
root_module['ns3::Mac48Address'].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('std::vector< ns3::Ptr< ns3::NetDevice > > const_iterator', 'ns3::NetDeviceContainer::Iterator')
typehandlers.add_type_alias('std::vector< ns3::Ptr< ns3::NetDevice > > const_iterator*', 'ns3::NetDeviceContainer::Iterator*')
typehandlers.add_type_alias('std::vector< ns3::Ptr< ns3::NetDevice > > const_iterator&', 'ns3::NetDeviceContainer::Iterator&')
## node-container.h (module 'network'): ns3::NodeContainer [class]
module.add_class('NodeContainer', import_from_module='ns.network')
typehandlers.add_type_alias('std::vector< ns3::Ptr< ns3::Node > > const_iterator', 'ns3::NodeContainer::Iterator')
typehandlers.add_type_alias('std::vector< ns3::Ptr< ns3::Node > > const_iterator*', 'ns3::NodeContainer::Iterator*')
typehandlers.add_type_alias('std::vector< ns3::Ptr< ns3::Node > > const_iterator&', 'ns3::NodeContainer::Iterator&')
## object-base.h (module 'core'): ns3::ObjectBase [class]
module.add_class('ObjectBase', import_from_module='ns.core', allow_subclassing=True)
## 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'])
## log.h (module 'core'): ns3::ParameterLogger [class]
module.add_class('ParameterLogger', import_from_module='ns.core')
## pcap-file.h (module 'network'): ns3::PcapFile [class]
module.add_class('PcapFile', import_from_module='ns.network')
## trace-helper.h (module 'network'): ns3::PcapHelper [class]
module.add_class('PcapHelper', import_from_module='ns.network')
## trace-helper.h (module 'network'): ns3::PcapHelper::DataLinkType [enumeration]
module.add_enum('DataLinkType', ['DLT_NULL', 'DLT_EN10MB', 'DLT_PPP', 'DLT_RAW', 'DLT_IEEE802_11', 'DLT_LINUX_SLL', 'DLT_PRISM_HEADER', 'DLT_IEEE802_11_RADIO', 'DLT_IEEE802_15_4', 'DLT_NETLINK'], outer_class=root_module['ns3::PcapHelper'], import_from_module='ns.network')
## trace-helper.h (module 'network'): ns3::PcapHelperForDevice [class]
module.add_class('PcapHelperForDevice', import_from_module='ns.network', allow_subclassing=True)
## queue-size.h (module 'network'): ns3::QueueSize [class]
module.add_class('QueueSize', import_from_module='ns.network')
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> [class]
module.add_class('SimpleRefCount', import_from_module='ns.core', memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'), automatic_type_narrowing=True, parent=root_module['ns3::ObjectBase'], template_parameters=['ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'])
## simulator.h (module 'core'): ns3::Simulator [class]
module.add_class('Simulator', import_from_module='ns.core', destructor_visibility='private')
## simulator.h (module 'core'): ns3::Simulator [enumeration]
module.add_enum('', ['NO_CONTEXT'], outer_class=root_module['ns3::Simulator'], import_from_module='ns.core')
## 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')
## traced-value.h (module 'core'): ns3::TracedValue<unsigned int> [class]
module.add_class('TracedValue', import_from_module='ns.core', template_parameters=['unsigned int'])
## 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('uint32_t', 'ns3::TypeId::hash_t')
typehandlers.add_type_alias('uint32_t*', 'ns3::TypeId::hash_t*')
typehandlers.add_type_alias('uint32_t&', 'ns3::TypeId::hash_t&')
## 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'])
## csma-helper.h (module 'csma'): ns3::CsmaHelper [class]
module.add_class('CsmaHelper', parent=[root_module['ns3::PcapHelperForDevice'], root_module['ns3::AsciiTraceHelperForDevice']])
## 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'])
## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper [class]
module.add_class('PcapFileWrapper', import_from_module='ns.network', parent=root_module['ns3::Object'])
## queue.h (module 'network'): ns3::QueueBase [class]
module.add_class('QueueBase', import_from_module='ns.network', parent=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', import_from_module='ns.core', memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'), automatic_type_narrowing=True, parent=root_module['ns3::empty'], template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class]
module.add_class('SimpleRefCount', import_from_module='ns.core', memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'), automatic_type_narrowing=True, parent=root_module['ns3::empty'], template_parameters=['ns3::AttributeChecker', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeChecker>'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > [class]
module.add_class('SimpleRefCount', import_from_module='ns.core', memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'), automatic_type_narrowing=True, parent=root_module['ns3::empty'], template_parameters=['ns3::AttributeValue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeValue>'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > [class]
module.add_class('SimpleRefCount', import_from_module='ns.core', memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'), automatic_type_narrowing=True, parent=root_module['ns3::empty'], template_parameters=['ns3::CallbackImplBase', 'ns3::empty', 'ns3::DefaultDeleter<ns3::CallbackImplBase>'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > [class]
module.add_class('SimpleRefCount', import_from_module='ns.core', memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'), automatic_type_narrowing=True, parent=root_module['ns3::empty'], template_parameters=['ns3::EventImpl', 'ns3::empty', 'ns3::DefaultDeleter<ns3::EventImpl>'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> > [class]
module.add_class('SimpleRefCount', import_from_module='ns.core', memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'), automatic_type_narrowing=True, parent=root_module['ns3::empty'], template_parameters=['ns3::Hash::Implementation', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Hash::Implementation>'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > [class]
module.add_class('SimpleRefCount', import_from_module='ns.core', memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'), automatic_type_narrowing=True, parent=root_module['ns3::empty'], template_parameters=['ns3::NixVector', 'ns3::empty', 'ns3::DefaultDeleter<ns3::NixVector>'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> > [class]
module.add_class('SimpleRefCount', import_from_module='ns.core', memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'), automatic_type_narrowing=True, parent=root_module['ns3::empty'], template_parameters=['ns3::OutputStreamWrapper', 'ns3::empty', 'ns3::DefaultDeleter<ns3::OutputStreamWrapper>'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > [class]
module.add_class('SimpleRefCount', import_from_module='ns.core', memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'), automatic_type_narrowing=True, parent=root_module['ns3::empty'], template_parameters=['ns3::Packet', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Packet>'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> > [class]
module.add_class('SimpleRefCount', import_from_module='ns.core', memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'), automatic_type_narrowing=True, parent=root_module['ns3::empty'], template_parameters=['ns3::QueueItem', 'ns3::empty', 'ns3::DefaultDeleter<ns3::QueueItem>'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class]
module.add_class('SimpleRefCount', import_from_module='ns.core', memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'), automatic_type_narrowing=True, parent=root_module['ns3::empty'], template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'])
## 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('void ( * ) ( ns3::Time )', 'ns3::Time::TracedCallback')
typehandlers.add_type_alias('void ( * ) ( ns3::Time )*', 'ns3::Time::TracedCallback*')
typehandlers.add_type_alias('void ( * ) ( ns3::Time )&', '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'])
## 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', import_from_module='ns.core', automatic_type_narrowing=True, allow_subclassing=False, parent=root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
## attribute.h (module 'core'): ns3::AttributeValue [class]
module.add_class('AttributeValue', import_from_module='ns.core', automatic_type_narrowing=True, allow_subclassing=False, 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'])
## channel.h (module 'network'): ns3::Channel [class]
module.add_class('Channel', import_from_module='ns.network', parent=root_module['ns3::Object'])
## random-variable-stream.h (module 'core'): ns3::ConstantRandomVariable [class]
module.add_class('ConstantRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## csma-channel.h (module 'csma'): ns3::CsmaChannel [class]
module.add_class('CsmaChannel', parent=root_module['ns3::Channel'])
## data-rate.h (module 'network'): ns3::DataRateChecker [class]
module.add_class('DataRateChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## data-rate.h (module 'network'): ns3::DataRateValue [class]
module.add_class('DataRateValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## random-variable-stream.h (module 'core'): ns3::DeterministicRandomVariable [class]
module.add_class('DeterministicRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## 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'])
## error-model.h (module 'network'): ns3::ErrorModel [class]
module.add_class('ErrorModel', import_from_module='ns.network', parent=root_module['ns3::Object'])
## 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-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'])
## 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'])
## error-model.h (module 'network'): ns3::ListErrorModel [class]
module.add_class('ListErrorModel', import_from_module='ns.network', parent=root_module['ns3::ErrorModel'])
## 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'])
## 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('void ( * ) ( )', 'ns3::NetDevice::LinkChangeTracedCallback')
typehandlers.add_type_alias('void ( * ) ( )*', 'ns3::NetDevice::LinkChangeTracedCallback*')
typehandlers.add_type_alias('void ( * ) ( )&', 'ns3::NetDevice::LinkChangeTracedCallback&')
typehandlers.add_type_alias('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 >', 'ns3::NetDevice::ReceiveCallback')
typehandlers.add_type_alias('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 >*', 'ns3::NetDevice::ReceiveCallback*')
typehandlers.add_type_alias('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 >&', 'ns3::NetDevice::ReceiveCallback&')
typehandlers.add_type_alias('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 >', 'ns3::NetDevice::PromiscReceiveCallback')
typehandlers.add_type_alias('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 >*', 'ns3::NetDevice::PromiscReceiveCallback*')
typehandlers.add_type_alias('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 >&', '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('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 >', 'ns3::Node::ProtocolHandler')
typehandlers.add_type_alias('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 >*', 'ns3::Node::ProtocolHandler*')
typehandlers.add_type_alias('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 >&', 'ns3::Node::ProtocolHandler&')
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ns3::Node::DeviceAdditionListener')
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', 'ns3::Node::DeviceAdditionListener*')
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', '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'])
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper [class]
module.add_class('OutputStreamWrapper', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >'])
## 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('void ( * ) ( ns3::Ptr< ns3::Packet const > )', 'ns3::Packet::TracedCallback')
typehandlers.add_type_alias('void ( * ) ( ns3::Ptr< ns3::Packet const > )*', 'ns3::Packet::TracedCallback*')
typehandlers.add_type_alias('void ( * ) ( ns3::Ptr< ns3::Packet const > )&', 'ns3::Packet::TracedCallback&')
typehandlers.add_type_alias('void ( * ) ( ns3::Ptr< ns3::Packet const >, ns3::Address const & )', 'ns3::Packet::AddressTracedCallback')
typehandlers.add_type_alias('void ( * ) ( ns3::Ptr< ns3::Packet const >, ns3::Address const & )*', 'ns3::Packet::AddressTracedCallback*')
typehandlers.add_type_alias('void ( * ) ( ns3::Ptr< ns3::Packet const >, ns3::Address const & )&', 'ns3::Packet::AddressTracedCallback&')
typehandlers.add_type_alias('void ( * ) ( ns3::Ptr< ns3::Packet const > const, ns3::Address const &, ns3::Address const & )', 'ns3::Packet::TwoAddressTracedCallback')
typehandlers.add_type_alias('void ( * ) ( ns3::Ptr< ns3::Packet const > const, ns3::Address const &, ns3::Address const & )*', 'ns3::Packet::TwoAddressTracedCallback*')
typehandlers.add_type_alias('void ( * ) ( ns3::Ptr< ns3::Packet const > const, ns3::Address const &, ns3::Address const & )&', 'ns3::Packet::TwoAddressTracedCallback&')
typehandlers.add_type_alias('void ( * ) ( ns3::Ptr< ns3::Packet const >, ns3::Mac48Address )', 'ns3::Packet::Mac48AddressTracedCallback')
typehandlers.add_type_alias('void ( * ) ( ns3::Ptr< ns3::Packet const >, ns3::Mac48Address )*', 'ns3::Packet::Mac48AddressTracedCallback*')
typehandlers.add_type_alias('void ( * ) ( ns3::Ptr< ns3::Packet const >, ns3::Mac48Address )&', 'ns3::Packet::Mac48AddressTracedCallback&')
typehandlers.add_type_alias('void ( * ) ( uint32_t, uint32_t )', 'ns3::Packet::SizeTracedCallback')
typehandlers.add_type_alias('void ( * ) ( uint32_t, uint32_t )*', 'ns3::Packet::SizeTracedCallback*')
typehandlers.add_type_alias('void ( * ) ( uint32_t, uint32_t )&', 'ns3::Packet::SizeTracedCallback&')
typehandlers.add_type_alias('void ( * ) ( ns3::Ptr< ns3::Packet const >, double )', 'ns3::Packet::SinrTracedCallback')
typehandlers.add_type_alias('void ( * ) ( ns3::Ptr< ns3::Packet const >, double )*', 'ns3::Packet::SinrTracedCallback*')
typehandlers.add_type_alias('void ( * ) ( ns3::Ptr< ns3::Packet const >, double )&', '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'])
## queue.h (module 'network'): ns3::Queue<ns3::Packet> [class]
module.add_class('Queue', import_from_module='ns.network', parent=root_module['ns3::QueueBase'], template_parameters=['ns3::Packet'])
typehandlers.add_type_alias('ns3::Packet', 'ns3::Queue< ns3::Packet > ItemType')
typehandlers.add_type_alias('ns3::Packet*', 'ns3::Queue< ns3::Packet > ItemType*')
typehandlers.add_type_alias('ns3::Packet&', 'ns3::Queue< ns3::Packet > ItemType&')
module.add_typedef(root_module['ns3::Packet'], 'ItemType')
## queue.h (module 'network'): ns3::Queue<ns3::QueueDiscItem> [class]
module.add_class('Queue', import_from_module='ns.network', parent=root_module['ns3::QueueBase'], template_parameters=['ns3::QueueDiscItem'])
typehandlers.add_type_alias('ns3::QueueDiscItem', 'ns3::Queue< ns3::QueueDiscItem > ItemType')
typehandlers.add_type_alias('ns3::QueueDiscItem*', 'ns3::Queue< ns3::QueueDiscItem > ItemType*')
typehandlers.add_type_alias('ns3::QueueDiscItem&', 'ns3::Queue< ns3::QueueDiscItem > ItemType&')
## queue-item.h (module 'network'): ns3::QueueItem [class]
module.add_class('QueueItem', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> >'])
## queue-item.h (module 'network'): ns3::QueueItem::Uint8Values [enumeration]
module.add_enum('Uint8Values', ['IP_DSFIELD'], outer_class=root_module['ns3::QueueItem'], import_from_module='ns.network')
typehandlers.add_type_alias('void ( * ) ( ns3::Ptr< ns3::QueueItem const > )', 'ns3::QueueItem::TracedCallback')
typehandlers.add_type_alias('void ( * ) ( ns3::Ptr< ns3::QueueItem const > )*', 'ns3::QueueItem::TracedCallback*')
typehandlers.add_type_alias('void ( * ) ( ns3::Ptr< ns3::QueueItem const > )&', 'ns3::QueueItem::TracedCallback&')
## queue-size.h (module 'network'): ns3::QueueSizeChecker [class]
module.add_class('QueueSizeChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## queue-size.h (module 'network'): ns3::QueueSizeValue [class]
module.add_class('QueueSizeValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## error-model.h (module 'network'): ns3::RateErrorModel [class]
module.add_class('RateErrorModel', import_from_module='ns.network', parent=root_module['ns3::ErrorModel'])
## error-model.h (module 'network'): ns3::RateErrorModel::ErrorUnit [enumeration]
module.add_enum('ErrorUnit', ['ERROR_UNIT_BIT', 'ERROR_UNIT_BYTE', 'ERROR_UNIT_PACKET'], outer_class=root_module['ns3::RateErrorModel'], import_from_module='ns.network')
## error-model.h (module 'network'): ns3::ReceiveListErrorModel [class]
module.add_class('ReceiveListErrorModel', import_from_module='ns.network', parent=root_module['ns3::ErrorModel'])
## 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'])
## 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'])
## error-model.h (module 'network'): ns3::BinaryErrorModel [class]
module.add_class('BinaryErrorModel', import_from_module='ns.network', parent=root_module['ns3::ErrorModel'])
## error-model.h (module 'network'): ns3::BurstErrorModel [class]
module.add_class('BurstErrorModel', import_from_module='ns.network', parent=root_module['ns3::ErrorModel'])
## 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', parent=root_module['ns3::CallbackImplBase'], template_parameters=['ns3::ObjectBase *', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<const ns3::Packet>, 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', parent=root_module['ns3::CallbackImplBase'], template_parameters=['void', 'ns3::Ptr<const ns3::Packet>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<const ns3::QueueDiscItem>, 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', parent=root_module['ns3::CallbackImplBase'], template_parameters=['void', 'ns3::Ptr<const ns3::QueueDiscItem>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'])
## 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', parent=root_module['ns3::CallbackImplBase'], 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'])
## 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', parent=root_module['ns3::CallbackImplBase'], template_parameters=['void', 'ns3::Ptr<ns3::NetDevice>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'])
## callback.h (module 'core'): ns3::CallbackImpl<void, 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', parent=root_module['ns3::CallbackImplBase'], template_parameters=['void', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'])
## callback.h (module 'core'): ns3::CallbackImpl<void, unsigned int, 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', parent=root_module['ns3::CallbackImplBase'], template_parameters=['void', 'unsigned int', 'unsigned int', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'])
## csma-net-device.h (module 'csma'): ns3::CsmaNetDevice [class]
module.add_class('CsmaNetDevice', parent=root_module['ns3::NetDevice'])
## csma-net-device.h (module 'csma'): ns3::CsmaNetDevice::EncapsulationMode [enumeration]
module.add_enum('EncapsulationMode', ['ILLEGAL', 'DIX', 'LLC'], outer_class=root_module['ns3::CsmaNetDevice'])
## queue-item.h (module 'network'): ns3::QueueDiscItem [class]
module.add_class('QueueDiscItem', import_from_module='ns.network', parent=root_module['ns3::QueueItem'])
module.add_container('std::map< std::string, ns3::LogComponent * >', ('std::string', 'ns3::LogComponent *'), container_type='map')
module.add_container('std::list< unsigned int >', 'unsigned int', container_type='list')
typehandlers.add_type_alias('void ( * ) ( std::ostream & )', 'ns3::TimePrinter')
typehandlers.add_type_alias('void ( * ) ( std::ostream & )*', 'ns3::TimePrinter*')
typehandlers.add_type_alias('void ( * ) ( std::ostream & )&', 'ns3::TimePrinter&')
typehandlers.add_type_alias('void ( * ) ( std::ostream & )', 'ns3::NodePrinter')
typehandlers.add_type_alias('void ( * ) ( std::ostream & )*', 'ns3::NodePrinter*')
typehandlers.add_type_alias('void ( * ) ( std::ostream & )&', 'ns3::NodePrinter&')
## 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('uint32_t ( * ) ( char const *, std::size_t const )', 'ns3::Hash::Hash32Function_ptr')
typehandlers.add_type_alias('uint32_t ( * ) ( char const *, std::size_t const )*', 'ns3::Hash::Hash32Function_ptr*')
typehandlers.add_type_alias('uint32_t ( * ) ( char const *, std::size_t const )&', 'ns3::Hash::Hash32Function_ptr&')
typehandlers.add_type_alias('uint64_t ( * ) ( char const *, std::size_t const )', 'ns3::Hash::Hash64Function_ptr')
typehandlers.add_type_alias('uint64_t ( * ) ( char const *, std::size_t const )*', 'ns3::Hash::Hash64Function_ptr*')
typehandlers.add_type_alias('uint64_t ( * ) ( char const *, std::size_t const )&', '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('void ( * ) ( ns3::Time, ns3::Time )', 'ns3::TracedValueCallback::Time')
typehandlers.add_type_alias('void ( * ) ( ns3::Time, ns3::Time )*', 'ns3::TracedValueCallback::Time*')
typehandlers.add_type_alias('void ( * ) ( ns3::Time, ns3::Time )&', 'ns3::TracedValueCallback::Time&')
typehandlers.add_type_alias('void ( * ) ( bool, bool )', 'ns3::TracedValueCallback::Bool')
typehandlers.add_type_alias('void ( * ) ( bool, bool )*', 'ns3::TracedValueCallback::Bool*')
typehandlers.add_type_alias('void ( * ) ( bool, bool )&', 'ns3::TracedValueCallback::Bool&')
typehandlers.add_type_alias('void ( * ) ( int8_t, int8_t )', 'ns3::TracedValueCallback::Int8')
typehandlers.add_type_alias('void ( * ) ( int8_t, int8_t )*', 'ns3::TracedValueCallback::Int8*')
typehandlers.add_type_alias('void ( * ) ( int8_t, int8_t )&', 'ns3::TracedValueCallback::Int8&')
typehandlers.add_type_alias('void ( * ) ( uint8_t, uint8_t )', 'ns3::TracedValueCallback::Uint8')
typehandlers.add_type_alias('void ( * ) ( uint8_t, uint8_t )*', 'ns3::TracedValueCallback::Uint8*')
typehandlers.add_type_alias('void ( * ) ( uint8_t, uint8_t )&', 'ns3::TracedValueCallback::Uint8&')
typehandlers.add_type_alias('void ( * ) ( int16_t, int16_t )', 'ns3::TracedValueCallback::Int16')
typehandlers.add_type_alias('void ( * ) ( int16_t, int16_t )*', 'ns3::TracedValueCallback::Int16*')
typehandlers.add_type_alias('void ( * ) ( int16_t, int16_t )&', 'ns3::TracedValueCallback::Int16&')
typehandlers.add_type_alias('void ( * ) ( uint16_t, uint16_t )', 'ns3::TracedValueCallback::Uint16')
typehandlers.add_type_alias('void ( * ) ( uint16_t, uint16_t )*', 'ns3::TracedValueCallback::Uint16*')
typehandlers.add_type_alias('void ( * ) ( uint16_t, uint16_t )&', 'ns3::TracedValueCallback::Uint16&')
typehandlers.add_type_alias('void ( * ) ( int32_t, int32_t )', 'ns3::TracedValueCallback::Int32')
typehandlers.add_type_alias('void ( * ) ( int32_t, int32_t )*', 'ns3::TracedValueCallback::Int32*')
typehandlers.add_type_alias('void ( * ) ( int32_t, int32_t )&', 'ns3::TracedValueCallback::Int32&')
typehandlers.add_type_alias('void ( * ) ( uint32_t, uint32_t )', 'ns3::TracedValueCallback::Uint32')
typehandlers.add_type_alias('void ( * ) ( uint32_t, uint32_t )*', 'ns3::TracedValueCallback::Uint32*')
typehandlers.add_type_alias('void ( * ) ( uint32_t, uint32_t )&', 'ns3::TracedValueCallback::Uint32&')
typehandlers.add_type_alias('void ( * ) ( double, double )', 'ns3::TracedValueCallback::Double')
typehandlers.add_type_alias('void ( * ) ( double, double )*', 'ns3::TracedValueCallback::Double*')
typehandlers.add_type_alias('void ( * ) ( double, double )&', 'ns3::TracedValueCallback::Double&')
typehandlers.add_type_alias('void ( * ) ( )', 'ns3::TracedValueCallback::Void')
typehandlers.add_type_alias('void ( * ) ( )*', 'ns3::TracedValueCallback::Void*')
typehandlers.add_type_alias('void ( * ) ( )&', '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_Ns3AsciiTraceHelper_methods(root_module, root_module['ns3::AsciiTraceHelper'])
register_Ns3AsciiTraceHelperForDevice_methods(root_module, root_module['ns3::AsciiTraceHelperForDevice'])
register_Ns3AttributeConstructionList_methods(root_module, root_module['ns3::AttributeConstructionList'])
register_Ns3AttributeConstructionListItem_methods(root_module, root_module['ns3::AttributeConstructionList::Item'])
register_Ns3Backoff_methods(root_module, root_module['ns3::Backoff'])
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_Ns3CsmaDeviceRec_methods(root_module, root_module['ns3::CsmaDeviceRec'])
register_Ns3DataRate_methods(root_module, root_module['ns3::DataRate'])
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__Ns3OutputStreamWrapper_methods(root_module, root_module['ns3::DefaultDeleter< ns3::OutputStreamWrapper >'])
register_Ns3DefaultDeleter__Ns3Packet_methods(root_module, root_module['ns3::DefaultDeleter< ns3::Packet >'])
register_Ns3DefaultDeleter__Ns3QueueItem_methods(root_module, root_module['ns3::DefaultDeleter< ns3::QueueItem >'])
register_Ns3DefaultDeleter__Ns3TraceSourceAccessor_methods(root_module, root_module['ns3::DefaultDeleter< ns3::TraceSourceAccessor >'])
register_Ns3EventId_methods(root_module, root_module['ns3::EventId'])
register_Ns3Hasher_methods(root_module, root_module['ns3::Hasher'])
register_Ns3Ipv4Address_methods(root_module, root_module['ns3::Ipv4Address'])
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_Ns3LogComponent_methods(root_module, root_module['ns3::LogComponent'])
register_Ns3Mac48Address_methods(root_module, root_module['ns3::Mac48Address'])
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_Ns3ParameterLogger_methods(root_module, root_module['ns3::ParameterLogger'])
register_Ns3PcapFile_methods(root_module, root_module['ns3::PcapFile'])
register_Ns3PcapHelper_methods(root_module, root_module['ns3::PcapHelper'])
register_Ns3PcapHelperForDevice_methods(root_module, root_module['ns3::PcapHelperForDevice'])
register_Ns3QueueSize_methods(root_module, root_module['ns3::QueueSize'])
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_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_Ns3TracedValue__Unsigned_int_methods(root_module, root_module['ns3::TracedValue< unsigned int >'])
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_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_Ns3CsmaHelper_methods(root_module, root_module['ns3::CsmaHelper'])
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_Ns3PcapFileWrapper_methods(root_module, root_module['ns3::PcapFileWrapper'])
register_Ns3QueueBase_methods(root_module, root_module['ns3::QueueBase'])
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__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >'])
register_Ns3SimpleRefCount__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >'])
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__Ns3QueueItem_Ns3Empty_Ns3DefaultDeleter__lt__ns3QueueItem__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> >'])
register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
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_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_Ns3Channel_methods(root_module, root_module['ns3::Channel'])
register_Ns3ConstantRandomVariable_methods(root_module, root_module['ns3::ConstantRandomVariable'])
register_Ns3CsmaChannel_methods(root_module, root_module['ns3::CsmaChannel'])
register_Ns3DataRateChecker_methods(root_module, root_module['ns3::DataRateChecker'])
register_Ns3DataRateValue_methods(root_module, root_module['ns3::DataRateValue'])
register_Ns3DeterministicRandomVariable_methods(root_module, root_module['ns3::DeterministicRandomVariable'])
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_Ns3ErrorModel_methods(root_module, root_module['ns3::ErrorModel'])
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_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_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_Ns3ListErrorModel_methods(root_module, root_module['ns3::ListErrorModel'])
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_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_Ns3OutputStreamWrapper_methods(root_module, root_module['ns3::OutputStreamWrapper'])
register_Ns3Packet_methods(root_module, root_module['ns3::Packet'])
register_Ns3ParetoRandomVariable_methods(root_module, root_module['ns3::ParetoRandomVariable'])
register_Ns3Queue__Ns3Packet_methods(root_module, root_module['ns3::Queue< ns3::Packet >'])
register_Ns3Queue__Ns3QueueDiscItem_methods(root_module, root_module['ns3::Queue< ns3::QueueDiscItem >'])
register_Ns3QueueItem_methods(root_module, root_module['ns3::QueueItem'])
register_Ns3QueueSizeChecker_methods(root_module, root_module['ns3::QueueSizeChecker'])
register_Ns3QueueSizeValue_methods(root_module, root_module['ns3::QueueSizeValue'])
register_Ns3RateErrorModel_methods(root_module, root_module['ns3::RateErrorModel'])
register_Ns3ReceiveListErrorModel_methods(root_module, root_module['ns3::ReceiveListErrorModel'])
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_Ns3AddressChecker_methods(root_module, root_module['ns3::AddressChecker'])
register_Ns3AddressValue_methods(root_module, root_module['ns3::AddressValue'])
register_Ns3BinaryErrorModel_methods(root_module, root_module['ns3::BinaryErrorModel'])
register_Ns3BurstErrorModel_methods(root_module, root_module['ns3::BurstErrorModel'])
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_Ns3Ptr__lt__const_ns3Packet__gt___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, ns3::Ptr<const ns3::Packet>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Void_Ns3Ptr__lt__const_ns3QueueDiscItem__gt___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, ns3::Ptr<const ns3::QueueDiscItem>, 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_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Void_Unsigned_int_Unsigned_int_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, unsigned int, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CsmaNetDevice_methods(root_module, root_module['ns3::CsmaNetDevice'])
register_Ns3QueueDiscItem_methods(root_module, root_module['ns3::QueueDiscItem'])
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_Ns3AsciiTraceHelper_methods(root_module, cls):
## trace-helper.h (module 'network'): ns3::AsciiTraceHelper::AsciiTraceHelper(ns3::AsciiTraceHelper const & arg0) [constructor]
cls.add_constructor([param('ns3::AsciiTraceHelper const &', 'arg0')])
## trace-helper.h (module 'network'): ns3::AsciiTraceHelper::AsciiTraceHelper() [constructor]
cls.add_constructor([])
## trace-helper.h (module 'network'): ns3::Ptr<ns3::OutputStreamWrapper> ns3::AsciiTraceHelper::CreateFileStream(std::string filename, std::ios_base::openmode filemode=std::ios_base::out) [member function]
cls.add_method('CreateFileStream',
'ns3::Ptr< ns3::OutputStreamWrapper >',
[param('std::string', 'filename'), param('std::ios_base::openmode', 'filemode', default_value='std::ios_base::out')])
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDequeueSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('DefaultDequeueSinkWithContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDequeueSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('DefaultDequeueSinkWithoutContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDropSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('DefaultDropSinkWithContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDropSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('DefaultDropSinkWithoutContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultEnqueueSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('DefaultEnqueueSinkWithContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultEnqueueSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('DefaultEnqueueSinkWithoutContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultReceiveSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('DefaultReceiveSinkWithContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultReceiveSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('DefaultReceiveSinkWithoutContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): std::string ns3::AsciiTraceHelper::GetFilenameFromDevice(std::string prefix, ns3::Ptr<ns3::NetDevice> device, bool useObjectNames=true) [member function]
cls.add_method('GetFilenameFromDevice',
'std::string',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'device'), param('bool', 'useObjectNames', default_value='true')])
## trace-helper.h (module 'network'): std::string ns3::AsciiTraceHelper::GetFilenameFromInterfacePair(std::string prefix, ns3::Ptr<ns3::Object> object, uint32_t interface, bool useObjectNames=true) [member function]
cls.add_method('GetFilenameFromInterfacePair',
'std::string',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::Object >', 'object'), param('uint32_t', 'interface'), param('bool', 'useObjectNames', default_value='true')])
return
def register_Ns3AsciiTraceHelperForDevice_methods(root_module, cls):
## trace-helper.h (module 'network'): ns3::AsciiTraceHelperForDevice::AsciiTraceHelperForDevice(ns3::AsciiTraceHelperForDevice const & arg0) [constructor]
cls.add_constructor([param('ns3::AsciiTraceHelperForDevice const &', 'arg0')])
## trace-helper.h (module 'network'): ns3::AsciiTraceHelperForDevice::AsciiTraceHelperForDevice() [constructor]
cls.add_constructor([])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool explicitFilename=false) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'explicitFilename', default_value='false')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, ns3::Ptr<ns3::NetDevice> nd) [member function]
cls.add_method('EnableAscii',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('ns3::Ptr< ns3::NetDevice >', 'nd')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, std::string ndName, bool explicitFilename=false) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::string', 'prefix'), param('std::string', 'ndName'), param('bool', 'explicitFilename', default_value='false')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, std::string ndName) [member function]
cls.add_method('EnableAscii',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('std::string', 'ndName')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, ns3::NetDeviceContainer d) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::string', 'prefix'), param('ns3::NetDeviceContainer', 'd')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, ns3::NetDeviceContainer d) [member function]
cls.add_method('EnableAscii',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('ns3::NetDeviceContainer', 'd')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, ns3::NodeContainer n) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::string', 'prefix'), param('ns3::NodeContainer', 'n')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, ns3::NodeContainer n) [member function]
cls.add_method('EnableAscii',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('ns3::NodeContainer', 'n')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, uint32_t nodeid, uint32_t deviceid, bool explicitFilename) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::string', 'prefix'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid'), param('bool', 'explicitFilename')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, uint32_t nodeid, uint32_t deviceid) [member function]
cls.add_method('EnableAscii',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAsciiAll(std::string prefix) [member function]
cls.add_method('EnableAsciiAll',
'void',
[param('std::string', 'prefix')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAsciiAll(ns3::Ptr<ns3::OutputStreamWrapper> stream) [member function]
cls.add_method('EnableAsciiAll',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAsciiInternal(ns3::Ptr<ns3::OutputStreamWrapper> stream, std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool explicitFilename) [member function]
cls.add_method('EnableAsciiInternal',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'explicitFilename')],
is_virtual=True, is_pure_virtual=True)
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_Ns3Backoff_methods(root_module, cls):
## backoff.h (module 'csma'): ns3::Backoff::Backoff(ns3::Backoff const & arg0) [constructor]
cls.add_constructor([param('ns3::Backoff const &', 'arg0')])
## backoff.h (module 'csma'): ns3::Backoff::Backoff() [constructor]
cls.add_constructor([])
## backoff.h (module 'csma'): ns3::Backoff::Backoff(ns3::Time slotTime, uint32_t minSlots, uint32_t maxSlots, uint32_t ceiling, uint32_t maxRetries) [constructor]
cls.add_constructor([param('ns3::Time', 'slotTime'), param('uint32_t', 'minSlots'), param('uint32_t', 'maxSlots'), param('uint32_t', 'ceiling'), param('uint32_t', 'maxRetries')])
## backoff.h (module 'csma'): int64_t ns3::Backoff::AssignStreams(int64_t stream) [member function]
cls.add_method('AssignStreams',
'int64_t',
[param('int64_t', 'stream')])
## backoff.h (module 'csma'): ns3::Time ns3::Backoff::GetBackoffTime() [member function]
cls.add_method('GetBackoffTime',
'ns3::Time',
[])
## backoff.h (module 'csma'): void ns3::Backoff::IncrNumRetries() [member function]
cls.add_method('IncrNumRetries',
'void',
[])
## backoff.h (module 'csma'): bool ns3::Backoff::MaxRetriesReached() [member function]
cls.add_method('MaxRetriesReached',
'bool',
[])
## backoff.h (module 'csma'): void ns3::Backoff::ResetBackoffTime() [member function]
cls.add_method('ResetBackoffTime',
'void',
[])
## backoff.h (module 'csma'): ns3::Backoff::m_ceiling [variable]
cls.add_instance_attribute('m_ceiling', 'uint32_t', is_const=False)
## backoff.h (module 'csma'): ns3::Backoff::m_maxRetries [variable]
cls.add_instance_attribute('m_maxRetries', 'uint32_t', is_const=False)
## backoff.h (module 'csma'): ns3::Backoff::m_maxSlots [variable]
cls.add_instance_attribute('m_maxSlots', 'uint32_t', is_const=False)
## backoff.h (module 'csma'): ns3::Backoff::m_minSlots [variable]
cls.add_instance_attribute('m_minSlots', 'uint32_t', is_const=False)
## backoff.h (module 'csma'): ns3::Backoff::m_slotTime [variable]
cls.add_instance_attribute('m_slotTime', 'ns3::Time', is_const=False)
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_Ns3CsmaDeviceRec_methods(root_module, cls):
## csma-channel.h (module 'csma'): ns3::CsmaDeviceRec::CsmaDeviceRec() [constructor]
cls.add_constructor([])
## csma-channel.h (module 'csma'): ns3::CsmaDeviceRec::CsmaDeviceRec(ns3::Ptr<ns3::CsmaNetDevice> device) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::CsmaNetDevice >', 'device')])
## csma-channel.h (module 'csma'): ns3::CsmaDeviceRec::CsmaDeviceRec(ns3::CsmaDeviceRec const & o) [constructor]
cls.add_constructor([param('ns3::CsmaDeviceRec const &', 'o')])
## csma-channel.h (module 'csma'): bool ns3::CsmaDeviceRec::IsActive() [member function]
cls.add_method('IsActive',
'bool',
[])
## csma-channel.h (module 'csma'): ns3::CsmaDeviceRec::active [variable]
cls.add_instance_attribute('active', 'bool', is_const=False)
## csma-channel.h (module 'csma'): ns3::CsmaDeviceRec::devicePtr [variable]
cls.add_instance_attribute('devicePtr', 'ns3::Ptr< ns3::CsmaNetDevice >', is_const=False)
return
def register_Ns3DataRate_methods(root_module, cls):
cls.add_output_stream_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_comparison_operator('>=')
## data-rate.h (module 'network'): ns3::DataRate::DataRate(ns3::DataRate const & arg0) [constructor]
cls.add_constructor([param('ns3::DataRate const &', 'arg0')])
## data-rate.h (module 'network'): ns3::DataRate::DataRate() [constructor]
cls.add_constructor([])
## data-rate.h (module 'network'): ns3::DataRate::DataRate(uint64_t bps) [constructor]
cls.add_constructor([param('uint64_t', 'bps')])
## data-rate.h (module 'network'): ns3::DataRate::DataRate(std::string rate) [constructor]
cls.add_constructor([param('std::string', 'rate')])
## data-rate.h (module 'network'): ns3::Time ns3::DataRate::CalculateBitsTxTime(uint32_t bits) const [member function]
cls.add_method('CalculateBitsTxTime',
'ns3::Time',
[param('uint32_t', 'bits')],
is_const=True)
## data-rate.h (module 'network'): ns3::Time ns3::DataRate::CalculateBytesTxTime(uint32_t bytes) const [member function]
cls.add_method('CalculateBytesTxTime',
'ns3::Time',
[param('uint32_t', 'bytes')],
is_const=True)
## data-rate.h (module 'network'): double ns3::DataRate::CalculateTxTime(uint32_t bytes) const [member function]
cls.add_method('CalculateTxTime',
'double',
[param('uint32_t', 'bytes')],
is_const=True, deprecated=True)
## data-rate.h (module 'network'): uint64_t ns3::DataRate::GetBitRate() const [member function]
cls.add_method('GetBitRate',
'uint64_t',
[],
is_const=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__Ns3OutputStreamWrapper_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::OutputStreamWrapper>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::OutputStreamWrapper>::DefaultDeleter(ns3::DefaultDeleter<ns3::OutputStreamWrapper> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::OutputStreamWrapper > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::OutputStreamWrapper>::Delete(ns3::OutputStreamWrapper * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::OutputStreamWrapper *', '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__Ns3QueueItem_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::QueueItem>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::QueueItem>::DefaultDeleter(ns3::DefaultDeleter<ns3::QueueItem> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::QueueItem > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::QueueItem>::Delete(ns3::QueueItem * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::QueueItem *', '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_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_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, deprecated=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_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, deprecated=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) const [member function]
cls.add_method('CombinePrefix',
'ns3::Ipv6Address',
[param('ns3::Ipv6Prefix const &', 'prefix')],
is_const=True)
## 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::HasPrefix(ns3::Ipv6Prefix const & prefix) const [member function]
cls.add_method('HasPrefix',
'bool',
[param('ns3::Ipv6Prefix const &', 'prefix')],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllHostsMulticast() const [member function]
cls.add_method('IsAllHostsMulticast',
'bool',
[],
is_const=True, deprecated=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, deprecated=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::Address addr, ns3::Ipv6Address prefix) [member function]
cls.add_method('MakeAutoconfiguredAddress',
'ns3::Ipv6Address',
[param('ns3::Address', 'addr'), param('ns3::Ipv6Address', 'prefix')],
is_static=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::Address mac) [member function]
cls.add_method('MakeAutoconfiguredLinkLocalAddress',
'ns3::Ipv6Address',
[param('ns3::Address', 'mac')],
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, uint8_t prefixLength) [constructor]
cls.add_constructor([param('uint8_t *', 'prefix'), param('uint8_t', 'prefixLength')])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(char const * prefix, uint8_t prefixLength) [constructor]
cls.add_constructor([param('char const *', 'prefix'), param('uint8_t', 'prefixLength')])
## 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'): uint8_t ns3::Ipv6Prefix::GetMinimumPrefixLength() const [member function]
cls.add_method('GetMinimumPrefixLength',
'uint8_t',
[],
is_const=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, deprecated=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)
## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::SetPrefixLength(uint8_t prefixLength) [member function]
cls.add_method('SetPrefixLength',
'void',
[param('uint8_t', 'prefixLength')])
return
def register_Ns3LogComponent_methods(root_module, cls):
## log.h (module 'core'): ns3::LogComponent::LogComponent(ns3::LogComponent const & arg0) [constructor]
cls.add_constructor([param('ns3::LogComponent const &', 'arg0')])
## log.h (module 'core'): ns3::LogComponent::LogComponent(std::string const & name, std::string const & file, ns3::LogLevel const mask=::ns3::LogLevel::LOG_NONE) [constructor]
cls.add_constructor([param('std::string const &', 'name'), param('std::string const &', 'file'), param('ns3::LogLevel const', 'mask', default_value='::ns3::LogLevel::LOG_NONE')])
## log.h (module 'core'): void ns3::LogComponent::Disable(ns3::LogLevel const level) [member function]
cls.add_method('Disable',
'void',
[param('ns3::LogLevel const', 'level')])
## log.h (module 'core'): void ns3::LogComponent::Enable(ns3::LogLevel const level) [member function]
cls.add_method('Enable',
'void',
[param('ns3::LogLevel const', 'level')])
## log.h (module 'core'): std::string ns3::LogComponent::File() const [member function]
cls.add_method('File',
'std::string',
[],
is_const=True)
## log.h (module 'core'): static ns3::LogComponent::ComponentList * ns3::LogComponent::GetComponentList() [member function]
cls.add_method('GetComponentList',
'ns3::LogComponent::ComponentList *',
[],
is_static=True)
## log.h (module 'core'): static std::string ns3::LogComponent::GetLevelLabel(ns3::LogLevel const level) [member function]
cls.add_method('GetLevelLabel',
'std::string',
[param('ns3::LogLevel const', 'level')],
is_static=True)
## log.h (module 'core'): bool ns3::LogComponent::IsEnabled(ns3::LogLevel const level) const [member function]
cls.add_method('IsEnabled',
'bool',
[param('ns3::LogLevel const', 'level')],
is_const=True)
## log.h (module 'core'): bool ns3::LogComponent::IsNoneEnabled() const [member function]
cls.add_method('IsNoneEnabled',
'bool',
[],
is_const=True)
## log.h (module 'core'): char const * ns3::LogComponent::Name() const [member function]
cls.add_method('Name',
'char const *',
[],
is_const=True)
## log.h (module 'core'): void ns3::LogComponent::SetMask(ns3::LogLevel const level) [member function]
cls.add_method('SetMask',
'void',
[param('ns3::LogLevel const', 'level')])
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_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_const=True, is_virtual=True, is_pure_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',
[],
is_virtual=True, visibility='protected')
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'): bool ns3::ObjectFactory::IsTypeIdSet() const [member function]
cls.add_method('IsTypeIdSet',
'bool',
[],
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_Ns3ParameterLogger_methods(root_module, cls):
## log.h (module 'core'): ns3::ParameterLogger::ParameterLogger(ns3::ParameterLogger const & arg0) [constructor]
cls.add_constructor([param('ns3::ParameterLogger const &', 'arg0')])
## log.h (module 'core'): ns3::ParameterLogger::ParameterLogger(std::ostream & os) [constructor]
cls.add_constructor([param('std::ostream &', 'os')])
return
def register_Ns3PcapFile_methods(root_module, cls):
## pcap-file.h (module 'network'): ns3::PcapFile::PcapFile() [constructor]
cls.add_constructor([])
## pcap-file.h (module 'network'): void ns3::PcapFile::Clear() [member function]
cls.add_method('Clear',
'void',
[])
## pcap-file.h (module 'network'): void ns3::PcapFile::Close() [member function]
cls.add_method('Close',
'void',
[])
## pcap-file.h (module 'network'): static bool ns3::PcapFile::Diff(std::string const & f1, std::string const & f2, uint32_t & sec, uint32_t & usec, uint32_t & packets, uint32_t snapLen=ns3::PcapFile::SNAPLEN_DEFAULT) [member function]
cls.add_method('Diff',
'bool',
[param('std::string const &', 'f1'), param('std::string const &', 'f2'), param('uint32_t &', 'sec'), param('uint32_t &', 'usec'), param('uint32_t &', 'packets'), param('uint32_t', 'snapLen', default_value='ns3::PcapFile::SNAPLEN_DEFAULT')],
is_static=True)
## pcap-file.h (module 'network'): bool ns3::PcapFile::Eof() const [member function]
cls.add_method('Eof',
'bool',
[],
is_const=True)
## pcap-file.h (module 'network'): bool ns3::PcapFile::Fail() const [member function]
cls.add_method('Fail',
'bool',
[],
is_const=True)
## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetDataLinkType() [member function]
cls.add_method('GetDataLinkType',
'uint32_t',
[])
## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetMagic() [member function]
cls.add_method('GetMagic',
'uint32_t',
[])
## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetSigFigs() [member function]
cls.add_method('GetSigFigs',
'uint32_t',
[])
## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetSnapLen() [member function]
cls.add_method('GetSnapLen',
'uint32_t',
[])
## pcap-file.h (module 'network'): bool ns3::PcapFile::GetSwapMode() [member function]
cls.add_method('GetSwapMode',
'bool',
[])
## pcap-file.h (module 'network'): int32_t ns3::PcapFile::GetTimeZoneOffset() [member function]
cls.add_method('GetTimeZoneOffset',
'int32_t',
[])
## pcap-file.h (module 'network'): uint16_t ns3::PcapFile::GetVersionMajor() [member function]
cls.add_method('GetVersionMajor',
'uint16_t',
[])
## pcap-file.h (module 'network'): uint16_t ns3::PcapFile::GetVersionMinor() [member function]
cls.add_method('GetVersionMinor',
'uint16_t',
[])
## pcap-file.h (module 'network'): void ns3::PcapFile::Init(uint32_t dataLinkType, uint32_t snapLen=ns3::PcapFile::SNAPLEN_DEFAULT, int32_t timeZoneCorrection=ns3::PcapFile::ZONE_DEFAULT, bool swapMode=false, bool nanosecMode=false) [member function]
cls.add_method('Init',
'void',
[param('uint32_t', 'dataLinkType'), param('uint32_t', 'snapLen', default_value='ns3::PcapFile::SNAPLEN_DEFAULT'), param('int32_t', 'timeZoneCorrection', default_value='ns3::PcapFile::ZONE_DEFAULT'), param('bool', 'swapMode', default_value='false'), param('bool', 'nanosecMode', default_value='false')])
## pcap-file.h (module 'network'): bool ns3::PcapFile::IsNanoSecMode() [member function]
cls.add_method('IsNanoSecMode',
'bool',
[])
## pcap-file.h (module 'network'): void ns3::PcapFile::Open(std::string const & filename, std::ios_base::openmode mode) [member function]
cls.add_method('Open',
'void',
[param('std::string const &', 'filename'), param('std::ios_base::openmode', 'mode')])
## pcap-file.h (module 'network'): void ns3::PcapFile::Read(uint8_t * const data, uint32_t maxBytes, uint32_t & tsSec, uint32_t & tsUsec, uint32_t & inclLen, uint32_t & origLen, uint32_t & readLen) [member function]
cls.add_method('Read',
'void',
[param('uint8_t * const', 'data'), param('uint32_t', 'maxBytes'), param('uint32_t &', 'tsSec'), param('uint32_t &', 'tsUsec'), param('uint32_t &', 'inclLen'), param('uint32_t &', 'origLen'), param('uint32_t &', 'readLen')])
## pcap-file.h (module 'network'): void ns3::PcapFile::Write(uint32_t tsSec, uint32_t tsUsec, uint8_t const * const data, uint32_t totalLen) [member function]
cls.add_method('Write',
'void',
[param('uint32_t', 'tsSec'), param('uint32_t', 'tsUsec'), param('uint8_t const * const', 'data'), param('uint32_t', 'totalLen')])
## pcap-file.h (module 'network'): void ns3::PcapFile::Write(uint32_t tsSec, uint32_t tsUsec, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('Write',
'void',
[param('uint32_t', 'tsSec'), param('uint32_t', 'tsUsec'), param('ns3::Ptr< ns3::Packet const >', 'p')])
## pcap-file.h (module 'network'): void ns3::PcapFile::Write(uint32_t tsSec, uint32_t tsUsec, ns3::Header const & header, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('Write',
'void',
[param('uint32_t', 'tsSec'), param('uint32_t', 'tsUsec'), param('ns3::Header const &', 'header'), param('ns3::Ptr< ns3::Packet const >', 'p')])
## pcap-file.h (module 'network'): ns3::PcapFile::SNAPLEN_DEFAULT [variable]
cls.add_static_attribute('SNAPLEN_DEFAULT', 'uint32_t const', is_const=True)
## pcap-file.h (module 'network'): ns3::PcapFile::ZONE_DEFAULT [variable]
cls.add_static_attribute('ZONE_DEFAULT', 'int32_t const', is_const=True)
return
def register_Ns3PcapHelper_methods(root_module, cls):
## trace-helper.h (module 'network'): ns3::PcapHelper::PcapHelper(ns3::PcapHelper const & arg0) [constructor]
cls.add_constructor([param('ns3::PcapHelper const &', 'arg0')])
## trace-helper.h (module 'network'): ns3::PcapHelper::PcapHelper() [constructor]
cls.add_constructor([])
## trace-helper.h (module 'network'): ns3::Ptr<ns3::PcapFileWrapper> ns3::PcapHelper::CreateFile(std::string filename, std::ios_base::openmode filemode, ns3::PcapHelper::DataLinkType dataLinkType, uint32_t snapLen=std::numeric_limits<unsigned int>::max(), int32_t tzCorrection=0) [member function]
cls.add_method('CreateFile',
'ns3::Ptr< ns3::PcapFileWrapper >',
[param('std::string', 'filename'), param('std::ios_base::openmode', 'filemode'), param('ns3::PcapHelper::DataLinkType', 'dataLinkType'), param('uint32_t', 'snapLen', default_value='std::numeric_limits<unsigned int>::max()'), param('int32_t', 'tzCorrection', default_value='0')])
## trace-helper.h (module 'network'): std::string ns3::PcapHelper::GetFilenameFromDevice(std::string prefix, ns3::Ptr<ns3::NetDevice> device, bool useObjectNames=true) [member function]
cls.add_method('GetFilenameFromDevice',
'std::string',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'device'), param('bool', 'useObjectNames', default_value='true')])
## trace-helper.h (module 'network'): std::string ns3::PcapHelper::GetFilenameFromInterfacePair(std::string prefix, ns3::Ptr<ns3::Object> object, uint32_t interface, bool useObjectNames=true) [member function]
cls.add_method('GetFilenameFromInterfacePair',
'std::string',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::Object >', 'object'), param('uint32_t', 'interface'), param('bool', 'useObjectNames', default_value='true')])
return
def register_Ns3PcapHelperForDevice_methods(root_module, cls):
## trace-helper.h (module 'network'): ns3::PcapHelperForDevice::PcapHelperForDevice(ns3::PcapHelperForDevice const & arg0) [constructor]
cls.add_constructor([param('ns3::PcapHelperForDevice const &', 'arg0')])
## trace-helper.h (module 'network'): ns3::PcapHelperForDevice::PcapHelperForDevice() [constructor]
cls.add_constructor([])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool promiscuous=false, bool explicitFilename=false) [member function]
cls.add_method('EnablePcap',
'void',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'promiscuous', default_value='false'), param('bool', 'explicitFilename', default_value='false')])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, std::string ndName, bool promiscuous=false, bool explicitFilename=false) [member function]
cls.add_method('EnablePcap',
'void',
[param('std::string', 'prefix'), param('std::string', 'ndName'), param('bool', 'promiscuous', default_value='false'), param('bool', 'explicitFilename', default_value='false')])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, ns3::NetDeviceContainer d, bool promiscuous=false) [member function]
cls.add_method('EnablePcap',
'void',
[param('std::string', 'prefix'), param('ns3::NetDeviceContainer', 'd'), param('bool', 'promiscuous', default_value='false')])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, ns3::NodeContainer n, bool promiscuous=false) [member function]
cls.add_method('EnablePcap',
'void',
[param('std::string', 'prefix'), param('ns3::NodeContainer', 'n'), param('bool', 'promiscuous', default_value='false')])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, uint32_t nodeid, uint32_t deviceid, bool promiscuous=false) [member function]
cls.add_method('EnablePcap',
'void',
[param('std::string', 'prefix'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid'), param('bool', 'promiscuous', default_value='false')])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcapAll(std::string prefix, bool promiscuous=false) [member function]
cls.add_method('EnablePcapAll',
'void',
[param('std::string', 'prefix'), param('bool', 'promiscuous', default_value='false')])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcapInternal(std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool promiscuous, bool explicitFilename) [member function]
cls.add_method('EnablePcapInternal',
'void',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'promiscuous'), param('bool', 'explicitFilename')],
is_virtual=True, is_pure_virtual=True)
return
def register_Ns3QueueSize_methods(root_module, cls):
cls.add_output_stream_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_comparison_operator('>=')
## queue-size.h (module 'network'): ns3::QueueSize::QueueSize(ns3::QueueSize const & arg0) [constructor]
cls.add_constructor([param('ns3::QueueSize const &', 'arg0')])
## queue-size.h (module 'network'): ns3::QueueSize::QueueSize() [constructor]
cls.add_constructor([])
## queue-size.h (module 'network'): ns3::QueueSize::QueueSize(ns3::QueueSizeUnit unit, uint32_t value) [constructor]
cls.add_constructor([param('ns3::QueueSizeUnit', 'unit'), param('uint32_t', 'value')])
## queue-size.h (module 'network'): ns3::QueueSize::QueueSize(std::string size) [constructor]
cls.add_constructor([param('std::string', 'size')])
## queue-size.h (module 'network'): ns3::QueueSizeUnit ns3::QueueSize::GetUnit() const [member function]
cls.add_method('GetUnit',
'ns3::QueueSizeUnit',
[],
is_const=True)
## queue-size.h (module 'network'): uint32_t ns3::QueueSize::GetValue() const [member function]
cls.add_method('GetValue',
'uint32_t',
[],
is_const=True)
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 uint64_t ns3::Simulator::GetEventCount() [member function]
cls.add_method('GetEventCount',
'uint64_t',
[],
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_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_virtual=True, is_pure_virtual=True)
## tag.h (module 'network'): uint32_t ns3::Tag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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_Ns3TracedValue__Unsigned_int_methods(root_module, cls):
## traced-value.h (module 'core'): ns3::TracedValue<unsigned int>::TracedValue() [constructor]
cls.add_constructor([])
## traced-value.h (module 'core'): ns3::TracedValue<unsigned int>::TracedValue(ns3::TracedValue<unsigned int> const & o) [constructor]
cls.add_constructor([param('ns3::TracedValue< unsigned int > const &', 'o')])
## traced-value.h (module 'core'): ns3::TracedValue<unsigned int>::TracedValue(unsigned int const & v) [constructor]
cls.add_constructor([param('unsigned int const &', 'v')])
## traced-value.h (module 'core'): ns3::TracedValue<unsigned int>::TracedValue(ns3::TracedValue<unsigned int> const & other) [constructor]
cls.add_constructor([param('ns3::TracedValue< unsigned int > const &', 'other')])
## traced-value.h (module 'core'): ns3::TracedValue<unsigned int>::TracedValue(ns3::TracedValue<unsigned int> const & other) [constructor]
cls.add_constructor([param('ns3::TracedValue< unsigned int > const &', 'other')])
## traced-value.h (module 'core'): void ns3::TracedValue<unsigned int>::Connect(ns3::CallbackBase const & cb, std::string path) [member function]
cls.add_method('Connect',
'void',
[param('ns3::CallbackBase const &', 'cb'), param('std::string', 'path')])
## traced-value.h (module 'core'): void ns3::TracedValue<unsigned int>::ConnectWithoutContext(ns3::CallbackBase const & cb) [member function]
cls.add_method('ConnectWithoutContext',
'void',
[param('ns3::CallbackBase const &', 'cb')])
## traced-value.h (module 'core'): void ns3::TracedValue<unsigned int>::Disconnect(ns3::CallbackBase const & cb, std::string path) [member function]
cls.add_method('Disconnect',
'void',
[param('ns3::CallbackBase const &', 'cb'), param('std::string', 'path')])
## traced-value.h (module 'core'): void ns3::TracedValue<unsigned int>::DisconnectWithoutContext(ns3::CallbackBase const & cb) [member function]
cls.add_method('DisconnectWithoutContext',
'void',
[param('ns3::CallbackBase const &', 'cb')])
## traced-value.h (module 'core'): unsigned int ns3::TracedValue<unsigned int>::Get() const [member function]
cls.add_method('Get',
'unsigned int',
[],
is_const=True)
## traced-value.h (module 'core'): void ns3::TracedValue<unsigned int>::Set(unsigned int const & v) [member function]
cls.add_method('Set',
'void',
[param('unsigned int const &', 'v')])
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=['ns3::QueueBase'])
## 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_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::Time'], root_module['ns3::int64x64_t'], param('ns3::Time const &', 'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', '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 &', 'right'))
cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', 'right'))
cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', 'right'))
cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', '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_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_virtual=True)
return
def register_Ns3CsmaHelper_methods(root_module, cls):
## csma-helper.h (module 'csma'): ns3::CsmaHelper::CsmaHelper(ns3::CsmaHelper const & arg0) [constructor]
cls.add_constructor([param('ns3::CsmaHelper const &', 'arg0')])
## csma-helper.h (module 'csma'): ns3::CsmaHelper::CsmaHelper() [constructor]
cls.add_constructor([])
## csma-helper.h (module 'csma'): int64_t ns3::CsmaHelper::AssignStreams(ns3::NetDeviceContainer c, int64_t stream) [member function]
cls.add_method('AssignStreams',
'int64_t',
[param('ns3::NetDeviceContainer', 'c'), param('int64_t', 'stream')])
## csma-helper.h (module 'csma'): ns3::NetDeviceContainer ns3::CsmaHelper::Install(ns3::Ptr<ns3::Node> node) const [member function]
cls.add_method('Install',
'ns3::NetDeviceContainer',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_const=True)
## csma-helper.h (module 'csma'): ns3::NetDeviceContainer ns3::CsmaHelper::Install(std::string name) const [member function]
cls.add_method('Install',
'ns3::NetDeviceContainer',
[param('std::string', 'name')],
is_const=True)
## csma-helper.h (module 'csma'): ns3::NetDeviceContainer ns3::CsmaHelper::Install(ns3::Ptr<ns3::Node> node, ns3::Ptr<ns3::CsmaChannel> channel) const [member function]
cls.add_method('Install',
'ns3::NetDeviceContainer',
[param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::Ptr< ns3::CsmaChannel >', 'channel')],
is_const=True)
## csma-helper.h (module 'csma'): ns3::NetDeviceContainer ns3::CsmaHelper::Install(ns3::Ptr<ns3::Node> node, std::string channelName) const [member function]
cls.add_method('Install',
'ns3::NetDeviceContainer',
[param('ns3::Ptr< ns3::Node >', 'node'), param('std::string', 'channelName')],
is_const=True)
## csma-helper.h (module 'csma'): ns3::NetDeviceContainer ns3::CsmaHelper::Install(std::string nodeName, ns3::Ptr<ns3::CsmaChannel> channel) const [member function]
cls.add_method('Install',
'ns3::NetDeviceContainer',
[param('std::string', 'nodeName'), param('ns3::Ptr< ns3::CsmaChannel >', 'channel')],
is_const=True)
## csma-helper.h (module 'csma'): ns3::NetDeviceContainer ns3::CsmaHelper::Install(std::string nodeName, std::string channelName) const [member function]
cls.add_method('Install',
'ns3::NetDeviceContainer',
[param('std::string', 'nodeName'), param('std::string', 'channelName')],
is_const=True)
## csma-helper.h (module 'csma'): ns3::NetDeviceContainer ns3::CsmaHelper::Install(ns3::NodeContainer const & c) const [member function]
cls.add_method('Install',
'ns3::NetDeviceContainer',
[param('ns3::NodeContainer const &', 'c')],
is_const=True)
## csma-helper.h (module 'csma'): ns3::NetDeviceContainer ns3::CsmaHelper::Install(ns3::NodeContainer const & c, ns3::Ptr<ns3::CsmaChannel> channel) const [member function]
cls.add_method('Install',
'ns3::NetDeviceContainer',
[param('ns3::NodeContainer const &', 'c'), param('ns3::Ptr< ns3::CsmaChannel >', 'channel')],
is_const=True)
## csma-helper.h (module 'csma'): ns3::NetDeviceContainer ns3::CsmaHelper::Install(ns3::NodeContainer const & c, std::string channelName) const [member function]
cls.add_method('Install',
'ns3::NetDeviceContainer',
[param('ns3::NodeContainer const &', 'c'), param('std::string', 'channelName')],
is_const=True)
## csma-helper.h (module 'csma'): void ns3::CsmaHelper::SetChannelAttribute(std::string n1, ns3::AttributeValue const & v1) [member function]
cls.add_method('SetChannelAttribute',
'void',
[param('std::string', 'n1'), param('ns3::AttributeValue const &', 'v1')])
## csma-helper.h (module 'csma'): void ns3::CsmaHelper::SetDeviceAttribute(std::string n1, ns3::AttributeValue const & v1) [member function]
cls.add_method('SetDeviceAttribute',
'void',
[param('std::string', 'n1'), param('ns3::AttributeValue const &', 'v1')])
## csma-helper.h (module 'csma'): void ns3::CsmaHelper::SetQueue(std::string type, std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue()) [member function]
cls.add_method('SetQueue',
'void',
[param('std::string', 'type'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()')])
## csma-helper.h (module 'csma'): void ns3::CsmaHelper::EnableAsciiInternal(ns3::Ptr<ns3::OutputStreamWrapper> stream, std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool explicitFilename) [member function]
cls.add_method('EnableAsciiInternal',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'explicitFilename')],
is_virtual=True, visibility='private')
## csma-helper.h (module 'csma'): void ns3::CsmaHelper::EnablePcapInternal(std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool promiscuous, bool explicitFilename) [member function]
cls.add_method('EnablePcapInternal',
'void',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'promiscuous'), param('bool', 'explicitFilename')],
is_virtual=True, visibility='private')
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_virtual=True, is_pure_virtual=True)
## header.h (module 'network'): uint32_t ns3::Header::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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',
[],
is_virtual=True, visibility='protected')
## object.h (module 'core'): void ns3::Object::DoInitialize() [member function]
cls.add_method('DoInitialize',
'void',
[],
is_virtual=True, visibility='protected')
## object.h (module 'core'): void ns3::Object::NotifyNewAggregate() [member function]
cls.add_method('NotifyNewAggregate',
'void',
[],
is_virtual=True, visibility='protected')
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_Ns3PcapFileWrapper_methods(root_module, cls):
## pcap-file-wrapper.h (module 'network'): static ns3::TypeId ns3::PcapFileWrapper::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper::PcapFileWrapper() [constructor]
cls.add_constructor([])
## pcap-file-wrapper.h (module 'network'): bool ns3::PcapFileWrapper::Fail() const [member function]
cls.add_method('Fail',
'bool',
[],
is_const=True)
## pcap-file-wrapper.h (module 'network'): bool ns3::PcapFileWrapper::Eof() const [member function]
cls.add_method('Eof',
'bool',
[],
is_const=True)
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Clear() [member function]
cls.add_method('Clear',
'void',
[])
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Open(std::string const & filename, std::ios_base::openmode mode) [member function]
cls.add_method('Open',
'void',
[param('std::string const &', 'filename'), param('std::ios_base::openmode', 'mode')])
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Close() [member function]
cls.add_method('Close',
'void',
[])
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Init(uint32_t dataLinkType, uint32_t snapLen=std::numeric_limits<unsigned int>::max(), int32_t tzCorrection=ns3::PcapFile::ZONE_DEFAULT) [member function]
cls.add_method('Init',
'void',
[param('uint32_t', 'dataLinkType'), param('uint32_t', 'snapLen', default_value='std::numeric_limits<unsigned int>::max()'), param('int32_t', 'tzCorrection', default_value='ns3::PcapFile::ZONE_DEFAULT')])
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Write(ns3::Time t, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('Write',
'void',
[param('ns3::Time', 't'), param('ns3::Ptr< ns3::Packet const >', 'p')])
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Write(ns3::Time t, ns3::Header const & header, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('Write',
'void',
[param('ns3::Time', 't'), param('ns3::Header const &', 'header'), param('ns3::Ptr< ns3::Packet const >', 'p')])
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Write(ns3::Time t, uint8_t const * buffer, uint32_t length) [member function]
cls.add_method('Write',
'void',
[param('ns3::Time', 't'), param('uint8_t const *', 'buffer'), param('uint32_t', 'length')])
## pcap-file-wrapper.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::PcapFileWrapper::Read(ns3::Time & t) [member function]
cls.add_method('Read',
'ns3::Ptr< ns3::Packet >',
[param('ns3::Time &', 't')])
## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetMagic() [member function]
cls.add_method('GetMagic',
'uint32_t',
[])
## pcap-file-wrapper.h (module 'network'): uint16_t ns3::PcapFileWrapper::GetVersionMajor() [member function]
cls.add_method('GetVersionMajor',
'uint16_t',
[])
## pcap-file-wrapper.h (module 'network'): uint16_t ns3::PcapFileWrapper::GetVersionMinor() [member function]
cls.add_method('GetVersionMinor',
'uint16_t',
[])
## pcap-file-wrapper.h (module 'network'): int32_t ns3::PcapFileWrapper::GetTimeZoneOffset() [member function]
cls.add_method('GetTimeZoneOffset',
'int32_t',
[])
## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetSigFigs() [member function]
cls.add_method('GetSigFigs',
'uint32_t',
[])
## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetSnapLen() [member function]
cls.add_method('GetSnapLen',
'uint32_t',
[])
## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetDataLinkType() [member function]
cls.add_method('GetDataLinkType',
'uint32_t',
[])
return
def register_Ns3QueueBase_methods(root_module, cls):
## queue.h (module 'network'): ns3::QueueBase::QueueBase(ns3::QueueBase const & arg0) [constructor]
cls.add_constructor([param('ns3::QueueBase const &', 'arg0')])
## queue.h (module 'network'): ns3::QueueBase::QueueBase() [constructor]
cls.add_constructor([])
## queue.h (module 'network'): static void ns3::QueueBase::AppendItemTypeIfNotPresent(std::string & typeId, std::string const & itemType) [member function]
cls.add_method('AppendItemTypeIfNotPresent',
'void',
[param('std::string &', 'typeId'), param('std::string const &', 'itemType')],
is_static=True)
## queue.h (module 'network'): ns3::QueueSize ns3::QueueBase::GetCurrentSize() const [member function]
cls.add_method('GetCurrentSize',
'ns3::QueueSize',
[],
is_const=True)
## queue.h (module 'network'): ns3::QueueSize ns3::QueueBase::GetMaxSize() const [member function]
cls.add_method('GetMaxSize',
'ns3::QueueSize',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetNBytes() const [member function]
cls.add_method('GetNBytes',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetNPackets() const [member function]
cls.add_method('GetNPackets',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetTotalDroppedBytes() const [member function]
cls.add_method('GetTotalDroppedBytes',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetTotalDroppedBytesAfterDequeue() const [member function]
cls.add_method('GetTotalDroppedBytesAfterDequeue',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetTotalDroppedBytesBeforeEnqueue() const [member function]
cls.add_method('GetTotalDroppedBytesBeforeEnqueue',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetTotalDroppedPackets() const [member function]
cls.add_method('GetTotalDroppedPackets',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetTotalDroppedPacketsAfterDequeue() const [member function]
cls.add_method('GetTotalDroppedPacketsAfterDequeue',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetTotalDroppedPacketsBeforeEnqueue() const [member function]
cls.add_method('GetTotalDroppedPacketsBeforeEnqueue',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetTotalReceivedBytes() const [member function]
cls.add_method('GetTotalReceivedBytes',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetTotalReceivedPackets() const [member function]
cls.add_method('GetTotalReceivedPackets',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): static ns3::TypeId ns3::QueueBase::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## queue.h (module 'network'): bool ns3::QueueBase::IsEmpty() const [member function]
cls.add_method('IsEmpty',
'bool',
[],
is_const=True)
## queue.h (module 'network'): void ns3::QueueBase::ResetStatistics() [member function]
cls.add_method('ResetStatistics',
'void',
[])
## queue.h (module 'network'): void ns3::QueueBase::SetMaxSize(ns3::QueueSize size) [member function]
cls.add_method('SetMaxSize',
'void',
[param('ns3::QueueSize', 'size')])
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_virtual=True, is_pure_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::RandomVariableStream::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True, is_pure_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__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__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::SimpleRefCount(ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter< ns3::OutputStreamWrapper > > 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__Ns3QueueItem_Ns3Empty_Ns3DefaultDeleter__lt__ns3QueueItem__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> >::SimpleRefCount(ns3::SimpleRefCount<ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::QueueItem, ns3::empty, ns3::DefaultDeleter< ns3::QueueItem > > 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_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 &', 'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::Time'], param('int64_t const &', 'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::int64x64_t const &', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::Time'], root_module['ns3::Time'], param('int64_t const &', 'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::int64x64_t const &', 'right'))
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', '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_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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_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_const=True, is_virtual=True, is_pure_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasGetter() const [member function]
cls.add_method('HasGetter',
'bool',
[],
is_const=True, is_virtual=True, is_pure_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasSetter() const [member function]
cls.add_method('HasSetter',
'bool',
[],
is_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_virtual=True)
## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetValueTypeName() const [member function]
cls.add_method('GetValueTypeName',
'std::string',
[],
is_const=True, is_virtual=True, is_pure_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeChecker::HasUnderlyingTypeInformation() const [member function]
cls.add_method('HasUnderlyingTypeInformation',
'bool',
[],
is_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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, template_parameters=['ns3::ObjectBase*'], visibility='protected')
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, template_parameters=['void'], visibility='protected')
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, template_parameters=['unsigned int'], visibility='protected')
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, template_parameters=['ns3::Ptr<ns3::NetDevice> '], visibility='protected')
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, template_parameters=['ns3::Ptr<ns3::Packet const> '], visibility='protected')
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, template_parameters=['unsigned short'], visibility='protected')
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, template_parameters=['ns3::Address const&'], visibility='protected')
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, template_parameters=['ns3::NetDevice::PacketType'], visibility='protected')
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, template_parameters=['ns3::Ptr<ns3::QueueDiscItem const> '], visibility='protected')
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_Ns3Channel_methods(root_module, cls):
## channel.h (module 'network'): ns3::Channel::Channel(ns3::Channel const & arg0) [constructor]
cls.add_constructor([param('ns3::Channel const &', 'arg0')])
## channel.h (module 'network'): ns3::Channel::Channel() [constructor]
cls.add_constructor([])
## channel.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::Channel::GetDevice(std::size_t i) const [member function]
cls.add_method('GetDevice',
'ns3::Ptr< ns3::NetDevice >',
[param('std::size_t', 'i')],
is_const=True, is_virtual=True, is_pure_virtual=True)
## channel.h (module 'network'): uint32_t ns3::Channel::GetId() const [member function]
cls.add_method('GetId',
'uint32_t',
[],
is_const=True)
## channel.h (module 'network'): std::size_t ns3::Channel::GetNDevices() const [member function]
cls.add_method('GetNDevices',
'std::size_t',
[],
is_const=True, is_virtual=True, is_pure_virtual=True)
## channel.h (module 'network'): static ns3::TypeId ns3::Channel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
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_Ns3CsmaChannel_methods(root_module, cls):
## csma-channel.h (module 'csma'): static ns3::TypeId ns3::CsmaChannel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## csma-channel.h (module 'csma'): ns3::CsmaChannel::CsmaChannel() [constructor]
cls.add_constructor([])
## csma-channel.h (module 'csma'): int32_t ns3::CsmaChannel::Attach(ns3::Ptr<ns3::CsmaNetDevice> device) [member function]
cls.add_method('Attach',
'int32_t',
[param('ns3::Ptr< ns3::CsmaNetDevice >', 'device')])
## csma-channel.h (module 'csma'): bool ns3::CsmaChannel::Detach(ns3::Ptr<ns3::CsmaNetDevice> device) [member function]
cls.add_method('Detach',
'bool',
[param('ns3::Ptr< ns3::CsmaNetDevice >', 'device')])
## csma-channel.h (module 'csma'): bool ns3::CsmaChannel::Detach(uint32_t deviceId) [member function]
cls.add_method('Detach',
'bool',
[param('uint32_t', 'deviceId')])
## csma-channel.h (module 'csma'): bool ns3::CsmaChannel::Reattach(uint32_t deviceId) [member function]
cls.add_method('Reattach',
'bool',
[param('uint32_t', 'deviceId')])
## csma-channel.h (module 'csma'): bool ns3::CsmaChannel::Reattach(ns3::Ptr<ns3::CsmaNetDevice> device) [member function]
cls.add_method('Reattach',
'bool',
[param('ns3::Ptr< ns3::CsmaNetDevice >', 'device')])
## csma-channel.h (module 'csma'): bool ns3::CsmaChannel::TransmitStart(ns3::Ptr<const ns3::Packet> p, uint32_t srcId) [member function]
cls.add_method('TransmitStart',
'bool',
[param('ns3::Ptr< ns3::Packet const >', 'p'), param('uint32_t', 'srcId')])
## csma-channel.h (module 'csma'): bool ns3::CsmaChannel::TransmitEnd() [member function]
cls.add_method('TransmitEnd',
'bool',
[])
## csma-channel.h (module 'csma'): void ns3::CsmaChannel::PropagationCompleteEvent() [member function]
cls.add_method('PropagationCompleteEvent',
'void',
[])
## csma-channel.h (module 'csma'): int32_t ns3::CsmaChannel::GetDeviceNum(ns3::Ptr<ns3::CsmaNetDevice> device) [member function]
cls.add_method('GetDeviceNum',
'int32_t',
[param('ns3::Ptr< ns3::CsmaNetDevice >', 'device')])
## csma-channel.h (module 'csma'): ns3::WireState ns3::CsmaChannel::GetState() [member function]
cls.add_method('GetState',
'ns3::WireState',
[])
## csma-channel.h (module 'csma'): bool ns3::CsmaChannel::IsBusy() [member function]
cls.add_method('IsBusy',
'bool',
[])
## csma-channel.h (module 'csma'): bool ns3::CsmaChannel::IsActive(uint32_t deviceId) [member function]
cls.add_method('IsActive',
'bool',
[param('uint32_t', 'deviceId')])
## csma-channel.h (module 'csma'): uint32_t ns3::CsmaChannel::GetNumActDevices() [member function]
cls.add_method('GetNumActDevices',
'uint32_t',
[])
## csma-channel.h (module 'csma'): std::size_t ns3::CsmaChannel::GetNDevices() const [member function]
cls.add_method('GetNDevices',
'std::size_t',
[],
is_const=True, is_virtual=True)
## csma-channel.h (module 'csma'): ns3::Ptr<ns3::NetDevice> ns3::CsmaChannel::GetDevice(std::size_t i) const [member function]
cls.add_method('GetDevice',
'ns3::Ptr< ns3::NetDevice >',
[param('std::size_t', 'i')],
is_const=True, is_virtual=True)
## csma-channel.h (module 'csma'): ns3::Ptr<ns3::CsmaNetDevice> ns3::CsmaChannel::GetCsmaDevice(std::size_t i) const [member function]
cls.add_method('GetCsmaDevice',
'ns3::Ptr< ns3::CsmaNetDevice >',
[param('std::size_t', 'i')],
is_const=True)
## csma-channel.h (module 'csma'): ns3::DataRate ns3::CsmaChannel::GetDataRate() [member function]
cls.add_method('GetDataRate',
'ns3::DataRate',
[])
## csma-channel.h (module 'csma'): ns3::Time ns3::CsmaChannel::GetDelay() [member function]
cls.add_method('GetDelay',
'ns3::Time',
[])
return
def register_Ns3DataRateChecker_methods(root_module, cls):
## data-rate.h (module 'network'): ns3::DataRateChecker::DataRateChecker() [constructor]
cls.add_constructor([])
## data-rate.h (module 'network'): ns3::DataRateChecker::DataRateChecker(ns3::DataRateChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::DataRateChecker const &', 'arg0')])
return
def register_Ns3DataRateValue_methods(root_module, cls):
## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue() [constructor]
cls.add_constructor([])
## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue(ns3::DataRate const & value) [constructor]
cls.add_constructor([param('ns3::DataRate const &', 'value')])
## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue(ns3::DataRateValue const & arg0) [constructor]
cls.add_constructor([param('ns3::DataRateValue const &', 'arg0')])
## data-rate.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::DataRateValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## data-rate.h (module 'network'): bool ns3::DataRateValue::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)
## data-rate.h (module 'network'): ns3::DataRate ns3::DataRateValue::Get() const [member function]
cls.add_method('Get',
'ns3::DataRate',
[],
is_const=True)
## data-rate.h (module 'network'): std::string ns3::DataRateValue::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)
## data-rate.h (module 'network'): void ns3::DataRateValue::Set(ns3::DataRate const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::DataRate const &', 'value')])
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_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')],
is_virtual=True, visibility='private')
## random-variable-stream.h (module 'core'): void ns3::EmpiricalRandomVariable::Validate() [member function]
cls.add_method('Validate',
'void',
[],
is_virtual=True, visibility='private')
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, is_virtual=True, visibility='private')
## 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')],
is_virtual=True, visibility='private')
## 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, is_virtual=True, visibility='private')
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_Ns3ErrorModel_methods(root_module, cls):
## error-model.h (module 'network'): ns3::ErrorModel::ErrorModel(ns3::ErrorModel const & arg0) [constructor]
cls.add_constructor([param('ns3::ErrorModel const &', 'arg0')])
## error-model.h (module 'network'): ns3::ErrorModel::ErrorModel() [constructor]
cls.add_constructor([])
## error-model.h (module 'network'): void ns3::ErrorModel::Disable() [member function]
cls.add_method('Disable',
'void',
[])
## error-model.h (module 'network'): void ns3::ErrorModel::Enable() [member function]
cls.add_method('Enable',
'void',
[])
## error-model.h (module 'network'): static ns3::TypeId ns3::ErrorModel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## error-model.h (module 'network'): bool ns3::ErrorModel::IsCorrupt(ns3::Ptr<ns3::Packet> pkt) [member function]
cls.add_method('IsCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'pkt')])
## error-model.h (module 'network'): bool ns3::ErrorModel::IsEnabled() const [member function]
cls.add_method('IsEnabled',
'bool',
[],
is_const=True)
## error-model.h (module 'network'): void ns3::ErrorModel::Reset() [member function]
cls.add_method('Reset',
'void',
[])
## error-model.h (module 'network'): bool ns3::ErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
is_virtual=True, is_pure_virtual=True, visibility='private')
## error-model.h (module 'network'): void ns3::ErrorModel::DoReset() [member function]
cls.add_method('DoReset',
'void',
[],
is_virtual=True, is_pure_virtual=True, visibility='private')
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_virtual=True, is_pure_virtual=True, visibility='protected')
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_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_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_Ns3ListErrorModel_methods(root_module, cls):
## error-model.h (module 'network'): ns3::ListErrorModel::ListErrorModel(ns3::ListErrorModel const & arg0) [constructor]
cls.add_constructor([param('ns3::ListErrorModel const &', 'arg0')])
## error-model.h (module 'network'): ns3::ListErrorModel::ListErrorModel() [constructor]
cls.add_constructor([])
## error-model.h (module 'network'): std::list<unsigned int, std::allocator<unsigned int> > ns3::ListErrorModel::GetList() const [member function]
cls.add_method('GetList',
'std::list< unsigned int >',
[],
is_const=True)
## error-model.h (module 'network'): static ns3::TypeId ns3::ListErrorModel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## error-model.h (module 'network'): void ns3::ListErrorModel::SetList(std::list<unsigned int, std::allocator<unsigned int> > const & packetlist) [member function]
cls.add_method('SetList',
'void',
[param('std::list< unsigned int > const &', 'packetlist')])
## error-model.h (module 'network'): bool ns3::ListErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
is_virtual=True, visibility='private')
## error-model.h (module 'network'): void ns3::ListErrorModel::DoReset() [member function]
cls.add_method('DoReset',
'void',
[],
is_virtual=True, visibility='private')
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_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_virtual=True, is_pure_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetAddress() const [member function]
cls.add_method('GetAddress',
'ns3::Address',
[],
is_const=True, is_virtual=True, is_pure_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetBroadcast() const [member function]
cls.add_method('GetBroadcast',
'ns3::Address',
[],
is_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_virtual=True)
## net-device.h (module 'network'): uint32_t ns3::NetDevice::GetIfIndex() const [member function]
cls.add_method('GetIfIndex',
'uint32_t',
[],
is_const=True, is_virtual=True, is_pure_virtual=True)
## net-device.h (module 'network'): uint16_t ns3::NetDevice::GetMtu() const [member function]
cls.add_method('GetMtu',
'uint16_t',
[],
is_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_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_const=True, is_virtual=True, is_pure_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsBroadcast() const [member function]
cls.add_method('IsBroadcast',
'bool',
[],
is_const=True, is_virtual=True, is_pure_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsLinkUp() const [member function]
cls.add_method('IsLinkUp',
'bool',
[],
is_const=True, is_virtual=True, is_pure_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsMulticast() const [member function]
cls.add_method('IsMulticast',
'bool',
[],
is_const=True, is_virtual=True, is_pure_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsPointToPoint() const [member function]
cls.add_method('IsPointToPoint',
'bool',
[],
is_const=True, is_virtual=True, is_pure_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::NeedsArp() const [member function]
cls.add_method('NeedsArp',
'bool',
[],
is_const=True, is_virtual=True, is_pure_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_virtual=True, is_pure_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_virtual=True, is_pure_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_virtual=True, is_pure_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_virtual=True, is_pure_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_virtual=True, is_pure_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_virtual=True, is_pure_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_virtual=True, is_pure_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_virtual=True, is_pure_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::SupportsSendFrom() const [member function]
cls.add_method('SupportsSendFrom',
'bool',
[],
is_const=True, is_virtual=True, is_pure_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',
[],
is_virtual=True, visibility='protected')
## node.h (module 'network'): void ns3::Node::DoInitialize() [member function]
cls.add_method('DoInitialize',
'void',
[],
is_virtual=True, visibility='protected')
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_Ns3OutputStreamWrapper_methods(root_module, cls):
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(ns3::OutputStreamWrapper const & arg0) [constructor]
cls.add_constructor([param('ns3::OutputStreamWrapper const &', 'arg0')])
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(std::string filename, std::ios_base::openmode filemode) [constructor]
cls.add_constructor([param('std::string', 'filename'), param('std::ios_base::openmode', 'filemode')])
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(std::ostream * os) [constructor]
cls.add_constructor([param('std::ostream *', 'os')])
## output-stream-wrapper.h (module 'network'): std::ostream * ns3::OutputStreamWrapper::GetStream() [member function]
cls.add_method('GetStream',
'std::ostream *',
[])
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::AddByteTag(ns3::Tag const & tag, uint32_t start, uint32_t end) const [member function]
cls.add_method('AddByteTag',
'void',
[param('ns3::Tag const &', 'tag'), param('uint32_t', 'start'), param('uint32_t', 'end')],
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',
[],
is_const=True, deprecated=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_Ns3Queue__Ns3Packet_methods(root_module, cls):
## queue.h (module 'network'): static ns3::TypeId ns3::Queue<ns3::Packet>::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## queue.h (module 'network'): ns3::Queue<ns3::Packet>::Queue() [constructor]
cls.add_constructor([])
## queue.h (module 'network'): bool ns3::Queue<ns3::Packet>::Enqueue(ns3::Ptr<ns3::Packet> item) [member function]
cls.add_method('Enqueue',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'item')],
is_virtual=True, is_pure_virtual=True)
## queue.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Queue<ns3::Packet>::Dequeue() [member function]
cls.add_method('Dequeue',
'ns3::Ptr< ns3::Packet >',
[],
is_virtual=True, is_pure_virtual=True)
## queue.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Queue<ns3::Packet>::Remove() [member function]
cls.add_method('Remove',
'ns3::Ptr< ns3::Packet >',
[],
is_virtual=True, is_pure_virtual=True)
## queue.h (module 'network'): ns3::Ptr<const ns3::Packet> ns3::Queue<ns3::Packet>::Peek() const [member function]
cls.add_method('Peek',
'ns3::Ptr< ns3::Packet const >',
[],
is_const=True, is_virtual=True, is_pure_virtual=True)
## queue.h (module 'network'): void ns3::Queue<ns3::Packet>::Flush() [member function]
cls.add_method('Flush',
'void',
[])
## queue.h (module 'network'): ns3::Queue<ns3::Packet>::Queue(ns3::Queue<ns3::Packet> const & arg0) [constructor]
cls.add_constructor([param('ns3::Queue< ns3::Packet > const &', 'arg0')])
## queue.h (module 'network'): ns3::Queue<ns3::Packet>::ConstIterator ns3::Queue<ns3::Packet>::begin() const [member function]
cls.add_method('begin',
'ns3::Queue< ns3::Packet > ConstIterator',
[],
is_const=True, visibility='protected')
## queue.h (module 'network'): ns3::Queue<ns3::Packet>::Iterator ns3::Queue<ns3::Packet>::begin() [member function]
cls.add_method('begin',
'ns3::Queue< ns3::Packet > Iterator',
[],
visibility='protected')
## queue.h (module 'network'): ns3::Queue<ns3::Packet>::ConstIterator ns3::Queue<ns3::Packet>::end() const [member function]
cls.add_method('end',
'ns3::Queue< ns3::Packet > ConstIterator',
[],
is_const=True, visibility='protected')
## queue.h (module 'network'): ns3::Queue<ns3::Packet>::Iterator ns3::Queue<ns3::Packet>::end() [member function]
cls.add_method('end',
'ns3::Queue< ns3::Packet > Iterator',
[],
visibility='protected')
## queue.h (module 'network'): bool ns3::Queue<ns3::Packet>::DoEnqueue(ns3::Queue<ns3::Packet>::ConstIterator pos, ns3::Ptr<ns3::Packet> item) [member function]
cls.add_method('DoEnqueue',
'bool',
[param('std::list< ns3::Ptr< ns3::Packet > > const_iterator', 'pos'), param('ns3::Ptr< ns3::Packet >', 'item')],
visibility='protected')
## queue.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Queue<ns3::Packet>::DoDequeue(ns3::Queue<ns3::Packet>::ConstIterator pos) [member function]
cls.add_method('DoDequeue',
'ns3::Ptr< ns3::Packet >',
[param('std::list< ns3::Ptr< ns3::Packet > > const_iterator', 'pos')],
visibility='protected')
## queue.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Queue<ns3::Packet>::DoRemove(ns3::Queue<ns3::Packet>::ConstIterator pos) [member function]
cls.add_method('DoRemove',
'ns3::Ptr< ns3::Packet >',
[param('std::list< ns3::Ptr< ns3::Packet > > const_iterator', 'pos')],
visibility='protected')
## queue.h (module 'network'): ns3::Ptr<const ns3::Packet> ns3::Queue<ns3::Packet>::DoPeek(ns3::Queue<ns3::Packet>::ConstIterator pos) const [member function]
cls.add_method('DoPeek',
'ns3::Ptr< ns3::Packet const >',
[param('std::list< ns3::Ptr< ns3::Packet > > const_iterator', 'pos')],
is_const=True, visibility='protected')
## queue.h (module 'network'): void ns3::Queue<ns3::Packet>::DropBeforeEnqueue(ns3::Ptr<ns3::Packet> item) [member function]
cls.add_method('DropBeforeEnqueue',
'void',
[param('ns3::Ptr< ns3::Packet >', 'item')],
visibility='protected')
## queue.h (module 'network'): void ns3::Queue<ns3::Packet>::DropAfterDequeue(ns3::Ptr<ns3::Packet> item) [member function]
cls.add_method('DropAfterDequeue',
'void',
[param('ns3::Ptr< ns3::Packet >', 'item')],
visibility='protected')
return
def register_Ns3Queue__Ns3QueueDiscItem_methods(root_module, cls):
## queue.h (module 'network'): static ns3::TypeId ns3::Queue<ns3::QueueDiscItem>::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## queue.h (module 'network'): ns3::Queue<ns3::QueueDiscItem>::Queue() [constructor]
cls.add_constructor([])
## queue.h (module 'network'): bool ns3::Queue<ns3::QueueDiscItem>::Enqueue(ns3::Ptr<ns3::QueueDiscItem> item) [member function]
cls.add_method('Enqueue',
'bool',
[param('ns3::Ptr< ns3::QueueDiscItem >', 'item')],
is_virtual=True, is_pure_virtual=True)
## queue.h (module 'network'): ns3::Ptr<ns3::QueueDiscItem> ns3::Queue<ns3::QueueDiscItem>::Dequeue() [member function]
cls.add_method('Dequeue',
'ns3::Ptr< ns3::QueueDiscItem >',
[],
is_virtual=True, is_pure_virtual=True)
## queue.h (module 'network'): ns3::Ptr<ns3::QueueDiscItem> ns3::Queue<ns3::QueueDiscItem>::Remove() [member function]
cls.add_method('Remove',
'ns3::Ptr< ns3::QueueDiscItem >',
[],
is_virtual=True, is_pure_virtual=True)
## queue.h (module 'network'): ns3::Ptr<const ns3::QueueDiscItem> ns3::Queue<ns3::QueueDiscItem>::Peek() const [member function]
cls.add_method('Peek',
'ns3::Ptr< ns3::QueueDiscItem const >',
[],
is_const=True, is_virtual=True, is_pure_virtual=True)
## queue.h (module 'network'): void ns3::Queue<ns3::QueueDiscItem>::Flush() [member function]
cls.add_method('Flush',
'void',
[])
## queue.h (module 'network'): ns3::Queue<ns3::QueueDiscItem>::Queue(ns3::Queue<ns3::QueueDiscItem> const & arg0) [constructor]
cls.add_constructor([param('ns3::Queue< ns3::QueueDiscItem > const &', 'arg0')])
## queue.h (module 'network'): ns3::Queue<ns3::QueueDiscItem>::ConstIterator ns3::Queue<ns3::QueueDiscItem>::begin() const [member function]
cls.add_method('begin',
'ns3::Queue< ns3::QueueDiscItem > ConstIterator',
[],
is_const=True, visibility='protected')
## queue.h (module 'network'): ns3::Queue<ns3::QueueDiscItem>::Iterator ns3::Queue<ns3::QueueDiscItem>::begin() [member function]
cls.add_method('begin',
'ns3::Queue< ns3::QueueDiscItem > Iterator',
[],
visibility='protected')
## queue.h (module 'network'): ns3::Queue<ns3::QueueDiscItem>::ConstIterator ns3::Queue<ns3::QueueDiscItem>::end() const [member function]
cls.add_method('end',
'ns3::Queue< ns3::QueueDiscItem > ConstIterator',
[],
is_const=True, visibility='protected')
## queue.h (module 'network'): ns3::Queue<ns3::QueueDiscItem>::Iterator ns3::Queue<ns3::QueueDiscItem>::end() [member function]
cls.add_method('end',
'ns3::Queue< ns3::QueueDiscItem > Iterator',
[],
visibility='protected')
## queue.h (module 'network'): bool ns3::Queue<ns3::QueueDiscItem>::DoEnqueue(ns3::Queue<ns3::QueueDiscItem>::ConstIterator pos, ns3::Ptr<ns3::QueueDiscItem> item) [member function]
cls.add_method('DoEnqueue',
'bool',
[param('std::list< ns3::Ptr< ns3::QueueDiscItem > > const_iterator', 'pos'), param('ns3::Ptr< ns3::QueueDiscItem >', 'item')],
visibility='protected')
## queue.h (module 'network'): ns3::Ptr<ns3::QueueDiscItem> ns3::Queue<ns3::QueueDiscItem>::DoDequeue(ns3::Queue<ns3::QueueDiscItem>::ConstIterator pos) [member function]
cls.add_method('DoDequeue',
'ns3::Ptr< ns3::QueueDiscItem >',
[param('std::list< ns3::Ptr< ns3::QueueDiscItem > > const_iterator', 'pos')],
visibility='protected')
## queue.h (module 'network'): ns3::Ptr<ns3::QueueDiscItem> ns3::Queue<ns3::QueueDiscItem>::DoRemove(ns3::Queue<ns3::QueueDiscItem>::ConstIterator pos) [member function]
cls.add_method('DoRemove',
'ns3::Ptr< ns3::QueueDiscItem >',
[param('std::list< ns3::Ptr< ns3::QueueDiscItem > > const_iterator', 'pos')],
visibility='protected')
## queue.h (module 'network'): ns3::Ptr<const ns3::QueueDiscItem> ns3::Queue<ns3::QueueDiscItem>::DoPeek(ns3::Queue<ns3::QueueDiscItem>::ConstIterator pos) const [member function]
cls.add_method('DoPeek',
'ns3::Ptr< ns3::QueueDiscItem const >',
[param('std::list< ns3::Ptr< ns3::QueueDiscItem > > const_iterator', 'pos')],
is_const=True, visibility='protected')
## queue.h (module 'network'): void ns3::Queue<ns3::QueueDiscItem>::DropBeforeEnqueue(ns3::Ptr<ns3::QueueDiscItem> item) [member function]
cls.add_method('DropBeforeEnqueue',
'void',
[param('ns3::Ptr< ns3::QueueDiscItem >', 'item')],
visibility='protected')
## queue.h (module 'network'): void ns3::Queue<ns3::QueueDiscItem>::DropAfterDequeue(ns3::Ptr<ns3::QueueDiscItem> item) [member function]
cls.add_method('DropAfterDequeue',
'void',
[param('ns3::Ptr< ns3::QueueDiscItem >', 'item')],
visibility='protected')
return
def register_Ns3QueueItem_methods(root_module, cls):
cls.add_output_stream_operator()
## queue-item.h (module 'network'): ns3::QueueItem::QueueItem(ns3::Ptr<ns3::Packet> p) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Packet >', 'p')])
## queue-item.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::QueueItem::GetPacket() const [member function]
cls.add_method('GetPacket',
'ns3::Ptr< ns3::Packet >',
[],
is_const=True)
## queue-item.h (module 'network'): uint32_t ns3::QueueItem::GetSize() const [member function]
cls.add_method('GetSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## queue-item.h (module 'network'): bool ns3::QueueItem::GetUint8Value(ns3::QueueItem::Uint8Values field, uint8_t & value) const [member function]
cls.add_method('GetUint8Value',
'bool',
[param('ns3::QueueItem::Uint8Values', 'field'), param('uint8_t &', 'value')],
is_const=True, is_virtual=True)
## queue-item.h (module 'network'): void ns3::QueueItem::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
return
def register_Ns3QueueSizeChecker_methods(root_module, cls):
## queue-size.h (module 'network'): ns3::QueueSizeChecker::QueueSizeChecker() [constructor]
cls.add_constructor([])
## queue-size.h (module 'network'): ns3::QueueSizeChecker::QueueSizeChecker(ns3::QueueSizeChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::QueueSizeChecker const &', 'arg0')])
return
def register_Ns3QueueSizeValue_methods(root_module, cls):
## queue-size.h (module 'network'): ns3::QueueSizeValue::QueueSizeValue() [constructor]
cls.add_constructor([])
## queue-size.h (module 'network'): ns3::QueueSizeValue::QueueSizeValue(ns3::QueueSize const & value) [constructor]
cls.add_constructor([param('ns3::QueueSize const &', 'value')])
## queue-size.h (module 'network'): ns3::QueueSizeValue::QueueSizeValue(ns3::QueueSizeValue const & arg0) [constructor]
cls.add_constructor([param('ns3::QueueSizeValue const &', 'arg0')])
## queue-size.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::QueueSizeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## queue-size.h (module 'network'): bool ns3::QueueSizeValue::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)
## queue-size.h (module 'network'): ns3::QueueSize ns3::QueueSizeValue::Get() const [member function]
cls.add_method('Get',
'ns3::QueueSize',
[],
is_const=True)
## queue-size.h (module 'network'): std::string ns3::QueueSizeValue::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)
## queue-size.h (module 'network'): void ns3::QueueSizeValue::Set(ns3::QueueSize const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::QueueSize const &', 'value')])
return
def register_Ns3RateErrorModel_methods(root_module, cls):
## error-model.h (module 'network'): ns3::RateErrorModel::RateErrorModel(ns3::RateErrorModel const & arg0) [constructor]
cls.add_constructor([param('ns3::RateErrorModel const &', 'arg0')])
## error-model.h (module 'network'): ns3::RateErrorModel::RateErrorModel() [constructor]
cls.add_constructor([])
## error-model.h (module 'network'): int64_t ns3::RateErrorModel::AssignStreams(int64_t stream) [member function]
cls.add_method('AssignStreams',
'int64_t',
[param('int64_t', 'stream')])
## error-model.h (module 'network'): double ns3::RateErrorModel::GetRate() const [member function]
cls.add_method('GetRate',
'double',
[],
is_const=True)
## error-model.h (module 'network'): static ns3::TypeId ns3::RateErrorModel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## error-model.h (module 'network'): ns3::RateErrorModel::ErrorUnit ns3::RateErrorModel::GetUnit() const [member function]
cls.add_method('GetUnit',
'ns3::RateErrorModel::ErrorUnit',
[],
is_const=True)
## error-model.h (module 'network'): void ns3::RateErrorModel::SetRandomVariable(ns3::Ptr<ns3::RandomVariableStream> arg0) [member function]
cls.add_method('SetRandomVariable',
'void',
[param('ns3::Ptr< ns3::RandomVariableStream >', 'arg0')])
## error-model.h (module 'network'): void ns3::RateErrorModel::SetRate(double rate) [member function]
cls.add_method('SetRate',
'void',
[param('double', 'rate')])
## error-model.h (module 'network'): void ns3::RateErrorModel::SetUnit(ns3::RateErrorModel::ErrorUnit error_unit) [member function]
cls.add_method('SetUnit',
'void',
[param('ns3::RateErrorModel::ErrorUnit', 'error_unit')])
## error-model.h (module 'network'): bool ns3::RateErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
is_virtual=True, visibility='private')
## error-model.h (module 'network'): bool ns3::RateErrorModel::DoCorruptBit(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorruptBit',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
is_virtual=True, visibility='private')
## error-model.h (module 'network'): bool ns3::RateErrorModel::DoCorruptByte(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorruptByte',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
is_virtual=True, visibility='private')
## error-model.h (module 'network'): bool ns3::RateErrorModel::DoCorruptPkt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorruptPkt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
is_virtual=True, visibility='private')
## error-model.h (module 'network'): void ns3::RateErrorModel::DoReset() [member function]
cls.add_method('DoReset',
'void',
[],
is_virtual=True, visibility='private')
return
def register_Ns3ReceiveListErrorModel_methods(root_module, cls):
## error-model.h (module 'network'): ns3::ReceiveListErrorModel::ReceiveListErrorModel(ns3::ReceiveListErrorModel const & arg0) [constructor]
cls.add_constructor([param('ns3::ReceiveListErrorModel const &', 'arg0')])
## error-model.h (module 'network'): ns3::ReceiveListErrorModel::ReceiveListErrorModel() [constructor]
cls.add_constructor([])
## error-model.h (module 'network'): std::list<unsigned int, std::allocator<unsigned int> > ns3::ReceiveListErrorModel::GetList() const [member function]
cls.add_method('GetList',
'std::list< unsigned int >',
[],
is_const=True)
## error-model.h (module 'network'): static ns3::TypeId ns3::ReceiveListErrorModel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## error-model.h (module 'network'): void ns3::ReceiveListErrorModel::SetList(std::list<unsigned int, std::allocator<unsigned int> > const & packetlist) [member function]
cls.add_method('SetList',
'void',
[param('std::list< unsigned int > const &', 'packetlist')])
## error-model.h (module 'network'): bool ns3::ReceiveListErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
is_virtual=True, visibility='private')
## error-model.h (module 'network'): void ns3::ReceiveListErrorModel::DoReset() [member function]
cls.add_method('DoReset',
'void',
[],
is_virtual=True, visibility='private')
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_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_Ns3BinaryErrorModel_methods(root_module, cls):
## error-model.h (module 'network'): ns3::BinaryErrorModel::BinaryErrorModel(ns3::BinaryErrorModel const & arg0) [constructor]
cls.add_constructor([param('ns3::BinaryErrorModel const &', 'arg0')])
## error-model.h (module 'network'): ns3::BinaryErrorModel::BinaryErrorModel() [constructor]
cls.add_constructor([])
## error-model.h (module 'network'): static ns3::TypeId ns3::BinaryErrorModel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## error-model.h (module 'network'): bool ns3::BinaryErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
is_virtual=True, visibility='private')
## error-model.h (module 'network'): void ns3::BinaryErrorModel::DoReset() [member function]
cls.add_method('DoReset',
'void',
[],
is_virtual=True, visibility='private')
return
def register_Ns3BurstErrorModel_methods(root_module, cls):
## error-model.h (module 'network'): ns3::BurstErrorModel::BurstErrorModel(ns3::BurstErrorModel const & arg0) [constructor]
cls.add_constructor([param('ns3::BurstErrorModel const &', 'arg0')])
## error-model.h (module 'network'): ns3::BurstErrorModel::BurstErrorModel() [constructor]
cls.add_constructor([])
## error-model.h (module 'network'): int64_t ns3::BurstErrorModel::AssignStreams(int64_t stream) [member function]
cls.add_method('AssignStreams',
'int64_t',
[param('int64_t', 'stream')])
## error-model.h (module 'network'): double ns3::BurstErrorModel::GetBurstRate() const [member function]
cls.add_method('GetBurstRate',
'double',
[],
is_const=True)
## error-model.h (module 'network'): static ns3::TypeId ns3::BurstErrorModel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## error-model.h (module 'network'): void ns3::BurstErrorModel::SetBurstRate(double rate) [member function]
cls.add_method('SetBurstRate',
'void',
[param('double', 'rate')])
## error-model.h (module 'network'): void ns3::BurstErrorModel::SetRandomBurstSize(ns3::Ptr<ns3::RandomVariableStream> burstSz) [member function]
cls.add_method('SetRandomBurstSize',
'void',
[param('ns3::Ptr< ns3::RandomVariableStream >', 'burstSz')])
## error-model.h (module 'network'): void ns3::BurstErrorModel::SetRandomVariable(ns3::Ptr<ns3::RandomVariableStream> ranVar) [member function]
cls.add_method('SetRandomVariable',
'void',
[param('ns3::Ptr< ns3::RandomVariableStream >', 'ranVar')])
## error-model.h (module 'network'): bool ns3::BurstErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
is_virtual=True, visibility='private')
## error-model.h (module 'network'): void ns3::BurstErrorModel::DoReset() [member function]
cls.add_method('DoReset',
'void',
[],
is_virtual=True, visibility='private')
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 *',
[],
custom_name='__call__', is_virtual=True, is_pure_virtual=True)
return
def register_Ns3CallbackImpl__Void_Ns3Ptr__lt__const_ns3Packet__gt___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<const ns3::Packet>, 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<const ns3::Packet>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, ns3::Ptr<const ns3::Packet>, 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::Packet 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, ns3::Ptr<const ns3::Packet>, 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<const ns3::Packet>, 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<const ns3::Packet>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ptr<const ns3::Packet> arg0) [member operator]
cls.add_method('operator()',
'void',
[param('ns3::Ptr< ns3::Packet const >', 'arg0')],
custom_name='__call__', is_virtual=True, is_pure_virtual=True)
return
def register_Ns3CallbackImpl__Void_Ns3Ptr__lt__const_ns3QueueDiscItem__gt___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<const ns3::QueueDiscItem>, 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<const ns3::QueueDiscItem>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, ns3::Ptr<const ns3::QueueDiscItem>, 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::QueueDiscItem 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, ns3::Ptr<const ns3::QueueDiscItem>, 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<const ns3::QueueDiscItem>, 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<const ns3::QueueDiscItem>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ptr<const ns3::QueueDiscItem> arg0) [member operator]
cls.add_method('operator()',
'void',
[param('ns3::Ptr< ns3::QueueDiscItem const >', 'arg0')],
custom_name='__call__', is_virtual=True, is_pure_virtual=True)
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')],
custom_name='__call__', is_virtual=True, is_pure_virtual=True)
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')],
custom_name='__call__', is_virtual=True, is_pure_virtual=True)
return
def register_Ns3CallbackImpl__Void_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, 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<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, 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< void, 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<void, 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<void, 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'): void ns3::CallbackImpl<void, 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()',
'void',
[],
custom_name='__call__', is_virtual=True, is_pure_virtual=True)
return
def register_Ns3CallbackImpl__Void_Unsigned_int_Unsigned_int_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, unsigned int, 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, unsigned int, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, unsigned int, 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, unsigned int, 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, unsigned int, 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, unsigned int, 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, unsigned int, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(unsigned int arg0, unsigned int arg1) [member operator]
cls.add_method('operator()',
'void',
[param('unsigned int', 'arg0'), param('unsigned int', 'arg1')],
custom_name='__call__', is_virtual=True, is_pure_virtual=True)
return
def register_Ns3CsmaNetDevice_methods(root_module, cls):
## csma-net-device.h (module 'csma'): static ns3::TypeId ns3::CsmaNetDevice::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## csma-net-device.h (module 'csma'): ns3::CsmaNetDevice::CsmaNetDevice() [constructor]
cls.add_constructor([])
## csma-net-device.h (module 'csma'): void ns3::CsmaNetDevice::SetInterframeGap(ns3::Time t) [member function]
cls.add_method('SetInterframeGap',
'void',
[param('ns3::Time', 't')])
## csma-net-device.h (module 'csma'): void ns3::CsmaNetDevice::SetBackoffParams(ns3::Time slotTime, uint32_t minSlots, uint32_t maxSlots, uint32_t maxRetries, uint32_t ceiling) [member function]
cls.add_method('SetBackoffParams',
'void',
[param('ns3::Time', 'slotTime'), param('uint32_t', 'minSlots'), param('uint32_t', 'maxSlots'), param('uint32_t', 'maxRetries'), param('uint32_t', 'ceiling')])
## csma-net-device.h (module 'csma'): bool ns3::CsmaNetDevice::Attach(ns3::Ptr<ns3::CsmaChannel> ch) [member function]
cls.add_method('Attach',
'bool',
[param('ns3::Ptr< ns3::CsmaChannel >', 'ch')])
## csma-net-device.h (module 'csma'): void ns3::CsmaNetDevice::SetQueue(ns3::Ptr<ns3::Queue<ns3::Packet> > queue) [member function]
cls.add_method('SetQueue',
'void',
[param('ns3::Ptr< ns3::Queue< ns3::Packet > >', 'queue')])
## csma-net-device.h (module 'csma'): ns3::Ptr<ns3::Queue<ns3::Packet> > ns3::CsmaNetDevice::GetQueue() const [member function]
cls.add_method('GetQueue',
'ns3::Ptr< ns3::Queue< ns3::Packet > >',
[],
is_const=True)
## csma-net-device.h (module 'csma'): void ns3::CsmaNetDevice::SetReceiveErrorModel(ns3::Ptr<ns3::ErrorModel> em) [member function]
cls.add_method('SetReceiveErrorModel',
'void',
[param('ns3::Ptr< ns3::ErrorModel >', 'em')])
## csma-net-device.h (module 'csma'): void ns3::CsmaNetDevice::Receive(ns3::Ptr<ns3::Packet> p, ns3::Ptr<ns3::CsmaNetDevice> sender) [member function]
cls.add_method('Receive',
'void',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ptr< ns3::CsmaNetDevice >', 'sender')])
## csma-net-device.h (module 'csma'): bool ns3::CsmaNetDevice::IsSendEnabled() [member function]
cls.add_method('IsSendEnabled',
'bool',
[])
## csma-net-device.h (module 'csma'): void ns3::CsmaNetDevice::SetSendEnable(bool enable) [member function]
cls.add_method('SetSendEnable',
'void',
[param('bool', 'enable')])
## csma-net-device.h (module 'csma'): bool ns3::CsmaNetDevice::IsReceiveEnabled() [member function]
cls.add_method('IsReceiveEnabled',
'bool',
[])
## csma-net-device.h (module 'csma'): void ns3::CsmaNetDevice::SetReceiveEnable(bool enable) [member function]
cls.add_method('SetReceiveEnable',
'void',
[param('bool', 'enable')])
## csma-net-device.h (module 'csma'): void ns3::CsmaNetDevice::SetEncapsulationMode(ns3::CsmaNetDevice::EncapsulationMode mode) [member function]
cls.add_method('SetEncapsulationMode',
'void',
[param('ns3::CsmaNetDevice::EncapsulationMode', 'mode')])
## csma-net-device.h (module 'csma'): ns3::CsmaNetDevice::EncapsulationMode ns3::CsmaNetDevice::GetEncapsulationMode() [member function]
cls.add_method('GetEncapsulationMode',
'ns3::CsmaNetDevice::EncapsulationMode',
[])
## csma-net-device.h (module 'csma'): void ns3::CsmaNetDevice::SetIfIndex(uint32_t const index) [member function]
cls.add_method('SetIfIndex',
'void',
[param('uint32_t const', 'index')],
is_virtual=True)
## csma-net-device.h (module 'csma'): uint32_t ns3::CsmaNetDevice::GetIfIndex() const [member function]
cls.add_method('GetIfIndex',
'uint32_t',
[],
is_const=True, is_virtual=True)
## csma-net-device.h (module 'csma'): ns3::Ptr<ns3::Channel> ns3::CsmaNetDevice::GetChannel() const [member function]
cls.add_method('GetChannel',
'ns3::Ptr< ns3::Channel >',
[],
is_const=True, is_virtual=True)
## csma-net-device.h (module 'csma'): bool ns3::CsmaNetDevice::SetMtu(uint16_t const mtu) [member function]
cls.add_method('SetMtu',
'bool',
[param('uint16_t const', 'mtu')],
is_virtual=True)
## csma-net-device.h (module 'csma'): uint16_t ns3::CsmaNetDevice::GetMtu() const [member function]
cls.add_method('GetMtu',
'uint16_t',
[],
is_const=True, is_virtual=True)
## csma-net-device.h (module 'csma'): void ns3::CsmaNetDevice::SetAddress(ns3::Address address) [member function]
cls.add_method('SetAddress',
'void',
[param('ns3::Address', 'address')],
is_virtual=True)
## csma-net-device.h (module 'csma'): ns3::Address ns3::CsmaNetDevice::GetAddress() const [member function]
cls.add_method('GetAddress',
'ns3::Address',
[],
is_const=True, is_virtual=True)
## csma-net-device.h (module 'csma'): bool ns3::CsmaNetDevice::IsLinkUp() const [member function]
cls.add_method('IsLinkUp',
'bool',
[],
is_const=True, is_virtual=True)
## csma-net-device.h (module 'csma'): void ns3::CsmaNetDevice::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_virtual=True)
## csma-net-device.h (module 'csma'): bool ns3::CsmaNetDevice::IsBroadcast() const [member function]
cls.add_method('IsBroadcast',
'bool',
[],
is_const=True, is_virtual=True)
## csma-net-device.h (module 'csma'): ns3::Address ns3::CsmaNetDevice::GetBroadcast() const [member function]
cls.add_method('GetBroadcast',
'ns3::Address',
[],
is_const=True, is_virtual=True)
## csma-net-device.h (module 'csma'): bool ns3::CsmaNetDevice::IsMulticast() const [member function]
cls.add_method('IsMulticast',
'bool',
[],
is_const=True, is_virtual=True)
## csma-net-device.h (module 'csma'): ns3::Address ns3::CsmaNetDevice::GetMulticast(ns3::Ipv4Address multicastGroup) const [member function]
cls.add_method('GetMulticast',
'ns3::Address',
[param('ns3::Ipv4Address', 'multicastGroup')],
is_const=True, is_virtual=True)
## csma-net-device.h (module 'csma'): bool ns3::CsmaNetDevice::IsPointToPoint() const [member function]
cls.add_method('IsPointToPoint',
'bool',
[],
is_const=True, is_virtual=True)
## csma-net-device.h (module 'csma'): bool ns3::CsmaNetDevice::IsBridge() const [member function]
cls.add_method('IsBridge',
'bool',
[],
is_const=True, is_virtual=True)
## csma-net-device.h (module 'csma'): bool ns3::CsmaNetDevice::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_virtual=True)
## csma-net-device.h (module 'csma'): bool ns3::CsmaNetDevice::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_virtual=True)
## csma-net-device.h (module 'csma'): ns3::Ptr<ns3::Node> ns3::CsmaNetDevice::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_const=True, is_virtual=True)
## csma-net-device.h (module 'csma'): void ns3::CsmaNetDevice::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_virtual=True)
## csma-net-device.h (module 'csma'): bool ns3::CsmaNetDevice::NeedsArp() const [member function]
cls.add_method('NeedsArp',
'bool',
[],
is_const=True, is_virtual=True)
## csma-net-device.h (module 'csma'): void ns3::CsmaNetDevice::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_virtual=True)
## csma-net-device.h (module 'csma'): ns3::Address ns3::CsmaNetDevice::GetMulticast(ns3::Ipv6Address addr) const [member function]
cls.add_method('GetMulticast',
'ns3::Address',
[param('ns3::Ipv6Address', 'addr')],
is_const=True, is_virtual=True)
## csma-net-device.h (module 'csma'): void ns3::CsmaNetDevice::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_virtual=True)
## csma-net-device.h (module 'csma'): bool ns3::CsmaNetDevice::SupportsSendFrom() const [member function]
cls.add_method('SupportsSendFrom',
'bool',
[],
is_const=True, is_virtual=True)
## csma-net-device.h (module 'csma'): int64_t ns3::CsmaNetDevice::AssignStreams(int64_t stream) [member function]
cls.add_method('AssignStreams',
'int64_t',
[param('int64_t', 'stream')])
## csma-net-device.h (module 'csma'): void ns3::CsmaNetDevice::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
is_virtual=True, visibility='protected')
## csma-net-device.h (module 'csma'): void ns3::CsmaNetDevice::AddHeader(ns3::Ptr<ns3::Packet> p, ns3::Mac48Address source, ns3::Mac48Address dest, uint16_t protocolNumber) [member function]
cls.add_method('AddHeader',
'void',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Mac48Address', 'source'), param('ns3::Mac48Address', 'dest'), param('uint16_t', 'protocolNumber')],
visibility='protected')
return
def register_Ns3QueueDiscItem_methods(root_module, cls):
## queue-item.h (module 'network'): ns3::QueueDiscItem::QueueDiscItem(ns3::Ptr<ns3::Packet> p, ns3::Address const & addr, uint16_t protocol) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Address const &', 'addr'), param('uint16_t', 'protocol')])
## queue-item.h (module 'network'): ns3::Address ns3::QueueDiscItem::GetAddress() const [member function]
cls.add_method('GetAddress',
'ns3::Address',
[],
is_const=True)
## queue-item.h (module 'network'): uint16_t ns3::QueueDiscItem::GetProtocol() const [member function]
cls.add_method('GetProtocol',
'uint16_t',
[],
is_const=True)
## queue-item.h (module 'network'): uint8_t ns3::QueueDiscItem::GetTxQueueIndex() const [member function]
cls.add_method('GetTxQueueIndex',
'uint8_t',
[],
is_const=True)
## queue-item.h (module 'network'): void ns3::QueueDiscItem::SetTxQueueIndex(uint8_t txq) [member function]
cls.add_method('SetTxQueueIndex',
'void',
[param('uint8_t', 'txq')])
## queue-item.h (module 'network'): ns3::Time ns3::QueueDiscItem::GetTimeStamp() const [member function]
cls.add_method('GetTimeStamp',
'ns3::Time',
[],
is_const=True)
## queue-item.h (module 'network'): void ns3::QueueDiscItem::SetTimeStamp(ns3::Time t) [member function]
cls.add_method('SetTimeStamp',
'void',
[param('ns3::Time', 't')])
## queue-item.h (module 'network'): void ns3::QueueDiscItem::AddHeader() [member function]
cls.add_method('AddHeader',
'void',
[],
is_virtual=True, is_pure_virtual=True)
## queue-item.h (module 'network'): void ns3::QueueDiscItem::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## queue-item.h (module 'network'): bool ns3::QueueDiscItem::Mark() [member function]
cls.add_method('Mark',
'bool',
[],
is_virtual=True, is_pure_virtual=True)
## queue-item.h (module 'network'): uint32_t ns3::QueueDiscItem::Hash(uint32_t perturbation=0) const [member function]
cls.add_method('Hash',
'uint32_t',
[param('uint32_t', 'perturbation', default_value='0')],
is_const=True, is_virtual=True)
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_virtual=True, is_pure_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_virtual=True, is_pure_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()
|
hanyassasa87/ns3-802.11ad
|
src/csma/bindings/modulegen__gcc_LP64.py
|
Python
|
gpl-2.0
| 475,193
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2017-2022 F4PGA 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.
#
# SPDX-License-Identifier: Apache-2.0
# SymbiFlow V2X documentation build configuration file, created by
# sphinx-quickstart on Mon Feb 5 11:04:37 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import re
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.doctest',
'sphinx.ext.imgmath',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx_markdown_tables',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
source_suffix = ['.rst', '.md']
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'SymbiFlow FPGA Assembly (FASM)'
copyright = u'2018, SymbiFlow Team'
author = u'SymbiFlow Team'
# Enable github links when not on readthedocs
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd:
html_context = {
"display_github": True, # Integrate GitHub
"github_user": "symbiflow", # Username
"github_repo": "fasm", # Repo name
"github_version": "master", # Version
"conf_py_path": "/docs/",
}
else:
docs_dir = os.path.abspath(os.path.dirname(__file__))
print("Docs dir is:", docs_dir)
import subprocess
subprocess.call('git fetch origin --unshallow', cwd=docs_dir, shell=True)
subprocess.check_call('git fetch origin --tags', cwd=docs_dir, shell=True)
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The full version, including alpha/beta/rc tags.
release = re.sub('^v', '', os.popen('git describe').read().strip())
# The short X.Y version.
version = release
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'env', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'default'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_symbiflow_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
html_theme_options = {
'repo_name': 'SymbiFlow/fasm',
'github_url': 'https://github.com/SymbiFlow/fasm',
}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
]
}
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'symbiflow-fasm'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(
master_doc,
'fasm.tex',
u'SymbiFlow FASM Documentation',
u'SymbiFlow Team',
'manual',
),
]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(
master_doc,
'symbiflow-fasm',
u'SymbiFlow FASM Documentation',
[author],
1,
),
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(
master_doc,
'SymbiFlowFASM',
u'SymbiFlow FASM Documentation',
author,
'SymbiFlowFASM',
'One line description of project.',
'Miscellaneous',
),
]
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
def setup(app):
pass
|
SymbiFlow/fasm
|
docs/conf.py
|
Python
|
isc
| 7,055
|
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from apps.employees import ajax
from . import views
urlpatterns = (
url(r'^home/$', login_required(views.home), name="employee_home_redirect"),
url(r'^(?P<pk>[\d]+)/$', login_required(views.EmployeeDetail.as_view()), name="employee_detail"),
url(r'^schedule/add$', login_required(views.ScheduleAdd.as_view()), name="employee_schedule_add"),
url(r'^schedule/$', login_required(views.schedule), name="employee_schedule"),
url(r'^admin/$', login_required(views.EmployeeAdminPanel.as_view()), name="employee_admin"),
url(r'^sub-board/$', login_required(views.SubBoard.as_view()), name="sub_board"),
url(r'^ajax/take_slip/$', login_required(ajax.SubSlipAjax.as_view()), name="take_slip"),
)
|
lmann4/cis526-final-project
|
resource_management/apps/employees/urls.py
|
Python
|
mit
| 807
|
#!/usr/bin/env python
## \file tools.py
# \brief mesh functions
# \author Trent Lukaczyk, Aerospace Design Laboratory (Stanford University) <http://su2.stanford.edu>.
# \version 2.0.6
#
# Stanford University Unstructured (SU2) Code
# Copyright (C) 2012 Aerospace Design Laboratory
#
# 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/>.
# -------------------------------------------------------------------
# Imports
# -------------------------------------------------------------------
import numpy as np
# ----------------------------------------------------------------------
# Read SU2 Mesh File
# ----------------------------------------------------------------------
def read(filename,scale=1.0):
''' imports mesh and builds python dictionary structure
input: filename
scale: apply scaling factor (optional)
output:
meshdata mesh data dictionary
meshdata['NDIME'] number of dimensions
meshdata['NELEM'] number of elements
meshdata['ELEM'] element array [ type, nodes, index ]
meshdata['NPOIN'] number of points
meshdata['NMARK'] number of markers
meshdata['MARKS'] marker data dictionary
meshdata['MARKS']['tag_name'] marker data for 'tag_name'
meshdata['MARKS']['tag_name']['NELEM'] number of elements
meshdata['MARKS']['tag_name']['ELEM'] element array [type,nodes]
'''
# initialize variables
data = {}
marks = {}
# open meshfile
meshfile = open(filename,'r')
# scan file until end of file
keepon = True
while keepon:
# read line
line = meshfile.readline()
line = line.replace('\t',' ')
line = line.replace('\n',' ')
# stop if line is empty
if not line:
keepon = False
# skip comments
elif line[0] == "%":
pass
# number of dimensions
elif "NDIME=" in line:
# save to SU2_MESH data
data['NDIME'] = int( line.split("=")[1].strip() )
#:if NDIME
# elements
elif "NELEM=" in line:
# number of elements
nelem = long( line.split("=")[1].strip() )
# save to SU2_MESH data
data['NELEM'] = nelem
# element data list
elem = []
# scan next lines for element data
for ielem in range(nelem):
# read line
line = meshfile.readline()
# split line, convert to long ints
thiselem = map(long, line.split() )
# add to element list
elem = elem + [thiselem]
# save to SU2_MESH data
data['ELEM'] = elem
#: if NELEM
# points
elif "NPOIN=" in line:
npoin = long( line.split("=")[1].strip().split(' ')[0] )
# save to SU2_MESH data
data['NPOIN'] = npoin
# point data list
poin = []
#scan next lines for point data
for ipoin in range(npoin):
# read line
line = meshfile.readline()
# split line, convert to long ints
thispoin = [float(x)*scale for x in line.split() ]
# add to point list
poin = poin + [thispoin]
# save to SU2_MESH data
data['POIN'] = poin
#:if NPOIN
# number of markers
elif "NMARK=" in line:
nmark = long( line.split("=")[1].strip() )
# save to SU2_MESH data
data['NMARK'] = nmark
#:if NMARK
# a marker
elif "MARKER_TAG=" in line:
# marker tag
thistag = line.split("=")[1].strip()
# start SU2_MARK dictionary
thismark = {}
# save to SU2_MARK data
thismark['TAG'] = thistag
# read number of marker elements
line = meshfile.readline()
if not "MARKER_ELEMS=" in line:
raise Exception("Marker Specification Error")
# convert string to long int
thisnelem = long( line.split("=")[1].strip() )
# save to SU2_MARK data
thismark['NELEM'] = thisnelem
# marker element data list
markelem = []
# scan next lines for marker elements
for ielem in range(thisnelem):
# read line
line = meshfile.readline()
# split and convert to long ints
thiselem = map(long, line.split() )
# add to marker element list
markelem = markelem + [thiselem]
# save to SU2_MARK data
thismark['ELEM'] = markelem
# add to marker list
marks[thismark['TAG']] = thismark
#:if MARKER_TAG
#:while not end of file
# save to SU2_MESH data
data['MARKS'] = marks
return data
#: def read
# ----------------------------------------------------------------------
# Write SU2 Mesh File
# ----------------------------------------------------------------------
def write(filename,meshdata,scale=1.0):
''' writes meshdata to file
inputs: filename, meshdata
'''
# open file for writing
outputfile = open(filename,'w')
# numbers
ndime = meshdata['NDIME']
# write dimension
outputfile.write("% \n% Problem Dimension \n% \n")
outputfile.write("NDIME= %i\n" % meshdata['NDIME'])
# write elements
outputfile.write("% \n% Inner element connectivity \n% \n")
outputfile.write("NELEM= %i\n" % meshdata['NELEM'])
for elem in meshdata['ELEM']:
for num in elem:
outputfile.write("%i " % num)
outputfile.write("\n")
# write nodes
outputfile.write("% \n% Node coordinates \n% \n")
outputfile.write("NPOIN= %i\n" % meshdata['NPOIN'])
for poin in meshdata['POIN']:
for inum in range(ndime):
outputfile.write("%#18.10e " % (poin[inum]*scale))
outputfile.write( "%i\n" % (long(poin[inum+1])) )
# write markers
outputfile.write("% \n% Boundary elements \n% \n")
outputfile.write( "NMARK= %i\n" % meshdata['NMARK'] )
for mark_tag in meshdata['MARKS'].keys():
this_mark = meshdata['MARKS'][mark_tag]
outputfile.write( "MARKER_TAG= %s\n" % this_mark['TAG'] )
outputfile.write( "MARKER_ELEMS= %i\n" % this_mark['NELEM'] )
for elem in this_mark['ELEM']:
for num in elem:
outputfile.write("%i " % num)
outputfile.write("\n")
# close file
outputfile.close()
return
#: def write
# ----------------------------------------------------------------------
# Get Marker Mesh Points
# ----------------------------------------------------------------------
def get_markerPoints(meshdata,mark_tags):
''' pulls all mesh nodes on markers
checks for duplicates (from edges) '''
# marker tags should be a list
if not isinstance(mark_tags,list):
mark_tags = [mark_tags]
# some numbers
nmark = meshdata['NMARK']
ndim = meshdata['NDIME']
# list for marker node numbers
markernodes = []
# scan each marker
for this_tag in mark_tags:
# current mark
this_mark = meshdata['MARKS'][this_tag]
# marker elements
markelems = this_mark['ELEM']
# list for marker nodes
marknodes = []
# pull all marker nodes, there will be duplicates
for row in markelems:
# ignore first marker element entry (element type)
marknodes = marknodes + row[1:]
# find unique node points
marknodes = dict(map(lambda i:(i,1),marknodes)).keys()
# add to mesh node list
markernodes = markernodes + marknodes
#: for each marker
# one more unique check
markernodes = dict(map(lambda i:(i,1),markernodes)).keys()
# list for marker points
markerpoints = []
# pull all nodes on markers
for inode in markernodes:
markerpoints = markerpoints + [ tuple( meshdata['POIN'][inode][0:ndim] ) ]
return markerpoints, markernodes
#: def get_markerPoints()
# ----------------------------------------------------------------------
# Set Mesh Points
# ----------------------------------------------------------------------
def set_meshPoints(meshdata,meshnodes,meshpoints):
''' stores array of meshpoints in the meshdata structure
note: will operate on the input meshdata by pointer
if a new mesh is needed make a deep copy
before calling this function
'''
n_nodes = len(meshnodes)
n_dim = meshdata['NDIME']
# for each given node, update meshdata['POIN']
for ipoint in range(n_nodes):
inode = meshnodes[ipoint]
for iDim in range(n_dim):
meshdata['POIN'][inode][iDim] = meshpoints[ipoint][iDim]
return meshdata
#def: set_meshPoints
# ----------------------------------------------------------------------
# Sort Airfoil
# ----------------------------------------------------------------------
def sort_airfoil(mesh_data,marker_name):
''' sorts xy airfoil points in clockwise loop from trailing edge
returns list of mesh point indeces
assumes:
- airfoil oriented nearly parallel with x-axis
- oriented from leading to trailing edge in the +x-direction
- one airfoil element with name 'marker_name'
'''
# find airfoil elements and points
airfoil_elems = mesh_data['MARKS'][marker_name]['ELEM']
airfoil_elems = np.array(airfoil_elems)
airfoil_points = mesh_data['POIN']
airfoil_points = np.array(airfoil_points)
airfoil_points = airfoil_points[airfoil_elems[:,1],:]
n_P,_ = airfoil_elems.shape
# build transfer arrays
EP = airfoil_elems[:,1:3] # edge to point
PX = airfoil_points[:,0:2] # point to coord
IP = np.arange(0,n_P) # loop index to point
# sorted airfoil point indeces tobe
Psort = np.zeros(n_P,long)
Isort = np.arange(0,n_P)
# find trailing edge
iP0 = np.argmax(PX[:,0])
P0 = EP[iP0,0]
I0 = IP[iP0]
Psort[0] = P0
# build loop
for this_iP in range(1,n_P):
P0 = EP[EP[:,0]==P0,1]
I0 = IP[EP[:,0]==P0]
Psort[this_iP] = P0
Isort[this_iP] = I0
# check for clockwise
D1 = PX[Isort[1],1] - PX[Isort[0],1]
D2 = PX[Isort[-1],1] - PX[Isort[0],1]
if D1>D2:
Psort = Psort[-1::-1]
# done
points_sorted = Psort
loop_sorted = Isort
return points_sorted,loop_sorted
#def: sort_airfoil()
|
AmritaLonkar/trunk
|
SU2_PY/SU2/mesh/tools.py
|
Python
|
gpl-2.0
| 11,442
|
from .utils import Impl
|
comp-imaging/ProxImaL
|
proximal/utils/__init__.py
|
Python
|
mit
| 24
|
from setuptools import setup
setup(
name='Flask-SubdomainDevserver',
version='0.1.1',
url='http://github.com/saltycrane/flask-subdomaindevserver/',
license='BSD',
author='Eliot',
author_email='saltycrane@gmail.com',
description='Flask subdomain devserver',
py_modules=['subdomaindevserver'],
install_requires=[
"Werkzeug>=0.9.6",
],
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: POSIX',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules'
],
)
|
saltycrane/flask-subdomaindevserver
|
setup.py
|
Python
|
bsd-3-clause
| 848
|
"""
WSGI config for metabotnik 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "metabotnik.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
|
epoz/metabotnik
|
src/metabotnik/wsgi.py
|
Python
|
mit
| 395
|
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 7, transform = "Integration", sigma = 0.0, exog_count = 100, ar_order = 0);
|
antoinecarme/pyaf
|
tests/artificial/transf_Integration/trend_MovingMedian/cycle_7/ar_/test_artificial_128_Integration_MovingMedian_7__100.py
|
Python
|
bsd-3-clause
| 270
|
import datetime
import json
import re
import sys
import lxml.etree
from lxml.etree import tostring
from itertools import izip
from billy.scrape.bills import Bill, BillScraper
from billy.scrape.votes import Vote
from openstates.utils import LXMLMixin
#Skip Amendment for now, data is included in Bill entry
_scrapable_types = ['Bill','Bill&Amend','CMZ Permit','Other','Resolution']
_action_pairs = (
('ctl00_ContentPlaceHolder_DateIntroLabel','Introduced','bill:introduced'),
('ctl00_ContentPlaceHolder_DateRecLabel','Received','bill:filed'),
('ctl00_ContentPlaceHolder_DateAssignLabel','Assigned','other'),
('ctl00_ContentPlaceHolder_DateToSenLabel','Sent to Senator','other'),
('ctl00_ContentPlaceHolder_DateToGovLabel','Sent to Governor','governor:received'),
('ctl00_ContentPlaceHolder_DateAppGovLabel','Signed by Governor','governor:signed'),
('ctl00_ContentPlaceHolder_DateVetoedLabel','Vetoed','governor:vetoed'),
('ctl00_ContentPlaceHolder_DateOverLabel','Governor Veto Overridden','bill:veto_override:passed'),
)
_action_ids = (
('ctl00_ContentPlaceHolder_ComActionLabel','upper'),
('ctl00_ContentPlaceHolder_FloorActionLabel','upper'),
('ctl00_ContentPlaceHolder_RulesActionLabel','upper'),
('ctl00_ContentPlaceHolder_RemarksLabel','executive'),
)
_action_re = (
('AMENDED AND REPORTED', ['committee:referred','amendment:passed']),
('REPORTED OUT', 'committee:referred'),
('ADOPTED', 'bill:passed'),
('HELD IN COMMITTEE', 'other'),
('AMENDED', 'amendment:passed'),
)
_committees = (
('COCHPY&R','COMMITTEE OF CULTURE, HISTORIC PRESERVATION, YOUTH & RECREATION'),
('COEDA&P','COMMITTEE OF ECONOMIC DEVELOPMENT, AGRICULTURE & PLANNING'),
('COE&WD','COMMITTEE OF EDUCATION & WORKFORCE DEVELOPMENT'),
('HEALTH','COMMITTEE OF ENERGY & ENVIROMENTAL PROTECTION'),
('COF','COMMITTEE OF FINANCE'),
('COHHHS&VA','COMMITTEE OF HEALTH, HOSPITAL & HUMAN SERVICES'),
('COHSJ&PS','COMMITTEE OF HOMELAND SECURITY, PUBLIC SAFETY & JUSTICE'),
('PUBLICWRKS','COMMITTEE OF HOUSING, PUBLIC WORKS & WASTE MANAGMENT'),
('RULJUD','COMMITTEE OF RULES & JUDICIARY'),
('WHOLE','COMMITTEE OF THE WHOLE'),
('GOVSERV','COMMITTEE ON GOVERNMENT SERVICES, CONSUMER AND VETERANS AFFAIRS'),
('COGS&H','COMMITTEE ON GOVERNMENT SERVICES, CONSUMER AND VETERANS AFFAIRS'),
('','Legislative Youth Advisory Counsel'),
('ZONING','ZONING'),
)
class VIBillScraper(BillScraper, LXMLMixin):
jurisdiction = 'vi'
session = ''
committees = []
def scrape(self, session, chambers):
self.session = session
#First we get the Form to get our ASP viewstate variables
search_url = 'http://www.legvi.org/vilegsearch/default.aspx'
doc = lxml.html.fromstring(self.get(url=search_url).text)
(viewstate, ) = doc.xpath('//input[@id="__VIEWSTATE"]/@value')
(viewstategenerator, ) = doc.xpath(
'//input[@id="__VIEWSTATEGENERATOR"]/@value')
(eventvalidation, ) = doc.xpath('//input[@id="__EVENTVALIDATION"]/@value')
(previouspage, ) = doc.xpath('//input[@id="__PREVIOUSPAGE"]/@value')
form = {
'__VIEWSTATE': viewstate,
'__VIEWSTATEGENERATOR': viewstategenerator,
'__EVENTVALIDATION': eventvalidation,
'__EVENTARGUMENT': '',
'__LASTFOCUS': '',
'__PREVIOUSPAGE': previouspage,
'__EVENTTARGET': 'ctl00$ContentPlaceHolder$leginum',
'ctl00$ContentPlaceHolder$leginum': session,
'ctl00$ContentPlaceHolder$sponsor': '',
'ctl00$ContentPlaceHolder$billnumber': '',
'ctl00$ContentPlaceHolder$actnumber': '',
'ctl00$ContentPlaceHolder$subject': '',
'ctl00$ContentPlaceHolder$BRNumber': '',
'ctl00$ContentPlaceHolder$ResolutionNumber': '',
'ctl00$ContentPlaceHolder$AmendmentNumber': '',
'ctl00$ContentPlaceHolder$GovernorsNumber': '',
}
#Then we post the to the search form once to set our ASP viewstate
form = self.post(url=search_url, data=form, allow_redirects=True)
doc = lxml.html.fromstring(form.text)
(viewstate, ) = doc.xpath('//input[@id="__VIEWSTATE"]/@value')
(viewstategenerator, ) = doc.xpath(
'//input[@id="__VIEWSTATEGENERATOR"]/@value')
(eventvalidation, ) = doc.xpath('//input[@id="__EVENTVALIDATION"]/@value')
(previouspage, ) = doc.xpath('//input[@id="__PREVIOUSPAGE"]/@value')
form = {
'__VIEWSTATE': viewstate,
'__VIEWSTATEGENERATOR': viewstategenerator,
'__EVENTVALIDATION': eventvalidation,
'__EVENTARGUMENT': '',
'__LASTFOCUS': '',
'__PREVIOUSPAGE': previouspage,
'__EVENTTARGET': 'ctl00$ContentPlaceHolder$leginum',
'ctl00$ContentPlaceHolder$leginum': session,
'ctl00$ContentPlaceHolder$sponsor': '',
'ctl00$ContentPlaceHolder$billnumber': '',
'ctl00$ContentPlaceHolder$actnumber': '',
'ctl00$ContentPlaceHolder$subject': '',
'ctl00$ContentPlaceHolder$BRNumber': '',
'ctl00$ContentPlaceHolder$ResolutionNumber': '',
'ctl00$ContentPlaceHolder$AmendmentNumber': '',
'ctl00$ContentPlaceHolder$GovernorsNumber': '',
}
#Then we submit to the results url to actually get the bill list
results_url = 'http://www.legvi.org/vilegsearch/Results.aspx'
bills_list = self.post(url=results_url, data=form, allow_redirects=True)
bills_list = lxml.html.fromstring(bills_list.text)
bills_list.make_links_absolute('http://www.legvi.org/vilegsearch/');
bills = bills_list.xpath('//table[@id="ctl00_ContentPlaceHolder_BillsDataGrid"]/tr')
for bill_row in bills[1:]:
(bill_type,) = bill_row.xpath('./td[6]/font/text()')
if bill_type in _scrapable_types:
(landing_page,) = bill_row.xpath('.//td/font/a/@href')
self.scrape_bill(landing_page)
def scrape_bill(self, bill_page_url):
bill_page = lxml.html.fromstring(self.get(bill_page_url).text)
title = bill_page.xpath('//span[@id="ctl00_ContentPlaceHolder_SubjectLabel"]/text()')
if title:
title = title[0]
else:
self.warning('Missing bill title {}'.format(bill_page_url))
return False
bill_no = bill_page.xpath('//span[@id="ctl00_ContentPlaceHolder_BillNumberLabel"]/a/text()')
if bill_no:
bill_no = bill_no[0]
else:
bill_no = bill_page.xpath('//span[@id="ctl00_ContentPlaceHolder_BillNumberLabel"]/text()')
if bill_no:
bill_no = bill_no[0]
else:
self.error('Missing bill number {}'.format(bill_page_url))
return False
bill = Bill(
session=self.session,
chamber='upper',
bill_id=bill_no,
title=title,
type='bill'
)
bill.add_source(bill_page_url)
self.parse_versions(bill, bill_page, bill_no)
self.parse_acts(bill, bill_page)
sponsors = bill_page.xpath('//span[@id="ctl00_ContentPlaceHolder_SponsorsLabel"]/text()')
if sponsors:
self.assign_sponsors(bill, sponsors[0], 'primary')
cosponsors = bill_page.xpath('//span[@id="ctl00_ContentPlaceHolder_CoSponsorsLabel"]/text()')
if cosponsors:
self.assign_sponsors(bill, cosponsors[0], 'cosponsor')
self.parse_date_actions(bill, bill_page)
self.parse_actions(bill, bill_page)
self.save_bill(bill)
def parse_versions(self, bill, bill_page, bill_no):
bill_version = bill_page.xpath('//span[@id="ctl00_ContentPlaceHolder_BillNumberLabel"]/a/@href')
if bill_version:
bill.add_version(name=bill_no,
url= 'http://www.legvi.org/vilegsearch/{}'.format(bill_version[0]),
mimetype='application/pdf'
)
def parse_acts(self, bill, bill_page):
bill_act = bill_page.xpath('//span[@id="ctl00_ContentPlaceHolder_ActNumberLabel"]/a')
if bill_act:
(act_title,) = bill_act[0].xpath('./text()')
act_title = 'Act {}'.format(act_title)
(act_link,) = bill_act[0].xpath('./@href')
act_link = 'http://www.legvi.org/vilegsearch/{}'.format(act_link)
bill.add_document(name=act_title,
url=act_link,
mimetype='application/pdf'
)
def clean_names(self, name_str):
#Clean up the names a bit to allow for comma splitting
name_str = re.sub(", Jr", " Jr.", name_str, flags=re.I)
name_str = re.sub(", Sr", " Sr.", name_str, flags=re.I)
return name_str
def assign_sponsors(self, bill, sponsors, sponsor_type):
sponsors = self.clean_names(sponsors)
sponsors = sponsors.split(',')
for sponsor in sponsors:
bill.add_sponsor(type=sponsor_type, name=sponsor.strip())
def parse_date_actions(self, bill, bill_page):
# There's a set of dates on the bill page denoting specific actions
# These are mapped in _action_pairs above
for xpath, action_name, action_type in _action_pairs:
action_date = bill_page.xpath('//span[@id="{}"]/text()'.format(xpath))
if action_date:
bill.add_action(actor='upper',
action=action_name,
date=self.parse_date(action_date[0]),
type=action_type)
def parse_date(self, date_str):
#manual typo fix
date_str = date_str.replace('07/21/5','07/21/15')
try:
return datetime.datetime.strptime(date_str, '%m/%d/%Y').date()
except ValueError:
return datetime.datetime.strptime(date_str, '%m/%d/%y').date()
def parse_actions(self, bill, bill_page):
# Aside from the actions implied by dates, which are handled in parse_date_actions
# Each actor has 1+ fields for their actions,
# Pull (DATE, Action) pairs out of text, and categorize the action
for xpath,actor in _action_ids:
actions = bill_page.xpath('//span[@id="{}"]/text()'.format(xpath))
if actions:
for action_date, action_text in self.split_action(actions[0]):
bill.add_action(actor=actor,
action=action_text,
date=self.parse_date(action_date),
type= self.categorize_action(action_text))
def split_action(self, action_str):
# Turns 01/01/2015 ACTION1 02/02/2016 ACTION2
# Into (('01/01/2015','ACTION NAME'),('02/02/2016','ACTION2'))
actions = re.split('(\d{1,2}/\d{1,2}/\d{1,2})', action_str)
#Trim out whitespace and leading/trailing dashes
actions = [re.sub('^-\s+|^-|-$','',action.strip()) for action in actions]
#Trim out empty list items from re.split
actions = list(filter(None, actions))
return self.grouped(actions,2)
def categorize_action(self, action):
for pattern, types in _action_re:
if re.findall(pattern, action, re.IGNORECASE):
return types
return 'other'
def grouped(self, iterable, n):
# Return a list grouped by n
#"s -> (s0,s1,s2,...sn-1), (sn,sn+1,sn+2,...s2n-1), (s2n,s2n+1,s2n+2,...s3n-1), ..."
return izip(*[iter(iterable)]*n)
|
cliftonmcintosh/openstates
|
openstates/vi/bills.py
|
Python
|
gpl-3.0
| 11,961
|
# Copyright (c) 2015 Mirantis, Inc.
#
# 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 glance.common import exception
from glance.common import semver_db
from glance.tests import utils as test_utils
class SemVerTestCase(test_utils.BaseTestCase):
def test_long_conversion(self):
initial = '1.2.3-beta+07.17.2014'
v = semver_db.parse(initial)
l, prerelease, build = v.__composite_values__()
v2 = semver_db.DBVersion(l, prerelease, build)
self.assertEqual(initial, str(v2))
def test_major_comparison_as_long(self):
v1 = semver_db.parse("1.1.100")
v2 = semver_db.parse("2.0.0")
self.assertTrue(v2.__composite_values__()[0] >
v1.__composite_values__()[0])
def test_minor_comparison_as_long(self):
v1 = semver_db.parse("1.1.100")
v2 = semver_db.parse("2.0.0")
self.assertTrue(v2.__composite_values__()[0] >
v1.__composite_values__()[0])
def test_patch_comparison_as_long(self):
v1 = semver_db.parse("1.1.1")
v2 = semver_db.parse("1.1.100")
self.assertTrue(v2.__composite_values__()[0] >
v1.__composite_values__()[0])
def test_label_comparison_as_long(self):
v1 = semver_db.parse("1.1.1-alpha")
v2 = semver_db.parse("1.1.1")
self.assertTrue(v2.__composite_values__()[0] >
v1.__composite_values__()[0])
def test_label_comparison_as_string(self):
versions = [
semver_db.parse("1.1.1-0.10.a.23.y.255").__composite_values__()[1],
semver_db.parse("1.1.1-0.10.z.23.x.255").__composite_values__()[1],
semver_db.parse("1.1.1-0.10.z.23.y.255").__composite_values__()[1],
semver_db.parse("1.1.1-0.10.z.23.y.256").__composite_values__()[1],
semver_db.parse("1.1.1-0.10.z.24.y.255").__composite_values__()[1],
semver_db.parse("1.1.1-0.11.z.24.y.255").__composite_values__()[1],
semver_db.parse("1.1.1-1.11.z.24.y.255").__composite_values__()[1],
semver_db.parse("1.1.1-alp.1.2.3.4.5.6").__composite_values__()[1]]
for i in range(len(versions) - 1):
self.assertLess(versions[i], versions[i + 1])
def test_too_large_version(self):
version1 = '1.1.65536'
version2 = '1.65536.1'
version3 = '65536.1.1'
self.assertRaises(exception.InvalidVersion, semver_db.parse, version1)
self.assertRaises(exception.InvalidVersion, semver_db.parse, version2)
self.assertRaises(exception.InvalidVersion, semver_db.parse, version3)
def test_too_long_numeric_segments(self):
version = semver_db.parse('1.0.0-alpha.1234567')
self.assertRaises(exception.InvalidVersion,
version.__composite_values__)
|
stevelle/glance
|
glance/tests/unit/common/test_semver.py
|
Python
|
apache-2.0
| 3,342
|
from distutils.core import Extension
def get_extension():
return Extension(
'japronto.request.crequest',
sources=['crequest.c', '../response/cresponse.c',
'../router/match_dict.c', '../capsule.c'],
include_dirs=['../../picohttpparser', '..',
'../response', '../router'],
define_macros=[('REQUEST_OPAQUE', 1)])
|
squeaky-pl/japronto
|
src/japronto/request/crequest_ext.py
|
Python
|
mit
| 387
|
from zope.interface import implements
from axiom.item import Item, declareLegacyItem, POWERUP_BEFORE
from axiom import attributes
from axiom.upgrade import (registerAttributeCopyingUpgrader,
registerUpgrader)
from axiom.dependency import dependsOn
from xmantissa import ixmantissa, prefs, webnav, fulltext
from xquotient import mail, spam, _mailsearchui
from xquotient.exmess import MessageDisplayPreferenceCollection
from xquotient.grabber import GrabberConfiguration
class MessageSearchProvider(Item):
"""
Wrapper around an ISearchProvider which will hand back search results
wrapped in a fragment that knows about Messages.
"""
schemaVersion = 2
indexer = dependsOn(fulltext.PyLuceneIndexer, doc="""
The actual fulltext indexing implementation object which will perform
searches. The results it returns will be wrapped up in a fragment which
knows how to display L{exmess.Message} instances.
""")
messageSource = dependsOn(mail.MessageSource)
powerupInterfaces = (ixmantissa.ISearchProvider,)
def installed(self):
self.indexer.addSource(self.messageSource)
def count(self, term):
raise NotImplementedError("No one should ever call count, I think.")
def search(self, *a, **k):
if 'sortAscending' not in k:
k['sortAscending'] = False
d = self.indexer.search(*a, **k)
d.addCallback(_mailsearchui.SearchAggregatorFragment, self.store)
return d
declareLegacyItem(MessageSearchProvider.typeName, 1, dict(
indexer=attributes.reference(),
installedOn=attributes.reference()))
def _messageSearchProvider1to2(old):
new = old.upgradeVersion(MessageSearchProvider.typeName, 1, 2,
indexer=old.indexer,
messageSource=old.store.findUnique(mail.MessageSource))
return new
registerUpgrader(_messageSearchProvider1to2, MessageSearchProvider.typeName, 1, 2)
class QuotientBenefactor(Item):
implements(ixmantissa.IBenefactor)
typeName = 'quotient_benefactor'
schemaVersion = 1
endowed = attributes.integer(default=0)
powerupNames = ["xquotient.inbox.Inbox"]
class ExtractBenefactor(Item):
implements(ixmantissa.IBenefactor)
endowed = attributes.integer(default=0)
powerupNames = ["xquotient.extract.ExtractPowerup",
"xquotient.gallery.Gallery",
"xquotient.gallery.ThumbnailDisplayer"]
class QuotientPeopleBenefactor(Item):
implements(ixmantissa.IBenefactor)
endowed = attributes.integer(default=0)
powerupNames = ["xquotient.qpeople.MessageLister"]
class IndexingBenefactor(Item):
implements(ixmantissa.IBenefactor)
endowed = attributes.integer(default=0)
powerupNames = ["xquotient.quotientapp.MessageSearchProvider"]
class QuotientPreferenceCollection(Item, prefs.PreferenceCollectionMixin):
"""
The core Quotient L{xmantissa.ixmantissa.IPreferenceCollection}. Doesn't
collect any preferences, but groups some quotient settings related fragments
"""
implements(ixmantissa.IPreferenceCollection)
typeName = 'quotient_preference_collection'
schemaVersion = 3
installedOn = attributes.reference()
powerupInterfaces = (ixmantissa.IPreferenceCollection,)
def getPreferenceParameters(self):
return ()
def getSections(self):
# XXX This is wrong because it is backwards. This class cannot be
# responsible for looking for every item that might exist in the
# database and want to provide configuration, because plugins make it
# impossible for this class to ever have a complete list of such items.
# Instead, items need to act as plugins for something so that there
# mere existence in the database causes them to show up for
# configuration.
sections = []
for cls in GrabberConfiguration, spam.Filter:
item = self.store.findUnique(cls, default=None)
if item is not None:
sections.append(item)
if sections:
return sections
return None
def getTabs(self):
return (webnav.Tab('Mail', self.storeID, 0.0),)
registerAttributeCopyingUpgrader(QuotientPreferenceCollection, 1, 2)
declareLegacyItem(QuotientPreferenceCollection.typeName, 2,
dict(installedOn=attributes.reference(),
preferredMimeType=attributes.text(),
preferredMessageDisplay=attributes.text(),
showRead=attributes.boolean(),
showMoreDetail=attributes.boolean()))
def quotientPreferenceCollection2To3(old):
"""
Remove the preference attributes of
L{xquotient.quotientapp.QuotientPreferenceCollection}, and install
a L{xquotient.exmess.MessageDisplayPreferenceCollection}, because
the attributes have either been moved there, or removed entirely
"""
mdpc = MessageDisplayPreferenceCollection(
store=old.store,
preferredFormat=old.preferredMimeType)
mdpc.installedOn = old.store
old.store.powerUp(mdpc, ixmantissa.IPreferenceCollection, POWERUP_BEFORE)
return old.upgradeVersion('quotient_preference_collection', 2, 3,
installedOn=old.installedOn)
registerUpgrader(quotientPreferenceCollection2To3, 'quotient_preference_collection', 2, 3)
|
twisted/quotient
|
xquotient/quotientapp.py
|
Python
|
mit
| 5,429
|
# Copyright 2014 Cloudbase Solutions Srl
#
# 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 oslo_log import log as oslo_logging
import six
from cloudbaseinit.models import network as network_model
LOG = oslo_logging.getLogger(__name__)
NAME = "name"
MAC = "mac"
ADDRESS = "address"
ADDRESS6 = "address6"
NETMASK = "netmask"
NETMASK6 = "netmask6"
BROADCAST = "broadcast"
GATEWAY = "gateway"
GATEWAY6 = "gateway6"
DNSNS = "dnsnameservers"
# Fields of interest by regexps.
FIELDS = {
NAME: re.compile(r"iface\s+(?P<{}>\S+)"
r"\s+inet6?\s+static".format(NAME)),
MAC: re.compile(r"hwaddress\s+ether\s+"
r"(?P<{}>\S+)".format(MAC)),
ADDRESS: re.compile(r"address\s+"
r"(?P<{}>\S+)".format(ADDRESS)),
ADDRESS6: re.compile(r"post-up ip -6 addr add (?P<{}>[^/]+)/"
r"(\d+) dev".format(ADDRESS6)),
NETMASK: re.compile(r"netmask\s+"
r"(?P<{}>\S+)".format(NETMASK)),
NETMASK6: re.compile(r"post-up ip -6 addr add ([^/]+)/"
r"(?P<{}>\d+) dev".format(NETMASK6)),
BROADCAST: re.compile(r"broadcast\s+"
r"(?P<{}>\S+)".format(BROADCAST)),
GATEWAY: re.compile(r"gateway\s+"
r"(?P<{}>\S+)".format(GATEWAY)),
GATEWAY6: re.compile(r"post-up ip -6 route add default via "
r"(?P<{}>.+) dev".format(GATEWAY6)),
DNSNS: re.compile(r"dns-nameservers\s+(?P<{}>.+)".format(DNSNS))
}
IFACE_TEMPLATE = dict.fromkeys(FIELDS.keys())
# Map IPv6 availability by value index under `NetworkDetails`.
V6_PROXY = {
ADDRESS: ADDRESS6,
NETMASK: NETMASK6,
GATEWAY: GATEWAY6
}
DETAIL_PREPROCESS = {
MAC: lambda value: value.upper(),
DNSNS: lambda value: value.strip().split()
}
def _get_iface_blocks(data):
""""Yield interface blocks as pairs of v4 and v6 halves."""
lines, lines6 = [], []
crt_lines = lines
for line in data.splitlines():
line = line.strip()
if not line or line.startswith("#"):
continue
if "iface" in line:
if "inet6" in line:
crt_lines = lines6
continue
if lines:
yield lines, lines6
lines[:] = []
lines6[:] = []
crt_lines = lines
crt_lines.append(line)
if lines:
yield lines, lines6
def _get_field(line):
for field, regex in FIELDS.items():
match = regex.match(line)
if match:
yield field, match.group(field)
def _add_nic(iface, nics):
if not iface or iface == IFACE_TEMPLATE:
return # no information gathered
LOG.debug("Found new interface: %s", iface)
# Each missing detail is marked as None.
nic = network_model.NetworkDetails(**iface)
nics.append(nic)
def parse(data):
"""Parse the received content and obtain network details."""
if not data or not isinstance(data, six.string_types):
LOG.error("Invalid Debian config to parse:\n%s", data)
return
LOG.info("Parsing Debian config...\n%s", data)
nics = [] # list of NetworkDetails objects
for lines_pair in _get_iface_blocks(data):
iface = IFACE_TEMPLATE.copy()
for lines, use_proxy in zip(lines_pair, (False, True)):
for line in lines:
for field, value in _get_field(line):
if use_proxy:
field = V6_PROXY.get(field)
if not field:
continue
func = DETAIL_PREPROCESS.get(field, lambda value: value)
iface[field] = func(value) if value != "None" else None
_add_nic(iface, nics)
return nics
|
alexpilotti/cloudbase-init
|
cloudbaseinit/utils/debiface.py
|
Python
|
apache-2.0
| 4,319
|
import Tkinter as tk
import re
class CustomText(tk.Text):
def __init__(self, *args, **kwargs):
tk.Text.__init__(self, *args, **kwargs)
self.tk.eval('''
proc widget_proxy {widget widget_command args} {
# call the real tk widget command with the real args
set result [uplevel [linsert $args 0 $widget_command]]
# generate the event for certain types of commands
if {([lindex $args 0] in {insert replace delete}) ||
([lrange $args 0 2] == {mark set insert}) ||
([lrange $args 0 1] == {xview moveto}) ||
([lrange $args 0 1] == {xview scroll}) ||
([lrange $args 0 1] == {yview moveto}) ||
([lrange $args 0 1] == {yview scroll})} {
event generate $widget <<Change>> -when tail
}
# return the result from the real widget command
return $result
}
''')
self.tk.eval('''
rename {widget} _{widget}
interp alias {{}} ::{widget} {{}} widget_proxy {widget} _{widget}
'''.format(widget=str(self)))
def HighLight_Complex_Pattern(self, pattern, indexstart=None, indexend=None):
self.ClearAllTags()
self.tag_configure("Group_0", background="#00ff00")
self.tag_configure("Group_1", background="#ff0000")
self.tag_configure("Group_2", background="#0000ff")
self.tag_configure("Group_3", background="#ffff00")
self.tag_configure("Group_4", background="#00ffff")
self.tag_configure("Group_5", background="#ff00ff")
self.tag_configure("Group_6", background="#ccff00")
self.tag_configure("Group_7", background="#00ffcc")
self.tag_configure("Group_8", background="#ffcc00")
self.tag_configure("Group_9", background="#00ffcc")
IndexTagContent = {0:"Group_0",
1:"Group_1",
2:"Group_2",
3:"Group_3",
4:"Group_4",
5:"Group_5",
6:"Group_6",
7:"Group_7",
8:"Group_8",
9:"Group_9"}
if(indexstart==None):
IndexInitial = self.index("1.0")
IndexInitialNum = 0
else:
IndexInitial = self.index("1.0 + %s chars"%(str(indexstart)))
IndexInitialNum = indexstart
if(indexend==None):
IndexEnding = "end"
else:
IndexEnding = self.index("1.0 + %s chars"%(str(indexend)))
ValueStringText = self.get(IndexInitial, IndexEnding)
matches = re.finditer(pattern, ValueStringText)
for matchNum, match in enumerate(matches):
for groupNum in range(0, len(match.groups())):
groupNum=groupNum +1
#print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
NumberCharacters = IndexInitialNum + match.end(groupNum) - match.start(groupNum)
MatchStartInitial = self.index("1.0 + %s chars"%(str(IndexInitialNum+ match.start(groupNum))))
MatchEndEnding = self.index( "%s+%sc" % ( MatchStartInitial, NumberCharacters))
self.mark_set("matchStart", MatchStartInitial )
self.mark_set("matchEnd",MatchEndEnding )
IndexTagWrite = (groupNum-1) % len(IndexTagContent)
self.tag_add(IndexTagContent[IndexTagWrite], "matchStart", "matchEnd")
def ClearAllTags(self):
ListTagNames = self.tag_names()
for IndividualTagName in ListTagNames:
if IndividualTagName is not 'sel':
self.tag_delete(IndividualTagName)
pass
pass
pass
def highlight_pattern(self, pattern, tag, start="1.0", end="end",
regexp=False):
'''Apply the given tag to all text that matches the given pattern
If 'regexp' is set to True, pattern will be treated as a regular
expression according to Tcl's regular expression syntax.
'''
start = self.index(start)
end = self.index(end)
self.mark_set("matchStart", start)
self.mark_set("matchEnd", start)
self.mark_set("searchLimit", end)
count = tk.IntVar()
while True:
index = self.search(pattern, "matchEnd","searchLimit",
count=count, regexp=regexp)
if index == "": break
if count.get() == 0: break # degenerate pattern which matches zero-length strings
self.mark_set("matchStart", index)
self.mark_set("matchEnd", "%s+%sc" % (index, count.get()))
self.tag_add(tag, "matchStart", "matchEnd")
class TextLineNumbers(tk.Canvas):
def __init__(self, *args, **kwargs):
tk.Canvas.__init__(self, *args, **kwargs)
self.textwidget = None
def attach(self, text_widget):
self.textwidget = text_widget
def redraw(self, *args):
'''redraw line numbers'''
self.delete("all")
i = self.textwidget.index("@0,0")
while True :
dline= self.textwidget.dlineinfo(i)
if dline is None: break
y = dline[1]
linenum = str(i).split(".")[0]
self.create_text(2,y,anchor="nw", text=linenum)
i = self.textwidget.index("%s+1line" % i)
class Example(tk.Frame):
def __init__(self, *args, **kwargs):
tk.Frame.__init__(self, *args, **kwargs)
self.text = CustomText(self)
self.vsb = tk.Scrollbar(orient="vertical", command=self.text.yview)
self.text.configure(yscrollcommand=self.vsb.set)
#self.text.tag_configure("bigfont", font=("Helvetica", "24", "bold"))
self.linenumbers = TextLineNumbers(self, width=30)
self.linenumbers.attach(self.text)
self.vsb.pack(side="right", fill="y")
self.linenumbers.pack(side="left", fill="y")
self.text.pack(side="right", fill="both", expand=True)
self.text.bind("<<Change>>", self._on_change)
self.text.bind("<Configure>", self._on_change)
self.text.insert("end", "one\ntwo\nthree\n")
self.text.insert("end", "four\n",)
self.text.insert("end", "five\n")
self.text.HighLight_Complex_Pattern("(\w)(\w)\n")
#self.text.tag_configure("red", foreground="#ff0000")
#self.text.highlight_pattern("four", "red")
#self.text.tag_configure("green", foreground="#00ff00")
#self.text.tag_configure("green", foreground="#00ff00")
#self.text.highlight_pattern("one", "green")
#self.text.ClearAllTags()
def _on_change(self, event):
self.linenumbers.redraw()
def ViewRegexResult():
TextSearch = containtext.get("1.0", "end-1c")
OverallClass.text.HighLight_Complex_Pattern(TextSearch)
pass
def CommandSubstitution():
TextSearch = containtext.get("1.0", "end-1c")
OverallClass.text.HighLight_Complex_Pattern(TextSearch)
pass
global OverallClass
if __name__ == "__main__":
root = tk.Tk()
OverallClass = Example(root)
OverallClass.pack(side="top", fill="both", expand=True)
b = tk.Button(root, text='RegexSearch', command = ViewRegexResult)
b.pack(side="bottom")
containtext = tk.Text(root, height = 1)
containtext.pack(side="bottom")
FrameSearch = tk.Frame(root)
varInit = tk.StringVar()
LabelA = tk.Label(FrameSearch,textvariable=varInit)
varInit.set("Init")
LabelA.pack(side="left")
IndexInitLine = tk.Text(FrameSearch,height=1,width=4)
IndexInitLine.pack(side="left")
varEnd = tk.StringVar()
LabelB = tk.Label(FrameSearch,textvariable=varEnd)
varEnd.set("End")
LabelB.pack(side="left")
IndexEndLine = tk.Text(FrameSearch,height = 1,width=4)
IndexEndLine.pack(side="left")
varSubExp = tk.StringVar()
SubstituteRegex = tk.Label(FrameSearch,textvariable=varSubExp)
varSubExp.set("Pattern Modification")
SubstituteRegex.pack(side="left")
SubstituteRegexPattern = tk.Text(FrameSearch,height = 1,width=20)
SubstituteRegexPattern.pack(side="left")
ButtonExecuteSubstitution = tk.Button(FrameSearch, text='ExecuteSubtitution', command = CommandSubstitution)
ButtonExecuteSubstitution.pack(side="left")
FrameSearch.pack(side="bottom")
root.mainloop()
|
cbustamantegarres/Regstyle
|
PythonExample.py
|
Python
|
gpl-3.0
| 9,074
|
from __future__ import division, absolute_import, unicode_literals
from functools import partial
from qtpy import QtGui
from qtpy.QtCore import Qt
from qtpy import QtWidgets
from ..i18n import N_
from ..widgets import standard
from ..qtutils import get
from .. import icons
from .. import qtutils
from .toolbarcmds import COMMANDS
from . import defs
TREE_LAYOUT = {
'Others': [
'Others::LaunchEditor',
'Others::RevertUnstagedEdits'
],
'File': [
'File::NewRepo',
'File::OpenRepo',
'File::OpenRepoNewWindow',
'File::Refresh',
'File::EditRemotes',
'File::RecentModified',
'File::SaveAsTarZip',
'File::ApplyPatches',
'File::ExportPatches',
],
'Actions': [
'Actions::Fetch',
'Actions::Pull',
'Actions::Push',
'Actions::Stash',
'Actions::CreateTag',
'Actions::CherryPick',
'Actions::Merge',
'Actions::AbortMerge',
'Actions::UpdateSubmodules',
'Actions::ResetBranchHead',
'Actions::ResetWorktree',
'Actions::Grep',
'Actions::Search'
],
'Commit@@verb': [
'Commit::Stage',
'Commit::AmendLast',
'Commit::StageAll',
'Commit::UnstageAll',
'Commit::Unstage',
'Commit::LoadCommitMessage',
'Commit::GetCommitMessageTemplate',
],
'Diff': [
'Diff::Difftool',
'Diff::Expression',
'Diff::Branches',
'Diff::Diffstat'
],
'Branch': [
'Branch::Review',
'Branch::Create',
'Branch::Checkout',
'Branch::Delete',
'Branch::DeleteRemote',
'Branch::Rename',
'Branch::BrowseCurrent',
'Branch::BrowseOther',
'Branch::VisualizeCurrent',
'Branch::VisualizeAll'
],
'View': [
'View::DAG',
'View::FileBrowser',
]
}
def configure(toolbar, parent=None):
"""Launches the Toolbar configure dialog"""
view = ToolbarView(toolbar, parent if parent else qtutils.active_window())
view.show()
return view
def get_toolbars(widget):
return widget.findChildren(ToolBar)
def add_toolbar(context, widget):
toolbars = get_toolbars(widget)
name = 'ToolBar%d' % (len(toolbars) + 1)
toolbar = ToolBar.create(context, name)
widget.addToolBar(toolbar)
configure(toolbar)
class ToolBarState(object):
"""export_state() and apply_state() providers for toolbars"""
def __init__(self, context, widget):
"""widget must be a QMainWindow for toolBarArea(), etc."""
self.context = context
self.widget = widget
def apply_state(self, toolbars):
context = self.context
widget = self.widget
for data in toolbars:
toolbar = ToolBar.create(context, data['name'])
toolbar.load_items(data['items'])
toolbar.set_show_icons(data['show_icons'])
toolbar.setVisible(data['visible'])
toolbar_area = decode_toolbar_area(data['area'])
if data['break']:
widget.addToolBarBreak(toolbar_area)
widget.addToolBar(toolbar_area, toolbar)
# floating toolbars must be set after added
if data['float']:
toolbar.setWindowFlags(Qt.Tool | Qt.FramelessWindowHint)
toolbar.move(data['x'], data['y'])
# TODO: handle changed width when exists more than one toolbar in
# an area
def export_state(self):
result = []
widget = self.widget
toolbars = widget.findChildren(ToolBar)
for toolbar in toolbars:
toolbar_area = widget.toolBarArea(toolbar)
if toolbar_area == Qt.NoToolBarArea:
continue # filter out removed toolbars
items = [x.data() for x in toolbar.actions()]
result.append({
'name': toolbar.windowTitle(),
'area': encode_toolbar_area(toolbar_area),
'break': widget.toolBarBreak(toolbar),
'float': toolbar.isFloating(),
'x': toolbar.pos().x(),
'y': toolbar.pos().y(),
'width': toolbar.width(),
'height': toolbar.height(),
'show_icons': toolbar.show_icons(),
'visible': toolbar.isVisible(),
'items': items,
})
return result
class ToolBar(QtWidgets.QToolBar):
SEPARATOR = 'Separator'
@staticmethod
def create(context, name):
return ToolBar(context, name, TREE_LAYOUT, COMMANDS)
def __init__(self, context, title, tree_layout, toolbar_commands):
QtWidgets.QToolBar.__init__(self)
self.setWindowTitle(title)
self.setObjectName(title)
self.context = context
self.tree_layout = tree_layout
self.commands = toolbar_commands
def set_show_icons(self, show_icons):
if show_icons:
self.setToolButtonStyle(Qt.ToolButtonIconOnly)
else:
self.setToolButtonStyle(Qt.ToolButtonTextOnly)
def show_icons(self):
return self.toolButtonStyle() == Qt.ToolButtonIconOnly
def load_items(self, items):
for data in items:
self.add_action_from_data(data)
def add_action_from_data(self, data):
parent = data['parent']
child = data['child']
if child == self.SEPARATOR:
toolbar_action = self.addSeparator()
toolbar_action.setData(data)
return
tree_items = self.tree_layout.get(parent, [])
if child in tree_items and child in self.commands:
command = self.commands[child]
title = N_(command['title'])
callback = partial(command['action'], self.context)
icon = None
command_icon = command.get('icon', None)
if command_icon:
icon = getattr(icons, command_icon, None)
if callable(icon):
icon = icon()
if icon:
toolbar_action = self.addAction(icon, title, callback)
else:
toolbar_action = self.addAction(title, callback)
toolbar_action.setData(data)
def delete_toolbar(self):
self.parent().removeToolBar(self)
def contextMenuEvent(self, event):
menu = QtWidgets.QMenu()
menu.addAction(N_('Configure toolbar'), partial(configure, self))
menu.addAction(N_('Delete toolbar'), self.delete_toolbar)
menu.exec_(event.globalPos())
def encode_toolbar_area(toolbar_area):
"""Encode a Qt::ToolBarArea as a string"""
if toolbar_area == Qt.LeftToolBarArea:
result = 'left'
elif toolbar_area == Qt.RightToolBarArea:
result = 'right'
elif toolbar_area == Qt.TopToolBarArea:
result = 'top'
elif toolbar_area == Qt.BottomToolBarArea:
result = 'bottom'
else: # fallback to "bottom"
result = 'bottom'
return result
def decode_toolbar_area(string):
"""Decode an encoded toolbar area string into a Qt::ToolBarArea"""
if string == 'left':
result = Qt.LeftToolBarArea
elif string == 'right':
result = Qt.RightToolBarArea
elif string == 'top':
result = Qt.TopToolBarArea
elif string == 'bottom':
result = Qt.BottomToolBarArea
else:
result = Qt.BottomToolBarArea
return result
class ToolbarView(standard.Dialog):
"""Provides the git-cola 'ToolBar' configure dialog"""
SEPARATOR_TEXT = '----------------------------'
def __init__(self, toolbar, parent=None):
standard.Dialog.__init__(self, parent)
self.setWindowTitle(N_('Configure toolbar'))
self.toolbar = toolbar
self.left_list = ToolbarTreeWidget(self)
self.right_list = DraggableListWidget(self)
self.text_toolbar_name = QtWidgets.QLabel()
self.text_toolbar_name.setText(N_('Name'))
self.toolbar_name = QtWidgets.QLineEdit()
self.toolbar_name.setText(toolbar.windowTitle())
self.add_separator = qtutils.create_button(N_('Add Separator'))
self.remove_item = qtutils.create_button(N_('Remove Element'))
checked = toolbar.show_icons()
checkbox_text = N_('Show icon? (if available)')
self.show_icon = qtutils.checkbox(
checkbox_text, checkbox_text, checked)
self.apply_button = qtutils.ok_button(N_('Apply'))
self.close_button = qtutils.close_button()
self.close_button.setDefault(True)
self.right_actions = qtutils.hbox(
defs.no_margin, defs.spacing,
self.add_separator,
self.remove_item)
self.name_layout = qtutils.hbox(
defs.no_margin, defs.spacing,
self.text_toolbar_name,
self.toolbar_name)
self.left_layout = qtutils.vbox(
defs.no_margin, defs.spacing,
self.left_list)
self.right_layout = qtutils.vbox(
defs.no_margin, defs.spacing,
self.right_list,
self.right_actions)
self.top_layout = qtutils.hbox(
defs.no_margin, defs.spacing,
self.left_layout,
self.right_layout)
self.actions_layout = qtutils.hbox(
defs.no_margin, defs.spacing,
self.show_icon,
qtutils.STRETCH,
self.close_button,
self.apply_button)
self.main_layout = qtutils.vbox(
defs.margin, defs.spacing,
self.name_layout,
self.top_layout,
self.actions_layout)
self.setLayout(self.main_layout)
qtutils.connect_button(self.add_separator, self.add_separator_action)
qtutils.connect_button(self.remove_item, self.remove_item_action)
qtutils.connect_button(self.apply_button, self.apply_action)
qtutils.connect_button(self.close_button, self.accept)
self.load_right_items()
self.load_left_items()
self.init_size(parent=parent)
def load_right_items(self):
for action in self.toolbar.actions():
data = action.data()
if data['child'] == self.toolbar.SEPARATOR:
self.add_separator_action()
else:
command = self.toolbar.commands[data['child']]
title = command['title']
icon = command['icon']
self.right_list.add_item(title, data, icon)
def load_left_items(self):
# def current_children(actions):
# result = []
# for action in actions:
# data = action.data()
# if data['child'] != self.toolbar.SEPARATOR:
# result.append(data['child'])
# return result
for parent in self.toolbar.tree_layout:
top = self.left_list.insert_top(parent)
# current_items = current_children(self.toolbar.actions())
for item in self.toolbar.tree_layout[parent]:
command = self.toolbar.commands[item]
child = create_child(parent, item,
command['title'], command['icon'])
top.appendRow(child)
top.sortChildren(0, Qt.AscendingOrder)
def add_separator_action(self):
data = {'parent': None, 'child': self.toolbar.SEPARATOR}
self.right_list.add_separator(self.SEPARATOR_TEXT, data)
def remove_item_action(self):
items = self.right_list.selectedItems()
for item in items:
self.right_list.takeItem(self.right_list.row(item))
def apply_action(self):
self.toolbar.clear()
self.toolbar.set_show_icons(get(self.show_icon))
self.toolbar.setWindowTitle(self.toolbar_name.text())
for item in self.right_list.get_items():
data = item.data(Qt.UserRole)
self.toolbar.add_action_from_data(data)
class DraggableListMixin(object):
items = []
def __init__(self, widget, Base):
self.widget = widget
self.Base = Base
widget.setAcceptDrops(True)
widget.setSelectionMode(widget.SingleSelection)
widget.setDragEnabled(True)
widget.setDropIndicatorShown(True)
def dragEnterEvent(self, event):
widget = self.widget
self.Base.dragEnterEvent(widget, event)
def dragMoveEvent(self, event):
widget = self.widget
self.Base.dragMoveEvent(widget, event)
def dragLeaveEvent(self, event):
widget = self.widget
self.Base.dragLeaveEvent(widget, event)
def dropEvent(self, event):
widget = self.widget
event.setDropAction(Qt.MoveAction)
self.Base.dropEvent(widget, event)
def get_items(self):
widget = self.widget
base = self.Base
items = [base.item(widget, i) for i in range(base.count(widget))]
return items
# pylint: disable=too-many-ancestors
class DraggableListWidget(QtWidgets.QListWidget):
Mixin = DraggableListMixin
def __init__(self, parent=None):
QtWidgets.QListWidget.__init__(self, parent)
self.setAcceptDrops(True)
self.setSelectionMode(self.SingleSelection)
self.setDragEnabled(True)
self.setDropIndicatorShown(True)
self._mixin = self.Mixin(self, QtWidgets.QListWidget)
def dragEnterEvent(self, event):
return self._mixin.dragEnterEvent(event)
def dragMoveEvent(self, event):
return self._mixin.dragMoveEvent(event)
def dropEvent(self, event):
return self._mixin.dropEvent(event)
def add_separator(self, title, data):
item = QtWidgets.QListWidgetItem()
item.setText(title)
item.setData(Qt.UserRole, data)
self.addItem(item)
def add_item(self, title, data, icon_text=None):
item = QtWidgets.QListWidgetItem()
item.setText(N_(title))
item.setData(Qt.UserRole, data)
if icon_text is not None:
icon = getattr(icons, icon_text, None)
item.setIcon(icon())
self.addItem(item)
def get_items(self):
return self._mixin.get_items()
# pylint: disable=too-many-ancestors
class ToolbarTreeWidget(standard.TreeView):
def __init__(self, parent):
standard.TreeView.__init__(self, parent)
self.setDragEnabled(True)
self.setDragDropMode(QtWidgets.QAbstractItemView.DragOnly)
self.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
self.setDropIndicatorShown(True)
self.setRootIsDecorated(True)
self.setHeaderHidden(True)
self.setAlternatingRowColors(False)
self.setSortingEnabled(False)
self.setModel(QtGui.QStandardItemModel())
def insert_top(self, title):
item = create_item(title, title)
item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
self.model().insertRow(0, item)
self.model().sort(0)
return item
def create_child(parent, child, title, icon_text=None):
data = {'parent': parent, 'child': child}
item = create_item(title, data)
if icon_text is not None:
icon = getattr(icons, icon_text, None)
item.setIcon(icon())
return item
def create_item(name, data):
item = QtGui.QStandardItem()
item.setEditable(False)
item.setDragEnabled(True)
item.setText(N_(name))
item.setData(data, Qt.UserRole)
return item
|
AndiDog/git-cola
|
cola/widgets/toolbar.py
|
Python
|
gpl-2.0
| 15,536
|
import post as posts
import user
import thread as threads
from util.StringBuilder import *
from api_helpers.common_helper import *
from api_helpers.user_helper import get_id_by_email
def create(ds, **args):
required(['name', 'short_name', 'user'], args)
user_id = get_id_by_email(ds, args['user'])
#ds.close_all()
conn = ds.get_db()
db = conn['conn']
c = db.cursor()
try:
c.execute(u"""INSERT INTO forum (name, short_name, user, user_id)
VALUES (%s, %s, %s, %s)""",
(args['name'], args['short_name'], args['user'], user_id))
_id = db.insert_id()
db.commit()
except Exception as e:
db.rollback()
raise e
finally:
c.close()
db.close() #ds.close(conn['id'])
data = {
'id': _id,
'name': args['name'],
'short_name': args['short_name'],
'user': args['user']
}
return data
def details(ds, **args):
required(['forum'], args)
optional('related', args, [], ['user'])
conn = ds.get_db()
db = conn['conn']
c = db.cursor()
c.execute(u"""SELECT * FROM forum
WHERE forum.short_name = %s""", (args['forum'],))
forum_data = c.fetchone()
c.close()
db.close() #ds.close(conn['id'])
check_empty(forum_data, u"No forum found with that short_name")
email = forum_data['user']
if 'user' in args['related']:
user_data = user.details(ds, user=email)
else:
user_data = email
del forum_data['user_id']
forum_data['user'] = user_data
return forum_data
def listPosts(ds, **args):
return posts.list(ds, **args)
def listThreads(ds, **args):
return threads.list(ds, **args)
def listUsers(ds, **args):
required(['forum'], args)
optional('since_id', args)
optional('limit', args)
optional('order', args, 'desc', ['desc', 'asc'])
query = StringBuilder()
query.append(u"""SELECT DISTINCT user FROM post
WHERE forum = %s""")
params = (args['forum'],)
if args['since_id']:
query.append(u"""AND id >= %s""")
params += (args['since_id'],)
if args['order']:
query.append(u"""ORDER BY user_id %s""" % args['order'])
if args['limit']:
query.append(u"""LIMIT %d""" % int(args['limit']))
conn = ds.get_db()
db = conn['conn']
c = db.cursor()
c.execute(str(query), params)
users_list = [user.details(ds, user=u['user']) for u in c]
c.close()
db.close() #ds.close(conn['id'])
return users_list
|
igorcoding/forum-api
|
api/forum.py
|
Python
|
mit
| 2,579
|
import importlib
from .devices.api_interface import IoDeviceApi
# TODO: Make this dynamic
I2C = IoDeviceApi.I2C
def get_device(dev_type, flags=None):
device_impl_module = importlib.import_module('.devices.%s' % dev_type, __name__)
device_impl_class_name = dev_type.title().replace('_','') + 'IoDevice'
device_class = getattr(device_impl_module, device_impl_class_name)
return device_class(flags)
|
sgnn7/sgfc
|
io_dev/sgfc_io/__init__.py
|
Python
|
lgpl-2.1
| 417
|
""" Demonstration Bokeh app of how to register event callbacks in both
Javascript and Python using an adaptation of the color_scatter example
from the bokeh gallery. This example extends the js_events.py example
with corresponding Python event callbacks.
"""
import numpy as np
from bokeh.io import curdoc
from bokeh.plotting import figure
from bokeh import events
from bokeh.models import CustomJS, Div, Button
from bokeh.layouts import column, row
def display_event(div, attributes=[]):
"""
Function to build a suitable CustomJS to display the current event
in the div model.
"""
style = 'float: left; clear: left; font-size: 10pt'
return CustomJS(args=dict(div=div), code="""
var attrs = %s;
var args = [];
for (var i = 0; i<attrs.length; i++ ) {
var val = JSON.stringify(cb_obj[attrs[i]], function(key, val) {
return val.toFixed ? Number(val.toFixed(2)) : val;
})
args.push(attrs[i] + '=' + val)
}
var line = "<span style=%r><b>" + cb_obj.event_name + "</b>(" + args.join(", ") + ")</span>\\n";
var text = div.text.concat(line);
var lines = text.split("\\n")
if (lines.length > 35)
lines.shift();
div.text = lines.join("\\n");
""" % (attributes, style))
def print_event(attributes=[]):
"""
Function that returns a Python callback to pretty print the events.
"""
def python_callback(event):
cls_name = event.__class__.__name__
attrs = ', '.join(['{attr}={val}'.format(attr=attr, val=event.__dict__[attr])
for attr in attributes])
print('{cls_name}({attrs})'.format(cls_name=cls_name, attrs=attrs))
return python_callback
# Follows the color_scatter gallery example
N = 4000
x = np.random.random(size=N) * 100
y = np.random.random(size=N) * 100
radii = np.random.random(size=N) * 1.5
colors = [
"#%02x%02x%02x" % (int(r), int(g), 150) for r, g in zip(50+2*x, 30+2*y)
]
p = figure(tools="pan,wheel_zoom,zoom_in,zoom_out,reset,tap,lasso_select,box_select")
p.scatter(x, y, radius=radii,
fill_color=colors, fill_alpha=0.6,
line_color=None)
# Add a div to display events and a button to trigger button click events
div = Div(width=1000)
button = Button(label="Button", button_type="success")
layout = column(button, row(p, div))
point_attributes = ['x','y','sx','sy']
pan_attributes = point_attributes + ['delta_x', 'delta_y']
pinch_attributes = point_attributes + ['scale']
wheel_attributes = point_attributes+['delta']
## Register Javascript event callbacks
# Button event
button.js_on_event(events.ButtonClick, display_event(div))
# LOD events
p.js_on_event(events.LODStart, display_event(div))
p.js_on_event(events.LODEnd, display_event(div))
# Point events
p.js_on_event(events.Tap, display_event(div, attributes=point_attributes))
p.js_on_event(events.DoubleTap, display_event(div, attributes=point_attributes))
p.js_on_event(events.Press, display_event(div, attributes=point_attributes))
# Mouse wheel event
p.js_on_event(events.MouseWheel, display_event(div,attributes=wheel_attributes))
# Mouse move, enter and leave
p.js_on_event(events.MouseMove, display_event(div, attributes=point_attributes))
p.js_on_event(events.MouseEnter, display_event(div, attributes=point_attributes))
p.js_on_event(events.MouseLeave, display_event(div, attributes=point_attributes))
# Pan events
p.js_on_event(events.Pan, display_event(div, attributes=pan_attributes))
p.js_on_event(events.PanStart, display_event(div, attributes=point_attributes))
p.js_on_event(events.PanEnd, display_event(div, attributes=point_attributes))
# Pinch events
p.js_on_event(events.Pinch, display_event(div, attributes=pinch_attributes))
p.js_on_event(events.PinchStart, display_event(div, attributes=point_attributes))
p.js_on_event(events.PinchEnd, display_event(div, attributes=point_attributes))
# Selection events
p.js_on_event(events.SelectionGeometry, display_event(div, attributes=['geometry', 'final']))
# Reset events
p.js_on_event(events.Reset, display_event(div))
## Register Python event callbacks
# Button event
button.on_event(events.ButtonClick, print_event())
# LOD events
p.on_event(events.LODStart, print_event())
p.on_event(events.LODEnd, print_event())
# Point events
p.on_event(events.Tap, print_event(attributes=point_attributes))
p.on_event(events.DoubleTap, print_event(attributes=point_attributes))
p.on_event(events.Press, print_event(attributes=point_attributes))
# Mouse wheel event
p.on_event(events.MouseWheel, print_event(attributes=wheel_attributes))
# Mouse move, enter and leave
p.on_event(events.MouseMove, print_event(attributes=point_attributes))
p.on_event(events.MouseEnter, print_event(attributes=point_attributes))
p.on_event(events.MouseLeave, print_event(attributes=point_attributes))
# Pan events
p.on_event(events.Pan, print_event(attributes=pan_attributes))
p.on_event(events.PanStart, print_event(attributes=point_attributes))
p.on_event(events.PanEnd, print_event(attributes=point_attributes))
# Pinch events
p.on_event(events.Pinch, print_event(attributes=pinch_attributes))
p.on_event(events.PinchStart, print_event(attributes=point_attributes))
p.on_event(events.PinchEnd, print_event(attributes=point_attributes))
# Selection events
p.on_event(events.SelectionGeometry, print_event(attributes=['geometry', 'final']))
# Reset events
p.on_event(events.Reset, print_event())
curdoc().add_root(layout)
|
dennisobrien/bokeh
|
examples/howto/events_app.py
|
Python
|
bsd-3-clause
| 5,564
|
"""Read and write configuration settings
"""
from milc import cli
def print_config(section, key):
"""Print a single config setting to stdout.
"""
cli.echo('%s.%s{fg_cyan}={fg_reset}%s', section, key, cli.config[section][key])
def show_config():
"""Print the current configuration to stdout.
"""
for section in cli.config:
for key in cli.config[section]:
print_config(section, key)
def parse_config_token(config_token):
"""Split a user-supplied configuration-token into its components.
"""
section = option = value = None
if '=' in config_token and '.' not in config_token:
cli.log.error('Invalid configuration token, the key must be of the form <section>.<option>: %s', config_token)
return section, option, value
# Separate the key (<section>.<option>) from the value
if '=' in config_token:
key, value = config_token.split('=')
else:
key = config_token
# Extract the section and option from the key
if '.' in key:
section, option = key.split('.', 1)
else:
section = key
return section, option, value
def set_config(section, option, value):
"""Set a config key in the running config.
"""
log_string = '%s.%s{fg_cyan}:{fg_reset} %s {fg_cyan}->{fg_reset} %s'
if cli.args.read_only:
log_string += ' {fg_red}(change not written)'
cli.echo(log_string, section, option, cli.config[section][option], value)
if not cli.args.read_only:
if value == 'None':
del cli.config[section][option]
else:
cli.config[section][option] = value
@cli.argument('-ro', '--read-only', arg_only=True, action='store_true', help='Operate in read-only mode.')
@cli.argument('configs', nargs='*', arg_only=True, help='Configuration options to read or write.')
@cli.subcommand("Read and write configuration settings.")
def config(cli):
"""Read and write config settings.
This script iterates over the config_tokens supplied as argument. Each config_token has the following form:
section[.key][=value]
If only a section (EG 'compile') is supplied all keys for that section will be displayed.
If section.key is supplied the value for that single key will be displayed.
If section.key=value is supplied the value for that single key will be set.
If section.key=None is supplied the key will be deleted.
No validation is done to ensure that the supplied section.key is actually used by qmk scripts.
"""
if not cli.args.configs:
return show_config()
# Process config_tokens
save_config = False
for argument in cli.args.configs:
# Split on space in case they quoted multiple config tokens
for config_token in argument.split(' '):
section, option, value = parse_config_token(config_token)
# Validation
if option and '.' in option:
cli.log.error('Config keys may not have more than one period! "%s" is not valid.', config_token)
return False
# Do what the user wants
if section and option and value:
# Write a configuration option
set_config(section, option, value)
if not cli.args.read_only:
save_config = True
elif section and option:
# Display a single key
print_config(section, option)
elif section:
# Display an entire section
for key in cli.config[section]:
print_config(section, key)
# Ending actions
if save_config:
cli.save_config()
return True
|
kmtoki/qmk_firmware
|
lib/python/qmk/cli/config.py
|
Python
|
gpl-2.0
| 3,720
|
import socket
from NEGRAV import *
###################### FUNCTIONS FOR BASE STATION ##############################
def server_listening():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('',TCP_PORT_SERVER))
s.listen(1)
conn, address = s.accept()
data = conn.recv (BUFFER_SIZE)
#Aca va el parser?
return conn, address, data
def add_response (conn,ip):
conn.sendall(json_add_response(ip))#On error, an exception is raised, and there is no way to determine how much data, if any, was successfully sent
#conn.close() the client does this
###################### FUNCTIONS FOR NODE STATION ##############################
def add_request(ip):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((IP_BASE, TCP_PORT_SERVER))
s.sendall(json_add_request(ip))#On error, an exception is raised, and there is no way to determine how much data, if any, was successfully sent
data = s.recv(BUFFER_SIZE)
s.close()
return data
def node_report(ip, type, sensor, GPS):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((IP_BASE, TCP_PORT_SERVER))
s.sendall(json_node_report(ip, type, sensor, GPS))#On error, an exception is raised, and there is no way to determine how much data, if any, was successfully sent
s.close()
|
Nickiler531/NEGRAV_implemetation
|
src/socket-functions.py
|
Python
|
gpl-3.0
| 1,273
|
#from distutils.core import setup
import setuptools
setuptools.setup(
name = 'p3270',
packages = ['p3270'],
version = '0.1.3',
description = 'Python library to communicate with IBM hosts',
author = 'Mossaab Stiri',
author_email = 'mossaab.stiri@gmail.com',
url = 'https://github.com/mstiri/p3270',
long_description = '''
A Python library that provides an interface to communicate with IBM hosts: send commands and text, receive output (screens). The library provides the means to do what a human can do using a 3270 emulator.
The library is highly customizable and is built with simplicity in mind.
It is written in Python 3, runs on Linux and Unix-like Operating Systems, and relies on the `s3270` utility. So it is required to have the `s3270` installed on your system and available on your PATH.
The library allows you to open a telnet connection to an IBM host, and execute a set of instructions as you specified them in your python program.
''',
keywords = 'IBM CICS 3270 TN3270 test automation Mainframe z/OS',
classifiers = [
'Intended Audience :: Developers',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Operating System :: Unix',
'Operating System :: POSIX :: Linux',
'Topic :: Software Development :: Testing',
'Topic :: Software Development :: Libraries :: Python Modules',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Development Status :: 4 - Beta'
]
)
|
mstiri/p3270
|
setup.py
|
Python
|
gpl-3.0
| 1,698
|
# -*- coding: utf-8 -*-
import configparser
import enum
import logging
import os
import re
from datetime import datetime
from typing import Dict
from django.core.exceptions import ValidationError
from django.core.validators import MaxLengthValidator, RegexValidator
from django.db import models
from django.db.models import Count
from django.utils.translation import gettext_lazy as _
from tcms.core.models import TCMSActionModel
from tcms.issuetracker import validators
logger = logging.getLogger(__name__)
TOKEN_EXPIRATION_DATE_FORMAT = [
"%Y-%m-%d %H:%M:%S",
"%Y-%m-%d",
]
def parse_token_expiration_date(value):
for fmt in TOKEN_EXPIRATION_DATE_FORMAT:
try:
return datetime.strptime(value, fmt)
except ValueError:
logger.warning("Date %s is not in a known format %s. Skip it and try next format.")
return None
@enum.unique
class CredentialTypes(enum.Enum):
NoNeed = "No need to login"
UserPwd = "Username/Password authentication"
Token = "Token based"
class IssueTrackerProduct(TCMSActionModel):
"""Representing a specific issue tracker product
In real world, there are lots of issue tracker products, e.g. Bugzilla,
JIRA, GitHub, GitLab, etc. This model represents one of them before adding
an issue tracker to model :class:`IssueTracker`, which could represent a
specific deployed instance, for example, the KDE Bugzilla and the GNOME
Bugzilla.
"""
name = models.CharField(
max_length=30,
unique=True,
help_text=_("Name of the issue tracker product."),
)
class Meta:
db_table = "issue_tracker_products"
def __str__(self):
return self.name
class ProductIssueTrackerRelationship(TCMSActionModel):
"""Many-to-many relationship between Product and IssueTracker
Before adding issues to case or case run, an issue tracker must be
associated with a product added to Nitrate.
"""
product = models.ForeignKey(
"management.Product",
on_delete=models.CASCADE,
help_text=_("Select which project the issue tracker is associated with."),
)
issue_tracker = models.ForeignKey(
"issuetracker.IssueTracker",
on_delete=models.CASCADE,
help_text=_("Select an issue tracker to be associated with a product."),
)
alias = models.CharField(
max_length=50,
null=True,
blank=True,
help_text=_("The corresponding product name in issue tracker."),
)
namespace = models.CharField(
max_length=30,
null=True,
blank=True,
help_text=_(
"A name which the issues reported for product should belong to in "
"issue tracker. Different issue tracker services will use this "
"namespace to construct specific URL for issue report. Namespace "
"could be empty, if product is not under a namespace in issue "
"tracker, or is the top level product with its own components. "
"For example, in a Bugzilla instance, product A is a component of "
"a product X, namespace should be the name of X.",
),
validators=[MaxLengthValidator(30)],
)
def __str__(self):
return f"Rel {self.product} - {self.issue_tracker}"
class Meta:
db_table = "product_issue_tracker_relationship"
unique_together = ("product", "issue_tracker")
verbose_name = _("Relationship between Issue Tracker and Product")
class IssueTracker(TCMSActionModel):
"""Represent a deployed issue tracker instance"""
enabled = models.BooleanField(
default=True,
db_index=True,
help_text=_("Whether to enable this issue tracker in system wide. Default: true."),
)
name = models.CharField(
max_length=50,
unique=True,
help_text=_("Issue tracker name."),
validators=[
MaxLengthValidator(
50, message=_("Issue tracker name is too long. 50 characters at most.")
),
RegexValidator(
r"^[a-zA-Z0-9 ]+$",
message=_(
"Name contains invalid characters. Name could contain "
"lower and upper case letters, digit or space."
),
),
],
)
description = models.CharField(
max_length=255,
blank=True,
default="",
help_text=_("A short description to this issue tracker. 255 characters at most."),
)
service_url = models.URLField(
default="",
blank=True,
verbose_name=_("Service URL"),
help_text=_(
"URL of this issue tracker. Example: https://issues.example.com/. "
'The trailing slash "/" is optional.',
),
)
api_url = models.URLField(
default="",
blank=True,
verbose_name=_("API URL"),
help_text=_(
"API URL of this issue tracker, that is used by the corresponding "
"service object implementation to complete specific action. A "
"typical use case would be, a service object of a Bugzilla may use"
" this URL to associate a case with a specific bug as an external "
"link. Example: https://bz.example.com/xmlrpc.cgi"
),
)
issues_display_url_fmt = models.URLField(
default="",
blank=True,
verbose_name=_("Issues Display URL Format"),
help_text=_(
"URL format to construct a display URL used to open in Web browse "
"to display issues. This should probably only apply to Bugzilla. "
"Example: http://bz.example.com/buglist.cgi?bug_id={issue_keys}"
),
)
issue_url_fmt = models.URLField(
verbose_name=_("Issue URL Format"),
help_text=_(
"Formatter string used to construct a specific issue's URL. "
"Format arguments: issue_key, product. Example: "
"https://bugzilla.domain/show_bug.cgi?id=%(issue_key)s"
),
)
validate_regex = models.CharField(
max_length=100,
help_text=_(
"Regular expression in Python Regular Expression syntax, which is "
"used to validate issue ID. This regex will be used in both "
"JavaScript code and Python code. So, please write it carefully."
),
validators=[validators.validate_reg_exp],
)
allow_add_case_to_issue = models.BooleanField(
default=False,
help_text=_("Allow to add associated test case link to issue."),
)
credential_type = models.CharField(
max_length=10,
choices=[(item.name, item.value) for item in list(CredentialTypes)],
help_text=_(
"Select a credential type. The corresponding service "
"implementation will use it to log into the remote issue tracker "
"service. Please remember to create a specific user/pwd or token "
"credential if you select one of these two types."
),
)
tracker_product = models.ForeignKey(
IssueTrackerProduct,
related_name="tracker_instances",
on_delete=models.CASCADE,
verbose_name=_("Tracker Product"),
)
products = models.ManyToManyField(
"management.Product",
through=ProductIssueTrackerRelationship,
related_name="issue_trackers",
)
# Field for loading corresponding Python class to do specific actions
class_path = models.CharField(
max_length=100,
default="tcms.issuetracker.services.IssueTrackerService",
verbose_name=_("Custom service class path"),
help_text=_(
"Importable path to the implementation for this issue tracker. "
"Default is <code>tcms.issuetracker.models.IssueTrackerService</code>, "
"which provides basic functionalities for general purpose. "
"Set to a custom path for specific service implementation "
"inherited from <code>IssueTrackerService</code>"
),
validators=[validators.validate_class_path],
)
# Fields for implementing filing issue in an issue tracker.
issue_report_endpoint = models.CharField(
max_length=50,
verbose_name=_("Issue Report Endpoint"),
help_text=_(
"The endpoint for filing an issue. Used in the serivce "
"implementation to construct final full URL. Example: "
"/secure/CreateIssue!default.jspa"
),
)
issue_report_params = models.TextField(
max_length=255,
blank=True,
default="",
verbose_name=_("Issue Report Parameters"),
help_text=_(
"Parameters used to format URL for reporting issue. Each line is a"
" <code>key:value</code> pair of parameters. Nitrate provides a "
"few parameters to format URL and additional parameters could be "
"provided by system administrator as well."
),
validators=[validators.validate_issue_report_params],
)
issue_report_templ = models.TextField(
max_length=255,
blank=True,
default="",
verbose_name=_("Issue Report Template"),
help_text=_(
"The issue content template, which could be arbitrary text with "
"format arguments. Nitrate provides these format arguments: "
"<code>TestBuild.name</code>, <code>setup</code>, <code>action</code> "
"and <code>effect</code>. The text is formatted with keyward arguments."
),
)
class Meta:
db_table = "issue_trackers"
verbose_name = _("Issue Tracker")
def __str__(self):
return self.name
def get_absolute_url(self):
"""Get URL linking to this issue tracker
:return: the URL.
:rtype: str
"""
return self.service_url
@property
def code_name(self):
"""Return a useful issue tracker name for programmatic purpose
Several characters are replaced. Space in name is replaced with
underscore.
:return: a formatted name.
:rtype: str
"""
return self.name.replace(" ", "_")
@classmethod
def get_by_case(cls, case, enabled=True):
"""Find out issue trackers for a case
:param case: to get related issue trackers for this test case.
:type case: :class:`TestCase`
:param bool enabled: whether to get enabled issue trackers. If omitted, defaults to True.
:return: a queryset of matched issue trackers
:rtype: QuerySet
"""
criteria = {"products__in": case.plan.values("product")}
if enabled is not None:
criteria["enabled"] = enabled
return cls.objects.filter(**criteria)
@property
def credential(self) -> Dict[str, str]:
"""Get login credential
The returned credential could contain different login credential data
which depends on what credential type is configured for this issue
tracker, and how corresponding credential is created.
"""
if self.credential_type == CredentialTypes.NoNeed.name:
return {}
elif self.credential_type == CredentialTypes.UserPwd.name:
cred = UserPwdCredential.objects.filter(issue_tracker=self).first()
if cred is None:
raise ValueError(
f"Username/password credential is not set for issue tracker {self.name}."
)
else:
if cred.secret_file:
content = cred.read_secret_file(cred.secret_file)
return {
"username": content.get("issuetracker", "username"),
"password": content.get("issuetracker", "password"),
}
else:
return {
"username": cred.username,
"password": cred.password,
}
elif self.credential_type == CredentialTypes.Token.name:
cred = TokenCredential.objects.filter(issue_tracker=self).first()
if cred is None:
raise ValueError(f"Token credential is not set for issue tracker {self.name}.")
else:
if cred.secret_file:
content = cred.read_secret_file(cred.secret_file)
return {"token": content.get("issuetracker", "token")}
else:
return {"token": cred.token}
class Credential(TCMSActionModel):
"""Base class providing general functions for credentials"""
secret_file = models.CharField(
max_length=100,
null=True,
blank=True,
help_text=_(
"An absolute path to an alternative secret file to provide the "
"credential. The file must be in INI format."
),
)
class Meta:
abstract = True
@staticmethod
def read_secret_file(filename):
config = configparser.ConfigParser()
config.read([filename])
return config
def check_secret_file(self, filename):
"""Check if secret file is valid for reading credential
:param str filename: the file name of secret file.
:raises ValidationError: if cannot read credential from specified
secret file.
"""
if not os.access(filename, os.F_OK):
raise ValidationError(
{"secret_file": "Secret file {} does not exist.".format(filename)}
)
if not os.path.isfile(filename):
raise ValidationError({"secret_file": f"{filename} is not a file."})
if not os.access(filename, os.R_OK):
raise ValidationError(
{"secret_file": "Secret file {} cannot be read.".format(filename)}
)
config = self.read_secret_file(filename)
config_section = "issuetracker"
if not config.has_section(config_section):
# Translators: validation error is shown in Admin WebUI
raise ValidationError(
{
"secret_file": _('Secret file does not have section "issuetracker".'),
}
)
if isinstance(self, TokenCredential):
if not config.has_option(config_section, "token"):
# Translators: validation error is shown in Admin WebUI
raise ValidationError(
{
"secret_file": _("Token is not set in secret file."),
}
)
if config.has_option(config_section, "until"):
expiration_date = parse_token_expiration_date(config.get(config_section, "until"))
today = datetime.utcnow()
if expiration_date < today:
# Translators: validation error is shown in Admin WebUI
raise ValidationError(
{
"secret_file": _(
"Is token expired? The expiration date is older than today."
),
}
)
if isinstance(self, UserPwdCredential) and not (
config.has_option("issuetracker", "username")
and config.has_option("issuetracker", "password")
):
# Translators: validation error is shown in Admin WebUI
raise ValidationError(
{
"secret_file": _("Neither Username nor password is set in secrete file."),
}
)
def clean(self):
"""General validation for a concrete credential model
Each concrete credential model derived from :class:`Credential` should
call parent's ``clean`` before other validation steps.
"""
super().clean()
cred_type = self.issue_tracker.credential_type
if cred_type == CredentialTypes.NoNeed.name:
cred_type = CredentialTypes[cred_type].value
raise ValidationError(
{
"issue_tracker": f"Is credential really required? "
f'Credential type "{cred_type}" is selected.'
}
)
if isinstance(self, UserPwdCredential) and cred_type != CredentialTypes.UserPwd.name:
cred_type = CredentialTypes[cred_type].value
raise ValidationError(
{
"issue_tracker": f"Cannot create a username/password credential. "
f'Credential type "{cred_type}" is selected.'
}
)
if isinstance(self, TokenCredential) and cred_type != CredentialTypes.Token.name:
cred_type = CredentialTypes[cred_type].value
raise ValidationError(
{
"issue_tracker": f"Cannot create a token based credential. "
f'Credential type "{cred_type}" is selected.'
}
)
if self.secret_file:
self.check_secret_file(self.secret_file)
class UserPwdCredential(Credential):
"""Username/password credential for logging into issue tracker"""
username = models.CharField(
max_length=100,
null=True,
blank=True,
help_text=_("Username used to log into remote issue tracker service."),
)
password = models.CharField(
max_length=255,
null=True,
blank=True,
help_text=_(
"Password used with username together to log into remote issue tracker service."
),
)
issue_tracker = models.OneToOneField(
IssueTracker,
related_name="user_pwd_credential",
on_delete=models.CASCADE,
help_text=_("The issue tracker this credential is applied to."),
)
def __str__(self):
return "Username/Password Credential"
class Meta:
db_table = "issue_tracker_user_pwd_credential"
verbose_name = _("Username/Password Credential")
def clean(self):
"""Validate username/password credential"""
super().clean()
if not self.secret_file and not self.username and not self.password:
raise ValidationError(
{
"username": _(
"Username and password are not set yet. Please consider "
"setting them in database or a secret file in filesystem."
),
}
)
if self.username and self.secret_file:
raise ValidationError(
{
"username": _(
"Both username and secret file are specified. "
"Please consider using one of them."
),
}
)
if self.username or self.password:
if not self.username:
raise ValidationError({"username": _("Missing username.")})
if not self.password:
raise ValidationError({"password": _("Missing password.")})
class TokenCredential(Credential):
"""Token based authentication for logging into issue tracker"""
token = models.CharField(
max_length=255,
null=True,
blank=True,
help_text=_("Token used to log into remote issue tracker."),
)
until = models.DateField(
null=True,
blank=True,
help_text=_(
"Optional expiration date. This is useful for Nitrate to determine"
" whether the token has been expired before request. If omitted, "
"request will be sent without checking the expiration date."
),
)
issue_tracker = models.OneToOneField(
IssueTracker,
related_name="token_credential",
on_delete=models.CASCADE,
help_text=_("The issue tracker this credential is applied to."),
)
def __str__(self):
return "Token credential"
class Meta:
db_table = "issue_tracker_token_credential"
verbose_name = _("Token Credential")
def clean(self):
"""Validate token credential"""
super().clean()
if not self.secret_file and not self.token:
raise ValidationError(
{
"token": _(
"Token is not set yet. A token can be set in database or a"
" secret file in filesystem."
),
}
)
if self.token and self.secret_file:
raise ValidationError(
{
"token": _(
"Token is set in database as well as a secret file. "
"Please consider using one of them."
),
}
)
if self.until:
today = datetime.utcnow()
if self.until < today:
raise ValidationError(_("Expiration date is prior to today."))
class Issue(TCMSActionModel):
"""This is the issue which could be added to case or case run
The meaning of issue in issue tracker represents a general concept. In
different concrete issue tracker products, it has different name to call,
e.g. bug in Bugzilla and issue in JIRA and GitHub.
"""
issue_key = models.CharField(
max_length=50,
help_text=_(
"Actual issue ID corresponding issue tracker. Different issue "
"tracker may have issue IDs in different type or format. For "
"example, in Bugzilla, it could be an integer, or in JIRA, it "
"could be a string in format PROJECTNAME-number, e.g. PROJECT-1."
),
validators=[
MaxLengthValidator(50, _("Issue key has too many characters. 50 characters at most."))
],
)
summary = models.CharField(
max_length=255, null=True, blank=True, help_text=_("Summary of issue.")
)
description = models.TextField(null=True, blank=True, help_text=_("Description of issue."))
tracker = models.ForeignKey(
IssueTracker,
related_name="issues",
on_delete=models.CASCADE,
help_text=_("Which issue tracker this issue belongs to."),
)
case = models.ForeignKey(
"testcases.TestCase",
related_name="issues",
help_text="A test case this issue is associated with.",
error_messages={
"required": _("Case is missed."),
},
on_delete=models.CASCADE,
)
case_run = models.ForeignKey(
"testruns.TestCaseRun",
null=True,
blank=True,
related_name="issues",
help_text=_("Optionally associate this issue to this case run."),
on_delete=models.SET_NULL,
)
def __str__(self):
return self.issue_key
class Meta:
db_table = "issue_tracker_issues"
unique_together = (
("tracker", "issue_key", "case"),
("tracker", "issue_key", "case", "case_run"),
)
def get_absolute_url(self):
return self.tracker.issue_url_fmt.format(
product=self.tracker.name, issue_key=self.issue_key
)
def clean(self):
"""Validate issue"""
super().clean()
issue_key_re = re.compile(self.tracker.validate_regex)
if not issue_key_re.match(self.issue_key):
raise ValidationError({"issue_key": f"Issue key {self.issue_key} is in wrong format."})
@staticmethod
def count_by_case_run(case_run_ids=None):
"""Subtotal issues and optionally by specified case runs
:param case_run_ids: list of test case run IDs to just return subtotal
for them.
:type case_run_ids: list[int]
:return: a mapping from case run id to the number of issues belong to
that case run.
:rtype: dict
"""
if case_run_ids is not None:
assert isinstance(case_run_ids, list)
assert all(isinstance(item, int) for item in case_run_ids)
criteria = {"case_run__in": case_run_ids}
else:
criteria = {"case_run__isnull": False}
return {
item["case_run"]: item["issues_count"]
for item in (
Issue.objects.filter(**criteria)
.values("case_run")
.annotate(issues_count=Count("pk"))
)
}
|
Nitrate/Nitrate
|
src/tcms/issuetracker/models.py
|
Python
|
gpl-2.0
| 24,620
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016 Michael Gruener <michael.gruener@chaosmoon.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: acme_certificate_revoke
author: "Felix Fontein (@felixfontein)"
version_added: "2.7"
short_description: Revoke certificates with the ACME protocol
description:
- "Allows to revoke certificates issued by a CA supporting the
L(ACME protocol,https://tools.ietf.org/html/rfc8555),
such as L(Let's Encrypt,https://letsencrypt.org/)."
notes:
- "Exactly one of C(account_key_src), C(account_key_content),
C(private_key_src) or C(private_key_content) must be specified."
- "Trying to revoke an already revoked certificate
should result in an unchanged status, even if the revocation reason
was different than the one specified here. Also, depending on the
server, it can happen that some other error is returned if the
certificate has already been revoked."
seealso:
- name: The Let's Encrypt documentation
description: Documentation for the Let's Encrypt Certification Authority.
Provides useful information for example on rate limits.
link: https://letsencrypt.org/docs/
- name: Automatic Certificate Management Environment (ACME)
description: The specification of the ACME protocol (RFC 8555).
link: https://tools.ietf.org/html/rfc8555
- module: acme_inspect
description: Allows to debug problems.
extends_documentation_fragment:
- acme
options:
certificate:
description:
- "Path to the certificate to revoke."
type: path
required: yes
account_key_src:
description:
- "Path to a file containing the ACME account RSA or Elliptic Curve
key."
- "RSA keys can be created with C(openssl rsa ...). Elliptic curve keys can
be created with C(openssl ecparam -genkey ...). Any other tool creating
private keys in PEM format can be used as well."
- "Mutually exclusive with C(account_key_content)."
- "Required if C(account_key_content) is not used."
type: path
account_key_content:
description:
- "Content of the ACME account RSA or Elliptic Curve key."
- "Note that exactly one of C(account_key_src), C(account_key_content),
C(private_key_src) or C(private_key_content) must be specified."
- "I(Warning): the content will be written into a temporary file, which will
be deleted by Ansible when the module completes. Since this is an
important private key — it can be used to change the account key,
or to revoke your certificates without knowing their private keys
—, this might not be acceptable."
- "In case C(cryptography) is used, the content is not written into a
temporary file. It can still happen that it is written to disk by
Ansible in the process of moving the module with its argument to
the node where it is executed."
type: str
private_key_src:
description:
- "Path to the certificate's private key."
- "Note that exactly one of C(account_key_src), C(account_key_content),
C(private_key_src) or C(private_key_content) must be specified."
type: path
private_key_content:
description:
- "Content of the certificate's private key."
- "Note that exactly one of C(account_key_src), C(account_key_content),
C(private_key_src) or C(private_key_content) must be specified."
- "I(Warning): the content will be written into a temporary file, which will
be deleted by Ansible when the module completes. Since this is an
important private key — it can be used to change the account key,
or to revoke your certificates without knowing their private keys
—, this might not be acceptable."
- "In case C(cryptography) is used, the content is not written into a
temporary file. It can still happen that it is written to disk by
Ansible in the process of moving the module with its argument to
the node where it is executed."
type: str
revoke_reason:
description:
- "One of the revocation reasonCodes defined in
L(https://tools.ietf.org/html/rfc5280#section-5.3.1, Section 5.3.1 of RFC5280)."
- "Possible values are C(0) (unspecified), C(1) (keyCompromise),
C(2) (cACompromise), C(3) (affiliationChanged), C(4) (superseded),
C(5) (cessationOfOperation), C(6) (certificateHold),
C(8) (removeFromCRL), C(9) (privilegeWithdrawn),
C(10) (aACompromise)"
type: int
'''
EXAMPLES = '''
- name: Revoke certificate with account key
acme_certificate_revoke:
account_key_src: /etc/pki/cert/private/account.key
certificate: /etc/httpd/ssl/sample.com.crt
- name: Revoke certificate with certificate's private key
acme_certificate_revoke:
private_key_src: /etc/httpd/ssl/sample.com.key
certificate: /etc/httpd/ssl/sample.com.crt
'''
RETURN = '''
'''
from ansible.module_utils.acme import (
ModuleFailException, ACMEAccount, nopad_b64, pem_to_der, set_crypto_backend,
)
from ansible.module_utils.basic import AnsibleModule
def main():
module = AnsibleModule(
argument_spec=dict(
account_key_src=dict(type='path', aliases=['account_key']),
account_key_content=dict(type='str', no_log=True),
account_uri=dict(type='str'),
acme_directory=dict(type='str', default='https://acme-staging.api.letsencrypt.org/directory'),
acme_version=dict(type='int', default=1, choices=[1, 2]),
validate_certs=dict(type='bool', default=True),
private_key_src=dict(type='path'),
private_key_content=dict(type='str', no_log=True),
certificate=dict(type='path', required=True),
revoke_reason=dict(type='int'),
select_crypto_backend=dict(type='str', default='auto', choices=['auto', 'openssl', 'cryptography']),
),
required_one_of=(
['account_key_src', 'account_key_content', 'private_key_src', 'private_key_content'],
),
mutually_exclusive=(
['account_key_src', 'account_key_content', 'private_key_src', 'private_key_content'],
),
supports_check_mode=False,
)
set_crypto_backend(module)
if not module.params.get('validate_certs'):
module.warn(warning='Disabling certificate validation for communications with ACME endpoint. ' +
'This should only be done for testing against a local ACME server for ' +
'development purposes, but *never* for production purposes.')
try:
account = ACMEAccount(module)
# Load certificate
certificate = pem_to_der(module.params.get('certificate'))
certificate = nopad_b64(certificate)
# Construct payload
payload = {
'certificate': certificate
}
if module.params.get('revoke_reason') is not None:
payload['reason'] = module.params.get('revoke_reason')
# Determine endpoint
if module.params.get('acme_version') == 1:
endpoint = account.directory['revoke-cert']
payload['resource'] = 'revoke-cert'
else:
endpoint = account.directory['revokeCert']
# Get hold of private key (if available) and make sure it comes from disk
private_key = module.params.get('private_key_src')
private_key_content = module.params.get('private_key_content')
# Revoke certificate
if private_key or private_key_content:
# Step 1: load and parse private key
error, private_key_data = account.parse_key(private_key, private_key_content)
if error:
raise ModuleFailException("error while parsing private key: %s" % error)
# Step 2: sign revokation request with private key
jws_header = {
"alg": private_key_data['alg'],
"jwk": private_key_data['jwk'],
}
result, info = account.send_signed_request(endpoint, payload, key_data=private_key_data, jws_header=jws_header)
else:
# Step 1: get hold of account URI
created, account_data = account.setup_account(allow_creation=False)
if created:
raise AssertionError('Unwanted account creation')
if account_data is None:
raise ModuleFailException(msg='Account does not exist or is deactivated.')
# Step 2: sign revokation request with account key
result, info = account.send_signed_request(endpoint, payload)
if info['status'] != 200:
already_revoked = False
# Standardized error from draft 14 on (https://tools.ietf.org/html/rfc8555#section-7.6)
if result.get('type') == 'urn:ietf:params:acme:error:alreadyRevoked':
already_revoked = True
else:
# Hack for Boulder errors
if module.params.get('acme_version') == 1:
error_type = 'urn:acme:error:malformed'
else:
error_type = 'urn:ietf:params:acme:error:malformed'
if result.get('type') == error_type and result.get('detail') == 'Certificate already revoked':
# Fallback: boulder returns this in case the certificate was already revoked.
already_revoked = True
# If we know the certificate was already revoked, we don't fail,
# but successfully terminate while indicating no change
if already_revoked:
module.exit_json(changed=False)
raise ModuleFailException('Error revoking certificate: {0} {1}'.format(info['status'], result))
module.exit_json(changed=True)
except ModuleFailException as e:
e.do_fail(module)
if __name__ == '__main__':
main()
|
kvar/ansible
|
lib/ansible/modules/crypto/acme/acme_certificate_revoke.py
|
Python
|
gpl-3.0
| 10,293
|
import numpy as np
from scipy.signal import decimate
l = range(128)
print l
def downsample(l, factor):
chunks = len(l)/factor
new_l = []
for i in range(chunks):
idx = i * factor
new_l.append(sum(l[idx:idx+factor])/factor)
return new_l
print downsample(l, 32)
|
Falaina/pypgf
|
pypgf/interp.py
|
Python
|
cc0-1.0
| 287
|
import numpy as np
from gym.spaces import Box
from metaworld.envs import reward_utils
from metaworld.envs.asset_path_utils import full_v2_path_for
from metaworld.envs.mujoco.sawyer_xyz.sawyer_xyz_env import SawyerXYZEnv, _assert_task_is_set
from scipy.spatial.transform import Rotation
class SawyerPegInsertionSideEnvV2(SawyerXYZEnv):
TARGET_RADIUS = 0.07
"""
Motivation for V2:
V1 was difficult to solve because the observation didn't say where
to insert the peg (the hole's location). Furthermore, the hole object
could be initialized in such a way that it severely restrained the
sawyer's movement.
Changelog from V1 to V2:
- (8/21/20) Updated to Byron's XML
- (7/7/20) Removed 1 element vector. Replaced with 3 element position
of the hole (for consistency with other environments)
- (6/16/20) Added a 1 element vector to the observation. This vector
points from the end effector to the hole in the Y direction.
i.e. (self._target_pos - pos_hand)[1]
- (6/16/20) Used existing goal_low and goal_high values to constrain
the hole's position, as opposed to hand_low and hand_high
"""
def __init__(self):
hand_init_pos = (0, 0.6, 0.2)
hand_low = (-0.5, 0.40, 0.05)
hand_high = (0.5, 1, 0.5)
obj_low = (.0, 0.5, 0.02)
obj_high = (.2, 0.7, 0.02)
goal_low = (-0.35, 0.4, -0.001)
goal_high = (-0.25, 0.7, 0.001)
super().__init__(
self.model_name,
hand_low=hand_low,
hand_high=hand_high,
)
self.init_config = {
'obj_init_pos': np.array([0, 0.6, 0.02]),
'hand_init_pos': np.array([0, .6, .2]),
}
self.goal = np.array([-0.3, 0.6, 0.0])
self.obj_init_pos = self.init_config['obj_init_pos']
self.hand_init_pos = self.init_config['hand_init_pos']
self.hand_init_pos = np.array(hand_init_pos)
self._random_reset_space = Box(
np.hstack((obj_low, goal_low)),
np.hstack((obj_high, goal_high)),
)
self.goal_space = Box(
np.array(goal_low) + np.array([.03, .0, .13]),
np.array(goal_high) + np.array([.03, .0, .13])
)
@property
def model_name(self):
return full_v2_path_for('sawyer_xyz/sawyer_peg_insertion_side.xml')
@_assert_task_is_set
def evaluate_state(self, obs, action):
obj = obs[4:7]
reward, tcp_to_obj, tcp_open, obj_to_target, grasp_reward, in_place_reward, collision_box_front, ip_orig= (
self.compute_reward(action, obs))
grasp_success = float(tcp_to_obj < 0.02 and (tcp_open > 0) and (obj[2] - 0.01 > self.obj_init_pos[2]))
success = float(obj_to_target <= 0.07)
near_object = float(tcp_to_obj <= 0.03)
info = {
'success': success,
'near_object': near_object,
'grasp_success': grasp_success,
'grasp_reward': grasp_reward,
'in_place_reward': in_place_reward,
'obj_to_target': obj_to_target,
'unscaled_reward': reward,
}
return reward, info
def _get_pos_objects(self):
return self._get_site_pos('pegGrasp')
def _get_quat_objects(self):
return Rotation.from_matrix(self.data.get_site_xmat('pegGrasp')).as_quat()
def reset_model(self):
self._reset_hand()
pos_peg = self.obj_init_pos
pos_box = self.goal
if self.random_init:
pos_peg, pos_box = np.split(self._get_state_rand_vec(), 2)
while np.linalg.norm(pos_peg[:2] - pos_box[:2]) < 0.1:
pos_peg, pos_box = np.split(self._get_state_rand_vec(), 2)
self.obj_init_pos = pos_peg
self.peg_head_pos_init = self._get_site_pos('pegHead')
self._set_obj_xyz(self.obj_init_pos)
self.sim.model.body_pos[self.model.body_name2id('box')] = pos_box
self._target_pos = pos_box + np.array([.03, .0, .13])
return self._get_obs()
def compute_reward(self, action, obs):
tcp = self.tcp_center
obj = obs[4:7]
obj_head = self._get_site_pos('pegHead')
tcp_opened = obs[3]
target = self._target_pos
tcp_to_obj = np.linalg.norm(obj - tcp)
scale = np.array([1., 2., 2.])
# force agent to pick up object then insert
obj_to_target = np.linalg.norm((obj_head - target) * scale)
in_place_margin = np.linalg.norm((self.peg_head_pos_init - target) * scale)
in_place = reward_utils.tolerance(obj_to_target,
bounds=(0, self.TARGET_RADIUS),
margin=in_place_margin,
sigmoid='long_tail',)
ip_orig = in_place
brc_col_box_1 = self._get_site_pos('bottom_right_corner_collision_box_1')
tlc_col_box_1 = self._get_site_pos('top_left_corner_collision_box_1')
brc_col_box_2 = self._get_site_pos('bottom_right_corner_collision_box_2')
tlc_col_box_2 = self._get_site_pos('top_left_corner_collision_box_2')
collision_box_bottom_1 = reward_utils.rect_prism_tolerance(curr=obj_head,
one=tlc_col_box_1,
zero=brc_col_box_1)
collision_box_bottom_2 = reward_utils.rect_prism_tolerance(curr=obj_head,
one=tlc_col_box_2,
zero=brc_col_box_2)
collision_boxes = reward_utils.hamacher_product(collision_box_bottom_2,
collision_box_bottom_1)
in_place = reward_utils.hamacher_product(in_place,
collision_boxes)
pad_success_margin = 0.03
object_reach_radius=0.01
x_z_margin = 0.005
obj_radius = 0.0075
object_grasped = self._gripper_caging_reward(action,
obj,
object_reach_radius=object_reach_radius,
obj_radius=obj_radius,
pad_success_thresh=pad_success_margin,
xz_thresh=x_z_margin,
high_density=True)
if tcp_to_obj < 0.08 and (tcp_opened > 0) and (obj[2] - 0.01 > self.obj_init_pos[2]):
object_grasped = 1.
in_place_and_object_grasped = reward_utils.hamacher_product(object_grasped,
in_place)
reward = in_place_and_object_grasped
if tcp_to_obj < 0.08 and (tcp_opened > 0) and (obj[2] - 0.01 > self.obj_init_pos[2]):
reward += 1. + 5 * in_place
if obj_to_target <= 0.07:
reward = 10.
return [reward, tcp_to_obj, tcp_opened, obj_to_target, object_grasped, in_place, collision_boxes, ip_orig]
|
rlworkgroup/metaworld
|
metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_peg_insertion_side_v2.py
|
Python
|
mit
| 7,286
|
#!/usr/bin/env python2
"""Trains a CNN using Keras. Includes a bunch of fancy stuff so that you don't
lose your work when you Ctrl + C."""
from argparse import ArgumentParser, ArgumentTypeError
import datetime
from itertools import groupby
from json import dumps
import logging
from logging import info, warn
from os import path, makedirs, environ
from multiprocessing import Process, Queue, Event, Lock
from Queue import Full
from random import randint
from sys import stdout, argv
from time import time
import h5py
from keras.models import Graph
from keras.optimizers import SGD
from keras.utils.generic_utils import Progbar
import numpy as np
from scipy.io import loadmat
import models
from utils import get_model_lr
INIT = 'he_normal'
def mkdir_p(dir_path):
try:
makedirs(dir_path)
except OSError as e:
# 17 means "already exists"
if e.errno != 17:
raise e
class TimedContext(object):
def __init__(self, name=None):
self.name = name
def __enter__(self):
self.start = time()
def __exit__(self, *args, **kwargs):
elapsed = time() - self.start
name_str = self.name or 'Unnamed timed context'
print('%s took %fs' % (name_str, elapsed))
class NumericLogger(object):
def __init__(self, dest):
self.dest = dest
self.lock = Lock()
def append(self, data):
if 'time' not in data:
data['time'] = datetime_str()
json_data = dumps(data)
# No file-level locking because YOLO
with self.lock:
with open(self.dest, 'a') as fp:
# Should probably use a binary format or something. Oh well.
fp.write(json_data + '\n')
# Needs to be set up in main function
numeric_log = None
def group_sort_dedup_indices(indices):
"""Takes a list of the form `[(major_index, minor_index)]` and returns a
list of the form `[(major_index, [minor_indices])]`, where major indices
and minor indices are still grouped as before, but both major and minor
indices are sorted. Minor indices are also deduplicated, so `p[1]` will be
a sorted, deduplicated list for each `p` in the return value.
This function is very useful for generating h5py slices, since h5py
requires sorted, deduplicated indices to batch-select specific elements
from a dataset."""
sorted_ins = sorted(indices)
keyfun = lambda indices: indices[0]
rv = []
for k, g in groupby(sorted_ins, keyfun):
sorted_minors = [t[1] for t in g]
# Deduplicate as well
minors = []
for idx, val in enumerate(sorted_minors):
if idx == 0 or sorted_minors[idx - 1] != val:
minors.append(val)
rv.append((k, minors))
return rv
class BatchReader(object):
def __init__(self, h5_paths, inputs, outputs, batch_size, mark_epochs,
shuffle, mean_pixels):
"""Initialise the worker.
:param list h5_paths: List of paths to HDF5 files to read.
:param list inputs: List of input names, corresponding to HDF5
datasets.
:param list outputs: List of output names, again corresponding to HDF5
datasets.
:param int batch_size: Number of datums in batches to return.
:param bool mark_epochs: Whether to push None to the queue at the end
of an epoch.
:param bool shuffle: Should data be shuffled?
:param dict mean_pixels: Dictionary giving mean pixels for each
channel."""
self.h5_files = [h5py.File(path, 'r') for path in h5_paths]
self.inputs = inputs
self.outputs = outputs
for filename in inputs + outputs:
assert not filename.startswith('/')
assert len(inputs) > 0, "Need at least one input"
assert len(outputs) > 0, "Need at least one output"
self.batch_size = batch_size
self.mark_epochs = mark_epochs
self.shuffle = shuffle
self.mean_pixels = mean_pixels
self._index_pool = []
def _refresh_index_pool(self):
self._index_pool = []
for idx, fp in enumerate(self.h5_files):
some_output = self.outputs[0]
label_set = fp[some_output]
data_size = len(label_set)
self._index_pool.extend(
(idx, datum_idx) for datum_idx in xrange(data_size)
)
if self.shuffle:
np.random.shuffle(self._index_pool)
def _pop_n_indices(self, n):
rv = self._index_pool[:n]
del self._index_pool[:n]
return rv
def _get_batch_indices(self):
if self.mark_epochs and not self._index_pool:
# The index pool has been exhausted, so we need to return [] and
# refresh the index pool
self._refresh_index_pool()
indices = self._pop_n_indices(self.batch_size)
while len(indices) < self.batch_size:
start_len = len(indices)
self._refresh_index_pool()
indices.extend(self._pop_n_indices(self.batch_size - start_len))
# Just check that the number of indices we have is actually
# increasing
assert len(indices) - start_len > 0, \
"Looks like we ran out of indices :/"
return group_sort_dedup_indices(indices)
def _get_ds(self, ds_name, indices):
sub_batch = None
for fp_idx, data_indices in indices:
fp = self.h5_files[fp_idx]
# This line used to yield a cryptic internal error whenever
# data_indices contained duplicates.
fp_data = fp[ds_name][data_indices].astype('float32')
if sub_batch is None:
sub_batch = fp_data
else:
assert fp_data.shape[1:] == sub_batch.shape[1:]
sub_batch = np.concatenate((sub_batch, fp_data), axis=0)
assert sub_batch is not None
mean_pixel = self.mean_pixels.get(ds_name)
if mean_pixel is not None:
# The .reshape() allows Numpy to broadcast it
assert sub_batch.ndim == 4, "Can only mean-subtract images"
sub_batch -= mean_pixel.reshape(
(1, sub_batch.shape[1], 1, 1)
)
elif sub_batch.ndim > 2:
warn("There's no mean pixel for dataset %s" % ds_name)
return sub_batch
def _get_sub_batches(self, ds_fields, indices):
sub_batch = {}
for ds_name in ds_fields:
sub_batch[ds_name] = self._get_ds(ds_name, indices)
return sub_batch
def get_batch(self):
# First, fetch a batch full of data
batch_indices = self._get_batch_indices()
assert(batch_indices or self.mark_epochs)
if self.mark_epochs and not batch_indices:
return None
inputs = self._get_sub_batches(self.inputs, batch_indices)
outputs = self._get_sub_batches(self.outputs, batch_indices)
assert inputs.viewkeys() != outputs.viewkeys(), \
"Can't mix inputs and outputs"
# 'inputs' is just going to be our batch now
inputs.update(outputs)
return inputs
def close(self):
for fp in self.h5_files:
fp.close()
def h5_read_worker(
out_queue, end_evt, h5_paths, inputs, outputs, mean_pixels,
batch_size, mark_epochs, shuffle
):
"""This function is designed to be run in a multiprocessing.Process, and
communicate using a ``multiprocessing.Queue``. It will just keep reading
batches and pushing them (complete batches!) to the queue in a tight loop;
obviously this will block as soon as the queue is full, at which point this
process will wait until it can read again. Note that ``end_evt`` is an
Event which should be set once the main thread wants to exit.
At the end of each epoch, ``None`` will be pushed to the output queue iff
``mark_epochs`` is True. This notifies the training routine that it should
perform validation or whatever it is training routines do nowadays."""
# See https://bugs.python.org/issue8426
# mp.Queues work by pickling objects to be enqueued and then sending them
# across a Unix pipe. By default, Queue installs an atexit handler which
# waits for all enqueued data to be written to the Unix pipe. This seems to
# hang when the receiver has exited, possibly due to limits on the amount
# of data which can be buffered in a pipe. cancel_join_thread() either
# removes that atexit handler or makes it a noop. This is not the default
# behaviour because it results in unwritten data being irrevocably lost
# (which is okay for us!).
out_queue.cancel_join_thread()
reader = BatchReader(
h5_paths=h5_paths, inputs=inputs, outputs=outputs,
batch_size=batch_size, mark_epochs=mark_epochs, shuffle=shuffle,
mean_pixels=mean_pixels
)
# Outer loop is to keep pushing forever, inner loop just polls end_event
# periodically if we're waiting to push to the queue
try:
while True:
batch = reader.get_batch()
while True:
if end_evt.is_set():
return
try:
out_queue.put(batch, timeout=0.05)
break
except Full:
# Queue.Full (for Queue = the module in stdlib, not the
# class) is raised when we time out
pass
finally:
print('Worker hit finally block; exiting')
def get_sample_weight(data, classname, masks):
# [:] is for benefit of h5py
class_data = data[classname][:].astype('int')
assert class_data.ndim == 2
# Quick checks to ensure it's valid one-hot data
assert class_data.shape[1] > 1
assert (np.sum(class_data, axis=1) == 1).all()
assert np.logical_or(class_data == 1, class_data == 0).all()
# The data is one-hot, so we need to change it to be just integer class
# labels
classes = np.argmax(class_data, axis=1)
assert classes.ndim == 1
# num_classes = class_data.shape[1]
# Make sure that the number of masks is the number of classes or the number
# of classes + 1
mask_names = set(masks.keys())
# XXX: I've commented out these assertions because they only made sense
# when we needed a 1:1 mapping between classes and outputs.
# assert len(mask_names) == len(masks)
# assert num_classes - 1 <= len(mask_names) <= num_classes
# mask_vals = {val for name, val in masks}
# assert(len(mask_vals) == len(mask_names))
# Masks are in [0, num_classes); assert that this is the case
# Note that if the number of classes is one fewer than the number of input
# masks, then we assume that the zeroth class does not control any external
# loss.
# assert max(mask_vals) == num_classes - 1
# assert len(mask_names) < num_classes or min(mask_vals) == 0
sample_weight = {}
for mask_name, mask_vals in masks.iteritems():
sample_weight[mask_name] = np.in1d(classes, mask_vals).astype('float32')
assert len(sample_weight) == len(mask_names)
return sample_weight
def horrible_get(q):
"""Logically equivalent to ``q.get()``, but (possibly!) works around a
horrible, undocumented Python bug: https://bugs.python.org/issue1360. I say
"possibly" because I don't know whether this is actually fixing anything.
Might have to remove it later to find out."""
while True:
try:
return q.get(timeout=60)
except Full:
continue
def train(model, queue, iterations, mask_class_name, masks):
"""Perform a fixed number of training iterations."""
assert (mask_class_name is None) == (masks is None)
info('Training for %i iterations', iterations)
p = Progbar(iterations)
loss = 0.0
p.update(0)
mean_loss = 0
for iteration in xrange(iterations):
# First, get some data from the queue
start_time = time()
data = horrible_get(queue)
fetch_time = time() - start_time
if mask_class_name is not None:
sample_weight = get_sample_weight(data, mask_class_name, masks)
else:
sample_weight = {}
# Next, do some backprop
start_time = time()
loss, = model.train_on_batch(data, sample_weight=sample_weight)
loss = float(loss)
bp_time = time() - start_time
learning_rate = get_model_lr(model)
# Finally, write some debugging output
extra_info = [
('loss', loss),
('lr', learning_rate),
('fetcht', fetch_time),
('bpropt', bp_time)
]
p.update(iteration + 1, extra_info)
# Update mean loss
mean_loss += float(loss) / iterations
# Log results to numeric log
numlog_data = dict(extra_info)
numlog_data['type'] = 'train'
numlog_data['bsize'] = len(data[data.keys()[0]])
numeric_log.append(numlog_data)
learning_rate = model.optimizer.get_config()['lr']
info('Finished {} training batches, mean loss-per-batch {}, LR {}'.format(
iterations, mean_loss, learning_rate
))
def validate(model, queue, batches, mask_class_name, masks):
"""Perform one epoch of validation."""
info('Testing on validation set')
samples = 0
weighted_loss = 0.0
for batch_num in xrange(batches):
data = horrible_get(queue)
assert data is not None
if mask_class_name is not None:
sample_weight = get_sample_weight(data, mask_class_name, masks)
else:
sample_weight = {}
loss, = model.test_on_batch(data, sample_weight=sample_weight)
loss = float(loss)
# Update stats
sample_size = len(data[data.keys()[0]])
samples += sample_size
weighted_loss += sample_size * loss
numeric_log.append({
'type': 'val_batch',
'loss': loss,
'w_loss': weighted_loss,
'bsize': sample_size
})
if (batch_num % 10) == 0:
info('%i validation batches tested', batch_num)
mean_loss = weighted_loss / max(1, samples)
info(
'Finished %i batches (%i samples); mean loss-per-sample %f',
batches, samples, mean_loss
)
numeric_log.append({
'type': 'val_done',
'mean_loss': mean_loss
})
def save(model, iteration_no, dest_dir):
"""Save the model to a checkpoint file."""
filename = 'model-iter-{}-r{:06}.h5'.format(iteration_no, randint(1, 1e6-1))
full_path = path.join(dest_dir, filename)
# Note that save_weights will prompt if the file already exists. This is
# why I've added a small random number to the end; hopefully this will
# allow unattended optimisation runs to complete even when Keras decides
# that it doesn't want to play nicely.
info("Saving model to %s", full_path)
model.save_weights(full_path)
return full_path
def read_mean_pixels(mat_path):
if mat_path is None:
# No mean pixel
return {}
mat = loadmat(mat_path)
mean_pixels = {
k: v.flatten() for k, v in mat.iteritems() if not k.startswith('_')
}
return mean_pixels
def sub_mean_pixels(mean_pixels, all_data):
rv = {}
for name, data in all_data.iteritems():
mean_pixel = mean_pixels.get(name)
if mean_pixel is not None:
assert data.ndim == 4, "Can only mean-subtract images"
rv[name] = data - mean_pixel.reshape(
(1, data.shape[1], 1, 1)
)
elif data.ndim > 2:
# Only warn about image-like things
warn("There's no mean pixel for dataset %s" % name)
return rv
def infer_sizes(h5_path):
"""Just return shapes of all datasets, assuming that different samples are
indexed along the first dimension."""
rv = {}
with h5py.File(h5_path, 'r') as fp:
for key in fp.keys():
rv[key] = fp[key].shape[1:]
return rv
def _model_io_map(config):
return {
cfg['name']: cfg for cfg in config
}
def get_model_io(model):
assert isinstance(model, Graph)
inputs = _model_io_map(model.input_config)
outputs = _model_io_map(model.output_config)
return (inputs, outputs)
def h5_parser(h5_string):
# parse strings,like,this without worrying about ,,stuff,like,,this,
rv = [p for p in h5_string.split(',') if p]
if not rv:
raise ArgumentTypeError('Expected at least one path')
return rv
def loss_mask_parser(arg):
"""Takes as input a string dictating which losses should be enabled by
which class values, and returns a dictionary with the same information in a
more malleable form.
:param arg: String of form
``<class>:<output>=<value>,<output>=<value>,...``
:returns: Dictionary with keys corresponding to seen outputs, each with an
array value indicating which class values should unmask it; if
the class holds any of the values in the set associated with an
output, then that output should count towards the total loss of
the model."""
classname, rest = arg.split(':', 1)
nosep = rest.split(',')
pairs = [s.split('=', 1) for s in nosep if '=' in s]
set_dict = {}
for label, clas in pairs:
set_dict.setdefault(label, set()).add(int(clas))
# We return a dictionary mapping output names to *Numpy arrays* of
# corresponding classes. This lets us use np.in1d to test for membership in
# a vectorised way.
rv_dict = {
k: np.fromiter(v, dtype='int') for k, v in set_dict.iteritems()
}
return classname, rv_dict
def datetime_str():
return datetime.datetime.now().isoformat()
def setup_logging(work_dir):
global numeric_log
logging.basicConfig(level=logging.DEBUG)
log_dir = path.join(work_dir, 'logs')
mkdir_p(log_dir)
t = datetime_str()
num_log_fn = path.join(log_dir, 'numlog-' + t + '.log')
log_file = path.join(log_dir, 'log-' + t + '.log')
file_handler = logging.FileHandler(log_file, mode='a')
logging.getLogger().addHandler(file_handler)
numeric_log = NumericLogger(num_log_fn)
info('=' * 80)
info('Logging started at ' + datetime_str())
info('Human-readable log path: {}'.format(log_file))
info('Numeric log path: {}'.format(num_log_fn))
def load_model(args):
ds_shape = infer_sizes(args.train_h5s[0])
solver = SGD(
lr=args.learning_rate, decay=args.decay, momentum=0.9, nesterov=True
)
model_to_load = getattr(models, args.model_name)
info('Using loader %s' % args.model_name)
model = model_to_load(
ds_shape, solver, INIT
)
info('Loaded model of type {}'.format(type(model)))
opt_cfg = model.optimizer.get_config()
info('Solver data: decay={decay}, lr={lr}, momentum={momentum}, '
'nesterov={nesterov}'.format(**opt_cfg))
if args.finetune_path is not None:
info("Loading weights from '%s'", args.finetune_path)
model.load_weights(args.finetune_path)
return model
def get_parser():
"""Grab the ``argparse.ArgumentParser`` for this application. For some
reason ``argparse`` needs access to ``sys.argv`` to build an
``ArgumentParser`` (not just to actually evaluate it), so I've put this
into its own function so that it doesn't get executed when running from
environments with no ``sys.argv`` (e.g. Matlab)"""
parser = ArgumentParser(description="Train a CNN to regress joints")
# Mandatory arguments
parser.add_argument(
'train_h5s', metavar='TRAINDATA', type=h5_parser,
help='h5 files in which training samples are stored (comma separated)'
)
parser.add_argument(
'val_h5s', metavar='VALDATA', type=h5_parser,
help='h5 file in which validation samples are stored (comma separated)'
)
parser.add_argument(
'working_dir', metavar='WORKINGDIR', type=str,
help='directory in which to store checkpoint files and logs'
)
# Optargs
parser.add_argument(
'--queued-batches', dest='queued_batches', type=int, default=32,
help='number of unused batches stored in processing queue (in memory)'
)
parser.add_argument(
'--batch-size', dest='batch_size', type=int, default=16,
help='batch size for both training (backprop) and validation'
)
parser.add_argument(
'--checkpoint-epochs', dest='checkpoint_epochs', type=int, default=5,
help='training intervals to wait before writing a checkpoint file'
)
parser.add_argument(
'--train-interval-batches', dest='train_interval_batches', type=int,
default=256, help='number of batches to train for between validation'
)
parser.add_argument(
'--mean-pixel-mat', dest='mean_pixel_path', type=str, default=None,
help='.mat containing mean pixel'
)
parser.add_argument(
'--learning-rate', dest='learning_rate', type=float, default=0.0001,
help='learning rate for SGD'
)
parser.add_argument(
'--decay', dest='decay', type=float, default=1e-6,
help='decay for SGD'
)
parser.add_argument(
'--finetune', dest='finetune_path', type=str, default=None,
help='finetune from these weights instead of starting again'
)
parser.add_argument(
'--write-fc-weights', dest='fc_weight_path', type=str, default=None,
help='use this to write fully convolutional net weights to some path'
)
parser.add_argument(
'--write-fc-json', dest='fc_json_path', type=str, default=None,
help='use this to write fully convolutional net spec to some path'
)
parser.add_argument(
'--max-iter', dest='max_iter', type=int, default=None,
help='maximum number of iterations to run for'
)
# TODO: Add configuration option to just run through the entire validation set
# like I was doing before. That's a lot faster than using randomly sampled
# stuff. Edit: I think I pushed down the validaiton block size, so now random
# selection should be relatively fast.
parser.add_argument(
'--val-batches', dest='val_batches', type=int, default=50,
help='number of batches to run during each validation step'
)
parser.add_argument(
# Syntax proposal: 'class:out1=1,out2=2,out3=3', where 'class' is the name
# of the class output (we only look at the ground truth) and out1,out2,out3
# are names of outputs to be masked. In this case, out1's loss is only
# enabled when the GT class is 1 (or [0 1 0 0 ...] in one-hot notation),
# out2's loss is only enabled whne the GT class is 2 ([0 0 1 0 ...]), etc.
'--cond-losses', dest='loss_mask', type=loss_mask_parser, default=None,
help="use given GT class to selectively enable losses"
)
parser.add_argument(
'--model-name', dest='model_name', type=str,
default='vggnet16_joint_reg_class_flow',
help='name of model to use'
)
return parser
if __name__ == '__main__':
# Start by parsing arguments and setting up logger
parser = get_parser()
args = parser.parse_args()
# Set up checkpointing and logging
work_dir = args.working_dir
checkpoint_dir = path.join(work_dir, 'checkpoints')
mkdir_p(checkpoint_dir)
setup_logging(work_dir)
info('argv: {}'.format(argv))
info('THEANO_FLAGS: {}'.format(environ.get('THEANO_FLAGS')))
# Model-building
model = load_model(args)
inputs, outputs = [d.keys() for d in get_model_io(model)]
mod_json = model.to_json()
model_json_path = path.join(checkpoint_dir, 'train_model.json')
with open(model_json_path, 'w') as fp:
info('Saving model definition to ' + model_json_path)
fp.write(mod_json)
# Prefetching stuff
end_event = Event()
mean_pixels = read_mean_pixels(args.mean_pixel_path)
# Training data prefetch
train_queue = Queue(args.queued_batches)
# We supply everything as kwargs so that I know what I'm passing in
train_kwargs = dict(
h5_paths=args.train_h5s, batch_size=args.batch_size,
out_queue=train_queue, end_evt=end_event, mark_epochs=False,
shuffle=True, mean_pixels=mean_pixels, inputs=inputs, outputs=outputs
)
train_worker = Process(target=h5_read_worker, kwargs=train_kwargs)
# Validation data prefetch
val_queue = Queue(args.queued_batches)
val_kwargs = dict(
h5_paths=args.val_h5s, batch_size=args.batch_size, out_queue=val_queue,
end_evt=end_event, mark_epochs=False, shuffle=True,
mean_pixels=mean_pixels, inputs=inputs, outputs=outputs
)
val_worker = Process(target=h5_read_worker, kwargs=val_kwargs)
if args.loss_mask is not None:
mask_class_name, masks = args.loss_mask
else:
warn('No masks supplied for conditional regression!')
mask_class_name, masks = None, None
try:
# Protect this in a try: for graceful cleanup of workers
train_worker.start()
val_worker.start()
# Stats
epochs_elapsed = 0
batches_used = 0
try:
while True:
# Train and validate
validate(
model, val_queue, args.val_batches, mask_class_name, masks
)
train(
model, train_queue, args.train_interval_batches,
mask_class_name, masks
)
# Update stats
epochs_elapsed += 1
batches_used += args.train_interval_batches
is_checkpoint_epoch = epochs_elapsed % args.checkpoint_epochs == 0
if epochs_elapsed > 0 and is_checkpoint_epoch:
save(model, batches_used, checkpoint_dir)
if args.max_iter is not None \
and epochs_elapsed > args.max_iter:
info(
'Maximum iterations (%i) exceeded; terminating',
args.max_iter
)
break
finally:
# Always save afterwards, even if we get KeyboardInterrupt'd or
# whatever
stdout.write('\n')
save(model, batches_used, checkpoint_dir)
# Convert to fully convolutional net if necessary
if args.fc_json_path or args.fc_weight_path:
info('Upgrading to fully convolutional network')
upgraded = models.upgrade_multipath_poselet_vggnet(model)
if args.fc_json_path:
info('Saving model spec as JSON to %s', args.fc_json_path)
mod_json = upgraded.to_json()
with open(args.fc_json_path, 'w') as fp:
fp.write(mod_json)
if args.fc_weight_path:
info('Saving weights to %s', args.fc_weight_path)
upgraded.save_weights(args.fc_weight_path, overwrite=True)
finally:
# Make sure workers shut down gracefully
end_event.set()
stdout.write('\n')
info('Waiting for workers to exit (could take some time)')
# XXX: My termination scheme (with end_event) is not working, and I
# can't tell where the workers are getting stuck. It seems to be in a
# cleanup function somewhere (maybe attach GDB to it?)
train_worker.join()
val_worker.join()
|
qxcv/joint-regressor
|
keras/train.py
|
Python
|
apache-2.0
| 27,660
|
#!/usr/bin/env python
#
# Copyright (c) 2015 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this
# list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the original 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 Intel Corporation nor the names of its contributors
# may be used to endorse or promote products derived from this work without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "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 INTEL CORPORATION 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.
#
# Authors:
# Yun, Liu<yunx.liu@intel.com>
import unittest
import os
from xml.etree import ElementTree
import json
import sys
sys.path.append("../")
import comm
class TestCrosswalkApptoolsFunctions(unittest.TestCase):
def test_display_fullscreen(self):
comm.setUp()
comm.create(self)
os.chdir('org.xwalk.test')
jsonfile = open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "r")
jsons = jsonfile.read()
jsonfile.close()
jsonDict = json.loads(jsons)
jsonDict["display"] = "fullscreen"
json.dump(jsonDict, open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "w"))
buildcmd = comm.PackTools + "crosswalk-app build"
buildstatus = os.system(buildcmd)
comm.clear("org.xwalk.test")
self.assertEquals(buildstatus, 0)
def test_packageID_normal(self):
comm.setUp()
comm.create(self)
os.chdir('org.xwalk.test')
with open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json") as json_file:
data = json.load(json_file)
comm.clear("org.xwalk.test")
self.assertEquals(data['xwalk_package_id'].strip(os.linesep), "org.xwalk.test")
if __name__ == '__main__':
unittest.main()
|
kangxu/crosswalk-test-suite
|
apptools/apptools-ios-tests/apptools/CI/manifest_basic.py
|
Python
|
bsd-3-clause
| 2,784
|
#!/usr/bin/env python
#============================================================================
# P Y I B E X
# File : test_Bsc.cpp
# Author : Benoit Desrochers
# Copyright : Benoit Desrochers
# License : See the LICENSE file
# Created : Dec 28, 2014
#============================================================================
import unittest
import pyIbex
from pyIbex import *
class TestBsc(unittest.TestCase):
def test_LargestFirst(self):
bsc = LargestFirst(0.1)
a = IntervalVector([[1,2], [2,6]])
(c,b) = bsc.bisect(a)
self.assertEqual(c, IntervalVector([[1,2],[2,3.8]]))
self.assertEqual(b, IntervalVector([[1,2],[3.8,6]]))
self.assertTrue(True)
def test_LargestFirst2(self):
bsc = LargestFirst([0.1, 1])
a = IntervalVector([[1,2], [2,6]])
(c,b) = bsc.bisect(a)
self.assertEqual(c, IntervalVector([[1,1.45],[2,6]]))
self.assertEqual(b, IntervalVector([[1.45,2],[2,6]]))
self.assertTrue(True)
if __name__ == '__main__':
unittest.main()
|
msis/pyIbex
|
tests/test_Bsc.py
|
Python
|
lgpl-3.0
| 1,034
|
#!/usr/bin/python3
# Copyright 2016 Francisco Pina Martins <f.pinamartins@gmail.com>
# This file is part of layer_data_extractor.
# layer_data_extractor 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.
# layer_data_extractor 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 layer_data_extractor. If not, see <http://www.gnu.org/licenses/>.
# Most of the code was taken from here: <http://en.proft.me/2015/09/20/converting-latitude-and-longitude-decimal-values-p/>
# Usage:python3 simpe_coordinate_converter.py coords.csv
import re
def dms2dd(degrees, minutes, seconds, direction):
"""
Convert DMS coordinates to decimal degrees
"""
decdeg = float(degrees) + float(minutes)/60 + float(seconds)/(60*60)
if direction == 'S' or direction == 'W':
decdeg *= -1
return str(round(decdeg, 4))
def parse_dms(dms):
parts = re.split('[^\dESNW.]+', dms)
lat = dms2dd(parts[0], parts[1], parts[2], parts[3])
lng = dms2dd(parts[4], parts[5], parts[6], parts[7])
return (lat, lng)
def main(coords_filename):
"""
Reads the DMS values from a CSV file and outputs the converted values to
STDOUT. Assumes a header, tab delimiters and the order "ID LAT LON".
"""
infile = open(coords_filename, 'r')
header = infile.readline() # Skip header
print(header, end="")
for lines in infile:
if "N/A" in lines:
continue
data = lines.split("\t")
label = data[0]
decdeg = parse_dms("\t".join(data[1:]))
print(label + "\t" + "\t".join(decdeg))
if __name__ == "__main__":
from sys import argv
main(argv[1])
|
StuntsPT/Misc_GIS_scripts
|
simple_coordinate_converter.py
|
Python
|
gpl-3.0
| 2,069
|
"""
A test spanning all the capabilities of all the serializers.
This class sets up a model for each model field type
(except for image types, because of the Pillow dependency).
"""
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
# The following classes are for testing basic data
# marshalling, including NULL values, where allowed.
class BinaryData(models.Model):
data = models.BinaryField(null=True)
class BooleanData(models.Model):
data = models.BooleanField(default=False)
class CharData(models.Model):
data = models.CharField(max_length=30, null=True)
class DateData(models.Model):
data = models.DateField(null=True)
class DateTimeData(models.Model):
data = models.DateTimeField(null=True)
class DecimalData(models.Model):
data = models.DecimalField(null=True, decimal_places=3, max_digits=5)
class EmailData(models.Model):
data = models.EmailField(null=True)
class FileData(models.Model):
data = models.FileField(null=True, upload_to='/foo/bar')
class FilePathData(models.Model):
data = models.FilePathField(null=True)
class FloatData(models.Model):
data = models.FloatField(null=True)
class IntegerData(models.Model):
data = models.IntegerField(null=True)
class BigIntegerData(models.Model):
data = models.BigIntegerField(null=True)
# class ImageData(models.Model):
# data = models.ImageField(null=True)
class GenericIPAddressData(models.Model):
data = models.GenericIPAddressField(null=True)
class NullBooleanData(models.Model):
data = models.NullBooleanField(null=True)
class PositiveIntegerData(models.Model):
data = models.PositiveIntegerField(null=True)
class PositiveSmallIntegerData(models.Model):
data = models.PositiveSmallIntegerField(null=True)
class SlugData(models.Model):
data = models.SlugField(null=True)
class SmallData(models.Model):
data = models.SmallIntegerField(null=True)
class TextData(models.Model):
data = models.TextField(null=True)
class TimeData(models.Model):
data = models.TimeField(null=True)
class Tag(models.Model):
"""A tag on an item."""
data = models.SlugField()
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey()
class Meta:
ordering = ["data"]
class GenericData(models.Model):
data = models.CharField(max_length=30)
tags = GenericRelation(Tag)
# The following test classes are all for validation
# of related objects; in particular, forward, backward,
# and self references.
class Anchor(models.Model):
"""This is a model that can be used as
something for other models to point at"""
data = models.CharField(max_length=30)
class Meta:
ordering = ('id',)
class NaturalKeyAnchorManager(models.Manager):
def get_by_natural_key(self, data):
return self.get(data=data)
class NaturalKeyAnchor(models.Model):
objects = NaturalKeyAnchorManager()
data = models.CharField(max_length=100, unique=True)
title = models.CharField(max_length=100, null=True)
def natural_key(self):
return (self.data,)
class UniqueAnchor(models.Model):
"""This is a model that can be used as
something for other models to point at"""
data = models.CharField(unique=True, max_length=30)
class FKData(models.Model):
data = models.ForeignKey(Anchor, null=True)
class FKDataNaturalKey(models.Model):
data = models.ForeignKey(NaturalKeyAnchor, null=True)
class M2MData(models.Model):
data = models.ManyToManyField(Anchor)
class O2OData(models.Model):
# One to one field can't be null here, since it is a PK.
data = models.OneToOneField(Anchor, primary_key=True)
class FKSelfData(models.Model):
data = models.ForeignKey('self', null=True)
class M2MSelfData(models.Model):
data = models.ManyToManyField('self', symmetrical=False)
class FKDataToField(models.Model):
data = models.ForeignKey(UniqueAnchor, null=True, to_field='data')
class FKDataToO2O(models.Model):
data = models.ForeignKey(O2OData, null=True)
class M2MIntermediateData(models.Model):
data = models.ManyToManyField(Anchor, through='Intermediate')
class Intermediate(models.Model):
left = models.ForeignKey(M2MIntermediateData)
right = models.ForeignKey(Anchor)
extra = models.CharField(max_length=30, blank=True, default="doesn't matter")
# The following test classes are for validating the
# deserialization of objects that use a user-defined
# field as the primary key.
# Some of these data types have been commented out
# because they can't be used as a primary key on one
# or all database backends.
class BooleanPKData(models.Model):
data = models.BooleanField(primary_key=True, default=False)
class CharPKData(models.Model):
data = models.CharField(max_length=30, primary_key=True)
# class DatePKData(models.Model):
# data = models.DateField(primary_key=True)
# class DateTimePKData(models.Model):
# data = models.DateTimeField(primary_key=True)
class DecimalPKData(models.Model):
data = models.DecimalField(primary_key=True, decimal_places=3, max_digits=5)
class EmailPKData(models.Model):
data = models.EmailField(primary_key=True)
# class FilePKData(models.Model):
# data = models.FileField(primary_key=True, upload_to='/foo/bar')
class FilePathPKData(models.Model):
data = models.FilePathField(primary_key=True)
class FloatPKData(models.Model):
data = models.FloatField(primary_key=True)
class IntegerPKData(models.Model):
data = models.IntegerField(primary_key=True)
# class ImagePKData(models.Model):
# data = models.ImageField(primary_key=True)
class GenericIPAddressPKData(models.Model):
data = models.GenericIPAddressField(primary_key=True)
# This is just a Boolean field with null=True, and we can't test a PK value of NULL.
# class NullBooleanPKData(models.Model):
# data = models.NullBooleanField(primary_key=True)
class PositiveIntegerPKData(models.Model):
data = models.PositiveIntegerField(primary_key=True)
class PositiveSmallIntegerPKData(models.Model):
data = models.PositiveSmallIntegerField(primary_key=True)
class SlugPKData(models.Model):
data = models.SlugField(primary_key=True)
class SmallPKData(models.Model):
data = models.SmallIntegerField(primary_key=True)
# class TextPKData(models.Model):
# data = models.TextField(primary_key=True)
# class TimePKData(models.Model):
# data = models.TimeField(primary_key=True)
class ComplexModel(models.Model):
field1 = models.CharField(max_length=10)
field2 = models.CharField(max_length=10)
field3 = models.CharField(max_length=10)
# Tests for handling fields with pre_save functions, or
# models with save functions that modify data
class AutoNowDateTimeData(models.Model):
data = models.DateTimeField(null=True, auto_now=True)
class ModifyingSaveData(models.Model):
data = models.IntegerField(null=True)
def save(self, *args, **kwargs):
"""
A save method that modifies the data in the object.
Verifies that a user-defined save() method isn't called when objects
are deserialized (#4459).
"""
self.data = 666
super(ModifyingSaveData, self).save(*args, **kwargs)
# Tests for serialization of models using inheritance.
# Regression for #7202, #7350
class AbstractBaseModel(models.Model):
parent_data = models.IntegerField()
class Meta:
abstract = True
class InheritAbstractModel(AbstractBaseModel):
child_data = models.IntegerField()
class BaseModel(models.Model):
parent_data = models.IntegerField()
class InheritBaseModel(BaseModel):
child_data = models.IntegerField()
class ExplicitInheritBaseModel(BaseModel):
parent = models.OneToOneField(BaseModel)
child_data = models.IntegerField()
class ProxyBaseModel(BaseModel):
class Meta:
proxy = True
class ProxyProxyBaseModel(ProxyBaseModel):
class Meta:
proxy = True
class LengthModel(models.Model):
data = models.IntegerField()
def __len__(self):
return self.data
|
devops2014/djangosite
|
tests/serializers_regress/models.py
|
Python
|
bsd-3-clause
| 8,282
|
import searchFiles
import EnglishFile
def compareEngFilesAux(enFile, tokenList, listNotUsed):
while 1:
token = enFile.getNextToken()
if token:
if not token in tokenList:
listNotUsed.append(token)
else:
return listNotUsed
def compareMakeListEngAux(enFile, tokenList, listDifferences):
listAux = []
while 1:
token = enFile.getNextToken()
if (token):
listAux.append(token)
else:
break
for line in tokenList:
if not line in listAux:
listDifferences.append(line)
return listDifferences
def compareEngFiles():
sFile = searchFiles.searchFile()
tokenList = sFile.makeTokenList()
enFile = EnglishFile.englishFile()
enFile.openFile()
listNotUsed = []
listNotUsed = compareEngFilesAux(enFile, tokenList, listNotUsed)
enFile.closeFile();
return listNotUsed
def compareFilesEng():
sFile = searchFiles.searchFile()
tokenList = sFile.makeTokenList()
enFile = EnglishFile.englishFile()
enFile.openFile()
listDifferences = []
compareMakeListEngAux(enFile, tokenList, listDifferences)
enFile.closeFile();
return listDifferences
#token = enFile.getNextToken()
#if token:
# print tokenList.index(token)
|
pearltrees/tree-shape-visualization
|
tools/languageSynchronizer/compareEngFiles.py
|
Python
|
mit
| 1,413
|
def hackathon_specifics(request):
return {'HACKATHON_NAME': 'MadHacks'}
|
austinhartzheim/madhacks-live
|
madhacks/context_processors.py
|
Python
|
mit
| 76
|
#
# (c) 2017 Red Hat Inc.
#
# 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/>.
#
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
---
cliconf: exos
short_description: Use exos cliconf to run command on Extreme EXOS platform
description:
- This exos plugin provides low level abstraction apis for
sending and receiving CLI commands from Extreme EXOS network devices.
version_added: "2.6"
"""
import re
import json
from ansible.errors import AnsibleConnectionFailure
from ansible.module_utils._text import to_bytes, to_text
from ansible.module_utils.network.common.utils import to_list
from ansible.module_utils.connection import ConnectionError
from ansible.module_utils.common._collections_compat import Mapping
from ansible.module_utils.network.common.config import NetworkConfig, dumps
from ansible.plugins.cliconf import CliconfBase
class Cliconf(CliconfBase):
def get_diff(self, candidate=None, running=None, diff_match='line', diff_ignore_lines=None, path=None, diff_replace='line'):
diff = {}
device_operations = self.get_device_operations()
option_values = self.get_option_values()
if candidate is None and device_operations['supports_generate_diff']:
raise ValueError("candidate configuration is required to generate diff")
if diff_match not in option_values['diff_match']:
raise ValueError("'match' value %s in invalid, valid values are %s" % (diff_match, ', '.join(option_values['diff_match'])))
if diff_replace not in option_values['diff_replace']:
raise ValueError("'replace' value %s in invalid, valid values are %s" % (diff_replace, ', '.join(option_values['diff_replace'])))
# prepare candidate configuration
candidate_obj = NetworkConfig(indent=1)
candidate_obj.load(candidate)
if running and diff_match != 'none' and diff_replace != 'config':
# running configuration
running_obj = NetworkConfig(indent=1, contents=running, ignore_lines=diff_ignore_lines)
configdiffobjs = candidate_obj.difference(running_obj, path=path, match=diff_match, replace=diff_replace)
else:
configdiffobjs = candidate_obj.items
diff['config_diff'] = dumps(configdiffobjs, 'commands') if configdiffobjs else ''
return diff
def get_device_info(self):
device_info = {}
device_info['network_os'] = 'exos'
reply = self.run_commands({'command': 'show switch detail', 'output': 'text'})
data = to_text(reply, errors='surrogate_or_strict').strip()
match = re.search(r'ExtremeXOS version (\S+)', data)
if match:
device_info['network_os_version'] = match.group(1)
match = re.search(r'System Type: +(\S+)', data)
if match:
device_info['network_os_model'] = match.group(1)
match = re.search(r'SysName: +(\S+)', data)
if match:
device_info['network_os_hostname'] = match.group(1)
return device_info
def get_default_flag(self):
# The flag to modify the command to collect configuration with defaults
return 'detail'
def get_config(self, source='running', format='text', flags=None):
options_values = self.get_option_values()
if format not in options_values['format']:
raise ValueError("'format' value %s is invalid. Valid values are %s" % (format, ','.join(options_values['format'])))
lookup = {'running': 'show configuration', 'startup': 'debug cfgmgr show configuration file'}
if source not in lookup:
raise ValueError("fetching configuration from %s is not supported" % source)
cmd = {'command': lookup[source], 'output': 'text'}
if source == 'startup':
reply = self.run_commands({'command': 'show switch', 'format': 'text'})
data = to_text(reply, errors='surrogate_or_strict').strip()
match = re.search(r'Config Selected: +(\S+)\.cfg', data, re.MULTILINE)
if match:
cmd['command'] += match.group(1)
else:
# No Startup(/Selected) Config
return {}
cmd['command'] += ' '.join(to_list(flags))
cmd['command'] = cmd['command'].strip()
return self.run_commands(cmd)[0]
def edit_config(self, candidate=None, commit=True, replace=None, diff=False, comment=None):
resp = {}
operations = self.get_device_operations()
self.check_edit_config_capability(operations, candidate, commit, replace, comment)
results = []
requests = []
if commit:
for line in to_list(candidate):
if not isinstance(line, Mapping):
line = {'command': line}
results.append(self.send_command(**line))
requests.append(line['command'])
else:
raise ValueError('check mode is not supported')
resp['request'] = requests
resp['response'] = results
return resp
def get(self, command, prompt=None, answer=None, sendonly=False, output=None, check_all=False):
if output:
command = self._get_command_with_output(command, output)
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all)
def run_commands(self, commands=None, check_rc=True):
if commands is None:
raise ValueError("'commands' value is required")
responses = list()
for cmd in to_list(commands):
if not isinstance(cmd, Mapping):
cmd = {'command': cmd}
output = cmd.pop('output', None)
if output:
cmd['command'] = self._get_command_with_output(cmd['command'], output)
try:
out = self.send_command(**cmd)
except AnsibleConnectionFailure as e:
if check_rc is True:
raise
out = getattr(e, 'err', e)
if out is not None:
try:
out = to_text(out, errors='surrogate_or_strict').strip()
except UnicodeError:
raise ConnectionError(message=u'Failed to decode output from %s: %s' % (cmd, to_text(out)))
if output and output == 'json':
try:
out = json.loads(out)
except ValueError:
raise ConnectionError('Response was not valid JSON, got {0}'.format(
to_text(out)
))
responses.append(out)
return responses
def get_device_operations(self):
return {
'supports_diff_replace': False, # identify if config should be merged or replaced is supported
'supports_commit': False, # identify if commit is supported by device or not
'supports_rollback': False, # identify if rollback is supported or not
'supports_defaults': True, # identify if fetching running config with default is supported
'supports_commit_comment': False, # identify if adding comment to commit is supported of not
'supports_onbox_diff': False, # identify if on box diff capability is supported or not
'supports_generate_diff': True, # identify if diff capability is supported within plugin
'supports_multiline_delimiter': False, # identify if multiline delimiter is supported within config
'supports_diff_match': True, # identify if match is supported
'supports_diff_ignore_lines': True, # identify if ignore line in diff is supported
'supports_config_replace': False, # identify if running config replace with candidate config is supported
'supports_admin': False, # identify if admin configure mode is supported or not
'supports_commit_label': False, # identify if commit label is supported or not
'supports_replace': False
}
def get_option_values(self):
return {
'format': ['text', 'json'],
'diff_match': ['line', 'strict', 'exact', 'none'],
'diff_replace': ['line', 'block'],
'output': ['text', 'json']
}
def get_capabilities(self):
result = super(Cliconf, self).get_capabilities()
result['rpc'] += ['run_commmands', 'get_default_flag', 'get_diff']
result['device_operations'] = self.get_device_operations()
result['device_info'] = self.get_device_info()
result.update(self.get_option_values())
return json.dumps(result)
def _get_command_with_output(self, command, output):
if output not in self.get_option_values().get('output'):
raise ValueError("'output' value is %s is invalid. Valid values are %s" % (output, ','.join(self.get_option_values().get('output'))))
if output == 'json' and not command.startswith('run script cli2json.py'):
cmd = 'run script cli2json.py %s' % command
else:
cmd = command
return cmd
|
dagwieers/ansible
|
lib/ansible/plugins/cliconf/exos.py
|
Python
|
gpl-3.0
| 9,931
|
# -*- coding: utf-8 -*-
import re
from jinja2 import Environment
from .observable import Observable
def get_attribute(render_data, variable):
levels = variable.split('.')
r = render_data
for level in levels:
if hasattr(r, level):
r = getattr(r, level)
else:
r = r.get(level) or {}
if not r:
return ''
return r
variable_re = re.compile(r'({\s*.*\s*})')
def is_function(text, node):
fnname = render_template(text, node)
return hasattr(fnname, node)
env = Environment(variable_start_string='{', variable_end_string='}')
def render_template(text, render_data):
if not (text.startswith('{') and text.endswith('}')):
return env.from_string(text).render(**vars(render_data))
expr = text[1:-1]
return env.compile_expression(expr)(**vars(render_data))
variables = variable_re.findall(text)
variables = {var[1:-1].strip(): var for var in variables}
for variable in variables:
rendered = get_attribute(render_data, variable)
if callable(rendered):
return rendered
text = text.replace(variables[variable], rendered)
return text
|
soasme/riotpy
|
riot/template.py
|
Python
|
mit
| 1,172
|
from graph_explorer import structured_metrics
import testhelpers
def test_parse_count_and_rate():
s_metrics = structured_metrics.StructuredMetrics()
s_metrics.load_plugins()
tags_base = {
'n1': 'foo',
'n2': 'req',
'plugin': 'catchall_statsd',
'source': 'statsd',
}
def get_proto2(key, target_type, unit, updates={}):
return testhelpers.get_proto2(key, tags_base, target_type, unit, updates)
key = "stats.foo.req"
expected = get_proto2(key, 'rate', 'unknown/s')
real = s_metrics.list_metrics([key])
assert len(real) == 1
assert expected == real.values()[0]
key = "stats_counts.foo.req"
expected = get_proto2(key, 'count', 'unknown')
real = s_metrics.list_metrics([key])
assert len(real) == 1
assert expected == real.values()[0]
def test_parse_timers():
s_metrics = structured_metrics.StructuredMetrics()
s_metrics.load_plugins()
tags_base = {
'n1': 'memcached_default_get',
'plugin': 'catchall_statsd',
'source': 'statsd',
}
def get_proto2(key, target_type, unit, updates={}):
return testhelpers.get_proto2(key, tags_base, target_type, unit, updates)
key = "stats.timers.memcached_default_get.count"
expected = get_proto2(key, 'count', 'Pckt')
real = s_metrics.list_metrics([key])
assert len(real) == 1
assert expected == real.values()[0]
key = "stats.timers.memcached_default_get.count_ps"
expected = get_proto2(key, 'rate', 'Pckt/s')
real = s_metrics.list_metrics([key])
assert len(real) == 1
assert expected == real.values()[0]
key = "stats.timers.memcached_default_get.lower"
expected = get_proto2(key, 'gauge', 'ms', {'stat': 'lower'})
real = s_metrics.list_metrics([key])
assert len(real) == 1
assert expected == real.values()[0]
key = "stats.timers.memcached_default_get.mean"
expected = get_proto2(key, 'gauge', 'ms', {'stat': 'mean'})
real = s_metrics.list_metrics([key])
assert len(real) == 1
assert expected == real.values()[0]
key = "stats.timers.memcached_default_get.mean_90"
expected = get_proto2(key, 'gauge', 'ms', {'stat': 'mean_90'})
real = s_metrics.list_metrics([key])
assert len(real) == 1
assert expected == real.values()[0]
key = "stats.timers.memcached_default_get.median"
expected = get_proto2(key, 'gauge', 'ms', {'stat': 'median'})
real = s_metrics.list_metrics([key])
assert len(real) == 1
assert expected == real.values()[0]
key = "stats.timers.memcached_default_get.std"
expected = get_proto2(key, 'gauge', 'ms', {'stat': 'std'})
real = s_metrics.list_metrics([key])
assert len(real) == 1
assert expected == real.values()[0]
key = "stats.timers.memcached_default_get.sum"
expected = get_proto2(key, 'gauge', 'ms', {'stat': 'sum'})
real = s_metrics.list_metrics([key])
assert len(real) == 1
assert expected == real.values()[0]
key = "stats.timers.memcached_default_get.sum_90"
expected = get_proto2(key, 'gauge', 'ms', {'stat': 'sum_90'})
real = s_metrics.list_metrics([key])
assert len(real) == 1
assert expected == real.values()[0]
key = "stats.timers.memcached_default_get.upper"
expected = get_proto2(key, 'gauge', 'ms', {'stat': 'upper'})
real = s_metrics.list_metrics([key])
assert len(real) == 1
assert expected == real.values()[0]
key = "stats.timers.memcached_default_get.upper_90"
expected = get_proto2(key, 'gauge', 'ms', {'stat': 'upper_90'})
real = s_metrics.list_metrics([key])
assert len(real) == 1
assert expected == real.values()[0]
key = "stats.timers.memcached_default_get.histogram.bin_0_01"
expected = get_proto2(key, 'gauge', 'freq_abs', {'bin_upper': '0.01', 'orig_unit': 'ms'})
real = s_metrics.list_metrics([key])
assert len(real) == 1
assert expected == real.values()[0]
key = "stats.timers.memcached_default_get.histogram.bin_5"
expected = get_proto2(key, 'gauge', 'freq_abs', {'bin_upper': '5', 'orig_unit': 'ms'})
real = s_metrics.list_metrics([key])
assert len(real) == 1
assert expected == real.values()[0]
key = "stats.timers.memcached_default_get.histogram.bin_inf"
expected = get_proto2(key, 'gauge', 'freq_abs', {'bin_upper': 'inf', 'orig_unit': 'ms'})
real = s_metrics.list_metrics([key])
assert len(real) == 1
assert expected == real.values()[0]
|
vimeo/graph-explorer
|
graph_explorer/test/test_structured_metrics_plugin_catchall_statsd.py
|
Python
|
apache-2.0
| 4,466
|
import dbus
CONNMAN_OBJECT_PATH = 'net.connman'
bus = dbus.SystemBus()
def is_technology_available(technology):
if get_technology_info(technology) is not None:
return True
return False
def is_technology_enabled(technology):
if get_technology_info(technology) is not None:
technology_dict = get_technology_info(technology)
if technology_dict['Powered']:
return True
return False
# queries DBUS to see if the specified technology is detected, returns a dictionary with the details if not returns None
def get_technology_info(technology):
manager = get_manager_interface();
technologies = manager.GetTechnologies()
for t in technologies:
if t[0] == '/net/connman/technology/' + technology:
return t[1]
def toggle_technology_state(technology, state):
technology_interface = dbus.Interface(bus.get_object(CONNMAN_OBJECT_PATH, '/net/connman/technology/' + technology),
'net.connman.Technology')
try:
technology_interface.SetProperty('Powered', state)
except dbus.DBusException:
return False
return True
def get_manager_interface():
try:
return dbus.Interface(bus.get_object(CONNMAN_OBJECT_PATH, '/'), 'net.connman.Manager')
except dbus.DBusException, error:
print('Could not get connman manager interface')
def get_service_interface(path):
try:
return dbus.Interface(bus.get_object(CONNMAN_OBJECT_PATH, path), 'net.connman.Service')
except dbus.DBusException, error:
print('Could not get connman service interface')
def get_technology_interface(technology):
try:
return dbus.Interface(bus.get_object(CONNMAN_OBJECT_PATH, '/net/connman/technology/'+technology),
"net.connman.Technology")
except dbus.DBusException, error:
print('Could not get connman technology' + technology + 'interface')
|
ActionAdam/osmc
|
package/mediacenter-addon-osmc/src/script.module.osmcsetting.networking/resources/lib/connman.py
|
Python
|
gpl-2.0
| 1,951
|
## Copyright 2008-2013 Luc Saffre
## This file is part of the Lino project.
## Lino 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.
## Lino 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 Lino; if not, see <http://www.gnu.org/licenses/>.
"""
A general-purpose address book, used by many other apps in
:mod:`lino.modlib`.
"""
from lino import ad
from django.utils.translation import ugettext_lazy as _
class App(ad.App):
verbose_name = _("Contacts")
#~ MODULE_LABEL = _("Contacts")
|
MaxTyutyunnikov/lino
|
lino/modlib/contacts/__init__.py
|
Python
|
gpl-3.0
| 979
|
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from .models import IDifferentiable # noqa: F401
from .models import IJointlyDifferentiable # noqa: F401
from .models import IModel # noqa: F401
from .models import IModelWithNoise # noqa: F401
from .models import IPriorHyperparameters # noqa: F401
|
EmuKit/emukit
|
emukit/core/interfaces/__init__.py
|
Python
|
apache-2.0
| 368
|
from django.db import models
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
slug = models.CharField(max_length=10, unique=True,
default="question")
def __str__(self):
return self.question_text
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
def __str__(self):
return self.choice_text
|
chfw/django-excel
|
polls/models.py
|
Python
|
bsd-3-clause
| 579
|
'''
Copyright 2016, EMC, Inc.
Author(s):
George Paulos
This script load SKU packs from sources specified in global_config.json.
'''
import os
import sys
import subprocess
# set path to common libraries
sys.path.append(subprocess.check_output("git rev-parse --show-toplevel", shell=True).rstrip("\n") + "/test/common")
import fit_common
class load_sku_packs(fit_common.unittest.TestCase):
def test01_preload_sku_packs(self):
print "**** Processing SKU Packs"
# Load SKU packs from GutHub
subprocess.call("rm -rf temp.sku; rm -rf on-skupack", shell=True)
os.mkdir("on-skupack")
# download all SKU repos and merge into on-skupack
for url in fit_common.GLOBAL_CONFIG['repos']['skupack']:
print "**** Cloning SKU Packs from " + url
subprocess.call("git clone " + url + " temp.sku", shell=True)
subprocess.call('cp -R temp.sku/* on-skupack; rm -rf temp.sku', shell=True)
# build build SKU packs
for subdir, dirs, files in os.walk('on-skupack'):
for skus in dirs:
if skus not in ["debianstatic", ".git"] and os.path.isfile('on-skupack/' + skus + '/config.json'):
subprocess.call("cd on-skupack;mkdir -p " + skus + "/tasks " + skus + "/static "
+ skus + "/workflows " + skus + "/templates", shell=True)
subprocess.call("cd on-skupack; ./build-package.bash "
+ skus + " " + skus + " >/dev/null 2>&1", shell=True)
break
# upload SKU packs to ORA
print "**** Loading SKU Packs to server"
for subdir, dirs, files in os.walk('on-skupack/tarballs'):
for skupacks in files:
print "\n**** Loading SKU Pack for " + skupacks
fit_common.rackhdapi("/api/1.1/skus/pack", action="binary-post",
payload=file(fit_common.TEST_PATH + "on-skupack/tarballs/" + skupacks).read())
break
print "\n"
# check SKU directory against source files
errorcount = 0
skulist = fit_common.json.dumps(fit_common.rackhdapi("/api/2.0/skus")['json'])
for subdir, dirs, files in os.walk('on-skupack'):
for skus in dirs:
if skus not in ["debianstatic", ".git", "packagebuild", "tarballs"] and os.path.isfile('on-skupack/' + skus + '/config.json'):
configfile = fit_common.json.loads(open("on-skupack/" + skus + "/config.json").read())
if configfile['name'] not in skulist:
print "FAILURE - Missing SKU: " + configfile['name']
errorcount += 1
break
self.assertEqual(errorcount, 0, "SKU pack install error.")
def test02_preload_default_sku(self):
# Load default SKU for unsupported compute nodes
print '**** Installing default SKU'
payload = {
"name": "Unsupported-Compute",
"rules": [
{
"path": "bmc.IP Address"
}
]
}
api_data = fit_common.rackhdapi("/api/2.0/skus", action='post', payload=payload)
if __name__ == '__main__':
fit_common.unittest.main()
|
tldavies/RackHD
|
test/util/load_sku_packs.py
|
Python
|
apache-2.0
| 3,381
|
# Support for the Media RSS format
# Copyright 2010-2015 Kurt McKee <contactme@kurtmckee.org>
# Copyright 2002-2008 Mark Pilgrim
# All rights reserved.
#
# This file is a part of feedparser.
#
# 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.
#
# 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.
from __future__ import absolute_import, unicode_literals
from ..util import FeedParserDict
class Namespace(object):
supported_namespaces = {
# Canonical namespace
'http://search.yahoo.com/mrss/': 'media',
# Old namespace (no trailing slash)
'http://search.yahoo.com/mrss': 'media',
}
def _start_media_category(self, attrsD):
attrsD.setdefault('scheme', 'http://search.yahoo.com/mrss/category_schema')
self._start_category(attrsD)
def _end_media_category(self):
self._end_category()
def _end_media_keywords(self):
for term in self.pop('media_keywords').split(','):
if term.strip():
self._addTag(term.strip(), None, None)
def _start_media_title(self, attrsD):
self._start_title(attrsD)
def _end_media_title(self):
title_depth = self.title_depth
self._end_title()
self.title_depth = title_depth
def _start_media_group(self, attrsD):
# don't do anything, but don't break the enclosed tags either
pass
def _start_media_rating(self, attrsD):
context = self._getContext()
context.setdefault('media_rating', attrsD)
self.push('rating', 1)
def _end_media_rating(self):
rating = self.pop('rating')
if rating is not None and rating.strip():
context = self._getContext()
context['media_rating']['content'] = rating
def _start_media_credit(self, attrsD):
context = self._getContext()
context.setdefault('media_credit', [])
context['media_credit'].append(attrsD)
self.push('credit', 1)
def _end_media_credit(self):
credit = self.pop('credit')
if credit != None and len(credit.strip()) != 0:
context = self._getContext()
context['media_credit'][-1]['content'] = credit
def _start_media_description(self, attrsD):
self._start_description(attrsD)
def _end_media_description(self):
self._end_description()
def _start_media_restriction(self, attrsD):
context = self._getContext()
context.setdefault('media_restriction', attrsD)
self.push('restriction', 1)
def _end_media_restriction(self):
restriction = self.pop('restriction')
if restriction != None and len(restriction.strip()) != 0:
context = self._getContext()
context['media_restriction']['content'] = [cc.strip().lower() for cc in restriction.split(' ')]
def _start_media_license(self, attrsD):
context = self._getContext()
context.setdefault('media_license', attrsD)
self.push('license', 1)
def _end_media_license(self):
license = self.pop('license')
if license != None and len(license.strip()) != 0:
context = self._getContext()
context['media_license']['content'] = license
def _start_media_content(self, attrsD):
context = self._getContext()
context.setdefault('media_content', [])
context['media_content'].append(attrsD)
def _start_media_thumbnail(self, attrsD):
context = self._getContext()
context.setdefault('media_thumbnail', [])
self.push('url', 1) # new
context['media_thumbnail'].append(attrsD)
def _end_media_thumbnail(self):
url = self.pop('url')
context = self._getContext()
if url != None and len(url.strip()) != 0:
if 'url' not in context['media_thumbnail'][-1]:
context['media_thumbnail'][-1]['url'] = url
def _start_media_player(self, attrsD):
self.push('media_player', 0)
self._getContext()['media_player'] = FeedParserDict(attrsD)
def _end_media_player(self):
value = self.pop('media_player')
context = self._getContext()
context['media_player']['content'] = value
|
coderbone/SickRage
|
lib/feedparser/namespaces/mediarss.py
|
Python
|
gpl-3.0
| 5,377
|
from bs4 import BeautifulSoup as BS
import Util
def clean_story(file_name):
print('Processing story ' + file_name)
# extract the basic data out of html flags
with open(file_name) as f:
soup = BS(''.join(f.readlines()), 'html.parser')
title = soup.title.text
parser = Util.Parser()
parser.skip_non_empty_attrs = True
parser.skip_pages = True
story = parser.parse(soup.find_all('p')).get_text()
return title, story
|
daphnei/nn_chatbot
|
story_corpus/rft/clean_story.py
|
Python
|
mit
| 428
|
"""
soupselect.py - https://code.google.com/p/soupselect/
CSS selector support for BeautifulSoup.
soup = BeautifulSoup('<html>...')
select(soup, 'div')
- returns a list of div elements
select(soup, 'div#main ul a')
- returns a list of links inside a ul inside div#main
"""
import re
from bs4 import BeautifulSoup
tag_re = re.compile('^[a-z0-9]+$')
attribselect_re = re.compile(
r'^(?P<tag>\w+)?\[(?P<attribute>\w+)(?P<operator>[=~\|\^\$\*]?)' +
r'=?"?(?P<value>[^\]"]*)"?\]$'
)
# /^(\w+)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/
# \---/ \---/\-------------/ \-------/
# | | | |
# | | | The value
# | | ~,|,^,$,* or =
# | Attribute
# Tag
def attribute_checker(operator, attribute, value=''):
"""
Takes an operator, attribute and optional value; returns a function that
will return True for elements that match that combination.
"""
return {
'=': lambda el: el.get(attribute) == value,
# attribute includes value as one of a set of space separated tokens
'~': lambda el: value in el.get(attribute, '').split(),
# attribute starts with value
'^': lambda el: el.get(attribute, '').startswith(value),
# attribute ends with value
'$': lambda el: el.get(attribute, '').endswith(value),
# attribute contains value
'*': lambda el: value in el.get(attribute, ''),
# attribute is either exactly value or starts with value-
'|': lambda el: el.get(attribute, '') == value \
or el.get(attribute, '').startswith('%s-' % value),
}.get(operator, lambda el: attribute in el)
def select(soup, selector):
"""
soup should be a BeautifulSoup instance; selector is a CSS selector
specifying the elements you want to retrieve.
"""
tokens = selector.split()
current_context = [soup]
for token in tokens:
m = attribselect_re.match(token)
if m:
# Attribute selector
tag, attribute, operator, value = m.groups()
if not tag:
tag = True
checker = attribute_checker(operator, attribute, value)
found = []
for context in current_context:
found.extend([el for el in context.findAll(tag) if checker(el)])
current_context = found
continue
if '#' in token:
# ID selector
tag, id = token.split('#', 1)
if not tag:
tag = True
el = current_context[0].find(tag, {'id': id})
if not el:
return [] # No match
current_context = [el]
continue
if '.' in token:
# Class selector
tag, klass = token.split('.', 1)
if not tag:
tag = True
found = []
for context in current_context:
found.extend(
context.findAll(tag,
{'class': lambda attr: attr and klass in attr.split()}
)
)
current_context = found
continue
if token == '*':
# Star selector
found = []
for context in current_context:
found.extend(context.findAll(True))
current_context = found
continue
# Here we should just have a regular tag
if not tag_re.match(token):
return []
found = []
for context in current_context:
found.extend(context.findAll(token))
current_context = found
return current_context
def monkeypatch(BeautifulSoupClass=None):
"""
If you don't explicitly state the class to patch, defaults to the most
common import location for BeautifulSoup.
"""
if not BeautifulSoupClass:
from BeautifulSoup import BeautifulSoup as BeautifulSoupClass
BeautifulSoupClass.findSelect = select
def unmonkeypatch(BeautifulSoupClass=None):
if not BeautifulSoupClass:
from BeautifulSoup import BeautifulSoup as BeautifulSoupClass
delattr(BeautifulSoupClass, 'findSelect')
def cssFind(html, selector):
"""
Parse ``html`` with class:`BeautifulSoup.BeautifulSoup` and use
:func:`.select` on the result.
Added by Espen A. Kristiansen to make it even easier to use for testing.
"""
soup = BeautifulSoup(html)
return select(soup, selector)
def cssGet(html, selector):
"""
Same as :func:`.cssFind`, but returns the first match.
Added by Espen A. Kristiansen to make it even easier to use for testing.
"""
try:
return cssFind(html, selector)[0]
except IndexError as e:
raise IndexError('Could not find {}.'.format(selector))
def cssExists(html, selector):
"""
Same as :func:`.cssFind`, but returns ``True`` if the selector matches at least one item.
Added by Espen A. Kristiansen to make it even easier to use for testing.
"""
matches = cssFind(html, selector)
return bool(len(matches))
def prettyhtml(html):
return BeautifulSoup(html).prettify()
def normalize_whitespace(html):
return re.sub('(\s|\\xa0)+', ' ', html).strip()
|
devilry/devilry-django
|
devilry/project/develop/testhelpers/soupselect.py
|
Python
|
bsd-3-clause
| 5,265
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.