repo_name
stringlengths
5
100
path
stringlengths
4
375
copies
stringclasses
991 values
size
stringlengths
4
7
content
stringlengths
666
1M
license
stringclasses
15 values
ludojmj/treelud
server/paramiko/pkey.py
1
14362
# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com> # # This file is part of paramiko. # # Paramiko 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. # # Paramiko 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 Paramiko; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. """ Common API for all public keys. """ import base64 from binascii import hexlify, unhexlify import os from hashlib import md5 from Crypto.Cipher import DES3, AES from paramiko import util from paramiko.common import o600, zero_byte from paramiko.py3compat import u, encodebytes, decodebytes, b from paramiko.ssh_exception import SSHException, PasswordRequiredException class PKey (object): """ Base class for public keys. """ # known encryption types for private key files: _CIPHER_TABLE = { 'AES-128-CBC': {'cipher': AES, 'keysize': 16, 'blocksize': 16, 'mode': AES.MODE_CBC}, 'DES-EDE3-CBC': {'cipher': DES3, 'keysize': 24, 'blocksize': 8, 'mode': DES3.MODE_CBC}, } def __init__(self, msg=None, data=None): """ Create a new instance of this public key type. If ``msg`` is given, the key's public part(s) will be filled in from the message. If ``data`` is given, the key's public part(s) will be filled in from the string. :param .Message msg: an optional SSH `.Message` containing a public key of this type. :param str data: an optional string containing a public key of this type :raises SSHException: if a key cannot be created from the ``data`` or ``msg`` given, or no key was passed in. """ pass def asbytes(self): """ Return a string of an SSH `.Message` made up of the public part(s) of this key. This string is suitable for passing to `__init__` to re-create the key object later. """ return bytes() def __str__(self): return self.asbytes() # noinspection PyUnresolvedReferences def __cmp__(self, other): """ Compare this key to another. Returns 0 if this key is equivalent to the given key, or non-0 if they are different. Only the public parts of the key are compared, so a public key will compare equal to its corresponding private key. :param .Pkey other: key to compare to. """ hs = hash(self) ho = hash(other) if hs != ho: return cmp(hs, ho) return cmp(self.asbytes(), other.asbytes()) def __eq__(self, other): return hash(self) == hash(other) def get_name(self): """ Return the name of this private key implementation. :return: name of this private key type, in SSH terminology, as a `str` (for example, ``"ssh-rsa"``). """ return '' def get_bits(self): """ Return the number of significant bits in this key. This is useful for judging the relative security of a key. :return: bits in the key (as an `int`) """ return 0 def can_sign(self): """ Return ``True`` if this key has the private part necessary for signing data. """ return False def get_fingerprint(self): """ Return an MD5 fingerprint of the public part of this key. Nothing secret is revealed. :return: a 16-byte `string <str>` (binary) of the MD5 fingerprint, in SSH format. """ return md5(self.asbytes()).digest() def get_base64(self): """ Return a base64 string containing the public part of this key. Nothing secret is revealed. This format is compatible with that used to store public key files or recognized host keys. :return: a base64 `string <str>` containing the public part of the key. """ return u(encodebytes(self.asbytes())).replace('\n', '') def sign_ssh_data(self, data): """ Sign a blob of data with this private key, and return a `.Message` representing an SSH signature message. :param str data: the data to sign. :return: an SSH signature `message <.Message>`. """ return bytes() def verify_ssh_sig(self, data, msg): """ Given a blob of data, and an SSH message representing a signature of that data, verify that it was signed with this key. :param str data: the data that was signed. :param .Message msg: an SSH signature message :return: ``True`` if the signature verifies correctly; ``False`` otherwise. """ return False def from_private_key_file(cls, filename, password=None): """ Create a key object by reading a private key file. If the private key is encrypted and ``password`` is not ``None``, the given password will be used to decrypt the key (otherwise `.PasswordRequiredException` is thrown). Through the magic of Python, this factory method will exist in all subclasses of PKey (such as `.RSAKey` or `.DSSKey`), but is useless on the abstract PKey class. :param str filename: name of the file to read :param str password: an optional password to use to decrypt the key file, if it's encrypted :return: a new `.PKey` based on the given private key :raises IOError: if there was an error reading the file :raises PasswordRequiredException: if the private key file is encrypted, and ``password`` is ``None`` :raises SSHException: if the key file is invalid """ key = cls(filename=filename, password=password) return key from_private_key_file = classmethod(from_private_key_file) def from_private_key(cls, file_obj, password=None): """ Create a key object by reading a private key from a file (or file-like) object. If the private key is encrypted and ``password`` is not ``None``, the given password will be used to decrypt the key (otherwise `.PasswordRequiredException` is thrown). :param file file_obj: the file to read from :param str password: an optional password to use to decrypt the key, if it's encrypted :return: a new `.PKey` based on the given private key :raises IOError: if there was an error reading the key :raises PasswordRequiredException: if the private key file is encrypted, and ``password`` is ``None`` :raises SSHException: if the key file is invalid """ key = cls(file_obj=file_obj, password=password) return key from_private_key = classmethod(from_private_key) def write_private_key_file(self, filename, password=None): """ Write private key contents into a file. If the password is not ``None``, the key is encrypted before writing. :param str filename: name of the file to write :param str password: an optional password to use to encrypt the key file :raises IOError: if there was an error writing the file :raises SSHException: if the key is invalid """ raise Exception('Not implemented in PKey') def write_private_key(self, file_obj, password=None): """ Write private key contents into a file (or file-like) object. If the password is not ``None``, the key is encrypted before writing. :param file file_obj: the file object to write into :param str password: an optional password to use to encrypt the key :raises IOError: if there was an error writing to the file :raises SSHException: if the key is invalid """ raise Exception('Not implemented in PKey') def _read_private_key_file(self, tag, filename, password=None): """ Read an SSH2-format private key file, looking for a string of the type ``"BEGIN xxx PRIVATE KEY"`` for some ``xxx``, base64-decode the text we find, and return it as a string. If the private key is encrypted and ``password`` is not ``None``, the given password will be used to decrypt the key (otherwise `.PasswordRequiredException` is thrown). :param str tag: ``"RSA"`` or ``"DSA"``, the tag used to mark the data block. :param str filename: name of the file to read. :param str password: an optional password to use to decrypt the key file, if it's encrypted. :return: data blob (`str`) that makes up the private key. :raises IOError: if there was an error reading the file. :raises PasswordRequiredException: if the private key file is encrypted, and ``password`` is ``None``. :raises SSHException: if the key file is invalid. """ with open(filename, 'r') as f: data = self._read_private_key(tag, f, password) return data def _read_private_key(self, tag, f, password=None): lines = f.readlines() start = 0 while (start < len(lines)) and (lines[start].strip() != '-----BEGIN ' + tag + ' PRIVATE KEY-----'): start += 1 if start >= len(lines): raise SSHException('not a valid ' + tag + ' private key file') # parse any headers first headers = {} start += 1 while start < len(lines): l = lines[start].split(': ') if len(l) == 1: break headers[l[0].lower()] = l[1].strip() start += 1 # find end end = start while (lines[end].strip() != '-----END ' + tag + ' PRIVATE KEY-----') and (end < len(lines)): end += 1 # if we trudged to the end of the file, just try to cope. try: data = decodebytes(b(''.join(lines[start:end]))) except base64.binascii.Error as e: raise SSHException('base64 decoding error: ' + str(e)) if 'proc-type' not in headers: # unencryped: done return data # encrypted keyfile: will need a password if headers['proc-type'] != '4,ENCRYPTED': raise SSHException('Unknown private key structure "%s"' % headers['proc-type']) try: encryption_type, saltstr = headers['dek-info'].split(',') except: raise SSHException("Can't parse DEK-info in private key file") if encryption_type not in self._CIPHER_TABLE: raise SSHException('Unknown private key cipher "%s"' % encryption_type) # if no password was passed in, raise an exception pointing out that we need one if password is None: raise PasswordRequiredException('Private key file is encrypted') cipher = self._CIPHER_TABLE[encryption_type]['cipher'] keysize = self._CIPHER_TABLE[encryption_type]['keysize'] mode = self._CIPHER_TABLE[encryption_type]['mode'] salt = unhexlify(b(saltstr)) key = util.generate_key_bytes(md5, salt, password, keysize) return cipher.new(key, mode, salt).decrypt(data) def _write_private_key_file(self, tag, filename, data, password=None): """ Write an SSH2-format private key file in a form that can be read by paramiko or openssh. If no password is given, the key is written in a trivially-encoded format (base64) which is completely insecure. If a password is given, DES-EDE3-CBC is used. :param str tag: ``"RSA"`` or ``"DSA"``, the tag used to mark the data block. :param file filename: name of the file to write. :param str data: data blob that makes up the private key. :param str password: an optional password to use to encrypt the file. :raises IOError: if there was an error writing the file. """ with open(filename, 'w', o600) as f: # grrr... the mode doesn't always take hold os.chmod(filename, o600) self._write_private_key(tag, f, data, password) def _write_private_key(self, tag, f, data, password=None): f.write('-----BEGIN %s PRIVATE KEY-----\n' % tag) if password is not None: cipher_name = list(self._CIPHER_TABLE.keys())[0] cipher = self._CIPHER_TABLE[cipher_name]['cipher'] keysize = self._CIPHER_TABLE[cipher_name]['keysize'] blocksize = self._CIPHER_TABLE[cipher_name]['blocksize'] mode = self._CIPHER_TABLE[cipher_name]['mode'] salt = os.urandom(blocksize) key = util.generate_key_bytes(md5, salt, password, keysize) if len(data) % blocksize != 0: n = blocksize - len(data) % blocksize #data += os.urandom(n) # that would make more sense ^, but it confuses openssh. data += zero_byte * n data = cipher.new(key, mode, salt).encrypt(data) f.write('Proc-Type: 4,ENCRYPTED\n') f.write('DEK-Info: %s,%s\n' % (cipher_name, u(hexlify(salt)).upper())) f.write('\n') s = u(encodebytes(data)) # re-wrap to 64-char lines s = ''.join(s.split('\n')) s = '\n'.join([s[i: i + 64] for i in range(0, len(s), 64)]) f.write(s) f.write('\n') f.write('-----END %s PRIVATE KEY-----\n' % tag)
mit
resmo/cloudstack
systemvm/patches/debian/config/opt/cloud/bin/cs/CsGuestNetwork.py
3
2545
# 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. from merge import DataBag import CsHelper class CsGuestNetwork: def __init__(self, device, config): self.data = {} self.guest = True db = DataBag() db.setKey("guestnetwork") db.load() dbag = db.getDataBag() self.config = config if device in dbag.keys() and len(dbag[device]) != 0: self.data = dbag[device][0] else: self.guest = False def is_guestnetwork(self): return self.guest def get_dns(self): if not self.guest: return self.config.get_dns() dns = [] if not self.config.use_extdns() and 'router_guest_gateway' in self.data: dns.append(self.data['router_guest_gateway']) if 'dns' in self.data: dns.extend(self.data['dns'].split(',')) return dns or [''] def set_dns(self, val): self.data['dns'] = val def set_router(self, val): self.data['router_guest_gateway'] = val def get_netmask(self): # We need to fix it properly. I just added the if, as Ian did in some other files, to avoid the exception. if 'router_guest_netmask' in self.data: return self.data['router_guest_netmask'] return '' def get_gateway(self): # We need to fix it properly. I just added the if, as Ian did in some other files, to avoid the exception. if 'router_guest_gateway' in self.data: return self.data['router_guest_gateway'] return '' def get_domain(self): domain = "cloudnine.internal" if not self.guest: return self.config.get_domain() if 'domain_name' in self.data: return self.data['domain_name'] return domain
apache-2.0
kumarshivam675/Mobile10X-Hack
build/lib.linux-x86_64-2.7/yowsup/layers/protocol_presence/protocolentities/presence_unsubscribe.py
70
1047
from yowsup.structs import ProtocolEntity, ProtocolTreeNode from .presence import PresenceProtocolEntity class UnsubscribePresenceProtocolEntity(PresenceProtocolEntity): ''' <presence type="unsubscribe" to="jid"></presence> ''' def __init__(self, jid): super(UnsubscribePresenceProtocolEntity, self).__init__("unsubscribe") self.setProps(jid) def setProps(self, jid): self.jid = jid def toProtocolTreeNode(self): node = super(UnsubscribePresenceProtocolEntity, self).toProtocolTreeNode() node.setAttribute("to", self.jid) return node def __str__(self): out = super(UnsubscribePresenceProtocolEntity, self).__str__() out += "To: %s\n" % self.jid return out @staticmethod def fromProtocolTreeNode(node): entity = PresenceProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = UnsubscribePresenceProtocolEntity entity.setProps( node.getAttributeValue("to") ) return entity
gpl-3.0
edulramirez/nova
nova/virt/event.py
76
3420
# Copyright 2013 Red Hat, 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. """ Asynchronous event notifications from virtualization drivers. This module defines a set of classes representing data for various asynchronous events that can occur in a virtualization driver. """ import time from nova.i18n import _ EVENT_LIFECYCLE_STARTED = 0 EVENT_LIFECYCLE_STOPPED = 1 EVENT_LIFECYCLE_PAUSED = 2 EVENT_LIFECYCLE_RESUMED = 3 EVENT_LIFECYCLE_SUSPENDED = 4 NAMES = { EVENT_LIFECYCLE_STARTED: _('Started'), EVENT_LIFECYCLE_STOPPED: _('Stopped'), EVENT_LIFECYCLE_PAUSED: _('Paused'), EVENT_LIFECYCLE_RESUMED: _('Resumed'), EVENT_LIFECYCLE_SUSPENDED: _('Suspended'), } class Event(object): """Base class for all events emitted by a hypervisor. All events emitted by a virtualization driver are subclasses of this base object. The only generic information recorded in the base class is a timestamp indicating when the event first occurred. The timestamp is recorded as fractional seconds since the UNIX epoch. """ def __init__(self, timestamp=None): if timestamp is None: self.timestamp = time.time() else: self.timestamp = timestamp def get_timestamp(self): return self.timestamp def __repr__(self): return "<%s: %s>" % ( self.__class__.__name__, self.timestamp) class InstanceEvent(Event): """Base class for all instance events. All events emitted by a virtualization driver which are associated with a virtual domain instance are subclasses of this base object. This object records the UUID associated with the instance. """ def __init__(self, uuid, timestamp=None): super(InstanceEvent, self).__init__(timestamp) self.uuid = uuid def get_instance_uuid(self): return self.uuid def __repr__(self): return "<%s: %s, %s>" % ( self.__class__.__name__, self.timestamp, self.uuid) class LifecycleEvent(InstanceEvent): """Class for instance lifecycle state change events. When a virtual domain instance lifecycle state changes, events of this class are emitted. The EVENT_LIFECYCLE_XX constants defined why lifecycle change occurred. This event allows detection of an instance starting/stopping without need for polling. """ def __init__(self, uuid, transition, timestamp=None): super(LifecycleEvent, self).__init__(uuid, timestamp) self.transition = transition def get_transition(self): return self.transition def get_name(self): return NAMES.get(self.transition, _('Unknown')) def __repr__(self): return "<%s: %s, %s => %s>" % ( self.__class__.__name__, self.timestamp, self.uuid, self.get_name())
apache-2.0
gylian/headphones
lib/mutagen/oggvorbis.py
16
4163
# Ogg Vorbis support. # # Copyright 2006 Joe Wreschnig # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. """Read and write Ogg Vorbis comments. This module handles Vorbis files wrapped in an Ogg bitstream. The first Vorbis stream found is used. Read more about Ogg Vorbis at http://vorbis.com/. This module is based on the specification at http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html. """ __all__ = ["OggVorbis", "Open", "delete"] import struct from mutagen._vorbis import VCommentDict from mutagen.ogg import OggPage, OggFileType, error as OggError class error(OggError): pass class OggVorbisHeaderError(error): pass class OggVorbisInfo(object): """Ogg Vorbis stream information. Attributes: * length - file length in seconds, as a float * bitrate - nominal ('average') bitrate in bits per second, as an int """ length = 0 def __init__(self, fileobj): page = OggPage(fileobj) while not page.packets[0].startswith("\x01vorbis"): page = OggPage(fileobj) if not page.first: raise OggVorbisHeaderError( "page has ID header, but doesn't start a stream") (self.channels, self.sample_rate, max_bitrate, nominal_bitrate, min_bitrate) = struct.unpack("<B4i", page.packets[0][11:28]) self.serial = page.serial max_bitrate = max(0, max_bitrate) min_bitrate = max(0, min_bitrate) nominal_bitrate = max(0, nominal_bitrate) if nominal_bitrate == 0: self.bitrate = (max_bitrate + min_bitrate) // 2 elif max_bitrate and max_bitrate < nominal_bitrate: # If the max bitrate is less than the nominal, we know # the nominal is wrong. self.bitrate = max_bitrate elif min_bitrate > nominal_bitrate: self.bitrate = min_bitrate else: self.bitrate = nominal_bitrate def _post_tags(self, fileobj): page = OggPage.find_last(fileobj, self.serial) self.length = page.position / float(self.sample_rate) def pprint(self): return "Ogg Vorbis, %.2f seconds, %d bps" % (self.length, self.bitrate) class OggVCommentDict(VCommentDict): """Vorbis comments embedded in an Ogg bitstream.""" def __init__(self, fileobj, info): pages = [] complete = False while not complete: page = OggPage(fileobj) if page.serial == info.serial: pages.append(page) complete = page.complete or (len(page.packets) > 1) data = OggPage.to_packets(pages)[0][7:] # Strip off "\x03vorbis". super(OggVCommentDict, self).__init__(data) def _inject(self, fileobj): """Write tag data into the Vorbis comment packet/page.""" # Find the old pages in the file; we'll need to remove them, # plus grab any stray setup packet data out of them. fileobj.seek(0) page = OggPage(fileobj) while not page.packets[0].startswith("\x03vorbis"): page = OggPage(fileobj) old_pages = [page] while not (old_pages[-1].complete or len(old_pages[-1].packets) > 1): page = OggPage(fileobj) if page.serial == old_pages[0].serial: old_pages.append(page) packets = OggPage.to_packets(old_pages, strict=False) # Set the new comment packet. packets[0] = "\x03vorbis" + self.write() new_pages = OggPage.from_packets(packets, old_pages[0].sequence) OggPage.replace(fileobj, old_pages, new_pages) class OggVorbis(OggFileType): """An Ogg Vorbis file.""" _Info = OggVorbisInfo _Tags = OggVCommentDict _Error = OggVorbisHeaderError _mimes = ["audio/vorbis", "audio/x-vorbis"] @staticmethod def score(filename, fileobj, header): return (header.startswith("OggS") * ("\x01vorbis" in header)) Open = OggVorbis def delete(filename): """Remove tags from a file.""" OggVorbis(filename).delete()
gpl-3.0
Nyto035/Konza_backend
search/tests/test_search.py
1
17357
import json from mock import patch from django.test import TestCase from django.test.utils import override_settings from django.core.urlresolvers import reverse from django.core.management import call_command from django.contrib.auth.models import Group from django.contrib.auth import get_user_model from model_mommy import mommy from facilities.models import Facility, FacilityApproval from facilities.serializers import FacilitySerializer from common.models import County, Constituency, UserConstituency, UserCounty from common.tests import ViewTestBase from mfl_gis.models import FacilityCoordinates from chul.models import CommunityHealthUnit from search.filters import SearchFilter from search.search_utils import ( ElasticAPI, index_instance, default, serialize_model) from ..index_settings import get_mappings SEARCH_TEST_SETTINGS = { "ELASTIC_URL": "http://localhost:9200/", "INDEX_NAME": "test_index", "NON_INDEXABLE_MODELS": [ "mfl_gis.FacilityCoordinates", "mfl_gis.WorldBorder", "mfl_gis.CountyBoundary", "mfl_gis.ConstituencyBoundary", "mfl_gis.WardBoundary", "users.CustomGroup", "users.ProxyGroup" ], "FULL_TEXT_SEARCH_FIELDS": { "models": [ { "name": "facility", "fields": [ "name", "county", "constituency", "ward_name", "facility_services.service_name", "facility_services.service_name", "facility_services.category_name", "facility_physical_address.town", "facility_physical_address.nearest_landmark", "facility_physical_address.nearest_landmark" ] } ] }, "AUTOCOMPLETE_MODEL_FIELDS": [ { "app": "facilities", "models": [ { "name": "facility", "fields": ["name", "ward_name"] }, { "name": "owner", "fields": ["name"] } ] } ] } CACHES_TEST_SETTINGS = { 'default': { 'BACKEND': 'django.core.cache.backends.dummy.DummyCache', } } @override_settings( SEARCH=SEARCH_TEST_SETTINGS, CACHES=CACHES_TEST_SETTINGS) class TestElasticSearchAPI(TestCase): def setUp(self): self.elastic_search_api = ElasticAPI() super(TestElasticSearchAPI, self).setUp() def test_setup_index(self): self.elastic_search_api.delete_index(index_name='test_index') result = self.elastic_search_api.setup_index(index_name='test_index') self.assertEquals(200, result.status_code) self.elastic_search_api.delete_index(index_name='test_index') def test_get_non_existing_index(self): index_name = 'test_index' self.elastic_search_api.delete_index(index_name) self.elastic_search_api.get_index(index_name) def test_get_exsting_index(self): index_name = 'test_index' self.elastic_search_api.setup_index(index_name=index_name) self.elastic_search_api.get_index(index_name) self.elastic_search_api.delete_index(index_name='test_index') def test_delete_index(self): index_name = 'test_index_3' response = self.elastic_search_api.setup_index(index_name=index_name) self.assertEquals(200, response.status_code) self.elastic_search_api.delete_index(index_name) def test_index_document(self): facility = mommy.make(Facility, name='Fig tree medical clinic') self.elastic_search_api.setup_index(index_name='test_index') result = index_instance(facility, 'test_index') self.assertEquals(201, result.status_code) def test_search_document_no_instance_type(self): index_name = 'test_index' response = self.elastic_search_api.setup_index(index_name=index_name) self.assertEquals(200, response.status_code) facility = mommy.make(Facility, name='Fig tree medical clinic') result = index_instance(facility, 'test_index') self.assertEquals(201, result.status_code) self.elastic_search_api.search_document( index_name=index_name, instance_type=Facility, query='tree') def test_remove_document(self): index_name = 'test_index' self.elastic_search_api.setup_index(index_name=index_name) facility = mommy.make(Facility, name='Fig tree medical clinic') result = index_instance(facility, 'test_index') self.assertEquals(201, result.status_code) self.elastic_search_api.remove_document( index_name, 'facility', str(facility.id)) self.elastic_search_api.delete_index(index_name='test_index') def test_index_settings(self): expected_map = get_mappings() for key, value in expected_map.items(): for key_2, value_2 in expected_map.get(key).items(): for key_3, value_3 in expected_map.get(key).get(key_2).items(): values = expected_map.get(key).get(key_2).get(key_3) self.assertEquals( 'autocomplete', values.get('index_analyzer')) self.assertEquals( 'autocomplete', values.get('search_analyzer')) self.assertEquals( 'string', values.get('type')) self.assertEquals( False, values.get('coerce')) self.assertEquals( True, values.get('store')) def tearDown(self): self.elastic_search_api.delete_index(index_name='test_index') super(TestElasticSearchAPI, self).tearDown() @override_settings( SEARCH=SEARCH_TEST_SETTINGS, CACHES=CACHES_TEST_SETTINGS) class TestSearchFunctions(ViewTestBase): def setUp(self): self.elastic_search_api = ElasticAPI() self.elastic_search_api.setup_index(index_name='test_index') super(TestSearchFunctions, self).setUp() def test_serialize_model(self): self.maxDiff = None facility = mommy.make(Facility) serialized_data = serialize_model(facility) expected_data = FacilitySerializer( facility ).data expected_data = json.dumps(expected_data, default=default) self.assertEquals(expected_data, serialized_data.get('data')) def test_serialize_model_serializer_not_found(self): # There is no serializer named GroupSerializer # Therefore the serialize model function should return None group = mommy.make(Group) serialized_data = serialize_model(group) self.assertIsNone(serialized_data) def test_default_json_dumps_function(self): facility = mommy.make(Facility) data = FacilitySerializer( facility ).data result = json.dumps(data, default=default) self.assertIsInstance(result, str) def test_search_facility(self): url = reverse('api:facilities:facilities_list') self.elastic_search_api = ElasticAPI() self.elastic_search_api.setup_index(index_name='test_index') facility = mommy.make(Facility, name='Kanyakini') index_instance(facility, 'test_index') url = url + "?search={}".format('Kanyakini') response = self.client.get(url) self.assertEquals(200, response.status_code) self.assertIsInstance(response.data.get('results'), list) self.elastic_search_api.delete_index('test_index') def test_search_facility_using_material_view(self): self.elastic_search_api = ElasticAPI() self.elastic_search_api.setup_index(index_name='test_index') facility = mommy.make(Facility, name='Facility ya kutest material') url = reverse('api:facilities:material') index_instance(facility, 'test_index') url = url + "?search={}".format('material') response = self.client.get(url) self.assertEquals(200, response.status_code) self.assertIsInstance(response.data.get('results'), list) self.elastic_search_api.delete_index('test_index') def test_search_facility_using_query_dsl(self): url = reverse('api:facilities:facilities_list') self.elastic_search_api = ElasticAPI() self.elastic_search_api.setup_index(index_name='test_index') facility = mommy.make(Facility, name='Kanyakini') index_instance(facility, 'test_index') query_dsl = { "from": 0, "size": 30, "query": { "query_string": { "default_field": "name", "query": "Kanyakini" } } } url = url + "?search={}".format(json.dumps(query_dsl)) response = self.client.get(url) self.assertEquals(200, response.status_code) self.assertIsInstance(response.data.get('results'), list) self.elastic_search_api.delete_index('test_index') def test_seach_auto_complete(self): url = reverse('api:facilities:facilities_list') self.elastic_search_api = ElasticAPI() self.elastic_search_api.setup_index(index_name='test_index') facility = mommy.make(Facility, name='Kanyakini') index_instance(facility, 'test_index') url = url + "?search_auto={}".format('Kanya') response = self.client.get(url) self.assertEquals(200, response.status_code) self.assertIsInstance(response.data.get('results'), list) self.elastic_search_api.delete_index('test_index') def test_search_facility_multiple_filters(self): url = reverse('api:facilities:facilities_list') self.elastic_search_api = ElasticAPI() self.elastic_search_api.setup_index(index_name='test_index') facility = mommy.make( Facility, name='Mordal mountains medical clinic') mommy.make(FacilityApproval, facility=facility) facility.is_published = True facility.save() facility_2 = mommy.make( Facility, name='Eye of mordal health center', is_published=False) index_instance(facility, 'test_index') index_instance(facility_2, 'test_index') url = url + "?search={}&is_published={}".format('mordal', 'false') response = self.client.get(url) self.assertEquals(200, response.status_code) self.assertIsInstance(response.data.get('results'), list) self.elastic_search_api.delete_index('test_index') def test_get_search_auto_complete_fields(self): search_fields = self.elastic_search_api.get_search_fields('facility') self.assertIsInstance(search_fields, list) self.assertEquals(len(search_fields), 10) def test_get_search_auto_complete_fields_si_empty(self): search_fields = self.elastic_search_api.get_search_fields('no_model') self.assertIsNone(search_fields) def test_user_search(self): user = mommy.make(get_user_model(), is_national=True) self.client.force_authenticate(user) county_user = mommy.make(get_user_model()) sub_county_user = mommy.make( get_user_model(), first_name='kijana', last_name='mzee') index_instance(sub_county_user, 'test_index') url = reverse("api:users:mfl_users_list") url = url + "?search=kijana" response = self.client.get(url) self.assertEquals(200, response.status_code) # the national users are not allowed to see the sub county level users county = mommy.make(County) const = mommy.make(Constituency, county=county) mommy.make(UserCounty, county=county, user=county_user) mommy.make( UserConstituency, user=sub_county_user, constituency=const, created_by=county_user, updated_by=county_user) filtered_response = self.client.get(url) self.assertEquals(200, filtered_response.status_code) def test_chu_search(self): facility = mommy.make(Facility) facility_2 = mommy.make(Facility) chu_url = reverse("api:chul:community_health_units_list") chu = mommy.make( CommunityHealthUnit, facility=facility, name='Jericho') mommy.make(CommunityHealthUnit, facility=facility_2) index_instance(chu) chu_search_url = chu_url + "?search=Jericho" response = self.client.get(chu_search_url) self.assertEquals(200, response.status_code) def test_chu_search_using_code(self): facility = mommy.make(Facility) facility_2 = mommy.make(Facility) chu_url = reverse("api:chul:community_health_units_list") chu = mommy.make( CommunityHealthUnit, facility=facility, name='Jericho') mommy.make(CommunityHealthUnit, facility=facility_2) index_instance(chu) chu_search_url = chu_url + "?search={}".format(chu.code) response = self.client.get(chu_search_url) self.assertEquals(200, response.status_code) def tearDown(self): self.elastic_search_api.delete_index(index_name='test_index') super(TestSearchFunctions, self).tearDown() @override_settings( SEARCH=SEARCH_TEST_SETTINGS, CACHES=CACHES_TEST_SETTINGS) class TestSearchFilter(ViewTestBase): def setUp(self): self.elastic_search_api = ElasticAPI() super(TestSearchFilter, self).setUp() def test_filter_no_data(self): api = ElasticAPI() api.delete_index('test_index') api.setup_index('test_index') mommy.make(Facility, name='test facility') mommy.make(Facility) qs = Facility.objects.all() search_filter = SearchFilter(name='search') result = search_filter.filter(qs, 'test') # no documents have been indexed self.assertEquals(result.count(), 0) api.delete_index('test_index') def test_filter_elastic_not_available(self): with patch.object( ElasticAPI, 'search_document') as mock_search: mock_search.return_value = None api = ElasticAPI() api.delete_index('test_index') api.setup_index('test_index') mommy.make(Facility, name='test facility') mommy.make(Facility) qs = Facility.objects.all() search_filter = SearchFilter(name='search') result = search_filter.filter(qs, 'test') # no documents have been indexed self.assertEquals(result.count(), 0) api.delete_index('test_index') def test_filter_data(self): api = ElasticAPI() api.delete_index('test_index') api.setup_index('test_index') test_facility = mommy.make(Facility, name='test facility') index_instance(test_facility, 'test_index') mommy.make(Facility) qs = Facility.objects.all() search_filter = SearchFilter(name='search') # some weird bug there is a delay in getting the search results for x in range(0, 100): search_filter.filter(qs, 'test') api.delete_index('test_index') def test_create_index(self): call_command('setup_index') api = ElasticAPI() api.get_index('test_index') # handle cases where the index already exists def test_build_index(self): call_command('setup_index') mommy.make(Facility, name='medical clinic two') mommy.make(Facility, name='medical clinic one') call_command('build_index') def test_delete_index(self): # a very naive test. When results are checked with status codes, # tests pass locally but fail on circle ci # We leave it without any assertions for coverage's sake. api = ElasticAPI() call_command('setup_index') api.get_index('test_index') call_command('remove_index') api.get_index('test_index') def test_non_indexable_model(self): obj = mommy.make_recipe( 'mfl_gis.tests.facility_coordinates_recipe') self.assertEquals(1, FacilityCoordinates.objects.count()) index_instance(obj) def test_seach_facility_by_code(self): mommy.make(Facility, code=17780) api = ElasticAPI() api.delete_index('test_index') api.setup_index('test_index') test_facility = mommy.make(Facility, name='test facility') index_instance(test_facility, 'test_index') mommy.make(Facility) qs = Facility.objects.all() search_filter = SearchFilter(name='search') # some weird bug there is a delay in getting the search results for x in range(0, 100): search_filter.filter(qs, 18990) search_filter.filter(qs, 17780) api.delete_index('test_index') def tearDown(self): self.elastic_search_api.delete_index(index_name='test_index') super(TestSearchFilter, self).tearDown()
mit
abbeymiles/aima-python
submissions/McLean/vacuum2Runner.py
24
6129
import agents as ag import envgui as gui # change this line ONLY to refer to your project import submissions.aardvark.vacuum2 as v2 # ______________________________________________________________________________ # Vacuum environment class Dirt(ag.Thing): pass class VacuumEnvironment(ag.XYEnvironment): """The environment of [Ex. 2.12]. Agent perceives dirty or clean, and bump (into obstacle) or not; 2D discrete world of unknown size; performance measure is 100 for each dirt cleaned, and -1 for each turn taken.""" def __init__(self, width=4, height=3): super(VacuumEnvironment, self).__init__(width, height) self.add_walls() def thing_classes(self): return [ag.Wall, Dirt, # ReflexVacuumAgent, RandomVacuumAgent, # TableDrivenVacuumAgent, ModelBasedVacuumAgent ] def percept(self, agent): """The percept is a tuple of ('Dirty' or 'Clean', 'Bump' or 'None'). Unlike the TrivialVacuumEnvironment, location is NOT perceived.""" status = ('Dirty' if self.some_things_at( agent.location, Dirt) else 'Clean') bump = ('Bump' if agent.bump else'None') return (bump, status) def execute_action(self, agent, action): if action == 'Suck': dirt_list = self.list_things_at(agent.location, Dirt) if dirt_list != []: dirt = dirt_list[0] agent.performance += 100 self.delete_thing(dirt) else: super(VacuumEnvironment, self).execute_action(agent, action) if action != 'NoOp': agent.performance -= 1 # Launch a Text-Based Environment print('Two Cells, Agent on Left:') v = VacuumEnvironment(4, 3) v.add_thing(Dirt(), (1, 1)) v.add_thing(Dirt(), (2, 1)) a = v2.HW2Agent() a = ag.TraceAgent(a) v.add_thing(a, (1, 1)) t = gui.EnvTUI(v) t.mapImageNames({ ag.Wall: '#', Dirt: '@', ag.Agent: 'V', }) t.step(0) t.list_things(Dirt) t.step(4) if len(t.env.get_things(Dirt)) > 0: t.list_things(Dirt) else: print('All clean!') # Check to continue if input('Do you want to continue [y/N]? ') != 'y': exit(0) else: print('----------------------------------------') # Repeat, but put Agent on the Right print('Two Cells, Agent on Right:') v = VacuumEnvironment(4, 3) v.add_thing(Dirt(), (1, 1)) v.add_thing(Dirt(), (2, 1)) a = v2.HW2Agent() a = ag.TraceAgent(a) v.add_thing(a, (2, 1)) t = gui.EnvTUI(v) t.mapImageNames({ ag.Wall: '#', Dirt: '@', ag.Agent: 'V', }) t.step(0) t.list_things(Dirt) t.step(4) if len(t.env.get_things(Dirt)) > 0: t.list_things(Dirt) else: print('All clean!') # Check to continue if input('Do you want to continue [y/N]? ') != 'y': exit(0) else: print('----------------------------------------') # Repeat, but put Agent on the Right print('Two Cells, Agent on Top:') v = VacuumEnvironment(3, 4) v.add_thing(Dirt(), (1, 1)) v.add_thing(Dirt(), (1, 2)) a = v2.HW2Agent() a = ag.TraceAgent(a) v.add_thing(a, (1, 1)) t = gui.EnvTUI(v) t.mapImageNames({ ag.Wall: '#', Dirt: '@', ag.Agent: 'V', }) t.step(0) t.list_things(Dirt) t.step(4) if len(t.env.get_things(Dirt)) > 0: t.list_things(Dirt) else: print('All clean!') # Check to continue if input('Do you want to continue [y/N]? ') != 'y': exit(0) else: print('----------------------------------------') # Repeat, but put Agent on the Right print('Two Cells, Agent on Bottom:') v = VacuumEnvironment(3, 4) v.add_thing(Dirt(), (1, 1)) v.add_thing(Dirt(), (1, 2)) a = v2.HW2Agent() a = ag.TraceAgent(a) v.add_thing(a, (1, 2)) t = gui.EnvTUI(v) t.mapImageNames({ ag.Wall: '#', Dirt: '@', ag.Agent: 'V', }) t.step(0) t.list_things(Dirt) t.step(4) if len(t.env.get_things(Dirt)) > 0: t.list_things(Dirt) else: print('All clean!') # Check to continue if input('Do you want to continue [y/N]? ') != 'y': exit(0) else: print('----------------------------------------') def testVacuum(label, w=4, h=3, dloc=[(1,1),(2,1)], vloc=(1,1), limit=6): print(label) v = VacuumEnvironment(w, h) for loc in dloc: v.add_thing(Dirt(), loc) a = v2.HW2Agent() a = ag.TraceAgent(a) v.add_thing(a, vloc) t = gui.EnvTUI(v) t.mapImageNames({ ag.Wall: '#', Dirt: '@', ag.Agent: 'V', }) t.step(0) t.list_things(Dirt) t.step(limit) if len(t.env.get_things(Dirt)) > 0: t.list_things(Dirt) else: print('All clean!') # Check to continue if input('Do you want to continue [Y/n]? ') == 'n': exit(0) else: print('----------------------------------------') testVacuum('Two Cells, Agent on Left:') testVacuum('Two Cells, Agent on Right:', vloc=(2,1)) testVacuum('Two Cells, Agent on Top:', w=3, h=4, dloc=[(1,1), (1,2)], vloc=(1,1) ) testVacuum('Two Cells, Agent on Bottom:', w=3, h=4, dloc=[(1,1), (1,2)], vloc=(1,2) ) testVacuum('Five Cells, Agent on Left:', w=7, h=3, dloc=[(2,1), (4,1)], vloc=(1,1), limit=12) testVacuum('Five Cells, Agent near Right:', w=7, h=3, dloc=[(2,1), (3,1)], vloc=(4,1), limit=12) testVacuum('Five Cells, Agent on Top:', w=3, h=7, dloc=[(1,2), (1,4)], vloc=(1,1), limit=12 ) testVacuum('Five Cells, Agent Near Bottom:', w=3, h=7, dloc=[(1,2), (1,3)], vloc=(1,4), limit=12 ) testVacuum('5x4 Grid, Agent in Top Left:', w=7, h=6, dloc=[(1,4), (2,2), (3, 3), (4,1), (5,2)], vloc=(1,1), limit=46 ) testVacuum('5x4 Grid, Agent near Bottom Right:', w=7, h=6, dloc=[(1,3), (2,2), (3, 4), (4,1), (5,2)], vloc=(4, 3), limit=46 ) v = VacuumEnvironment(6, 3) a = v2.HW2Agent() a = ag.TraceAgent(a) loc = v.random_location_inbounds() v.add_thing(a, location=loc) v.scatter_things(Dirt) g = gui.EnvGUI(v, 'Vaccuum') c = g.getCanvas() c.mapImageNames({ ag.Wall: 'images/wall.jpg', # Floor: 'images/floor.png', Dirt: 'images/dirt.png', ag.Agent: 'images/vacuum.png', }) c.update() g.mainloop()
mit
ptemplier/ansible
lib/ansible/modules/cloud/azure/azure_rm_availabilityset.py
4
8695
#!/usr/bin/python # # Copyright (c) 2017 Julien Stroheker, <juliens@microsoft.com> # # 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: azure_rm_availabilityset version_added: "2.4" short_description: Manage Azure availability set. description: - Create, update and delete Azure availability set. An availability set cannot be updated, you will have to recreate one instead. The only update operation will be for the tags. options: resource_group: description: - Name of a resource group where the availability set exists or will be created. required: true name: description: - Name of the availability set. required: true state: description: - Assert the state of the availability set. Use 'present' to create or update a availability set and 'absent' to delete a availability set. default: present choices: - absent - present required: false location: description: - Valid azure location. Defaults to location of the resource group. default: resource_group location required: false platform_update_domain_count: description: - Update domains indicate groups of virtual machines and underlying physical hardware that can be rebooted at the same time. Default is 5. default: 5 required: false platform_fault_domain_count: description: - Fault domains define the group of virtual machines that share a common power source and network switch. Should be between 1 and 3. Default is 3 default: 3 required: false sku: description: - Define if the availability set supports managed disks. default: Classic choices: - Classic - Aligned required: false extends_documentation_fragment: - azure - azure_tags author: - "Julien Stroheker (@ju_stroh)" ''' EXAMPLES = ''' - name: Create an availability set with default options azure_rm_availabilityset: name: myavailabilityset location: eastus resource_group: Testing - name: Create an availability set with advanced options azure_rm_availabilityset: name: myavailabilityset location: eastus resource_group: Testing platform_update_domain_count: 5 platform_fault_domain_count: 3 sku: Aligned - name: Delete an availability set azure_rm_availabilityset: name: myavailabilityset location: eastus resource_group: Testing state: absent ''' RETURN = ''' state: description: Current state of the avaibility set returned: always type: dict changed: description: Whether or not the resource has changed returned: always type: bool ''' from ansible.module_utils.azure_rm_common import AzureRMModuleBase try: from msrestazure.azure_exceptions import CloudError from azure.mgmt.compute.models import ( AvailabilitySet, Sku ) except ImportError: # This is handled in azure_rm_common pass def availability_set_to_dict(avaset): return dict( id=avaset.id, name=avaset.name, location=avaset.location, platform_update_domain_count=avaset.platform_update_domain_count, platform_fault_domain_count=avaset.platform_fault_domain_count, tags=avaset.tags, sku=avaset.sku.name ) class AzureRMAvailabilitySet(AzureRMModuleBase): """Configuration class for an Azure RM availability set resource""" def __init__(self): self.module_arg_spec = dict( resource_group=dict( type='str', required=True ), name=dict( type='str', required=True ), state=dict( type='str', required=False, default='present', choices=['present', 'absent'] ), location=dict( type='str', required=False ), platform_update_domain_count=dict( type='int', default=5, required=False ), platform_fault_domain_count=dict( type='int', default=3, required=False ), sku=dict( type='str', default='Classic', required=False, choices=['Classic', 'Aligned'] ) ) self.resource_group = None self.name = None self.location = None self.tags = None self.platform_update_domain_count = None self.platform_fault_domain_count = None self.sku = None self.results = dict(changed=False, state=dict()) super(AzureRMAvailabilitySet, self).__init__(derived_arg_spec=self.module_arg_spec, supports_check_mode=True, supports_tags=True) def exec_module(self, **kwargs): """Main module execution method""" for key in list(self.module_arg_spec.keys()) + ['tags']: setattr(self, key, kwargs[key]) results = dict() resource_group = None response = None try: resource_group = self.get_resource_group(self.resource_group) except CloudError: self.fail('resource group {} not found'.format(self.resource_group)) if not self.location: self.location = resource_group.location # Check if the AS already present in the RG if self.state == 'present': response = self.get_availabilityset() if not response: self.results['state'] = self.create_availabilityset() self.results['changed'] = True else: self.log("AS already there, updating Tags") update_tags, response['tags'] = self.update_tags(response['tags']) if update_tags: self.results['state'] = self.create_availabilityset() self.results['changed'] = True elif self.state == 'absent': self.delete_availabilityset() self.results['changed'] = True return self.results def create_availabilityset(self): self.log("Creating availabilityset {0}".format(self.name)) try: paramsSku = Sku( name=self.sku ) params = AvailabilitySet( location=self.location, tags=self.tags, platform_update_domain_count=self.platform_update_domain_count, platform_fault_domain_count=self.platform_fault_domain_count, sku=paramsSku ) response = self.compute_client.availability_sets.create_or_update(self.resource_group, self.name, params) except CloudError as e: self.log('Error attempting to create the availability set.') self.fail("Error creating the availability set: {0}".format(str(e))) return availability_set_to_dict(response) def delete_availabilityset(self): self.log("Deleting availabilityset {0}".format(self.name)) try: response = self.compute_client.availability_sets.delete(self.resource_group, self.name) except CloudError as e: self.log('Error attempting to delete the availability set.') self.fail("Error deleting the availability set: {0}".format(str(e))) return True def get_availabilityset(self): self.log("Checking if the availabilityset {0} is present".format(self.name)) found = False try: response = self.compute_client.availability_sets.get(self.resource_group, self.name) found = True except CloudError as e: self.log('Did not find the Availability set.') if found is True: return availability_set_to_dict(response) else: return False def main(): """Main execution""" AzureRMAvailabilitySet() if __name__ == '__main__': main()
gpl-3.0
sniperganso/python-manilaclient
manilaclient/openstack/common/apiclient/client.py
1
13107
# Copyright 2010 Jacob Kaplan-Moss # Copyright 2011 OpenStack Foundation # Copyright 2011 Piston Cloud Computing, Inc. # Copyright 2013 Alessio Ababilov # Copyright 2013 Grid Dynamics # Copyright 2013 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. """ OpenStack Client interface. Handles the REST calls and responses. """ # E0202: An attribute inherited from %s hide this method # pylint: disable=E0202 import logging import time try: import simplejson as json except ImportError: import json from oslo_utils import importutils import requests from manilaclient.openstack.common._i18n import _ from manilaclient.openstack.common.apiclient import exceptions _logger = logging.getLogger(__name__) class HTTPClient(object): """This client handles sending HTTP requests to OpenStack servers. Features: - share authentication information between several clients to different services (e.g., for compute and image clients); - reissue authentication request for expired tokens; - encode/decode JSON bodies; - raise exceptions on HTTP errors; - pluggable authentication; - store authentication information in a keyring; - store time spent for requests; - register clients for particular services, so one can use `http_client.identity` or `http_client.compute`; - log requests and responses in a format that is easy to copy-and-paste into terminal and send the same request with curl. """ user_agent = "manilaclient.openstack.common.apiclient" def __init__(self, auth_plugin, region_name=None, endpoint_type="publicURL", original_ip=None, verify=True, cert=None, timeout=None, timings=False, keyring_saver=None, debug=False, user_agent=None, http=None): self.auth_plugin = auth_plugin self.endpoint_type = endpoint_type self.region_name = region_name self.original_ip = original_ip self.timeout = timeout self.verify = verify self.cert = cert self.keyring_saver = keyring_saver self.debug = debug self.user_agent = user_agent or self.user_agent self.times = [] # [("item", starttime, endtime), ...] self.timings = timings # requests within the same session can reuse TCP connections from pool self.http = http or requests.Session() self.cached_token = None def _http_log_req(self, method, url, kwargs): if not self.debug: return string_parts = [ "curl -i", "-X '%s'" % method, "'%s'" % url, ] for element in kwargs['headers']: header = "-H '%s: %s'" % (element, kwargs['headers'][element]) string_parts.append(header) _logger.debug("REQ: %s" % " ".join(string_parts)) if 'data' in kwargs: _logger.debug("REQ BODY: %s\n" % (kwargs['data'])) def _http_log_resp(self, resp): if not self.debug: return _logger.debug( "RESP: [%s] %s\n", resp.status_code, resp.headers) if resp._content_consumed: _logger.debug( "RESP BODY: %s\n", resp.text) def serialize(self, kwargs): if kwargs.get('json') is not None: kwargs['headers']['Content-Type'] = 'application/json' kwargs['data'] = json.dumps(kwargs['json']) try: del kwargs['json'] except KeyError: pass def get_timings(self): return self.times def reset_timings(self): self.times = [] def request(self, method, url, **kwargs): """Send an http request with the specified characteristics. Wrapper around `requests.Session.request` to handle tasks such as setting headers, JSON encoding/decoding, and error handling. :param method: method of HTTP request :param url: URL of HTTP request :param kwargs: any other parameter that can be passed to requests.Session.request (such as `headers`) or `json` that will be encoded as JSON and used as `data` argument """ kwargs.setdefault("headers", {}) kwargs["headers"]["User-Agent"] = self.user_agent if self.original_ip: kwargs["headers"]["Forwarded"] = "for=%s;by=%s" % ( self.original_ip, self.user_agent) if self.timeout is not None: kwargs.setdefault("timeout", self.timeout) kwargs.setdefault("verify", self.verify) if self.cert is not None: kwargs.setdefault("cert", self.cert) self.serialize(kwargs) self._http_log_req(method, url, kwargs) if self.timings: start_time = time.time() resp = self.http.request(method, url, **kwargs) if self.timings: self.times.append(("%s %s" % (method, url), start_time, time.time())) self._http_log_resp(resp) if resp.status_code >= 400: _logger.debug( "Request returned failure status: %s", resp.status_code) raise exceptions.from_response(resp, method, url) return resp @staticmethod def concat_url(endpoint, url): """Concatenate endpoint and final URL. E.g., "http://keystone/v2.0/" and "/tokens" are concatenated to "http://keystone/v2.0/tokens". :param endpoint: the base URL :param url: the final URL """ return "%s/%s" % (endpoint.rstrip("/"), url.strip("/")) def client_request(self, client, method, url, **kwargs): """Send an http request using `client`'s endpoint and specified `url`. If request was rejected as unauthorized (possibly because the token is expired), issue one authorization attempt and send the request once again. :param client: instance of BaseClient descendant :param method: method of HTTP request :param url: URL of HTTP request :param kwargs: any other parameter that can be passed to `HTTPClient.request` """ filter_args = { "endpoint_type": client.endpoint_type or self.endpoint_type, "service_type": client.service_type, } token, endpoint = (self.cached_token, client.cached_endpoint) just_authenticated = False if not (token and endpoint): try: token, endpoint = self.auth_plugin.token_and_endpoint( **filter_args) except exceptions.EndpointException: pass if not (token and endpoint): self.authenticate() just_authenticated = True token, endpoint = self.auth_plugin.token_and_endpoint( **filter_args) if not (token and endpoint): raise exceptions.AuthorizationFailure( _("Cannot find endpoint or token for request")) old_token_endpoint = (token, endpoint) kwargs.setdefault("headers", {})["X-Auth-Token"] = token self.cached_token = token client.cached_endpoint = endpoint # Perform the request once. If we get Unauthorized, then it # might be because the auth token expired, so try to # re-authenticate and try again. If it still fails, bail. try: return self.request( method, self.concat_url(endpoint, url), **kwargs) except exceptions.Unauthorized as unauth_ex: if just_authenticated: raise self.cached_token = None client.cached_endpoint = None if self.auth_plugin.opts.get('token'): self.auth_plugin.opts['token'] = None if self.auth_plugin.opts.get('endpoint'): self.auth_plugin.opts['endpoint'] = None self.authenticate() try: token, endpoint = self.auth_plugin.token_and_endpoint( **filter_args) except exceptions.EndpointException: raise unauth_ex if (not (token and endpoint) or old_token_endpoint == (token, endpoint)): raise unauth_ex self.cached_token = token client.cached_endpoint = endpoint kwargs["headers"]["X-Auth-Token"] = token return self.request( method, self.concat_url(endpoint, url), **kwargs) def add_client(self, base_client_instance): """Add a new instance of :class:`BaseClient` descendant. `self` will store a reference to `base_client_instance`. Example: >>> def test_clients(): ... from keystoneclient.auth import keystone ... from openstack.common.apiclient import client ... auth = keystone.KeystoneAuthPlugin( ... username="user", password="pass", tenant_name="tenant", ... auth_url="http://auth:5000/v2.0") ... openstack_client = client.HTTPClient(auth) ... # create nova client ... from novaclient.v1_1 import client ... client.Client(openstack_client) ... # create keystone client ... from keystoneclient.v2_0 import client ... client.Client(openstack_client) ... # use them ... openstack_client.identity.tenants.list() ... openstack_client.compute.servers.list() """ service_type = base_client_instance.service_type if service_type and not hasattr(self, service_type): setattr(self, service_type, base_client_instance) def authenticate(self): self.auth_plugin.authenticate(self) # Store the authentication results in the keyring for later requests if self.keyring_saver: self.keyring_saver.save(self) class BaseClient(object): """Top-level object to access the OpenStack API. This client uses :class:`HTTPClient` to send requests. :class:`HTTPClient` will handle a bunch of issues such as authentication. """ service_type = None endpoint_type = None # "publicURL" will be used cached_endpoint = None def __init__(self, http_client, extensions=None): self.http_client = http_client http_client.add_client(self) # Add in any extensions... if extensions: for extension in extensions: if extension.manager_class: setattr(self, extension.name, extension.manager_class(self)) def client_request(self, method, url, **kwargs): return self.http_client.client_request( self, method, url, **kwargs) def head(self, url, **kwargs): return self.client_request("HEAD", url, **kwargs) def get(self, url, **kwargs): return self.client_request("GET", url, **kwargs) def post(self, url, **kwargs): return self.client_request("POST", url, **kwargs) def put(self, url, **kwargs): return self.client_request("PUT", url, **kwargs) def delete(self, url, **kwargs): return self.client_request("DELETE", url, **kwargs) def patch(self, url, **kwargs): return self.client_request("PATCH", url, **kwargs) @staticmethod def get_class(api_name, version, version_map): """Returns the client class for the requested API version :param api_name: the name of the API, e.g. 'compute', 'image', etc :param version: the requested API version :param version_map: a dict of client classes keyed by version :rtype: a client class for the requested API version """ try: client_path = version_map[str(version)] except (KeyError, ValueError): msg = _("Invalid %(api_name)s client version '%(version)s'. " "Must be one of: %(version_map)s") % { 'api_name': api_name, 'version': version, 'version_map': ', '.join(version_map.keys())} raise exceptions.UnsupportedVersion(msg) return importutils.import_class(client_path)
apache-2.0
Hitachi-Data-Systems/org-chart-builder
pptx/parts/image.py
1
7754
# encoding: utf-8 """ Image part objects, including Image """ import hashlib import os import posixpath try: from PIL import Image as PIL_Image except ImportError: import Image as PIL_Image from StringIO import StringIO from pptx.opc.package import Part from pptx.opc.packuri import PackURI from pptx.opc.spec import image_content_types from pptx.parts.part import PartCollection from pptx.util import Px class Image(Part): """ Return new Image part instance. *file* may be |None|, a path to a file (a string), or a file-like object. If *file* is |None|, no image is loaded and :meth:`_load` must be called before using the instance. Otherwise, the file referenced or contained in *file* is loaded. Corresponds to package files ppt/media/image[1-9][0-9]*.*. """ def __init__(self, partname, content_type, blob, ext, filepath=None): super(Image, self).__init__(partname, content_type, blob) self._ext = ext self._filepath = filepath @classmethod def new(cls, partname, img_file): """ Return a new Image part instance from *img_file*, which may be a path to a file (a string), or a file-like object. Corresponds to package files ppt/media/image[1-9][0-9]*.*. """ filepath, ext, content_type, blob = cls._load_from_file(img_file) image = cls(partname, content_type, blob, ext, filepath) return image @property def ext(self): """ Return file extension for this image e.g. ``'png'``. """ return self._ext @classmethod def load(cls, partname, content_type, blob, package): ext = posixpath.splitext(partname)[1] return cls(partname, content_type, blob, ext) @property def _desc(self): """ Return filename associated with this image, either the filename of the original image file the image was created with or a synthetic name of the form ``image.ext`` where ``ext`` is appropriate to the image file format, e.g. ``'jpg'``. """ if self._filepath is not None: return os.path.split(self._filepath)[1] # return generic filename if original filename is unknown return 'image.%s' % self.ext @staticmethod def _ext_from_image_stream(stream): """ Return the filename extension appropriate to the image file contained in *stream*. """ ext_map = { 'GIF': 'gif', 'JPEG': 'jpg', 'PNG': 'png', 'TIFF': 'tiff', 'WMF': 'wmf' } stream.seek(0) format = PIL_Image.open(stream).format if format not in ext_map: tmpl = "unsupported image format, expected one of: %s, got '%s'" raise ValueError(tmpl % (ext_map.keys(), format)) return ext_map[format] @staticmethod def _image_ext_content_type(ext): """ Return the content type corresponding to filename extension *ext* """ key = ext.lower() if key not in image_content_types: tmpl = "unsupported image file extension '%s'" raise ValueError(tmpl % (ext)) content_type = image_content_types[key] return content_type @classmethod def _load_from_file(cls, img_file): """ Load image from *img_file*, which is either a path to an image file or a file-like object. """ if isinstance(img_file, basestring): # img_file is a path filepath = img_file ext = os.path.splitext(filepath)[1][1:] content_type = cls._image_ext_content_type(ext) with open(filepath, 'rb') as f: blob = f.read() else: # assume img_file is a file-like object filepath = None ext = cls._ext_from_image_stream(img_file) content_type = cls._image_ext_content_type(ext) img_file.seek(0) blob = img_file.read() return filepath, ext, content_type, blob def _scale(self, width, height): """ Return scaled image dimensions based on supplied parameters. If *width* and *height* are both |None|, the native image size is returned. If neither *width* nor *height* is |None|, their values are returned unchanged. If a value is provided for either *width* or *height* and the other is |None|, the dimensions are scaled, preserving the image's aspect ratio. """ native_width_px, native_height_px = self._size native_width = Px(native_width_px) native_height = Px(native_height_px) if width is None and height is None: width = native_width height = native_height elif width is None: scaling_factor = float(height) / float(native_height) width = int(round(native_width * scaling_factor)) elif height is None: scaling_factor = float(width) / float(native_width) height = int(round(native_height * scaling_factor)) return width, height @property def _sha1(self): """Return SHA1 hash digest for image""" return hashlib.sha1(self._blob).hexdigest() @property def _size(self): """ Return *width*, *height* tuple representing native dimensions of image in pixels. """ image_stream = StringIO(self._blob) width_px, height_px = PIL_Image.open(image_stream).size image_stream.close() return width_px, height_px class ImageCollection(PartCollection): """ Immutable sequence of images, typically belonging to an instance of |Package|. An image part containing a particular image blob appears only once in an instance, regardless of how many times it is referenced by a pic shape in a slide. """ def __init__(self): super(ImageCollection, self).__init__() def add_image(self, file): """ Return image part containing the image in *file*, which is either a path to an image file or a file-like object containing an image. If an image instance containing this same image already exists, that instance is returned. If it does not yet exist, a new one is created. """ # use Image constructor to validate and characterize image file partname = PackURI('/ppt/media/image1.jpeg') # dummy just for baseURI image = Image.new(partname, file) # return matching image if found for existing_image in self._values: if existing_image._sha1 == image._sha1: return existing_image # otherwise add it to collection and return new image self._values.append(image) self._rename_images() return image def load(self, parts): """ Load the image collection with all the image parts in iterable *parts*. """ def is_image_part(part): return ( isinstance(part, Image) and part.partname.startswith('/ppt/media/') ) for part in parts: if is_image_part(part): self.add_part(part) def _rename_images(self): """ Assign partnames like ``/ppt/media/image9.png`` to all images in the collection. The name portion is always ``image``. The number part forms a continuous sequence starting at 1 (e.g. 1, 2, 3, ...). The extension is preserved during renaming. """ for idx, image in enumerate(self._values): partname_str = '/ppt/media/image%d.%s' % (idx+1, image.ext) image.partname = PackURI(partname_str)
apache-2.0
MridulS/sympy
sympy/solvers/recurr.py
20
24338
""" This module is intended for solving recurrences or, in other words, difference equations. Currently supported are linear, inhomogeneous equations with polynomial or rational coefficients. The solutions are obtained among polynomials, rational functions, hypergeometric terms, or combinations of hypergeometric term which are pairwise dissimilar. ``rsolve_X`` functions were meant as a low level interface for ``rsolve`` which would use Mathematica's syntax. Given a recurrence relation: .. math:: a_{k}(n) y(n+k) + a_{k-1}(n) y(n+k-1) + ... + a_{0}(n) y(n) = f(n) where `k > 0` and `a_{i}(n)` are polynomials in `n`. To use ``rsolve_X`` we need to put all coefficients in to a list ``L`` of `k+1` elements the following way: ``L = [ a_{0}(n), ..., a_{k-1}(n), a_{k}(n) ]`` where ``L[i]``, for `i=0, \dots, k`, maps to `a_{i}(n) y(n+i)` (`y(n+i)` is implicit). For example if we would like to compute `m`-th Bernoulli polynomial up to a constant (example was taken from rsolve_poly docstring), then we would use `b(n+1) - b(n) = m n^{m-1}` recurrence, which has solution `b(n) = B_m + C`. Then ``L = [-1, 1]`` and `f(n) = m n^(m-1)` and finally for `m=4`: >>> from sympy import Symbol, bernoulli, rsolve_poly >>> n = Symbol('n', integer=True) >>> rsolve_poly([-1, 1], 4*n**3, n) C0 + n**4 - 2*n**3 + n**2 >>> bernoulli(4, n) n**4 - 2*n**3 + n**2 - 1/30 For the sake of completeness, `f(n)` can be: [1] a polynomial -> rsolve_poly [2] a rational function -> rsolve_ratio [3] a hypergeometric function -> rsolve_hyper """ from __future__ import print_function, division from collections import defaultdict from sympy.core.singleton import S from sympy.core.numbers import Rational from sympy.core.symbol import Symbol, Wild, Dummy from sympy.core.relational import Equality from sympy.core.add import Add from sympy.core.mul import Mul from sympy.core import sympify from sympy.simplify import simplify, hypersimp, hypersimilar from sympy.solvers import solve, solve_undetermined_coeffs from sympy.polys import Poly, quo, gcd, lcm, roots, resultant from sympy.functions import binomial, factorial, FallingFactorial, RisingFactorial from sympy.matrices import Matrix, casoratian from sympy.concrete import product from sympy.core.compatibility import default_sort_key, xrange from sympy.utilities.iterables import numbered_symbols def rsolve_poly(coeffs, f, n, **hints): """ Given linear recurrence operator `\operatorname{L}` of order `k` with polynomial coefficients and inhomogeneous equation `\operatorname{L} y = f`, where `f` is a polynomial, we seek for all polynomial solutions over field `K` of characteristic zero. The algorithm performs two basic steps: (1) Compute degree `N` of the general polynomial solution. (2) Find all polynomials of degree `N` or less of `\operatorname{L} y = f`. There are two methods for computing the polynomial solutions. If the degree bound is relatively small, i.e. it's smaller than or equal to the order of the recurrence, then naive method of undetermined coefficients is being used. This gives system of algebraic equations with `N+1` unknowns. In the other case, the algorithm performs transformation of the initial equation to an equivalent one, for which the system of algebraic equations has only `r` indeterminates. This method is quite sophisticated (in comparison with the naive one) and was invented together by Abramov, Bronstein and Petkovsek. It is possible to generalize the algorithm implemented here to the case of linear q-difference and differential equations. Lets say that we would like to compute `m`-th Bernoulli polynomial up to a constant. For this we can use `b(n+1) - b(n) = m n^{m-1}` recurrence, which has solution `b(n) = B_m + C`. For example: >>> from sympy import Symbol, rsolve_poly >>> n = Symbol('n', integer=True) >>> rsolve_poly([-1, 1], 4*n**3, n) C0 + n**4 - 2*n**3 + n**2 References ========== .. [1] S. A. Abramov, M. Bronstein and M. Petkovsek, On polynomial solutions of linear operator equations, in: T. Levelt, ed., Proc. ISSAC '95, ACM Press, New York, 1995, 290-296. .. [2] M. Petkovsek, Hypergeometric solutions of linear recurrences with polynomial coefficients, J. Symbolic Computation, 14 (1992), 243-264. .. [3] M. Petkovsek, H. S. Wilf, D. Zeilberger, A = B, 1996. """ f = sympify(f) if not f.is_polynomial(n): return None homogeneous = f.is_zero r = len(coeffs) - 1 coeffs = [ Poly(coeff, n) for coeff in coeffs ] polys = [ Poly(0, n) ] * (r + 1) terms = [ (S.Zero, S.NegativeInfinity) ] *(r + 1) for i in xrange(0, r + 1): for j in xrange(i, r + 1): polys[i] += coeffs[j]*binomial(j, i) if not polys[i].is_zero: (exp,), coeff = polys[i].LT() terms[i] = (coeff, exp) d = b = terms[0][1] for i in xrange(1, r + 1): if terms[i][1] > d: d = terms[i][1] if terms[i][1] - i > b: b = terms[i][1] - i d, b = int(d), int(b) x = Dummy('x') degree_poly = S.Zero for i in xrange(0, r + 1): if terms[i][1] - i == b: degree_poly += terms[i][0]*FallingFactorial(x, i) nni_roots = list(roots(degree_poly, x, filter='Z', predicate=lambda r: r >= 0).keys()) if nni_roots: N = [max(nni_roots)] else: N = [] if homogeneous: N += [-b - 1] else: N += [f.as_poly(n).degree() - b, -b - 1] N = int(max(N)) if N < 0: if homogeneous: if hints.get('symbols', False): return (S.Zero, []) else: return S.Zero else: return None if N <= r: C = [] y = E = S.Zero for i in xrange(0, N + 1): C.append(Symbol('C' + str(i))) y += C[i] * n**i for i in xrange(0, r + 1): E += coeffs[i].as_expr()*y.subs(n, n + i) solutions = solve_undetermined_coeffs(E - f, C, n) if solutions is not None: C = [ c for c in C if (c not in solutions) ] result = y.subs(solutions) else: return None # TBD else: A = r U = N + A + b + 1 nni_roots = list(roots(polys[r], filter='Z', predicate=lambda r: r >= 0).keys()) if nni_roots != []: a = max(nni_roots) + 1 else: a = S.Zero def _zero_vector(k): return [S.Zero] * k def _one_vector(k): return [S.One] * k def _delta(p, k): B = S.One D = p.subs(n, a + k) for i in xrange(1, k + 1): B *= -Rational(k - i + 1, i) D += B * p.subs(n, a + k - i) return D alpha = {} for i in xrange(-A, d + 1): I = _one_vector(d + 1) for k in xrange(1, d + 1): I[k] = I[k - 1] * (x + i - k + 1)/k alpha[i] = S.Zero for j in xrange(0, A + 1): for k in xrange(0, d + 1): B = binomial(k, i + j) D = _delta(polys[j].as_expr(), k) alpha[i] += I[k]*B*D V = Matrix(U, A, lambda i, j: int(i == j)) if homogeneous: for i in xrange(A, U): v = _zero_vector(A) for k in xrange(1, A + b + 1): if i - k < 0: break B = alpha[k - A].subs(x, i - k) for j in xrange(0, A): v[j] += B * V[i - k, j] denom = alpha[-A].subs(x, i) for j in xrange(0, A): V[i, j] = -v[j] / denom else: G = _zero_vector(U) for i in xrange(A, U): v = _zero_vector(A) g = S.Zero for k in xrange(1, A + b + 1): if i - k < 0: break B = alpha[k - A].subs(x, i - k) for j in xrange(0, A): v[j] += B * V[i - k, j] g += B * G[i - k] denom = alpha[-A].subs(x, i) for j in xrange(0, A): V[i, j] = -v[j] / denom G[i] = (_delta(f, i - A) - g) / denom P, Q = _one_vector(U), _zero_vector(A) for i in xrange(1, U): P[i] = (P[i - 1] * (n - a - i + 1)/i).expand() for i in xrange(0, A): Q[i] = Add(*[ (v*p).expand() for v, p in zip(V[:, i], P) ]) if not homogeneous: h = Add(*[ (g*p).expand() for g, p in zip(G, P) ]) C = [ Symbol('C' + str(i)) for i in xrange(0, A) ] g = lambda i: Add(*[ c*_delta(q, i) for c, q in zip(C, Q) ]) if homogeneous: E = [ g(i) for i in xrange(N + 1, U) ] else: E = [ g(i) + _delta(h, i) for i in xrange(N + 1, U) ] if E != []: solutions = solve(E, *C) if not solutions: if homogeneous: if hints.get('symbols', False): return (S.Zero, []) else: return S.Zero else: return None else: solutions = {} if homogeneous: result = S.Zero else: result = h for c, q in list(zip(C, Q)): if c in solutions: s = solutions[c]*q C.remove(c) else: s = c*q result += s.expand() if hints.get('symbols', False): return (result, C) else: return result def rsolve_ratio(coeffs, f, n, **hints): """ Given linear recurrence operator `\operatorname{L}` of order `k` with polynomial coefficients and inhomogeneous equation `\operatorname{L} y = f`, where `f` is a polynomial, we seek for all rational solutions over field `K` of characteristic zero. This procedure accepts only polynomials, however if you are interested in solving recurrence with rational coefficients then use ``rsolve`` which will pre-process the given equation and run this procedure with polynomial arguments. The algorithm performs two basic steps: (1) Compute polynomial `v(n)` which can be used as universal denominator of any rational solution of equation `\operatorname{L} y = f`. (2) Construct new linear difference equation by substitution `y(n) = u(n)/v(n)` and solve it for `u(n)` finding all its polynomial solutions. Return ``None`` if none were found. Algorithm implemented here is a revised version of the original Abramov's algorithm, developed in 1989. The new approach is much simpler to implement and has better overall efficiency. This method can be easily adapted to q-difference equations case. Besides finding rational solutions alone, this functions is an important part of Hyper algorithm were it is used to find particular solution of inhomogeneous part of a recurrence. Examples ======== >>> from sympy.abc import x >>> from sympy.solvers.recurr import rsolve_ratio >>> rsolve_ratio([-2*x**3 + x**2 + 2*x - 1, 2*x**3 + x**2 - 6*x, ... - 2*x**3 - 11*x**2 - 18*x - 9, 2*x**3 + 13*x**2 + 22*x + 8], 0, x) C2*(2*x - 3)/(2*(x**2 - 1)) References ========== .. [1] S. A. Abramov, Rational solutions of linear difference and q-difference equations with polynomial coefficients, in: T. Levelt, ed., Proc. ISSAC '95, ACM Press, New York, 1995, 285-289 See Also ======== rsolve_hyper """ f = sympify(f) if not f.is_polynomial(n): return None coeffs = list(map(sympify, coeffs)) r = len(coeffs) - 1 A, B = coeffs[r], coeffs[0] A = A.subs(n, n - r).expand() h = Dummy('h') res = resultant(A, B.subs(n, n + h), n) if not res.is_polynomial(h): p, q = res.as_numer_denom() res = quo(p, q, h) nni_roots = list(roots(res, h, filter='Z', predicate=lambda r: r >= 0).keys()) if not nni_roots: return rsolve_poly(coeffs, f, n, **hints) else: C, numers = S.One, [S.Zero]*(r + 1) for i in xrange(int(max(nni_roots)), -1, -1): d = gcd(A, B.subs(n, n + i), n) A = quo(A, d, n) B = quo(B, d.subs(n, n - i), n) C *= Mul(*[ d.subs(n, n - j) for j in xrange(0, i + 1) ]) denoms = [ C.subs(n, n + i) for i in range(0, r + 1) ] for i in range(0, r + 1): g = gcd(coeffs[i], denoms[i], n) numers[i] = quo(coeffs[i], g, n) denoms[i] = quo(denoms[i], g, n) for i in xrange(0, r + 1): numers[i] *= Mul(*(denoms[:i] + denoms[i + 1:])) result = rsolve_poly(numers, f * Mul(*denoms), n, **hints) if result is not None: if hints.get('symbols', False): return (simplify(result[0] / C), result[1]) else: return simplify(result / C) else: return None def rsolve_hyper(coeffs, f, n, **hints): """ Given linear recurrence operator `\operatorname{L}` of order `k` with polynomial coefficients and inhomogeneous equation `\operatorname{L} y = f` we seek for all hypergeometric solutions over field `K` of characteristic zero. The inhomogeneous part can be either hypergeometric or a sum of a fixed number of pairwise dissimilar hypergeometric terms. The algorithm performs three basic steps: (1) Group together similar hypergeometric terms in the inhomogeneous part of `\operatorname{L} y = f`, and find particular solution using Abramov's algorithm. (2) Compute generating set of `\operatorname{L}` and find basis in it, so that all solutions are linearly independent. (3) Form final solution with the number of arbitrary constants equal to dimension of basis of `\operatorname{L}`. Term `a(n)` is hypergeometric if it is annihilated by first order linear difference equations with polynomial coefficients or, in simpler words, if consecutive term ratio is a rational function. The output of this procedure is a linear combination of fixed number of hypergeometric terms. However the underlying method can generate larger class of solutions - D'Alembertian terms. Note also that this method not only computes the kernel of the inhomogeneous equation, but also reduces in to a basis so that solutions generated by this procedure are linearly independent Examples ======== >>> from sympy.solvers import rsolve_hyper >>> from sympy.abc import x >>> rsolve_hyper([-1, -1, 1], 0, x) C0*(1/2 + sqrt(5)/2)**x + C1*(-sqrt(5)/2 + 1/2)**x >>> rsolve_hyper([-1, 1], 1 + x, x) C0 + x*(x + 1)/2 References ========== .. [1] M. Petkovsek, Hypergeometric solutions of linear recurrences with polynomial coefficients, J. Symbolic Computation, 14 (1992), 243-264. .. [2] M. Petkovsek, H. S. Wilf, D. Zeilberger, A = B, 1996. """ coeffs = list(map(sympify, coeffs)) f = sympify(f) r, kernel, symbols = len(coeffs) - 1, [], set() if not f.is_zero: if f.is_Add: similar = {} for g in f.expand().args: if not g.is_hypergeometric(n): return None for h in similar.keys(): if hypersimilar(g, h, n): similar[h] += g break else: similar[g] = S.Zero inhomogeneous = [] for g, h in similar.items(): inhomogeneous.append(g + h) elif f.is_hypergeometric(n): inhomogeneous = [f] else: return None for i, g in enumerate(inhomogeneous): coeff, polys = S.One, coeffs[:] denoms = [ S.One ] * (r + 1) s = hypersimp(g, n) for j in xrange(1, r + 1): coeff *= s.subs(n, n + j - 1) p, q = coeff.as_numer_denom() polys[j] *= p denoms[j] = q for j in xrange(0, r + 1): polys[j] *= Mul(*(denoms[:j] + denoms[j + 1:])) R = rsolve_poly(polys, Mul(*denoms), n) if not (R is None or R is S.Zero): inhomogeneous[i] *= R else: return None result = Add(*inhomogeneous) else: result = S.Zero Z = Dummy('Z') p, q = coeffs[0], coeffs[r].subs(n, n - r + 1) p_factors = [ z for z in roots(p, n).keys() ] q_factors = [ z for z in roots(q, n).keys() ] factors = [ (S.One, S.One) ] for p in p_factors: for q in q_factors: if p.is_integer and q.is_integer and p <= q: continue else: factors += [(n - p, n - q)] p = [ (n - p, S.One) for p in p_factors ] q = [ (S.One, n - q) for q in q_factors ] factors = p + factors + q for A, B in factors: polys, degrees = [], [] D = A*B.subs(n, n + r - 1) for i in xrange(0, r + 1): a = Mul(*[ A.subs(n, n + j) for j in xrange(0, i) ]) b = Mul(*[ B.subs(n, n + j) for j in xrange(i, r) ]) poly = quo(coeffs[i]*a*b, D, n) polys.append(poly.as_poly(n)) if not poly.is_zero: degrees.append(polys[i].degree()) d, poly = max(degrees), S.Zero for i in xrange(0, r + 1): coeff = polys[i].nth(d) if coeff is not S.Zero: poly += coeff * Z**i for z in roots(poly, Z).keys(): if z.is_zero: continue (C, s) = rsolve_poly([ polys[i]*z**i for i in xrange(r + 1) ], 0, n, symbols=True) if C is not None and C is not S.Zero: symbols |= set(s) ratio = z * A * C.subs(n, n + 1) / B / C ratio = simplify(ratio) # If there is a nonnegative root in the denominator of the ratio, # this indicates that the term y(n_root) is zero, and one should # start the product with the term y(n_root + 1). n0 = 0 for n_root in roots(ratio.as_numer_denom()[1], n).keys(): if (n0 < (n_root + 1)) == True: n0 = n_root + 1 K = product(ratio, (n, n0, n - 1)) if K.has(factorial, FallingFactorial, RisingFactorial): K = simplify(K) if casoratian(kernel + [K], n, zero=False) != 0: kernel.append(K) kernel.sort(key=default_sort_key) sk = list(zip(numbered_symbols('C'), kernel)) if sk: for C, ker in sk: result += C * ker else: return None if hints.get('symbols', False): symbols |= set([s for s, k in sk]) return (result, list(symbols)) else: return result def rsolve(f, y, init=None): """ Solve univariate recurrence with rational coefficients. Given `k`-th order linear recurrence `\operatorname{L} y = f`, or equivalently: .. math:: a_{k}(n) y(n+k) + a_{k-1}(n) y(n+k-1) + \dots + a_{0}(n) y(n) = f(n) where `a_{i}(n)`, for `i=0, \dots, k`, are polynomials or rational functions in `n`, and `f` is a hypergeometric function or a sum of a fixed number of pairwise dissimilar hypergeometric terms in `n`, finds all solutions or returns ``None``, if none were found. Initial conditions can be given as a dictionary in two forms: (1) ``{ n_0 : v_0, n_1 : v_1, ..., n_m : v_m }`` (2) ``{ y(n_0) : v_0, y(n_1) : v_1, ..., y(n_m) : v_m }`` or as a list ``L`` of values: ``L = [ v_0, v_1, ..., v_m ]`` where ``L[i] = v_i``, for `i=0, \dots, m`, maps to `y(n_i)`. Examples ======== Lets consider the following recurrence: .. math:: (n - 1) y(n + 2) - (n^2 + 3 n - 2) y(n + 1) + 2 n (n + 1) y(n) = 0 >>> from sympy import Function, rsolve >>> from sympy.abc import n >>> y = Function('y') >>> f = (n - 1)*y(n + 2) - (n**2 + 3*n - 2)*y(n + 1) + 2*n*(n + 1)*y(n) >>> rsolve(f, y(n)) 2**n*C0 + C1*factorial(n) >>> rsolve(f, y(n), { y(0):0, y(1):3 }) 3*2**n - 3*factorial(n) See Also ======== rsolve_poly, rsolve_ratio, rsolve_hyper """ if isinstance(f, Equality): f = f.lhs - f.rhs n = y.args[0] k = Wild('k', exclude=(n,)) # Preprocess user input to allow things like # y(n) + a*(y(n + 1) + y(n - 1))/2 f = f.expand().collect(y.func(Wild('m', integer=True))) h_part = defaultdict(lambda: S.Zero) i_part = S.Zero for g in Add.make_args(f): coeff = S.One kspec = None for h in Mul.make_args(g): if h.is_Function: if h.func == y.func: result = h.args[0].match(n + k) if result is not None: kspec = int(result[k]) else: raise ValueError( "'%s(%s+k)' expected, got '%s'" % (y.func, n, h)) else: raise ValueError( "'%s' expected, got '%s'" % (y.func, h.func)) else: coeff *= h if kspec is not None: h_part[kspec] += coeff else: i_part += coeff for k, coeff in h_part.items(): h_part[k] = simplify(coeff) common = S.One for coeff in h_part.values(): if coeff.is_rational_function(n): if not coeff.is_polynomial(n): common = lcm(common, coeff.as_numer_denom()[1], n) else: raise ValueError( "Polynomial or rational function expected, got '%s'" % coeff) i_numer, i_denom = i_part.as_numer_denom() if i_denom.is_polynomial(n): common = lcm(common, i_denom, n) if common is not S.One: for k, coeff in h_part.items(): numer, denom = coeff.as_numer_denom() h_part[k] = numer*quo(common, denom, n) i_part = i_numer*quo(common, i_denom, n) K_min = min(h_part.keys()) if K_min < 0: K = abs(K_min) H_part = defaultdict(lambda: S.Zero) i_part = i_part.subs(n, n + K).expand() common = common.subs(n, n + K).expand() for k, coeff in h_part.items(): H_part[k + K] = coeff.subs(n, n + K).expand() else: H_part = h_part K_max = max(H_part.keys()) coeffs = [H_part[i] for i in xrange(K_max + 1)] result = rsolve_hyper(coeffs, -i_part, n, symbols=True) if result is None: return None solution, symbols = result if init == {} or init == []: init = None if symbols and init is not None: if type(init) is list: init = dict([(i, init[i]) for i in xrange(len(init))]) equations = [] for k, v in init.items(): try: i = int(k) except TypeError: if k.is_Function and k.func == y.func: i = int(k.args[0]) else: raise ValueError("Integer or term expected, got '%s'" % k) try: eq = solution.limit(n, i) - v except NotImplementedError: eq = solution.subs(n, i) - v equations.append(eq) result = solve(equations, *symbols) if not result: return None else: solution = solution.subs(result) return solution
bsd-3-clause
francisco-dlp/hyperspy
hyperspy/_signals/dielectric_function.py
4
5178
# -*- coding: utf-8 -*- # Copyright 2007-2016 The HyperSpy developers # # This file is part of HyperSpy. # # HyperSpy 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. # # HyperSpy 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 HyperSpy. If not, see <http://www.gnu.org/licenses/>. import numpy as np from scipy import constants from scipy.integrate import simps, cumtrapz from hyperspy._signals.complex_signal1d import (ComplexSignal1D, LazyComplexSignal1D) from hyperspy.misc.eels.tools import eels_constant class DielectricFunction_mixin: _signal_type = "DielectricFunction" _alias_signal_types = ["dielectric function"] def get_number_of_effective_electrons(self, nat, cumulative=False): r"""Compute the number of effective electrons using the Bethe f-sum rule. The Bethe f-sum rule gives rise to two definitions of the effective number (see [Egerton2011]_), neff1 and neff2: .. math:: n_{\mathrm{eff_{1}}} = n_{\mathrm{eff}}\left(-\Im\left(\epsilon^{-1}\right)\right) and: .. math:: n_{\mathrm{eff_{2}}} = n_{\mathrm{eff}}\left(\epsilon_{2}\right) This method computes and return both. Parameters ---------- nat: float Number of atoms (or molecules) per unit volume of the sample. cumulative : bool If False calculate the number of effective electrons up to the higher energy-loss of the spectrum. If True, calculate the number of effective electrons as a function of the energy-loss up to the higher energy-loss of the spectrum. *True is only supported by SciPy newer than 0.13.2*. Returns ------- neff1, neff2: Signal1D Signal1D instances containing neff1 and neff2. The signal and navigation dimensions are the same as the current signal if `cumulative` is True, otherwise the signal dimension is 0 and the navigation dimension is the same as the current signal. Notes ----- .. [Egerton2011] Ray Egerton, "Electron Energy-Loss Spectroscopy in the Electron Microscope", Springer-Verlag, 2011. """ m0 = constants.value("electron mass") epsilon0 = constants.epsilon_0 # Vacuum permittivity [F/m] hbar = constants.hbar # Reduced Plank constant [J·s] k = 2 * epsilon0 * m0 / (np.pi * nat * hbar ** 2) axis = self.axes_manager.signal_axes[0] if cumulative is False: dneff1 = k * simps((-1. / self.data).imag * axis.axis, x=axis.axis, axis=axis.index_in_array) dneff2 = k * simps(self.data.imag * axis.axis, x=axis.axis, axis=axis.index_in_array) neff1 = self._get_navigation_signal(data=dneff1) neff2 = self._get_navigation_signal(data=dneff2) else: neff1 = self._deepcopy_with_new_data( k * cumtrapz((-1. / self.data).imag * axis.axis, x=axis.axis, axis=axis.index_in_array, initial=0)) neff2 = self._deepcopy_with_new_data( k * cumtrapz(self.data.imag * axis.axis, x=axis.axis, axis=axis.index_in_array, initial=0)) # Prepare return neff1.metadata.General.title = ( r"$n_{\mathrm{eff}}\left(-\Im\left(\epsilon^{-1}\right)\right)$ " "calculated from " + self.metadata.General.title + " using the Bethe f-sum rule.") neff2.metadata.General.title = ( r"$n_{\mathrm{eff}}\left(\epsilon_{2}\right)$ " "calculated from " + self.metadata.General.title + " using the Bethe f-sum rule.") return neff1, neff2 def get_electron_energy_loss_spectrum(self, zlp, t): data = ((-1 / self.data).imag * eels_constant(self, zlp, t).data * self.axes_manager.signal_axes[0].scale) s = self._deepcopy_with_new_data(data) s.data = s.data.real s.set_signal_type("EELS") s.metadata.General.title = ("EELS calculated from " + self.metadata.General.title) return s class DielectricFunction(DielectricFunction_mixin, ComplexSignal1D): pass class LazyDielectricFunction(DielectricFunction, LazyComplexSignal1D): pass
gpl-3.0
ClearCorp/odoo-clearcorp
TODO-7.0/hr_contract_name/__openerp__.py
4
1537
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Addons modules by CLEARCORP S.A. # Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## { 'name': 'Employee Contracts Name', 'version': '1.0', 'url': 'http://launchpad.net/openerp-ccorp-addons', 'author': 'ClearCorp S.A.', 'website': 'http://clearcorp.co.cr', 'category': 'Human Resources', 'complexity': 'easy', 'description': """This module adds a sequence to the name. """, 'depends': [ 'hr_contract', ], 'init_xml': [], 'demo_xml': [], 'update_xml': [], 'license': 'AGPL-3', 'installable': True, 'active': False, }
agpl-3.0
mydongistiny/external_chromium_org
tools/telemetry/telemetry/core/backends/chrome/inspector_websocket_unittest.py
26
3829
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import unittest from telemetry.unittest import simple_mock from telemetry.core.backends.chrome import inspector_websocket from telemetry.core.backends.chrome import websocket class FakeSocket(object): """ A fake socket that: + Receives first package of data after 10 second in the first recv(). + Receives second package of data after 10 second in the second recv(). + Raises a websocket.WebSocketTimeoutException after 15 seconds in the third recv(). + Raises a websocket.WebSocketTimeoutException after 15 seconds in the fourth recv(). + Receives third package of data after 10 second in the fifth recv(). + Receives last package of data (containing 'method') after 10 second in the last recv(). """ def __init__(self, mock_timer): self._mock_timer = mock_timer self._recv_counter = 0 def recv(self): self._recv_counter += 1 if self._recv_counter == 1: self._mock_timer.SetTime(10) return '["foo"]' elif self._recv_counter == 2: self._mock_timer.SetTime(20) return '["bar"]' elif self._recv_counter == 3: self._mock_timer.SetTime(35) raise websocket.WebSocketTimeoutException() elif self._recv_counter == 4: self._mock_timer.SetTime(50) raise websocket.WebSocketTimeoutException() elif self._recv_counter == 5: self._mock_timer.SetTime(60) return '["baz"]' elif self._recv_counter == 6: self._mock_timer.SetTime(70) return '["method"]' def settimeout(self, timeout): pass def _ReraiseExceptionErrorHandler(_elapsed_time): raise def _DoNothingExceptionErrorHandler(_elapsed_time): pass class InspectorWebsocketUnittest(unittest.TestCase): def setUp(self): self._mock_timer = simple_mock.MockTimer(inspector_websocket) def tearDown(self): self._mock_timer.Restore() def testDispatchNotificationUntilDoneTimedOutOne(self): inspector = inspector_websocket.InspectorWebsocket( notification_handler=lambda data: True, error_handler=_ReraiseExceptionErrorHandler) inspector._socket = FakeSocket(self._mock_timer) # The third call to socket.recv() will take 15 seconds without any data # received, hence the below call will raise a # DispatchNotificationsUntilDoneTimeoutException. with self.assertRaises( inspector_websocket.DispatchNotificationsUntilDoneTimeoutException): inspector.DispatchNotificationsUntilDone(12) def testDispatchNotificationUntilDoneTimedOutTwo(self): inspector = inspector_websocket.InspectorWebsocket( notification_handler=lambda data: True, error_handler=_DoNothingExceptionErrorHandler) inspector._socket = FakeSocket(self._mock_timer) # The third and forth calls to socket.recv() will take 30 seconds without # any data received, hence the below call will raise a # DispatchNotificationsUntilDoneTimeoutException. with self.assertRaises( inspector_websocket.DispatchNotificationsUntilDoneTimeoutException): inspector.DispatchNotificationsUntilDone(29) def testDispatchNotificationUntilDoneNotTimedOut(self): inspector = inspector_websocket.InspectorWebsocket( notification_handler=lambda data: True, error_handler=_ReraiseExceptionErrorHandler) inspector._socket = FakeSocket(self._mock_timer) # Even though it takes 70 seconds to receive all the data, the call below # will succeed since there are no interval which the previous data package # received and the next failed data receiving attempt was greater than # 30 seconds. inspector.DispatchNotificationsUntilDone(31)
bsd-3-clause
jkyeung/XlsxWriter
xlsxwriter/test/worksheet/test_cond_format14.py
1
4372
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org # import unittest from ...compatibility import StringIO from ..helperfunctions import _xml_to_list from ...worksheet import Worksheet class TestAssembleWorksheet(unittest.TestCase): """ Test assembling a complete Worksheet file. """ def test_assemble_xml_file(self): """Test writing a worksheet with conditional formatting.""" self.maxDiff = None fh = StringIO() worksheet = Worksheet() worksheet._set_filehandle(fh) worksheet.select() worksheet.write('A1', 1) worksheet.write('A2', 2) worksheet.write('A3', 3) worksheet.write('A4', 4) worksheet.write('A5', 5) worksheet.write('A6', 6) worksheet.write('A7', 7) worksheet.write('A8', 8) worksheet.write('A9', 9) worksheet.write('A10', 10) worksheet.write('A11', 11) worksheet.write('A12', 12) worksheet.conditional_format('A1:A12', {'type': 'data_bar'}) worksheet._assemble_xml_file() exp = _xml_to_list(""" <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"> <dimension ref="A1:A12"/> <sheetViews> <sheetView tabSelected="1" workbookViewId="0"/> </sheetViews> <sheetFormatPr defaultRowHeight="15"/> <sheetData> <row r="1" spans="1:1"> <c r="A1"> <v>1</v> </c> </row> <row r="2" spans="1:1"> <c r="A2"> <v>2</v> </c> </row> <row r="3" spans="1:1"> <c r="A3"> <v>3</v> </c> </row> <row r="4" spans="1:1"> <c r="A4"> <v>4</v> </c> </row> <row r="5" spans="1:1"> <c r="A5"> <v>5</v> </c> </row> <row r="6" spans="1:1"> <c r="A6"> <v>6</v> </c> </row> <row r="7" spans="1:1"> <c r="A7"> <v>7</v> </c> </row> <row r="8" spans="1:1"> <c r="A8"> <v>8</v> </c> </row> <row r="9" spans="1:1"> <c r="A9"> <v>9</v> </c> </row> <row r="10" spans="1:1"> <c r="A10"> <v>10</v> </c> </row> <row r="11" spans="1:1"> <c r="A11"> <v>11</v> </c> </row> <row r="12" spans="1:1"> <c r="A12"> <v>12</v> </c> </row> </sheetData> <conditionalFormatting sqref="A1:A12"> <cfRule type="dataBar" priority="1"> <dataBar> <cfvo type="min" val="0"/> <cfvo type="max" val="0"/> <color rgb="FF638EC6"/> </dataBar> </cfRule> </conditionalFormatting> <pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/> </worksheet> """) got = _xml_to_list(fh.getvalue()) self.assertEqual(got, exp)
bsd-2-clause
parthea/pydatalab
legacy_tests/bigquery/query_tests.py
2
6791
# Copyright 2015 Google Inc. 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 __future__ import absolute_import from __future__ import unicode_literals from builtins import str import mock from oauth2client.client import AccessTokenCredentials import unittest import datalab.bigquery import datalab.context class TestCases(unittest.TestCase): @mock.patch('datalab.bigquery._api.Api.tabledata_list') @mock.patch('datalab.bigquery._api.Api.jobs_insert_query') @mock.patch('datalab.bigquery._api.Api.jobs_query_results') @mock.patch('datalab.bigquery._api.Api.jobs_get') @mock.patch('datalab.bigquery._api.Api.tables_get') def test_single_result_query(self, mock_api_tables_get, mock_api_jobs_get, mock_api_jobs_query_results, mock_api_insert_query, mock_api_tabledata_list): mock_api_tables_get.return_value = TestCases._create_tables_get_result() mock_api_jobs_get.return_value = {'status': {'state': 'DONE'}} mock_api_jobs_query_results.return_value = {'jobComplete': True} mock_api_insert_query.return_value = TestCases._create_insert_done_result() mock_api_tabledata_list.return_value = TestCases._create_single_row_result() sql = 'SELECT field1 FROM [table] LIMIT 1' q = TestCases._create_query(sql) results = q.results() self.assertEqual(sql, results.sql) self.assertEqual('(%s)' % sql, q._repr_sql_()) self.assertEqual(sql, str(q)) self.assertEqual(1, results.length) first_result = results[0] self.assertEqual('value1', first_result['field1']) @mock.patch('datalab.bigquery._api.Api.jobs_insert_query') @mock.patch('datalab.bigquery._api.Api.jobs_query_results') @mock.patch('datalab.bigquery._api.Api.jobs_get') @mock.patch('datalab.bigquery._api.Api.tables_get') def test_empty_result_query(self, mock_api_tables_get, mock_api_jobs_get, mock_api_jobs_query_results, mock_api_insert_query): mock_api_tables_get.return_value = TestCases._create_tables_get_result(0) mock_api_jobs_get.return_value = {'status': {'state': 'DONE'}} mock_api_jobs_query_results.return_value = {'jobComplete': True} mock_api_insert_query.return_value = TestCases._create_insert_done_result() q = TestCases._create_query() results = q.results() self.assertEqual(0, results.length) @mock.patch('datalab.bigquery._api.Api.jobs_insert_query') @mock.patch('datalab.bigquery._api.Api.jobs_query_results') @mock.patch('datalab.bigquery._api.Api.jobs_get') @mock.patch('datalab.bigquery._api.Api.tables_get') def test_incomplete_result_query(self, mock_api_tables_get, mock_api_jobs_get, mock_api_jobs_query_results, mock_api_insert_query): mock_api_tables_get.return_value = TestCases._create_tables_get_result() mock_api_jobs_get.return_value = {'status': {'state': 'DONE'}} mock_api_jobs_query_results.return_value = {'jobComplete': True} mock_api_insert_query.return_value = TestCases._create_incomplete_result() q = TestCases._create_query() results = q.results() self.assertEqual(1, results.length) self.assertEqual('test_job', results.job_id) @mock.patch('datalab.bigquery._api.Api.jobs_insert_query') def test_malformed_response_raises_exception(self, mock_api_insert_query): mock_api_insert_query.return_value = {} q = TestCases._create_query() with self.assertRaises(Exception) as error: q.results() self.assertEqual('Unexpected response from server', str(error.exception)) def test_udf_expansion(self): sql = 'SELECT * FROM udf(source)' udf = datalab.bigquery.UDF('inputs', [('foo', 'string'), ('bar', 'integer')], 'udf', 'code') context = TestCases._create_context() query = datalab.bigquery.Query(sql, udf=udf, context=context) self.assertEquals('SELECT * FROM (SELECT foo, bar FROM udf(source))', query.sql) # Alternate form query = datalab.bigquery.Query(sql, udfs=[udf], context=context) self.assertEquals('SELECT * FROM (SELECT foo, bar FROM udf(source))', query.sql) @staticmethod def _create_query(sql=None): if sql is None: sql = 'SELECT * ...' return datalab.bigquery.Query(sql, context=TestCases._create_context()) @staticmethod def _create_context(): project_id = 'test' creds = AccessTokenCredentials('test_token', 'test_ua') return datalab.context.Context(project_id, creds) @staticmethod def _create_insert_done_result(): # pylint: disable=g-continuation-in-parens-misaligned return { 'jobReference': { 'jobId': 'test_job' }, 'configuration': { 'query': { 'destinationTable': { 'projectId': 'project', 'datasetId': 'dataset', 'tableId': 'table' } } }, 'jobComplete': True, } @staticmethod def _create_single_row_result(): # pylint: disable=g-continuation-in-parens-misaligned return { 'totalRows': 1, 'rows': [ {'f': [{'v': 'value1'}]} ] } @staticmethod def _create_empty_result(): # pylint: disable=g-continuation-in-parens-misaligned return { 'totalRows': 0 } @staticmethod def _create_incomplete_result(): # pylint: disable=g-continuation-in-parens-misaligned return { 'jobReference': { 'jobId': 'test_job' }, 'configuration': { 'query': { 'destinationTable': { 'projectId': 'project', 'datasetId': 'dataset', 'tableId': 'table' } } }, 'jobComplete': False } @staticmethod def _create_page_result(page_token=None): # pylint: disable=g-continuation-in-parens-misaligned return { 'totalRows': 2, 'rows': [ {'f': [{'v': 'value1'}]} ], 'pageToken': page_token } @staticmethod def _create_tables_get_result(num_rows=1, schema=None): if schema is None: schema = [{'name': 'field1', 'type': 'string'}] return { 'numRows': num_rows, 'schema': { 'fields': schema }, }
apache-2.0
jakevdp/scipy
scipy/_lib/tests/test__gcutils.py
109
2804
""" Test for assert_deallocated context manager and gc utilities """ import gc from scipy._lib._gcutils import set_gc_state, gc_state, assert_deallocated, ReferenceError from nose.tools import assert_equal, raises def test_set_gc_state(): gc_status = gc.isenabled() try: for state in (True, False): gc.enable() set_gc_state(state) assert_equal(gc.isenabled(), state) gc.disable() set_gc_state(state) assert_equal(gc.isenabled(), state) finally: if gc_status: gc.enable() def test_gc_state(): # Test gc_state context manager gc_status = gc.isenabled() try: for pre_state in (True, False): set_gc_state(pre_state) for with_state in (True, False): # Check the gc state is with_state in with block with gc_state(with_state): assert_equal(gc.isenabled(), with_state) # And returns to previous state outside block assert_equal(gc.isenabled(), pre_state) # Even if the gc state is set explicitly within the block with gc_state(with_state): assert_equal(gc.isenabled(), with_state) set_gc_state(not with_state) assert_equal(gc.isenabled(), pre_state) finally: if gc_status: gc.enable() def test_assert_deallocated(): # Ordinary use class C(object): def __init__(self, arg0, arg1, name='myname'): self.name = name for gc_current in (True, False): with gc_state(gc_current): # We are deleting from with-block context, so that's OK with assert_deallocated(C, 0, 2, 'another name') as c: assert_equal(c.name, 'another name') del c # Or not using the thing in with-block context, also OK with assert_deallocated(C, 0, 2, name='third name'): pass assert_equal(gc.isenabled(), gc_current) @raises(ReferenceError) def test_assert_deallocated_nodel(): class C(object): pass # Need to delete after using if in with-block context with assert_deallocated(C) as c: pass @raises(ReferenceError) def test_assert_deallocated_circular(): class C(object): def __init__(self): self._circular = self # Circular reference, no automatic garbage collection with assert_deallocated(C) as c: del c @raises(ReferenceError) def test_assert_deallocated_circular2(): class C(object): def __init__(self): self._circular = self # Still circular reference, no automatic garbage collection with assert_deallocated(C): pass
bsd-3-clause
Lucidiot/PseudoScience
pseudosci/tests/test_relativity.py
1
2368
#!/usr/bin/env python # -*- coding:utf-8 -*- from ..units.general import Velocity, Time, Distance from ..data.constants import LIGHT_VELOCITY from ..movement import Movement from ..relativity import contraction_factor, lorentz_factor, time_dilation, \ length_contraction, RelativistMovement import pytest class TestRelativity: """Tests du module pseudosci.relativity""" def test_contraction_factor(self): """Test de contraction_factor(vel)""" assert contraction_factor(Velocity(mps=0)) == 1.0 assert round(contraction_factor(LIGHT_VELOCITY / 10), 3) == 0.995 assert round(contraction_factor(LIGHT_VELOCITY / 2), 3) == 0.866 def test_lorentz_factor(self): """Test de lorentz_factor(vel)""" assert lorentz_factor(Velocity(mps=0)) == 1.0 assert round(lorentz_factor(LIGHT_VELOCITY / 10), 3) == 1.005 assert round(lorentz_factor(LIGHT_VELOCITY / 2), 3) == 1.155 def test_time_dilation(self): """Test de time_dilation(time, vel)""" t = Time(s=1) assert time_dilation(t, Velocity(mps=0)).s == 1.0 assert round(time_dilation(t, LIGHT_VELOCITY / 10).s, 3) == 1.005 assert round(time_dilation(t, LIGHT_VELOCITY / 2).s, 3) == 1.155 def test_length_contraction(self): """Test de length_contraction(distance, vel)""" d = Distance(m=1) assert length_contraction(d, Velocity(mps=0)).m == 1.0 assert round(length_contraction(d, LIGHT_VELOCITY / 10).m, 3) == 0.995 assert round(length_contraction(d, LIGHT_VELOCITY / 2).m, 3) == 0.866 def test_relativist_movement(self): """Test de la classe RelativistMovement""" assert issubclass(RelativistMovement, Movement) m = Movement(distance=Distance(m=1), velocity=LIGHT_VELOCITY / 2) rm = RelativistMovement(m) assert rm.movement == m assert rm.properdistance == m.distance assert rm.propertime == m.time assert rm.velocity == m.velocity assert round(rm.contraction_factor, 3) == 0.866 assert round(rm.lorentz_factor, 3) == 1.155 assert round(rm.time.s, 9) == round((rm.propertime * rm.lorentz).s, 9) assert round(rm.distance.m, 9) == \ round((rm.properdistance * rm.contraction).m, 9) with pytest.raises(AttributeError): rm.pouet
gpl-3.0
mhoffman/catmap
catmap/parsers/table_parser.py
3
18012
import numpy as np import catmap from .parser_base import * string2symbols = catmap.string2symbols Template = catmap.Template class TableParser(ParserBase): """Parses attributes based on column headers and filters. Additional functionality may be added by inheriting and defining the parse_{header_name} function where header_name is the column header for the additional variable to be parsed. """ def __init__(self,reaction_model=None,**kwargs): ParserBase.__init__(self,reaction_model) defaults = dict( estimate_frequencies = 1, #Use frequencies from different sites #if available (set variable to 1 or True). #Use dissociated state frequencies for TS (set to 2) #If no frequencies are available from other sites then #concatenate frequencies from #individual atoms (set to 3). #If no frequencies can be found, use empty frequency set #(set to >3) frequency_surface_names = [], #Use frequencies from a specific #surface_name only. If "None" or empty then an average of #the frequencies from all available surfaces will be used. required_headers = ['species_name','surface_name','site_name' ,'formation_energy','frequencies', 'reference'], parse_headers = ['formation_energy','frequencies'], frequency_unit_conversion = 1.239842e-4, # conversion factor to coverage_headers = ['coverage','coadsorbate_coverage'], #go from input units to eV standard_coverage = 'min', standard_coadsorbate_coverage = 'min', #coverage to use as the "base" in coverage-dependent input file #use "min" to take the minimum or specify explicitly interaction_surface_names = None, #use a different set of (more) surfaces to form interaction matrix. #If none then only the surfaces in the model will be used. ) self._linebreak = '\n' self._separator = '\t' self._rxm.update(kwargs,override=True) self._rxm.update(defaults,override=False) self._required = {'input_file':str,'estimate_frequencies':bool, 'required_headers':list, 'parse_headers':list, 'frequency_unit_conversion':float, 'frequency_surface_names':None} def parse(self,**kwargs): f = open(self.input_file) lines = f.read().split(self._linebreak) lines = [L for L in lines if L] f.close() self._baseparse() headers = lines.pop(0).split(self._separator) headers = [h.strip() for h in headers] if not set(self.required_headers).issubset(set(headers)): raise ValueError('Required headers are missing! '+\ 'Please be sure that all headers '+\ 'are specified: '+' '.join(self.required_headers)) linedicts = [] for L in lines: linedict = {} for k, v in zip(headers, L.split(self._separator, len(headers))): linedict[k] = v if len(linedict) != len(headers): print("Input line " + str(linedict) + " does not have all required fields. Ignoring.") continue sites = [s for s in self.species_definitions if self.species_definitions[s].get('type',None) == 'site' and linedict['site_name'] in self.species_definitions[s]['site_names'] and '*' not in s] if not sites: sites = ['?'] adskey = [linedict['species_name']+'_'+site_i for site_i in sites] linedict['species_keys'] = adskey linedicts.append(linedict) self._line_dicts = linedicts self._headers = headers for p in self.parse_headers: if callable(getattr(self,'parse_'+p)): getattr(self,'parse_'+p)() else: raise AttributeError('No parsing function defined for '+p) def parse_formation_energy(self,**kwargs): "Parse in basic info for reaction model" self.__dict__.update(kwargs) all_ads = [k for k in self.species_definitions.keys() if self.species_definitions[k].get('type',None) != 'site'] for adsdef in all_ads: if adsdef in ['ele_g', 'H_g', 'OH_g']: continue # Ignore electrochemical species that should not be manually defined. ads = self.species_definitions[adsdef].get('name',None) if ads is None: del self.species_definitions[adsdef] print('Warning: Species with undefined "name" was encountered ('+adsdef+'). '+\ 'Ensure that all species which are explicitly set in "species_definitions" '+\ 'are also defined in the reaction network ("rxn_expressions"). This definition '+\ 'will be ignored.') else: site = self.species_definitions[adsdef]['site'] alternative_names = self.species_definitions[adsdef].get( 'alternative_names',[]) adsnames = [ads]+alternative_names sites = self.species_definitions[site]['site_names'] infodict = {} for linedict in self._line_dicts: if ( linedict['species_name'] in adsnames and linedict['site_name'] in sites and linedict['surface_name'] in list(self.surface_names)+['None'] ): #The following clause ensures that the low-coverage limit #is used unless otherwise specified. #It should probably be abstracted out into something cleaner. pass_dict = {} surf = linedict['surface_name'] for cvg_key in ['coverage','coadsorbate_coverage']: pass_dict[cvg_key] = True if cvg_key in linedict: standard_cvg = getattr(self,'standard_'+cvg_key, None) if standard_cvg in ['min','minimum',None]: if surf in infodict: if linedict[cvg_key] > infodict[surf][cvg_key]: pass_dict[cvg_key] = False else: if linedict[cvg_key] != standard_cvg: pass_dict[cvg_key] = False if False not in pass_dict.values(): infodict[surf] = linedict paramlist = [] sources = [] if self.species_definitions[adsdef]['type'] not in ['gas']: for surf in self.surface_names: if surf in infodict: E = float(infodict[surf]['formation_energy']) paramlist.append(E) sources.append(infodict[surf]['reference'].strip()) else: paramlist.append(None) self.species_definitions[adsdef]['formation_energy'] = paramlist self.species_definitions[adsdef]['formation_energy_source'] = sources else: if 'None' in infodict: E = float(infodict['None']['formation_energy']) self.species_definitions[adsdef]['formation_energy'] = E self.species_definitions[adsdef]['formation_energy_source'] = \ infodict['None']['reference'].strip() else: raise ValueError('No formation energy found for '+str(adsdef)+'. Check input file.') def parse_frequencies(self,**kwargs): self.__dict__.update(kwargs) allfreqdict = {} frequency_dict = {} #Parse in all available frequencies for linedict in self._line_dicts: if eval(linedict['frequencies']): freqs = eval(linedict['frequencies']) freqs = [self.frequency_unit_conversion*f for f in freqs] if linedict['species_name'] not in allfreqdict: allfreqdict[linedict['species_name']] = \ [[linedict['surface_name'], linedict['site_name'], freqs]] #Store frequency info for parsing later else: frq = [linedict['surface_name'], linedict['site_name'], freqs] if frq not in allfreqdict[linedict['species_name']]: allfreqdict[linedict['species_name']].append(frq) def freq_handler(freqdict_entry,site,ads): """ Returns a single list of frequencies from a freqdict_entry, which is a list of all frequency data for a given species. Entries matching both site and surface (if specified in self.frequency_surface_names) are preferred over those that only match surface. If more than match of the highest validity is found, the mean of those frequencies is returned. """ perfect_matches = [] partial_matches = [] if self.frequency_surface_names is None: self.frequency_surface_names = [] for entry in freqdict_entry: masked = [entry[0] in self.frequency_surface_names, entry[1] in self.species_definitions.get(site,{'site_names':[]})['site_names'], entry[2]] if not self.frequency_surface_names: if site in self._gas_sites and entry[0] == 'None': masked[0] = True elif site not in self._gas_sites: masked[0] = True else: if site in self._gas_sites and entry[0] == 'None': masked[0] = True if all(masked): perfect_matches.append(masked[-1]) elif masked[0] and site not in self._gas_sites: #Surface matches but site might not... if entry[1] != 'gas': #HACK... this whole function needs to be cleaned up. partial_matches.append(masked[-1]) def match_handler(perfect_matches): if len(perfect_matches) == 1: return perfect_matches[0] elif len(perfect_matches) > 1: if len(set([len(pm) for pm in perfect_matches]))>1: raise ValueError('Frequency vectors have different '+\ 'lengths for '+ str(ads)) matcharray = np.array(perfect_matches) freqout = matcharray.mean(0) #average valid frequencies return list(freqout) else: #No valid frequencies are found... return [] if len(perfect_matches) > 0: return match_handler(perfect_matches) elif self.estimate_frequencies: return match_handler(partial_matches) else: return [] all_ads = [k for k in self.species_definitions.keys() if self.species_definitions[k]['type'] != 'site'] for adsdef in all_ads+list(allfreqdict.keys()): #format all freqs if '_' in adsdef: adsname,site = adsdef.split('_') elif adsdef in list(allfreqdict.keys()): adsname = adsdef site = self._default_site if adsname in allfreqdict: frequency_dict[adsdef] = freq_handler(allfreqdict[adsname],site ,adsname) elif self.estimate_frequencies > 3: frequency_dict[adsdef] = [] for adsdef in all_ads: adsname,site = [self.species_definitions[adsdef][k] for k in ['name','site']] #Use single-atom frequencies... if ( not frequency_dict.get(adsdef,None) and self.estimate_frequencies > 2 and '-' not in adsname #Don't include TS's ): symbols = string2symbols(adsname) freqs = [] if set(symbols).issubset(set(frequency_dict.keys())): for s in symbols: freqs += frequency_dict[s] frequency_dict[adsdef] = freqs for adsdef in all_ads: #Use dissosciated TS frequencies adsname,site = [self.species_definitions[adsdef][k] for k in ['name','site']] if ( not frequency_dict.get(adsdef,None) and self.estimate_frequencies > 1 and '-' in adsname ): A,B = adsname.split('-') frequency_dict[adsdef] = frequency_dict[A] + frequency_dict[B] for key in self.species_definitions.keys(): self.species_definitions[key]['frequencies'] = frequency_dict.get(key,[]) def parse_coverage(self,**kwargs): self.__dict__.update(kwargs) n = len(self.adsorbate_names) surfaces = self.surface_names info_dict = {} ads_names = self.adsorbate_names+self.transition_state_names for surf in surfaces: cvg_dict = {} for linedict in self._line_dicts: for skey in linedict['species_keys']: if (skey in self.adsorbate_names+self.transition_state_names and linedict['surface_name'] == surf): ads = skey if 'delta_theta' in linedict: self.species_definitions[ads]['delta_theta'] = float( linedict['delta_theta']) theta_vec = [0]*len(ads_names) idx_i = ads_names.index(ads) theta_i = float(linedict['coverage']) theta_vec[idx_i] += theta_i for coads_name in ['coadsorbate','coadsorbate2']: #could add coadsorbate3, coadsorbate4,... as needed if coads_name+'_name' in linedict: if linedict[coads_name+'_name'] != 'None': coads = linedict[coads_name+'_name'] site = ads.split('_')[-1] site = linedict.get(coads_name+'_site',site) coads += '_'+site #assume coads on same site as ads if not specified theta_j = float(linedict[coads_name+'_coverage']) if coads in ads_names: idx_j = ads_names.index(coads) theta_vec[idx_j] += theta_j else: names_only = [n.split('_')[0] for n in ads_names] coads_name = coads.split('_')[0] if coads_name not in names_only: print(('Warning: Could not find co-adsorbed species ' '{coads:s} (adsorbate {ads:s}). Ignoring this entry.').format(coads=coads,ads=ads)) else: idx_j = names_only.index(coads_name) actual_ads = ads_names[idx_j] print(('Warning: Could not find co-adsorbed species ' '{coads:s} (adsorbate {ads:s}). Using {actual_ads:s}.').format(coads=coads, ads=ads, actual_ads=actual_ads)) theta_vec[idx_j] += theta_j E_diff = float(linedict['formation_energy']) E_int = linedict.get('integral_formation_energy',None) if E_int: E_int = float(E_int) theta_E = [theta_vec, E_diff,E_int] if ads in cvg_dict: cvg_dict[ads].append(theta_E) else: cvg_dict[ads] = [theta_E] info_dict[surf] = cvg_dict for i_ads,ads in enumerate(self.adsorbate_names+self.transition_state_names): cvg_dep_E = [None]*len(surfaces) for surf in surfaces: cvgs = info_dict[surf].get(ads,None) if cvgs is None: pass else: cvg_dep_E[self.surface_names.index(surf)] = cvgs self.species_definitions[ads]['coverage_dependent_energy'] = cvg_dep_E
gpl-3.0
kcompher/BuildingMachineLearningSystemsWithPython
ch08/stacked.py
4
1057
# This code is supporting material for the book # Building Machine Learning Systems with Python # by Willi Richert and Luis Pedro Coelho # published by PACKT Publishing # # It is made available under the MIT License from __future__ import print_function from sklearn.linear_model import LinearRegression from load_ml100k import load import numpy as np import similar_movie import usermodel import corrneighbours reviews = load() reg = LinearRegression() es = np.array([ usermodel.all_estimates(reviews), corrneighbours.all_estimates(reviews), similar_movies.all_estimates(reviews), ]) reviews = reviews.toarray() total_error = 0.0 coefficients = [] for u in xrange(reviews.shape[0]): es0 = np.delete(es, u, 1) r0 = np.delete(reviews, u, 0) X, Y = np.where(r0 > 0) X = es[:, X, Y] y = r0[r0 > 0] reg.fit(X.T, y) coefficients.append(reg.coef_) r0 = reviews[u] X = np.where(r0 > 0) p0 = reg.predict(es[:, u, X].squeeze().T) err0 = r0[r0 > 0] - p0 total_error += np.dot(err0, err0) print(u)
mit
ibigbug/shadowsocks
shadowsocks/crypto/table.py
1044
8108
# !/usr/bin/env python # # Copyright 2015 clowwindy # # 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 __future__ import absolute_import, division, print_function, \ with_statement import string import struct import hashlib __all__ = ['ciphers'] cached_tables = {} if hasattr(string, 'maketrans'): maketrans = string.maketrans translate = string.translate else: maketrans = bytes.maketrans translate = bytes.translate def get_table(key): m = hashlib.md5() m.update(key) s = m.digest() a, b = struct.unpack('<QQ', s) table = maketrans(b'', b'') table = [table[i: i + 1] for i in range(len(table))] for i in range(1, 1024): table.sort(key=lambda x: int(a % (ord(x) + i))) return table def init_table(key): if key not in cached_tables: encrypt_table = b''.join(get_table(key)) decrypt_table = maketrans(encrypt_table, maketrans(b'', b'')) cached_tables[key] = [encrypt_table, decrypt_table] return cached_tables[key] class TableCipher(object): def __init__(self, cipher_name, key, iv, op): self._encrypt_table, self._decrypt_table = init_table(key) self._op = op def update(self, data): if self._op: return translate(data, self._encrypt_table) else: return translate(data, self._decrypt_table) ciphers = { 'table': (0, 0, TableCipher) } def test_table_result(): from shadowsocks.common import ord target1 = [ [60, 53, 84, 138, 217, 94, 88, 23, 39, 242, 219, 35, 12, 157, 165, 181, 255, 143, 83, 247, 162, 16, 31, 209, 190, 171, 115, 65, 38, 41, 21, 245, 236, 46, 121, 62, 166, 233, 44, 154, 153, 145, 230, 49, 128, 216, 173, 29, 241, 119, 64, 229, 194, 103, 131, 110, 26, 197, 218, 59, 204, 56, 27, 34, 141, 221, 149, 239, 192, 195, 24, 155, 170, 183, 11, 254, 213, 37, 137, 226, 75, 203, 55, 19, 72, 248, 22, 129, 33, 175, 178, 10, 198, 71, 77, 36, 113, 167, 48, 2, 117, 140, 142, 66, 199, 232, 243, 32, 123, 54, 51, 82, 57, 177, 87, 251, 150, 196, 133, 5, 253, 130, 8, 184, 14, 152, 231, 3, 186, 159, 76, 89, 228, 205, 156, 96, 163, 146, 18, 91, 132, 85, 80, 109, 172, 176, 105, 13, 50, 235, 127, 0, 189, 95, 98, 136, 250, 200, 108, 179, 211, 214, 106, 168, 78, 79, 74, 210, 30, 73, 201, 151, 208, 114, 101, 174, 92, 52, 120, 240, 15, 169, 220, 182, 81, 224, 43, 185, 40, 99, 180, 17, 212, 158, 42, 90, 9, 191, 45, 6, 25, 4, 222, 67, 126, 1, 116, 124, 206, 69, 61, 7, 68, 97, 202, 63, 244, 20, 28, 58, 93, 134, 104, 144, 227, 147, 102, 118, 135, 148, 47, 238, 86, 112, 122, 70, 107, 215, 100, 139, 223, 225, 164, 237, 111, 125, 207, 160, 187, 246, 234, 161, 188, 193, 249, 252], [151, 205, 99, 127, 201, 119, 199, 211, 122, 196, 91, 74, 12, 147, 124, 180, 21, 191, 138, 83, 217, 30, 86, 7, 70, 200, 56, 62, 218, 47, 168, 22, 107, 88, 63, 11, 95, 77, 28, 8, 188, 29, 194, 186, 38, 198, 33, 230, 98, 43, 148, 110, 177, 1, 109, 82, 61, 112, 219, 59, 0, 210, 35, 215, 50, 27, 103, 203, 212, 209, 235, 93, 84, 169, 166, 80, 130, 94, 164, 165, 142, 184, 111, 18, 2, 141, 232, 114, 6, 131, 195, 139, 176, 220, 5, 153, 135, 213, 154, 189, 238, 174, 226, 53, 222, 146, 162, 236, 158, 143, 55, 244, 233, 96, 173, 26, 206, 100, 227, 49, 178, 34, 234, 108, 207, 245, 204, 150, 44, 87, 121, 54, 140, 118, 221, 228, 155, 78, 3, 239, 101, 64, 102, 17, 223, 41, 137, 225, 229, 66, 116, 171, 125, 40, 39, 71, 134, 13, 193, 129, 247, 251, 20, 136, 242, 14, 36, 97, 163, 181, 72, 25, 144, 46, 175, 89, 145, 113, 90, 159, 190, 15, 183, 73, 123, 187, 128, 248, 252, 152, 24, 197, 68, 253, 52, 69, 117, 57, 92, 104, 157, 170, 214, 81, 60, 133, 208, 246, 172, 23, 167, 160, 192, 76, 161, 237, 45, 4, 58, 10, 182, 65, 202, 240, 185, 241, 79, 224, 132, 51, 42, 126, 105, 37, 250, 149, 32, 243, 231, 67, 179, 48, 9, 106, 216, 31, 249, 19, 85, 254, 156, 115, 255, 120, 75, 16]] target2 = [ [124, 30, 170, 247, 27, 127, 224, 59, 13, 22, 196, 76, 72, 154, 32, 209, 4, 2, 131, 62, 101, 51, 230, 9, 166, 11, 99, 80, 208, 112, 36, 248, 81, 102, 130, 88, 218, 38, 168, 15, 241, 228, 167, 117, 158, 41, 10, 180, 194, 50, 204, 243, 246, 251, 29, 198, 219, 210, 195, 21, 54, 91, 203, 221, 70, 57, 183, 17, 147, 49, 133, 65, 77, 55, 202, 122, 162, 169, 188, 200, 190, 125, 63, 244, 96, 31, 107, 106, 74, 143, 116, 148, 78, 46, 1, 137, 150, 110, 181, 56, 95, 139, 58, 3, 231, 66, 165, 142, 242, 43, 192, 157, 89, 175, 109, 220, 128, 0, 178, 42, 255, 20, 214, 185, 83, 160, 253, 7, 23, 92, 111, 153, 26, 226, 33, 176, 144, 18, 216, 212, 28, 151, 71, 206, 222, 182, 8, 174, 205, 201, 152, 240, 155, 108, 223, 104, 239, 98, 164, 211, 184, 34, 193, 14, 114, 187, 40, 254, 12, 67, 93, 217, 6, 94, 16, 19, 82, 86, 245, 24, 197, 134, 132, 138, 229, 121, 5, 235, 238, 85, 47, 103, 113, 179, 69, 250, 45, 135, 156, 25, 61, 75, 44, 146, 189, 84, 207, 172, 119, 53, 123, 186, 120, 171, 68, 227, 145, 136, 100, 90, 48, 79, 159, 149, 39, 213, 236, 126, 52, 60, 225, 199, 105, 73, 233, 252, 118, 215, 35, 115, 64, 37, 97, 129, 161, 177, 87, 237, 141, 173, 191, 163, 140, 234, 232, 249], [117, 94, 17, 103, 16, 186, 172, 127, 146, 23, 46, 25, 168, 8, 163, 39, 174, 67, 137, 175, 121, 59, 9, 128, 179, 199, 132, 4, 140, 54, 1, 85, 14, 134, 161, 238, 30, 241, 37, 224, 166, 45, 119, 109, 202, 196, 93, 190, 220, 69, 49, 21, 228, 209, 60, 73, 99, 65, 102, 7, 229, 200, 19, 82, 240, 71, 105, 169, 214, 194, 64, 142, 12, 233, 88, 201, 11, 72, 92, 221, 27, 32, 176, 124, 205, 189, 177, 246, 35, 112, 219, 61, 129, 170, 173, 100, 84, 242, 157, 26, 218, 20, 33, 191, 155, 232, 87, 86, 153, 114, 97, 130, 29, 192, 164, 239, 90, 43, 236, 208, 212, 185, 75, 210, 0, 81, 227, 5, 116, 243, 34, 18, 182, 70, 181, 197, 217, 95, 183, 101, 252, 248, 107, 89, 136, 216, 203, 68, 91, 223, 96, 141, 150, 131, 13, 152, 198, 111, 44, 222, 125, 244, 76, 251, 158, 106, 24, 42, 38, 77, 2, 213, 207, 249, 147, 113, 135, 245, 118, 193, 47, 98, 145, 66, 160, 123, 211, 165, 78, 204, 80, 250, 110, 162, 48, 58, 10, 180, 55, 231, 79, 149, 74, 62, 50, 148, 143, 206, 28, 15, 57, 159, 139, 225, 122, 237, 138, 171, 36, 56, 115, 63, 144, 154, 6, 230, 133, 215, 41, 184, 22, 104, 254, 234, 253, 187, 226, 247, 188, 156, 151, 40, 108, 51, 83, 178, 52, 3, 31, 255, 195, 53, 235, 126, 167, 120]] encrypt_table = b''.join(get_table(b'foobar!')) decrypt_table = maketrans(encrypt_table, maketrans(b'', b'')) for i in range(0, 256): assert (target1[0][i] == ord(encrypt_table[i])) assert (target1[1][i] == ord(decrypt_table[i])) encrypt_table = b''.join(get_table(b'barfoo!')) decrypt_table = maketrans(encrypt_table, maketrans(b'', b'')) for i in range(0, 256): assert (target2[0][i] == ord(encrypt_table[i])) assert (target2[1][i] == ord(decrypt_table[i])) def test_encryption(): from shadowsocks.crypto import util cipher = TableCipher('table', b'test', b'', 1) decipher = TableCipher('table', b'test', b'', 0) util.run_cipher(cipher, decipher) if __name__ == '__main__': test_table_result() test_encryption()
apache-2.0
ahmadio/edx-platform
lms/djangoapps/course_wiki/plugins/markdownedx/mdx_image.py
151
2077
#!/usr/bin/env python ''' Image Embedding Extension for Python-Markdown ====================================== Converts lone links to embedded images, provided the file extension is allowed. Ex: http://www.ericfehse.net/media/img/ef/blog/django-pony.jpg becomes <img src="http://www.ericfehse.net/media/img/ef/blog/django-pony.jpg"> mypic.jpg becomes <img src="/MEDIA_PATH/mypic.jpg"> Requires Python-Markdown 1.6+ ''' import simplewiki.settings as settings import markdown try: # Markdown 2.1.0 changed from 2.0.3. We try importing the new version first, # but import the 2.0.3 version if it fails from markdown.util import etree except: from markdown import etree class ImageExtension(markdown.Extension): def __init__(self, configs): for key, value in configs: self.setConfig(key, value) def add_inline(self, md, name, klass, re): pattern = klass(re) pattern.md = md pattern.ext = self md.inlinePatterns.add(name, pattern, "<reference") def extendMarkdown(self, md, md_globals): self.add_inline(md, 'image', ImageLink, r'^(?P<proto>([^:/?#])+://)?(?P<domain>([^/?#]*)/)?(?P<path>[^?#]*\.(?P<ext>[^?#]{3,4}))(?:\?([^#]*))?(?:#(.*))?$') class ImageLink(markdown.inlinepatterns.Pattern): def handleMatch(self, m): img = etree.Element('img') proto = m.group('proto') or "http://" domain = m.group('domain') path = m.group('path') ext = m.group('ext') # A fixer upper if ext.lower() in settings.WIKI_IMAGE_EXTENSIONS: if domain: src = proto + domain + path elif path: # We need a nice way to source local attachments... src = "/wiki/media/" + path + ".upload" else: src = '' img.set('src', src) return img def makeExtension(configs=None): return ImageExtension(configs=configs) if __name__ == "__main__": import doctest doctest.testmod()
agpl-3.0
rturumella/CloudBot
plugins/google_translate.py
25
3804
import requests from cloudbot import hook max_length = 100 def goog_trans(api_key, text, source, target): url = 'https://www.googleapis.com/language/translate/v2' if len(text) > max_length: return "This command only supports input of less then 100 characters." params = { 'q': text, 'key': api_key, 'target': target, 'format': 'text' } if source: params['source'] = source request = requests.get(url, params=params) parsed = request.json() if parsed.get('error'): if parsed['error']['code'] == 403: return "The Translate API is off in the Google Developers Console." else: return "Google API error." if not source: return '(%(detectedSourceLanguage)s) %(translatedText)s' % (parsed['data']['translations'][0]) return '%(translatedText)s' % parsed['data']['translations'][0] def match_language(fragment): fragment = fragment.lower() for short, _ in lang_pairs: if fragment in short.lower().split(): return short.split()[0] for short, full in lang_pairs: if fragment in full.lower(): return short.split()[0] return None @hook.command() def translate(text, bot): """[source language [target language]] <sentence> - translates <sentence> from source language (default autodetect) to target language (default English) using Google Translate""" api_key = bot.config.get("api_keys", {}).get("google_dev_key", None) if not api_key: return "This command requires a Google Developers Console API key." args = text.split(' ', 2) try: if len(args) >= 2: sl = match_language(args[0]) if not sl: return goog_trans(api_key, text, '', 'en') if len(args) == 2: return goog_trans(api_key, args[1], sl, 'en') if len(args) >= 3: tl = match_language(args[1]) if not tl: if sl == 'en': return 'unable to determine desired target language' return goog_trans(api_key, args[1] + ' ' + args[2], sl, 'en') return goog_trans(api_key, args[2], sl, tl) return goog_trans(api_key, text, '', 'en') except IOError as e: return e lang_pairs = [ ("no", "Norwegian"), ("it", "Italian"), ("ht", "Haitian Creole"), ("af", "Afrikaans"), ("sq", "Albanian"), ("ar", "Arabic"), ("hy", "Armenian"), ("az", "Azerbaijani"), ("eu", "Basque"), ("be", "Belarusian"), ("bg", "Bulgarian"), ("ca", "Catalan"), ("zh-CN zh", "Chinese"), ("hr", "Croatian"), ("cs", "Czech"), ("da", "Danish"), ("nl", "Dutch"), ("en", "English"), ("et", "Estonian"), ("tl", "Filipino"), ("fi", "Finnish"), ("fr", "French"), ("gl", "Galician"), ("ka", "Georgian"), ("de", "German"), ("el", "Greek"), ("ht", "Haitian Creole"), ("iw", "Hebrew"), ("hi", "Hindi"), ("hu", "Hungarian"), ("is", "Icelandic"), ("id", "Indonesian"), ("ga", "Irish"), ("it", "Italian"), ("ja jp jpn", "Japanese"), ("ko", "Korean"), ("lv", "Latvian"), ("lt", "Lithuanian"), ("mk", "Macedonian"), ("ms", "Malay"), ("mt", "Maltese"), ("no", "Norwegian"), ("fa", "Persian"), ("pl", "Polish"), ("pt", "Portuguese"), ("ro", "Romanian"), ("ru", "Russian"), ("sr", "Serbian"), ("sk", "Slovak"), ("sl", "Slovenian"), ("es", "Spanish"), ("sw", "Swahili"), ("sv", "Swedish"), ("th", "Thai"), ("tr", "Turkish"), ("uk", "Ukrainian"), ("ur", "Urdu"), ("vi", "Vietnamese"), ("cy", "Welsh"), ("yi", "Yiddish") ]
gpl-3.0
sunlianqiang/kbengine
kbe/res/scripts/common/Lib/encodings/cp1125.py
213
34597
""" Python Character Mapping Codec for CP1125 """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_map) def decode(self,input,errors='strict'): return codecs.charmap_decode(input,errors,decoding_table) class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input, final=False): return codecs.charmap_encode(input,self.errors,encoding_map)[0] class IncrementalDecoder(codecs.IncrementalDecoder): def decode(self, input, final=False): return codecs.charmap_decode(input,self.errors,decoding_table)[0] class StreamWriter(Codec,codecs.StreamWriter): pass class StreamReader(Codec,codecs.StreamReader): pass ### encodings module API def getregentry(): return codecs.CodecInfo( name='cp1125', encode=Codec().encode, decode=Codec().decode, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamreader=StreamReader, streamwriter=StreamWriter, ) ### Decoding Map decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ 0x0080: 0x0410, # CYRILLIC CAPITAL LETTER A 0x0081: 0x0411, # CYRILLIC CAPITAL LETTER BE 0x0082: 0x0412, # CYRILLIC CAPITAL LETTER VE 0x0083: 0x0413, # CYRILLIC CAPITAL LETTER GHE 0x0084: 0x0414, # CYRILLIC CAPITAL LETTER DE 0x0085: 0x0415, # CYRILLIC CAPITAL LETTER IE 0x0086: 0x0416, # CYRILLIC CAPITAL LETTER ZHE 0x0087: 0x0417, # CYRILLIC CAPITAL LETTER ZE 0x0088: 0x0418, # CYRILLIC CAPITAL LETTER I 0x0089: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I 0x008a: 0x041a, # CYRILLIC CAPITAL LETTER KA 0x008b: 0x041b, # CYRILLIC CAPITAL LETTER EL 0x008c: 0x041c, # CYRILLIC CAPITAL LETTER EM 0x008d: 0x041d, # CYRILLIC CAPITAL LETTER EN 0x008e: 0x041e, # CYRILLIC CAPITAL LETTER O 0x008f: 0x041f, # CYRILLIC CAPITAL LETTER PE 0x0090: 0x0420, # CYRILLIC CAPITAL LETTER ER 0x0091: 0x0421, # CYRILLIC CAPITAL LETTER ES 0x0092: 0x0422, # CYRILLIC CAPITAL LETTER TE 0x0093: 0x0423, # CYRILLIC CAPITAL LETTER U 0x0094: 0x0424, # CYRILLIC CAPITAL LETTER EF 0x0095: 0x0425, # CYRILLIC CAPITAL LETTER HA 0x0096: 0x0426, # CYRILLIC CAPITAL LETTER TSE 0x0097: 0x0427, # CYRILLIC CAPITAL LETTER CHE 0x0098: 0x0428, # CYRILLIC CAPITAL LETTER SHA 0x0099: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA 0x009a: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN 0x009b: 0x042b, # CYRILLIC CAPITAL LETTER YERU 0x009c: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN 0x009d: 0x042d, # CYRILLIC CAPITAL LETTER E 0x009e: 0x042e, # CYRILLIC CAPITAL LETTER YU 0x009f: 0x042f, # CYRILLIC CAPITAL LETTER YA 0x00a0: 0x0430, # CYRILLIC SMALL LETTER A 0x00a1: 0x0431, # CYRILLIC SMALL LETTER BE 0x00a2: 0x0432, # CYRILLIC SMALL LETTER VE 0x00a3: 0x0433, # CYRILLIC SMALL LETTER GHE 0x00a4: 0x0434, # CYRILLIC SMALL LETTER DE 0x00a5: 0x0435, # CYRILLIC SMALL LETTER IE 0x00a6: 0x0436, # CYRILLIC SMALL LETTER ZHE 0x00a7: 0x0437, # CYRILLIC SMALL LETTER ZE 0x00a8: 0x0438, # CYRILLIC SMALL LETTER I 0x00a9: 0x0439, # CYRILLIC SMALL LETTER SHORT I 0x00aa: 0x043a, # CYRILLIC SMALL LETTER KA 0x00ab: 0x043b, # CYRILLIC SMALL LETTER EL 0x00ac: 0x043c, # CYRILLIC SMALL LETTER EM 0x00ad: 0x043d, # CYRILLIC SMALL LETTER EN 0x00ae: 0x043e, # CYRILLIC SMALL LETTER O 0x00af: 0x043f, # CYRILLIC SMALL LETTER PE 0x00b0: 0x2591, # LIGHT SHADE 0x00b1: 0x2592, # MEDIUM SHADE 0x00b2: 0x2593, # DARK SHADE 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT 0x00db: 0x2588, # FULL BLOCK 0x00dc: 0x2584, # LOWER HALF BLOCK 0x00dd: 0x258c, # LEFT HALF BLOCK 0x00de: 0x2590, # RIGHT HALF BLOCK 0x00df: 0x2580, # UPPER HALF BLOCK 0x00e0: 0x0440, # CYRILLIC SMALL LETTER ER 0x00e1: 0x0441, # CYRILLIC SMALL LETTER ES 0x00e2: 0x0442, # CYRILLIC SMALL LETTER TE 0x00e3: 0x0443, # CYRILLIC SMALL LETTER U 0x00e4: 0x0444, # CYRILLIC SMALL LETTER EF 0x00e5: 0x0445, # CYRILLIC SMALL LETTER HA 0x00e6: 0x0446, # CYRILLIC SMALL LETTER TSE 0x00e7: 0x0447, # CYRILLIC SMALL LETTER CHE 0x00e8: 0x0448, # CYRILLIC SMALL LETTER SHA 0x00e9: 0x0449, # CYRILLIC SMALL LETTER SHCHA 0x00ea: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN 0x00eb: 0x044b, # CYRILLIC SMALL LETTER YERU 0x00ec: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN 0x00ed: 0x044d, # CYRILLIC SMALL LETTER E 0x00ee: 0x044e, # CYRILLIC SMALL LETTER YU 0x00ef: 0x044f, # CYRILLIC SMALL LETTER YA 0x00f0: 0x0401, # CYRILLIC CAPITAL LETTER IO 0x00f1: 0x0451, # CYRILLIC SMALL LETTER IO 0x00f2: 0x0490, # CYRILLIC CAPITAL LETTER GHE WITH UPTURN 0x00f3: 0x0491, # CYRILLIC SMALL LETTER GHE WITH UPTURN 0x00f4: 0x0404, # CYRILLIC CAPITAL LETTER UKRAINIAN IE 0x00f5: 0x0454, # CYRILLIC SMALL LETTER UKRAINIAN IE 0x00f6: 0x0406, # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I 0x00f7: 0x0456, # CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I 0x00f8: 0x0407, # CYRILLIC CAPITAL LETTER YI 0x00f9: 0x0457, # CYRILLIC SMALL LETTER YI 0x00fa: 0x00b7, # MIDDLE DOT 0x00fb: 0x221a, # SQUARE ROOT 0x00fc: 0x2116, # NUMERO SIGN 0x00fd: 0x00a4, # CURRENCY SIGN 0x00fe: 0x25a0, # BLACK SQUARE 0x00ff: 0x00a0, # NO-BREAK SPACE }) ### Decoding Table decoding_table = ( '\x00' # 0x0000 -> NULL '\x01' # 0x0001 -> START OF HEADING '\x02' # 0x0002 -> START OF TEXT '\x03' # 0x0003 -> END OF TEXT '\x04' # 0x0004 -> END OF TRANSMISSION '\x05' # 0x0005 -> ENQUIRY '\x06' # 0x0006 -> ACKNOWLEDGE '\x07' # 0x0007 -> BELL '\x08' # 0x0008 -> BACKSPACE '\t' # 0x0009 -> HORIZONTAL TABULATION '\n' # 0x000a -> LINE FEED '\x0b' # 0x000b -> VERTICAL TABULATION '\x0c' # 0x000c -> FORM FEED '\r' # 0x000d -> CARRIAGE RETURN '\x0e' # 0x000e -> SHIFT OUT '\x0f' # 0x000f -> SHIFT IN '\x10' # 0x0010 -> DATA LINK ESCAPE '\x11' # 0x0011 -> DEVICE CONTROL ONE '\x12' # 0x0012 -> DEVICE CONTROL TWO '\x13' # 0x0013 -> DEVICE CONTROL THREE '\x14' # 0x0014 -> DEVICE CONTROL FOUR '\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE '\x16' # 0x0016 -> SYNCHRONOUS IDLE '\x17' # 0x0017 -> END OF TRANSMISSION BLOCK '\x18' # 0x0018 -> CANCEL '\x19' # 0x0019 -> END OF MEDIUM '\x1a' # 0x001a -> SUBSTITUTE '\x1b' # 0x001b -> ESCAPE '\x1c' # 0x001c -> FILE SEPARATOR '\x1d' # 0x001d -> GROUP SEPARATOR '\x1e' # 0x001e -> RECORD SEPARATOR '\x1f' # 0x001f -> UNIT SEPARATOR ' ' # 0x0020 -> SPACE '!' # 0x0021 -> EXCLAMATION MARK '"' # 0x0022 -> QUOTATION MARK '#' # 0x0023 -> NUMBER SIGN '$' # 0x0024 -> DOLLAR SIGN '%' # 0x0025 -> PERCENT SIGN '&' # 0x0026 -> AMPERSAND "'" # 0x0027 -> APOSTROPHE '(' # 0x0028 -> LEFT PARENTHESIS ')' # 0x0029 -> RIGHT PARENTHESIS '*' # 0x002a -> ASTERISK '+' # 0x002b -> PLUS SIGN ',' # 0x002c -> COMMA '-' # 0x002d -> HYPHEN-MINUS '.' # 0x002e -> FULL STOP '/' # 0x002f -> SOLIDUS '0' # 0x0030 -> DIGIT ZERO '1' # 0x0031 -> DIGIT ONE '2' # 0x0032 -> DIGIT TWO '3' # 0x0033 -> DIGIT THREE '4' # 0x0034 -> DIGIT FOUR '5' # 0x0035 -> DIGIT FIVE '6' # 0x0036 -> DIGIT SIX '7' # 0x0037 -> DIGIT SEVEN '8' # 0x0038 -> DIGIT EIGHT '9' # 0x0039 -> DIGIT NINE ':' # 0x003a -> COLON ';' # 0x003b -> SEMICOLON '<' # 0x003c -> LESS-THAN SIGN '=' # 0x003d -> EQUALS SIGN '>' # 0x003e -> GREATER-THAN SIGN '?' # 0x003f -> QUESTION MARK '@' # 0x0040 -> COMMERCIAL AT 'A' # 0x0041 -> LATIN CAPITAL LETTER A 'B' # 0x0042 -> LATIN CAPITAL LETTER B 'C' # 0x0043 -> LATIN CAPITAL LETTER C 'D' # 0x0044 -> LATIN CAPITAL LETTER D 'E' # 0x0045 -> LATIN CAPITAL LETTER E 'F' # 0x0046 -> LATIN CAPITAL LETTER F 'G' # 0x0047 -> LATIN CAPITAL LETTER G 'H' # 0x0048 -> LATIN CAPITAL LETTER H 'I' # 0x0049 -> LATIN CAPITAL LETTER I 'J' # 0x004a -> LATIN CAPITAL LETTER J 'K' # 0x004b -> LATIN CAPITAL LETTER K 'L' # 0x004c -> LATIN CAPITAL LETTER L 'M' # 0x004d -> LATIN CAPITAL LETTER M 'N' # 0x004e -> LATIN CAPITAL LETTER N 'O' # 0x004f -> LATIN CAPITAL LETTER O 'P' # 0x0050 -> LATIN CAPITAL LETTER P 'Q' # 0x0051 -> LATIN CAPITAL LETTER Q 'R' # 0x0052 -> LATIN CAPITAL LETTER R 'S' # 0x0053 -> LATIN CAPITAL LETTER S 'T' # 0x0054 -> LATIN CAPITAL LETTER T 'U' # 0x0055 -> LATIN CAPITAL LETTER U 'V' # 0x0056 -> LATIN CAPITAL LETTER V 'W' # 0x0057 -> LATIN CAPITAL LETTER W 'X' # 0x0058 -> LATIN CAPITAL LETTER X 'Y' # 0x0059 -> LATIN CAPITAL LETTER Y 'Z' # 0x005a -> LATIN CAPITAL LETTER Z '[' # 0x005b -> LEFT SQUARE BRACKET '\\' # 0x005c -> REVERSE SOLIDUS ']' # 0x005d -> RIGHT SQUARE BRACKET '^' # 0x005e -> CIRCUMFLEX ACCENT '_' # 0x005f -> LOW LINE '`' # 0x0060 -> GRAVE ACCENT 'a' # 0x0061 -> LATIN SMALL LETTER A 'b' # 0x0062 -> LATIN SMALL LETTER B 'c' # 0x0063 -> LATIN SMALL LETTER C 'd' # 0x0064 -> LATIN SMALL LETTER D 'e' # 0x0065 -> LATIN SMALL LETTER E 'f' # 0x0066 -> LATIN SMALL LETTER F 'g' # 0x0067 -> LATIN SMALL LETTER G 'h' # 0x0068 -> LATIN SMALL LETTER H 'i' # 0x0069 -> LATIN SMALL LETTER I 'j' # 0x006a -> LATIN SMALL LETTER J 'k' # 0x006b -> LATIN SMALL LETTER K 'l' # 0x006c -> LATIN SMALL LETTER L 'm' # 0x006d -> LATIN SMALL LETTER M 'n' # 0x006e -> LATIN SMALL LETTER N 'o' # 0x006f -> LATIN SMALL LETTER O 'p' # 0x0070 -> LATIN SMALL LETTER P 'q' # 0x0071 -> LATIN SMALL LETTER Q 'r' # 0x0072 -> LATIN SMALL LETTER R 's' # 0x0073 -> LATIN SMALL LETTER S 't' # 0x0074 -> LATIN SMALL LETTER T 'u' # 0x0075 -> LATIN SMALL LETTER U 'v' # 0x0076 -> LATIN SMALL LETTER V 'w' # 0x0077 -> LATIN SMALL LETTER W 'x' # 0x0078 -> LATIN SMALL LETTER X 'y' # 0x0079 -> LATIN SMALL LETTER Y 'z' # 0x007a -> LATIN SMALL LETTER Z '{' # 0x007b -> LEFT CURLY BRACKET '|' # 0x007c -> VERTICAL LINE '}' # 0x007d -> RIGHT CURLY BRACKET '~' # 0x007e -> TILDE '\x7f' # 0x007f -> DELETE '\u0410' # 0x0080 -> CYRILLIC CAPITAL LETTER A '\u0411' # 0x0081 -> CYRILLIC CAPITAL LETTER BE '\u0412' # 0x0082 -> CYRILLIC CAPITAL LETTER VE '\u0413' # 0x0083 -> CYRILLIC CAPITAL LETTER GHE '\u0414' # 0x0084 -> CYRILLIC CAPITAL LETTER DE '\u0415' # 0x0085 -> CYRILLIC CAPITAL LETTER IE '\u0416' # 0x0086 -> CYRILLIC CAPITAL LETTER ZHE '\u0417' # 0x0087 -> CYRILLIC CAPITAL LETTER ZE '\u0418' # 0x0088 -> CYRILLIC CAPITAL LETTER I '\u0419' # 0x0089 -> CYRILLIC CAPITAL LETTER SHORT I '\u041a' # 0x008a -> CYRILLIC CAPITAL LETTER KA '\u041b' # 0x008b -> CYRILLIC CAPITAL LETTER EL '\u041c' # 0x008c -> CYRILLIC CAPITAL LETTER EM '\u041d' # 0x008d -> CYRILLIC CAPITAL LETTER EN '\u041e' # 0x008e -> CYRILLIC CAPITAL LETTER O '\u041f' # 0x008f -> CYRILLIC CAPITAL LETTER PE '\u0420' # 0x0090 -> CYRILLIC CAPITAL LETTER ER '\u0421' # 0x0091 -> CYRILLIC CAPITAL LETTER ES '\u0422' # 0x0092 -> CYRILLIC CAPITAL LETTER TE '\u0423' # 0x0093 -> CYRILLIC CAPITAL LETTER U '\u0424' # 0x0094 -> CYRILLIC CAPITAL LETTER EF '\u0425' # 0x0095 -> CYRILLIC CAPITAL LETTER HA '\u0426' # 0x0096 -> CYRILLIC CAPITAL LETTER TSE '\u0427' # 0x0097 -> CYRILLIC CAPITAL LETTER CHE '\u0428' # 0x0098 -> CYRILLIC CAPITAL LETTER SHA '\u0429' # 0x0099 -> CYRILLIC CAPITAL LETTER SHCHA '\u042a' # 0x009a -> CYRILLIC CAPITAL LETTER HARD SIGN '\u042b' # 0x009b -> CYRILLIC CAPITAL LETTER YERU '\u042c' # 0x009c -> CYRILLIC CAPITAL LETTER SOFT SIGN '\u042d' # 0x009d -> CYRILLIC CAPITAL LETTER E '\u042e' # 0x009e -> CYRILLIC CAPITAL LETTER YU '\u042f' # 0x009f -> CYRILLIC CAPITAL LETTER YA '\u0430' # 0x00a0 -> CYRILLIC SMALL LETTER A '\u0431' # 0x00a1 -> CYRILLIC SMALL LETTER BE '\u0432' # 0x00a2 -> CYRILLIC SMALL LETTER VE '\u0433' # 0x00a3 -> CYRILLIC SMALL LETTER GHE '\u0434' # 0x00a4 -> CYRILLIC SMALL LETTER DE '\u0435' # 0x00a5 -> CYRILLIC SMALL LETTER IE '\u0436' # 0x00a6 -> CYRILLIC SMALL LETTER ZHE '\u0437' # 0x00a7 -> CYRILLIC SMALL LETTER ZE '\u0438' # 0x00a8 -> CYRILLIC SMALL LETTER I '\u0439' # 0x00a9 -> CYRILLIC SMALL LETTER SHORT I '\u043a' # 0x00aa -> CYRILLIC SMALL LETTER KA '\u043b' # 0x00ab -> CYRILLIC SMALL LETTER EL '\u043c' # 0x00ac -> CYRILLIC SMALL LETTER EM '\u043d' # 0x00ad -> CYRILLIC SMALL LETTER EN '\u043e' # 0x00ae -> CYRILLIC SMALL LETTER O '\u043f' # 0x00af -> CYRILLIC SMALL LETTER PE '\u2591' # 0x00b0 -> LIGHT SHADE '\u2592' # 0x00b1 -> MEDIUM SHADE '\u2593' # 0x00b2 -> DARK SHADE '\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL '\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT '\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE '\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE '\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE '\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE '\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT '\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL '\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT '\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT '\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE '\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE '\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT '\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT '\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL '\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL '\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT '\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL '\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL '\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE '\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE '\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT '\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT '\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL '\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL '\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT '\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL '\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL '\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE '\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE '\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE '\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE '\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE '\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE '\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE '\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE '\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE '\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE '\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT '\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT '\u2588' # 0x00db -> FULL BLOCK '\u2584' # 0x00dc -> LOWER HALF BLOCK '\u258c' # 0x00dd -> LEFT HALF BLOCK '\u2590' # 0x00de -> RIGHT HALF BLOCK '\u2580' # 0x00df -> UPPER HALF BLOCK '\u0440' # 0x00e0 -> CYRILLIC SMALL LETTER ER '\u0441' # 0x00e1 -> CYRILLIC SMALL LETTER ES '\u0442' # 0x00e2 -> CYRILLIC SMALL LETTER TE '\u0443' # 0x00e3 -> CYRILLIC SMALL LETTER U '\u0444' # 0x00e4 -> CYRILLIC SMALL LETTER EF '\u0445' # 0x00e5 -> CYRILLIC SMALL LETTER HA '\u0446' # 0x00e6 -> CYRILLIC SMALL LETTER TSE '\u0447' # 0x00e7 -> CYRILLIC SMALL LETTER CHE '\u0448' # 0x00e8 -> CYRILLIC SMALL LETTER SHA '\u0449' # 0x00e9 -> CYRILLIC SMALL LETTER SHCHA '\u044a' # 0x00ea -> CYRILLIC SMALL LETTER HARD SIGN '\u044b' # 0x00eb -> CYRILLIC SMALL LETTER YERU '\u044c' # 0x00ec -> CYRILLIC SMALL LETTER SOFT SIGN '\u044d' # 0x00ed -> CYRILLIC SMALL LETTER E '\u044e' # 0x00ee -> CYRILLIC SMALL LETTER YU '\u044f' # 0x00ef -> CYRILLIC SMALL LETTER YA '\u0401' # 0x00f0 -> CYRILLIC CAPITAL LETTER IO '\u0451' # 0x00f1 -> CYRILLIC SMALL LETTER IO '\u0490' # 0x00f2 -> CYRILLIC CAPITAL LETTER GHE WITH UPTURN '\u0491' # 0x00f3 -> CYRILLIC SMALL LETTER GHE WITH UPTURN '\u0404' # 0x00f4 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE '\u0454' # 0x00f5 -> CYRILLIC SMALL LETTER UKRAINIAN IE '\u0406' # 0x00f6 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I '\u0456' # 0x00f7 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I '\u0407' # 0x00f8 -> CYRILLIC CAPITAL LETTER YI '\u0457' # 0x00f9 -> CYRILLIC SMALL LETTER YI '\xb7' # 0x00fa -> MIDDLE DOT '\u221a' # 0x00fb -> SQUARE ROOT '\u2116' # 0x00fc -> NUMERO SIGN '\xa4' # 0x00fd -> CURRENCY SIGN '\u25a0' # 0x00fe -> BLACK SQUARE '\xa0' # 0x00ff -> NO-BREAK SPACE ) ### Encoding Map encoding_map = { 0x0000: 0x0000, # NULL 0x0001: 0x0001, # START OF HEADING 0x0002: 0x0002, # START OF TEXT 0x0003: 0x0003, # END OF TEXT 0x0004: 0x0004, # END OF TRANSMISSION 0x0005: 0x0005, # ENQUIRY 0x0006: 0x0006, # ACKNOWLEDGE 0x0007: 0x0007, # BELL 0x0008: 0x0008, # BACKSPACE 0x0009: 0x0009, # HORIZONTAL TABULATION 0x000a: 0x000a, # LINE FEED 0x000b: 0x000b, # VERTICAL TABULATION 0x000c: 0x000c, # FORM FEED 0x000d: 0x000d, # CARRIAGE RETURN 0x000e: 0x000e, # SHIFT OUT 0x000f: 0x000f, # SHIFT IN 0x0010: 0x0010, # DATA LINK ESCAPE 0x0011: 0x0011, # DEVICE CONTROL ONE 0x0012: 0x0012, # DEVICE CONTROL TWO 0x0013: 0x0013, # DEVICE CONTROL THREE 0x0014: 0x0014, # DEVICE CONTROL FOUR 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE 0x0016: 0x0016, # SYNCHRONOUS IDLE 0x0017: 0x0017, # END OF TRANSMISSION BLOCK 0x0018: 0x0018, # CANCEL 0x0019: 0x0019, # END OF MEDIUM 0x001a: 0x001a, # SUBSTITUTE 0x001b: 0x001b, # ESCAPE 0x001c: 0x001c, # FILE SEPARATOR 0x001d: 0x001d, # GROUP SEPARATOR 0x001e: 0x001e, # RECORD SEPARATOR 0x001f: 0x001f, # UNIT SEPARATOR 0x0020: 0x0020, # SPACE 0x0021: 0x0021, # EXCLAMATION MARK 0x0022: 0x0022, # QUOTATION MARK 0x0023: 0x0023, # NUMBER SIGN 0x0024: 0x0024, # DOLLAR SIGN 0x0025: 0x0025, # PERCENT SIGN 0x0026: 0x0026, # AMPERSAND 0x0027: 0x0027, # APOSTROPHE 0x0028: 0x0028, # LEFT PARENTHESIS 0x0029: 0x0029, # RIGHT PARENTHESIS 0x002a: 0x002a, # ASTERISK 0x002b: 0x002b, # PLUS SIGN 0x002c: 0x002c, # COMMA 0x002d: 0x002d, # HYPHEN-MINUS 0x002e: 0x002e, # FULL STOP 0x002f: 0x002f, # SOLIDUS 0x0030: 0x0030, # DIGIT ZERO 0x0031: 0x0031, # DIGIT ONE 0x0032: 0x0032, # DIGIT TWO 0x0033: 0x0033, # DIGIT THREE 0x0034: 0x0034, # DIGIT FOUR 0x0035: 0x0035, # DIGIT FIVE 0x0036: 0x0036, # DIGIT SIX 0x0037: 0x0037, # DIGIT SEVEN 0x0038: 0x0038, # DIGIT EIGHT 0x0039: 0x0039, # DIGIT NINE 0x003a: 0x003a, # COLON 0x003b: 0x003b, # SEMICOLON 0x003c: 0x003c, # LESS-THAN SIGN 0x003d: 0x003d, # EQUALS SIGN 0x003e: 0x003e, # GREATER-THAN SIGN 0x003f: 0x003f, # QUESTION MARK 0x0040: 0x0040, # COMMERCIAL AT 0x0041: 0x0041, # LATIN CAPITAL LETTER A 0x0042: 0x0042, # LATIN CAPITAL LETTER B 0x0043: 0x0043, # LATIN CAPITAL LETTER C 0x0044: 0x0044, # LATIN CAPITAL LETTER D 0x0045: 0x0045, # LATIN CAPITAL LETTER E 0x0046: 0x0046, # LATIN CAPITAL LETTER F 0x0047: 0x0047, # LATIN CAPITAL LETTER G 0x0048: 0x0048, # LATIN CAPITAL LETTER H 0x0049: 0x0049, # LATIN CAPITAL LETTER I 0x004a: 0x004a, # LATIN CAPITAL LETTER J 0x004b: 0x004b, # LATIN CAPITAL LETTER K 0x004c: 0x004c, # LATIN CAPITAL LETTER L 0x004d: 0x004d, # LATIN CAPITAL LETTER M 0x004e: 0x004e, # LATIN CAPITAL LETTER N 0x004f: 0x004f, # LATIN CAPITAL LETTER O 0x0050: 0x0050, # LATIN CAPITAL LETTER P 0x0051: 0x0051, # LATIN CAPITAL LETTER Q 0x0052: 0x0052, # LATIN CAPITAL LETTER R 0x0053: 0x0053, # LATIN CAPITAL LETTER S 0x0054: 0x0054, # LATIN CAPITAL LETTER T 0x0055: 0x0055, # LATIN CAPITAL LETTER U 0x0056: 0x0056, # LATIN CAPITAL LETTER V 0x0057: 0x0057, # LATIN CAPITAL LETTER W 0x0058: 0x0058, # LATIN CAPITAL LETTER X 0x0059: 0x0059, # LATIN CAPITAL LETTER Y 0x005a: 0x005a, # LATIN CAPITAL LETTER Z 0x005b: 0x005b, # LEFT SQUARE BRACKET 0x005c: 0x005c, # REVERSE SOLIDUS 0x005d: 0x005d, # RIGHT SQUARE BRACKET 0x005e: 0x005e, # CIRCUMFLEX ACCENT 0x005f: 0x005f, # LOW LINE 0x0060: 0x0060, # GRAVE ACCENT 0x0061: 0x0061, # LATIN SMALL LETTER A 0x0062: 0x0062, # LATIN SMALL LETTER B 0x0063: 0x0063, # LATIN SMALL LETTER C 0x0064: 0x0064, # LATIN SMALL LETTER D 0x0065: 0x0065, # LATIN SMALL LETTER E 0x0066: 0x0066, # LATIN SMALL LETTER F 0x0067: 0x0067, # LATIN SMALL LETTER G 0x0068: 0x0068, # LATIN SMALL LETTER H 0x0069: 0x0069, # LATIN SMALL LETTER I 0x006a: 0x006a, # LATIN SMALL LETTER J 0x006b: 0x006b, # LATIN SMALL LETTER K 0x006c: 0x006c, # LATIN SMALL LETTER L 0x006d: 0x006d, # LATIN SMALL LETTER M 0x006e: 0x006e, # LATIN SMALL LETTER N 0x006f: 0x006f, # LATIN SMALL LETTER O 0x0070: 0x0070, # LATIN SMALL LETTER P 0x0071: 0x0071, # LATIN SMALL LETTER Q 0x0072: 0x0072, # LATIN SMALL LETTER R 0x0073: 0x0073, # LATIN SMALL LETTER S 0x0074: 0x0074, # LATIN SMALL LETTER T 0x0075: 0x0075, # LATIN SMALL LETTER U 0x0076: 0x0076, # LATIN SMALL LETTER V 0x0077: 0x0077, # LATIN SMALL LETTER W 0x0078: 0x0078, # LATIN SMALL LETTER X 0x0079: 0x0079, # LATIN SMALL LETTER Y 0x007a: 0x007a, # LATIN SMALL LETTER Z 0x007b: 0x007b, # LEFT CURLY BRACKET 0x007c: 0x007c, # VERTICAL LINE 0x007d: 0x007d, # RIGHT CURLY BRACKET 0x007e: 0x007e, # TILDE 0x007f: 0x007f, # DELETE 0x00a0: 0x00ff, # NO-BREAK SPACE 0x00a4: 0x00fd, # CURRENCY SIGN 0x00b7: 0x00fa, # MIDDLE DOT 0x0401: 0x00f0, # CYRILLIC CAPITAL LETTER IO 0x0404: 0x00f4, # CYRILLIC CAPITAL LETTER UKRAINIAN IE 0x0406: 0x00f6, # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I 0x0407: 0x00f8, # CYRILLIC CAPITAL LETTER YI 0x0410: 0x0080, # CYRILLIC CAPITAL LETTER A 0x0411: 0x0081, # CYRILLIC CAPITAL LETTER BE 0x0412: 0x0082, # CYRILLIC CAPITAL LETTER VE 0x0413: 0x0083, # CYRILLIC CAPITAL LETTER GHE 0x0414: 0x0084, # CYRILLIC CAPITAL LETTER DE 0x0415: 0x0085, # CYRILLIC CAPITAL LETTER IE 0x0416: 0x0086, # CYRILLIC CAPITAL LETTER ZHE 0x0417: 0x0087, # CYRILLIC CAPITAL LETTER ZE 0x0418: 0x0088, # CYRILLIC CAPITAL LETTER I 0x0419: 0x0089, # CYRILLIC CAPITAL LETTER SHORT I 0x041a: 0x008a, # CYRILLIC CAPITAL LETTER KA 0x041b: 0x008b, # CYRILLIC CAPITAL LETTER EL 0x041c: 0x008c, # CYRILLIC CAPITAL LETTER EM 0x041d: 0x008d, # CYRILLIC CAPITAL LETTER EN 0x041e: 0x008e, # CYRILLIC CAPITAL LETTER O 0x041f: 0x008f, # CYRILLIC CAPITAL LETTER PE 0x0420: 0x0090, # CYRILLIC CAPITAL LETTER ER 0x0421: 0x0091, # CYRILLIC CAPITAL LETTER ES 0x0422: 0x0092, # CYRILLIC CAPITAL LETTER TE 0x0423: 0x0093, # CYRILLIC CAPITAL LETTER U 0x0424: 0x0094, # CYRILLIC CAPITAL LETTER EF 0x0425: 0x0095, # CYRILLIC CAPITAL LETTER HA 0x0426: 0x0096, # CYRILLIC CAPITAL LETTER TSE 0x0427: 0x0097, # CYRILLIC CAPITAL LETTER CHE 0x0428: 0x0098, # CYRILLIC CAPITAL LETTER SHA 0x0429: 0x0099, # CYRILLIC CAPITAL LETTER SHCHA 0x042a: 0x009a, # CYRILLIC CAPITAL LETTER HARD SIGN 0x042b: 0x009b, # CYRILLIC CAPITAL LETTER YERU 0x042c: 0x009c, # CYRILLIC CAPITAL LETTER SOFT SIGN 0x042d: 0x009d, # CYRILLIC CAPITAL LETTER E 0x042e: 0x009e, # CYRILLIC CAPITAL LETTER YU 0x042f: 0x009f, # CYRILLIC CAPITAL LETTER YA 0x0430: 0x00a0, # CYRILLIC SMALL LETTER A 0x0431: 0x00a1, # CYRILLIC SMALL LETTER BE 0x0432: 0x00a2, # CYRILLIC SMALL LETTER VE 0x0433: 0x00a3, # CYRILLIC SMALL LETTER GHE 0x0434: 0x00a4, # CYRILLIC SMALL LETTER DE 0x0435: 0x00a5, # CYRILLIC SMALL LETTER IE 0x0436: 0x00a6, # CYRILLIC SMALL LETTER ZHE 0x0437: 0x00a7, # CYRILLIC SMALL LETTER ZE 0x0438: 0x00a8, # CYRILLIC SMALL LETTER I 0x0439: 0x00a9, # CYRILLIC SMALL LETTER SHORT I 0x043a: 0x00aa, # CYRILLIC SMALL LETTER KA 0x043b: 0x00ab, # CYRILLIC SMALL LETTER EL 0x043c: 0x00ac, # CYRILLIC SMALL LETTER EM 0x043d: 0x00ad, # CYRILLIC SMALL LETTER EN 0x043e: 0x00ae, # CYRILLIC SMALL LETTER O 0x043f: 0x00af, # CYRILLIC SMALL LETTER PE 0x0440: 0x00e0, # CYRILLIC SMALL LETTER ER 0x0441: 0x00e1, # CYRILLIC SMALL LETTER ES 0x0442: 0x00e2, # CYRILLIC SMALL LETTER TE 0x0443: 0x00e3, # CYRILLIC SMALL LETTER U 0x0444: 0x00e4, # CYRILLIC SMALL LETTER EF 0x0445: 0x00e5, # CYRILLIC SMALL LETTER HA 0x0446: 0x00e6, # CYRILLIC SMALL LETTER TSE 0x0447: 0x00e7, # CYRILLIC SMALL LETTER CHE 0x0448: 0x00e8, # CYRILLIC SMALL LETTER SHA 0x0449: 0x00e9, # CYRILLIC SMALL LETTER SHCHA 0x044a: 0x00ea, # CYRILLIC SMALL LETTER HARD SIGN 0x044b: 0x00eb, # CYRILLIC SMALL LETTER YERU 0x044c: 0x00ec, # CYRILLIC SMALL LETTER SOFT SIGN 0x044d: 0x00ed, # CYRILLIC SMALL LETTER E 0x044e: 0x00ee, # CYRILLIC SMALL LETTER YU 0x044f: 0x00ef, # CYRILLIC SMALL LETTER YA 0x0451: 0x00f1, # CYRILLIC SMALL LETTER IO 0x0454: 0x00f5, # CYRILLIC SMALL LETTER UKRAINIAN IE 0x0456: 0x00f7, # CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I 0x0457: 0x00f9, # CYRILLIC SMALL LETTER YI 0x0490: 0x00f2, # CYRILLIC CAPITAL LETTER GHE WITH UPTURN 0x0491: 0x00f3, # CYRILLIC SMALL LETTER GHE WITH UPTURN 0x2116: 0x00fc, # NUMERO SIGN 0x221a: 0x00fb, # SQUARE ROOT 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL 0x2552: 0x00d5, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE 0x2553: 0x00d6, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT 0x2555: 0x00b8, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE 0x2556: 0x00b7, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT 0x2558: 0x00d4, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE 0x2559: 0x00d3, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT 0x255b: 0x00be, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE 0x255c: 0x00bd, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT 0x255e: 0x00c6, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE 0x255f: 0x00c7, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT 0x2561: 0x00b5, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE 0x2562: 0x00b6, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT 0x2564: 0x00d1, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE 0x2565: 0x00d2, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL 0x2567: 0x00cf, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE 0x2568: 0x00d0, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL 0x256a: 0x00d8, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE 0x256b: 0x00d7, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL 0x2580: 0x00df, # UPPER HALF BLOCK 0x2584: 0x00dc, # LOWER HALF BLOCK 0x2588: 0x00db, # FULL BLOCK 0x258c: 0x00dd, # LEFT HALF BLOCK 0x2590: 0x00de, # RIGHT HALF BLOCK 0x2591: 0x00b0, # LIGHT SHADE 0x2592: 0x00b1, # MEDIUM SHADE 0x2593: 0x00b2, # DARK SHADE 0x25a0: 0x00fe, # BLACK SQUARE }
lgpl-3.0
Fat-Zer/FreeCAD_sf_master
src/Mod/Path/PathScripts/PathCustom.py
13
3170
# -*- coding: utf-8 -*- # *************************************************************************** # * Copyright (c) 2014 Yorik van Havre <yorik@uncreated.net> * # * * # * This program is free software; you can redistribute it and/or modify * # * it under the terms of the GNU Lesser General Public License (LGPL) * # * as published by the Free Software Foundation; either version 2 of * # * the License, or (at your option) any later version. * # * for detail see the LICENCE text file. * # * * # * 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 Library General Public License for more details. * # * * # * You should have received a copy of the GNU Library General Public * # * License along with this program; if not, write to the Free Software * # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * # * USA * # * * # *************************************************************************** import FreeCAD import Path import PathScripts.PathOp as PathOp import PathScripts.PathLog as PathLog from PySide import QtCore __title__ = "Path Custom Operation" __author__ = "sliptonic (Brad Collette)" __url__ = "http://www.freecadweb.org" __doc__ = "Path Custom object and FreeCAD command" if False: PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) PathLog.trackModule(PathLog.thisModule()) else: PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) # Qt translation handling def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) class ObjectCustom(PathOp.ObjectOp): def opFeatures(self, obj): return PathOp.FeatureTool | PathOp.FeatureCoolant def initOperation(self, obj): obj.addProperty("App::PropertyStringList", "Gcode", "Path", QtCore.QT_TRANSLATE_NOOP("PathCustom", "The gcode to be inserted")) obj.Proxy = self def opExecute(self, obj): self.commandlist.append(Path.Command("(Begin Custom)")) if obj.Gcode: for l in obj.Gcode: newcommand = Path.Command(str(l)) self.commandlist.append(newcommand) self.commandlist.append(Path.Command("(End Custom)")) def SetupProperties(): setup = [] return setup def Create(name, obj=None): '''Create(name) ... Creates and returns a Custom operation.''' if obj is None: obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) proxy = ObjectCustom(obj, name) return obj
lgpl-2.1
fmonjalet/miasm
miasm2/arch/arm/arch.py
1
65252
#!/usr/bin/env python #-*- coding:utf-8 -*- import logging from pyparsing import * from miasm2.expression.expression import * from miasm2.core.cpu import * from collections import defaultdict from miasm2.core.bin_stream import bin_stream import miasm2.arch.arm.regs as regs_module from miasm2.arch.arm.regs import * from miasm2.core.asmbloc import asm_label # A1 encoding log = logging.getLogger("armdis") console_handler = logging.StreamHandler() console_handler.setFormatter(logging.Formatter("%(levelname)-5s: %(message)s")) log.addHandler(console_handler) log.setLevel(logging.DEBUG) # arm regs ############## reg_dum = ExprId('DumReg') gen_reg('PC', globals()) # GP regs_str = ['R%d' % r for r in xrange(0x10)] regs_str[13] = 'SP' regs_str[14] = 'LR' regs_str[15] = 'PC' regs_expr = [ExprId(x, 32) for x in regs_str] gpregs = reg_info(regs_str, regs_expr) gpregs_pc = reg_info(regs_str[-1:], regs_expr[-1:]) gpregs_sp = reg_info(regs_str[13:14], regs_expr[13:14]) gpregs_nosppc = reg_info(regs_str[:13] + [str(reg_dum), regs_str[14]], regs_expr[:13] + [reg_dum, regs_expr[14]]) # psr sr_flags = "cxsf" cpsr_regs_str = [] spsr_regs_str = [] for i in xrange(0x10): o = "" for j in xrange(4): if i & (1 << j): o += sr_flags[j] cpsr_regs_str.append("CPSR_%s" % o) spsr_regs_str.append("SPSR_%s" % o) # psr_regs_str = ['CPSR', 'SPSR'] # psr_regs_expr = [ExprId(x, 32) for x in psr_regs_str] # psr_regs = reg_info(psr_regs_str, psr_regs_expr) cpsr_regs_expr = [ExprId(x, 32) for x in cpsr_regs_str] spsr_regs_expr = [ExprId(x, 32) for x in spsr_regs_str] cpsr_regs = reg_info(cpsr_regs_str, cpsr_regs_expr) spsr_regs = reg_info(spsr_regs_str, spsr_regs_expr) # CP cpregs_str = ['c%d' % r for r in xrange(0x10)] cpregs_expr = [ExprId(x) for x in cpregs_str] cp_regs = reg_info(cpregs_str, cpregs_expr) # P pregs_str = ['p%d' % r for r in xrange(0x10)] pregs_expr = [ExprId(x) for x in pregs_str] p_regs = reg_info(pregs_str, pregs_expr) conditional_branch = ["BEQ", "BNE", "BCS", "BCC", "BMI", "BPL", "BVS", "BVC", "BHI", "BLS", "BGE", "BLT", "BGT", "BLE"] unconditional_branch = ["B", "BX", "BL", "BLX"] # parser helper ########### def tok_reg_duo(s, l, t): t = t[0] i1 = gpregs.expr.index(t[0]) i2 = gpregs.expr.index(t[1]) o = [] for i in xrange(i1, i2 + 1): o.append(gpregs.expr[i]) return o LPARENTHESIS = Literal("(") RPARENTHESIS = Literal(")") LACC = Suppress(Literal("{")) RACC = Suppress(Literal("}")) MINUS = Suppress(Literal("-")) CIRCUNFLEX = Literal("^") def check_bounds(left_bound, right_bound, value): if left_bound <= value and value <= right_bound: return ExprInt32(value) else: raise ValueError('shift operator immediate value out of bound') int_1_31 = str_int.copy().setParseAction(lambda v: check_bounds(1, 31, v[0])) int_1_32 = str_int.copy().setParseAction(lambda v: check_bounds(1, 32, v[0])) def reglistparse(s, l, t): t = t[0] if t[-1] == "^": return ExprOp('sbit', ExprOp('reglist', *t[:-1])) return ExprOp('reglist', *t) allshifts = ['<<', '>>', 'a>>', '>>>', 'rrx'] allshifts_armt = ['<<', '>>', 'a>>', '>>>', 'rrx'] shift2expr_dct = {'LSL': '<<', 'LSR': '>>', 'ASR': 'a>>', 'ROR': ">>>", 'RRX': "rrx"} expr2shift_dct = dict([(x[1], x[0]) for x in shift2expr_dct.items()]) def op_shift2expr(s, l, t): return shift2expr_dct[t[0]] reg_duo = Group(gpregs.parser + MINUS + gpregs.parser).setParseAction(tok_reg_duo) reg_or_duo = reg_duo | gpregs.parser gpreg_list = Group(LACC + delimitedList( reg_or_duo, delim=',') + RACC + Optional(CIRCUNFLEX)) gpreg_list.setParseAction(reglistparse) LBRACK = Suppress("[") RBRACK = Suppress("]") COMMA = Suppress(",") all_binaryop_1_31_shifts_t = literal_list( ['LSL', 'ROR']).setParseAction(op_shift2expr) all_binaryop_1_32_shifts_t = literal_list( ['LSR', 'ASR']).setParseAction(op_shift2expr) all_unaryop_shifts_t = literal_list(['RRX']).setParseAction(op_shift2expr) allshifts_t_armt = literal_list( ['LSL', 'LSR', 'ASR', 'ROR', 'RRX']).setParseAction(op_shift2expr) gpreg_p = gpregs.parser psr_p = cpsr_regs.parser | spsr_regs.parser def shift2expr(t): if len(t) == 1: return t[0] elif len(t) == 2: return ExprOp(t[1], t[0]) elif len(t) == 3: return ExprOp(t[1], t[0], t[2]) variable, operand, base_expr = gen_base_expr() int_or_expr = base_expr def ast_id2expr(t): if not t in mn_arm.regs.all_regs_ids_byname: r = ExprId(asm_label(t)) else: r = mn_arm.regs.all_regs_ids_byname[t] return r def ast_int2expr(a): return ExprInt32(a) my_var_parser = parse_ast(ast_id2expr, ast_int2expr) base_expr.setParseAction(my_var_parser) shift_off = (gpregs.parser + Optional( (all_unaryop_shifts_t) | (all_binaryop_1_31_shifts_t + (gpregs.parser | int_1_31)) | (all_binaryop_1_32_shifts_t + (gpregs.parser | int_1_32)) )).setParseAction(shift2expr) shift_off |= base_expr def deref2expr_nooff(s, l, t): t = t[0] # XXX default return ExprOp("preinc", t[0], ExprInt32(0)) def deref2expr_pre(s, l, t): t = t[0] if len(t) == 1: return ExprOp("preinc", t[0], ExprInt32(0)) elif len(t) == 2: return ExprOp("preinc", t[0], t[1]) else: raise NotImplementedError('len(t) > 2') def deref2expr_pre_mem(s, l, t): t = t[0] if len(t) == 1: return ExprMem(ExprOp("preinc", t[0], ExprInt32(0))) elif len(t) == 2: return ExprMem(ExprOp("preinc", t[0], t[1])) else: raise NotImplementedError('len(t) > 2') def deref2expr_post(s, l, t): t = t[0] return ExprOp("postinc", t[0], t[1]) def deref_wb(s, l, t): t = t[0] if t[-1] == '!': return ExprMem(ExprOp('wback', *t[:-1])) return ExprMem(t[0]) # shift_off.setParseAction(deref_off) deref_nooff = Group( LBRACK + gpregs.parser + RBRACK).setParseAction(deref2expr_nooff) deref_pre = Group(LBRACK + gpregs.parser + Optional( COMMA + shift_off) + RBRACK).setParseAction(deref2expr_pre) deref_post = Group(LBRACK + gpregs.parser + RBRACK + COMMA + shift_off).setParseAction(deref2expr_post) deref = Group((deref_post | deref_pre | deref_nooff) + Optional('!')).setParseAction(deref_wb) def parsegpreg_wb(s, l, t): t = t[0] if t[-1] == '!': return ExprOp('wback', *t[:-1]) return t[0] gpregs_wb = Group(gpregs.parser + Optional('!')).setParseAction(parsegpreg_wb) # cond_list = ['EQ', 'NE', 'CS', 'CC', 'MI', 'PL', 'VS', 'VC', 'HI', 'LS', 'GE', 'LT', 'GT', 'LE', ''] # , 'NV'] cond_dct = dict([(x[1], x[0]) for x in enumerate(cond_list)]) # default_prio = 0x1337 bm_cond = bs_mod_name(l=4, fname='cond', mn_mod=cond_list) # cond_dct) def permut_args(order, args): l = [] for i, x in enumerate(order): l.append((x.__class__, i)) l = dict(l) out = [None for x in xrange(len(args))] for a in args: out[l[a.__class__]] = a return out class additional_info: def __init__(self): self.except_on_instr = False self.lnk = None self.cond = None class instruction_arm(instruction): delayslot = 0 def __init__(self, *args, **kargs): super(instruction_arm, self).__init__(*args, **kargs) @staticmethod def arg2str(e, pos = None): wb = False if isinstance(e, ExprId) or isinstance(e, ExprInt): return str(e) if isinstance(e, ExprOp) and e.op in expr2shift_dct: if len(e.args) == 1: return '%s %s' % (e.args[0], expr2shift_dct[e.op]) elif len(e.args) == 2: return '%s %s %s' % (e.args[0], expr2shift_dct[e.op], e.args[1]) else: raise NotImplementedError('zarb arg2str') sb = False if isinstance(e, ExprOp) and e.op == "sbit": sb = True e = e.args[0] if isinstance(e, ExprOp) and e.op == "reglist": o = [gpregs.expr.index(x) for x in e.args] out = reglist2str(o) if sb: out += "^" return out if isinstance(e, ExprOp) and e.op == 'wback': wb = True e = e.args[0] if isinstance(e, ExprId): out = str(e) if wb: out += "!" return out if not isinstance(e, ExprMem): return str(e) e = e.arg if isinstance(e, ExprOp) and e.op == 'wback': wb = True e = e.args[0] if isinstance(e, ExprId): r, s = e, None elif len(e.args) == 1 and isinstance(e.args[0], ExprId): r, s = e.args[0], None elif isinstance(e.args[0], ExprId): r, s = e.args[0], e.args[1] else: r, s = e.args[0].args if isinstance(s, ExprOp) and s.op in expr2shift_dct: s = ' '.join([str(x) for x in s.args[0], expr2shift_dct[s.op], s.args[1]]) if isinstance(e, ExprOp) and e.op == 'postinc': o = '[%s]' % r if s and not (isinstance(s, ExprInt) and s.arg == 0): o += ', %s' % s else: if s and not (isinstance(s, ExprInt) and s.arg == 0): o = '[%s, %s]' % (r, s) else: o = '[%s]' % (r) if wb: o += "!" return o def dstflow(self): return self.name in conditional_branch + unconditional_branch def dstflow2label(self, symbol_pool): e = self.args[0] if not isinstance(e, ExprInt): return if self.name == 'BLX': ad = e.arg + self.offset else: ad = e.arg + self.offset l = symbol_pool.getby_offset_create(ad) s = ExprId(l, e.size) self.args[0] = s def breakflow(self): if self.name in conditional_branch + unconditional_branch: return True if self.name.startswith("LDM") and PC in self.args[1].args: return True if self.args and PC in self.args[0].get_r(): return True return False def is_subcall(self): if self.name == 'BLX': return True return self.additional_info.lnk def getdstflow(self, symbol_pool): return [self.args[0]] def splitflow(self): if self.additional_info.lnk: return True if self.name == 'BLX': return True if self.name == 'BX': return False return self.breakflow() and self.additional_info.cond != 14 def get_symbol_size(self, symbol, symbol_pool): return 32 def fixDstOffset(self): e = self.args[0] if self.offset is None: raise ValueError('symbol not resolved %s' % l) if not isinstance(e, ExprInt): log.debug('dyn dst %r', e) return off = e.arg - self.offset if int(off % 4): raise ValueError('strange offset! %r' % off) self.args[0] = ExprInt32(off) def get_args_expr(self): args = [a for a in self.args] return args def get_asm_offset(self, expr): # LDR XXX, [PC, offset] => PC is self.offset+8 return ExprInt_from(expr, self.offset+8) class instruction_armt(instruction_arm): def __init__(self, *args, **kargs): super(instruction_armt, self).__init__(*args, **kargs) def dstflow(self): if self.name in ["CBZ", "CBNZ"]: return True return self.name in conditional_branch + unconditional_branch def dstflow2label(self, symbol_pool): if self.name in ["CBZ", "CBNZ"]: e = self.args[1] else: e = self.args[0] if not isinstance(e, ExprInt): return if self.name == 'BLX': ad = e.arg + (self.offset & 0xfffffffc) else: ad = e.arg + self.offset l = symbol_pool.getby_offset_create(ad) s = ExprId(l, e.size) if self.name in ["CBZ", "CBNZ"]: self.args[1] = s else: self.args[0] = s def breakflow(self): if self.name in conditional_branch + unconditional_branch +["CBZ", "CBNZ"]: return True if self.name.startswith("LDM") and PC in self.args[1].args: return True if self.args and PC in self.args[0].get_r(): return True return False def getdstflow(self, symbol_pool): if self.name in ['CBZ', 'CBNZ']: return [self.args[1]] return [self.args[0]] def splitflow(self): if self.name in conditional_branch + ['BL', 'BLX', 'CBZ', 'CBNZ']: return True return False def is_subcall(self): return self.name in ['BL', 'BLX'] def fixDstOffset(self): e = self.args[0] if self.offset is None: raise ValueError('symbol not resolved %s' % l) if not isinstance(e, ExprInt): log.debug('dyn dst %r', e) return # The first +2 is to compensate instruction len, but strangely, 32 bits # thumb2 instructions len is 2... For the second +2, didn't find it in # the doc. off = e.arg - self.offset if int(off % 2): raise ValueError('strange offset! %r' % off) self.args[0] = ExprInt32(off) def get_asm_offset(self, expr): # ADR XXX, PC, imm => PC is 4 aligned + imm new_offset = ((self.offset+self.l)/4)*4 return ExprInt_from(expr, new_offset) class mn_arm(cls_mn): delayslot = 0 name = "arm" regs = regs_module bintree = {} num = 0 all_mn = [] all_mn_mode = defaultdict(list) all_mn_name = defaultdict(list) all_mn_inst = defaultdict(list) pc = {'l':PC, 'b':PC} sp = {'l':SP, 'b':SP} instruction = instruction_arm max_instruction_len = 4 alignment = 4 @classmethod def getpc(cls, attrib = None): return PC @classmethod def getsp(cls, attrib = None): return SP def additional_info(self): info = additional_info() info.lnk = False if hasattr(self, "lnk"): info.lnk = self.lnk.value != 0 info.cond = self.cond.value return info @classmethod def getbits(cls, bs, attrib, start, n): if not n: return 0 o = 0 if n > bs.getlen() * 8: raise ValueError('not enought bits %r %r' % (n, len(bs.bin) * 8)) while n: offset = start / 8 n_offset = cls.endian_offset(attrib, offset) c = cls.getbytes(bs, n_offset, 1) if not c: raise IOError c = ord(c) r = 8 - start % 8 c &= (1 << r) - 1 l = min(r, n) c >>= (r - l) o <<= l o |= c n -= l start += l return o @classmethod def endian_offset(cls, attrib, offset): if attrib == "l": return (offset & ~3) + 3 - offset % 4 elif attrib == "b": return offset else: raise NotImplementedError('bad attrib') @classmethod def check_mnemo(cls, fields): l = sum([x.l for x in fields]) assert l == 32, "len %r" % l @classmethod def getmn(cls, name): return name.upper() @classmethod def mod_fields(cls, fields): l = sum([x.l for x in fields]) if l == 32: return fields return [bm_cond] + fields @classmethod def gen_modes(cls, subcls, name, bases, dct, fields): dct['mode'] = None return [(subcls, name, bases, dct, fields)] def value(self, mode): v = super(mn_arm, self).value(mode) if mode == 'l': return [x[::-1] for x in v] elif mode == 'b': return [x for x in v] else: raise NotImplementedError('bad attrib') def get_symbol_size(self, symbol, symbol_pool, mode): return 32 class mn_armt(cls_mn): name = "armt" regs = regs_module delayslot = 0 bintree = {} num = 0 all_mn = [] all_mn_mode = defaultdict(list) all_mn_name = defaultdict(list) all_mn_inst = defaultdict(list) pc = PC sp = SP instruction = instruction_armt max_instruction_len = 4 alignment = 4 @classmethod def getpc(cls, attrib = None): return PC @classmethod def getsp(cls, attrib = None): return SP def additional_info(self): info = additional_info() info.lnk = False if hasattr(self, "lnk"): info.lnk = self.lnk.value != 0 info.cond = 14 # COND_ALWAYS return info @classmethod def getbits(cls, bs, attrib, start, n): if not n: return 0 o = 0 if n > bs.getlen() * 8: raise ValueError('not enought bits %r %r' % (n, len(bs.bin) * 8)) while n: offset = start / 8 n_offset = cls.endian_offset(attrib, offset) c = cls.getbytes(bs, n_offset, 1) if not c: raise IOError c = ord(c) r = 8 - start % 8 c &= (1 << r) - 1 l = min(r, n) c >>= (r - l) o <<= l o |= c n -= l start += l return o @classmethod def endian_offset(cls, attrib, offset): if attrib == "l": return (offset & ~1) + 1 - offset % 2 elif attrib == "b": return offset else: raise NotImplementedError('bad attrib') @classmethod def check_mnemo(cls, fields): l = sum([x.l for x in fields]) assert l in [16, 32], "len %r" % l @classmethod def getmn(cls, name): return name.upper() @classmethod def mod_fields(cls, fields): return list(fields) @classmethod def gen_modes(cls, subcls, name, bases, dct, fields): dct['mode'] = None return [(subcls, name, bases, dct, fields)] def value(self, mode): v = super(mn_armt, self).value(mode) if mode == 'l': out = [] for x in v: if len(x) == 2: out.append(x[::-1]) elif len(x) == 4: out.append(x[:2][::-1] + x[2:4][::-1]) return out elif mode == 'b': return [x for x in v] else: raise NotImplementedError('bad attrib') def get_args_expr(self): args = [a.expr for a in self.args] return args def get_symbol_size(self, symbol, symbol_pool, mode): return 32 class arm_reg(reg_noarg, m_arg): pass class arm_gpreg_noarg(reg_noarg): reg_info = gpregs parser = reg_info.parser class arm_gpreg(arm_reg): reg_info = gpregs parser = reg_info.parser class arm_reg_wb(arm_reg): reg_info = gpregs parser = gpregs_wb def decode(self, v): v = v & self.lmask e = self.reg_info.expr[v] if self.parent.wback.value: e = ExprOp('wback', e) self.expr = e return True def encode(self): e = self.expr self.parent.wback.value = 0 if isinstance(e, ExprOp) and e.op == 'wback': self.parent.wback.value = 1 e = e.args[0] if isinstance(e, ExprId): self.value = self.reg_info.expr.index(e) else: self.parent.wback.value = 1 self.value = self.reg_info.expr.index(e.args[0]) return True class arm_psr(m_arg): parser = psr_p def decode(self, v): v = v & self.lmask if self.parent.psr.value == 0: e = cpsr_regs.expr[v] else: e = spsr_regs.expr[v] self.expr = e return True def encode(self): e = self.expr if e in spsr_regs.expr: self.parent.psr.value = 1 v = spsr_regs.expr.index(e) elif e in cpsr_regs.expr: self.parent.psr.value = 0 v = cpsr_regs.expr.index(e) else: return False self.value = v return True class arm_cpreg(arm_reg): reg_info = cp_regs parser = reg_info.parser class arm_preg(arm_reg): reg_info = p_regs parser = reg_info.parser class arm_imm(imm_noarg, m_arg): parser = base_expr class arm_offs(arm_imm): parser = base_expr def int2expr(self, v): if v & ~self.intmask != 0: return None return ExprInt_fromsize(self.intsize, v) def decodeval(self, v): v <<= 2 # Add pipeline offset v += 8 return v def encodeval(self, v): if v%4 != 0: return False # Remove pipeline offset v -= 8 return v >> 2 def decode(self, v): v = v & self.lmask if (1 << (self.l - 1)) & v: v |= ~0 ^ self.lmask v = self.decodeval(v) self.expr = ExprInt32(v) return True def encode(self): if not isinstance(self.expr, ExprInt): return False v = int(self.expr.arg) if (1 << (self.l - 1)) & v: v = -((0xffffffff ^ v) + 1) v = self.encodeval(v) self.value = (v & 0xffffffff) & self.lmask return True class arm_imm8_12(m_arg): parser = deref def decode(self, v): v = v & self.lmask if self.parent.updown.value: e = ExprInt32(v << 2) else: e = ExprInt32(-v << 2) if self.parent.ppi.value: e = ExprOp('preinc', self.parent.rn.expr, e) else: e = ExprOp('postinc', self.parent.rn.expr, e) if self.parent.wback.value == 1: e = ExprOp('wback', e) self.expr = ExprMem(e) return True def encode(self): self.parent.updown.value = 1 e = self.expr if not isinstance(e, ExprMem): return False e = e.arg if isinstance(e, ExprOp) and e.op == 'wback': self.parent.wback.value = 1 e = e.args[0] else: self.parent.wback.value = 0 if e.op == "postinc": self.parent.ppi.value = 0 elif e.op == "preinc": self.parent.ppi.value = 1 else: # XXX default self.parent.ppi.value = 1 self.parent.rn.expr = e.args[0] if len(e.args) == 1: self.value = 0 return True e = e.args[1] if not isinstance(e, ExprInt): log.debug('should be int %r', e) return False v = int(e.arg) if v < 0 or v & (1 << 31): self.parent.updown.value = 0 v = -v & 0xFFFFFFFF if v & 0x3: log.debug('arg should be 4 aligned') return False v >>= 2 self.value = v return True class arm_imm_4_12(m_arg): parser = base_expr def decode(self, v): v = v & self.lmask imm = (self.parent.imm4.value << 12) | v self.expr = ExprInt32(imm) return True def encode(self): if not isinstance(self.expr, ExprInt): return False v = int(self.expr.arg) if v > 0xffff: return False self.parent.imm4.value = v >> 12 self.value = v & 0xfff return True class arm_op2(m_arg): parser = shift_off def str_to_imm_rot_form(self, s, neg=False): if neg: s = -s & 0xffffffff for i in xrange(0, 32, 2): v = myrol32(s, i) if 0 <= v < 0x100: return ((i / 2) << 8) | v return None def decode(self, v): val = v & self.lmask if self.parent.immop.value: rot = val >> 8 imm = val & 0xff imm = myror32(imm, rot * 2) self.expr = ExprInt32(imm) return True rm = val & 0xf shift = val >> 4 shift_kind = shift & 1 shift_type = (shift >> 1) & 3 shift >>= 3 # print self.parent.immop.value, hex(shift), hex(shift_kind), # hex(shift_type) if shift_kind: # shift kind is reg if shift & 1: # log.debug('error in shift1') return False rs = shift >> 1 if rs == 0xf: # log.debug('error in shift2') return False shift_op = regs_expr[rs] else: # shift kind is imm amount = shift shift_op = ExprInt32(amount) a = regs_expr[rm] if shift_op == ExprInt32(0): if shift_type == 3: self.expr = ExprOp(allshifts[4], a) else: self.expr = a else: self.expr = ExprOp(allshifts[shift_type], a, shift_op) return True def encode(self): e = self.expr # pure imm if isinstance(e, ExprInt): val = self.str_to_imm_rot_form(int(e.arg)) if val is None: return False self.parent.immop.value = 1 self.value = val return True self.parent.immop.value = 0 # pure reg if isinstance(e, ExprId): rm = gpregs.expr.index(e) shift_kind = 0 shift_type = 0 amount = 0 self.value = ( ((((amount << 2) | shift_type) << 1) | shift_kind) << 4) | rm return True # rot reg if not isinstance(e, ExprOp): log.debug('bad reg rot1 %r', e) return False rm = gpregs.expr.index(e.args[0]) shift_type = allshifts.index(e.op) if e.op == 'rrx': shift_kind = 0 amount = 0 shift_type = 3 elif isinstance(e.args[1], ExprInt): shift_kind = 0 amount = int(e.args[1].arg) # LSR/ASR of 32 => 0 if amount == 32 and e.op in ['>>', 'a>>']: amount = 0 else: shift_kind = 1 amount = gpregs.expr.index(e.args[1]) << 1 self.value = ( ((((amount << 2) | shift_type) << 1) | shift_kind) << 4) | rm return True # op2imm + rn class arm_op2imm(arm_imm8_12): parser = deref def str_to_imm_rot_form(self, s, neg=False): if neg: s = -s & 0xffffffff if 0 <= s < (1 << 12): return s return None def decode(self, v): val = v & self.lmask if self.parent.immop.value == 0: imm = val if self.parent.updown.value == 0: imm = -imm if self.parent.ppi.value: e = ExprOp('preinc', self.parent.rn.expr, ExprInt32(imm)) else: e = ExprOp('postinc', self.parent.rn.expr, ExprInt32(imm)) if self.parent.wback.value == 1: e = ExprOp('wback', e) self.expr = ExprMem(e) return True rm = val & 0xf shift = val >> 4 shift_kind = shift & 1 shift_type = (shift >> 1) & 3 shift >>= 3 # print self.parent.immop.value, hex(shift), hex(shift_kind), # hex(shift_type) if shift_kind: # log.debug('error in disasm xx') return False else: # shift kind is imm amount = shift shift_op = ExprInt32(amount) a = regs_expr[rm] if shift_op == ExprInt32(0): pass else: a = ExprOp(allshifts[shift_type], a, shift_op) if self.parent.ppi.value: e = ExprOp('preinc', self.parent.rn.expr, a) else: e = ExprOp('postinc', self.parent.rn.expr, a) if self.parent.wback.value == 1: e = ExprOp('wback', e) self.expr = ExprMem(e) return True def encode(self): self.parent.immop.value = 1 self.parent.updown.value = 1 e = self.expr assert(isinstance(e, ExprMem)) e = e.arg if e.op == 'wback': self.parent.wback.value = 1 e = e.args[0] else: self.parent.wback.value = 0 if e.op == "postinc": self.parent.ppi.value = 0 elif e.op == "preinc": self.parent.ppi.value = 1 else: # XXX default self.parent.ppi.value = 1 # if len(v) <1: # raise ValueError('cannot parse', s) self.parent.rn.fromstring(e.args[0]) if len(e.args) == 1: self.parent.immop.value = 0 self.value = 0 return True # pure imm if isinstance(e.args[1], ExprInt): self.parent.immop.value = 0 val = self.str_to_imm_rot_form(int(e.args[1].arg)) if val is None: val = self.str_to_imm_rot_form(int(e.args[1].arg), True) if val is None: log.debug('cannot encode inm') return False self.parent.updown.value = 0 self.value = val return True # pure reg if isinstance(e.args[1], ExprId): rm = gpregs.expr.index(e.args[1]) shift_kind = 0 shift_type = 0 amount = 0 self.value = ( ((((amount << 2) | shift_type) << 1) | shift_kind) << 4) | rm return True # rot reg if not isinstance(e.args[1], ExprOp): log.debug('bad reg rot2 %r', e) return False e = e.args[1] rm = gpregs.expr.index(e.args[0]) shift_type = allshifts.index(e.op) if isinstance(e.args[1], ExprInt): shift_kind = 0 amount = int(e.args[1].arg) else: shift_kind = 1 amount = gpregs.expr.index(e.args[1]) << 1 self.value = ( ((((amount << 2) | shift_type) << 1) | shift_kind) << 4) | rm return True def reglist2str(rlist): out = [] i = 0 while i < len(rlist): j = i + 1 while j < len(rlist) and rlist[j] < 13 and rlist[j] == rlist[j - 1] + 1: j += 1 j -= 1 if j < i + 2: out.append(regs_str[rlist[i]]) i += 1 else: out.append(regs_str[rlist[i]] + '-' + regs_str[rlist[j]]) i = j + 1 return "{" + ", ".join(out) + '}' class arm_rlist(m_arg): parser = gpreg_list def encode(self): self.parent.sbit.value = 0 e = self.expr if isinstance(e, ExprOp) and e.op == "sbit": e = e.args[0] self.parent.sbit.value = 1 rlist = [gpregs.expr.index(x) for x in e.args] v = 0 for r in rlist: v |= 1 << r self.value = v return True def decode(self, v): v = v & self.lmask out = [] for i in xrange(0x10): if 1 << i & v: out.append(gpregs.expr[i]) if not out: return False e = ExprOp('reglist', *out) if self.parent.sbit.value == 1: e = ExprOp('sbit', e) self.expr = e return True class updown_b_nosp_mn(bs_mod_name): mn_mod = ['D', 'I'] def modname(self, name, f_i): return name + self.args['mn_mod'][f_i] class ppi_b_nosp_mn(bs_mod_name): prio = 5 mn_mod = ['A', 'B'] class updown_b_sp_mn(bs_mod_name): mn_mod = ['A', 'D'] def modname(self, name, f_i): if name.startswith("STM"): f_i = [1, 0][f_i] return name + self.args['mn_mod'][f_i] class ppi_b_sp_mn(bs_mod_name): mn_mod = ['F', 'E'] def modname(self, name, f_i): if name.startswith("STM"): f_i = [1, 0][f_i] return name + self.args['mn_mod'][f_i] class arm_reg_wb_nosp(arm_reg_wb): def decode(self, v): v = v & self.lmask if v == 13: return False e = self.reg_info.expr[v] if self.parent.wback.value: e = ExprOp('wback', e) self.expr = e return True class arm_offs_blx(arm_imm): def decode(self, v): v = v & self.lmask v = (v << 2) + (self.parent.lowb.value << 1) v = sign_ext(v, 26, 32) # Add pipeline offset v += 8 self.expr = ExprInt32(v) return True def encode(self): if not isinstance(self.expr, ExprInt): return False # Remove pipeline offset v = int(self.expr.arg - 8) if v & 0x80000000: v &= (1 << 26) - 1 self.parent.lowb.value = (v >> 1) & 1 self.value = v >> 2 return True class bs_lnk(bs_mod_name): def modname(self, name, i): return name[:1] + self.args['mn_mod'][i] + name[1:] accum = bs(l=1) scc = bs_mod_name(l=1, fname='scc', mn_mod=['', 'S']) dumscc = bs("1") rd = bs(l=4, cls=(arm_gpreg,)) rdl = bs(l=4, cls=(arm_gpreg,)) rn = bs(l=4, cls=(arm_gpreg,), fname="rn") rs = bs(l=4, cls=(arm_gpreg,)) rm = bs(l=4, cls=(arm_gpreg,)) op2 = bs(l=12, cls=(arm_op2,)) lnk = bs_lnk(l=1, fname='lnk', mn_mod=['', 'L']) offs = bs(l=24, cls=(arm_offs,), fname="offs") rn_noarg = bs(l=4, cls=(arm_gpreg_noarg,), fname="rn") rm_noarg = bs(l=4, cls=(arm_gpreg_noarg,), fname="rm", order = -1) immop = bs(l=1, fname='immop') dumr = bs(l=4, default_val="0000", fname="dumr") # psr = bs(l=1, cls=(arm_psr,), fname="psr") psr = bs(l=1, fname="psr") psr_field = bs(l=4, cls=(arm_psr,)) ppi = bs(l=1, fname='ppi') updown = bs(l=1, fname='updown') trb = bs_mod_name(l=1, fname='trb', mn_mod=['', 'B']) wback = bs_mod_name(l=1, fname="wback", mn_mod=['', 'T']) wback_no_t = bs(l=1, fname="wback") op2imm = bs(l=12, cls=(arm_op2imm,)) updown_b_nosp = updown_b_nosp_mn(l=1, mn_mod=['D', 'I'], fname='updown') ppi_b_nosp = ppi_b_nosp_mn(l=1, mn_mod=['A', 'B'], fname='ppi') updown_b_sp = updown_b_sp_mn(l=1, mn_mod=['A', 'D'], fname='updown') ppi_b_sp = ppi_b_sp_mn(l=1, mn_mod=['F', 'E'], fname='ppi') sbit = bs(l=1, fname="sbit") rn_sp = bs("1101", cls=(arm_reg_wb,), fname='rnsp') rn_wb = bs(l=4, cls=(arm_reg_wb_nosp,), fname='rn') rlist = bs(l=16, cls=(arm_rlist,), fname='rlist') swi_i = bs(l=24, cls=(arm_imm,), fname="swi_i") opc = bs(l=4, cls=(arm_imm, m_arg), fname='opc') crn = bs(l=4, cls=(arm_cpreg,), fname='crn') crd = bs(l=4, cls=(arm_cpreg,), fname='crd') crm = bs(l=4, cls=(arm_cpreg,), fname='crm') cpnum = bs(l=4, cls=(arm_preg,), fname='cpnum') cp = bs(l=3, cls=(arm_imm, m_arg), fname='cp') imm8_12 = bs(l=8, cls=(arm_imm8_12, m_arg), fname='imm') tl = bs_mod_name(l=1, fname="tl", mn_mod=['', 'L']) cpopc = bs(l=3, cls=(arm_imm, m_arg), fname='cpopc') imm20 = bs(l=20, cls=(arm_imm, m_arg)) imm4 = bs(l=4, cls=(arm_imm, m_arg)) imm12 = bs(l=12, cls=(arm_imm, m_arg)) imm16 = bs(l=16, cls=(arm_imm, m_arg)) imm4_noarg = bs(l=4, fname="imm4") imm_4_12 = bs(l=12, cls=(arm_imm_4_12,)) lowb = bs(l=1, fname='lowb') offs_blx = bs(l=24, cls=(arm_offs_blx,), fname="offs") fix_cond = bs("1111", fname="cond") class mul_part_x(bs_mod_name): prio = 5 mn_mod = ['B', 'T'] class mul_part_y(bs_mod_name): prio = 6 mn_mod = ['B', 'T'] mul_x = mul_part_x(l=1, fname='x', mn_mod=['B', 'T']) mul_y = mul_part_y(l=1, fname='y', mn_mod=['B', 'T']) class arm_immed(m_arg): parser = deref def decode(self, v): if self.parent.immop.value == 1: imm = ExprInt32((self.parent.immedH.value << 4) | v) else: imm = gpregs.expr[v] if self.parent.updown.value == 0: imm = -imm if self.parent.ppi.value: e = ExprOp('preinc', self.parent.rn.expr, imm) else: e = ExprOp('postinc', self.parent.rn.expr, imm) if self.parent.wback.value == 1: e = ExprOp('wback', e) self.expr = ExprMem(e) return True def encode(self): self.parent.immop.value = 1 self.parent.updown.value = 1 e = self.expr if not isinstance(e, ExprMem): return False e = e.arg if isinstance(e, ExprOp) and e.op == 'wback': self.parent.wback.value = 1 e = e.args[0] else: self.parent.wback.value = 0 if e.op == "postinc": self.parent.ppi.value = 0 elif e.op == "preinc": self.parent.ppi.value = 1 else: # XXX default self.parent.ppi.value = 1 self.parent.rn.expr = e.args[0] if len(e.args) == 1: self.value = 0 self.parent.immedH.value = 0 return True e = e.args[1] if isinstance(e, ExprInt): v = int(e.arg) if v < 0 or v & (1 << 31): self.parent.updown.value = 0 v = (-v) & 0xFFFFFFFF if v > 0xff: log.debug('cannot encode imm XXX') return False self.value = v & 0xF self.parent.immedH.value = v >> 4 return True self.parent.immop.value = 0 if isinstance(e, ExprOp) and len(e.args) == 1 and e.op == "-": self.parent.updown.value = 0 e = e.args[0] if e in gpregs.expr: self.value = gpregs.expr.index(e) self.parent.immedH.value = 0x0 return True else: raise ValueError('e should be int: %r' % e) immedH = bs(l=4, fname='immedH') immedL = bs(l=4, cls=(arm_immed, m_arg), fname='immedL') hb = bs(l=1) class armt2_rot_rm(m_arg): parser = shift_off def decode(self, v): r = self.parent.rm.expr if v == 00: e = r else: raise NotImplementedError('rotation') self.expr = e return True def encode(self): e = self.expr if isinstance(e, ExprId): self.value = 0 else: raise NotImplementedError('rotation') return True rot_rm = bs(l=2, cls=(armt2_rot_rm,), fname="rot_rm") def armop(name, fields, args=None, alias=False): dct = {"fields": fields} dct["alias"] = alias if args is not None: dct['args'] = args type(name, (mn_arm,), dct) def armtop(name, fields, args=None, alias=False): dct = {"fields": fields} dct["alias"] = alias if args is not None: dct['args'] = args type(name, (mn_armt,), dct) op_list = ['AND', 'EOR', 'SUB', 'RSB', 'ADD', 'ADC', 'SBC', 'RSC', 'TST', 'TEQ', 'CMP', 'CMN', 'ORR', 'MOV', 'BIC', 'MVN'] data_mov_name = {'MOV': 13, 'MVN': 15} data_test_name = {'TST': 8, 'TEQ': 9, 'CMP': 10, 'CMN': 11} data_name = {} for i, n in enumerate(op_list): if n in data_mov_name.keys() + data_test_name.keys(): continue data_name[n] = i bs_data_name = bs_name(l=4, name=data_name) bs_data_mov_name = bs_name(l=4, name=data_mov_name) bs_data_test_name = bs_name(l=4, name=data_test_name) transfer_name = {'STR': 0, 'LDR': 1} bs_transfer_name = bs_name(l=1, name=transfer_name) transferh_name = {'STRH': 0, 'LDRH': 1} bs_transferh_name = bs_name(l=1, name=transferh_name) transfer_ldr_name = {'LDRD': 0, 'LDRSB': 1} bs_transfer_ldr_name = bs_name(l=1, name=transfer_ldr_name) btransfer_name = {'STM': 0, 'LDM': 1} bs_btransfer_name = bs_name(l=1, name=btransfer_name) ctransfer_name = {'STC': 0, 'LDC': 1} bs_ctransfer_name = bs_name(l=1, name=ctransfer_name) mr_name = {'MCR': 0, 'MRC': 1} bs_mr_name = bs_name(l=1, name=mr_name) armop("mul", [bs('000000'), bs('0'), scc, rd, bs('0000'), rs, bs('1001'), rm], [rd, rm, rs]) armop("umull", [bs('000010'), bs('0'), scc, rd, rdl, rs, bs('1001'), rm], [rdl, rd, rm, rs]) armop("umlal", [bs('000010'), bs('1'), scc, rd, rdl, rs, bs('1001'), rm], [rdl, rd, rm, rs]) armop("smull", [bs('000011'), bs('0'), scc, rd, rdl, rs, bs('1001'), rm], [rdl, rd, rm, rs]) armop("smlal", [bs('000011'), bs('1'), scc, rd, rdl, rs, bs('1001'), rm], [rdl, rd, rm, rs]) armop("mla", [bs('000000'), bs('1'), scc, rd, rn, rs, bs('1001'), rm], [rd, rm, rs, rn]) armop("mrs", [bs('00010'), psr, bs('00'), psr_field, rd, bs('000000000000')], [rd, psr]) armop("msr", [bs('00010'), psr, bs('10'), psr_field, bs('1111'), bs('0000'), bs('0000'), rm], [psr_field, rm]) armop("data", [bs('00'), immop, bs_data_name, scc, rn, rd, op2], [rd, rn, op2]) armop("data_mov", [bs('00'), immop, bs_data_mov_name, scc, bs('0000'), rd, op2], [rd, op2]) armop("data_test", [bs('00'), immop, bs_data_test_name, dumscc, rn, dumr, op2]) armop("b", [bs('101'), lnk, offs]) armop("smul", [bs('00010110'), rd, bs('0000'), rs, bs('1'), mul_y, mul_x, bs('0'), rm], [rd, rm, rs]) # TODO TEST #armop("und", [bs('011'), imm20, bs('1'), imm4]) armop("transfer", [bs('01'), immop, ppi, updown, trb, wback_no_t, bs_transfer_name, rn_noarg, rd, op2imm], [rd, op2imm]) armop("transferh", [bs('000'), ppi, updown, immop, wback_no_t, bs_transferh_name, rn_noarg, rd, immedH, bs('1011'), immedL], [rd, immedL]) armop("ldrd", [bs('000'), ppi, updown, immop, wback_no_t, bs_transfer_ldr_name, rn_noarg, rd, immedH, bs('1101'), immedL], [rd, immedL]) armop("ldrsh", [bs('000'), ppi, updown, immop, wback_no_t, bs('1'), rn_noarg, rd, immedH, bs('1'), bs('1'), bs('1'), bs('1'), immedL], [rd, immedL]) armop("strd", [bs('000'), ppi, updown, immop, wback_no_t, bs('0'), rn_noarg, rd, immedH, bs('1'), bs('1'), bs('1'), bs('1'), immedL], [rd, immedL]) armop("btransfersp", [bs('100'), ppi_b_sp, updown_b_sp, sbit, wback_no_t, bs_btransfer_name, rn_sp, rlist]) armop("btransfer", [bs('100'), ppi_b_nosp, updown_b_nosp, sbit, wback_no_t, bs_btransfer_name, rn_wb, rlist]) # TODO: TEST armop("swp", [bs('00010'), trb, bs('00'), rn, rd, bs('0000'), bs('1001'), rm]) armop("svc", [bs('1111'), swi_i]) armop("cdp", [bs('1110'), opc, crn, crd, cpnum, cp, bs('0'), crm], [cpnum, opc, crd, crn, crm, cp]) armop("cdata", [bs('110'), ppi, updown, tl, wback_no_t, bs_ctransfer_name, rn_noarg, crd, cpnum, imm8_12], [cpnum, crd, imm8_12]) armop("mr", [bs('1110'), cpopc, bs_mr_name, crn, rd, cpnum, cp, bs('1'), crm], [cpnum, cpopc, rd, crn, crm, cp]) armop("bkpt", [bs('00010010'), imm12, bs('0111'), imm4]) armop("bx", [bs('000100101111111111110001'), rn]) armop("mov", [bs('00110000'), imm4_noarg, rd, imm_4_12], [rd, imm_4_12]) armop("movt", [bs('00110100'), imm4_noarg, rd, imm_4_12], [rd, imm_4_12]) armop("blx", [bs('00010010'), bs('1111'), bs('1111'), bs('1111'), bs('0011'), rm], [rm]) armop("blx", [fix_cond, bs('101'), lowb, offs_blx], [offs_blx]) armop("clz", [bs('00010110'), bs('1111'), rd, bs('1111'), bs('0001'), rm], [rd, rm]) armop("qadd", [bs('00010000'), rn, rd, bs('0000'), bs('0101'), rm], [rd, rm, rn]) armop("uxtb", [bs('01101110'), bs('1111'), rd, rot_rm, bs('00'), bs('0111'), rm_noarg]) armop("uxth", [bs('01101111'), bs('1111'), rd, rot_rm, bs('00'), bs('0111'), rm_noarg]) armop("sxtb", [bs('01101010'), bs('1111'), rd, rot_rm, bs('00'), bs('0111'), rm_noarg]) armop("sxth", [bs('01101011'), bs('1111'), rd, rot_rm, bs('00'), bs('0111'), rm_noarg]) armop("rev", [bs('01101011'), bs('1111'), rd, bs('1111'), bs('0011'), rm]) class arm_widthm1(arm_imm, m_arg): def decode(self, v): self.expr = ExprInt32(v+1) return True def encode(self): if not isinstance(self.expr, ExprInt): return False v = int(self.expr.arg) + -1 self.value = v return True widthm1 = bs(l=5, cls=(arm_widthm1, m_arg)) lsb = bs(l=5, cls=(arm_imm, m_arg)) armop("ubfx", [bs('0111111'), widthm1, rd, lsb, bs('101'), rn], [rd, rn, lsb, widthm1]) armop("bfc", [bs('0111110'), widthm1, rd, lsb, bs('001'), bs('1111')], [rd, lsb, widthm1]) # # thumnb ####################### # # ARM7-TDMI-manual-pt3 gpregs_l = reg_info(regs_str[:8], regs_expr[:8]) gpregs_h = reg_info(regs_str[8:], regs_expr[8:]) gpregs_sppc = reg_info(regs_str[-1:] + regs_str[13:14], regs_expr[-1:] + regs_expr[13:14]) deref_low = Group(LBRACK + gpregs_l.parser + Optional( COMMA + shift_off) + RBRACK).setParseAction(deref2expr_pre_mem) deref_pc = Group(LBRACK + gpregs_pc.parser + Optional( COMMA + shift_off) + RBRACK).setParseAction(deref2expr_pre_mem) deref_sp = Group(LBRACK + gpregs_sp.parser + COMMA + shift_off + RBRACK).setParseAction(deref2expr_pre_mem) gpregs_l_wb = Group( gpregs_l.parser + Optional('!')).setParseAction(parsegpreg_wb) class arm_offreg(m_arg): parser = deref_pc def decodeval(self, v): return v def encodeval(self, v): return v def decode(self, v): v = v & self.lmask v = self.decodeval(v) if v: self.expr = self.off_reg + ExprInt32(v) else: self.expr = self.off_reg e = self.expr if isinstance(e, ExprOp) and e.op == 'wback': self.parent.wback.value = 1 e = e.args[0] return True def encode(self): e = self.expr if not (isinstance(e, ExprOp) and e.op == "preinc"): log.debug('cannot encode %r', e) return False if e.args[0] != self.off_reg: log.debug('cannot encode reg %r', e.args[0]) return False v = int(e.args[1].arg) v = self.encodeval(v) self.value = v return True class arm_offpc(arm_offreg): off_reg = regs_expr[15] def decode(self, v): v = v & self.lmask v <<= 2 if v: self.expr = ExprMem(self.off_reg + ExprInt32(v)) else: self.expr = ExprMem(self.off_reg) e = self.expr.arg if isinstance(e, ExprOp) and e.op == 'wback': self.parent.wback.value = 1 e = e.args[0] return True def encode(self): e = self.expr if not isinstance(e, ExprMem): return False e = e.arg if not (isinstance(e, ExprOp) and e.op == "preinc"): log.debug('cannot encode %r', e) return False if e.args[0] != self.off_reg: log.debug('cannot encode reg %r', e.args[0]) return False v = int(e.args[1].arg) v >>= 2 self.value = v return True class arm_offsp(arm_offpc): parser = deref_sp off_reg = regs_expr[13] class arm_offspc(arm_offs): def decodeval(self, v): v = v << 1 # Add pipeline offset v += 2 + 2 return v def encodeval(self, v): # Remove pipeline offset v -= 2 + 2 if v % 2 == 0: return v >> 1 return False class arm_off8sppc(arm_imm): def decodeval(self, v): return v << 2 def encodeval(self, v): return v >> 2 class arm_off7(arm_imm): def decodeval(self, v): return v << 2 def encodeval(self, v): return v >> 2 class arm_deref(m_arg): parser = deref_low def decode(self, v): v = v & self.lmask rbase = regs_expr[v] e = ExprOp('preinc', rbase, self.parent.off.expr) self.expr = ExprMem(e) return True def encode(self): e = self.expr if not isinstance(e, ExprMem): return False e = e.arg if not (isinstance(e, ExprOp) and e.op == 'preinc'): log.debug('cannot encode %r', e) return False off = e.args[1] if isinstance(off, ExprId): self.parent.off.expr = off elif isinstance(off, ExprInt): self.parent.off.expr = off else: log.debug('cannot encode off %r', off) return False self.value = gpregs.expr.index(e.args[0]) if self.value >= 1 << self.l: log.debug('cannot encode reg %r', off) return False return True class arm_offbw(imm_noarg): def decode(self, v): v = v & self.lmask if self.parent.trb.value == 0: v <<= 2 self.expr = ExprInt32(v) return True def encode(self): if not isinstance(self.expr, ExprInt): return False v = int(self.expr.arg) if self.parent.trb.value == 0: if v & 3: log.debug('off must be aligned %r', v) return False v >>= 2 self.value = v return True class arm_offh(imm_noarg): def decode(self, v): v = v & self.lmask v <<= 1 self.expr = ExprInt32(v) return True def encode(self): if not isinstance(self.expr, ExprInt): return False v = int(self.expr.arg) if v & 1: log.debug('off must be aligned %r', v) return False v >>= 1 self.value = v return True class armt_rlist(m_arg): parser = gpreg_list def encode(self): e = self.expr rlist = [gpregs_l.expr.index(x) for x in e.args] v = 0 for r in rlist: v |= 1 << r self.value = v return True def decode(self, v): v = v & self.lmask out = [] for i in xrange(0x10): if 1 << i & v: out.append(gpregs.expr[i]) if not out: return False e = ExprOp('reglist', *out) self.expr = e return True class armt_rlist_pclr(armt_rlist): def encode(self): e = self.expr reg_l = list(e.args) self.parent.pclr.value = 0 if self.parent.pp.value == 0: # print 'push' if regs_expr[14] in reg_l: reg_l.remove(regs_expr[14]) self.parent.pclr.value = 1 else: # print 'pop', if regs_expr[15] in reg_l: reg_l.remove(regs_expr[15]) self.parent.pclr.value = 1 rlist = [gpregs.expr.index(x) for x in reg_l] v = 0 for r in rlist: v |= 1 << r self.value = v return True def decode(self, v): v = v & self.lmask out = [] for i in xrange(0x10): if 1 << i & v: out.append(gpregs.expr[i]) if self.parent.pclr.value == 1: if self.parent.pp.value == 0: out += [regs_expr[14]] else: out += [regs_expr[15]] if not out: return False e = ExprOp('reglist', *out) self.expr = e return True class armt_reg_wb(arm_reg_wb): reg_info = gpregs_l parser = gpregs_l_wb def decode(self, v): v = v & self.lmask e = self.reg_info.expr[v] if not e in self.parent.trlist.expr.args: e = ExprOp('wback', e) self.expr = e return True def encode(self): e = self.expr if isinstance(e, ExprOp): if e.op != 'wback': return False e = e.args[0] self.value = self.reg_info.expr.index(e) return True class arm_gpreg_l(arm_reg): reg_info = gpregs_l parser = reg_info.parser class arm_gpreg_h(arm_reg): reg_info = gpregs_h parser = reg_info.parser class arm_gpreg_l_noarg(arm_gpreg_noarg): reg_info = gpregs_l parser = reg_info.parser class arm_sppc(arm_reg): reg_info = gpregs_sppc parser = reg_info.parser class arm_sp(arm_reg): reg_info = gpregs_sp parser = reg_info.parser off5 = bs(l=5, cls=(arm_imm,), fname="off") off3 = bs(l=3, cls=(arm_imm,), fname="off") off8 = bs(l=8, cls=(arm_imm,), fname="off") off7 = bs(l=7, cls=(arm_off7,), fname="off") rdl = bs(l=3, cls=(arm_gpreg_l,), fname="rd") rnl = bs(l=3, cls=(arm_gpreg_l,), fname="rn") rsl = bs(l=3, cls=(arm_gpreg_l,), fname="rs") rml = bs(l=3, cls=(arm_gpreg_l,), fname="rm") rol = bs(l=3, cls=(arm_gpreg_l,), fname="ro") rbl = bs(l=3, cls=(arm_gpreg_l,), fname="rb") rbl_deref = bs(l=3, cls=(arm_deref,), fname="rb") dumrh = bs(l=3, default_val="000") rdh = bs(l=3, cls=(arm_gpreg_h,), fname="rd") rsh = bs(l=3, cls=(arm_gpreg_h,), fname="rs") offpc8 = bs(l=8, cls=(arm_offpc,), fname="offs") offsp8 = bs(l=8, cls=(arm_offsp,), fname="offs") rol_noarg = bs(l=3, cls=(arm_gpreg_l_noarg,), fname="off") off5bw = bs(l=5, cls=(arm_offbw,), fname="off") off5h = bs(l=5, cls=(arm_offh,), fname="off") sppc = bs(l=1, cls=(arm_sppc,)) pclr = bs(l=1, fname='pclr') sp = bs(l=0, cls=(arm_sp,)) off8s = bs(l=8, cls=(arm_offs,), fname="offs") trlistpclr = bs(l=8, cls=(armt_rlist_pclr,)) trlist = bs(l=8, cls=(armt_rlist,), fname="trlist", order = -1) rbl_wb = bs(l=3, cls=(armt_reg_wb,), fname='rb') offs8 = bs(l=8, cls=(arm_offspc,), fname="offs") offs11 = bs(l=11, cls=(arm_offspc,), fname="offs") hl = bs(l=1, prio=default_prio + 1, fname='hl') off8sppc = bs(l=8, cls=(arm_off8sppc,), fname="off") imm8_d1 = bs(l=8, default_val="00000001") imm8 = bs(l=8, cls=(arm_imm,), default_val = "00000001") mshift_name = {'LSLS': 0, 'LSRS': 1, 'ASRS': 2} bs_mshift_name = bs_name(l=2, name=mshift_name) addsub_name = {'ADDS': 0, 'SUBS': 1} bs_addsub_name = bs_name(l=1, name=addsub_name) mov_cmp_add_sub_name = {'MOVS': 0, 'CMP': 1, 'ADDS': 2, 'SUBS': 3} bs_mov_cmp_add_sub_name = bs_name(l=2, name=mov_cmp_add_sub_name) alu_name = {'ANDS': 0, 'EORS': 1, 'LSLS': 2, 'LSRS': 3, 'ASRS': 4, 'ADCS': 5, 'SBCS': 6, 'RORS': 7, 'TST': 8, 'NEGS': 9, 'CMP': 10, 'CMN': 11, 'ORRS': 12, 'MULS': 13, 'BICS': 14, 'MVNS': 15} bs_alu_name = bs_name(l=4, name=alu_name) hiregop_name = {'ADDS': 0, 'CMP': 1, 'MOV': 2} bs_hiregop_name = bs_name(l=2, name=hiregop_name) ldr_str_name = {'STR': 0, 'LDR': 1} bs_ldr_str_name = bs_name(l=1, name=ldr_str_name) ldrh_strh_name = {'STRH': 0, 'LDRH': 1} bs_ldrh_strh_name = bs_name(l=1, name=ldrh_strh_name) ldstsp_name = {'STR': 0, 'LDR': 1} bs_ldstsp_name = bs_name(l=1, name=ldstsp_name) addsubsp_name = {'ADD': 0, 'SUB': 1} bs_addsubsp_name = bs_name(l=1, name=addsubsp_name) pushpop_name = {'PUSH': 0, 'POP': 1} bs_pushpop_name = bs_name(l=1, name=pushpop_name, fname='pp') tbtransfer_name = {'STMIA': 0, 'LDMIA': 1} bs_tbtransfer_name = bs_name(l=1, name=tbtransfer_name) br_name = {'BEQ': 0, 'BNE': 1, 'BCS': 2, 'BCC': 3, 'BMI': 4, 'BPL': 5, 'BVS': 6, 'BVC': 7, 'BHI': 8, 'BLS': 9, 'BGE': 10, 'BLT': 11, 'BGT': 12, 'BLE': 13} bs_br_name = bs_name(l=4, name=br_name) armtop("mshift", [bs('000'), bs_mshift_name, off5, rsl, rdl], [rdl, rsl, off5]) armtop("addsubr", [bs('000110'), bs_addsub_name, rnl, rsl, rdl], [rdl, rsl, rnl]) armtop("addsubi", [bs('000111'), bs_addsub_name, off3, rsl, rdl], [rdl, rsl, off3]) armtop("mcas", [bs('001'), bs_mov_cmp_add_sub_name, rnl, off8]) armtop("alu", [bs('010000'), bs_alu_name, rsl, rdl], [rdl, rsl]) # should not be used ?? armtop("hiregop00", [bs('010001'), bs_hiregop_name, bs('00'), rsl, rdl], [rdl, rsl]) armtop("hiregop01", [bs('010001'), bs_hiregop_name, bs('01'), rsh, rdl], [rdl, rsh]) armtop("hiregop10", [bs('010001'), bs_hiregop_name, bs('10'), rsl, rdh], [rdh, rsl]) armtop("hiregop11", [bs('010001'), bs_hiregop_name, bs('11'), rsh, rdh], [rdh, rsh]) armtop("bx", [bs('010001'), bs('11'), bs('00'), rsl, dumrh]) armtop("bx", [bs('010001'), bs('11'), bs('01'), rsh, dumrh]) armtop("ldr", [bs('01001'), rdl, offpc8]) armtop("ldrstr", [bs('0101'), bs_ldr_str_name, trb, bs('0'), rol_noarg, rbl_deref, rdl], [rdl, rbl_deref]) armtop("strh", [bs('0101'), bs('00'), bs('1'), rol_noarg, rbl_deref, rdl], [rdl, rbl_deref]) armtop("ldrh", [bs('0101'), bs('10'), bs('1'), rol_noarg, rbl_deref, rdl], [rdl, rbl_deref]) armtop("ldsb", [bs('0101'), bs('01'), bs('1'), rol_noarg, rbl_deref, rdl], [rdl, rbl_deref]) armtop("ldsh", [bs('0101'), bs('11'), bs('1'), rol_noarg, rbl_deref, rdl], [rdl, rbl_deref]) armtop("ldst", [bs('011'), trb, bs_ldr_str_name, off5bw, rbl_deref, rdl], [rdl, rbl_deref]) armtop("ldhsth", [bs('1000'), bs_ldrh_strh_name, off5h, rbl_deref, rdl], [rdl, rbl_deref]) armtop("ldstsp", [bs('1001'), bs_ldstsp_name, rdl, offsp8], [rdl, offsp8]) armtop("add", [bs('1010'), sppc, rdl, off8sppc], [rdl, sppc, off8sppc]) armtop("addsp", [bs('10110000'), bs_addsubsp_name, sp, off7], [sp, off7]) armtop("pushpop", [bs('1011'), bs_pushpop_name, bs('10'), pclr, trlistpclr], [trlistpclr]) armtop("btransfersp", [bs('1100'), bs_tbtransfer_name, rbl_wb, trlist]) armtop("br", [bs('1101'), bs_br_name, offs8]) armtop("blx", [bs("01000111"), bs('10'), rnl, bs('000')]) armtop("svc", [bs('11011111'), imm8]) armtop("b", [bs('11100'), offs11]) armtop("und", [bs('1101'), bs('1110'), imm8_d1]) armtop("uxtb", [bs('10110010'), bs('11'), rml, rdl], [rdl, rml]) armtop("uxth", [bs('10110010'), bs('10'), rml, rdl], [rdl, rml]) armtop("sxtb", [bs('10110010'), bs('01'), rml, rdl], [rdl, rml]) armtop("sxth", [bs('10110010'), bs('00'), rml, rdl], [rdl, rml]) # thumb2 ###################### # # ARM Architecture Reference Manual Thumb-2 Supplement armt_gpreg_shift_off = Group( gpregs_nosppc.parser + allshifts_t_armt + base_expr ).setParseAction(shift2expr) armt_gpreg_shift_off |= gpregs_nosppc.parser class arm_gpreg_nosppc(arm_reg): reg_info = gpregs_nosppc class armt_gpreg_rm_shift_off(arm_reg): parser = armt_gpreg_shift_off def decode(self, v): v = v & self.lmask if v >= len(gpregs_nosppc.expr): return False r = gpregs_nosppc.expr[v] i = int(self.parent.imm5_3.value) << 2 i |= int(self.parent.imm5_2.value) if self.parent.stype.value < 3 or i != 0: shift = allshifts_armt[self.parent.stype.value] else: shift = allshifts_armt[4] self.expr = ExprOp(shift, r, ExprInt32(i)) return True def encode(self): e = self.expr if isinstance(e, ExprId): self.value = gpregs_nosppc.index(e) self.parent.stype.value = 0 self.parent.imm5_3.value = 0 self.parent.imm5_2.value = 0 return True shift = e.op r = gpregs_nosppc.expr.index(e.args[0]) self.value = r i = int(e.args[1].arg) if shift == 'rrx': if i != 1: log.debug('rrx shift must be 1') return False self.parent.imm5_3.value = 0 self.parent.imm5_2.value = 0 self.parent.stype.value = 3 return True self.parent.stype.value = allshifts_armt.index(shift) self.parent.imm5_2.value = i & 3 self.parent.imm5_3.value = i >> 2 return True rn_nosppc = bs(l=4, cls=(arm_gpreg_nosppc,), fname="rn") rd_nosppc = bs(l=4, cls=(arm_gpreg_nosppc,), fname="rd") rm_sh = bs(l=4, cls=(armt_gpreg_rm_shift_off,), fname="rm") class armt2_imm12(arm_imm): def decode(self, v): v = v & self.lmask v |= int(self.parent.imm12_3.value) << 8 v |= int(self.parent.imm12_1.value) << 11 # simple encoding if 0 <= v < 0x100: self.expr = ExprInt32(v) return True # 00XY00XY form if v >> 8 == 1: v &= 0xFF self.expr = ExprInt32((v << 16) | v) return True # XY00XY00 form if v >> 8 == 2: v &= 0xFF self.expr = ExprInt32((v << 24) | (v << 8)) return True # XYXYXYXY if v >> 8 == 3: v &= 0xFF self.expr = ExprInt32((v << 24) | (v << 16) | (v << 8) | v) return True r = v >> 7 v = v & 0xFF self.expr = ExprInt32(myror32(v, r)) return True def encode(self): v = int(self.expr.arg) value = None # simple encoding if 0 <= v < 0x100: value = v elif v & 0xFF00FF00 == 0 and v & 0xFF == (v >> 16) & 0xff: # 00XY00XY form value = (1 << 8) | (v & 0xFF) elif v & 0x00FF00FF == 0 and (v >> 8) & 0xff == (v >> 24) & 0xff: # XY00XY00 form value = (2 << 8) | ((v >> 8) & 0xff) elif (v & 0xFF == (v >> 8) & 0xFF == (v >> 16) & 0xFF == (v >> 24) & 0xFF): # XYXYXYXY form value = (3 << 8) | ((v >> 16) & 0xff) else: # rol encoding for i in xrange(32): o = myrol32(v, i) if 0 <= o < 0x100 and o & 0x80: value = (i << 7) | o break if value is None: log.debug('cannot encode imm12') return False self.value = value & self.lmask self.parent.imm12_3.value = (value >> 8) & self.parent.imm12_3.lmask self.parent.imm12_1.value = (value >> 11) & self.parent.imm12_1.lmask return True class armt2_imm10l(arm_imm): def decode(self, v): v = v & self.lmask s = self.parent.sign.value j1 = self.parent.j1.value j2 = self.parent.j2.value imm10h = self.parent.imm10h.value imm10l = v i1, i2 = j1 ^ s ^ 1, j2 ^ s ^ 1 v = (s << 24) | (i1 << 23) | ( i2 << 22) | (imm10h << 12) | (imm10l << 2) v = sign_ext(v, 25, 32) self.expr = ExprInt32(v) return True def encode(self): if not isinstance(self.expr, ExprInt): return False v = self.expr.arg.arg s = 0 if v & 0x80000000: s = 1 v = (-v) & 0xffffffff if v > (1 << 26): return False i1, i2, imm10h, imm10l = (v >> 23) & 1, ( v >> 22) & 1, (v >> 12) & 0x3ff, (v >> 2) & 0x3ff j1, j2 = i1 ^ s ^ 1, i2 ^ s ^ 1 self.parent.sign.value = s self.parent.j1.value = j1 self.parent.j2.value = j2 self.parent.imm10h.value = imm10h self.value = imm10l return True class armt2_imm11l(arm_imm): def decode(self, v): v = v & self.lmask s = self.parent.sign.value j1 = self.parent.j1.value j2 = self.parent.j2.value imm10h = self.parent.imm10h.value imm11l = v i1, i2 = j1 ^ s ^ 1, j2 ^ s ^ 1 v = (s << 24) | (i1 << 23) | ( i2 << 22) | (imm10h << 12) | (imm11l << 1) v = sign_ext(v, 25, 32) self.expr = ExprInt32(v) return True def encode(self): if not isinstance(self.expr, ExprInt): return False v = self.expr.arg.arg s = 0 if v & 0x80000000: s = 1 v = (-v) & 0xffffffff if v > (1 << 26): return False i1, i2, imm10h, imm11l = (v >> 23) & 1, ( v >> 22) & 1, (v >> 12) & 0x3ff, (v >> 1) & 0x7ff j1, j2 = i1 ^ s ^ 1, i2 ^ s ^ 1 self.parent.sign.value = s self.parent.j1.value = j1 self.parent.j2.value = j2 self.parent.imm10h.value = imm10h self.value = imm11l return True imm12_1 = bs(l=1, fname="imm12_1", order=1) imm12_3 = bs(l=3, fname="imm12_3", order=1) imm12_8 = bs(l=8, cls=(armt2_imm12,), fname="imm", order=2) imm5_3 = bs(l=3, fname="imm5_3") imm5_2 = bs(l=2, fname="imm5_2") imm_stype = bs(l=2, fname="stype") imm1 = bs(l=1, fname="imm1") class armt_imm5_1(arm_imm): def decode(self, v): v = sign_ext(((self.parent.imm1.value << 5) | v) << 1, 7, 32) self.expr = ExprInt32(v) return True def encode(self): if not isinstance(self.expr, ExprInt): return False v = self.expr.arg.arg if v & 0x80000000: v &= (1 << 7) - 1 self.parent.imm1.value = (v >> 6) & 1 self.value = (v >> 1) & 0x1f return True imm5_off = bs(l=5, cls=(armt_imm5_1,), fname="imm5_off") tsign = bs(l=1, fname="sign") tj1 = bs(l=1, fname="j1") tj2 = bs(l=1, fname="j2") timm10H = bs(l=10, fname="imm10h") timm10L = bs(l=10, cls=(armt2_imm10l,), fname="imm10l") timm11L = bs(l=11, cls=(armt2_imm11l,), fname="imm11l") armtop("adc", [bs('11110'), imm12_1, bs('0'), bs('1010'), scc, rn_nosppc, bs('0'), imm12_3, rd_nosppc, imm12_8]) armtop("adc", [bs('11101'), bs('01'), bs('1010'), scc, rn_nosppc, bs('0'), imm5_3, rd_nosppc, imm5_2, imm_stype, rm_sh]) armtop("bl", [bs('11110'), tsign, timm10H, bs('11'), tj1, bs('1'), tj2, timm11L]) armtop("blx", [bs('11110'), tsign, timm10H, bs('11'), tj1, bs('0'), tj2, timm10L, bs('0')]) armtop("cbz", [bs('101100'), imm1, bs('1'), imm5_off, rnl], [rnl, imm5_off]) armtop("cbnz", [bs('101110'), imm1, bs('1'), imm5_off, rnl], [rnl, imm5_off]) armtop("bkpt", [bs('1011'), bs('1110'), imm8])
gpl-2.0
emccode/HeliosBurn
install/docker/proxy_settings.py
1
1641
from configurations import Configuration, values import redis class Common(Configuration): REDIS_HOST = 'redis' REDIS_PORT = 6379 REDIS_DB = 0 LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'verbose': { 'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s", 'datefmt' : "%d/%b/%Y %H:%M:%S" }, 'simple': { 'format': '%(levelname)s %(message)s' }, }, 'handlers': { 'console': { 'level': 'DEBUG', 'class': 'logging.StreamHandler', 'formatter': 'verbose' }, 'redis': { 'level': 'DEBUG', 'class': 'redislog.handlers.RedisHandler', 'channel': 'hblog', 'redis_client': redis.Redis(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB), } }, 'loggers': { 'django': { 'handlers': ['console'], 'propagate': True, 'level': 'INFO', }, 'webui': { 'handlers': ['console', 'redis'], 'level': 'DEBUG', }, 'api': { 'handlers': ['console', 'redis'], 'level': 'DEBUG', }, 'proxy': { 'handlers': ['console', 'redis'], 'level': 'DEBUG', }, } }
mit
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/production_ml/labs/samples/contrib/azure-samples/databricks-pipelines/pipeline_cli.py
3
2464
import os import sys import logging import kfp import fire logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) class MyCLI: """ CLI for Kubeflow Pipelines. This CLI allows us to compile and run our pipelines in Kubeflow Pipelines without accessing Kubeflow portal. """ @staticmethod def compile( path ): """ Compile a Kubeflow pipeline. Args: path: Path to the pipeline (e.g. databricks_run_pipeline.py) """ logging.info("Compiling '%s'...", path) compiled_path = f"{path}.tar.gz" result = os.system(f"dsl-compile --py {path} --output {compiled_path}") if result != 0: logging.error("Failed to compile '%s' with error code %i.", path, result) sys.exit(result) return compiled_path @staticmethod def run( path, host, params={} ): """ Run a compiled pipeline in Kubeflow. Args: path: Path to the compiled pipeline (e.g. databricks_run_pipeline.py.tar.gz) host: Host name to use to talk to Kubeflow Pipelines (e.g. http://localhost:8080/pipeline) params: Pipeline parameters (e.g. '{\"run_name\":\"test-run\",\"parameter\":\"10\"}') """ logging.info("Running '%s' in '%s'...", path, host) client = kfp.Client(f"{host}") try: result = client.create_run_from_pipeline_package( pipeline_file=path, arguments=params ) logging.info("View run: %s/#/runs/details/%s", host, result.run_id) except Exception as ex: logging.error("Failed to run '{%s}' with error:\n{%s}", path, ex) sys.exit(1) @staticmethod def compile_run( path, host, params={} ): """ Compile and run a Kubeflow pipeline. Args: path: Path to the pipeline (e.g. databricks_run_pipeline.py) host: Host name to use to talk to Kubeflow Pipelines (e.g. http://localhost:8080/pipeline) params: Pipeline parameters (e.g. '{\"run_name\":\"test-run\",\"parameter\":\"10\"}') """ compiled_path = MyCLI.compile(path) MyCLI.run(compiled_path, host, params) if __name__ == '__main__': fire.Fire(MyCLI())
apache-2.0
Suwings/Yeinw
src/Crypto/SelfTest/Random/OSRNG/__init__.py
118
2082
# -*- coding: utf-8 -*- # # SelfTest/Random/OSRNG/__init__.py: Self-test for OSRNG modules # # Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net> # # =================================================================== # The contents of this file are dedicated to the public domain. To # the extent that dedication to the public domain is not available, # everyone is granted a worldwide, perpetual, royalty-free, # non-exclusive license to exercise all rights associated with the # contents of this file for any purpose whatsoever. # No rights are reserved. # # 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. # =================================================================== """Self-test for Crypto.Random.OSRNG package""" __revision__ = "$Id$" import os def get_tests(config={}): tests = [] if os.name == 'nt': from Crypto.SelfTest.Random.OSRNG import test_nt; tests += test_nt.get_tests(config=config) from Crypto.SelfTest.Random.OSRNG import test_winrandom; tests += test_winrandom.get_tests(config=config) elif os.name == 'posix': from Crypto.SelfTest.Random.OSRNG import test_posix; tests += test_posix.get_tests(config=config) if hasattr(os, 'urandom'): from Crypto.SelfTest.Random.OSRNG import test_fallback; tests += test_fallback.get_tests(config=config) from Crypto.SelfTest.Random.OSRNG import test_generic; tests += test_generic.get_tests(config=config) return tests if __name__ == '__main__': import unittest suite = lambda: unittest.TestSuite(get_tests()) unittest.main(defaultTest='suite') # vim:set ts=4 sw=4 sts=4 expandtab:
gpl-3.0
danakj/chromium
chrome/common/extensions/docs/server2/samples_model.py
36
7045
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import logging import posixpath import re from compiled_file_system import Cache from extensions_paths import EXAMPLES from samples_data_source import SamplesDataSource import third_party.json_schema_compiler.json_comment_eater as json_comment_eater import url_constants _DEFAULT_ICON_PATH = 'images/sample-default-icon.png' def _GetAPIItems(js_file): chrome_pattern = r'chrome[\w.]+' # Add API calls that appear normally, like "chrome.runtime.connect". calls = set(re.findall(chrome_pattern, js_file)) # Add API calls that have been assigned into variables, like # "var storageArea = chrome.storage.sync; storageArea.get", which should # be expanded like "chrome.storage.sync.get". for match in re.finditer(r'var\s+(\w+)\s*=\s*(%s);' % chrome_pattern, js_file): var_name, api_prefix = match.groups() for var_match in re.finditer(r'\b%s\.([\w.]+)\b' % re.escape(var_name), js_file): api_suffix, = var_match.groups() calls.add('%s.%s' % (api_prefix, api_suffix)) return calls class SamplesModel(object): def __init__(self, extension_samples_file_system, app_samples_file_system, compiled_fs_factory, reference_resolver, base_path, platform): self._samples_fs = (extension_samples_file_system if platform == 'extensions' else app_samples_file_system) self._samples_cache = compiled_fs_factory.Create( self._samples_fs, self._MakeSamplesList, SamplesDataSource, category=platform) self._text_cache = compiled_fs_factory.ForUnicode(self._samples_fs) self._reference_resolver = reference_resolver self._base_path = base_path self._platform = platform def GetCache(self): return self._samples_cache def FilterSamples(self, api_name): '''Fetches and filters the list of samples for this platform, returning a Future to the only the samples that use the API |api_name|. ''' def filter_samples(samples_list): return [sample for sample in samples_list if any(call['name'].startswith(api_name + '.') for call in sample['api_calls'])] def handle_error(_): # TODO(rockot): This cache is probably not working as intended, since # it can still lead to underlying filesystem (e.g. gitiles) access # while processing live requests. Because this can fail, we at least # trap and log exceptions to prevent 500s from being thrown. logging.warning('Unable to get samples listing. Skipping.') return [] platform_for_samples = '' if self._platform == 'apps' else EXAMPLES return (self._samples_cache.GetFromFileListing(platform_for_samples) .Then(filter_samples, error_handler=handle_error)) def _GetDataFromManifest(self, path, file_system): manifest = self._text_cache.GetFromFile(path + '/manifest.json').Get() try: manifest_json = json.loads(json_comment_eater.Nom(manifest)) except ValueError as e: logging.error('Error parsing manifest.json for %s: %s' % (path, e)) return None l10n_data = { 'name': manifest_json.get('name', ''), 'description': manifest_json.get('description', None), 'icon': manifest_json.get('icons', {}).get('128', None), 'default_locale': manifest_json.get('default_locale', None), 'locales': {} } if not l10n_data['default_locale']: return l10n_data locales_path = path + '/_locales/' locales_dir = file_system.ReadSingle(locales_path).Get() if locales_dir: def load_locale_json(path): return (path, json.loads(self._text_cache.GetFromFile(path).Get())) try: locales_json = [load_locale_json(locales_path + f + 'messages.json') for f in locales_dir] except ValueError as e: logging.error('Error parsing locales files for %s: %s' % (path, e)) else: for path, json_ in locales_json: l10n_data['locales'][path[len(locales_path):].split('/')[0]] = json_ return l10n_data @Cache def _MakeSamplesList(self, base_path, files): samples_list = [] for filename in sorted(files): if filename.rsplit('/')[-1] != 'manifest.json': continue # This is a little hacky, but it makes a sample page. sample_path = filename.rsplit('/', 1)[-2] sample_files = [path for path in files if path.startswith(sample_path + '/')] js_files = [path for path in sample_files if path.endswith('.js')] js_contents = [self._text_cache.GetFromFile( posixpath.join(base_path, js_file)).Get() for js_file in js_files] api_items = set() for js in js_contents: api_items.update(_GetAPIItems(js)) api_calls = [] for item in sorted(api_items): if len(item.split('.')) < 3: continue if item.endswith('.removeListener') or item.endswith('.hasListener'): continue if item.endswith('.addListener'): item = item[:-len('.addListener')] if item.startswith('chrome.'): item = item[len('chrome.'):] ref_data = self._reference_resolver.GetLink(item) # TODO(kalman): What about references like chrome.storage.sync.get? # That should link to either chrome.storage.sync or # chrome.storage.StorageArea.get (or probably both). # TODO(kalman): Filter out API-only references? This can happen when # the API namespace is assigned to a variable, but it's very hard to # to disambiguate. if ref_data is None: continue api_calls.append({ 'name': ref_data['text'], 'link': ref_data['href'] }) if self._platform == 'apps': url = url_constants.GITHUB_BASE + '/' + sample_path icon_base = url_constants.RAW_GITHUB_BASE + '/' + sample_path download_url = url else: extension_sample_path = posixpath.join('examples', sample_path) url = extension_sample_path icon_base = extension_sample_path download_url = extension_sample_path + '.zip' manifest_data = self._GetDataFromManifest( posixpath.join(base_path, sample_path), self._samples_fs) if manifest_data['icon'] is None: icon_path = posixpath.join( self._base_path, 'static', _DEFAULT_ICON_PATH) else: icon_path = '%s/%s' % (icon_base, manifest_data['icon']) manifest_data.update({ 'icon': icon_path, 'download_url': download_url, 'url': url, 'files': [f.replace(sample_path + '/', '') for f in sample_files], 'api_calls': api_calls }) samples_list.append(manifest_data) return samples_list
bsd-3-clause
tomtor/QGIS
python/plugins/db_manager/db_plugins/gpkg/plugin.py
15
11191
# -*- coding: utf-8 -*- """ /*************************************************************************** Name : DB Manager Description : Database manager plugin for QGIS Date : May 23, 2011 copyright : (C) 2011 by Giuseppe Sucameli email : brush.tyler@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ """ from builtins import str # this will disable the dbplugin if the connector raise an ImportError from .connector import GPKGDBConnector from qgis.PyQt.QtCore import Qt, QFileInfo, QCoreApplication from qgis.PyQt.QtGui import QIcon from qgis.PyQt.QtWidgets import QApplication, QAction, QFileDialog from qgis.core import ( Qgis, QgsApplication, QgsDataSourceUri, QgsSettings, QgsProviderRegistry, ) from qgis.gui import QgsMessageBar from ..plugin import DBPlugin, Database, Table, VectorTable, RasterTable, TableField, TableIndex, TableTrigger, \ InvalidDataException def classFactory(): return GPKGDBPlugin class GPKGDBPlugin(DBPlugin): @classmethod def icon(self): return QgsApplication.getThemeIcon("/mGeoPackage.svg") @classmethod def typeName(self): return 'gpkg' @classmethod def typeNameString(self): return QCoreApplication.translate('db_manager', 'GeoPackage') @classmethod def providerName(self): return 'ogr' @classmethod def connectionSettingsKey(self): return 'providers/ogr/GPKG/connections' def databasesFactory(self, connection, uri): return GPKGDatabase(connection, uri) def connect(self, parent=None): conn_name = self.connectionName() md = QgsProviderRegistry.instance().providerMetadata(self.providerName()) conn = md.findConnection(conn_name) if conn is None: # non-existent entry? raise InvalidDataException(self.tr(u'There is no defined database connection "{0}".').format(conn_name)) uri = QgsDataSourceUri() uri.setDatabase(conn.uri()) return self.connectToUri(uri) @classmethod def addConnection(self, conn_name, uri): md = QgsProviderRegistry.instance().providerMetadata(self.providerName()) conn = md.createConnection(uri.database(), {}) md.saveConnection(conn, conn_name) return True @classmethod def addConnectionActionSlot(self, item, action, parent, index): QApplication.restoreOverrideCursor() try: filename, selected_filter = QFileDialog.getOpenFileName(parent, parent.tr("Choose GeoPackage file"), None, "GeoPackage (*.gpkg)") if not filename: return finally: QApplication.setOverrideCursor(Qt.WaitCursor) conn_name = QFileInfo(filename).fileName() uri = QgsDataSourceUri() uri.setDatabase(filename) self.addConnection(conn_name, uri) index.internalPointer().itemChanged() class GPKGDatabase(Database): def __init__(self, connection, uri): Database.__init__(self, connection, uri) def connectorsFactory(self, uri): return GPKGDBConnector(uri, self.connection()) def dataTablesFactory(self, row, db, schema=None): return GPKGTable(row, db, schema) def vectorTablesFactory(self, row, db, schema=None): return GPKGVectorTable(row, db, schema) def rasterTablesFactory(self, row, db, schema=None): return GPKGRasterTable(row, db, schema) def info(self): from .info_model import GPKGDatabaseInfo return GPKGDatabaseInfo(self) def sqlResultModel(self, sql, parent): from .data_model import GPKGSqlResultModel return GPKGSqlResultModel(self, sql, parent) def sqlResultModelAsync(self, sql, parent): from .data_model import GPKGSqlResultModelAsync return GPKGSqlResultModelAsync(self, sql, parent) def registerDatabaseActions(self, mainWindow): action = QAction(self.tr("Run &Vacuum"), self) mainWindow.registerAction(action, self.tr("&Database"), self.runVacuumActionSlot) Database.registerDatabaseActions(self, mainWindow) def runVacuumActionSlot(self, item, action, parent): QApplication.restoreOverrideCursor() try: if not isinstance(item, (DBPlugin, Table)) or item.database() is None: parent.infoBar.pushMessage(self.tr("No database selected or you are not connected to it."), Qgis.Info, parent.iface.messageTimeout()) return finally: QApplication.setOverrideCursor(Qt.WaitCursor) self.runVacuum() def runVacuum(self): self.database().aboutToChange.emit() self.database().connector.runVacuum() self.database().refresh() def runAction(self, action): action = str(action) if action.startswith("vacuum/"): if action == "vacuum/run": self.runVacuum() return True return Database.runAction(self, action) def uniqueIdFunction(self): return None def toSqlLayer(self, sql, geomCol, uniqueCol, layerName="QueryLayer", layerType=None, avoidSelectById=False, filter=""): from qgis.core import QgsVectorLayer vl = QgsVectorLayer(self.uri().database() + '|subset=' + sql, layerName, 'ogr') return vl def supportsComment(self): return False class GPKGTable(Table): def __init__(self, row, db, schema=None): """Constructs a GPKGTable :param row: a three elements array with: [table_name, is_view, is_sys_table] :type row: array [str, bool, bool] :param db: database instance :type db: :param schema: schema name, defaults to None, ignored by GPKG :type schema: str, optional """ Table.__init__(self, db, None) self.name, self.isView, self.isSysTable = row def ogrUri(self): ogrUri = u"%s|layername=%s" % (self.uri().database(), self.name) return ogrUri def mimeUri(self): # QGIS has no provider to load Geopackage vectors, let's use OGR return u"vector:ogr:%s:%s" % (self.name, self.ogrUri()) def toMapLayer(self): from qgis.core import QgsVectorLayer provider = "ogr" uri = self.ogrUri() return QgsVectorLayer(uri, self.name, provider) def tableFieldsFactory(self, row, table): return GPKGTableField(row, table) def tableIndexesFactory(self, row, table): return GPKGTableIndex(row, table) def tableTriggersFactory(self, row, table): return GPKGTableTrigger(row, table) def tableDataModel(self, parent): from .data_model import GPKGTableDataModel return GPKGTableDataModel(self, parent) class GPKGVectorTable(GPKGTable, VectorTable): def __init__(self, row, db, schema=None): GPKGTable.__init__(self, row[:-5], db, schema) VectorTable.__init__(self, db, schema) # GPKG does case-insensitive checks for table names, but the # GPKG provider didn't do the same in QGIS < 1.9, so self.geomTableName # stores the table name like stored in the geometry_columns table self.geomTableName, self.geomColumn, self.geomType, self.geomDim, self.srid = row[-5:] self.extent = self.database().connector.getTableExtent((self.schemaName(), self.name), self.geomColumn, force=False) def uri(self): uri = self.database().uri() uri.setDataSource('', self.geomTableName, self.geomColumn) return uri def hasSpatialIndex(self, geom_column=None): geom_column = geom_column if geom_column is not None else self.geomColumn return self.database().connector.hasSpatialIndex((self.schemaName(), self.name), geom_column) def createSpatialIndex(self, geom_column=None): self.aboutToChange.emit() ret = VectorTable.createSpatialIndex(self, geom_column) if ret is not False: self.database().refresh() return ret def deleteSpatialIndex(self, geom_column=None): self.aboutToChange.emit() ret = VectorTable.deleteSpatialIndex(self, geom_column) if ret is not False: self.database().refresh() return ret def refreshTableEstimatedExtent(self): return def refreshTableExtent(self): prevExtent = self.extent self.extent = self.database().connector.getTableExtent((self.schemaName(), self.name), self.geomColumn, force=True) if self.extent != prevExtent: self.refresh() def runAction(self, action): if GPKGTable.runAction(self, action): return True return VectorTable.runAction(self, action) class GPKGRasterTable(GPKGTable, RasterTable): def __init__(self, row, db, schema=None): GPKGTable.__init__(self, row[:-3], db, schema) RasterTable.__init__(self, db, schema) self.prefixName, self.geomColumn, self.srid = row[-3:] self.geomType = 'RASTER' self.extent = self.database().connector.getTableExtent((self.schemaName(), self.name), self.geomColumn) def gpkgGdalUri(self): gdalUri = u'GPKG:%s:%s' % (self.uri().database(), self.prefixName) return gdalUri def mimeUri(self): # QGIS has no provider to load rasters, let's use GDAL uri = u"raster:gdal:%s:%s" % (self.name, self.uri().database()) return uri def toMapLayer(self): from qgis.core import QgsRasterLayer, QgsContrastEnhancement # QGIS has no provider to load rasters, let's use GDAL uri = self.gpkgGdalUri() rl = QgsRasterLayer(uri, self.name) if rl.isValid(): rl.setContrastEnhancement(QgsContrastEnhancement.StretchToMinimumMaximum) return rl class GPKGTableField(TableField): def __init__(self, row, table): TableField.__init__(self, table) self.num, self.name, self.dataType, self.notNull, self.default, self.primaryKey = row self.hasDefault = self.default class GPKGTableIndex(TableIndex): def __init__(self, row, table): TableIndex.__init__(self, table) self.num, self.name, self.isUnique, self.columns = row class GPKGTableTrigger(TableTrigger): def __init__(self, row, table): TableTrigger.__init__(self, table) self.name, self.function = row
gpl-2.0
ArneBab/pypyjs
website/demo/home/rfk/repos/pypy/lib-python/2.7/idlelib/macosxSupport.py
34
6028
""" A number of function that enhance IDLE on MacOSX when it used as a normal GUI application (as opposed to an X11 application). """ import sys import Tkinter from os import path _appbundle = None def runningAsOSXApp(): """ Returns True if Python is running from within an app on OSX. If so, assume that Python was built with Aqua Tcl/Tk rather than X11 Tcl/Tk. """ global _appbundle if _appbundle is None: _appbundle = (sys.platform == 'darwin' and '.app' in sys.executable) return _appbundle _carbonaquatk = None def isCarbonAquaTk(root): """ Returns True if IDLE is using a Carbon Aqua Tk (instead of the newer Cocoa Aqua Tk). """ global _carbonaquatk if _carbonaquatk is None: _carbonaquatk = (runningAsOSXApp() and 'aqua' in root.tk.call('tk', 'windowingsystem') and 'AppKit' not in root.tk.call('winfo', 'server', '.')) return _carbonaquatk def tkVersionWarning(root): """ Returns a string warning message if the Tk version in use appears to be one known to cause problems with IDLE. The Apple Cocoa-based Tk 8.5 that was shipped with Mac OS X 10.6. """ if (runningAsOSXApp() and ('AppKit' in root.tk.call('winfo', 'server', '.')) and (root.tk.call('info', 'patchlevel') == '8.5.7') ): return (r"WARNING: The version of Tcl/Tk (8.5.7) in use may" r" be unstable.\n" r"Visit http://www.python.org/download/mac/tcltk/" r" for current information.") else: return False def addOpenEventSupport(root, flist): """ This ensures that the application will respond to open AppleEvents, which makes is feasible to use IDLE as the default application for python files. """ def doOpenFile(*args): for fn in args: flist.open(fn) # The command below is a hook in aquatk that is called whenever the app # receives a file open event. The callback can have multiple arguments, # one for every file that should be opened. root.createcommand("::tk::mac::OpenDocument", doOpenFile) def hideTkConsole(root): try: root.tk.call('console', 'hide') except Tkinter.TclError: # Some versions of the Tk framework don't have a console object pass def overrideRootMenu(root, flist): """ Replace the Tk root menu by something that's more appropriate for IDLE. """ # The menu that is attached to the Tk root (".") is also used by AquaTk for # all windows that don't specify a menu of their own. The default menubar # contains a number of menus, none of which are appropriate for IDLE. The # Most annoying of those is an 'About Tck/Tk...' menu in the application # menu. # # This function replaces the default menubar by a mostly empty one, it # should only contain the correct application menu and the window menu. # # Due to a (mis-)feature of TkAqua the user will also see an empty Help # menu. from Tkinter import Menu, Text, Text from idlelib.EditorWindow import prepstr, get_accelerator from idlelib import Bindings from idlelib import WindowList from idlelib.MultiCall import MultiCallCreator menubar = Menu(root) root.configure(menu=menubar) menudict = {} menudict['windows'] = menu = Menu(menubar, name='windows') menubar.add_cascade(label='Window', menu=menu, underline=0) def postwindowsmenu(menu=menu): end = menu.index('end') if end is None: end = -1 if end > 0: menu.delete(0, end) WindowList.add_windows_to_menu(menu) WindowList.register_callback(postwindowsmenu) def about_dialog(event=None): from idlelib import aboutDialog aboutDialog.AboutDialog(root, 'About IDLE') def config_dialog(event=None): from idlelib import configDialog root.instance_dict = flist.inversedict configDialog.ConfigDialog(root, 'Settings') def help_dialog(event=None): from idlelib import textView fn = path.join(path.abspath(path.dirname(__file__)), 'help.txt') textView.view_file(root, 'Help', fn) root.bind('<<about-idle>>', about_dialog) root.bind('<<open-config-dialog>>', config_dialog) root.createcommand('::tk::mac::ShowPreferences', config_dialog) if flist: root.bind('<<close-all-windows>>', flist.close_all_callback) # The binding above doesn't reliably work on all versions of Tk # on MacOSX. Adding command definition below does seem to do the # right thing for now. root.createcommand('exit', flist.close_all_callback) if isCarbonAquaTk(root): # for Carbon AquaTk, replace the default Tk apple menu menudict['application'] = menu = Menu(menubar, name='apple') menubar.add_cascade(label='IDLE', menu=menu) Bindings.menudefs.insert(0, ('application', [ ('About IDLE', '<<about-idle>>'), None, ])) tkversion = root.tk.eval('info patchlevel') if tuple(map(int, tkversion.split('.'))) < (8, 4, 14): # for earlier AquaTk versions, supply a Preferences menu item Bindings.menudefs[0][1].append( ('_Preferences....', '<<open-config-dialog>>'), ) else: # assume Cocoa AquaTk # replace default About dialog with About IDLE one root.createcommand('tkAboutDialog', about_dialog) # replace default "Help" item in Help menu root.createcommand('::tk::mac::ShowHelp', help_dialog) # remove redundant "IDLE Help" from menu del Bindings.menudefs[-1][1][0] def setupApp(root, flist): """ Perform setup for the OSX application bundle. """ if not runningAsOSXApp(): return hideTkConsole(root) overrideRootMenu(root, flist) addOpenEventSupport(root, flist)
mit
tensorflow/tfjs-examples
iris/python/iris_test.py
1
1765
# Copyright 2018 Google LLC. 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 the Iris model.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import json import os import shutil import tempfile import unittest import iris class IrisTest(unittest.TestCase): def setUp(self): self._tmp_dir = tempfile.mkdtemp() super(IrisTest, self).setUp() def tearDown(self): if os.path.isdir(self._tmp_dir): shutil.rmtree(self._tmp_dir) super(IrisTest, self).tearDown() def testTrainAndSaveNonSequential(self): final_train_accuracy = iris.train(100, self._tmp_dir) self.assertGreater(final_train_accuracy, 0.9) # Check that the model json file is created. json.load(open(os.path.join(self._tmp_dir, 'model.json'), 'rt')) def testTrainAndSaveSequential(self): final_train_accuracy = iris.train(100, self._tmp_dir, sequential=True) self.assertGreater(final_train_accuracy, 0.9) # Check that the model json file is created. json.load(open(os.path.join(self._tmp_dir, 'model.json'), 'rt')) if __name__ == '__main__': unittest.main()
apache-2.0
xiandiancloud/edxplaltfom-xusong
cms/djangoapps/contentstore/features/checklists.py
35
4765
# pylint: disable=C0111 # pylint: disable=W0621 from lettuce import world, step from nose.tools import assert_true, assert_equal # pylint: disable=E0611 from terrain.steps import reload_the_page from selenium.common.exceptions import StaleElementReferenceException ############### ACTIONS #################### @step('I select Checklists from the Tools menu$') def i_select_checklists(step): world.click_tools() link_css = 'li.nav-course-tools-checklists a' world.css_click(link_css) world.wait_for_ajax_complete() @step('I have opened Checklists$') def i_have_opened_checklists(step): step.given('I have opened a new course in Studio') step.given('I select Checklists from the Tools menu') @step('I see the four default edX checklists$') def i_see_default_checklists(step): checklists = world.css_find('.checklist-title') assert_equal(4, len(checklists)) assert_true(checklists[0].text.endswith('Getting Started With Studio')) assert_true(checklists[1].text.endswith('Draft a Rough Course Outline')) assert_true(checklists[2].text.endswith("Explore edX\'s Support Tools")) assert_true(checklists[3].text.endswith('Draft Your Course About Page')) @step('I can check and uncheck tasks in a checklist$') def i_can_check_and_uncheck_tasks(step): # Use the 2nd checklist as a reference verifyChecklist2Status(0, 7, 0) toggleTask(1, 0) verifyChecklist2Status(1, 7, 14) toggleTask(1, 3) verifyChecklist2Status(2, 7, 29) toggleTask(1, 6) verifyChecklist2Status(3, 7, 43) toggleTask(1, 3) verifyChecklist2Status(2, 7, 29) @step('the tasks are correctly selected$') def tasks_correctly_selected(step): verifyChecklist2Status(2, 7, 29) # verify that task 7 is still selected by toggling its checkbox state and making sure that it deselects world.browser.execute_script("window.scrollBy(0,1000)") toggleTask(1, 6) verifyChecklist2Status(1, 7, 14) @step('I select a link to the course outline$') def i_select_a_link_to_the_course_outline(step): clickActionLink(1, 0, 'Edit Course Outline') @step('I am brought to the course outline page$') def i_am_brought_to_course_outline(step): assert world.is_css_present('body.view-outline') assert_equal(1, len(world.browser.windows)) @step('I am brought back to the course outline in the correct state$') def i_am_brought_back_to_course_outline(step): step.given('I see the four default edX checklists') # In a previous step, we selected (1, 0) in order to click the 'Edit Course Outline' link. # Make sure the task is still showing as selected (there was a caching bug with the collection). verifyChecklist2Status(1, 7, 14) @step('I select a link to help page$') def i_select_a_link_to_the_help_page(step): clickActionLink(2, 0, 'Visit Studio Help') @step('I am brought to the help page in a new window$') def i_am_brought_to_help_page_in_new_window(step): step.given('I see the four default edX checklists') windows = world.browser.windows assert_equal(2, len(windows)) world.browser.switch_to_window(windows[1]) assert_equal('http://help.edge.edx.org/', world.browser.url) ############### HELPER METHODS #################### def verifyChecklist2Status(completed, total, percentage): def verify_count(driver): try: statusCount = world.css_find('#course-checklist1 .status-count').first return statusCount.text == str(completed) except StaleElementReferenceException: return False world.wait_for(verify_count) assert_equal(str(total), world.css_find('#course-checklist1 .status-amount').first.text) # Would like to check the CSS width, but not sure how to do that. assert_equal(str(percentage), world.css_find('#course-checklist1 .viz-checklist-status-value .int').first.text) def toggleTask(checklist, task): world.css_click('#course-checklist' + str(checklist) + '-task' + str(task)) world.wait_for_ajax_complete() # TODO: figure out a way to do this in phantom and firefox # For now we will mark the scenerios that use this method as skipped def clickActionLink(checklist, task, actionText): # text will be empty initially, wait for it to populate def verify_action_link_text(driver): actualText = world.css_text('#course-checklist' + str(checklist) + ' a', index=task) if actualText == actionText: return True else: # toggle checklist item to make sure that the link button is showing toggleTask(checklist, task) return False world.wait_for(verify_action_link_text) world.css_click('#course-checklist' + str(checklist) + ' a', index=task) world.wait_for_ajax_complete()
agpl-3.0
printerpam/autoconf-archive
macro2texi.py
16
1811
#! /usr/bin/env python assert __name__ == "__main__" import sys from macro import Macro, writeFile tmpl = """\ @node %(name)s @unnumberedsec %(name)s @majorheading Synopsis %(synopsis)s @majorheading Description %(description)s @majorheading Source Code Download the @uref{http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/%(name)s.m4,latest version of @file{%(name)s.m4}} or browse @uref{http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=history;f=m4/%(name)s.m4,the macro's revision history}. @majorheading License %(authors)s %(license)s """ def quoteTexi(buf): return buf.replace('@', "@@").replace('{', "@{").replace('}', "@}") def formatParagraph(para): assert para assert para[0] assert para[0][0] if para[0][0].isspace(): return "@smallexample\n%s\n@end smallexample" % quoteTexi('\n'.join(para)) else: return quoteTexi('\n'.join(para)) def formatAuthor(a): assert a a["year"] = quoteTexi(a["year"]) a["name"] = quoteTexi(a["name"]) if "email" in a: a["email"] = quoteTexi(a["email"]) return "Copyright @copyright{} %(year)s %(name)s @email{%(email)s}" % a else: return "Copyright @copyright{} %(year)s %(name)s" % a if len(sys.argv) != 3: raise Exception("invalid command line syntax: %s" % ' '.join(map(repr, sys.argv))) (m4File,outFile) = sys.argv[1:] assert outFile != m4File m = Macro(m4File) m.synopsis = "@smallexample\n%s\n@end smallexample" % "\n".join(map(quoteTexi, m.synopsis)) m.description = '\n\n'.join(map(formatParagraph, m.description)) m.description = m.description.replace("@end smallexample\n@smallexample", "\n") m.authors = " @* ".join([ "@w{%s}" % formatAuthor(a) for a in m.authors ]) m.license = "\n\n".join(map(formatParagraph, m.license)) writeFile(outFile, tmpl % m.__dict__)
gpl-3.0
sshnaidm/ru
service.RussianKeyboard/default.py
3
2125
# declare file encoding # -*- coding: utf-8 -*- # Copyright (C) 2014 Lamkin666 # # This Program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, 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 XBMC; see the file COPYING. If not, write to # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. # http://www.gnu.org/copyleft/gpl.html import sys import xbmc import RussianKey import xbmcgui import xbmcaddon _addon_ = xbmcaddon.Addon("service.RussianKeyboard") if sys.version_info >= (2, 7): import json else: import simplejson as json def json_query(query): xbmc_request = json.dumps(query) result = xbmc.executeJSONRPC(xbmc_request) result = unicode(result, 'utf-8', errors='ignore') return json.loads(result) class keyboard_monitor: def __init__(self): self._daemon() def push_string(self, count, line_num): self.string1 = self.process_file() self.ac = True self.req = json.dumps({"id": "0", "jsonrpc":"2.0", "method":"Input.SendText", "params":{"text":self.string1, "done":self.ac}}) xbmc.executeJSONRPC(self.req) def process_file(self): keyboard = RussianKey.Keyboard('', '') keyboard.doModal() output = keyboard.getText() return output def _daemon(self): #this will run constantly while (not xbmc.abortRequested): xbmc.sleep(500) self.count = 0 self.line_num = 0 if xbmc.getCondVisibility('Window.IsActive(virtualkeyboard)'): self.push_string(self.count, self.line_num) if (__name__ == "__main__"): kbm = keyboard_monitor()
gpl-2.0
jeremyprice/PythonForDevs
LabsDone/lab12_2dim_list.py
2
1107
""" This program accumulates by month the maximum high temperature, the minimum high temperature, the number of days and the accumulated high temperatures. The latter two are used to calculate the average high temperature for the month. """ monlst = [] for i in range(12): monlst.append([0, 0, 0, 200]) # sublist[Days, Accum Temp, Max Hi, Min Hi] fin = open('/home/student/pydata/tmpprecip2012.dat', 'r') # fin = open('c:/pydata/tmpprecip2012.dat', 'r') for linein in fin: try: mon = int(linein[0:2]) temp = int(linein[13:16]) except ValueError: print 'Bad Data', linein continue x = mon - 1 monlst[x][0] += 1 # add 1 to the day count monlst[x][1] += temp # accumulate the temperature if temp > monlst[x][2]: monlst[x][2] = temp # update the max hi temp if temp < monlst[x][3]: monlst[x][3] = temp # update the min hi temp mon = 0 for cntr, totmp, maxtmp, mintmp in monlst: mon += 1 print '{:2d} {:6.1f} {:3d} {:3d}'.format( mon, totmp/float(cntr), maxtmp, mintmp)
mit
cgrebeld/pymel
pymel/core/animation.py
1
5392
"""functions related to animation""" import pymel.util as _util import pymel.internal.factories as _factories import general as _general import pymel.internal.pmcmds as cmds def currentTime( *args, **kwargs ): """ Modifications: - if no args are provided, the command returns the current time """ if not args and not kwargs: return cmds.currentTime(q=1) else: return cmds.currentTime(*args, **kwargs) def getCurrentTime(): """get the current time as a float""" return cmds.currentTime(q=1) def setCurrentTime( time ): """set the current time """ return cmds.currentTime(time) def listAnimatable( *args, **kwargs ): """ Modifications: - returns an empty list when the result is None - returns wrapped classes """ return map( _general.PyNode, _util.listForNone(cmds.listAnimatable( *args, **kwargs ) ) ) def keyframe( *args, **kwargs ): """ Modifications: - returns an empty list when the result is None - if both valueChange and timeChange are queried, the result will be a list of (time,value) pairs """ res = _util.listForNone( cmds.keyframe(*args, **kwargs) ) if kwargs.get('query', kwargs.get('q', False) ) and \ kwargs.get('valueChange', kwargs.get('vc', False) ) and kwargs.get('timeChange', kwargs.get('tc', False) ): return list(_util.pairIter(res)) return res def deformer(*args, **kwargs): return map( _general.PyNode, cmds.deformer(*args, **kwargs) ) def joint(*args, **kwargs): """ Maya Bug Fix: - when queried, limitSwitch*, stiffness*, and angle* flags returned lists, each with one value, instead of single values. Values are now properly unpacked """ res = cmds.joint(*args, **kwargs) #if kwargs.pop('query',False) or kwargs.pop('q',False): if kwargs.get('query', kwargs.get( 'q', False)): args = [ 'limitSwitchX', 'lsx', 'limitSwitchY', 'lsy', 'limitSwitchZ', 'lsz', 'stiffnessX', 'stx', 'stiffnessY', 'sty', 'stiffnessZ', 'stz', 'angleX', 'ax', 'angleY', 'ay', 'angleZ', 'az' ] if filter( lambda x: x in args, kwargs.keys()): res = res[0] else: try: res = cmds.ls(sl=1)[0] except: pass return res def _constraint( func ): def constraint(*args, **kwargs): """ Maya Bug Fix: - when queried, upVector, worldUpVector, and aimVector returned the name of the constraint instead of the desired values Modifications: - added new syntax for querying the weight of a target object, by passing the constraint first:: aimConstraint( 'pCube1_aimConstraint1', q=1, weight ='pSphere1' ) aimConstraint( 'pCube1_aimConstraint1', q=1, weight =['pSphere1', 'pCylinder1'] ) aimConstraint( 'pCube1_aimConstraint1', q=1, weight =[] ) """ if kwargs.get( 'query', kwargs.get('q', False) and len(args)==1) : # Fix the big with upVector, worldUpVector, and aimVector attrs = [ 'upVector', 'u', 'worldUpVector', 'wu', 'aimVector', 'a' ] for attr in attrs: if attr in kwargs: return _general.datatypes.Vector( _general.getAttr(args[0] + "." + attr ) ) # ...otherwise, try seeing if we can apply the new weight query syntax targetObjects = kwargs.get( 'weight', kwargs.get('w', None) ) if targetObjects is not None: # old way caused KeyError if 'w' not in kwargs, even if 'weight' was! # targetObjects = kwargs.get( 'weight', kwargs['w'] ) constraint = args[0] if 'constraint' in cmds.nodeType( constraint, inherited=1 ): if not _util.isIterable( targetObjects ): targetObjects = [targetObjects] elif not targetObjects: targetObjects = func( constraint, q=1, targetList=1 ) constraintObj = cmds.listConnections( constraint + '.constraintParentInverseMatrix', s=1, d=0 )[0] args = targetObjects + [constraintObj] kwargs.pop('w',None) kwargs['weight'] = True res = func(*args, **kwargs) if kwargs.get( 'query', kwargs.get('q', False) and len(args)==1) : if kwargs.get( 'weightAliasList', kwargs.get('wal', None) ): res = [_general.Attribute(args[0] + '.' + attr) for attr in res] elif kwargs.get( 'worldUpObject', kwargs.get('wuo', None) ): res = _factories.unwrapToPyNode(res) elif kwargs.get( 'targetList', kwargs.get('tl', None) ): res = _factories.toPyNodeList(res) return res constraint.__name__ = func.__name__ return constraint for contstraintCmdName in ('''aimConstraint geometryConstraint normalConstraint orientConstraint parentConstraint pointConstraint pointOnPolyConstraint poleVectorConstraint scaleConstraint tangentConstraint''').split(): cmd = getattr(cmds, contstraintCmdName, None) if cmd: globals()[contstraintCmdName] = _constraint(cmd) _factories.createFunctions( __name__, _general.PyNode )
bsd-3-clause
ddy88958620/lib
Python/scrapy/bosch_russian_diy/artemtools.py
2
1585
import csv import os import copy import re from decimal import Decimal from scrapy.spider import BaseSpider from scrapy.selector import HtmlXPathSelector from scrapy.http import Request, HtmlResponse, FormRequest from scrapy.utils.response import get_base_url from scrapy.utils.url import urljoin_rfc from scrapy.http.cookies import CookieJar from product_spiders.items import Product, ProductLoaderWithNameStrip as ProductLoader HERE = os.path.abspath(os.path.dirname(__file__)) class ArtemToolsSpider(BaseSpider): name = 'bosch-diy-artem-tools.ru' allowed_domains = ['artem-tools.ru'] def start_requests(self): with open(os.path.join(HERE, 'artemtools.csv')) as f: reader = csv.DictReader(f) for row in reader: url = row['url'] if url: yield Request(url, meta={'sku': row['sku']}, callback=self.parse_product, dont_filter=True) def parse(self, response): pass def parse_product(self, response): hxs = HtmlXPathSelector(response) loader = ProductLoader(item=Product(), selector=hxs) loader.add_value('url', response.url) loader.add_xpath('name', u'//h1/text()') price = hxs.select('//span[@style="font-size: 15px; color: #a70a0a; font-weight: bold"]/text()').extract() if price: price = price[0].replace(' ', '') loader.add_value('price', price) else: loader.add_value('price', 0) loader.add_value('sku', response.meta['sku']) yield loader.load_item()
apache-2.0
KraweDad/Platformer
platformer.py
1
6762
""" platformer.py Author: Matthew F Credit: Robbie Assignment: Write and submit a program that implements the sandbox platformer game: https://github.com/HHS-IntroProgramming/Platformer Platformer.listenKeyEvent("keydown", "s", self.SPRING) Platformer.listenKeyEvent("keyup", "s", self.SPRINGoff) Platformer.listenKeyEvent("keydown", "w", self.WALL) Platformer.listenKeyEvent("keyup", "w", self.WALLoff) """ from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame SCREEN_WIDTH = 640 SCREEN_HEIGHT = 640 class Springo(Sprite): """ THIS IS BOXY'S SPRING """ plurple = Color(0xff33ff, 1) noline = LineStyle(0, plurple) asset = RectangleAsset(25,5, noline, plurple) def __init__(self, position): super().__init__(Springo.asset, position) self.vx = 0 self.vy = 5 self.fxcenter = self.fycenter = 0.25 bricks = self.collidingWithSprites(Wall) Platformer.listenKeyEvent("keyup","s", self.Falling) self.Matty = True def step(self): self.vy = self.vy + 1.25 self.y += self.vy bricks = self.collidingWithSprites(Wall) if len(bricks) != 0: self.y -= self.vy self.vy = 0 self.Matty = False else: self.Matty = True self.x += self.vx bricks = self.collidingWithSprites(Wall) if len(bricks) != 0: self.x -= self.vx self.vx = 0 self.Matty = False else: self.Matty = True def Falling(self,event): if self.Matty == True: self.vy = self.vy + 1 class Wall(Sprite): """ THIS IS BOXY'S WALL """ black = Color(0, 1) noline = LineStyle(0, black) asset = RectangleAsset(25, 25, noline, black) def __init__(self, position): super().__init__(Wall.asset, position) self.vx = 0 self.vy = 0 self.fxcenter = self.fycenter = 0.25 class Boxy(Sprite): """ THIS IS BOXY """ Black = Color(0, 1) oline = LineStyle(0, Black) blue = Color(0x0000ff, 1.0) asset = RectangleAsset(25, 50, oline, blue) def __init__(self, position): super().__init__(Boxy.asset, position) self.vx = 0 self.vy = 5 self.bricks = self.collidingWithSprites(Wall) self.boing = self.collidingWithSprites(Springo) self.fxcenter = self.fycenter = 0.25 self.Matty = True self.DonFluffles = False self.Melly = False Platformer.listenKeyEvent("keydown", "right arrow", self.moveright) Platformer.listenKeyEvent("keyup", "right arrow", self.moveoff) Platformer.listenKeyEvent("keydown", "left arrow", self.moveleft) Platformer.listenKeyEvent("keyup", "left arrow", self.moveoff) Platformer.listenKeyEvent("keydown", "up arrow", self.moveup) Platformer.listenKeyEvent("keyup", "up arrow", self.moveoff) Platformer.listenKeyEvent("keydown", "right arrow", self.Falling) Platformer.listenKeyEvent("keydown", "left arrow", self.Falling) def step(self): self.vy = self.vy + .75 self.y += self.vy bricks = self.collidingWithSprites(Wall) boing = self.collidingWithSprites(Springo) if len(boing) != 0: self.Melly = True if len(bricks) != 0: self.y -= self.vy self.vy = 0 self.Matty = False else: self.Matty = True if self.Matty == True: self.DonFluffles = True else: self.DonFluffles = False if self.Melly == True: self.vy = self.vy * -2 self.Melly = False self.x += self.vx bricks = self.collidingWithSprites(Wall) if len(bricks) != 0: self.x -= self.vx self.vx = 0 self.Matty = False else: self.Matty = True def Falling(self,event): if self.Matty == True: self.vy = self.vy + 1 def moveoff(self,event): self.vx = 0 self.vy = self.vy + 1 if self.Melly == True: self.vy = -30 self.Melly = False def moveright(self, event): if len(self.bricks) == 0: self.Matty = True if self.Matty == True: self.vx = 5 else: self.vx = 5 def moveleft(self,event): if len(self.bricks) == 0: self.Matty = True if self.Matty == True: self.vx = -5 else: self.vx = -5 def moveup(self,event): if len(self.bricks) == 0: self.Matty = True if self.DonFluffles == False: if self.Matty == True: self.vy = -15 else: self.vy = self.vy class Platformer(App): """ THIS IS BOXY'S WORLD """ def __init__(self, width, height): super().__init__(width, height) black = Color(1, 0) Black = Color(0, 1) Blue = Color(0x0000ff, 1.0) noline = LineStyle(5, Black) Noline = LineStyle(0, Black) bg_asset = RectangleAsset(width, height, noline, black) Platformer.listenKeyEvent("keydown", "w", self.Wall) Platformer.listenKeyEvent("keydown", "p", self.Boxy) Platformer.listenKeyEvent("keydown", "s", self.Springo) Platformer.listenMouseEvent('mousemove', self.mousemove) self.Robbie = False bg = Sprite(bg_asset, (0,0)) self.x = 0 self.y = 0 def step(self): for ship in self.getSpritesbyClass(Boxy): ship.step() if ship.y > 640: ship.y = -50 ship.vy = 0 for hip in self.getSpritesbyClass(Springo): hip.step() if hip.y > 640: hip.destroy() def mousemove(self, event): self.x = event.x self.y = event.y def Wall(self, event): self.x = round(self.x/25) self.y = round(self.y/25) self.x = self.x*25 self.y = self.y*25 Wall((self.x, self.y)) def Springo(self, event): self.x = round(self.x/25) self.y = round(self.y/25) self.x = self.x*25 self.y = self.y*25 Springo((self.x, self.y)) def Boxy(self, event): if self.Robbie == False: Boxy((self.x, self.y)) self.Robbie = True myapp = Platformer(SCREEN_WIDTH, SCREEN_HEIGHT) myapp.run()
mit
nexlab/domotikad
domotika/mediasources/modules/Sitecom/__init__.py
1
1420
########################################################################### # Copyright (c) 2011-2014 Unixmedia S.r.l. <info@unixmedia.it> # Copyright (c) 2011-2014 Franco (nextime) Lanza <franco@unixmedia.it> # # Domotika System Controller Daemon "domotikad" [http://trac.unixmedia.it] # # This file is part of domotikad. # # domotikad 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/>. # ############################################################################## # This is a twisted plugin directory try: from twisted.plugin import pluginPackagePaths __path__.extend(pluginPackagePaths(__name__)) except ImportError: # Twisted 2.5 doesn't include pluginPackagePaths import sys, os __path__.extend([os.path.abspath(os.path.join(x, 'mediasources', 'modules', 'Sitecom')) for x in sys.path]) __all__ = []
gpl-3.0
googleapis/googleapis-gen
google/cloud/recommendationengine/v1beta1/recommendationengine-v1beta1-py/google/cloud/recommendationengine_v1beta1/services/user_event_service/transports/grpc_asyncio.py
1
18458
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore from google.api_core import operations_v1 # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore from google.api import httpbody_pb2 # type: ignore from google.cloud.recommendationengine_v1beta1.types import import_ from google.cloud.recommendationengine_v1beta1.types import user_event as gcr_user_event from google.cloud.recommendationengine_v1beta1.types import user_event_service from google.longrunning import operations_pb2 # type: ignore from .base import UserEventServiceTransport, DEFAULT_CLIENT_INFO from .grpc import UserEventServiceGrpcTransport class UserEventServiceGrpcAsyncIOTransport(UserEventServiceTransport): """gRPC AsyncIO backend transport for UserEventService. Service for ingesting end user actions on the customer website. This class defines the same methods as the primary client, so the primary client can load the underlying transport implementation and call it. It sends protocol buffers over the wire using gRPC (which is built on top of HTTP/2); the ``grpcio`` package must be installed. """ _grpc_channel: aio.Channel _stubs: Dict[str, Callable] = {} @classmethod def create_channel(cls, host: str = 'recommendationengine.googleapis.com', credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs) -> aio.Channel: """Create and return a gRPC AsyncIO channel object. Args: host (Optional[str]): The host for the channel to use. credentials (Optional[~.Credentials]): The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. credentials_file (Optional[str]): A file with credentials that can be loaded with :func:`google.auth.load_credentials_from_file`. This argument is ignored if ``channel`` is provided. scopes (Optional[Sequence[str]]): A optional list of scopes needed for this service. These are only used when credentials are not specified and are passed to :func:`google.auth.default`. quota_project_id (Optional[str]): An optional project to use for billing and quota. kwargs (Optional[dict]): Keyword arguments, which are passed to the channel creation. Returns: aio.Channel: A gRPC AsyncIO channel object. """ return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, quota_project_id=quota_project_id, default_scopes=cls.AUTH_SCOPES, scopes=scopes, default_host=cls.DEFAULT_HOST, **kwargs ) def __init__(self, *, host: str = 'recommendationengine.googleapis.com', credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, channel: aio.Channel = None, api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. Args: host (Optional[str]): The hostname to connect to. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. This argument is ignored if ``channel`` is provided. credentials_file (Optional[str]): A file with credentials that can be loaded with :func:`google.auth.load_credentials_from_file`. This argument is ignored if ``channel`` is provided. scopes (Optional[Sequence[str]]): A optional list of scopes needed for this service. These are only used when credentials are not specified and are passed to :func:`google.auth.default`. channel (Optional[aio.Channel]): A ``Channel`` instance through which to make calls. api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. If provided, it overrides the ``host`` argument and tries to create a mutual TLS channel with client SSL credentials from ``client_cert_source`` or applicatin default SSL credentials. client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): Deprecated. A callback to provide client SSL certificate bytes and private key bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): A callback to provide client certificate bytes and private key bytes, both in PEM format. It is used to configure mutual TLS channel. It is ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): The client info used to send a user-agent string along with API requests. If ``None``, then default info will be used. Generally, you only need to set this if you're developing your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport creation failed for any reason. google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} self._operations_client = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) if client_cert_source: warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: # Ignore credentials if a channel was passed. credentials = False # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None else: if api_mtls_endpoint: host = api_mtls_endpoint # Create SSL credentials with client_cert_source or application # default SSL credentials. if client_cert_source: cert, key = client_cert_source() self._ssl_channel_credentials = grpc.ssl_channel_credentials( certificate_chain=cert, private_key=key ) else: self._ssl_channel_credentials = SslCredentials().ssl_credentials else: if client_cert_source_for_mtls and not ssl_channel_credentials: cert, key = client_cert_source_for_mtls() self._ssl_channel_credentials = grpc.ssl_channel_credentials( certificate_chain=cert, private_key=key ) # The base transport sets the host, credentials and scopes super().__init__( host=host, credentials=credentials, credentials_file=credentials_file, scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, ) if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, credentials=self._credentials, credentials_file=credentials_file, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), ("grpc.max_receive_message_length", -1), ], ) # Wrap messages. This must be done after self._grpc_channel exists self._prep_wrapped_messages(client_info) @property def grpc_channel(self) -> aio.Channel: """Create the channel designed to connect to this service. This property caches on the instance; repeated calls return the same channel. """ # Return the channel from cache. return self._grpc_channel @property def operations_client(self) -> operations_v1.OperationsAsyncClient: """Create the client designed to process long-running operations. This property caches on the instance; repeated calls return the same client. """ # Sanity check: Only create a new client if we do not already have one. if self._operations_client is None: self._operations_client = operations_v1.OperationsAsyncClient( self.grpc_channel ) # Return the client from cache. return self._operations_client @property def write_user_event(self) -> Callable[ [user_event_service.WriteUserEventRequest], Awaitable[gcr_user_event.UserEvent]]: r"""Return a callable for the write user event method over gRPC. Writes a single user event. Returns: Callable[[~.WriteUserEventRequest], Awaitable[~.UserEvent]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if 'write_user_event' not in self._stubs: self._stubs['write_user_event'] = self.grpc_channel.unary_unary( '/google.cloud.recommendationengine.v1beta1.UserEventService/WriteUserEvent', request_serializer=user_event_service.WriteUserEventRequest.serialize, response_deserializer=gcr_user_event.UserEvent.deserialize, ) return self._stubs['write_user_event'] @property def collect_user_event(self) -> Callable[ [user_event_service.CollectUserEventRequest], Awaitable[httpbody_pb2.HttpBody]]: r"""Return a callable for the collect user event method over gRPC. Writes a single user event from the browser. This uses a GET request to due to browser restriction of POST-ing to a 3rd party domain. This method is used only by the Recommendations AI JavaScript pixel. Users should not call this method directly. Returns: Callable[[~.CollectUserEventRequest], Awaitable[~.HttpBody]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if 'collect_user_event' not in self._stubs: self._stubs['collect_user_event'] = self.grpc_channel.unary_unary( '/google.cloud.recommendationengine.v1beta1.UserEventService/CollectUserEvent', request_serializer=user_event_service.CollectUserEventRequest.serialize, response_deserializer=httpbody_pb2.HttpBody.FromString, ) return self._stubs['collect_user_event'] @property def list_user_events(self) -> Callable[ [user_event_service.ListUserEventsRequest], Awaitable[user_event_service.ListUserEventsResponse]]: r"""Return a callable for the list user events method over gRPC. Gets a list of user events within a time range, with potential filtering. Returns: Callable[[~.ListUserEventsRequest], Awaitable[~.ListUserEventsResponse]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if 'list_user_events' not in self._stubs: self._stubs['list_user_events'] = self.grpc_channel.unary_unary( '/google.cloud.recommendationengine.v1beta1.UserEventService/ListUserEvents', request_serializer=user_event_service.ListUserEventsRequest.serialize, response_deserializer=user_event_service.ListUserEventsResponse.deserialize, ) return self._stubs['list_user_events'] @property def purge_user_events(self) -> Callable[ [user_event_service.PurgeUserEventsRequest], Awaitable[operations_pb2.Operation]]: r"""Return a callable for the purge user events method over gRPC. Deletes permanently all user events specified by the filter provided. Depending on the number of events specified by the filter, this operation could take hours or days to complete. To test a filter, use the list command first. Returns: Callable[[~.PurgeUserEventsRequest], Awaitable[~.Operation]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if 'purge_user_events' not in self._stubs: self._stubs['purge_user_events'] = self.grpc_channel.unary_unary( '/google.cloud.recommendationengine.v1beta1.UserEventService/PurgeUserEvents', request_serializer=user_event_service.PurgeUserEventsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs['purge_user_events'] @property def import_user_events(self) -> Callable[ [import_.ImportUserEventsRequest], Awaitable[operations_pb2.Operation]]: r"""Return a callable for the import user events method over gRPC. Bulk import of User events. Request processing might be synchronous. Events that already exist are skipped. Use this method for backfilling historical user events. Operation.response is of type ImportResponse. Note that it is possible for a subset of the items to be successfully inserted. Operation.metadata is of type ImportMetadata. Returns: Callable[[~.ImportUserEventsRequest], Awaitable[~.Operation]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if 'import_user_events' not in self._stubs: self._stubs['import_user_events'] = self.grpc_channel.unary_unary( '/google.cloud.recommendationengine.v1beta1.UserEventService/ImportUserEvents', request_serializer=import_.ImportUserEventsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs['import_user_events'] __all__ = ( 'UserEventServiceGrpcAsyncIOTransport', )
apache-2.0
epinna/weevely3
tests/test_generators.py
1
1917
from tests.config import base_folder, base_url from core.generate import generate, save_generated from core.channels.channel import Channel from unittest import TestCase import subprocess import utils import random import hashlib import os def setUpModule(): subprocess.check_output(""" BASE_FOLDER="{base_folder}/generators/" rm -rf "$BASE_FOLDER" mkdir "$BASE_FOLDER" chown www-data: -R "$BASE_FOLDER/" """.format( base_folder = base_folder ), shell=True) class TestGenerators(TestCase): def test_generators(self): for i in range(0, 100): self._randomize_bd() obfuscated = generate(self.password.decode('utf-8')) save_generated(obfuscated, self.path) self.channel = Channel( 'ObfPost', { 'url' : self.url, 'password' : self.password.decode('utf-8') } ) self._incremental_requests(10, 100, 30, 50) self._clean_bd() def _incremental_requests( self, size_start, size_to, step_rand_start, step_rand_to): for i in range(size_start, size_to, random.randint(step_rand_start, step_rand_to)): payload = utils.strings.randstr(i) self.assertEqual( self.channel.send( 'echo("%s");' % payload.decode('utf-8'))[0], payload) @classmethod def _randomize_bd(cls): cls.password = utils.strings.randstr(10) password_hash = hashlib.md5(cls.password).hexdigest().lower() filename = '%s_%s.php' % ( __name__, cls.password) cls.url = os.path.join(base_url, 'generators', filename) cls.path = os.path.join(base_folder, 'generators', filename) @classmethod def _clean_bd(cls): os.remove(cls.path)
gpl-3.0
IITBinterns13/edx-platform-dev
common/lib/capa/capa/tests/__init__.py
11
1633
import fs.osfs import os, os.path from capa.capa_problem import LoncapaProblem from mock import Mock, MagicMock import xml.sax.saxutils as saxutils TEST_DIR = os.path.dirname(os.path.realpath(__file__)) def tst_render_template(template, context): """ A test version of render to template. Renders to the repr of the context, completely ignoring the template name. To make the output valid xml, quotes the content, and wraps it in a <div> """ return '<div>{0}</div>'.format(saxutils.escape(repr(context))) def calledback_url(dispatch = 'score_update'): return dispatch xqueue_interface = MagicMock() xqueue_interface.send_to_queue.return_value = (0, 'Success!') def test_system(): """ Construct a mock ModuleSystem instance. """ the_system = Mock( ajax_url='courses/course_id/modx/a_location', track_function=Mock(), get_module=Mock(), render_template=tst_render_template, replace_urls=Mock(), user=Mock(), filestore=fs.osfs.OSFS(os.path.join(TEST_DIR, "test_files")), debug=True, xqueue={'interface': xqueue_interface, 'construct_callback': calledback_url, 'default_queuename': 'testqueue', 'waittime': 10}, node_path=os.environ.get("NODE_PATH", "/usr/local/lib/node_modules"), anonymous_student_id='student', cache=None, can_execute_unsafe_code=lambda: False, ) return the_system def new_loncapa_problem(xml, system=None): """Construct a `LoncapaProblem` suitable for unit tests.""" return LoncapaProblem(xml, id='1', seed=723, system=system or test_system())
agpl-3.0
GHackAnonymous/linux
tools/perf/python/twatch.py
1565
1316
#! /usr/bin/python # -*- python -*- # -*- coding: utf-8 -*- # twatch - Experimental use of the perf python interface # Copyright (C) 2011 Arnaldo Carvalho de Melo <acme@redhat.com> # # This application 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; version 2. # # This application is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. import perf def main(): cpus = perf.cpu_map() threads = perf.thread_map() evsel = perf.evsel(task = 1, comm = 1, mmap = 0, wakeup_events = 1, watermark = 1, sample_id_all = 1, sample_type = perf.SAMPLE_PERIOD | perf.SAMPLE_TID | perf.SAMPLE_CPU) evsel.open(cpus = cpus, threads = threads); evlist = perf.evlist(cpus, threads) evlist.add(evsel) evlist.mmap() while True: evlist.poll(timeout = -1) for cpu in cpus: event = evlist.read_on_cpu(cpu) if not event: continue print "cpu: %2d, pid: %4d, tid: %4d" % (event.sample_cpu, event.sample_pid, event.sample_tid), print event if __name__ == '__main__': main()
gpl-2.0
javierTerry/odoo
addons/account/company.py
384
2814
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## from openerp.osv import fields, osv class res_company(osv.osv): _inherit = "res.company" _columns = { 'expects_chart_of_accounts': fields.boolean('Expects a Chart of Accounts'), 'tax_calculation_rounding_method': fields.selection([ ('round_per_line', 'Round per Line'), ('round_globally', 'Round Globally'), ], 'Tax Calculation Rounding Method', help="If you select 'Round per Line' : for each tax, the tax amount will first be computed and rounded for each PO/SO/invoice line and then these rounded amounts will be summed, leading to the total amount for that tax. If you select 'Round Globally': for each tax, the tax amount will be computed for each PO/SO/invoice line, then these amounts will be summed and eventually this total tax amount will be rounded. If you sell with tax included, you should choose 'Round per line' because you certainly want the sum of your tax-included line subtotals to be equal to the total amount with taxes."), 'paypal_account': fields.char("Paypal Account", size=128, help="Paypal username (usually email) for receiving online payments."), 'overdue_msg': fields.text('Overdue Payments Message', translate=True), } _defaults = { 'expects_chart_of_accounts': True, 'tax_calculation_rounding_method': 'round_per_line', 'overdue_msg': '''Dear Sir/Madam, Our records indicate that some payments on your account are still due. Please find details below. If the amount has already been paid, please disregard this notice. Otherwise, please forward us the total amount stated below. If you have any queries regarding your account, Please contact us. Thank you in advance for your cooperation. Best Regards,''' } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
agpl-3.0
wangxuan007/flasky
venv/lib/python2.7/site-packages/flask_script/commands.py
56
18544
# -*- coding: utf-8 -*- from __future__ import absolute_import,print_function import os import sys import code import warnings import string import inspect import argparse from flask import _request_ctx_stack from .cli import prompt, prompt_pass, prompt_bool, prompt_choices from ._compat import izip, text_type class InvalidCommand(Exception): """\ This is a generic error for "bad" commands. It is not used in Flask-Script itself, but you should throw this error (or one derived from it) in your command handlers, and your main code should display this error's message without a stack trace. This way, we maintain interoperability if some other plug-in code supplies Flask-Script hooks. """ pass class Group(object): """ Stores argument groups and mutually exclusive groups for `ArgumentParser.add_argument_group <http://argparse.googlecode.com/svn/trunk/doc/other-methods.html#argument-groups>` or `ArgumentParser.add_mutually_exclusive_group <http://argparse.googlecode.com/svn/trunk/doc/other-methods.html#add_mutually_exclusive_group>`. Note: The title and description params cannot be used with the exclusive or required params. :param options: A list of Option classes to add to this group :param title: A string to use as the title of the argument group :param description: A string to use as the description of the argument group :param exclusive: A boolean indicating if this is an argument group or a mutually exclusive group :param required: A boolean indicating if this mutually exclusive group must have an option selected """ def __init__(self, *options, **kwargs): self.option_list = options self.title = kwargs.pop("title", None) self.description = kwargs.pop("description", None) self.exclusive = kwargs.pop("exclusive", None) self.required = kwargs.pop("required", None) if ((self.title or self.description) and (self.required or self.exclusive)): raise TypeError("title and/or description cannot be used with " "required and/or exclusive.") super(Group, self).__init__(**kwargs) def get_options(self): """ By default, returns self.option_list. Override if you need to do instance-specific configuration. """ return self.option_list class Option(object): """ Stores positional and optional arguments for `ArgumentParser.add_argument <http://argparse.googlecode.com/svn/trunk/doc/add_argument.html>`_. :param name_or_flags: Either a name or a list of option strings, e.g. foo or -f, --foo :param action: The basic type of action to be taken when this argument is encountered at the command-line. :param nargs: The number of command-line arguments that should be consumed. :param const: A constant value required by some action and nargs selections. :param default: The value produced if the argument is absent from the command-line. :param type: The type to which the command-line arg should be converted. :param choices: A container of the allowable values for the argument. :param required: Whether or not the command-line option may be omitted (optionals only). :param help: A brief description of what the argument does. :param metavar: A name for the argument in usage messages. :param dest: The name of the attribute to be added to the object returned by parse_args(). """ def __init__(self, *args, **kwargs): self.args = args self.kwargs = kwargs class Command(object): """ Base class for creating commands. :param func: Initialize this command by introspecting the function. """ option_list = () help_args = None def __init__(self, func=None): if func is None: if not self.option_list: self.option_list = [] return args, varargs, keywords, defaults = inspect.getargspec(func) if inspect.ismethod(func): args = args[1:] options = [] # first arg is always "app" : ignore defaults = defaults or [] kwargs = dict(izip(*[reversed(l) for l in (args, defaults)])) for arg in args: if arg in kwargs: default = kwargs[arg] if isinstance(default, bool): options.append(Option('-%s' % arg[0], '--%s' % arg, action="store_true", dest=arg, required=False, default=default)) else: options.append(Option('-%s' % arg[0], '--%s' % arg, dest=arg, type=text_type, required=False, default=default)) else: options.append(Option(arg, type=text_type)) self.run = func self.__doc__ = func.__doc__ self.option_list = options @property def description(self): description = self.__doc__ or '' return description.strip() def add_option(self, option): """ Adds Option to option list. """ self.option_list.append(option) def get_options(self): """ By default, returns self.option_list. Override if you need to do instance-specific configuration. """ return self.option_list def create_parser(self, *args, **kwargs): func_stack = kwargs.pop('func_stack',()) parent = kwargs.pop('parent',None) parser = argparse.ArgumentParser(*args, add_help=False, **kwargs) help_args = self.help_args while help_args is None and parent is not None: help_args = parent.help_args parent = getattr(parent,'parent',None) if help_args: from flask_script import add_help add_help(parser,help_args) for option in self.get_options(): if isinstance(option, Group): if option.exclusive: group = parser.add_mutually_exclusive_group( required=option.required, ) else: group = parser.add_argument_group( title=option.title, description=option.description, ) for opt in option.get_options(): group.add_argument(*opt.args, **opt.kwargs) else: parser.add_argument(*option.args, **option.kwargs) parser.set_defaults(func_stack=func_stack+(self,)) self.parser = parser self.parent = parent return parser def __call__(self, app=None, *args, **kwargs): """ Handles the command with the given app. Default behaviour is to call ``self.run`` within a test request context. """ with app.test_request_context(): return self.run(*args, **kwargs) def run(self): """ Runs a command. This must be implemented by the subclass. Should take arguments as configured by the Command options. """ raise NotImplementedError class Shell(Command): """ Runs a Python shell inside Flask application context. :param banner: banner appearing at top of shell when started :param make_context: a callable returning a dict of variables used in the shell namespace. By default returns a dict consisting of just the app. :param use_bpython: use BPython shell if available, ignore if not. The BPython shell can be turned off in command line by passing the **--no-bpython** flag. :param use_ipython: use IPython shell if available, ignore if not. The IPython shell can be turned off in command line by passing the **--no-ipython** flag. """ banner = '' help = description = 'Runs a Python shell inside Flask application context.' def __init__(self, banner=None, make_context=None, use_ipython=True, use_bpython=True): self.banner = banner or self.banner self.use_ipython = use_ipython self.use_bpython = use_bpython if make_context is None: make_context = lambda: dict(app=_request_ctx_stack.top.app) self.make_context = make_context def get_options(self): return ( Option('--no-ipython', action="store_true", dest='no_ipython', default=not(self.use_ipython), help="Do not use the BPython shell"), Option('--no-bpython', action="store_true", dest='no_bpython', default=not(self.use_bpython), help="Do not use the IPython shell"), ) def get_context(self): """ Returns a dict of context variables added to the shell namespace. """ return self.make_context() def run(self, no_ipython, no_bpython): """ Runs the shell. If no_bpython is False or use_bpython is True, then a BPython shell is run (if installed). Else, if no_ipython is False or use_python is True then a IPython shell is run (if installed). """ context = self.get_context() if not no_bpython: # Try BPython try: from bpython import embed embed(banner=self.banner, locals_=context) return except ImportError: pass if not no_ipython: # Try IPython try: try: # 0.10.x from IPython.Shell import IPShellEmbed ipshell = IPShellEmbed(banner=self.banner) ipshell(global_ns=dict(), local_ns=context) except ImportError: # 0.12+ from IPython import embed embed(banner1=self.banner, user_ns=context) return except ImportError: pass # Use basic python shell code.interact(self.banner, local=context) class Server(Command): """ Runs the Flask development server i.e. app.run() :param host: server host :param port: server port :param use_debugger: Flag whether to default to using the Werkzeug debugger. This can be overriden in the command line by passing the **-d** or **-D** flag. Defaults to False, for security. :param use_reloader: Flag whether to use the auto-reloader. Default to True when debugging. This can be overriden in the command line by passing the **-r**/**-R** flag. :param threaded: should the process handle each request in a separate thread? :param processes: number of processes to spawn :param passthrough_errors: disable the error catching. This means that the server will die on errors but it can be useful to hook debuggers in (pdb etc.) :param options: :func:`werkzeug.run_simple` options. """ help = description = 'Runs the Flask development server i.e. app.run()' def __init__(self, host='127.0.0.1', port=5000, use_debugger=None, use_reloader=None, threaded=False, processes=1, passthrough_errors=False, **options): self.port = port self.host = host self.use_debugger = use_debugger self.use_reloader = use_reloader if use_reloader is not None else use_debugger self.server_options = options self.threaded = threaded self.processes = processes self.passthrough_errors = passthrough_errors def get_options(self): options = ( Option('-h', '--host', dest='host', default=self.host), Option('-p', '--port', dest='port', type=int, default=self.port), Option('--threaded', dest='threaded', action='store_true', default=self.threaded), Option('--processes', dest='processes', type=int, default=self.processes), Option('--passthrough-errors', action='store_true', dest='passthrough_errors', default=self.passthrough_errors), Option('-d', '--debug', action='store_true', dest='use_debugger', help='enable the Werkzeug debugger (DO NOT use in production code)', default=self.use_debugger), Option('-D', '--no-debug', action='store_false', dest='use_debugger', help='disable the Werkzeug debugger', default=self.use_debugger), Option('-r', '--reload', action='store_true', dest='use_reloader', help='monitor Python files for changes (not 100% safe for production use)', default=self.use_reloader), Option('-R', '--no-reload', action='store_false', dest='use_reloader', help='do not monitor Python files for changes', default=self.use_reloader), ) return options def __call__(self, app, host, port, use_debugger, use_reloader, threaded, processes, passthrough_errors): # we don't need to run the server in request context # so just run it directly if use_debugger is None: use_debugger = app.debug if use_debugger is None: use_debugger = True if sys.stderr.isatty(): print("Debugging is on. DANGER: Do not allow random users to connect to this server.", file=sys.stderr) if use_reloader is None: use_reloader = app.debug app.run(host=host, port=port, debug=use_debugger, use_debugger=use_debugger, use_reloader=use_reloader, threaded=threaded, processes=processes, passthrough_errors=passthrough_errors, **self.server_options) class Clean(Command): "Remove *.pyc and *.pyo files recursively starting at current directory" def run(self): for dirpath, dirnames, filenames in os.walk('.'): for filename in filenames: if filename.endswith('.pyc') or filename.endswith('.pyo'): full_pathname = os.path.join(dirpath, filename) print('Removing %s' % full_pathname) os.remove(full_pathname) class ShowUrls(Command): """ Displays all of the url matching routes for the project """ def __init__(self, order='rule'): self.order = order def get_options(self): return ( Option('url', nargs='?', help='Url to test (ex. /static/image.png)'), Option('--order', dest='order', default=self.order, help='Property on Rule to order by (default: %s)' % self.order) ) return options def run(self, url, order): from flask import current_app from werkzeug.exceptions import NotFound, MethodNotAllowed rows = [] column_length = 0 column_headers = ('Rule', 'Endpoint', 'Arguments') if url: try: rule, arguments = current_app.url_map \ .bind('localhost') \ .match(url, return_rule=True) rows.append((rule.rule, rule.endpoint, arguments)) column_length = 3 except (NotFound, MethodNotAllowed) as e: rows.append(("<%s>" % e, None, None)) column_length = 1 else: rules = sorted(current_app.url_map.iter_rules(), key=lambda rule: getattr(rule, order)) for rule in rules: rows.append((rule.rule, rule.endpoint, None)) column_length = 2 str_template = '' table_width = 0 if column_length >= 1: max_rule_length = max(len(r[0]) for r in rows) max_rule_length = max_rule_length if max_rule_length > 4 else 4 str_template += '%-' + str(max_rule_length) + 's' table_width += max_rule_length if column_length >= 2: max_endpoint_length = max(len(str(r[1])) for r in rows) # max_endpoint_length = max(rows, key=len) max_endpoint_length = max_endpoint_length if max_endpoint_length > 8 else 8 str_template += ' %-' + str(max_endpoint_length) + 's' table_width += 2 + max_endpoint_length if column_length >= 3: max_arguments_length = max(len(str(r[2])) for r in rows) max_arguments_length = max_arguments_length if max_arguments_length > 9 else 9 str_template += ' %-' + str(max_arguments_length) + 's' table_width += 2 + max_arguments_length print(str_template % (column_headers[:column_length])) print('-' * table_width) for row in rows: print(str_template % row[:column_length])
gpl-3.0
RedhawkSDR/throughput
streams/corba/__init__.py
1
2738
# # This file is protected by Copyright. Please refer to the COPYRIGHT file # distributed with this source distribution. # # This file is part of REDHAWK throughput. # # REDHAWK throughput 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. # # REDHAWK throughput is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see http://www.gnu.org/licenses/. # import subprocess import omniORB import rawdata __all__ = ('factory') class CorbaStream(object): def __init__(self, orbargs, orb, format, numa_policy): reader_args = numa_policy(['streams/corba/reader'] + orbargs) self.reader_proc = subprocess.Popen(reader_args, stdout=subprocess.PIPE) ior = self.reader_proc.stdout.readline().rstrip() self.reader = orb.string_to_object(ior) writer_args = numa_policy(['streams/corba/writer'] + orbargs) self.writer_proc = subprocess.Popen(writer_args, stdout=subprocess.PIPE) ior = self.writer_proc.stdout.readline().rstrip() self.writer = orb.string_to_object(ior) self.writer.connect(self.reader, format) def start(self): self.writer.start() def stop(self): self.writer.stop() def get_reader(self): return self.reader_proc.pid def get_writer(self): return self.writer_proc.pid def transfer_size(self, size): self.writer.transfer_length(size) def received(self): return self.reader.received() def terminate(self): self.reader_proc.terminate() self.writer_proc.terminate() self.reader_proc.kill() self.writer_proc.kill() self.reader_proc.wait() self.reader_proc.wait() class CorbaStreamFactory(object): def __init__(self, transport): if transport == 'unix': self.orbargs = ['-ORBendPoint', 'giop:unix:'] else: self.orbargs = ['-ORBendPoint', 'giop:tcp::'] self.orbargs += [ '-ORBgiopMaxMsgSize', str(50*1024*1024)] self.orb = omniORB.CORBA.ORB_init() def create(self, data_format, numa_policy): return CorbaStream(self.orbargs, self.orb, data_format, numa_policy) def cleanup(self): self.orb.destroy() def factory(transport): return CorbaStreamFactory(transport)
lgpl-3.0
mitchellzen/pops
satchmo/apps/payment/signals.py
13
1911
import django.dispatch #: Sent after ensuring that the cart and order are valid. #: #: :param sender: The controller which performed the sanity check. #: :type sender: ``payment.views.confirm.ConfirmController`` #: #: :param controller: The controller which performed the sanity check. #: :type controller: ``payment.views.confirm.ConfirmController`` #: #: .. Note:: *sender* is the same as *controller*. confirm_sanity_check = django.dispatch.Signal() #: Sent after a list of payment choices is compiled, allows the editing of #: payment choices. #: #: :param sender: Always ``None`` #: #: :param methods: A list of 2-element tuples containing the name and label for #: each active payment module. payment_choices = django.dispatch.Signal() #: Sent when a ``payment.forms.PaymentMethodForm`` is initialized. Receivers #: have cart/order passed in variables to check the contents and modify methods #: list if neccessary. #: #: :param sender: The form that is being initialized. #: :type sender: ``payment.forms.PaymentMethodForm`` #: #: :param methods: A list of 2-element tuples containing the name and label for #: each active payment module. #: #: :param cart: The cart. #: :type cart: ``satchmo_store.shop.models.Cart`` #: #: :param order: The current order. #: :type order: ``satchmo_store.shop.models.Order`` #: #: :param contact: The contact representing the current customer if #: authenticated; it is None otherwise. #: :type contact: ``satchmo_store.contact.models.Contact`` #: #: The following example shows how to conditionally modify the payment choices #: presented to a customer:: #: #: def adjust_payment_choices(sender, contact, methods, **kwargs): #: if should_reduce: # whatever your condition is #: for method in methods: #: if method[0] == 'PAYMENT_PMTKEY': #: methods.remove(method) payment_methods_query = django.dispatch.Signal()
bsd-3-clause
PaulStoffregen/micropython
tests/bytecode/pylib-tests/_weakrefset.py
766
5570
# Access WeakSet through the weakref module. # This code is separated-out because it is needed # by abc.py to load everything else at startup. from _weakref import ref __all__ = ['WeakSet'] class _IterationGuard: # This context manager registers itself in the current iterators of the # weak container, such as to delay all removals until the context manager # exits. # This technique should be relatively thread-safe (since sets are). def __init__(self, weakcontainer): # Don't create cycles self.weakcontainer = ref(weakcontainer) def __enter__(self): w = self.weakcontainer() if w is not None: w._iterating.add(self) return self def __exit__(self, e, t, b): w = self.weakcontainer() if w is not None: s = w._iterating s.remove(self) if not s: w._commit_removals() class WeakSet: def __init__(self, data=None): self.data = set() def _remove(item, selfref=ref(self)): self = selfref() if self is not None: if self._iterating: self._pending_removals.append(item) else: self.data.discard(item) self._remove = _remove # A list of keys to be removed self._pending_removals = [] self._iterating = set() if data is not None: self.update(data) def _commit_removals(self): l = self._pending_removals discard = self.data.discard while l: discard(l.pop()) def __iter__(self): with _IterationGuard(self): for itemref in self.data: item = itemref() if item is not None: yield item def __len__(self): return len(self.data) - len(self._pending_removals) def __contains__(self, item): try: wr = ref(item) except TypeError: return False return wr in self.data def __reduce__(self): return (self.__class__, (list(self),), getattr(self, '__dict__', None)) def add(self, item): if self._pending_removals: self._commit_removals() self.data.add(ref(item, self._remove)) def clear(self): if self._pending_removals: self._commit_removals() self.data.clear() def copy(self): return self.__class__(self) def pop(self): if self._pending_removals: self._commit_removals() while True: try: itemref = self.data.pop() except KeyError: raise KeyError('pop from empty WeakSet') item = itemref() if item is not None: return item def remove(self, item): if self._pending_removals: self._commit_removals() self.data.remove(ref(item)) def discard(self, item): if self._pending_removals: self._commit_removals() self.data.discard(ref(item)) def update(self, other): if self._pending_removals: self._commit_removals() for element in other: self.add(element) def __ior__(self, other): self.update(other) return self def difference(self, other): newset = self.copy() newset.difference_update(other) return newset __sub__ = difference def difference_update(self, other): self.__isub__(other) def __isub__(self, other): if self._pending_removals: self._commit_removals() if self is other: self.data.clear() else: self.data.difference_update(ref(item) for item in other) return self def intersection(self, other): return self.__class__(item for item in other if item in self) __and__ = intersection def intersection_update(self, other): self.__iand__(other) def __iand__(self, other): if self._pending_removals: self._commit_removals() self.data.intersection_update(ref(item) for item in other) return self def issubset(self, other): return self.data.issubset(ref(item) for item in other) __le__ = issubset def __lt__(self, other): return self.data < set(ref(item) for item in other) def issuperset(self, other): return self.data.issuperset(ref(item) for item in other) __ge__ = issuperset def __gt__(self, other): return self.data > set(ref(item) for item in other) def __eq__(self, other): if not isinstance(other, self.__class__): return NotImplemented return self.data == set(ref(item) for item in other) def symmetric_difference(self, other): newset = self.copy() newset.symmetric_difference_update(other) return newset __xor__ = symmetric_difference def symmetric_difference_update(self, other): self.__ixor__(other) def __ixor__(self, other): if self._pending_removals: self._commit_removals() if self is other: self.data.clear() else: self.data.symmetric_difference_update(ref(item, self._remove) for item in other) return self def union(self, other): return self.__class__(e for s in (self, other) for e in s) __or__ = union def isdisjoint(self, other): return len(self.intersection(other)) == 0
mit
steebchen/youtube-dl
youtube_dl/extractor/rtl2.py
12
7153
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..aes import aes_cbc_decrypt from ..compat import ( compat_b64decode, compat_ord, compat_str, ) from ..utils import ( bytes_to_intlist, ExtractorError, intlist_to_bytes, int_or_none, strip_or_none, ) class RTL2IE(InfoExtractor): IE_NAME = 'rtl2' _VALID_URL = r'http?://(?:www\.)?rtl2\.de/[^?#]*?/(?P<id>[^?#/]*?)(?:$|/(?:$|[?#]))' _TESTS = [{ 'url': 'http://www.rtl2.de/sendung/grip-das-motormagazin/folge/folge-203-0', 'info_dict': { 'id': 'folge-203-0', 'ext': 'f4v', 'title': 'GRIP sucht den Sommerkönig', 'description': 'md5:e3adbb940fd3c6e76fa341b8748b562f' }, 'params': { # rtmp download 'skip_download': True, }, }, { 'url': 'http://www.rtl2.de/sendung/koeln-50667/video/5512-anna/21040-anna-erwischt-alex/', 'info_dict': { 'id': '21040-anna-erwischt-alex', 'ext': 'mp4', 'title': 'Anna erwischt Alex!', 'description': 'Anna nimmt ihrem Vater nicht ab, dass er nicht spielt. Und tatsächlich erwischt sie ihn auf frischer Tat.' }, 'params': { # rtmp download 'skip_download': True, }, }] def _real_extract(self, url): # Some rtl2 urls have no slash at the end, so append it. if not url.endswith('/'): url += '/' video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) mobj = re.search( r'<div[^>]+data-collection="(?P<vico_id>\d+)"[^>]+data-video="(?P<vivi_id>\d+)"', webpage) if mobj: vico_id = mobj.group('vico_id') vivi_id = mobj.group('vivi_id') else: vico_id = self._html_search_regex( r'vico_id\s*:\s*([0-9]+)', webpage, 'vico_id') vivi_id = self._html_search_regex( r'vivi_id\s*:\s*([0-9]+)', webpage, 'vivi_id') info = self._download_json( 'http://www.rtl2.de/sites/default/modules/rtl2/mediathek/php/get_video_jw.php', video_id, query={ 'vico_id': vico_id, 'vivi_id': vivi_id, }) video_info = info['video'] title = video_info['titel'] formats = [] rtmp_url = video_info.get('streamurl') if rtmp_url: rtmp_url = rtmp_url.replace('\\', '') stream_url = 'mp4:' + self._html_search_regex(r'/ondemand/(.+)', rtmp_url, 'stream URL') rtmp_conn = ['S:connect', 'O:1', 'NS:pageUrl:' + url, 'NB:fpad:0', 'NN:videoFunction:1', 'O:0'] formats.append({ 'format_id': 'rtmp', 'url': rtmp_url, 'play_path': stream_url, 'player_url': 'http://www.rtl2.de/flashplayer/vipo_player.swf', 'page_url': url, 'flash_version': 'LNX 11,2,202,429', 'rtmp_conn': rtmp_conn, 'no_resume': True, 'preference': 1, }) m3u8_url = video_info.get('streamurl_hls') if m3u8_url: formats.extend(self._extract_akamai_formats(m3u8_url, video_id)) self._sort_formats(formats) return { 'id': video_id, 'title': title, 'thumbnail': video_info.get('image'), 'description': video_info.get('beschreibung'), 'duration': int_or_none(video_info.get('duration')), 'formats': formats, } class RTL2YouBaseIE(InfoExtractor): _BACKWERK_BASE_URL = 'https://p-you-backwerk.rtl2apps.de/' class RTL2YouIE(RTL2YouBaseIE): IE_NAME = 'rtl2:you' _VALID_URL = r'http?://you\.rtl2\.de/(?:video/\d+/|youplayer/index\.html\?.*?\bvid=)(?P<id>\d+)' _TESTS = [{ 'url': 'http://you.rtl2.de/video/3002/15740/MJUNIK%20%E2%80%93%20Home%20of%20YOU/307-hirn-wo-bist-du', 'info_dict': { 'id': '15740', 'ext': 'mp4', 'title': 'MJUNIK – Home of YOU - #307 Hirn, wo bist du?!', 'description': 'md5:ddaa95c61b372b12b66e115b2772fe01', 'age_limit': 12, }, }, { 'url': 'http://you.rtl2.de/youplayer/index.html?vid=15712', 'only_matching': True, }] _AES_KEY = b'\xe9W\xe4.<*\xb8\x1a\xd2\xb6\x92\xf3C\xd3\xefL\x1b\x03*\xbbbH\xc0\x03\xffo\xc2\xf2(\xaa\xaa!' _GEO_COUNTRIES = ['DE'] def _real_extract(self, url): video_id = self._match_id(url) stream_data = self._download_json( self._BACKWERK_BASE_URL + 'stream/video/' + video_id, video_id) data, iv = compat_b64decode(stream_data['streamUrl']).decode().split(':') stream_url = intlist_to_bytes(aes_cbc_decrypt( bytes_to_intlist(compat_b64decode(data)), bytes_to_intlist(self._AES_KEY), bytes_to_intlist(compat_b64decode(iv)) )) if b'rtl2_you_video_not_found' in stream_url: raise ExtractorError('video not found', expected=True) formats = self._extract_m3u8_formats( stream_url[:-compat_ord(stream_url[-1])].decode(), video_id, 'mp4', 'm3u8_native') self._sort_formats(formats) video_data = self._download_json( self._BACKWERK_BASE_URL + 'video/' + video_id, video_id) series = video_data.get('formatTitle') title = episode = video_data.get('title') or series if series and series != title: title = '%s - %s' % (series, title) return { 'id': video_id, 'title': title, 'formats': formats, 'description': strip_or_none(video_data.get('description')), 'thumbnail': video_data.get('image'), 'duration': int_or_none(stream_data.get('duration') or video_data.get('duration'), 1000), 'series': series, 'episode': episode, 'age_limit': int_or_none(video_data.get('minimumAge')), } class RTL2YouSeriesIE(RTL2YouBaseIE): IE_NAME = 'rtl2:you:series' _VALID_URL = r'http?://you\.rtl2\.de/videos/(?P<id>\d+)' _TEST = { 'url': 'http://you.rtl2.de/videos/115/dragon-ball', 'info_dict': { 'id': '115', }, 'playlist_mincount': 5, } def _real_extract(self, url): series_id = self._match_id(url) stream_data = self._download_json( self._BACKWERK_BASE_URL + 'videos', series_id, query={ 'formatId': series_id, 'limit': 1000000000, }) entries = [] for video in stream_data.get('videos', []): video_id = compat_str(video['videoId']) if not video_id: continue entries.append(self.url_result( 'http://you.rtl2.de/video/%s/%s' % (series_id, video_id), 'RTL2You', video_id)) return self.playlist_result(entries, series_id)
unlicense
sanket4373/keystone
keystone/common/sql/migrate_repo/versions/025_add_index_to_valid.py
4
1086
# Copyright 2013 OpenStack Foundation # # 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 sqlalchemy as sql def upgrade(migrate_engine): meta = sql.MetaData() meta.bind = migrate_engine token = sql.Table('token', meta, autoload=True) idx = sql.Index('ix_token_valid', token.c.valid) idx.create(migrate_engine) def downgrade(migrate_engine): meta = sql.MetaData() meta.bind = migrate_engine token = sql.Table('token', meta, autoload=True) idx = sql.Index('ix_token_valid', token.c.valid) idx.drop(migrate_engine)
apache-2.0
madmongo1/hunter
maintenance/docs_create_missing_stubs.py
20
2271
import os import subprocess # hardcoded paths HUNTER_DIR='..' PACKAGES_DIR=os.path.join(HUNTER_DIR, 'cmake/projects') DOCS_PKG_DIR=os.path.join(HUNTER_DIR, 'docs', 'packages', 'pkg') # get all wiki entries docs_filenames = [x for x in os.listdir(DOCS_PKG_DIR) if x.endswith('.rst')] docs_entries = [x[:-4] for x in docs_filenames] # get all hunter package entries pkg_entries = [x for x in os.listdir(PACKAGES_DIR) if os.path.isdir(os.path.join(PACKAGES_DIR, x))] pkg_entries_lower = [x.lower() for x in pkg_entries] # packages both in hunter and wiki pkg_match = [x for x in pkg_entries if x in docs_entries] # packages only in hunter pkg_only_hunter = [x for x in pkg_entries if x not in pkg_match] # output directories packages_dir = 'packages' only_hunter_dir = 'packages/only_hunter' # create if not exist for d in [packages_dir, only_hunter_dir]: if not os.path.exists(d): os.mkdir(d) # header for rst files header_format_string = """.. spelling:: {} .. index:: unsorted ; {} .. _pkg.{}: {} {} """ template_string = """ .. warning:: This page is a template and contains no real information. Please send pull request with real description. - `__FIXME__ Official <https://__FIXME__>`__ - `__FIXME__ Hunterized <https://github.com/hunter-packages/__FIXME__>`__ - `__FIXME__ Example <https://github.com/ruslo/hunter/blob/master/examples/__FIXME__/CMakeLists.txt>`__ - Available since `__FIXME__ vX.Y.Z <https://github.com/ruslo/hunter/releases/tag/vX.Y.Z>`__ - Added by `__FIXME__ <https://github.com/__FIXME__>`__ (`__FIXME__ pr-N <https://github.com/ruslo/hunter/pull/N>`__) .. code-block:: cmake hunter_add_package(__FIXME__) find_package(__FIXME__ CONFIG REQUIRED) target_link_libraries(foo __FIXME__::__FIXME__) """ # create dummy entries for packages only in hunter for entry in pkg_only_hunter: target_rst = os.path.join(only_hunter_dir, entry + '.rst') underscores = "=" * len(entry) header = header_format_string.format(entry, entry, entry, entry, underscores) #print(header) with open(target_rst, 'w') as f: f.write(header) f.write(template_string) print("pkg_match entries: ", len(pkg_match)) print("pkg_only_hunter entries: ", len(pkg_only_hunter))
bsd-2-clause
porduna/weblabdeusto
tools/wcloud/wcloud/test/test_celery_db.py
4
1620
import os import unittest from nose.tools import assert_is_not_none from sqlalchemy import text from wcloud.tasks.db_tasks import connect, create_db, destroy_db # Fix the working directory. cwd = os.getcwd() if cwd.endswith(os.path.join("wcloud", "test")): cwd = cwd[0:len(cwd)-len(os.path.join("wcloud", "test"))] os.chdir(cwd) class TestDatabaseTasks(unittest.TestCase): def test_connect(self): """ Test that we can connect to the database. """ engine = connect("root", "password") assert_is_not_none(engine, "Engine is None") def test_create_db(self): """ Test that we can successfully create a database. """ result = create_db.delay("root", "password", "wcloudtest", "wcloud", "password") db_name = result.get() assert db_name.startswith("wcloudtest") def test_destroy_db(self): db = create_db.delay("root", "password", "wcloudtest", "wcloud", "password").get() destroy_db.delay("root", "password", db).get() engine = connect("root", "password") dbs = engine.execute("SHOW databases LIKE '%s'" % db).fetchall() assert len(dbs) == 0 def _clearTestDatabases(self): engine = connect("root", "password") dbs = engine.execute(text("SHOW databases LIKE :bn"), bn="%s%%" % "wcloudtest") dbs = dbs.fetchall() dbs = [db[0] for db in dbs] for db in dbs: engine.execute("DROP DATABASE %s" % db) def setUp(self): self._clearTestDatabases() def tearDown(self): self._clearTestDatabases()
bsd-2-clause
kangkot/arangodb
3rdParty/V8-4.3.61/third_party/python_26/Lib/test/test_fileio.py
48
9024
# Adapted from test_file.py by Daniel Stutzbach #from __future__ import unicode_literals import sys import os import unittest from array import array from weakref import proxy from test.test_support import (TESTFN, findfile, check_warnings, run_unittest, make_bad_fd) from UserList import UserList import _fileio class AutoFileTests(unittest.TestCase): # file tests for which a test file is automatically set up def setUp(self): self.f = _fileio._FileIO(TESTFN, 'w') def tearDown(self): if self.f: self.f.close() os.remove(TESTFN) def testWeakRefs(self): # verify weak references p = proxy(self.f) p.write(bytes(range(10))) self.assertEquals(self.f.tell(), p.tell()) self.f.close() self.f = None self.assertRaises(ReferenceError, getattr, p, 'tell') def testSeekTell(self): self.f.write(bytes(bytearray(range(20)))) self.assertEquals(self.f.tell(), 20) self.f.seek(0) self.assertEquals(self.f.tell(), 0) self.f.seek(10) self.assertEquals(self.f.tell(), 10) self.f.seek(5, 1) self.assertEquals(self.f.tell(), 15) self.f.seek(-5, 1) self.assertEquals(self.f.tell(), 10) self.f.seek(-5, 2) self.assertEquals(self.f.tell(), 15) def testAttributes(self): # verify expected attributes exist f = self.f self.assertEquals(f.mode, "wb") self.assertEquals(f.closed, False) # verify the attributes are readonly for attr in 'mode', 'closed': self.assertRaises((AttributeError, TypeError), setattr, f, attr, 'oops') def testReadinto(self): # verify readinto self.f.write(bytes(bytearray([1, 2]))) self.f.close() a = array('b', b'x'*10) self.f = _fileio._FileIO(TESTFN, 'r') n = self.f.readinto(a) self.assertEquals(array('b', [1, 2]), a[:n]) def testRepr(self): self.assertEquals(repr(self.f), "_fileio._FileIO(%d, %s)" % (self.f.fileno(), repr(self.f.mode))) def testErrors(self): f = self.f self.assert_(not f.isatty()) self.assert_(not f.closed) #self.assertEquals(f.name, TESTFN) self.assertRaises(ValueError, f.read, 10) # Open for reading f.close() self.assert_(f.closed) f = _fileio._FileIO(TESTFN, 'r') self.assertRaises(TypeError, f.readinto, "") self.assert_(not f.closed) f.close() self.assert_(f.closed) def testMethods(self): methods = ['fileno', 'isatty', 'read', 'readinto', 'seek', 'tell', 'truncate', 'write', 'seekable', 'readable', 'writable'] if sys.platform.startswith('atheos'): methods.remove('truncate') self.f.close() self.assert_(self.f.closed) for methodname in methods: method = getattr(self.f, methodname) # should raise on closed file self.assertRaises(ValueError, method) def testOpendir(self): # Issue 3703: opening a directory should fill the errno # Windows always returns "[Errno 13]: Permission denied # Unix calls dircheck() and returns "[Errno 21]: Is a directory" try: _fileio._FileIO('.', 'r') except IOError as e: self.assertNotEqual(e.errno, 0) self.assertEqual(e.filename, ".") else: self.fail("Should have raised IOError") class OtherFileTests(unittest.TestCase): def testAbles(self): try: f = _fileio._FileIO(TESTFN, "w") self.assertEquals(f.readable(), False) self.assertEquals(f.writable(), True) self.assertEquals(f.seekable(), True) f.close() f = _fileio._FileIO(TESTFN, "r") self.assertEquals(f.readable(), True) self.assertEquals(f.writable(), False) self.assertEquals(f.seekable(), True) f.close() f = _fileio._FileIO(TESTFN, "a+") self.assertEquals(f.readable(), True) self.assertEquals(f.writable(), True) self.assertEquals(f.seekable(), True) self.assertEquals(f.isatty(), False) f.close() if sys.platform != "win32": try: f = _fileio._FileIO("/dev/tty", "a") except EnvironmentError: # When run in a cron job there just aren't any # ttys, so skip the test. This also handles other # OS'es that don't support /dev/tty. pass else: f = _fileio._FileIO("/dev/tty", "a") self.assertEquals(f.readable(), False) self.assertEquals(f.writable(), True) if sys.platform != "darwin" and \ not sys.platform.startswith('freebsd') and \ not sys.platform.startswith('sunos'): # Somehow /dev/tty appears seekable on some BSDs self.assertEquals(f.seekable(), False) self.assertEquals(f.isatty(), True) f.close() finally: os.unlink(TESTFN) def testModeStrings(self): # check invalid mode strings for mode in ("", "aU", "wU+", "rw", "rt"): try: f = _fileio._FileIO(TESTFN, mode) except ValueError: pass else: f.close() self.fail('%r is an invalid file mode' % mode) def testUnicodeOpen(self): # verify repr works for unicode too f = _fileio._FileIO(str(TESTFN), "w") f.close() os.unlink(TESTFN) def testInvalidFd(self): self.assertRaises(ValueError, _fileio._FileIO, -10) self.assertRaises(OSError, _fileio._FileIO, make_bad_fd()) def testBadModeArgument(self): # verify that we get a sensible error message for bad mode argument bad_mode = "qwerty" try: f = _fileio._FileIO(TESTFN, bad_mode) except ValueError as msg: if msg.args[0] != 0: s = str(msg) if s.find(TESTFN) != -1 or s.find(bad_mode) == -1: self.fail("bad error message for invalid mode: %s" % s) # if msg.args[0] == 0, we're probably on Windows where there may be # no obvious way to discover why open() failed. else: f.close() self.fail("no error for invalid mode: %s" % bad_mode) def testTruncateOnWindows(self): def bug801631(): # SF bug <http://www.python.org/sf/801631> # "file.truncate fault on windows" f = _fileio._FileIO(TESTFN, 'w') f.write(bytes(bytearray(range(11)))) f.close() f = _fileio._FileIO(TESTFN,'r+') data = f.read(5) if data != bytes(bytearray(range(5))): self.fail("Read on file opened for update failed %r" % data) if f.tell() != 5: self.fail("File pos after read wrong %d" % f.tell()) f.truncate() if f.tell() != 5: self.fail("File pos after ftruncate wrong %d" % f.tell()) f.close() size = os.path.getsize(TESTFN) if size != 5: self.fail("File size after ftruncate wrong %d" % size) try: bug801631() finally: os.unlink(TESTFN) def testAppend(self): try: f = open(TESTFN, 'wb') f.write(b'spam') f.close() f = open(TESTFN, 'ab') f.write(b'eggs') f.close() f = open(TESTFN, 'rb') d = f.read() f.close() self.assertEqual(d, b'spameggs') finally: try: os.unlink(TESTFN) except: pass def testInvalidInit(self): self.assertRaises(TypeError, _fileio._FileIO, "1", 0, 0) def testWarnings(self): with check_warnings() as w: self.assertEqual(w.warnings, []) self.assertRaises(TypeError, _fileio._FileIO, []) self.assertEqual(w.warnings, []) self.assertRaises(ValueError, _fileio._FileIO, "/some/invalid/name", "rt") self.assertEqual(w.warnings, []) def test_main(): # Historically, these tests have been sloppy about removing TESTFN. # So get rid of it no matter what. try: run_unittest(AutoFileTests, OtherFileTests) finally: if os.path.exists(TESTFN): os.unlink(TESTFN) if __name__ == '__main__': test_main()
apache-2.0
ellonweb/merlin
Hooks/user/quits.py
1
1711
# This file is part of Merlin. # Merlin is the Copyright (C)2008,2009,2010 of Robin K. Hansen, Elliot Rosemarine, Andreas Jacobsen. # Individual portions may be copyright by individual contributors, and # are included in this collective work with permission of the copyright # owners. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA from Core.config import Config from Core.maps import User from Core.loadable import loadable, route class quits(loadable): usage = " <pnick>" @route(r"(\S+)", access = "member") def execute(self, message, user, params): # assign param variables search=params.group(1) # do stuff here whore = User.load(name=search,exact=False,access="member") if whore is None: message.reply("No users matching '%s'"%(search,)) return if whore.quits<=0: message.reply("%s is a stalwart defender of his honor" % (whore.name,)) else: message.reply("%s is a whining loser who has quit %d times." % (whore.name,whore.quits))
gpl-2.0
solent-eng/solent
solent/draft/demonstrate_line_console.py
2
4403
# // license # Copyright 2016, Free Software Foundation. # # This file is part of Solent. # # Solent 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. # # Solent 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 # Solent. If not, see <http://www.gnu.org/licenses/>. from solent import Engine from solent import SolentQuitException from solent import log from solent.util import RailLineConsole LC_ADDR = 'localhost' LC_PORT = 8200 MTU = 1490 I_NEARCAST = ''' i message h i field h message init message line_console_connect field addr field port message line_console_condrop field msg message to_line_console field s message cmd_add field a field b message cmd_echo field s message cmd_quit ''' class CogInterpret: def __init__(self, cog_h, orb, engine): self.cog_h = cog_h self.orb = orb self.engine = engine def on_cmd_add(self, a, b): a = int(a) b = int(b) log("%s + %s = %s"%(a, b, a+b)) def on_cmd_echo(self, s): self.nearcast.to_line_console( s=s) def on_cmd_quit(self): raise SolentQuitException() class CogToLineConsole: def __init__(self, cog_h, orb, engine): self.cog_h = cog_h self.orb = orb self.engine = engine # self.rail_line_console = RailLineConsole() # def on_init(self): rail_h='%s/line_console'%(self.cog_h) self.rail_line_console.zero( rail_h=rail_h, cb_line_console_connect=self.cb_line_console_connect, cb_line_console_condrop=self.cb_line_console_condrop, cb_line_console_command=self.cb_line_console_command, engine=self.engine) # self.rail_line_console.start( ip=LC_ADDR, port=LC_PORT) def on_to_line_console(self, s): self.rail_line_console.send( msg='%s\n'%s) # def cb_line_console_connect(self, cs_line_console_connect): addr = cs_line_console_connect.addr port = cs_line_console_connect.port # self.nearcast.line_console_connect( addr=addr, port=port) def cb_line_console_condrop(self, cs_line_console_condrop): msg = cs_line_console_condrop.msg # self.nearcast.line_console_condrop( msg=msg) def cb_line_console_command(self, cs_line_console_command): tokens = cs_line_console_command.tokens # def complain(msg): self.rail_line_console.send( msg='%s\n'%msg) # if 0 == len(tokens): pass elif tokens[0] == 'add': if 3 != len(tokens): complain('Usage: add a b') return (_, a, b) = tokens self.nearcast.cmd_add( a=a, b=b) elif tokens[0] == 'echo': if 2 != len(tokens): complain('Usage: echo s') return (_, s) = tokens self.nearcast.cmd_echo( s=s) elif tokens[0] == 'quit': self.nearcast.cmd_quit() else: complain('??') return class CogBridge: def __init__(self, cog_h, orb, engine): self.cog_h = cog_h self.orb = orb self.engine = engine def nc_init(self): self.nearcast.init() def main(): engine = Engine( mtu=MTU) try: orb = engine.init_orb( i_nearcast=I_NEARCAST) orb.add_log_snoop() orb.init_cog(CogInterpret) orb.init_cog(CogToLineConsole) bridge = orb.init_cog(CogBridge) bridge.nc_init() engine.event_loop() except SolentQuitException: pass except KeyboardInterrupt: pass finally: engine.close() if __name__ == '__main__': main()
lgpl-3.0
tornadozou/tensorflow
tensorflow/contrib/cluster_resolver/python/training/gce_cluster_resolver_test.py
64
8588
# Copyright 2017 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. # ============================================================================== """Tests for GceClusterResolver.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.contrib.cluster_resolver.python.training.cluster_resolver import UnionClusterResolver from tensorflow.contrib.cluster_resolver.python.training.gce_cluster_resolver import GceClusterResolver from tensorflow.python.platform import test from tensorflow.python.training import server_lib mock = test.mock class GceClusterResolverTest(test.TestCase): def _verifyClusterSpecEquality(self, cluster_spec, expected_proto): self.assertProtoEquals(expected_proto, cluster_spec.as_cluster_def()) self.assertProtoEquals( expected_proto, server_lib.ClusterSpec(cluster_spec).as_cluster_def()) self.assertProtoEquals( expected_proto, server_lib.ClusterSpec(cluster_spec.as_cluster_def()).as_cluster_def()) self.assertProtoEquals( expected_proto, server_lib.ClusterSpec(cluster_spec.as_dict()).as_cluster_def()) def standard_mock_instance_groups(self, instance_map=None): if instance_map is None: instance_map = [ {'instance': 'https://gce.example.com/res/gce-instance-1'} ] mock_instance_group_request = mock.MagicMock() mock_instance_group_request.execute.return_value = { 'items': instance_map } service_attrs = { 'listInstances.return_value': mock_instance_group_request, 'listInstances_next.return_value': None, } mock_instance_groups = mock.Mock(**service_attrs) return mock_instance_groups def standard_mock_instances(self, instance_to_ip_map=None): if instance_to_ip_map is None: instance_to_ip_map = { 'gce-instance-1': '10.123.45.67' } mock_get_request = mock.MagicMock() mock_get_request.execute.return_value = { 'networkInterfaces': [ {'networkIP': '10.123.45.67'} ] } def get_side_effect(project, zone, instance): del project, zone # Unused if instance in instance_to_ip_map: mock_get_request = mock.MagicMock() mock_get_request.execute.return_value = { 'networkInterfaces': [ {'networkIP': instance_to_ip_map[instance]} ] } return mock_get_request else: raise RuntimeError('Instance %s not found!' % instance) service_attrs = { 'get.side_effect': get_side_effect, } mock_instances = mock.MagicMock(**service_attrs) return mock_instances def standard_mock_service_client( self, mock_instance_groups=None, mock_instances=None): if mock_instance_groups is None: mock_instance_groups = self.standard_mock_instance_groups() if mock_instances is None: mock_instances = self.standard_mock_instances() mock_client = mock.MagicMock() mock_client.instanceGroups.return_value = mock_instance_groups mock_client.instances.return_value = mock_instances return mock_client def gen_standard_mock_service_client(self, instances=None): name_to_ip = {} instance_list = [] for instance in instances: name_to_ip[instance['name']] = instance['ip'] instance_list.append({ 'instance': 'https://gce.example.com/gce/res/' + instance['name'] }) mock_instance = self.standard_mock_instances(name_to_ip) mock_instance_group = self.standard_mock_instance_groups(instance_list) return self.standard_mock_service_client(mock_instance_group, mock_instance) def testSimpleSuccessfulRetrieval(self): gce_cluster_resolver = GceClusterResolver( project='test-project', zone='us-east1-d', instance_group='test-instance-group', port=8470, credentials=None, service=self.standard_mock_service_client()) actual_cluster_spec = gce_cluster_resolver.cluster_spec() expected_proto = """ job { name: 'worker' tasks { key: 0 value: '10.123.45.67:8470' } } """ self._verifyClusterSpecEquality(actual_cluster_spec, expected_proto) def testCustomJobNameAndPortRetrieval(self): gce_cluster_resolver = GceClusterResolver( project='test-project', zone='us-east1-d', instance_group='test-instance-group', job_name='custom', port=2222, credentials=None, service=self.standard_mock_service_client()) actual_cluster_spec = gce_cluster_resolver.cluster_spec() expected_proto = """ job { name: 'custom' tasks { key: 0 value: '10.123.45.67:2222' } } """ self._verifyClusterSpecEquality(actual_cluster_spec, expected_proto) def testMultipleInstancesRetrieval(self): name_to_ip = [ {'name': 'instance1', 'ip': '10.1.2.3'}, {'name': 'instance2', 'ip': '10.2.3.4'}, {'name': 'instance3', 'ip': '10.3.4.5'}, ] gce_cluster_resolver = GceClusterResolver( project='test-project', zone='us-east1-d', instance_group='test-instance-group', port=8470, credentials=None, service=self.gen_standard_mock_service_client(name_to_ip)) actual_cluster_spec = gce_cluster_resolver.cluster_spec() expected_proto = """ job { name: 'worker' tasks { key: 0 value: '10.1.2.3:8470' } tasks { key: 1 value: '10.2.3.4:8470' } tasks { key: 2 value: '10.3.4.5:8470' } } """ self._verifyClusterSpecEquality(actual_cluster_spec, expected_proto) def testUnionMultipleInstanceRetrieval(self): worker1_name_to_ip = [ {'name': 'instance1', 'ip': '10.1.2.3'}, {'name': 'instance2', 'ip': '10.2.3.4'}, {'name': 'instance3', 'ip': '10.3.4.5'}, ] worker2_name_to_ip = [ {'name': 'instance4', 'ip': '10.4.5.6'}, {'name': 'instance5', 'ip': '10.5.6.7'}, {'name': 'instance6', 'ip': '10.6.7.8'}, ] ps_name_to_ip = [ {'name': 'ps1', 'ip': '10.100.1.2'}, {'name': 'ps2', 'ip': '10.100.2.3'}, ] worker1_gce_cluster_resolver = GceClusterResolver( project='test-project', zone='us-east1-d', instance_group='test-instance-group', job_name='worker', port=8470, credentials=None, service=self.gen_standard_mock_service_client(worker1_name_to_ip)) worker2_gce_cluster_resolver = GceClusterResolver( project='test-project', zone='us-east1-d', instance_group='test-instance-group', job_name='worker', port=8470, credentials=None, service=self.gen_standard_mock_service_client(worker2_name_to_ip)) ps_gce_cluster_resolver = GceClusterResolver( project='test-project', zone='us-east1-d', instance_group='test-instance-group', job_name='ps', port=2222, credentials=None, service=self.gen_standard_mock_service_client(ps_name_to_ip)) union_cluster_resolver = UnionClusterResolver(worker1_gce_cluster_resolver, worker2_gce_cluster_resolver, ps_gce_cluster_resolver) actual_cluster_spec = union_cluster_resolver.cluster_spec() expected_proto = """ job { name: 'ps' tasks { key: 0 value: '10.100.1.2:2222' } tasks { key: 1 value: '10.100.2.3:2222' } } job { name: 'worker' tasks { key: 0 value: '10.1.2.3:8470' } tasks { key: 1 value: '10.2.3.4:8470' } tasks { key: 2 value: '10.3.4.5:8470' } tasks { key: 3 value: '10.4.5.6:8470' } tasks { key: 4 value: '10.5.6.7:8470' } tasks { key: 5 value: '10.6.7.8:8470' } } """ self._verifyClusterSpecEquality(actual_cluster_spec, expected_proto) if __name__ == '__main__': test.main()
apache-2.0
BillMills/AutoQC
tests/ICDC_aqc_10_local_climatology_check_validation.py
3
3042
import qctests.ICDC_aqc_10_local_climatology_check as ICDC import util.testingProfile import numpy as np ##### ICDC 10 local climatology check. ##### -------------------------------------------------- class TestClass(): parameters = { 'db': 'iquod.db', 'table': 'unit' } def setUp(self): # refresh this table every test ICDC.loadParameters(self.parameters) def tearDown(self): pass def test_ICDC_10_local_climatology_check_locs(self): '''Make sure code processes locations as expected. ''' p = util.testingProfile.fakeProfile([-5, -5, -5], [1, 2, 5], latitude=-80.0, longitude=0.0) qc = ICDC.test(p, self.parameters) truth = np.zeros(3, dtype=bool) assert np.array_equal(qc, truth), 'Latitude -80.0 outside grid range and should not have flagged data' p = util.testingProfile.fakeProfile([-5, -5, -5], [1, 2, 5], latitude=-70.0, longitude=0.0) qc = ICDC.test(p, self.parameters) truth = np.ones(3, dtype=bool) assert np.array_equal(qc, truth), 'Latitude -70.0 outside grid range and should have flagged data' p = util.testingProfile.fakeProfile([-5, -5, -5], [1, 2, 5], latitude=-70.0, longitude=-182.0) qc = ICDC.test(p, self.parameters) truth = np.zeros(3, dtype=bool) assert np.array_equal(qc, truth), 'Longitude -182.0 outside grid range and should not have flagged data' p = util.testingProfile.fakeProfile([-5, -5, -5], [1, 2, 5], latitude=-70.0, longitude=362.0) qc = ICDC.test(p, self.parameters) truth = np.zeros(3, dtype=bool) assert np.array_equal(qc, truth), 'Longitude 362.0 outside grid range and should not have flagged data' p = util.testingProfile.fakeProfile([-5, -5, -5], [1, 2, 5], latitude=-70.0, longitude=182.0) qc = ICDC.test(p, self.parameters) truth = np.ones(3, dtype=bool) assert np.array_equal(qc, truth), 'Longitude 182.0 is adjusted to -178 and should have flagged data' def test_ICDC_10_local_climatology_check_ranges(self): '''Make sure code processes ranges as expected. ''' p = util.testingProfile.fakeProfile([0], [5], latitude=50.0, longitude=-180.0, date=[2000, 1, 15, 0]) qc = ICDC.test(p, self.parameters) truth = np.array([True]) assert np.array_equal(qc, truth), 'Below temperature range, should be flagged' p = util.testingProfile.fakeProfile([5], [5], latitude=50.0, longitude=-180.0, date=[2000, 1, 15, 0]) qc = ICDC.test(p, self.parameters) truth = np.array([False]) assert np.array_equal(qc, truth), 'In temperature range, should not be flagged' p = util.testingProfile.fakeProfile([12], [5], latitude=50.0, longitude=-180.0, date=[2000, 1, 15, 0]) qc = ICDC.test(p, self.parameters) truth = np.array([True]) assert np.array_equal(qc, truth), 'Above temperature range, should be flagged'
mit
zeliard/grpc
src/python/src/grpc/framework/foundation/callable_util.py
41
3953
# Copyright 2015, Google Inc. # 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 Google Inc. nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """Utilities for working with callables.""" import abc import collections import enum import functools import logging class Outcome(object): """A sum type describing the outcome of some call. Attributes: kind: One of Kind.RETURNED or Kind.RAISED respectively indicating that the call returned a value or raised an exception. return_value: The value returned by the call. Must be present if kind is Kind.RETURNED. exception: The exception raised by the call. Must be present if kind is Kind.RAISED. """ __metaclass__ = abc.ABCMeta @enum.unique class Kind(enum.Enum): """Identifies the general kind of the outcome of some call.""" RETURNED = object() RAISED = object() class _EasyOutcome( collections.namedtuple( '_EasyOutcome', ['kind', 'return_value', 'exception']), Outcome): """A trivial implementation of Outcome.""" def _call_logging_exceptions(behavior, message, *args, **kwargs): try: return _EasyOutcome(Outcome.Kind.RETURNED, behavior(*args, **kwargs), None) except Exception as e: # pylint: disable=broad-except logging.exception(message) return _EasyOutcome(Outcome.Kind.RAISED, None, e) def with_exceptions_logged(behavior, message): """Wraps a callable in a try-except that logs any exceptions it raises. Args: behavior: Any callable. message: A string to log if the behavior raises an exception. Returns: A callable that when executed invokes the given behavior. The returned callable takes the same arguments as the given behavior but returns a future.Outcome describing whether the given behavior returned a value or raised an exception. """ @functools.wraps(behavior) def wrapped_behavior(*args, **kwargs): return _call_logging_exceptions(behavior, message, *args, **kwargs) return wrapped_behavior def call_logging_exceptions(behavior, message, *args, **kwargs): """Calls a behavior in a try-except that logs any exceptions it raises. Args: behavior: Any callable. message: A string to log if the behavior raises an exception. *args: Positional arguments to pass to the given behavior. **kwargs: Keyword arguments to pass to the given behavior. Returns: An Outcome describing whether the given behavior returned a value or raised an exception. """ return _call_logging_exceptions(behavior, message, *args, **kwargs)
bsd-3-clause
vinaypost/multiuploader
tests/test_settings.py
1
1057
# -*- encoding: utf-8 -*- import os SECRET_KEY = 'p23jof024jf5-94j3f023jf230=fj234fp34fijo' BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) TEST_DATA_DIR = os.path.join(BASE_DIR, 'tests', 'test_data') DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'postgres', } } INSTALLED_APPS = [ 'sorl.thumbnail', 'tests', 'multiuploader', ] TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] MIDDLEWARE_CLASSES = () CELERY_TASK_ALWAYS_EAGER = True ROOT_URLCONF = 'multiuploader.urls' MULTIUPLOADER_FILES_FOLDER = 'multiuploader/'
mit
Zanzibar82/pelisalacarta
python/main-ui/plugintools.py
9
37167
# -*- coding: utf-8 -*- #------------------------------------------------------------ # Plugin Tools # Copyright 2015 tvalacarta@gmail.com # # Distributed under the terms of GNU General Public License v3 (GPLv3) # http://www.gnu.org/licenses/gpl-3.0.html #------------------------------------------------------------ # This file is part of Plugin Tools. # # Plugin Tools 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. # # pelisalacarta 4 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 pelisalacarta 4. If not, see <http://www.gnu.org/licenses/>. #------------------------------------------------------------ # Plugin Tools v1.1.1 #--------------------------------------------------------------------------- # Based on code from youtube, parsedom and pelisalacarta addons # Author: # Jesús (tvalacarta@gmail.com) # http://www.mimediacenter.info/plugintools #--------------------------------------------------------------------------- # Changelog: # 1.0.0 # - First release # 1.0.1 # - If find_single_match can't find anything, it returns an empty string # - Remove addon id from this module, so it remains clean # 1.0.2 # - Added parameter on "add_item" to say that item is playable # 1.0.3 # - Added direct play # - Fixed bug when video isPlayable=True # 1.0.4 # - Added get_temp_path, get_runtime_path, get_data_path # - Added get_setting, set_setting, open_settings_dialog and get_localized_string # - Added keyboard_input # - Added message # 1.0.5 # - Added read_body_and_headers for advanced http handling # - Added show_picture for picture addons support # - Added optional parameters "title" and "hidden" to keyboard_input # 1.0.6 # - Added fanart, show, episode and infolabels to add_item # 1.0.7 # - Added set_view function # 1.0.8 # - Added selector # 1.0.9 # - Added unescape and htmlclean functions # - Added as comments different view modes used in different skins # - Fix small problem in add_item, fanart were not passed as parameter to next action # - Added flag for disable application logs # 1.1.0 # - Add slugify # - Add context menu options to add_item # - Add download function # - Add application log control # 1.1.1 # - Added show_notification # - Bug fixes #--------------------------------------------------------------------------- import xbmc import xbmcplugin import xbmcaddon import xbmcgui import urllib import urllib2 import re import sys import os import time import socket from StringIO import StringIO import gzip application_log_enabled = False module_log_enabled = False http_debug_log_enabled = False LIST = "list" THUMBNAIL = "thumbnail" MOVIES = "movies" TV_SHOWS = "tvshows" SEASONS = "seasons" EPISODES = "episodes" OTHER = "other" ''' Known codes Confluence Normal CommonRootView: 50 # List ThumbnailView: 500 # Thumbnail WideIconView: 505 FullWidthList: 51 # Big list Biblioteca PosterWrapView: 501 # Poster Wrap PosterWrapView2_Fanart: 508 # Fanart MediaListView2: 504 # Media info MediaListView3: 503 # Media info 2 MediaListView4: 515 # Media info 3 ''' # Suggested view codes for each type from different skins (initial list thanks to xbmcswift2 library) ALL_VIEW_CODES = { 'list': { 'skin.confluence': 50, # List 'skin.aeon.nox': 50, # List 'skin.droid': 50, # List 'skin.quartz': 50, # List 'skin.re-touched': 50, # List }, 'thumbnail': { 'skin.confluence': 500, # Thumbnail 'skin.aeon.nox': 500, # Wall 'skin.droid': 51, # Big icons 'skin.quartz': 51, # Big icons 'skin.re-touched': 500, #Thumbnail }, 'movies': { 'skin.confluence': 515, # 500 Thumbnail # 515 Media Info 3 'skin.aeon.nox': 500, # Wall 'skin.droid': 51, # Big icons 'skin.quartz': 52, # Media info 'skin.re-touched': 500, #Thumbnail }, 'tvshows': { 'skin.confluence': 515, # 500 Thumbnail # 515 Media Info 3 'skin.aeon.nox': 500, # Wall 'skin.droid': 51, # Big icons 'skin.quartz': 52, # Media info 'skin.re-touched': 500, #Thumbnail }, 'seasons': { 'skin.confluence': 50, # List 'skin.aeon.nox': 50, # List 'skin.droid': 50, # List 'skin.quartz': 52, # Media info 'skin.re-touched': 50, # List }, 'episodes': { 'skin.confluence': 504, # Media Info 'skin.aeon.nox': 518, # Infopanel 'skin.droid': 50, # List 'skin.quartz': 52, # Media info 'skin.re-touched': 550, # Wide }, } # Write something on XBMC log def log(message): if application_log_enabled: xbmc.log(message) # Write this module messages on XBMC log def _log(message): if module_log_enabled: xbmc.log("plugintools."+message) # Parse XBMC params - based on script.module.parsedom addon def get_params(): _log("get_params") param_string = sys.argv[2] _log("get_params "+str(param_string)) commands = {} if param_string: split_commands = param_string[param_string.find('?') + 1:].split('&') for command in split_commands: _log("get_params command="+str(command)) if len(command) > 0: if "=" in command: split_command = command.split('=') key = split_command[0] value = urllib.unquote_plus(split_command[1]) commands[key] = value else: commands[command] = "" _log("get_params "+repr(commands)) return commands # Fetch text content from an URL def read(url): _log("read "+url) f = urllib2.urlopen(url) data = f.read() f.close() return data def read_body_and_headers(url, post=None, headers=[], follow_redirects=False, timeout=30): _log("read_body_and_headers "+url) if post is not None: _log("read_body_and_headers post="+post) if len(headers)==0: headers.append(["User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:18.0) Gecko/20100101 Firefox/18.0"]) # Start cookie lib ficherocookies = os.path.join( get_data_path(), 'cookies.dat' ) _log("read_body_and_headers cookies_file="+ficherocookies) cj = None ClientCookie = None cookielib = None # Let's see if cookielib is available try: _log("read_body_and_headers importing cookielib") import cookielib except ImportError: _log("read_body_and_headers cookielib no disponible") # If importing cookielib fails # let's try ClientCookie try: _log("read_body_and_headers importing ClientCookie") import ClientCookie except ImportError: _log("read_body_and_headers ClientCookie not available") # ClientCookie isn't available either urlopen = urllib2.urlopen Request = urllib2.Request else: _log("read_body_and_headers ClientCookie available") # imported ClientCookie urlopen = ClientCookie.urlopen Request = ClientCookie.Request cj = ClientCookie.MozillaCookieJar() else: _log("read_body_and_headers cookielib available") # importing cookielib worked urlopen = urllib2.urlopen Request = urllib2.Request cj = cookielib.MozillaCookieJar() # This is a subclass of FileCookieJar # that has useful load and save methods if cj is not None: # we successfully imported # one of the two cookie handling modules _log("read_body_and_headers Cookies enabled") if os.path.isfile(ficherocookies): _log("read_body_and_headers Reading cookie file") # if we have a cookie file already saved # then load the cookies into the Cookie Jar try: cj.load(ficherocookies, ignore_discard=True) except: _log("read_body_and_headers Wrong cookie file, deleting...") os.remove(ficherocookies) # Now we need to get our Cookie Jar # installed in the opener; # for fetching URLs if cookielib is not None: _log("read_body_and_headers opener using urllib2 (cookielib)") # if we use cookielib # then we get the HTTPCookieProcessor # and install the opener in urllib2 if not follow_redirects: opener = urllib2.build_opener(urllib2.HTTPHandler(debuglevel=http_debug_log_enabled),urllib2.HTTPCookieProcessor(cj),NoRedirectHandler()) else: opener = urllib2.build_opener(urllib2.HTTPHandler(debuglevel=http_debug_log_enabled),urllib2.HTTPCookieProcessor(cj)) urllib2.install_opener(opener) else: _log("read_body_and_headers opener using ClientCookie") # if we use ClientCookie # then we get the HTTPCookieProcessor # and install the opener in ClientCookie opener = ClientCookie.build_opener(ClientCookie.HTTPCookieProcessor(cj)) ClientCookie.install_opener(opener) # ------------------------------------------------- # Cookies instaladas, lanza la petición # ------------------------------------------------- # Contador inicio = time.clock() # Diccionario para las cabeceras txheaders = {} # Construye el request if post is None: _log("read_body_and_headers GET request") else: _log("read_body_and_headers POST request") # Añade las cabeceras _log("read_body_and_headers ---------------------------") for header in headers: _log("read_body_and_headers header %s=%s" % (str(header[0]),str(header[1])) ) txheaders[header[0]]=header[1] _log("read_body_and_headers ---------------------------") req = Request(url, post, txheaders) if timeout is None: handle=urlopen(req) else: #Disponible en python 2.6 en adelante --> handle = urlopen(req, timeout=timeout) #Para todas las versiones: try: import socket deftimeout = socket.getdefaulttimeout() socket.setdefaulttimeout(timeout) handle=urlopen(req) socket.setdefaulttimeout(deftimeout) except: import sys for line in sys.exc_info(): _log( "%s" % line ) # Actualiza el almacén de cookies cj.save(ficherocookies, ignore_discard=True) # Lee los datos y cierra if handle.info().get('Content-Encoding') == 'gzip': buf = StringIO( handle.read()) f = gzip.GzipFile(fileobj=buf) data = f.read() else: data=handle.read() info = handle.info() _log("read_body_and_headers Response") returnheaders=[] _log("read_body_and_headers ---------------------------") for header in info: _log("read_body_and_headers "+header+"="+info[header]) returnheaders.append([header,info[header]]) handle.close() _log("read_body_and_headers ---------------------------") ''' # Lanza la petición try: response = urllib2.urlopen(req) # Si falla la repite sustituyendo caracteres especiales except: req = urllib2.Request(url.replace(" ","%20")) # Añade las cabeceras for header in headers: req.add_header(header[0],header[1]) response = urllib2.urlopen(req) ''' # Tiempo transcurrido fin = time.clock() _log("read_body_and_headers Downloaded in %d seconds " % (fin-inicio+1)) _log("read_body_and_headers body="+data) return data,returnheaders class NoRedirectHandler(urllib2.HTTPRedirectHandler): def http_error_302(self, req, fp, code, msg, headers): infourl = urllib.addinfourl(fp, headers, req.get_full_url()) infourl.status = code infourl.code = code return infourl http_error_300 = http_error_302 http_error_301 = http_error_302 http_error_303 = http_error_302 http_error_307 = http_error_302 # Parse string and extracts multiple matches using regular expressions def find_multiple_matches(text,pattern): _log("find_multiple_matches pattern="+pattern) matches = re.findall(pattern,text,re.DOTALL) return matches # Parse string and extracts first match as a string def find_single_match(text,pattern): _log("find_single_match pattern="+pattern) result = "" try: matches = re.findall(pattern,text, flags=re.DOTALL) result = matches[0] except: result = "" return result def add_item( action="" , title="" , plot="" , url="" , thumbnail="" , fanart="" , show="" , episode="" , extra="", category="", page="", info_labels = None, context_menu_items = [] , isPlayable = False , folder=True ): _log("add_item action=["+action+"] title=["+title+"] url=["+url+"] thumbnail=["+thumbnail+"] fanart=["+fanart+"] show=["+show+"] episode=["+episode+"] extra=["+extra+"] category=["+category+"] page=["+page+"] isPlayable=["+str(isPlayable)+"] folder=["+str(folder)+"]") listitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", thumbnailImage=thumbnail ) if info_labels is None: info_labels = { "Title" : title, "FileName" : title, "Plot" : plot } listitem.setInfo( "video", info_labels ) if len(context_menu_items)>0: listitem.addContextMenuItems ( context_menu_items, replaceItems=False) if fanart!="": listitem.setProperty('fanart_image',fanart) xbmcplugin.setPluginFanart(int(sys.argv[1]), fanart) if url.startswith("plugin://"): itemurl = url listitem.setProperty('IsPlayable', 'true') xbmcplugin.addDirectoryItem( handle=int(sys.argv[1]), url=itemurl, listitem=listitem, isFolder=folder) elif isPlayable: listitem.setProperty("Video", "true") listitem.setProperty('IsPlayable', 'true') itemurl = '%s?action=%s&title=%s&url=%s&thumbnail=%s&fanart=%s&plot=%s&extra=%s&category=%s&page=%s' % ( sys.argv[ 0 ] , action , urllib.quote_plus( title ) , urllib.quote_plus(url) , urllib.quote_plus( thumbnail ) , urllib.quote_plus( fanart ) , urllib.quote_plus( plot ) , urllib.quote_plus( extra ) , urllib.quote_plus( category ) , urllib.quote_plus( page )) xbmcplugin.addDirectoryItem( handle=int(sys.argv[1]), url=itemurl, listitem=listitem, isFolder=folder) else: itemurl = '%s?action=%s&title=%s&url=%s&thumbnail=%s&fanart=%s&plot=%s&extra=%s&category=%s&page=%s' % ( sys.argv[ 0 ] , action , urllib.quote_plus( title ) , urllib.quote_plus(url) , urllib.quote_plus( thumbnail ) , urllib.quote_plus( fanart ) , urllib.quote_plus( plot ) , urllib.quote_plus( extra ) , urllib.quote_plus( category ) , urllib.quote_plus( page )) xbmcplugin.addDirectoryItem( handle=int(sys.argv[1]), url=itemurl, listitem=listitem, isFolder=folder) def close_item_list(): _log("close_item_list") xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True) def play_resolved_url(url): _log("play_resolved_url ["+url+"]") listitem = xbmcgui.ListItem(path=url) listitem.setProperty('IsPlayable', 'true') return xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem) def direct_play(url): _log("direct_play ["+url+"]") title = "" try: xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", path=url) except: xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", ) xlistitem.setInfo( "video", { "Title": title } ) playlist = xbmc.PlayList( xbmc.PLAYLIST_VIDEO ) playlist.clear() playlist.add( url, xlistitem ) player_type = xbmc.PLAYER_CORE_AUTO xbmcPlayer = xbmc.Player( player_type ) xbmcPlayer.play(playlist) def show_picture(url): local_folder = os.path.join(get_data_path(),"images") if not os.path.exists(local_folder): try: os.mkdir(local_folder) except: pass local_file = os.path.join(local_folder,"temp.jpg") # Download picture urllib.urlretrieve(url, local_file) # Show picture xbmc.executebuiltin( "SlideShow("+local_folder+")" ) def get_temp_path(): _log("get_temp_path") dev = xbmc.translatePath( "special://temp/" ) _log("get_temp_path ->'"+str(dev)+"'") return dev def get_runtime_path(): _log("get_runtime_path") dev = xbmc.translatePath( __settings__.getAddonInfo('Path') ) _log("get_runtime_path ->'"+str(dev)+"'") return dev def get_data_path(): _log("get_data_path") dev = xbmc.translatePath( __settings__.getAddonInfo('Profile') ) # Parche para XBMC4XBOX if not os.path.exists(dev): os.makedirs(dev) _log("get_data_path ->'"+str(dev)+"'") return dev def get_setting(name): _log("get_setting name='"+name+"'") dev = __settings__.getSetting( name ) _log("get_setting ->'"+str(dev)+"'") return dev def set_setting(name,value): _log("set_setting name='"+name+"','"+value+"'") __settings__.setSetting( name,value ) def open_settings_dialog(): _log("open_settings_dialog") __settings__.openSettings() def get_localized_string(code): _log("get_localized_string code="+str(code)) dev = __language__(code) try: dev = dev.encode("utf-8") except: pass _log("get_localized_string ->'"+dev+"'") return dev def keyboard_input(default_text="", title="", hidden=False): _log("keyboard_input default_text='"+default_text+"'") keyboard = xbmc.Keyboard(default_text,title,hidden) keyboard.doModal() if (keyboard.isConfirmed()): tecleado = keyboard.getText() else: tecleado = "" _log("keyboard_input ->'"+tecleado+"'") return tecleado def message(text1, text2="", text3=""): _log("message text1='"+text1+"', text2='"+text2+"', text3='"+text3+"'") if text3=="": xbmcgui.Dialog().ok( text1 , text2 ) elif text2=="": xbmcgui.Dialog().ok( "" , text1 ) else: xbmcgui.Dialog().ok( text1 , text2 , text3 ) def message_yes_no(text1, text2="", text3=""): _log("message_yes_no text1='"+text1+"', text2='"+text2+"', text3='"+text3+"'") if text3=="": yes_pressed = xbmcgui.Dialog().yesno( text1 , text2 ) elif text2=="": yes_pressed = xbmcgui.Dialog().yesno( "" , text1 ) else: yes_pressed = xbmcgui.Dialog().yesno( text1 , text2 , text3 ) return yes_pressed def selector(option_list,title="Select one"): _log("selector title='"+title+"', options="+repr(option_list)) dia = xbmcgui.Dialog() selection = dia.select(title,option_list) return selection def set_view(view_mode, view_code=0): _log("set_view view_mode='"+view_mode+"', view_code="+str(view_code)) # Set the content for extended library views if needed if view_mode==MOVIES: _log("set_view content is movies") xbmcplugin.setContent( int(sys.argv[1]) ,"movies" ) elif view_mode==TV_SHOWS: _log("set_view content is tvshows") xbmcplugin.setContent( int(sys.argv[1]) ,"tvshows" ) elif view_mode==SEASONS: _log("set_view content is seasons") xbmcplugin.setContent( int(sys.argv[1]) ,"seasons" ) elif view_mode==EPISODES: _log("set_view content is episodes") xbmcplugin.setContent( int(sys.argv[1]) ,"episodes" ) # Reads skin name skin_name = xbmc.getSkinDir() _log("set_view skin_name='"+skin_name+"'") try: if view_code==0: _log("set_view view mode is "+view_mode) view_codes = ALL_VIEW_CODES.get(view_mode) view_code = view_codes.get(skin_name) _log("set_view view code for "+view_mode+" in "+skin_name+" is "+str(view_code)) xbmc.executebuiltin("Container.SetViewMode("+str(view_code)+")") else: _log("set_view view code forced to "+str(view_code)) xbmc.executebuiltin("Container.SetViewMode("+str(view_code)+")") except: _log("Unable to find view code for view mode "+str(view_mode)+" and skin "+skin_name) def unescape(text): """Removes HTML or XML character references and entities from a text string. keep &amp;, &gt;, &lt; in the source code. from Fredrik Lundh http://effbot.org/zone/re-sub.htm#unescape-html """ def fixup(m): text = m.group(0) if text[:2] == "&#": # character reference try: if text[:3] == "&#x": return unichr(int(text[3:-1], 16)).encode("utf-8") else: return unichr(int(text[2:-1])).encode("utf-8") except ValueError: logger.info("error de valor") pass else: # named entity try: ''' if text[1:-1] == "amp": text = "&amp;amp;" elif text[1:-1] == "gt": text = "&amp;gt;" elif text[1:-1] == "lt": text = "&amp;lt;" else: print text[1:-1] text = unichr(htmlentitydefs.name2codepoint[text[1:-1]]).encode("utf-8") ''' import htmlentitydefs text = unichr(htmlentitydefs.name2codepoint[text[1:-1]]).encode("utf-8") except KeyError: logger.info("keyerror") pass except: pass return text # leave as is return re.sub("&#?\w+;", fixup, text) def htmlclean(cadena): cadena = cadena.replace("<center>","") cadena = cadena.replace("</center>","") cadena = cadena.replace("<cite>","") cadena = cadena.replace("</cite>","") cadena = cadena.replace("<em>","") cadena = cadena.replace("</em>","") cadena = cadena.replace("<b>","") cadena = cadena.replace("</b>","") cadena = cadena.replace("<u>","") cadena = cadena.replace("</u>","") cadena = cadena.replace("<li>","") cadena = cadena.replace("</li>","") cadena = cadena.replace("<tbody>","") cadena = cadena.replace("</tbody>","") cadena = cadena.replace("<tr>","") cadena = cadena.replace("</tr>","") cadena = cadena.replace("<![CDATA[","") cadena = cadena.replace("<Br />","") cadena = cadena.replace("<BR />","") cadena = cadena.replace("<Br>","") cadena = re.compile("<script.*?</script>",re.DOTALL).sub("",cadena) cadena = re.compile("<option[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</option>","") cadena = re.compile("<i[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</iframe>","") cadena = cadena.replace("</i>","") cadena = re.compile("<table[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</table>","") cadena = re.compile("<td[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</td>","") cadena = re.compile("<div[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</div>","") cadena = re.compile("<dd[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</dd>","") cadena = re.compile("<font[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</font>","") cadena = re.compile("<strong[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</strong>","") cadena = re.compile("<small[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</small>","") cadena = re.compile("<span[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</span>","") cadena = re.compile("<a[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</a>","") cadena = re.compile("<p[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</p>","") cadena = re.compile("<ul[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</ul>","") cadena = re.compile("<h1[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</h1>","") cadena = re.compile("<h2[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</h2>","") cadena = re.compile("<h3[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</h3>","") cadena = re.compile("<h4[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</h4>","") cadena = re.compile("<!--[^-]+-->",re.DOTALL).sub("",cadena) cadena = re.compile("<img[^>]*>",re.DOTALL).sub("",cadena) cadena = re.compile("<br[^>]*>",re.DOTALL).sub("",cadena) cadena = re.compile("<object[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</object>","") cadena = re.compile("<param[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</param>","") cadena = re.compile("<embed[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</embed>","") cadena = re.compile("<title[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("</title>","") cadena = re.compile("<link[^>]*>",re.DOTALL).sub("",cadena) cadena = cadena.replace("\t","") cadena = unescape(cadena) return cadena def slugify(title): # Replace international chars title = title.replace("Á","a") title = title.replace("É","e") title = title.replace("Í","i") title = title.replace("Ó","o") title = title.replace("Ú","u") title = title.replace("á","a") title = title.replace("é","e") title = title.replace("í","i") title = title.replace("ó","o") title = title.replace("ú","u") title = title.replace("À","a") title = title.replace("È","e") title = title.replace("Ì","i") title = title.replace("Ò","o") title = title.replace("Ù","u") title = title.replace("à","a") title = title.replace("è","e") title = title.replace("ì","i") title = title.replace("ò","o") title = title.replace("ù","u") title = title.replace("ç","c") title = title.replace("Ç","C") title = title.replace("Ñ","n") title = title.replace("ñ","n") title = title.replace("/","-") title = title.replace("&amp;","&") # Lowercase title = title.lower().strip() # Remove invalid chards validchars = "abcdefghijklmnopqrstuvwxyz1234567890- " title = ''.join(c for c in title if c in validchars) # Replace redundant whitespaces title = re.compile("\s+",re.DOTALL).sub(" ",title) # Replace whitespaces for minus title = re.compile("\s",re.DOTALL).sub("-",title.strip()) # Replace redundant minus title = re.compile("\-+",re.DOTALL).sub("-",title) # Fix some special cases if title.startswith("-"): title = title [1:] if title=="": title = "-"+str(time.time()) return title def download(url,filename,resume_download=True): _log("download url="+url+", filename="+filename) try: import xbmcgui # If file exists if os.path.exists(filename) and resume_download: f = open(filename, 'r+b') existSize = os.path.getsize(filename) _log("download File exists, size=%d, resume download" % existSize) downloaded = existSize f.seek(existSize) # File exists, skip download elif os.path.exists(filename) and not resume_download: _log("download File exists, skip download") return # File doesn't exists else: existSize = 0 _log("download File doesn't exists") f = open(filename, 'wb') downloaded = 0 # Progress dialog progress_dialog = xbmcgui.DialogProgress() progress_dialog.create( "plugin" , "Descargando..." , url , os.path.basename(filename) ) # Timeout of socket to 60 secs socket.setdefaulttimeout(60) # URL con login y password if find_single_match(url,"http\://[a-z]+\:[a-z]+\@[a-z0-9\:\.]+/")!="": _log("download Basic auth") username = find_single_match(url,"http\://([a-z]+)\:[a-z]+\@[a-z0-9\:\.]+/") _log("download username="+username) password = find_single_match(url,"http\://[a-z]+\:([a-z]+)\@[a-z0-9\:\.]+/") _log("download password="+password) url = "http://"+find_single_match(url,"http\://[a-z]+\:[a-z]+\@(.*?)$") _log("download url="+url) else: username="" h = urllib2.HTTPHandler(debuglevel=0) request = urllib2.Request(url) if existSize > 0: request.add_header('Range', 'bytes=%d-' % (existSize, )) if username!="": user_and_pass = base64.b64encode(b""+username+":"+password+"").decode("ascii") _log("download Adding Authorization header") #: Basic "+user_and_pass) request.add_header('Authorization', 'Basic '+user_and_pass) opener = urllib2.build_opener(h) urllib2.install_opener(opener) try: connexion = opener.open(request) except urllib2.HTTPError,e: _log("download error %d (%s) al abrir la url %s" % (e.code,e.msg,url)) f.close() progress_dialog.close() # Error 416 means range exceed file size => download is complete if e.code==416: return 0 else: return -2 try: total_size = int(connexion.headers["Content-Length"]) except: total_size = 1 if existSize > 0: total_size = total_size + existSize _log("download Content-Length=%s" % total_size) blocksize = 100*1024 readed_block = connexion.read(blocksize) _log("download Starting download... (first block=%s bytes)" % len(readed_block)) maxretries = 10 while len(readed_block)>0: try: f.write(readed_block) downloaded = downloaded + len(readed_block) percent = int(float(downloaded)*100/float(total_size)) totalmb = float(float(total_size)/(1024*1024)) downloaded_mb = float(float(downloaded)/(1024*1024)) # Read next block with retries retry_count = 0 while retry_count <= maxretries: try: before = time.time() readed_block = connexion.read(blocksize) after = time.time() if (after - before) > 0: velocidad=len(readed_block)/((after - before)) falta=total_size-downloaded if velocidad>0: tiempofalta=falta/velocidad else: tiempofalta=0 #logger.info(sec_to_hms(tiempofalta)) #progress_dialog.update( percent , "Descargando %.2fMB de %.2fMB (%d%%)" % ( downloaded_mb , totalmb , percent),"Falta %s - Velocidad %.2f Kb/s" % ( sec_to_hms(tiempofalta) , velocidad/1024 ), os.path.basename(filename) ) progress_dialog.update( percent , "%.2fMB/%.2fMB (%d%%) %.2f Kb/s %s falta " % ( downloaded_mb , totalmb , percent , velocidad/1024 , sec_to_hms(tiempofalta))) break try: if xbmc.abortRequested: logger.error( "XBMC Abort requested 1" ) return -1 except: pass except: try: if xbmc.abortRequested: logger.error( "XBMC Abort requested 2" ) return -1 except: pass retry_count = retry_count + 1 _log("download ERROR in block download, retry %d" % retry_count) import traceback _log("download "+traceback.format_exc()) # Download cancelled try: if progress_dialog.iscanceled(): _log("download Descarga del fichero cancelada") f.close() progress_dialog.close() return -1 except: pass # Download error if retry_count > maxretries: _log("download ERROR en la descarga del fichero") f.close() progress_dialog.close() return -2 except: import traceback _log("download "+traceback.format_exc() ) f.close() progress_dialog.close() return -2 except: import traceback _log("download "+traceback.format_exc()) try: f.close() except: pass progress_dialog.close() _log("download Download complete") def sec_to_hms(seconds): m,s = divmod(int(seconds), 60) h,m = divmod(m, 60) return ("%02d:%02d:%02d" % ( h , m ,s )) def get_safe_filename( original_filename ): safe_filename = original_filename # Replace international chars safe_filename = safe_filename.replace("Á","A") safe_filename = safe_filename.replace("É","E") safe_filename = safe_filename.replace("Í","I") safe_filename = safe_filename.replace("Ó","O") safe_filename = safe_filename.replace("Ú","U") safe_filename = safe_filename.replace("á","a") safe_filename = safe_filename.replace("é","e") safe_filename = safe_filename.replace("í","i") safe_filename = safe_filename.replace("ó","o") safe_filename = safe_filename.replace("ú","u") safe_filename = safe_filename.replace("À","A") safe_filename = safe_filename.replace("È","E") safe_filename = safe_filename.replace("Ì","I") safe_filename = safe_filename.replace("Ò","O") safe_filename = safe_filename.replace("Ù","U") safe_filename = safe_filename.replace("à","a") safe_filename = safe_filename.replace("è","e") safe_filename = safe_filename.replace("ì","i") safe_filename = safe_filename.replace("ò","o") safe_filename = safe_filename.replace("ù","u") safe_filename = safe_filename.replace("ç","c") safe_filename = safe_filename.replace("Ç","C") safe_filename = safe_filename.replace("Ñ","N") safe_filename = safe_filename.replace("ñ","n") safe_filename = safe_filename.replace("/","-") safe_filename = safe_filename.replace("&amp;","&") # Remove invalid chards validchars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890- " safe_filename = ''.join(c for c in safe_filename if c in validchars) # Replace redundant whitespaces safe_filename = re.compile("\s+",re.DOTALL).sub(" ",safe_filename) safe_filename = safe_filename.strip() if safe_filename=="": safe_filename = "invalid" return safe_filename #get_filename_from_url(media_url)[-4:] def get_filename_from_url(url): import urlparse parsed_url = urlparse.urlparse(url) try: filename = parsed_url.path except: # Si falla es porque la implementación de parsed_url no reconoce los atributos como "path" if len(parsed_url)>=4: filename = parsed_url[2] else: filename = "" if len(filename)>0: # Remove trailing slash if filename[-1:]=="/": filename = filename[:-1] if "/" in filename: filename = filename.split("/")[-1] return filename def show_notification(title,message,icon=""): xbmc.executebuiltin((u'XBMC.Notification("'+title+'", "'+message+'", 2000, "'+icon+'")')) f = open( os.path.join( os.path.dirname(__file__) , "addon.xml") ) data = f.read() f.close() addon_id = find_single_match(data,'id="([^"]+)"') if addon_id=="": addon_id = find_single_match(data,"id='([^']+)'") __settings__ = xbmcaddon.Addon(id=addon_id) __language__ = __settings__.getLocalizedString
gpl-3.0
ricardogsilva/QGIS
python/plugins/processing/algs/grass7/ext/r_li_mpa_ascii.py
45
1436
# -*- coding: utf-8 -*- """ *************************************************************************** r_li_mpa_ascii.py ----------------- Date : February 2016 Copyright : (C) 2016 by Médéric Ribreux Email : medspx at medspx dot fr *************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * *************************************************************************** """ __author__ = 'Médéric Ribreux' __date__ = 'February 2016' __copyright__ = '(C) 2016, Médéric Ribreux' from .r_li import checkMovingWindow, configFile, moveOutputTxtFile def checkParameterValuesBeforeExecuting(alg, parameters, context): return checkMovingWindow(alg, parameters, context, True) def processCommand(alg, parameters, context, feedback): configFile(alg, parameters, context, feedback, True) def processOutputs(alg, parameters, context, feedback): moveOutputTxtFile(alg, parameters, context)
gpl-2.0
frugalware/mate
t/fpmjunk.py
13
1462
#!/usr/bin/env python try: import pacman except ImportError: import alpm pacman = alpm import os, tempfile, shutil, sys, re remove = False if len(sys.argv) > 1: if sys.argv[1] == "--help": print "no longer necessary %s fpms" % sys.argv[2] sys.exit(0) elif sys.argv[1] == "--remove": remove = True arch = sys.argv[2] else: arch = sys.argv[1] for i in ['frugalware-%s' % arch]: arch = i[11:] root = tempfile.mkdtemp() pacman.initialize(root) if os.getcwd().split('/')[-2] == "frugalware-current": treename = "frugalware-current" archive = treename else: treename = "frugalware" archive = treename + "-stable" db = pacman.db_register(treename) pacman.db_setserver(db, "file://" + os.getcwd() + "/../frugalware-" + arch) pacman.db_update(1, db) fdb = [] j = pacman.db_getpkgcache(db) while j: pkg = pacman.void_to_PM_PKG(pacman.list_getdata(j)) pkgname = pacman.void_to_char(pacman.pkg_getinfo(pkg, pacman.PKG_NAME)) pkgver = pacman.void_to_char(pacman.pkg_getinfo(pkg, pacman.PKG_VERSION)) fdb.append("%s-%s-%s.fpm" % (pkgname, pkgver, arch)) j = pacman.list_next(j) pacman.release() shutil.rmtree(root) for j in os.listdir(os.getcwd() + "/../frugalware-" + arch): if j not in fdb and j != treename + ".fdb" and j != ".gitignore": print "frugalware-" + arch + "/" + j if remove: os.rename("../frugalware-" + arch + "/" + j, "/home/ftp/pub/archive/fpmjunk/" + archive + "/frugalware-" + arch + "/" + j)
gpl-2.0
jalexvig/tensorflow
tensorflow/contrib/nearest_neighbor/python/kernel_tests/hyperplane_lsh_probes_test.py
51
1939
# Copyright 2017 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. # ============================================================================== """Tests for hyperplane_lsh_probes.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.contrib.nearest_neighbor.python.ops.nearest_neighbor_ops import hyperplane_lsh_probes from tensorflow.python.platform import test class HyperplaneLshProbesTest(test.TestCase): # We only test the batch functionality of the op here because the multiprobe # tests in hyperplane_lsh_probes_test.cc already cover most of the LSH # functionality. def simple_batch_test(self): with self.test_session(): hyperplanes = np.eye(4) points = np.array([[1.2, 0.5, -0.9, -1.0], [2.0, -3.0, 1.0, -1.5]]) product = np.dot(points, hyperplanes) num_tables = 2 num_hyperplanes_per_table = 2 num_probes = 4 hashes, tables = hyperplane_lsh_probes(product, num_tables, num_hyperplanes_per_table, num_probes) self.assertAllEqual(hashes.eval(), [[3, 0, 2, 2], [2, 2, 0, 3]]) self.assertAllEqual(tables.eval(), [[0, 1, 0, 1], [0, 1, 1, 1]]) if __name__ == '__main__': test.main()
apache-2.0
angelapper/edx-platform
openedx/core/djangoapps/credit/api/provider.py
35
16186
""" API for initiating and tracking requests for credit from a provider. """ import datetime import logging import uuid import pytz from django.db import transaction from edx_proctoring.api import get_last_exam_completion_date from openedx.core.djangoapps.credit.exceptions import ( UserIsNotEligible, CreditProviderNotConfigured, RequestAlreadyCompleted, CreditRequestNotFound, InvalidCreditStatus, ) from openedx.core.djangoapps.credit.models import ( CreditProvider, CreditRequirementStatus, CreditRequest, CreditEligibility, ) from student.models import ( User, CourseEnrollment, ) from openedx.core.djangoapps.credit.signature import signature, get_shared_secret_key from util.date_utils import to_timestamp from util.json_request import JsonResponse # TODO: Cleanup this mess! ECOM-2908 log = logging.getLogger(__name__) def get_credit_providers(providers_list=None): """Retrieve all available credit providers or filter on given providers_list. Arguments: providers_list (list of strings or None): contains list of ids of credit providers or None. Returns: list of credit providers represented as dictionaries Response Values: >>> get_credit_providers(['hogwarts']) [ { "id": "hogwarts", "name": "Hogwarts School of Witchcraft and Wizardry", "url": "https://credit.example.com/", "status_url": "https://credit.example.com/status/", "description: "A new model for the Witchcraft and Wizardry School System.", "enable_integration": false, "fulfillment_instructions": " <p>In order to fulfill credit, Hogwarts School of Witchcraft and Wizardry requires learners to:</p> <ul> <li>Sample instruction abc</li> <li>Sample instruction xyz</li> </ul>", }, ... ] """ return CreditProvider.get_credit_providers(providers_list=providers_list) def get_credit_provider_info(request, provider_id): # pylint: disable=unused-argument """Retrieve the 'CreditProvider' model data against provided credit provider. Args: provider_id (str): The identifier for the credit provider Returns: 'CreditProvider' data dictionary Example Usage: >>> get_credit_provider_info("hogwarts") { "provider_id": "hogwarts", "display_name": "Hogwarts School of Witchcraft and Wizardry", "provider_url": "https://credit.example.com/", "provider_status_url": "https://credit.example.com/status/", "provider_description: "A new model for the Witchcraft and Wizardry School System.", "enable_integration": False, "fulfillment_instructions": " <p>In order to fulfill credit, Hogwarts School of Witchcraft and Wizardry requires learners to:</p> <ul> <li>Sample instruction abc</li> <li>Sample instruction xyz</li> </ul>", "thumbnail_url": "https://credit.example.com/logo.png" } """ credit_provider = CreditProvider.get_credit_provider(provider_id=provider_id) credit_provider_data = {} if credit_provider: credit_provider_data = { "provider_id": credit_provider.provider_id, "display_name": credit_provider.display_name, "provider_url": credit_provider.provider_url, "provider_status_url": credit_provider.provider_status_url, "provider_description": credit_provider.provider_description, "enable_integration": credit_provider.enable_integration, "fulfillment_instructions": credit_provider.fulfillment_instructions, "thumbnail_url": credit_provider.thumbnail_url } return JsonResponse(credit_provider_data) @transaction.atomic def create_credit_request(course_key, provider_id, username): """ Initiate a request for credit from a credit provider. This will return the parameters that the user's browser will need to POST to the credit provider. It does NOT calculate the signature. Only users who are eligible for credit (have satisfied all credit requirements) are allowed to make requests. A provider can be configured either with *integration enabled* or not. If automatic integration is disabled, this method will simply return a URL to the credit provider and method set to "GET", so the student can visit the URL and request credit directly. No database record will be created to track these requests. If automatic integration *is* enabled, then this will also return the parameters that the user's browser will need to POST to the credit provider. These parameters will be digitally signed using a secret key shared with the credit provider. A database record will be created to track the request with a 32-character UUID. The returned dictionary can be used by the user's browser to send a POST request to the credit provider. If a pending request already exists, this function should return a request description with the same UUID. (Other parameters, such as the user's full name may be different than the original request). If a completed request (either accepted or rejected) already exists, this function will raise an exception. Users are not allowed to make additional requests once a request has been completed. Arguments: course_key (CourseKey): The identifier for the course. provider_id (str): The identifier of the credit provider. username (str): The user initiating the request. Returns: dict Raises: UserIsNotEligible: The user has not satisfied eligibility requirements for credit. CreditProviderNotConfigured: The credit provider has not been configured for this course. RequestAlreadyCompleted: The user has already submitted a request and received a response from the credit provider. Example Usage: >>> create_credit_request(course.id, "hogwarts", "ron") { "url": "https://credit.example.com/request", "method": "POST", "parameters": { "request_uuid": "557168d0f7664fe59097106c67c3f847", "timestamp": 1434631630, "course_org": "HogwartsX", "course_num": "Potions101", "course_run": "1T2015", "final_grade": "0.95", "user_username": "ron", "user_email": "ron@example.com", "user_full_name": "Ron Weasley", "user_mailing_address": "", "user_country": "US", "signature": "cRCNjkE4IzY+erIjRwOQCpRILgOvXx4q2qvx141BCqI=" } } """ try: user_eligibility = CreditEligibility.objects.select_related('course').get( username=username, course__course_key=course_key ) credit_course = user_eligibility.course credit_provider = CreditProvider.objects.get(provider_id=provider_id) except CreditEligibility.DoesNotExist: log.warning( u'User "%s" tried to initiate a request for credit in course "%s", ' u'but the user is not eligible for credit', username, course_key ) raise UserIsNotEligible except CreditProvider.DoesNotExist: log.error(u'Credit provider with ID "%s" has not been configured.', provider_id) raise CreditProviderNotConfigured # Check if we've enabled automatic integration with the credit # provider. If not, we'll show the user a link to a URL # where the user can request credit directly from the provider. # Note that we do NOT track these requests in our database, # since the state would always be "pending" (we never hear back). if not credit_provider.enable_integration: return { "url": credit_provider.provider_url, "method": "GET", "parameters": {} } else: # If automatic credit integration is enabled, then try # to retrieve the shared signature *before* creating the request. # That way, if there's a misconfiguration, we won't have requests # in our system that we know weren't sent to the provider. shared_secret_key = get_shared_secret_key(credit_provider.provider_id) if shared_secret_key is None: msg = u'Credit provider with ID "{provider_id}" does not have a secret key configured.'.format( provider_id=credit_provider.provider_id ) log.error(msg) raise CreditProviderNotConfigured(msg) # Initiate a new request if one has not already been created credit_request, created = CreditRequest.objects.get_or_create( course=credit_course, provider=credit_provider, username=username, ) # Check whether we've already gotten a response for a request, # If so, we're not allowed to issue any further requests. # Skip checking the status if we know that we just created this record. if not created and credit_request.status != "pending": log.warning( ( u'Cannot initiate credit request because the request with UUID "%s" ' u'exists with status "%s"' ), credit_request.uuid, credit_request.status ) raise RequestAlreadyCompleted if created: credit_request.uuid = uuid.uuid4().hex # Retrieve user account and profile info user = User.objects.select_related('profile').get(username=username) # Retrieve the final grade from the eligibility table try: final_grade = CreditRequirementStatus.objects.get( username=username, requirement__namespace="grade", requirement__name="grade", requirement__course__course_key=course_key, status="satisfied" ).reason["final_grade"] # NOTE (CCB): Limiting the grade to seven characters is a hack for ASU. if len(unicode(final_grade)) > 7: final_grade = u'{:.5f}'.format(final_grade) else: final_grade = unicode(final_grade) except (CreditRequirementStatus.DoesNotExist, TypeError, KeyError): msg = 'Could not retrieve final grade from the credit eligibility table for ' \ 'user [{user_id}] in course [{course_key}].'.format(user_id=user.id, course_key=course_key) log.exception(msg) raise UserIsNotEligible(msg) # Getting the students's enrollment date course_enrollment = CourseEnrollment.get_enrollment(user, course_key) enrollment_date = course_enrollment.created if course_enrollment else "" # Getting the student's course completion date completion_date = get_last_exam_completion_date(course_key, username) parameters = { "request_uuid": credit_request.uuid, "timestamp": to_timestamp(datetime.datetime.now(pytz.UTC)), "course_org": course_key.org, "course_num": course_key.course, "course_run": course_key.run, "enrollment_timestamp": to_timestamp(enrollment_date) if enrollment_date else "", "course_completion_timestamp": to_timestamp(completion_date) if completion_date else "", "final_grade": final_grade, "user_username": user.username, "user_email": user.email, "user_full_name": user.profile.name, "user_mailing_address": "", "user_country": ( user.profile.country.code if user.profile.country.code is not None else "" ), } credit_request.parameters = parameters credit_request.save() if created: log.info(u'Created new request for credit with UUID "%s"', credit_request.uuid) else: log.info( u'Updated request for credit with UUID "%s" so the user can re-issue the request', credit_request.uuid ) # Sign the parameters using a secret key we share with the credit provider. parameters["signature"] = signature(parameters, shared_secret_key) return { "url": credit_provider.provider_url, "method": "POST", "parameters": parameters } def update_credit_request_status(request_uuid, provider_id, status): """ Update the status of a credit request. Approve or reject a request for a student to receive credit in a course from a particular credit provider. This function does NOT check that the status update is authorized. The caller needs to handle authentication and authorization (checking the signature of the message received from the credit provider) The function is idempotent; if the request has already been updated to the status, the function does nothing. Arguments: request_uuid (str): The unique identifier for the credit request. provider_id (str): Identifier for the credit provider. status (str): Either "approved" or "rejected" Returns: None Raises: CreditRequestNotFound: No request exists that is associated with the given provider. InvalidCreditStatus: The status is not either "approved" or "rejected". """ if status not in [CreditRequest.REQUEST_STATUS_APPROVED, CreditRequest.REQUEST_STATUS_REJECTED]: raise InvalidCreditStatus try: request = CreditRequest.objects.get(uuid=request_uuid, provider__provider_id=provider_id) old_status = request.status request.status = status request.save() log.info( u'Updated request with UUID "%s" from status "%s" to "%s" for provider with ID "%s".', request_uuid, old_status, status, provider_id ) except CreditRequest.DoesNotExist: msg = ( u'Credit provider with ID "{provider_id}" attempted to ' u'update request with UUID "{request_uuid}", but no request ' u'with this UUID is associated with the provider.' ).format(provider_id=provider_id, request_uuid=request_uuid) log.warning(msg) raise CreditRequestNotFound(msg) def get_credit_requests_for_user(username): """ Retrieve the status of a credit request. Returns either "pending", "approved", or "rejected" Arguments: username (unicode): The username of the user who initiated the requests. Returns: list Example Usage: >>> get_credit_request_status_for_user("bob") [ { "uuid": "557168d0f7664fe59097106c67c3f847", "timestamp": 1434631630, "course_key": "course-v1:HogwartsX+Potions101+1T2015", "provider": { "id": "HogwartsX", "display_name": "Hogwarts School of Witchcraft and Wizardry", }, "status": "pending" # or "approved" or "rejected" } ] """ return CreditRequest.credit_requests_for_user(username) def get_credit_request_status(username, course_key): """Get the credit request status. This function returns the status of credit request of user for given course. It returns the latest request status for the any credit provider. The valid status are 'pending', 'approved' or 'rejected'. Args: username(str): The username of user course_key(CourseKey): The course locator key Returns: A dictionary of credit request user has made if any """ credit_request = CreditRequest.get_user_request_status(username, course_key) return { "uuid": credit_request.uuid, "timestamp": credit_request.modified, "course_key": credit_request.course.course_key, "provider": { "id": credit_request.provider.provider_id, "display_name": credit_request.provider.display_name }, "status": credit_request.status } if credit_request else {}
agpl-3.0
ElunaLuaEngine/ElunaTrinityWotlk
contrib/enumutils_describe.py
7
6656
from re import compile, MULTILINE from os import walk, getcwd notice = ('''/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ ''') if not getcwd().endswith('src'): print('Run this from the src directory!') print('(Invoke as \'python ../contrib/enumutils_describe.py\')') exit(1) EnumPattern = compile(r'//\s*EnumUtils: DESCRIBE THIS(?:\s*\(in ([^\)]+)\))?\s+enum\s+([0-9A-Za-z]+)[^\n]*\s*{([^}]+)};') EnumValuesPattern = compile(r'\s+\S.+?(,|$)[^\n]*') EnumValueNamePattern = compile(r'^\s*([a-zA-Z0-9_]+)', flags=MULTILINE) EnumValueSkipLinePattern = compile(r'^\s*//') EnumValueCommentPattern = compile(r'//,?[ \t]*([^\n]+)$') CommentMatchFormat = compile(r'^(((TITLE +(.+?))|(DESCRIPTION +(.+?))) *){1,2}$') CommentSkipFormat = compile(r'^SKIP *$') def strescape(str): res = '' for char in str: if char in ('\\', '"') or not (32 <= ord(char) < 127): res += ('\\%03o' % ord(char)) else: res += char return '"' + res + '"' def processFile(path, filename): input = open('%s/%s.h' % (path, filename),'r') if input is None: print('Failed to open %s.h' % filename) return file = input.read() enums = [] for enum in EnumPattern.finditer(file): prefix = enum.group(1) or '' name = enum.group(2) values = [] for value in EnumValuesPattern.finditer(enum.group(3)): valueData = value.group(0) valueNameMatch = EnumValueNamePattern.search(valueData) if valueNameMatch is None: if EnumValueSkipLinePattern.search(valueData) is None: print('Name of value not found: %s' % repr(valueData)) continue valueName = valueNameMatch.group(1) valueCommentMatch = EnumValueCommentPattern.search(valueData) valueComment = None if valueCommentMatch: valueComment = valueCommentMatch.group(1) valueTitle = None valueDescription = None if valueComment is not None: if CommentSkipFormat.match(valueComment) is not None: continue commentMatch = CommentMatchFormat.match(valueComment) if commentMatch is not None: valueTitle = commentMatch.group(4) valueDescription = commentMatch.group(6) else: valueDescription = valueComment if valueTitle is None: valueTitle = valueName if valueDescription is None: valueDescription = '' values.append((valueName, valueTitle, valueDescription)) enums.append((prefix + name, prefix, values)) print('%s.h: Enum %s parsed with %d values' % (filename, name, len(values))) if not enums: return print('Done parsing %s.h (in %s)\n' % (filename, path)) output = open('%s/enuminfo_%s.cpp' % (path, filename), 'w') if output is None: print('Failed to create enuminfo_%s.cpp' % filename) return # write output file output.write(notice) output.write('#include "%s.h"\n' % filename) output.write('#include "Define.h"\n') output.write('#include "SmartEnum.h"\n') output.write('#include <stdexcept>\n') output.write('\n') output.write('namespace Trinity::Impl::EnumUtilsImpl\n') output.write('{\n') for name, prefix, values in enums: tag = ('data for enum \'%s\' in \'%s.h\' auto-generated' % (name, filename)) output.write('\n') output.write('/*' + ('*'*(len(tag)+2)) + '*\\\n') output.write('|* ' + tag + ' *|\n') output.write('\\*' + ('*'*(len(tag)+2)) + '*/\n') output.write('template <>\n') output.write('TC_API_EXPORT EnumText EnumUtils<%s>::ToString(%s value)\n' % (name, name)) output.write('{\n') output.write(' switch (value)\n') output.write(' {\n') for label, title, description in values: output.write(' case %s: return { %s, %s, %s };\n' % (prefix + label, strescape(label), strescape(title), strescape(description))) output.write(' default: throw std::out_of_range("value");\n') output.write(' }\n') output.write('}\n') output.write('\n') output.write('template <>\n') output.write('TC_API_EXPORT size_t EnumUtils<%s>::Count() { return %d; }\n' % (name, len(values))) output.write('\n') output.write('template <>\n') output.write('TC_API_EXPORT %s EnumUtils<%s>::FromIndex(size_t index)\n' % (name, name)) output.write('{\n') output.write(' switch (index)\n') output.write(' {\n') for (i, (label, title, description)) in enumerate(values): output.write(' case %d: return %s;\n' % (i, prefix + label)) output.write(' default: throw std::out_of_range("index");\n') output.write(' }\n') output.write('}\n') output.write('\n') output.write('template <>\n') output.write('TC_API_EXPORT size_t EnumUtils<%s>::ToIndex(%s value)\n' % (name, name)) output.write('{\n') output.write(' switch (value)\n') output.write(' {\n') for (i, (label, title, description)) in enumerate(values): output.write(' case %s: return %d;\n' % (prefix + label, i)) output.write(' default: throw std::out_of_range("value");\n') output.write(' }\n') output.write('}\n') output.write('}\n') FilenamePattern = compile(r'^(.+)\.h$') for root, dirs, files in walk('.'): for n in files: nameMatch = FilenamePattern.match(n) if nameMatch is not None: processFile(root, nameMatch.group(1))
gpl-2.0
xaxaxa/n7102_kernel
tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py
11088
3246
# Core.py - Python extension for perf script, core functions # # Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com> # # This software may be distributed under the terms of the GNU General # Public License ("GPL") version 2 as published by the Free Software # Foundation. from collections import defaultdict def autodict(): return defaultdict(autodict) flag_fields = autodict() symbolic_fields = autodict() def define_flag_field(event_name, field_name, delim): flag_fields[event_name][field_name]['delim'] = delim def define_flag_value(event_name, field_name, value, field_str): flag_fields[event_name][field_name]['values'][value] = field_str def define_symbolic_field(event_name, field_name): # nothing to do, really pass def define_symbolic_value(event_name, field_name, value, field_str): symbolic_fields[event_name][field_name]['values'][value] = field_str def flag_str(event_name, field_name, value): string = "" if flag_fields[event_name][field_name]: print_delim = 0 keys = flag_fields[event_name][field_name]['values'].keys() keys.sort() for idx in keys: if not value and not idx: string += flag_fields[event_name][field_name]['values'][idx] break if idx and (value & idx) == idx: if print_delim and flag_fields[event_name][field_name]['delim']: string += " " + flag_fields[event_name][field_name]['delim'] + " " string += flag_fields[event_name][field_name]['values'][idx] print_delim = 1 value &= ~idx return string def symbol_str(event_name, field_name, value): string = "" if symbolic_fields[event_name][field_name]: keys = symbolic_fields[event_name][field_name]['values'].keys() keys.sort() for idx in keys: if not value and not idx: string = symbolic_fields[event_name][field_name]['values'][idx] break if (value == idx): string = symbolic_fields[event_name][field_name]['values'][idx] break return string trace_flags = { 0x00: "NONE", \ 0x01: "IRQS_OFF", \ 0x02: "IRQS_NOSUPPORT", \ 0x04: "NEED_RESCHED", \ 0x08: "HARDIRQ", \ 0x10: "SOFTIRQ" } def trace_flag_str(value): string = "" print_delim = 0 keys = trace_flags.keys() for idx in keys: if not value and not idx: string += "NONE" break if idx and (value & idx) == idx: if print_delim: string += " | "; string += trace_flags[idx] print_delim = 1 value &= ~idx return string def taskState(state): states = { 0 : "R", 1 : "S", 2 : "D", 64: "DEAD" } if state not in states: return "Unknown" return states[state] class EventHeaders: def __init__(self, common_cpu, common_secs, common_nsecs, common_pid, common_comm): self.cpu = common_cpu self.secs = common_secs self.nsecs = common_nsecs self.pid = common_pid self.comm = common_comm def ts(self): return (self.secs * (10 ** 9)) + self.nsecs def ts_format(self): return "%d.%d" % (self.secs, int(self.nsecs / 1000))
gpl-2.0
tracksinspector/papi
setup.py
1
3827
"""A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() setup( name='papi', # Versions should comply with PEP440. For a discussion on single-sourcing # the version across setup.py and the project code, see # https://packaging.python.org/en/latest/single_source_version.html version='0.1.8', description='Build RESTful APIs with minimal boilerplate', long_description=long_description, # The project's main homepage. url='https://github.com/tracksinspector/papi', # Author details author='Tobias Dammers', author_email='dammers@tracksinspector.com', # Choose your license license='MIT', # See https://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers=[ # How mature is this project? Common values are # 3 - Alpha # 4 - Beta # 5 - Production/Stable 'Development Status :: 4 - Beta', # Indicate who your project is intended for 'Intended Audience :: Developers', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', # Pick your license as you wish (should match "license" above) 'License :: OSI Approved :: MIT License', # Specify the Python versions you support here. In particular, ensure # that you indicate whether you support Python 2, Python 3 or both. 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', ], # What does your project relate to? keywords='restful rest webservice json http hateoas', # You can just specify the packages manually here if your project is # simple. Or you can use find_packages(). packages=find_packages(exclude=['contrib', 'docs', 'tests', 'venv', 'example']), # Alternatively, if you want to distribute just a my_module.py, uncomment # this: # py_modules=["my_module"], # List run-time dependencies here. These will be installed by pip when # your project is installed. For an analysis of "install_requires" vs pip's # requirements files see: # https://packaging.python.org/en/latest/requirements.html install_requires=[], # List additional groups of dependencies here (e.g. development # dependencies). You can install these using the following syntax, # for example: # $ pip install -e .[dev,test] extras_require={ 'dev': ['check-manifest'], 'test': ['coverage', 'cov-core', 'nose2', 'six'], }, # If there are data files included in your packages that need to be # installed, specify them here. If using Python 2.6 or less, then these # have to be included in MANIFEST.in as well. package_data={ }, # Although 'package_data' is the preferred approach, in some case you may # need to place data files outside of your packages. See: # http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files # noqa # In this case, 'data_file' will be installed into '<sys.prefix>/my_data' data_files=[ ], # To provide executable scripts, use entry points in preference to the # "scripts" keyword. Entry points provide cross-platform support and allow # pip to create the appropriate form of executable for the target platform. entry_points={ }, )
mit
sergioska/EvernoteSyntaxHighlight
pygments/scanner.py
24
3114
# -*- coding: utf-8 -*- """ pygments.scanner ~~~~~~~~~~~~~~~~ This library implements a regex based scanner. Some languages like Pascal are easy to parse but have some keywords that depend on the context. Because of this it's impossible to lex that just by using a regular expression lexer like the `RegexLexer`. Have a look at the `DelphiLexer` to get an idea of how to use this scanner. :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re class EndOfText(RuntimeError): """ Raise if end of text is reached and the user tried to call a match function. """ class Scanner(object): """ Simple scanner All method patterns are regular expression strings (not compiled expressions!) """ def __init__(self, text, flags=0): """ :param text: The text which should be scanned :param flags: default regular expression flags """ self.data = text self.data_length = len(text) self.start_pos = 0 self.pos = 0 self.flags = flags self.last = None self.match = None self._re_cache = {} def eos(self): """`True` if the scanner reached the end of text.""" return self.pos >= self.data_length eos = property(eos, eos.__doc__) def check(self, pattern): """ Apply `pattern` on the current position and return the match object. (Doesn't touch pos). Use this for lookahead. """ if self.eos: raise EndOfText() if pattern not in self._re_cache: self._re_cache[pattern] = re.compile(pattern, self.flags) return self._re_cache[pattern].match(self.data, self.pos) def test(self, pattern): """Apply a pattern on the current position and check if it patches. Doesn't touch pos.""" return self.check(pattern) is not None def scan(self, pattern): """ Scan the text for the given pattern and update pos/match and related fields. The return value is a boolen that indicates if the pattern matched. The matched value is stored on the instance as ``match``, the last value is stored as ``last``. ``start_pos`` is the position of the pointer before the pattern was matched, ``pos`` is the end position. """ if self.eos: raise EndOfText() if pattern not in self._re_cache: self._re_cache[pattern] = re.compile(pattern, self.flags) self.last = self.match m = self._re_cache[pattern].match(self.data, self.pos) if m is None: return False self.start_pos = m.start() self.pos = m.end() self.match = m.group() return True def get_char(self): """Scan exactly one char.""" self.scan('.') def __repr__(self): return '<%s %d/%d>' % ( self.__class__.__name__, self.pos, self.data_length )
apache-2.0
mrichart/ns-3-dev-git
src/point-to-point/bindings/modulegen__gcc_LP64.py
38
407808
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.point_to_point', cpp_namespace='::ns3') return root_module def register_types(module): root_module = module.get_root() ## address.h (module 'network'): ns3::Address [class] module.add_class('Address', import_from_module='ns.network') ## address.h (module 'network'): ns3::Address::MaxSize_e [enumeration] module.add_enum('MaxSize_e', ['MAX_SIZE'], outer_class=root_module['ns3::Address'], import_from_module='ns.network') ## 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', allow_subclassing=True, import_from_module='ns.network') ## 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']) ## buffer.h (module 'network'): ns3::Buffer [class] module.add_class('Buffer', import_from_module='ns.network') ## buffer.h (module 'network'): ns3::Buffer::Iterator [class] module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::Buffer']) ## packet.h (module 'network'): ns3::ByteTagIterator [class] module.add_class('ByteTagIterator', import_from_module='ns.network') ## packet.h (module 'network'): ns3::ByteTagIterator::Item [class] module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagIterator']) ## byte-tag-list.h (module 'network'): ns3::ByteTagList [class] module.add_class('ByteTagList', import_from_module='ns.network') ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator [class] module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList']) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item [struct] module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList::Iterator']) ## callback.h (module 'core'): ns3::CallbackBase [class] module.add_class('CallbackBase', import_from_module='ns.core') ## data-rate.h (module 'network'): ns3::DataRate [class] module.add_class('DataRate', import_from_module='ns.network') ## 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') ## mac48-address.h (module 'network'): ns3::Mac48Address [class] module.add_class('Mac48Address', import_from_module='ns.network') ## mac48-address.h (module 'network'): ns3::Mac48Address [class] root_module['ns3::Mac48Address'].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') ## node-container.h (module 'network'): ns3::NodeContainer [class] module.add_class('NodeContainer', import_from_module='ns.network') ## object-base.h (module 'core'): ns3::ObjectBase [class] module.add_class('ObjectBase', allow_subclassing=True, import_from_module='ns.core') ## object.h (module 'core'): ns3::ObjectDeleter [struct] module.add_class('ObjectDeleter', import_from_module='ns.core') ## object-factory.h (module 'core'): ns3::ObjectFactory [class] module.add_class('ObjectFactory', import_from_module='ns.core') ## packet-metadata.h (module 'network'): ns3::PacketMetadata [class] module.add_class('PacketMetadata', import_from_module='ns.network') ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [struct] module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::PacketMetadata']) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [enumeration] module.add_enum('', ['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']) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData_e [enumeration] module.add_enum('TagData_e', ['MAX_SIZE'], outer_class=root_module['ns3::PacketTagList::TagData'], import_from_module='ns.network') ## 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', allow_subclassing=True, import_from_module='ns.network') ## point-to-point-helper.h (module 'point-to-point'): ns3::PointToPointHelper [class] module.add_class('PointToPointHelper', parent=[root_module['ns3::PcapHelperForDevice'], root_module['ns3::AsciiTraceHelperForDevice']]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'], parent=root_module['ns3::ObjectBase'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simulator.h (module 'core'): ns3::Simulator [class] module.add_class('Simulator', destructor_visibility='private', import_from_module='ns.core') ## simulator.h (module 'core'): ns3::Simulator [enumeration] module.add_enum('', ['NO_CONTEXT'], outer_class=root_module['ns3::Simulator'], import_from_module='ns.core') ## 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']) ## empty.h (module 'core'): ns3::empty [class] module.add_class('empty', import_from_module='ns.core') ## int64x64-double.h (module 'core'): ns3::int64x64_t [class] module.add_class('int64x64_t', import_from_module='ns.core') ## int64x64-double.h (module 'core'): ns3::int64x64_t::impl_type [enumeration] module.add_enum('impl_type', ['int128_impl', 'cairo_impl', 'ld_impl'], outer_class=root_module['ns3::int64x64_t'], import_from_module='ns.core') ## chunk.h (module 'network'): ns3::Chunk [class] module.add_class('Chunk', import_from_module='ns.network', parent=root_module['ns3::ObjectBase']) ## header.h (module 'network'): ns3::Header [class] module.add_class('Header', import_from_module='ns.network', parent=root_module['ns3::Chunk']) ## object.h (module 'core'): ns3::Object [class] module.add_class('Object', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >']) ## object.h (module 'core'): ns3::Object::AggregateIterator [class] module.add_class('AggregateIterator', import_from_module='ns.core', outer_class=root_module['ns3::Object']) ## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper [class] module.add_class('PcapFileWrapper', import_from_module='ns.network', parent=root_module['ns3::Object']) ## ppp-header.h (module 'point-to-point'): ns3::PppHeader [class] module.add_class('PppHeader', parent=root_module['ns3::Header']) ## queue.h (module 'network'): ns3::Queue [class] module.add_class('Queue', import_from_module='ns.network', parent=root_module['ns3::Object']) ## queue.h (module 'network'): ns3::Queue::QueueMode [enumeration] module.add_enum('QueueMode', ['QUEUE_MODE_PACKETS', 'QUEUE_MODE_BYTES'], outer_class=root_module['ns3::Queue'], import_from_module='ns.network') ## random-variable-stream.h (module 'core'): ns3::RandomVariableStream [class] module.add_class('RandomVariableStream', import_from_module='ns.core', parent=root_module['ns3::Object']) ## random-variable-stream.h (module 'core'): ns3::SequentialRandomVariable [class] module.add_class('SequentialRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream']) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeChecker', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeChecker>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeValue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeValue>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::CallbackImplBase', 'ns3::empty', 'ns3::DefaultDeleter<ns3::CallbackImplBase>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::EventImpl', 'ns3::empty', 'ns3::DefaultDeleter<ns3::EventImpl>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Hash::Implementation', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Hash::Implementation>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::NetDeviceQueue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::NetDeviceQueue>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::NixVector', 'ns3::empty', 'ns3::DefaultDeleter<ns3::NixVector>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::OutputStreamWrapper', 'ns3::empty', 'ns3::DefaultDeleter<ns3::OutputStreamWrapper>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Packet', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Packet>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::QueueItem', 'ns3::empty', 'ns3::DefaultDeleter<ns3::QueueItem>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## 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') ## 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', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >']) ## attribute.h (module 'core'): ns3::AttributeValue [class] module.add_class('AttributeValue', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >']) ## boolean.h (module 'core'): ns3::BooleanChecker [class] module.add_class('BooleanChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## boolean.h (module 'core'): ns3::BooleanValue [class] module.add_class('BooleanValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## callback.h (module 'core'): ns3::CallbackChecker [class] module.add_class('CallbackChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## callback.h (module 'core'): ns3::CallbackImplBase [class] module.add_class('CallbackImplBase', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >']) ## callback.h (module 'core'): ns3::CallbackValue [class] module.add_class('CallbackValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## 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']) ## 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') ## net-device.h (module 'network'): ns3::NetDeviceQueue [class] module.add_class('NetDeviceQueue', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> >']) ## net-device.h (module 'network'): ns3::NetDeviceQueueInterface [class] module.add_class('NetDeviceQueueInterface', import_from_module='ns.network', parent=root_module['ns3::Object']) ## 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']) ## 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> >']) ## random-variable-stream.h (module 'core'): ns3::ParetoRandomVariable [class] module.add_class('ParetoRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream']) ## point-to-point-channel.h (module 'point-to-point'): ns3::PointToPointChannel [class] module.add_class('PointToPointChannel', parent=root_module['ns3::Channel']) ## point-to-point-net-device.h (module 'point-to-point'): ns3::PointToPointNetDevice [class] module.add_class('PointToPointNetDevice', parent=root_module['ns3::NetDevice']) ## point-to-point-remote-channel.h (module 'point-to-point'): ns3::PointToPointRemoteChannel [class] module.add_class('PointToPointRemoteChannel', parent=root_module['ns3::PointToPointChannel']) ## net-device.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> >']) ## net-device.h (module 'network'): ns3::QueueItem::Uint8Values [enumeration] module.add_enum('Uint8Values', ['IP_DSFIELD'], outer_class=root_module['ns3::QueueItem'], import_from_module='ns.network') ## 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::BurstErrorModel [class] module.add_class('BurstErrorModel', import_from_module='ns.network', parent=root_module['ns3::ErrorModel']) module.add_container('std::list< unsigned int >', 'unsigned int', container_type=u'list') ## Register a nested module for the namespace FatalImpl nested_module = module.add_cpp_namespace('FatalImpl') register_types_ns3_FatalImpl(nested_module) ## Register a nested module for the namespace Hash nested_module = module.add_cpp_namespace('Hash') register_types_ns3_Hash(nested_module) ## Register a nested module for the namespace TracedValueCallback nested_module = module.add_cpp_namespace('TracedValueCallback') register_types_ns3_TracedValueCallback(nested_module) ## Register a nested module for the namespace internal nested_module = module.add_cpp_namespace('internal') register_types_ns3_internal(nested_module) def register_types_ns3_FatalImpl(module): root_module = module.get_root() def register_types_ns3_Hash(module): root_module = module.get_root() ## hash-function.h (module 'core'): ns3::Hash::Implementation [class] module.add_class('Implementation', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> >']) typehandlers.add_type_alias(u'uint32_t ( * ) ( char const *, size_t ) *', u'ns3::Hash::Hash32Function_ptr') typehandlers.add_type_alias(u'uint32_t ( * ) ( char const *, size_t ) **', u'ns3::Hash::Hash32Function_ptr*') typehandlers.add_type_alias(u'uint32_t ( * ) ( char const *, size_t ) *&', u'ns3::Hash::Hash32Function_ptr&') typehandlers.add_type_alias(u'uint64_t ( * ) ( char const *, size_t ) *', u'ns3::Hash::Hash64Function_ptr') typehandlers.add_type_alias(u'uint64_t ( * ) ( char const *, size_t ) **', u'ns3::Hash::Hash64Function_ptr*') typehandlers.add_type_alias(u'uint64_t ( * ) ( char const *, size_t ) *&', u'ns3::Hash::Hash64Function_ptr&') ## Register a nested module for the namespace Function nested_module = module.add_cpp_namespace('Function') register_types_ns3_Hash_Function(nested_module) def register_types_ns3_Hash_Function(module): root_module = module.get_root() ## hash-fnv.h (module 'core'): ns3::Hash::Function::Fnv1a [class] module.add_class('Fnv1a', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation']) ## hash-function.h (module 'core'): ns3::Hash::Function::Hash32 [class] module.add_class('Hash32', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation']) ## hash-function.h (module 'core'): ns3::Hash::Function::Hash64 [class] module.add_class('Hash64', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation']) ## hash-murmur3.h (module 'core'): ns3::Hash::Function::Murmur3 [class] module.add_class('Murmur3', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation']) def register_types_ns3_TracedValueCallback(module): root_module = module.get_root() typehandlers.add_type_alias(u'void ( * ) ( uint8_t, uint8_t ) *', u'ns3::TracedValueCallback::Uint8') typehandlers.add_type_alias(u'void ( * ) ( uint8_t, uint8_t ) **', u'ns3::TracedValueCallback::Uint8*') typehandlers.add_type_alias(u'void ( * ) ( uint8_t, uint8_t ) *&', u'ns3::TracedValueCallback::Uint8&') typehandlers.add_type_alias(u'void ( * ) ( int8_t, int8_t ) *', u'ns3::TracedValueCallback::Int8') typehandlers.add_type_alias(u'void ( * ) ( int8_t, int8_t ) **', u'ns3::TracedValueCallback::Int8*') typehandlers.add_type_alias(u'void ( * ) ( int8_t, int8_t ) *&', u'ns3::TracedValueCallback::Int8&') typehandlers.add_type_alias(u'void ( * ) ( uint16_t, uint16_t ) *', u'ns3::TracedValueCallback::Uint16') typehandlers.add_type_alias(u'void ( * ) ( uint16_t, uint16_t ) **', u'ns3::TracedValueCallback::Uint16*') typehandlers.add_type_alias(u'void ( * ) ( uint16_t, uint16_t ) *&', u'ns3::TracedValueCallback::Uint16&') typehandlers.add_type_alias(u'void ( * ) ( uint32_t, uint32_t ) *', u'ns3::TracedValueCallback::Uint32') typehandlers.add_type_alias(u'void ( * ) ( uint32_t, uint32_t ) **', u'ns3::TracedValueCallback::Uint32*') typehandlers.add_type_alias(u'void ( * ) ( uint32_t, uint32_t ) *&', u'ns3::TracedValueCallback::Uint32&') typehandlers.add_type_alias(u'void ( * ) ( double, double ) *', u'ns3::TracedValueCallback::Double') typehandlers.add_type_alias(u'void ( * ) ( double, double ) **', u'ns3::TracedValueCallback::Double*') typehandlers.add_type_alias(u'void ( * ) ( double, double ) *&', u'ns3::TracedValueCallback::Double&') typehandlers.add_type_alias(u'void ( * ) ( ns3::Time, ns3::Time ) *', u'ns3::TracedValueCallback::Time') typehandlers.add_type_alias(u'void ( * ) ( ns3::Time, ns3::Time ) **', u'ns3::TracedValueCallback::Time*') typehandlers.add_type_alias(u'void ( * ) ( ns3::Time, ns3::Time ) *&', u'ns3::TracedValueCallback::Time&') typehandlers.add_type_alias(u'void ( * ) ( bool, bool ) *', u'ns3::TracedValueCallback::Bool') typehandlers.add_type_alias(u'void ( * ) ( bool, bool ) **', u'ns3::TracedValueCallback::Bool*') typehandlers.add_type_alias(u'void ( * ) ( bool, bool ) *&', u'ns3::TracedValueCallback::Bool&') typehandlers.add_type_alias(u'void ( * ) ( int16_t, int16_t ) *', u'ns3::TracedValueCallback::Int16') typehandlers.add_type_alias(u'void ( * ) ( int16_t, int16_t ) **', u'ns3::TracedValueCallback::Int16*') typehandlers.add_type_alias(u'void ( * ) ( int16_t, int16_t ) *&', u'ns3::TracedValueCallback::Int16&') typehandlers.add_type_alias(u'void ( * ) ( int32_t, int32_t ) *', u'ns3::TracedValueCallback::Int32') typehandlers.add_type_alias(u'void ( * ) ( int32_t, int32_t ) **', u'ns3::TracedValueCallback::Int32*') typehandlers.add_type_alias(u'void ( * ) ( int32_t, int32_t ) *&', u'ns3::TracedValueCallback::Int32&') typehandlers.add_type_alias(u'void ( * ) ( ) *', u'ns3::TracedValueCallback::Void') typehandlers.add_type_alias(u'void ( * ) ( ) **', u'ns3::TracedValueCallback::Void*') typehandlers.add_type_alias(u'void ( * ) ( ) *&', u'ns3::TracedValueCallback::Void&') def register_types_ns3_internal(module): root_module = module.get_root() def register_methods(root_module): register_Ns3Address_methods(root_module, root_module['ns3::Address']) register_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_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_Ns3DataRate_methods(root_module, root_module['ns3::DataRate']) 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_Ns3Mac48Address_methods(root_module, root_module['ns3::Mac48Address']) 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_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_Ns3PointToPointHelper_methods(root_module, root_module['ns3::PointToPointHelper']) 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_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_Ns3PppHeader_methods(root_module, root_module['ns3::PppHeader']) register_Ns3Queue_methods(root_module, root_module['ns3::Queue']) 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__Ns3NetDeviceQueue_Ns3Empty_Ns3DefaultDeleter__lt__ns3NetDeviceQueue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> >']) 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_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_Ns3NetDeviceQueue_methods(root_module, root_module['ns3::NetDeviceQueue']) register_Ns3NetDeviceQueueInterface_methods(root_module, root_module['ns3::NetDeviceQueueInterface']) 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_Ns3PointToPointChannel_methods(root_module, root_module['ns3::PointToPointChannel']) register_Ns3PointToPointNetDevice_methods(root_module, root_module['ns3::PointToPointNetDevice']) register_Ns3PointToPointRemoteChannel_methods(root_module, root_module['ns3::PointToPointRemoteChannel']) register_Ns3QueueItem_methods(root_module, root_module['ns3::QueueItem']) 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_Ns3BurstErrorModel_methods(root_module, root_module['ns3::BurstErrorModel']) 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_output_stream_operator() cls.add_binary_comparison_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) [copy 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) [copy 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_Openmode filemode=std::ios_base::out) [member function] cls.add_method('CreateFileStream', 'ns3::Ptr< ns3::OutputStreamWrapper >', [param('std::string', 'filename'), param('std::_Ios_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) [copy 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_pure_virtual=True, is_virtual=True) return def register_Ns3AttributeConstructionList_methods(root_module, cls): ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList(ns3::AttributeConstructionList const & arg0) [copy 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<ns3::AttributeChecker const> 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'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::Begin() const [member function] cls.add_method('Begin', 'std::_List_const_iterator< ns3::AttributeConstructionList::Item >', [], is_const=True) ## attribute-construction-list.h (module 'core'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::End() const [member function] cls.add_method('End', 'std::_List_const_iterator< ns3::AttributeConstructionList::Item >', [], is_const=True) ## attribute-construction-list.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeConstructionList::Find(ns3::Ptr<ns3::AttributeChecker const> 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) [copy 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_Ns3Buffer_methods(root_module, cls): ## 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'): ns3::Buffer::Buffer(ns3::Buffer const & o) [copy constructor] cls.add_constructor([param('ns3::Buffer const &', 'o')]) ## 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) [copy 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) [copy 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) [copy 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) [copy 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) [copy 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) [copy 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) [copy 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_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) [copy 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')], deprecated=True, is_const=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_Ns3EventId_methods(root_module, cls): cls.add_binary_comparison_operator('!=') cls.add_binary_comparison_operator('==') ## event-id.h (module 'core'): ns3::EventId::EventId(ns3::EventId const & arg0) [copy 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) [copy 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, size_t const size) [member function] cls.add_method('GetHash32', 'uint32_t', [param('char const *', 'buffer'), param('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, size_t const size) [member function] cls.add_method('GetHash64', 'uint64_t', [param('char const *', 'buffer'), param('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_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(ns3::Ipv4Address const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4Address const &', 'arg0')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(uint32_t address) [constructor] cls.add_constructor([param('uint32_t', 'address')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(char const * address) [constructor] cls.add_constructor([param('char const *', 'address')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::CombineMask(ns3::Ipv4Mask const & mask) const [member function] cls.add_method('CombineMask', 'ns3::Ipv4Address', [param('ns3::Ipv4Mask const &', 'mask')], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::ConvertFrom(ns3::Address const & address) [member function] cls.add_method('ConvertFrom', 'ns3::Ipv4Address', [param('ns3::Address const &', 'address')], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::Deserialize(uint8_t const * buf) [member function] cls.add_method('Deserialize', 'ns3::Ipv4Address', [param('uint8_t const *', 'buf')], is_static=True) ## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Address::Get() const [member function] cls.add_method('Get', 'uint32_t', [], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetAny() [member function] cls.add_method('GetAny', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetBroadcast() [member function] cls.add_method('GetBroadcast', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::GetSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function] cls.add_method('GetSubnetDirectedBroadcast', 'ns3::Ipv4Address', [param('ns3::Ipv4Mask const &', 'mask')], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsAny() const [member function] cls.add_method('IsAny', 'bool', [], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsEqual(ns3::Ipv4Address const & other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv4Address const &', 'other')], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsLocalMulticast() const [member function] cls.add_method('IsLocalMulticast', 'bool', [], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsLocalhost() const [member function] cls.add_method('IsLocalhost', 'bool', [], is_const=True) ## ipv4-address.h (module 'network'): static bool ns3::Ipv4Address::IsMatchingType(ns3::Address const & address) [member function] cls.add_method('IsMatchingType', 'bool', [param('ns3::Address const &', 'address')], is_static=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function] cls.add_method('IsSubnetDirectedBroadcast', 'bool', [param('ns3::Ipv4Mask const &', 'mask')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Serialize(uint8_t * buf) const [member function] cls.add_method('Serialize', 'void', [param('uint8_t *', 'buf')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(uint32_t address) [member function] cls.add_method('Set', 'void', [param('uint32_t', 'address')]) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(char const * address) [member function] cls.add_method('Set', 'void', [param('char const *', 'address')]) return def register_Ns3Ipv4Mask_methods(root_module, cls): cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(ns3::Ipv4Mask const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4Mask const &', 'arg0')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(uint32_t mask) [constructor] cls.add_constructor([param('uint32_t', 'mask')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(char const * mask) [constructor] cls.add_constructor([param('char const *', 'mask')]) ## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::Get() const [member function] cls.add_method('Get', 'uint32_t', [], is_const=True) ## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::GetInverse() const [member function] cls.add_method('GetInverse', 'uint32_t', [], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv4Mask', [], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetOnes() [member function] cls.add_method('GetOnes', 'ns3::Ipv4Mask', [], is_static=True) ## ipv4-address.h (module 'network'): uint16_t ns3::Ipv4Mask::GetPrefixLength() const [member function] cls.add_method('GetPrefixLength', 'uint16_t', [], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv4Mask', [], is_static=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsEqual(ns3::Ipv4Mask other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv4Mask', 'other')], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsMatch(ns3::Ipv4Address a, ns3::Ipv4Address b) const [member function] cls.add_method('IsMatch', 'bool', [param('ns3::Ipv4Address', 'a'), param('ns3::Ipv4Address', 'b')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Set(uint32_t mask) [member function] cls.add_method('Set', 'void', [param('uint32_t', 'mask')]) return def register_Ns3Ipv6Address_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_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) [copy constructor] cls.add_constructor([param('ns3::Ipv6Address const &', 'addr')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(ns3::Ipv6Address const * addr) [constructor] cls.add_constructor([param('ns3::Ipv6Address const *', 'addr')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address ns3::Ipv6Address::CombinePrefix(ns3::Ipv6Prefix const & prefix) [member function] cls.add_method('CombinePrefix', 'ns3::Ipv6Address', [param('ns3::Ipv6Prefix const &', 'prefix')]) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::ConvertFrom(ns3::Address const & address) [member function] cls.add_method('ConvertFrom', 'ns3::Ipv6Address', [param('ns3::Address const &', 'address')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::Deserialize(uint8_t const * buf) [member function] cls.add_method('Deserialize', 'ns3::Ipv6Address', [param('uint8_t const *', 'buf')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllHostsMulticast() [member function] cls.add_method('GetAllHostsMulticast', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllNodesMulticast() [member function] cls.add_method('GetAllNodesMulticast', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllRoutersMulticast() [member function] cls.add_method('GetAllRoutersMulticast', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAny() [member function] cls.add_method('GetAny', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::GetBytes(uint8_t * buf) const [member function] cls.add_method('GetBytes', 'void', [param('uint8_t *', 'buf')], is_const=True) ## ipv6-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv6Address::GetIpv4MappedAddress() const [member function] cls.add_method('GetIpv4MappedAddress', 'ns3::Ipv4Address', [], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetOnes() [member function] cls.add_method('GetOnes', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllHostsMulticast() const [member function] cls.add_method('IsAllHostsMulticast', 'bool', [], deprecated=True, is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllNodesMulticast() const [member function] cls.add_method('IsAllNodesMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllRoutersMulticast() const [member function] cls.add_method('IsAllRoutersMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAny() const [member function] cls.add_method('IsAny', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsDocumentation() const [member function] cls.add_method('IsDocumentation', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsEqual(ns3::Ipv6Address const & other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv6Address const &', 'other')], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsIpv4MappedAddress() const [member function] cls.add_method('IsIpv4MappedAddress', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLinkLocal() const [member function] cls.add_method('IsLinkLocal', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLinkLocalMulticast() const [member function] cls.add_method('IsLinkLocalMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLocalhost() const [member function] cls.add_method('IsLocalhost', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): static bool ns3::Ipv6Address::IsMatchingType(ns3::Address const & address) [member function] cls.add_method('IsMatchingType', 'bool', [param('ns3::Address const &', 'address')], is_static=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsSolicitedMulticast() const [member function] cls.add_method('IsSolicitedMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac16Address addr, ns3::Ipv6Address prefix) [member function] cls.add_method('MakeAutoconfiguredAddress', 'ns3::Ipv6Address', [param('ns3::Mac16Address', 'addr'), param('ns3::Ipv6Address', 'prefix')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac48Address addr, ns3::Ipv6Address prefix) [member function] cls.add_method('MakeAutoconfiguredAddress', 'ns3::Ipv6Address', [param('ns3::Mac48Address', 'addr'), param('ns3::Ipv6Address', 'prefix')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac64Address addr, ns3::Ipv6Address prefix) [member function] cls.add_method('MakeAutoconfiguredAddress', 'ns3::Ipv6Address', [param('ns3::Mac64Address', 'addr'), param('ns3::Ipv6Address', 'prefix')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::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::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_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t * prefix) [constructor] cls.add_constructor([param('uint8_t *', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(char const * prefix) [constructor] cls.add_constructor([param('char const *', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t prefix) [constructor] cls.add_constructor([param('uint8_t', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const & prefix) [copy constructor] cls.add_constructor([param('ns3::Ipv6Prefix const &', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const * prefix) [constructor] cls.add_constructor([param('ns3::Ipv6Prefix const *', 'prefix')]) ## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::GetBytes(uint8_t * buf) const [member function] cls.add_method('GetBytes', 'void', [param('uint8_t *', 'buf')], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv6Prefix', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetOnes() [member function] cls.add_method('GetOnes', 'ns3::Ipv6Prefix', [], is_static=True) ## ipv6-address.h (module 'network'): uint8_t ns3::Ipv6Prefix::GetPrefixLength() const [member function] cls.add_method('GetPrefixLength', 'uint8_t', [], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv6Prefix', [], is_static=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsEqual(ns3::Ipv6Prefix const & other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv6Prefix const &', 'other')], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsMatch(ns3::Ipv6Address a, ns3::Ipv6Address b) const [member function] cls.add_method('IsMatch', 'bool', [param('ns3::Ipv6Address', 'a'), param('ns3::Ipv6Address', 'b')], is_const=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) return def register_Ns3Mac48Address_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address(ns3::Mac48Address const & arg0) [copy 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_Ns3NetDeviceContainer_methods(root_module, cls): ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::NetDeviceContainer const & arg0) [copy 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'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::NetDevice>*,std::vector<ns3::Ptr<ns3::NetDevice>, std::allocator<ns3::Ptr<ns3::NetDevice> > > > ns3::NetDeviceContainer::Begin() const [member function] cls.add_method('Begin', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::NetDevice > const, std::vector< ns3::Ptr< ns3::NetDevice > > >', [], is_const=True) ## net-device-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::NetDevice>*,std::vector<ns3::Ptr<ns3::NetDevice>, std::allocator<ns3::Ptr<ns3::NetDevice> > > > ns3::NetDeviceContainer::End() const [member function] cls.add_method('End', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::NetDevice > const, std::vector< ns3::Ptr< ns3::NetDevice > > >', [], 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) [copy 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'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeContainer::Begin() const [member function] cls.add_method('Begin', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >', [], 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'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeContainer::End() const [member function] cls.add_method('End', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >', [], 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) [copy constructor] cls.add_constructor([param('ns3::ObjectBase const &', 'arg0')]) ## object-base.h (module 'core'): void ns3::ObjectBase::GetAttribute(std::string name, ns3::AttributeValue & value) const [member function] cls.add_method('GetAttribute', 'void', [param('std::string', 'name'), param('ns3::AttributeValue &', 'value')], is_const=True) ## object-base.h (module 'core'): bool ns3::ObjectBase::GetAttributeFailSafe(std::string name, ns3::AttributeValue & value) const [member function] cls.add_method('GetAttributeFailSafe', 'bool', [param('std::string', 'name'), param('ns3::AttributeValue &', 'value')], is_const=True) ## object-base.h (module 'core'): ns3::TypeId ns3::ObjectBase::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## object-base.h (module 'core'): static ns3::TypeId ns3::ObjectBase::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## object-base.h (module 'core'): void ns3::ObjectBase::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function] cls.add_method('SetAttribute', 'void', [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::SetAttributeFailSafe(std::string name, ns3::AttributeValue const & value) [member function] cls.add_method('SetAttributeFailSafe', 'bool', [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceConnect', 'bool', [param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceConnectWithoutContext', 'bool', [param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceDisconnect', 'bool', [param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceDisconnectWithoutContext', 'bool', [param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): void ns3::ObjectBase::ConstructSelf(ns3::AttributeConstructionList const & attributes) [member function] cls.add_method('ConstructSelf', 'void', [param('ns3::AttributeConstructionList const &', 'attributes')], visibility='protected') ## object-base.h (module 'core'): void ns3::ObjectBase::NotifyConstructionCompleted() [member function] cls.add_method('NotifyConstructionCompleted', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3ObjectDeleter_methods(root_module, cls): ## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter() [constructor] cls.add_constructor([]) ## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter(ns3::ObjectDeleter const & arg0) [copy 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) [copy constructor] cls.add_constructor([param('ns3::ObjectFactory const &', 'arg0')]) ## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory() [constructor] cls.add_constructor([]) ## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory(std::string typeId) [constructor] cls.add_constructor([param('std::string', 'typeId')]) ## object-factory.h (module 'core'): ns3::Ptr<ns3::Object> ns3::ObjectFactory::Create() const [member function] cls.add_method('Create', 'ns3::Ptr< ns3::Object >', [], is_const=True) ## object-factory.h (module 'core'): ns3::TypeId ns3::ObjectFactory::GetTypeId() const [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_const=True) ## object-factory.h (module 'core'): void ns3::ObjectFactory::Set(std::string name, ns3::AttributeValue const & value) [member function] cls.add_method('Set', 'void', [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) ## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(ns3::TypeId tid) [member function] cls.add_method('SetTypeId', 'void', [param('ns3::TypeId', 'tid')]) ## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(char const * tid) [member function] cls.add_method('SetTypeId', 'void', [param('char const *', 'tid')]) ## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(std::string tid) [member function] cls.add_method('SetTypeId', 'void', [param('std::string', 'tid')]) return def register_Ns3PacketMetadata_methods(root_module, cls): ## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(uint64_t uid, uint32_t size) [constructor] cls.add_constructor([param('uint64_t', 'uid'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(ns3::PacketMetadata const & o) [copy 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) [copy 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) return def register_Ns3PacketMetadataItemIterator_methods(root_module, cls): ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator::ItemIterator(ns3::PacketMetadata::ItemIterator const & arg0) [copy 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) [copy 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) [copy 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) [copy 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) [copy 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 [ 21 ]', 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::tid [variable] cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False) 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_Openmode mode) [member function] cls.add_method('Open', 'void', [param('std::string const &', 'filename'), param('std::_Ios_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) [copy 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_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_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) [copy 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_pure_virtual=True, is_virtual=True) return def register_Ns3PointToPointHelper_methods(root_module, cls): ## point-to-point-helper.h (module 'point-to-point'): ns3::PointToPointHelper::PointToPointHelper(ns3::PointToPointHelper const & arg0) [copy constructor] cls.add_constructor([param('ns3::PointToPointHelper const &', 'arg0')]) ## point-to-point-helper.h (module 'point-to-point'): ns3::PointToPointHelper::PointToPointHelper() [constructor] cls.add_constructor([]) ## point-to-point-helper.h (module 'point-to-point'): ns3::NetDeviceContainer ns3::PointToPointHelper::Install(ns3::NodeContainer c) [member function] cls.add_method('Install', 'ns3::NetDeviceContainer', [param('ns3::NodeContainer', 'c')]) ## point-to-point-helper.h (module 'point-to-point'): ns3::NetDeviceContainer ns3::PointToPointHelper::Install(ns3::Ptr<ns3::Node> a, ns3::Ptr<ns3::Node> b) [member function] cls.add_method('Install', 'ns3::NetDeviceContainer', [param('ns3::Ptr< ns3::Node >', 'a'), param('ns3::Ptr< ns3::Node >', 'b')]) ## point-to-point-helper.h (module 'point-to-point'): ns3::NetDeviceContainer ns3::PointToPointHelper::Install(ns3::Ptr<ns3::Node> a, std::string bName) [member function] cls.add_method('Install', 'ns3::NetDeviceContainer', [param('ns3::Ptr< ns3::Node >', 'a'), param('std::string', 'bName')]) ## point-to-point-helper.h (module 'point-to-point'): ns3::NetDeviceContainer ns3::PointToPointHelper::Install(std::string aName, ns3::Ptr<ns3::Node> b) [member function] cls.add_method('Install', 'ns3::NetDeviceContainer', [param('std::string', 'aName'), param('ns3::Ptr< ns3::Node >', 'b')]) ## point-to-point-helper.h (module 'point-to-point'): ns3::NetDeviceContainer ns3::PointToPointHelper::Install(std::string aNode, std::string bNode) [member function] cls.add_method('Install', 'ns3::NetDeviceContainer', [param('std::string', 'aNode'), param('std::string', 'bNode')]) ## point-to-point-helper.h (module 'point-to-point'): void ns3::PointToPointHelper::SetChannelAttribute(std::string name, ns3::AttributeValue const & value) [member function] cls.add_method('SetChannelAttribute', 'void', [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) ## point-to-point-helper.h (module 'point-to-point'): void ns3::PointToPointHelper::SetDeviceAttribute(std::string name, ns3::AttributeValue const & value) [member function] cls.add_method('SetDeviceAttribute', 'void', [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) ## point-to-point-helper.h (module 'point-to-point'): void ns3::PointToPointHelper::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()')]) ## point-to-point-helper.h (module 'point-to-point'): void ns3::PointToPointHelper::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')], visibility='private', is_virtual=True) ## point-to-point-helper.h (module 'point-to-point'): void ns3::PointToPointHelper::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')], visibility='private', is_virtual=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) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3Simulator_methods(root_module, cls): ## simulator.h (module 'core'): ns3::Simulator::Simulator(ns3::Simulator const & arg0) [copy constructor] cls.add_constructor([param('ns3::Simulator const &', 'arg0')]) ## simulator.h (module 'core'): static void ns3::Simulator::Cancel(ns3::EventId const & id) [member function] cls.add_method('Cancel', 'void', [param('ns3::EventId const &', 'id')], is_static=True) ## simulator.h (module 'core'): static void ns3::Simulator::Destroy() [member function] cls.add_method('Destroy', 'void', [], is_static=True) ## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetContext() [member function] cls.add_method('GetContext', 'uint32_t', [], is_static=True) ## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetDelayLeft(ns3::EventId const & id) [member function] cls.add_method('GetDelayLeft', 'ns3::Time', [param('ns3::EventId const &', 'id')], is_static=True) ## simulator.h (module 'core'): static ns3::Ptr<ns3::SimulatorImpl> ns3::Simulator::GetImplementation() [member function] cls.add_method('GetImplementation', 'ns3::Ptr< ns3::SimulatorImpl >', [], is_static=True) ## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetMaximumSimulationTime() [member function] cls.add_method('GetMaximumSimulationTime', 'ns3::Time', [], is_static=True) ## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetSystemId() [member function] cls.add_method('GetSystemId', 'uint32_t', [], is_static=True) ## simulator.h (module 'core'): static bool ns3::Simulator::IsExpired(ns3::EventId const & id) [member function] cls.add_method('IsExpired', 'bool', [param('ns3::EventId const &', 'id')], is_static=True) ## simulator.h (module 'core'): static bool ns3::Simulator::IsFinished() [member function] cls.add_method('IsFinished', 'bool', [], is_static=True) ## simulator.h (module 'core'): static ns3::Time ns3::Simulator::Now() [member function] cls.add_method('Now', 'ns3::Time', [], is_static=True) ## simulator.h (module 'core'): static void ns3::Simulator::Remove(ns3::EventId const & id) [member function] cls.add_method('Remove', 'void', [param('ns3::EventId const &', 'id')], is_static=True) ## simulator.h (module 'core'): static void ns3::Simulator::SetImplementation(ns3::Ptr<ns3::SimulatorImpl> impl) [member function] cls.add_method('SetImplementation', 'void', [param('ns3::Ptr< ns3::SimulatorImpl >', 'impl')], is_static=True) ## simulator.h (module 'core'): static void ns3::Simulator::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function] cls.add_method('SetScheduler', 'void', [param('ns3::ObjectFactory', 'schedulerFactory')], is_static=True) ## simulator.h (module 'core'): static void ns3::Simulator::Stop() [member function] cls.add_method('Stop', 'void', [], is_static=True) ## simulator.h (module 'core'): static void ns3::Simulator::Stop(ns3::Time const & delay) [member function] cls.add_method('Stop', 'void', [param('ns3::Time const &', 'delay')], is_static=True) return def register_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) [copy constructor] cls.add_constructor([param('ns3::Tag const &', 'arg0')]) ## tag.h (module 'network'): void ns3::Tag::Deserialize(ns3::TagBuffer i) [member function] cls.add_method('Deserialize', 'void', [param('ns3::TagBuffer', 'i')], is_pure_virtual=True, is_virtual=True) ## tag.h (module 'network'): uint32_t ns3::Tag::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## tag.h (module 'network'): static ns3::TypeId ns3::Tag::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## tag.h (module 'network'): void ns3::Tag::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) ## tag.h (module 'network'): void ns3::Tag::Serialize(ns3::TagBuffer i) const [member function] cls.add_method('Serialize', 'void', [param('ns3::TagBuffer', 'i')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3TagBuffer_methods(root_module, cls): ## tag-buffer.h (module 'network'): ns3::TagBuffer::TagBuffer(ns3::TagBuffer const & arg0) [copy 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 data) [member function] cls.add_method('WriteU16', 'void', [param('uint16_t', 'data')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU32(uint32_t data) [member function] cls.add_method('WriteU32', 'void', [param('uint32_t', 'data')]) ## 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) [copy 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) [copy 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'): void ns3::TracedValue<unsigned int>::Connect(ns3::CallbackBase const & cb, std::basic_string<char,std::char_traits<char>,std::allocator<char> > 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::basic_string<char,std::char_traits<char>,std::allocator<char> > 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) [copy 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<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker, ns3::TypeId::SupportLevel supportLevel=::ns3::TypeId::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::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<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker, ns3::TypeId::SupportLevel supportLevel=::ns3::TypeId::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::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<ns3::TraceSourceAccessor const> 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<ns3::TraceSourceAccessor const> accessor, std::string callback, ns3::TypeId::SupportLevel supportLevel=::ns3::TypeId::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::SUPPORTED'), param('std::string const &', 'supportMsg', default_value='""')]) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation ns3::TypeId::GetAttribute(uint32_t i) const [member function] cls.add_method('GetAttribute', 'ns3::TypeId::AttributeInformation', [param('uint32_t', 'i')], is_const=True) ## type-id.h (module 'core'): std::string ns3::TypeId::GetAttributeFullName(uint32_t i) const [member function] cls.add_method('GetAttributeFullName', 'std::string', [param('uint32_t', 'i')], is_const=True) ## type-id.h (module 'core'): uint32_t ns3::TypeId::GetAttributeN() const [member function] cls.add_method('GetAttributeN', 'uint32_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'): uint32_t ns3::TypeId::GetHash() const [member function] cls.add_method('GetHash', 'uint32_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(uint32_t i) [member function] cls.add_method('GetRegistered', 'ns3::TypeId', [param('uint32_t', 'i')], is_static=True) ## type-id.h (module 'core'): static uint32_t ns3::TypeId::GetRegisteredN() [member function] cls.add_method('GetRegisteredN', 'uint32_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(uint32_t i) const [member function] cls.add_method('GetTraceSource', 'ns3::TypeId::TraceSourceInformation', [param('uint32_t', 'i')], is_const=True) ## type-id.h (module 'core'): uint32_t ns3::TypeId::GetTraceSourceN() const [member function] cls.add_method('GetTraceSourceN', 'uint32_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(uint32_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(uint32_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<ns3::TraceSourceAccessor const> 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<ns3::TraceSourceAccessor const> 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(uint32_t i, ns3::Ptr<ns3::AttributeValue const> initialValue) [member function] cls.add_method('SetAttributeInitialValue', 'bool', [param('uint32_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::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) [copy 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) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::flags [variable] 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) [copy 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) [copy constructor] cls.add_constructor([param('ns3::empty const &', 'arg0')]) return def register_Ns3Int64x64_t_methods(root_module, cls): cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right')) cls.add_unary_numeric_operator('-') cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right')) cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('>') cls.add_binary_comparison_operator('!=') cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', u'right')) cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', u'right')) cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', u'right')) cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', u'right')) cls.add_output_stream_operator() cls.add_binary_comparison_operator('<=') cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('>=') ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t() [constructor] cls.add_constructor([]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(double v) [constructor] cls.add_constructor([param('double', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long double v) [constructor] cls.add_constructor([param('long double', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(int v) [constructor] cls.add_constructor([param('int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long int v) [constructor] cls.add_constructor([param('long int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long long int v) [constructor] cls.add_constructor([param('long long int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(unsigned int v) [constructor] cls.add_constructor([param('unsigned int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long unsigned int v) [constructor] cls.add_constructor([param('long unsigned int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long long unsigned int v) [constructor] cls.add_constructor([param('long long unsigned int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(int64_t hi, uint64_t lo) [constructor] cls.add_constructor([param('int64_t', 'hi'), param('uint64_t', 'lo')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(ns3::int64x64_t const & o) [copy constructor] cls.add_constructor([param('ns3::int64x64_t const &', 'o')]) ## int64x64-double.h (module 'core'): double ns3::int64x64_t::GetDouble() const [member function] cls.add_method('GetDouble', 'double', [], is_const=True) ## int64x64-double.h (module 'core'): int64_t ns3::int64x64_t::GetHigh() const [member function] cls.add_method('GetHigh', 'int64_t', [], is_const=True) ## int64x64-double.h (module 'core'): uint64_t ns3::int64x64_t::GetLow() const [member function] cls.add_method('GetLow', 'uint64_t', [], is_const=True) ## int64x64-double.h (module 'core'): static ns3::int64x64_t ns3::int64x64_t::Invert(uint64_t v) [member function] cls.add_method('Invert', 'ns3::int64x64_t', [param('uint64_t', 'v')], is_static=True) ## int64x64-double.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-double.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) [copy constructor] cls.add_constructor([param('ns3::Chunk const &', 'arg0')]) ## chunk.h (module 'network'): uint32_t ns3::Chunk::Deserialize(ns3::Buffer::Iterator start) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_virtual=True) ## chunk.h (module 'network'): static ns3::TypeId ns3::Chunk::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## chunk.h (module 'network'): void ns3::Chunk::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3Header_methods(root_module, cls): cls.add_output_stream_operator() ## header.h (module 'network'): ns3::Header::Header() [constructor] cls.add_constructor([]) ## header.h (module 'network'): ns3::Header::Header(ns3::Header const & arg0) [copy constructor] cls.add_constructor([param('ns3::Header const &', 'arg0')]) ## header.h (module 'network'): uint32_t ns3::Header::Deserialize(ns3::Buffer::Iterator start) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_virtual=True) ## header.h (module 'network'): uint32_t ns3::Header::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## header.h (module 'network'): static ns3::TypeId ns3::Header::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## header.h (module 'network'): void ns3::Header::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) ## header.h (module 'network'): void ns3::Header::Serialize(ns3::Buffer::Iterator start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3Object_methods(root_module, cls): ## object.h (module 'core'): ns3::Object::Object() [constructor] cls.add_constructor([]) ## object.h (module 'core'): void ns3::Object::AggregateObject(ns3::Ptr<ns3::Object> other) [member function] cls.add_method('AggregateObject', 'void', [param('ns3::Ptr< ns3::Object >', 'other')]) ## object.h (module 'core'): void ns3::Object::Dispose() [member function] cls.add_method('Dispose', 'void', []) ## object.h (module 'core'): ns3::Object::AggregateIterator ns3::Object::GetAggregateIterator() const [member function] cls.add_method('GetAggregateIterator', 'ns3::Object::AggregateIterator', [], is_const=True) ## object.h (module 'core'): ns3::TypeId ns3::Object::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_const=True, is_virtual=True) ## object.h (module 'core'): static ns3::TypeId ns3::Object::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## object.h (module 'core'): void ns3::Object::Initialize() [member function] cls.add_method('Initialize', 'void', []) ## object.h (module 'core'): bool ns3::Object::IsInitialized() const [member function] cls.add_method('IsInitialized', 'bool', [], is_const=True) ## object.h (module 'core'): ns3::Object::Object(ns3::Object const & o) [copy constructor] cls.add_constructor([param('ns3::Object const &', 'o')], visibility='protected') ## object.h (module 'core'): void ns3::Object::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='protected', is_virtual=True) ## object.h (module 'core'): void ns3::Object::DoInitialize() [member function] cls.add_method('DoInitialize', 'void', [], visibility='protected', is_virtual=True) ## object.h (module 'core'): void ns3::Object::NotifyNewAggregate() [member function] cls.add_method('NotifyNewAggregate', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3ObjectAggregateIterator_methods(root_module, cls): ## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator(ns3::Object::AggregateIterator const & arg0) [copy 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<ns3::Object const> 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_Openmode mode) [member function] cls.add_method('Open', 'void', [param('std::string const &', 'filename'), param('std::_Ios_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_Ns3PppHeader_methods(root_module, cls): ## ppp-header.h (module 'point-to-point'): ns3::PppHeader::PppHeader(ns3::PppHeader const & arg0) [copy constructor] cls.add_constructor([param('ns3::PppHeader const &', 'arg0')]) ## ppp-header.h (module 'point-to-point'): ns3::PppHeader::PppHeader() [constructor] cls.add_constructor([]) ## ppp-header.h (module 'point-to-point'): uint32_t ns3::PppHeader::Deserialize(ns3::Buffer::Iterator start) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'start')], is_virtual=True) ## ppp-header.h (module 'point-to-point'): ns3::TypeId ns3::PppHeader::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_const=True, is_virtual=True) ## ppp-header.h (module 'point-to-point'): uint16_t ns3::PppHeader::GetProtocol() [member function] cls.add_method('GetProtocol', 'uint16_t', []) ## ppp-header.h (module 'point-to-point'): uint32_t ns3::PppHeader::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True, is_virtual=True) ## ppp-header.h (module 'point-to-point'): static ns3::TypeId ns3::PppHeader::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## ppp-header.h (module 'point-to-point'): void ns3::PppHeader::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True, is_virtual=True) ## ppp-header.h (module 'point-to-point'): void ns3::PppHeader::Serialize(ns3::Buffer::Iterator start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator', 'start')], is_const=True, is_virtual=True) ## ppp-header.h (module 'point-to-point'): void ns3::PppHeader::SetProtocol(uint16_t protocol) [member function] cls.add_method('SetProtocol', 'void', [param('uint16_t', 'protocol')]) return def register_Ns3Queue_methods(root_module, cls): ## queue.h (module 'network'): ns3::Queue::Queue(ns3::Queue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Queue const &', 'arg0')]) ## queue.h (module 'network'): ns3::Queue::Queue() [constructor] cls.add_constructor([]) ## queue.h (module 'network'): ns3::Ptr<ns3::QueueItem> ns3::Queue::Dequeue() [member function] cls.add_method('Dequeue', 'ns3::Ptr< ns3::QueueItem >', []) ## queue.h (module 'network'): void ns3::Queue::DequeueAll() [member function] cls.add_method('DequeueAll', 'void', []) ## queue.h (module 'network'): bool ns3::Queue::Enqueue(ns3::Ptr<ns3::QueueItem> item) [member function] cls.add_method('Enqueue', 'bool', [param('ns3::Ptr< ns3::QueueItem >', 'item')]) ## queue.h (module 'network'): uint32_t ns3::Queue::GetMaxBytes() const [member function] cls.add_method('GetMaxBytes', 'uint32_t', [], is_const=True) ## queue.h (module 'network'): uint32_t ns3::Queue::GetMaxPackets() const [member function] cls.add_method('GetMaxPackets', 'uint32_t', [], is_const=True) ## queue.h (module 'network'): ns3::Queue::QueueMode ns3::Queue::GetMode() const [member function] cls.add_method('GetMode', 'ns3::Queue::QueueMode', [], is_const=True) ## queue.h (module 'network'): uint32_t ns3::Queue::GetNBytes() const [member function] cls.add_method('GetNBytes', 'uint32_t', [], is_const=True) ## queue.h (module 'network'): uint32_t ns3::Queue::GetNPackets() const [member function] cls.add_method('GetNPackets', 'uint32_t', [], is_const=True) ## queue.h (module 'network'): uint32_t ns3::Queue::GetTotalDroppedBytes() const [member function] cls.add_method('GetTotalDroppedBytes', 'uint32_t', [], is_const=True) ## queue.h (module 'network'): uint32_t ns3::Queue::GetTotalDroppedPackets() const [member function] cls.add_method('GetTotalDroppedPackets', 'uint32_t', [], is_const=True) ## queue.h (module 'network'): uint32_t ns3::Queue::GetTotalReceivedBytes() const [member function] cls.add_method('GetTotalReceivedBytes', 'uint32_t', [], is_const=True) ## queue.h (module 'network'): uint32_t ns3::Queue::GetTotalReceivedPackets() const [member function] cls.add_method('GetTotalReceivedPackets', 'uint32_t', [], is_const=True) ## queue.h (module 'network'): static ns3::TypeId ns3::Queue::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## queue.h (module 'network'): bool ns3::Queue::IsEmpty() const [member function] cls.add_method('IsEmpty', 'bool', [], is_const=True) ## queue.h (module 'network'): ns3::Ptr<const ns3::QueueItem> ns3::Queue::Peek() const [member function] cls.add_method('Peek', 'ns3::Ptr< ns3::QueueItem const >', [], is_const=True) ## queue.h (module 'network'): ns3::Ptr<ns3::QueueItem> ns3::Queue::Remove() [member function] cls.add_method('Remove', 'ns3::Ptr< ns3::QueueItem >', []) ## queue.h (module 'network'): void ns3::Queue::ResetStatistics() [member function] cls.add_method('ResetStatistics', 'void', []) ## queue.h (module 'network'): void ns3::Queue::SetDropCallback(ns3::Callback<void, ns3::Ptr<ns3::QueueItem>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> cb) [member function] cls.add_method('SetDropCallback', 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::QueueItem >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')], is_virtual=True) ## queue.h (module 'network'): void ns3::Queue::SetMaxBytes(uint32_t maxBytes) [member function] cls.add_method('SetMaxBytes', 'void', [param('uint32_t', 'maxBytes')]) ## queue.h (module 'network'): void ns3::Queue::SetMaxPackets(uint32_t maxPackets) [member function] cls.add_method('SetMaxPackets', 'void', [param('uint32_t', 'maxPackets')]) ## queue.h (module 'network'): void ns3::Queue::SetMode(ns3::Queue::QueueMode mode) [member function] cls.add_method('SetMode', 'void', [param('ns3::Queue::QueueMode', 'mode')]) ## queue.h (module 'network'): void ns3::Queue::Drop(ns3::Ptr<ns3::QueueItem> item) [member function] cls.add_method('Drop', 'void', [param('ns3::Ptr< ns3::QueueItem >', 'item')], visibility='protected') ## queue.h (module 'network'): ns3::Ptr<ns3::QueueItem> ns3::Queue::DoDequeue() [member function] cls.add_method('DoDequeue', 'ns3::Ptr< ns3::QueueItem >', [], is_pure_virtual=True, visibility='private', is_virtual=True) ## queue.h (module 'network'): bool ns3::Queue::DoEnqueue(ns3::Ptr<ns3::QueueItem> item) [member function] cls.add_method('DoEnqueue', 'bool', [param('ns3::Ptr< ns3::QueueItem >', 'item')], is_pure_virtual=True, visibility='private', is_virtual=True) ## queue.h (module 'network'): ns3::Ptr<const ns3::QueueItem> ns3::Queue::DoPeek() const [member function] cls.add_method('DoPeek', 'ns3::Ptr< ns3::QueueItem const >', [], is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True) ## queue.h (module 'network'): ns3::Ptr<ns3::QueueItem> ns3::Queue::DoRemove() [member function] cls.add_method('DoRemove', 'ns3::Ptr< ns3::QueueItem >', [], is_pure_virtual=True, visibility='private', is_virtual=True) return def register_Ns3RandomVariableStream_methods(root_module, cls): ## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::RandomVariableStream::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## random-variable-stream.h (module 'core'): ns3::RandomVariableStream::RandomVariableStream() [constructor] cls.add_constructor([]) ## random-variable-stream.h (module 'core'): void ns3::RandomVariableStream::SetStream(int64_t stream) [member function] cls.add_method('SetStream', 'void', [param('int64_t', 'stream')]) ## random-variable-stream.h (module 'core'): int64_t ns3::RandomVariableStream::GetStream() const [member function] cls.add_method('GetStream', 'int64_t', [], is_const=True) ## random-variable-stream.h (module 'core'): void ns3::RandomVariableStream::SetAntithetic(bool isAntithetic) [member function] cls.add_method('SetAntithetic', 'void', [param('bool', 'isAntithetic')]) ## random-variable-stream.h (module 'core'): bool ns3::RandomVariableStream::IsAntithetic() const [member function] cls.add_method('IsAntithetic', 'bool', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::RandomVariableStream::GetValue() [member function] cls.add_method('GetValue', 'double', [], is_pure_virtual=True, is_virtual=True) ## random-variable-stream.h (module 'core'): uint32_t ns3::RandomVariableStream::GetInteger() [member function] cls.add_method('GetInteger', 'uint32_t', [], is_pure_virtual=True, is_virtual=True) ## random-variable-stream.h (module 'core'): ns3::RngStream * ns3::RandomVariableStream::Peek() const [member function] cls.add_method('Peek', 'ns3::RngStream *', [], is_const=True, visibility='protected') return def register_Ns3SequentialRandomVariable_methods(root_module, cls): ## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::SequentialRandomVariable::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## random-variable-stream.h (module 'core'): ns3::SequentialRandomVariable::SequentialRandomVariable() [constructor] cls.add_constructor([]) ## random-variable-stream.h (module 'core'): double ns3::SequentialRandomVariable::GetMin() const [member function] cls.add_method('GetMin', 'double', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::SequentialRandomVariable::GetMax() const [member function] cls.add_method('GetMax', 'double', [], is_const=True) ## random-variable-stream.h (module 'core'): ns3::Ptr<ns3::RandomVariableStream> ns3::SequentialRandomVariable::GetIncrement() const [member function] cls.add_method('GetIncrement', 'ns3::Ptr< ns3::RandomVariableStream >', [], is_const=True) ## random-variable-stream.h (module 'core'): uint32_t ns3::SequentialRandomVariable::GetConsecutive() const [member function] cls.add_method('GetConsecutive', 'uint32_t', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::SequentialRandomVariable::GetValue() [member function] cls.add_method('GetValue', 'double', [], is_virtual=True) ## random-variable-stream.h (module 'core'): uint32_t ns3::SequentialRandomVariable::GetInteger() [member function] cls.add_method('GetInteger', 'uint32_t', [], is_virtual=True) return def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter< ns3::AttributeAccessor > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) 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) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter< ns3::AttributeChecker > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) 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) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter< ns3::AttributeValue > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) 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) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter< ns3::CallbackImplBase > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) 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) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter< ns3::EventImpl > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) 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) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter< ns3::Hash::Implementation > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3NetDeviceQueue_Ns3Empty_Ns3DefaultDeleter__lt__ns3NetDeviceQueue__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> >::SimpleRefCount(ns3::SimpleRefCount<ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter< ns3::NetDeviceQueue > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) 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) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter< ns3::NixVector > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) 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) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter< ns3::OutputStreamWrapper > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) 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) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter< ns3::Packet > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) 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) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::QueueItem, ns3::empty, ns3::DefaultDeleter< ns3::QueueItem > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) 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) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter< ns3::TraceSourceAccessor > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3Time_methods(root_module, cls): cls.add_binary_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::Time'], param('int64_t const &', u'right')) cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', u'right')) cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', u'right')) cls.add_binary_numeric_operator('/', root_module['ns3::Time'], root_module['ns3::Time'], param('int64_t const &', u'right')) cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('>') cls.add_binary_comparison_operator('!=') cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', u'right')) cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', u'right')) cls.add_output_stream_operator() cls.add_binary_comparison_operator('<=') cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('>=') ## nstime.h (module 'core'): ns3::Time::Time() [constructor] cls.add_constructor([]) ## nstime.h (module 'core'): ns3::Time::Time(ns3::Time const & o) [copy 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) [copy constructor] cls.add_constructor([param('ns3::TraceSourceAccessor const &', 'arg0')]) ## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor() [constructor] cls.add_constructor([]) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Connect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function] cls.add_method('Connect', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::ConnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function] cls.add_method('ConnectWithoutContext', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Disconnect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function] cls.add_method('Disconnect', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::DisconnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function] cls.add_method('DisconnectWithoutContext', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3Trailer_methods(root_module, cls): cls.add_output_stream_operator() ## trailer.h (module 'network'): ns3::Trailer::Trailer() [constructor] cls.add_constructor([]) ## trailer.h (module 'network'): ns3::Trailer::Trailer(ns3::Trailer const & arg0) [copy constructor] cls.add_constructor([param('ns3::Trailer const &', 'arg0')]) ## trailer.h (module 'network'): uint32_t ns3::Trailer::Deserialize(ns3::Buffer::Iterator end) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'end')], is_pure_virtual=True, is_virtual=True) ## trailer.h (module 'network'): uint32_t ns3::Trailer::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## trailer.h (module 'network'): static ns3::TypeId ns3::Trailer::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## trailer.h (module 'network'): void ns3::Trailer::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trailer.h (module 'network'): void ns3::Trailer::Serialize(ns3::Buffer::Iterator start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3TriangularRandomVariable_methods(root_module, cls): ## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::TriangularRandomVariable::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## random-variable-stream.h (module 'core'): ns3::TriangularRandomVariable::TriangularRandomVariable() [constructor] cls.add_constructor([]) ## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetMean() const [member function] cls.add_method('GetMean', 'double', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetMin() const [member function] cls.add_method('GetMin', 'double', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetMax() const [member function] cls.add_method('GetMax', 'double', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetValue(double mean, double min, double max) [member function] cls.add_method('GetValue', 'double', [param('double', 'mean'), param('double', 'min'), param('double', 'max')]) ## random-variable-stream.h (module 'core'): uint32_t ns3::TriangularRandomVariable::GetInteger(uint32_t mean, uint32_t min, uint32_t max) [member function] cls.add_method('GetInteger', 'uint32_t', [param('uint32_t', 'mean'), param('uint32_t', 'min'), param('uint32_t', 'max')]) ## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetValue() [member function] cls.add_method('GetValue', 'double', [], is_virtual=True) ## random-variable-stream.h (module 'core'): uint32_t ns3::TriangularRandomVariable::GetInteger() [member function] cls.add_method('GetInteger', 'uint32_t', [], is_virtual=True) return def register_Ns3UniformRandomVariable_methods(root_module, cls): ## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::UniformRandomVariable::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## random-variable-stream.h (module 'core'): ns3::UniformRandomVariable::UniformRandomVariable() [constructor] cls.add_constructor([]) ## random-variable-stream.h (module 'core'): double ns3::UniformRandomVariable::GetMin() const [member function] cls.add_method('GetMin', 'double', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::UniformRandomVariable::GetMax() const [member function] cls.add_method('GetMax', 'double', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::UniformRandomVariable::GetValue(double min, double max) [member function] cls.add_method('GetValue', 'double', [param('double', 'min'), param('double', 'max')]) ## random-variable-stream.h (module 'core'): uint32_t ns3::UniformRandomVariable::GetInteger(uint32_t min, uint32_t max) [member function] cls.add_method('GetInteger', 'uint32_t', [param('uint32_t', 'min'), param('uint32_t', 'max')]) ## random-variable-stream.h (module 'core'): double ns3::UniformRandomVariable::GetValue() [member function] cls.add_method('GetValue', 'double', [], is_virtual=True) ## random-variable-stream.h (module 'core'): uint32_t ns3::UniformRandomVariable::GetInteger() [member function] cls.add_method('GetInteger', 'uint32_t', [], is_virtual=True) return def register_Ns3WeibullRandomVariable_methods(root_module, cls): ## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::WeibullRandomVariable::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## random-variable-stream.h (module 'core'): ns3::WeibullRandomVariable::WeibullRandomVariable() [constructor] cls.add_constructor([]) ## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetScale() const [member function] cls.add_method('GetScale', 'double', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetShape() const [member function] cls.add_method('GetShape', 'double', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetBound() const [member function] cls.add_method('GetBound', 'double', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetValue(double scale, double shape, double bound) [member function] cls.add_method('GetValue', 'double', [param('double', 'scale'), param('double', 'shape'), param('double', 'bound')]) ## random-variable-stream.h (module 'core'): uint32_t ns3::WeibullRandomVariable::GetInteger(uint32_t scale, uint32_t shape, uint32_t bound) [member function] cls.add_method('GetInteger', 'uint32_t', [param('uint32_t', 'scale'), param('uint32_t', 'shape'), param('uint32_t', 'bound')]) ## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetValue() [member function] cls.add_method('GetValue', 'double', [], is_virtual=True) ## random-variable-stream.h (module 'core'): uint32_t ns3::WeibullRandomVariable::GetInteger() [member function] cls.add_method('GetInteger', 'uint32_t', [], is_virtual=True) return def register_Ns3ZetaRandomVariable_methods(root_module, cls): ## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ZetaRandomVariable::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## random-variable-stream.h (module 'core'): ns3::ZetaRandomVariable::ZetaRandomVariable() [constructor] cls.add_constructor([]) ## random-variable-stream.h (module 'core'): double ns3::ZetaRandomVariable::GetAlpha() const [member function] cls.add_method('GetAlpha', 'double', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::ZetaRandomVariable::GetValue(double alpha) [member function] cls.add_method('GetValue', 'double', [param('double', 'alpha')]) ## random-variable-stream.h (module 'core'): uint32_t ns3::ZetaRandomVariable::GetInteger(uint32_t alpha) [member function] cls.add_method('GetInteger', 'uint32_t', [param('uint32_t', 'alpha')]) ## random-variable-stream.h (module 'core'): double ns3::ZetaRandomVariable::GetValue() [member function] cls.add_method('GetValue', 'double', [], is_virtual=True) ## random-variable-stream.h (module 'core'): uint32_t ns3::ZetaRandomVariable::GetInteger() [member function] cls.add_method('GetInteger', 'uint32_t', [], is_virtual=True) return def register_Ns3ZipfRandomVariable_methods(root_module, cls): ## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ZipfRandomVariable::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## random-variable-stream.h (module 'core'): ns3::ZipfRandomVariable::ZipfRandomVariable() [constructor] cls.add_constructor([]) ## random-variable-stream.h (module 'core'): uint32_t ns3::ZipfRandomVariable::GetN() const [member function] cls.add_method('GetN', 'uint32_t', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::ZipfRandomVariable::GetAlpha() const [member function] cls.add_method('GetAlpha', 'double', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::ZipfRandomVariable::GetValue(uint32_t n, double alpha) [member function] cls.add_method('GetValue', 'double', [param('uint32_t', 'n'), param('double', 'alpha')]) ## random-variable-stream.h (module 'core'): uint32_t ns3::ZipfRandomVariable::GetInteger(uint32_t n, uint32_t alpha) [member function] cls.add_method('GetInteger', 'uint32_t', [param('uint32_t', 'n'), param('uint32_t', 'alpha')]) ## random-variable-stream.h (module 'core'): double ns3::ZipfRandomVariable::GetValue() [member function] cls.add_method('GetValue', 'double', [], is_virtual=True) ## random-variable-stream.h (module 'core'): uint32_t ns3::ZipfRandomVariable::GetInteger() [member function] cls.add_method('GetInteger', 'uint32_t', [], is_virtual=True) return def register_Ns3AttributeAccessor_methods(root_module, cls): ## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor(ns3::AttributeAccessor const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeAccessor const &', 'arg0')]) ## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::Get(ns3::ObjectBase const * object, ns3::AttributeValue & attribute) const [member function] cls.add_method('Get', 'bool', [param('ns3::ObjectBase const *', 'object'), param('ns3::AttributeValue &', 'attribute')], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasGetter() const [member function] cls.add_method('HasGetter', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasSetter() const [member function] cls.add_method('HasSetter', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::Set(ns3::ObjectBase * object, ns3::AttributeValue const & value) const [member function] cls.add_method('Set', 'bool', [param('ns3::ObjectBase *', 'object', transfer_ownership=False), param('ns3::AttributeValue const &', 'value')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3AttributeChecker_methods(root_module, cls): ## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker(ns3::AttributeChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeChecker const &', 'arg0')]) ## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): bool ns3::AttributeChecker::Check(ns3::AttributeValue const & value) const [member function] cls.add_method('Check', 'bool', [param('ns3::AttributeValue const &', 'value')], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeChecker::Copy(ns3::AttributeValue const & source, ns3::AttributeValue & destination) const [member function] cls.add_method('Copy', 'bool', [param('ns3::AttributeValue const &', 'source'), param('ns3::AttributeValue &', 'destination')], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::Create() const [member function] cls.add_method('Create', 'ns3::Ptr< ns3::AttributeValue >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::CreateValidValue(ns3::AttributeValue const & value) const [member function] cls.add_method('CreateValidValue', 'ns3::Ptr< ns3::AttributeValue >', [param('ns3::AttributeValue const &', 'value')], is_const=True) ## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetUnderlyingTypeInformation() const [member function] cls.add_method('GetUnderlyingTypeInformation', 'std::string', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetValueTypeName() const [member function] cls.add_method('GetValueTypeName', 'std::string', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeChecker::HasUnderlyingTypeInformation() const [member function] cls.add_method('HasUnderlyingTypeInformation', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3AttributeValue_methods(root_module, cls): ## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue(ns3::AttributeValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeValue const &', 'arg0')]) ## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_pure_virtual=True, is_virtual=True) ## attribute.h (module 'core'): std::string ns3::AttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3BooleanChecker_methods(root_module, cls): ## boolean.h (module 'core'): ns3::BooleanChecker::BooleanChecker() [constructor] cls.add_constructor([]) ## boolean.h (module 'core'): ns3::BooleanChecker::BooleanChecker(ns3::BooleanChecker const & arg0) [copy 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) [copy 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<ns3::AttributeChecker const> 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<ns3::AttributeChecker const> 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) [copy 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) [copy constructor] cls.add_constructor([param('ns3::CallbackImplBase const &', 'arg0')]) ## callback.h (module 'core'): std::string ns3::CallbackImplBase::GetTypeid() const [member function] cls.add_method('GetTypeid', 'std::string', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## callback.h (module 'core'): bool ns3::CallbackImplBase::IsEqual(ns3::Ptr<ns3::CallbackImplBase const> other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ptr< ns3::CallbackImplBase const >', 'other')], is_pure_virtual=True, is_const=True, is_virtual=True) ## callback.h (module 'core'): static std::string ns3::CallbackImplBase::Demangle(std::string const & mangled) [member function] cls.add_method('Demangle', 'std::string', [param('std::string const &', 'mangled')], is_static=True, visibility='protected') return def register_Ns3CallbackValue_methods(root_module, cls): ## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackValue const & arg0) [copy 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<ns3::AttributeChecker const> 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<ns3::AttributeChecker const> 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) [copy 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(uint32_t i) const [member function] cls.add_method('GetDevice', 'ns3::Ptr< ns3::NetDevice >', [param('uint32_t', 'i')], is_pure_virtual=True, is_const=True, is_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'): uint32_t ns3::Channel::GetNDevices() const [member function] cls.add_method('GetNDevices', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_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_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) [copy 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::DataRateValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::DataRateValue const &', 'arg0')]) ## 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::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<ns3::AttributeChecker const> 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<ns3::AttributeChecker const> 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, uint64_t length) [member function] cls.add_method('SetValueArray', 'void', [param('double *', 'values'), param('uint64_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(ns3::DoubleValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::DoubleValue const &', 'arg0')]) ## double.h (module 'core'): ns3::DoubleValue::DoubleValue(double const & value) [constructor] cls.add_constructor([param('double const &', 'value')]) ## 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<ns3::AttributeChecker const> 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<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## double.h (module 'core'): void ns3::DoubleValue::Set(double const & value) [member function] cls.add_method('Set', 'void', [param('double const &', 'value')]) return def register_Ns3EmpiricalRandomVariable_methods(root_module, cls): ## random-variable-stream.h (module 'core'): ns3::EmpiricalRandomVariable::EmpiricalRandomVariable() [constructor] cls.add_constructor([]) ## random-variable-stream.h (module 'core'): void ns3::EmpiricalRandomVariable::CDF(double v, double c) [member function] cls.add_method('CDF', 'void', [param('double', 'v'), param('double', 'c')]) ## random-variable-stream.h (module 'core'): uint32_t ns3::EmpiricalRandomVariable::GetInteger() [member function] cls.add_method('GetInteger', 'uint32_t', [], is_virtual=True) ## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::EmpiricalRandomVariable::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## random-variable-stream.h (module 'core'): double ns3::EmpiricalRandomVariable::GetValue() [member function] cls.add_method('GetValue', 'double', [], is_virtual=True) ## random-variable-stream.h (module 'core'): double ns3::EmpiricalRandomVariable::Interpolate(double c1, double c2, double v1, double v2, double r) [member function] cls.add_method('Interpolate', 'double', [param('double', 'c1'), param('double', 'c2'), param('double', 'v1'), param('double', 'v2'), param('double', 'r')], visibility='private', is_virtual=True) ## random-variable-stream.h (module 'core'): void ns3::EmpiricalRandomVariable::Validate() [member function] cls.add_method('Validate', 'void', [], visibility='private', is_virtual=True) return def register_Ns3EmptyAttributeAccessor_methods(root_module, cls): ## attribute.h (module 'core'): ns3::EmptyAttributeAccessor::EmptyAttributeAccessor(ns3::EmptyAttributeAccessor const & arg0) [copy 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) [copy 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) [copy constructor] cls.add_constructor([param('ns3::EmptyAttributeValue const &', 'arg0')]) ## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EmptyAttributeValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, visibility='private', is_virtual=True) ## attribute.h (module 'core'): bool ns3::EmptyAttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], visibility='private', is_virtual=True) ## attribute.h (module 'core'): std::string ns3::EmptyAttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, visibility='private', is_virtual=True) return def register_Ns3EnumChecker_methods(root_module, cls): ## enum.h (module 'core'): ns3::EnumChecker::EnumChecker(ns3::EnumChecker const & arg0) [copy 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) [copy 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<ns3::AttributeChecker const> 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<ns3::AttributeChecker const> 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) [copy 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_pure_virtual=True, visibility='private', is_virtual=True) ## error-model.h (module 'network'): void ns3::ErrorModel::DoReset() [member function] cls.add_method('DoReset', 'void', [], is_pure_virtual=True, visibility='private', is_virtual=True) return def register_Ns3EventImpl_methods(root_module, cls): ## event-impl.h (module 'core'): ns3::EventImpl::EventImpl(ns3::EventImpl const & arg0) [copy constructor] cls.add_constructor([param('ns3::EventImpl const &', 'arg0')]) ## event-impl.h (module 'core'): ns3::EventImpl::EventImpl() [constructor] cls.add_constructor([]) ## event-impl.h (module 'core'): void ns3::EventImpl::Cancel() [member function] cls.add_method('Cancel', 'void', []) ## event-impl.h (module 'core'): void ns3::EventImpl::Invoke() [member function] cls.add_method('Invoke', 'void', []) ## event-impl.h (module 'core'): bool ns3::EventImpl::IsCancelled() [member function] cls.add_method('IsCancelled', 'bool', []) ## event-impl.h (module 'core'): void ns3::EventImpl::Notify() [member function] cls.add_method('Notify', 'void', [], is_pure_virtual=True, visibility='protected', is_virtual=True) return def register_Ns3ExponentialRandomVariable_methods(root_module, cls): ## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ExponentialRandomVariable::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## random-variable-stream.h (module 'core'): ns3::ExponentialRandomVariable::ExponentialRandomVariable() [constructor] cls.add_constructor([]) ## random-variable-stream.h (module 'core'): double ns3::ExponentialRandomVariable::GetMean() const [member function] cls.add_method('GetMean', 'double', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::ExponentialRandomVariable::GetBound() const [member function] cls.add_method('GetBound', 'double', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::ExponentialRandomVariable::GetValue(double mean, double bound) [member function] cls.add_method('GetValue', 'double', [param('double', 'mean'), param('double', 'bound')]) ## random-variable-stream.h (module 'core'): uint32_t ns3::ExponentialRandomVariable::GetInteger(uint32_t mean, uint32_t bound) [member function] cls.add_method('GetInteger', 'uint32_t', [param('uint32_t', 'mean'), param('uint32_t', 'bound')]) ## random-variable-stream.h (module 'core'): double ns3::ExponentialRandomVariable::GetValue() [member function] cls.add_method('GetValue', 'double', [], is_virtual=True) ## random-variable-stream.h (module 'core'): uint32_t ns3::ExponentialRandomVariable::GetInteger() [member function] cls.add_method('GetInteger', 'uint32_t', [], is_virtual=True) return def register_Ns3GammaRandomVariable_methods(root_module, cls): ## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::GammaRandomVariable::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## random-variable-stream.h (module 'core'): ns3::GammaRandomVariable::GammaRandomVariable() [constructor] cls.add_constructor([]) ## random-variable-stream.h (module 'core'): double ns3::GammaRandomVariable::GetAlpha() const [member function] cls.add_method('GetAlpha', 'double', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::GammaRandomVariable::GetBeta() const [member function] cls.add_method('GetBeta', 'double', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::GammaRandomVariable::GetValue(double alpha, double beta) [member function] cls.add_method('GetValue', 'double', [param('double', 'alpha'), param('double', 'beta')]) ## random-variable-stream.h (module 'core'): uint32_t ns3::GammaRandomVariable::GetInteger(uint32_t alpha, uint32_t beta) [member function] cls.add_method('GetInteger', 'uint32_t', [param('uint32_t', 'alpha'), param('uint32_t', 'beta')]) ## random-variable-stream.h (module 'core'): double ns3::GammaRandomVariable::GetValue() [member function] cls.add_method('GetValue', 'double', [], is_virtual=True) ## random-variable-stream.h (module 'core'): uint32_t ns3::GammaRandomVariable::GetInteger() [member function] cls.add_method('GetInteger', 'uint32_t', [], is_virtual=True) return def register_Ns3IntegerValue_methods(root_module, cls): ## integer.h (module 'core'): ns3::IntegerValue::IntegerValue() [constructor] cls.add_constructor([]) ## integer.h (module 'core'): ns3::IntegerValue::IntegerValue(ns3::IntegerValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::IntegerValue const &', 'arg0')]) ## 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::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<ns3::AttributeChecker const> 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<ns3::AttributeChecker const> 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) [copy 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::Ipv4AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4AddressValue const &', 'arg0')]) ## 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::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<ns3::AttributeChecker const> 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<ns3::AttributeChecker const> 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) [copy 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::Ipv4MaskValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4MaskValue const &', 'arg0')]) ## 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::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<ns3::AttributeChecker const> 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<ns3::AttributeChecker const> 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) [copy 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::Ipv6AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv6AddressValue const &', 'arg0')]) ## 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::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<ns3::AttributeChecker const> 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<ns3::AttributeChecker const> 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) [copy 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::Ipv6PrefixValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv6PrefixValue const &', 'arg0')]) ## 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::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<ns3::AttributeChecker const> 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<ns3::AttributeChecker const> 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) [copy 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')], visibility='private', is_virtual=True) ## error-model.h (module 'network'): void ns3::ListErrorModel::DoReset() [member function] cls.add_method('DoReset', 'void', [], visibility='private', is_virtual=True) 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) [copy 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::Mac48AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Mac48AddressValue const &', 'arg0')]) ## 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::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<ns3::AttributeChecker const> 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<ns3::AttributeChecker const> 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) [copy constructor] cls.add_constructor([param('ns3::NetDevice const &', 'arg0')]) ## net-device.h (module 'network'): void ns3::NetDevice::AddLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function] cls.add_method('AddLinkChangeCallback', 'void', [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetAddress() const [member function] cls.add_method('GetAddress', 'ns3::Address', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetBroadcast() const [member function] cls.add_method('GetBroadcast', 'ns3::Address', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Ptr<ns3::Channel> ns3::NetDevice::GetChannel() const [member function] cls.add_method('GetChannel', 'ns3::Ptr< ns3::Channel >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): uint32_t ns3::NetDevice::GetIfIndex() const [member function] cls.add_method('GetIfIndex', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): uint16_t ns3::NetDevice::GetMtu() const [member function] cls.add_method('GetMtu', 'uint16_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv4Address multicastGroup) const [member function] cls.add_method('GetMulticast', 'ns3::Address', [param('ns3::Ipv4Address', 'multicastGroup')], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv6Address addr) const [member function] cls.add_method('GetMulticast', 'ns3::Address', [param('ns3::Ipv6Address', 'addr')], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Ptr<ns3::Node> ns3::NetDevice::GetNode() const [member function] cls.add_method('GetNode', 'ns3::Ptr< ns3::Node >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): static ns3::TypeId ns3::NetDevice::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsBridge() const [member function] cls.add_method('IsBridge', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsLinkUp() const [member function] cls.add_method('IsLinkUp', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsPointToPoint() const [member function] cls.add_method('IsPointToPoint', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::NeedsArp() const [member function] cls.add_method('NeedsArp', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::Send(ns3::Ptr<ns3::Packet> packet, ns3::Address const & dest, uint16_t protocolNumber) [member function] cls.add_method('Send', 'bool', [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::SendFrom(ns3::Ptr<ns3::Packet> packet, ns3::Address const & source, ns3::Address const & dest, uint16_t protocolNumber) [member function] cls.add_method('SendFrom', 'bool', [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'source'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetAddress(ns3::Address address) [member function] cls.add_method('SetAddress', 'void', [param('ns3::Address', 'address')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetIfIndex(uint32_t const index) [member function] cls.add_method('SetIfIndex', 'void', [param('uint32_t const', 'index')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::SetMtu(uint16_t const mtu) [member function] cls.add_method('SetMtu', 'bool', [param('uint16_t const', 'mtu')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetNode(ns3::Ptr<ns3::Node> node) [member function] cls.add_method('SetNode', 'void', [param('ns3::Ptr< ns3::Node >', 'node')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetPromiscReceiveCallback(ns3::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) [member function] cls.add_method('SetPromiscReceiveCallback', 'void', [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'cb')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetReceiveCallback(ns3::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) [member function] cls.add_method('SetReceiveCallback', 'void', [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::SupportsSendFrom() const [member function] cls.add_method('SupportsSendFrom', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3NetDeviceQueue_methods(root_module, cls): ## net-device.h (module 'network'): ns3::NetDeviceQueue::NetDeviceQueue(ns3::NetDeviceQueue const & arg0) [copy constructor] cls.add_constructor([param('ns3::NetDeviceQueue const &', 'arg0')]) ## net-device.h (module 'network'): ns3::NetDeviceQueue::NetDeviceQueue() [constructor] cls.add_constructor([]) ## net-device.h (module 'network'): ns3::Ptr<ns3::QueueLimits> ns3::NetDeviceQueue::GetQueueLimits() [member function] cls.add_method('GetQueueLimits', 'ns3::Ptr< ns3::QueueLimits >', []) ## net-device.h (module 'network'): bool ns3::NetDeviceQueue::IsStopped() const [member function] cls.add_method('IsStopped', 'bool', [], is_const=True) ## net-device.h (module 'network'): void ns3::NetDeviceQueue::NotifyQueuedBytes(uint32_t bytes) [member function] cls.add_method('NotifyQueuedBytes', 'void', [param('uint32_t', 'bytes')]) ## net-device.h (module 'network'): void ns3::NetDeviceQueue::NotifyTransmittedBytes(uint32_t bytes) [member function] cls.add_method('NotifyTransmittedBytes', 'void', [param('uint32_t', 'bytes')]) ## net-device.h (module 'network'): void ns3::NetDeviceQueue::ResetQueueLimits() [member function] cls.add_method('ResetQueueLimits', 'void', []) ## net-device.h (module 'network'): void ns3::NetDeviceQueue::SetQueueLimits(ns3::Ptr<ns3::QueueLimits> ql) [member function] cls.add_method('SetQueueLimits', 'void', [param('ns3::Ptr< ns3::QueueLimits >', 'ql')]) ## net-device.h (module 'network'): void ns3::NetDeviceQueue::SetWakeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> cb) [member function] cls.add_method('SetWakeCallback', 'void', [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')], is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDeviceQueue::Start() [member function] cls.add_method('Start', 'void', [], is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDeviceQueue::Stop() [member function] cls.add_method('Stop', 'void', [], is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDeviceQueue::Wake() [member function] cls.add_method('Wake', 'void', [], is_virtual=True) return def register_Ns3NetDeviceQueueInterface_methods(root_module, cls): ## net-device.h (module 'network'): ns3::NetDeviceQueueInterface::NetDeviceQueueInterface(ns3::NetDeviceQueueInterface const & arg0) [copy constructor] cls.add_constructor([param('ns3::NetDeviceQueueInterface const &', 'arg0')]) ## net-device.h (module 'network'): ns3::NetDeviceQueueInterface::NetDeviceQueueInterface() [constructor] cls.add_constructor([]) ## net-device.h (module 'network'): void ns3::NetDeviceQueueInterface::CreateTxQueues() [member function] cls.add_method('CreateTxQueues', 'void', []) ## net-device.h (module 'network'): uint8_t ns3::NetDeviceQueueInterface::GetNTxQueues() const [member function] cls.add_method('GetNTxQueues', 'uint8_t', [], is_const=True) ## net-device.h (module 'network'): ns3::Callback<unsigned char, ns3::Ptr<ns3::QueueItem>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> ns3::NetDeviceQueueInterface::GetSelectQueueCallback() const [member function] cls.add_method('GetSelectQueueCallback', 'ns3::Callback< unsigned char, ns3::Ptr< ns3::QueueItem >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', [], is_const=True) ## net-device.h (module 'network'): ns3::Ptr<ns3::NetDeviceQueue> ns3::NetDeviceQueueInterface::GetTxQueue(uint8_t i) const [member function] cls.add_method('GetTxQueue', 'ns3::Ptr< ns3::NetDeviceQueue >', [param('uint8_t', 'i')], is_const=True) ## net-device.h (module 'network'): static ns3::TypeId ns3::NetDeviceQueueInterface::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## net-device.h (module 'network'): void ns3::NetDeviceQueueInterface::SetSelectQueueCallback(ns3::Callback<unsigned char, ns3::Ptr<ns3::QueueItem>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> cb) [member function] cls.add_method('SetSelectQueueCallback', 'void', [param('ns3::Callback< unsigned char, ns3::Ptr< ns3::QueueItem >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')]) ## net-device.h (module 'network'): void ns3::NetDeviceQueueInterface::SetTxQueuesN(uint8_t numTxQueues) [member function] cls.add_method('SetTxQueuesN', 'void', [param('uint8_t', 'numTxQueues')]) ## net-device.h (module 'network'): void ns3::NetDeviceQueueInterface::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3NixVector_methods(root_module, cls): cls.add_output_stream_operator() ## nix-vector.h (module 'network'): ns3::NixVector::NixVector() [constructor] cls.add_constructor([]) ## nix-vector.h (module 'network'): ns3::NixVector::NixVector(ns3::NixVector const & o) [copy 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) [copy 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::Callback<void,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> 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::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, 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::Callback<void,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> 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::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) [member function] cls.add_method('UnregisterProtocolHandler', 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'handler')]) ## node.h (module 'network'): void ns3::Node::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='protected', is_virtual=True) ## node.h (module 'network'): void ns3::Node::DoInitialize() [member function] cls.add_method('DoInitialize', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3NormalRandomVariable_methods(root_module, cls): ## random-variable-stream.h (module 'core'): ns3::NormalRandomVariable::INFINITE_VALUE [variable] cls.add_static_attribute('INFINITE_VALUE', 'double const', is_const=True) ## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::NormalRandomVariable::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## random-variable-stream.h (module 'core'): ns3::NormalRandomVariable::NormalRandomVariable() [constructor] cls.add_constructor([]) ## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetMean() const [member function] cls.add_method('GetMean', 'double', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetVariance() const [member function] cls.add_method('GetVariance', 'double', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetBound() const [member function] cls.add_method('GetBound', 'double', [], is_const=True) ## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetValue(double mean, double variance, double bound=ns3::NormalRandomVariable::INFINITE_VALUE) [member function] cls.add_method('GetValue', 'double', [param('double', 'mean'), param('double', 'variance'), param('double', 'bound', default_value='ns3::NormalRandomVariable::INFINITE_VALUE')]) ## random-variable-stream.h (module 'core'): uint32_t ns3::NormalRandomVariable::GetInteger(uint32_t mean, uint32_t variance, uint32_t bound) [member function] cls.add_method('GetInteger', 'uint32_t', [param('uint32_t', 'mean'), param('uint32_t', 'variance'), param('uint32_t', 'bound')]) ## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetValue() [member function] cls.add_method('GetValue', 'double', [], is_virtual=True) ## random-variable-stream.h (module 'core'): uint32_t ns3::NormalRandomVariable::GetInteger() [member function] cls.add_method('GetInteger', 'uint32_t', [], is_virtual=True) return def register_Ns3ObjectFactoryChecker_methods(root_module, cls): ## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker() [constructor] cls.add_constructor([]) ## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker(ns3::ObjectFactoryChecker const & arg0) [copy 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::ObjectFactoryValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectFactoryValue const &', 'arg0')]) ## 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::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<ns3::AttributeChecker const> 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<ns3::AttributeChecker const> 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) [copy constructor] cls.add_constructor([param('ns3::OutputStreamWrapper const &', 'arg0')]) ## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(std::string filename, std::_Ios_Openmode filemode) [constructor] cls.add_constructor([param('std::string', 'filename'), param('std::_Ios_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) [copy constructor] cls.add_constructor([param('ns3::Packet const &', 'o')]) ## packet.h (module 'network'): ns3::Packet::Packet(uint32_t size) [constructor] cls.add_constructor([param('uint32_t', 'size')]) ## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size, bool magic) [constructor] cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size'), param('bool', 'magic')]) ## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size) [constructor] cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## packet.h (module 'network'): void ns3::Packet::AddAtEnd(ns3::Ptr<const ns3::Packet> packet) [member function] cls.add_method('AddAtEnd', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) ## packet.h (module 'network'): void ns3::Packet::AddByteTag(ns3::Tag const & tag) const [member function] cls.add_method('AddByteTag', 'void', [param('ns3::Tag const &', 'tag')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::AddHeader(ns3::Header const & header) [member function] cls.add_method('AddHeader', 'void', [param('ns3::Header const &', 'header')]) ## packet.h (module 'network'): void ns3::Packet::AddPacketTag(ns3::Tag const & tag) const [member function] cls.add_method('AddPacketTag', 'void', [param('ns3::Tag const &', 'tag')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::AddPaddingAtEnd(uint32_t size) [member function] cls.add_method('AddPaddingAtEnd', 'void', [param('uint32_t', 'size')]) ## packet.h (module 'network'): void ns3::Packet::AddTrailer(ns3::Trailer const & trailer) [member function] cls.add_method('AddTrailer', 'void', [param('ns3::Trailer const &', 'trailer')]) ## packet.h (module 'network'): ns3::PacketMetadata::ItemIterator ns3::Packet::BeginItem() const [member function] cls.add_method('BeginItem', 'ns3::PacketMetadata::ItemIterator', [], is_const=True) ## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::Packet >', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::CopyData(uint8_t * buffer, uint32_t size) const [member function] cls.add_method('CopyData', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'size')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::CopyData(std::ostream * os, uint32_t size) const [member function] cls.add_method('CopyData', 'void', [param('std::ostream *', 'os'), param('uint32_t', 'size')], is_const=True) ## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::CreateFragment(uint32_t start, uint32_t length) const [member function] cls.add_method('CreateFragment', 'ns3::Ptr< ns3::Packet >', [param('uint32_t', 'start'), param('uint32_t', 'length')], is_const=True) ## packet.h (module 'network'): static void ns3::Packet::EnableChecking() [member function] cls.add_method('EnableChecking', 'void', [], is_static=True) ## packet.h (module 'network'): static void ns3::Packet::EnablePrinting() [member function] cls.add_method('EnablePrinting', 'void', [], is_static=True) ## packet.h (module 'network'): bool ns3::Packet::FindFirstMatchingByteTag(ns3::Tag & tag) const [member function] cls.add_method('FindFirstMatchingByteTag', 'bool', [param('ns3::Tag &', 'tag')], is_const=True) ## packet.h (module 'network'): ns3::ByteTagIterator ns3::Packet::GetByteTagIterator() const [member function] cls.add_method('GetByteTagIterator', 'ns3::ByteTagIterator', [], is_const=True) ## packet.h (module 'network'): ns3::Ptr<ns3::NixVector> ns3::Packet::GetNixVector() const [member function] cls.add_method('GetNixVector', 'ns3::Ptr< ns3::NixVector >', [], is_const=True) ## packet.h (module 'network'): ns3::PacketTagIterator ns3::Packet::GetPacketTagIterator() const [member function] cls.add_method('GetPacketTagIterator', 'ns3::PacketTagIterator', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::GetSize() const [member function] cls.add_method('GetSize', 'uint32_t', [], is_const=True) ## packet.h (module 'network'): uint64_t ns3::Packet::GetUid() const [member function] cls.add_method('GetUid', 'uint64_t', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::PeekHeader(ns3::Header & header) const [member function] cls.add_method('PeekHeader', 'uint32_t', [param('ns3::Header &', 'header')], is_const=True) ## packet.h (module 'network'): 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'): 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) ## 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 mean, double shape, double bound) [member function] cls.add_method('GetValue', 'double', [param('double', 'mean'), param('double', 'shape'), param('double', 'bound')]) ## random-variable-stream.h (module 'core'): uint32_t ns3::ParetoRandomVariable::GetInteger(uint32_t mean, uint32_t shape, uint32_t bound) [member function] cls.add_method('GetInteger', 'uint32_t', [param('uint32_t', 'mean'), 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_Ns3PointToPointChannel_methods(root_module, cls): ## point-to-point-channel.h (module 'point-to-point'): ns3::PointToPointChannel::PointToPointChannel(ns3::PointToPointChannel const & arg0) [copy constructor] cls.add_constructor([param('ns3::PointToPointChannel const &', 'arg0')]) ## point-to-point-channel.h (module 'point-to-point'): ns3::PointToPointChannel::PointToPointChannel() [constructor] cls.add_constructor([]) ## point-to-point-channel.h (module 'point-to-point'): void ns3::PointToPointChannel::Attach(ns3::Ptr<ns3::PointToPointNetDevice> device) [member function] cls.add_method('Attach', 'void', [param('ns3::Ptr< ns3::PointToPointNetDevice >', 'device')]) ## point-to-point-channel.h (module 'point-to-point'): ns3::Ptr<ns3::NetDevice> ns3::PointToPointChannel::GetDevice(uint32_t i) const [member function] cls.add_method('GetDevice', 'ns3::Ptr< ns3::NetDevice >', [param('uint32_t', 'i')], is_const=True, is_virtual=True) ## point-to-point-channel.h (module 'point-to-point'): uint32_t ns3::PointToPointChannel::GetNDevices() const [member function] cls.add_method('GetNDevices', 'uint32_t', [], is_const=True, is_virtual=True) ## point-to-point-channel.h (module 'point-to-point'): ns3::Ptr<ns3::PointToPointNetDevice> ns3::PointToPointChannel::GetPointToPointDevice(uint32_t i) const [member function] cls.add_method('GetPointToPointDevice', 'ns3::Ptr< ns3::PointToPointNetDevice >', [param('uint32_t', 'i')], is_const=True) ## point-to-point-channel.h (module 'point-to-point'): static ns3::TypeId ns3::PointToPointChannel::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## point-to-point-channel.h (module 'point-to-point'): bool ns3::PointToPointChannel::TransmitStart(ns3::Ptr<ns3::Packet> p, ns3::Ptr<ns3::PointToPointNetDevice> src, ns3::Time txTime) [member function] cls.add_method('TransmitStart', 'bool', [param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ptr< ns3::PointToPointNetDevice >', 'src'), param('ns3::Time', 'txTime')], is_virtual=True) ## point-to-point-channel.h (module 'point-to-point'): ns3::Time ns3::PointToPointChannel::GetDelay() const [member function] cls.add_method('GetDelay', 'ns3::Time', [], is_const=True, visibility='protected') ## point-to-point-channel.h (module 'point-to-point'): ns3::Ptr<ns3::PointToPointNetDevice> ns3::PointToPointChannel::GetDestination(uint32_t i) const [member function] cls.add_method('GetDestination', 'ns3::Ptr< ns3::PointToPointNetDevice >', [param('uint32_t', 'i')], is_const=True, visibility='protected') ## point-to-point-channel.h (module 'point-to-point'): ns3::Ptr<ns3::PointToPointNetDevice> ns3::PointToPointChannel::GetSource(uint32_t i) const [member function] cls.add_method('GetSource', 'ns3::Ptr< ns3::PointToPointNetDevice >', [param('uint32_t', 'i')], is_const=True, visibility='protected') ## point-to-point-channel.h (module 'point-to-point'): bool ns3::PointToPointChannel::IsInitialized() const [member function] cls.add_method('IsInitialized', 'bool', [], is_const=True, visibility='protected') return def register_Ns3PointToPointNetDevice_methods(root_module, cls): ## point-to-point-net-device.h (module 'point-to-point'): static ns3::TypeId ns3::PointToPointNetDevice::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## point-to-point-net-device.h (module 'point-to-point'): ns3::PointToPointNetDevice::PointToPointNetDevice() [constructor] cls.add_constructor([]) ## point-to-point-net-device.h (module 'point-to-point'): void ns3::PointToPointNetDevice::SetDataRate(ns3::DataRate bps) [member function] cls.add_method('SetDataRate', 'void', [param('ns3::DataRate', 'bps')]) ## point-to-point-net-device.h (module 'point-to-point'): void ns3::PointToPointNetDevice::SetInterframeGap(ns3::Time t) [member function] cls.add_method('SetInterframeGap', 'void', [param('ns3::Time', 't')]) ## point-to-point-net-device.h (module 'point-to-point'): bool ns3::PointToPointNetDevice::Attach(ns3::Ptr<ns3::PointToPointChannel> ch) [member function] cls.add_method('Attach', 'bool', [param('ns3::Ptr< ns3::PointToPointChannel >', 'ch')]) ## point-to-point-net-device.h (module 'point-to-point'): void ns3::PointToPointNetDevice::SetQueue(ns3::Ptr<ns3::Queue> queue) [member function] cls.add_method('SetQueue', 'void', [param('ns3::Ptr< ns3::Queue >', 'queue')]) ## point-to-point-net-device.h (module 'point-to-point'): ns3::Ptr<ns3::Queue> ns3::PointToPointNetDevice::GetQueue() const [member function] cls.add_method('GetQueue', 'ns3::Ptr< ns3::Queue >', [], is_const=True) ## point-to-point-net-device.h (module 'point-to-point'): void ns3::PointToPointNetDevice::SetReceiveErrorModel(ns3::Ptr<ns3::ErrorModel> em) [member function] cls.add_method('SetReceiveErrorModel', 'void', [param('ns3::Ptr< ns3::ErrorModel >', 'em')]) ## point-to-point-net-device.h (module 'point-to-point'): void ns3::PointToPointNetDevice::Receive(ns3::Ptr<ns3::Packet> p) [member function] cls.add_method('Receive', 'void', [param('ns3::Ptr< ns3::Packet >', 'p')]) ## point-to-point-net-device.h (module 'point-to-point'): void ns3::PointToPointNetDevice::SetIfIndex(uint32_t const index) [member function] cls.add_method('SetIfIndex', 'void', [param('uint32_t const', 'index')], is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): uint32_t ns3::PointToPointNetDevice::GetIfIndex() const [member function] cls.add_method('GetIfIndex', 'uint32_t', [], is_const=True, is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): ns3::Ptr<ns3::Channel> ns3::PointToPointNetDevice::GetChannel() const [member function] cls.add_method('GetChannel', 'ns3::Ptr< ns3::Channel >', [], is_const=True, is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): void ns3::PointToPointNetDevice::SetAddress(ns3::Address address) [member function] cls.add_method('SetAddress', 'void', [param('ns3::Address', 'address')], is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): ns3::Address ns3::PointToPointNetDevice::GetAddress() const [member function] cls.add_method('GetAddress', 'ns3::Address', [], is_const=True, is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): bool ns3::PointToPointNetDevice::SetMtu(uint16_t const mtu) [member function] cls.add_method('SetMtu', 'bool', [param('uint16_t const', 'mtu')], is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): uint16_t ns3::PointToPointNetDevice::GetMtu() const [member function] cls.add_method('GetMtu', 'uint16_t', [], is_const=True, is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): bool ns3::PointToPointNetDevice::IsLinkUp() const [member function] cls.add_method('IsLinkUp', 'bool', [], is_const=True, is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): void ns3::PointToPointNetDevice::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) ## point-to-point-net-device.h (module 'point-to-point'): bool ns3::PointToPointNetDevice::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_const=True, is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): ns3::Address ns3::PointToPointNetDevice::GetBroadcast() const [member function] cls.add_method('GetBroadcast', 'ns3::Address', [], is_const=True, is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): bool ns3::PointToPointNetDevice::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_const=True, is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): ns3::Address ns3::PointToPointNetDevice::GetMulticast(ns3::Ipv4Address multicastGroup) const [member function] cls.add_method('GetMulticast', 'ns3::Address', [param('ns3::Ipv4Address', 'multicastGroup')], is_const=True, is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): bool ns3::PointToPointNetDevice::IsPointToPoint() const [member function] cls.add_method('IsPointToPoint', 'bool', [], is_const=True, is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): bool ns3::PointToPointNetDevice::IsBridge() const [member function] cls.add_method('IsBridge', 'bool', [], is_const=True, is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): bool ns3::PointToPointNetDevice::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) ## point-to-point-net-device.h (module 'point-to-point'): bool ns3::PointToPointNetDevice::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) ## point-to-point-net-device.h (module 'point-to-point'): ns3::Ptr<ns3::Node> ns3::PointToPointNetDevice::GetNode() const [member function] cls.add_method('GetNode', 'ns3::Ptr< ns3::Node >', [], is_const=True, is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): void ns3::PointToPointNetDevice::SetNode(ns3::Ptr<ns3::Node> node) [member function] cls.add_method('SetNode', 'void', [param('ns3::Ptr< ns3::Node >', 'node')], is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): bool ns3::PointToPointNetDevice::NeedsArp() const [member function] cls.add_method('NeedsArp', 'bool', [], is_const=True, is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): void ns3::PointToPointNetDevice::SetReceiveCallback(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) [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) ## point-to-point-net-device.h (module 'point-to-point'): ns3::Address ns3::PointToPointNetDevice::GetMulticast(ns3::Ipv6Address addr) const [member function] cls.add_method('GetMulticast', 'ns3::Address', [param('ns3::Ipv6Address', 'addr')], is_const=True, is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): void ns3::PointToPointNetDevice::SetPromiscReceiveCallback(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) [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) ## point-to-point-net-device.h (module 'point-to-point'): bool ns3::PointToPointNetDevice::SupportsSendFrom() const [member function] cls.add_method('SupportsSendFrom', 'bool', [], is_const=True, is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): void ns3::PointToPointNetDevice::DoMpiReceive(ns3::Ptr<ns3::Packet> p) [member function] cls.add_method('DoMpiReceive', 'void', [param('ns3::Ptr< ns3::Packet >', 'p')], visibility='protected') ## point-to-point-net-device.h (module 'point-to-point'): void ns3::PointToPointNetDevice::NotifyNewAggregate() [member function] cls.add_method('NotifyNewAggregate', 'void', [], visibility='protected', is_virtual=True) ## point-to-point-net-device.h (module 'point-to-point'): void ns3::PointToPointNetDevice::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='private', is_virtual=True) return def register_Ns3PointToPointRemoteChannel_methods(root_module, cls): ## point-to-point-remote-channel.h (module 'point-to-point'): ns3::PointToPointRemoteChannel::PointToPointRemoteChannel(ns3::PointToPointRemoteChannel const & arg0) [copy constructor] cls.add_constructor([param('ns3::PointToPointRemoteChannel const &', 'arg0')]) ## point-to-point-remote-channel.h (module 'point-to-point'): ns3::PointToPointRemoteChannel::PointToPointRemoteChannel() [constructor] cls.add_constructor([]) ## point-to-point-remote-channel.h (module 'point-to-point'): static ns3::TypeId ns3::PointToPointRemoteChannel::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## point-to-point-remote-channel.h (module 'point-to-point'): bool ns3::PointToPointRemoteChannel::TransmitStart(ns3::Ptr<ns3::Packet> p, ns3::Ptr<ns3::PointToPointNetDevice> src, ns3::Time txTime) [member function] cls.add_method('TransmitStart', 'bool', [param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ptr< ns3::PointToPointNetDevice >', 'src'), param('ns3::Time', 'txTime')], is_virtual=True) return def register_Ns3QueueItem_methods(root_module, cls): cls.add_output_stream_operator() ## net-device.h (module 'network'): ns3::QueueItem::QueueItem(ns3::Ptr<ns3::Packet> p) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::Packet >', 'p')]) ## net-device.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::QueueItem::GetPacket() const [member function] cls.add_method('GetPacket', 'ns3::Ptr< ns3::Packet >', [], is_const=True) ## net-device.h (module 'network'): uint32_t ns3::QueueItem::GetPacketSize() const [member function] cls.add_method('GetPacketSize', 'uint32_t', [], is_const=True, is_virtual=True) ## net-device.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) ## net-device.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_Ns3RateErrorModel_methods(root_module, cls): ## error-model.h (module 'network'): ns3::RateErrorModel::RateErrorModel(ns3::RateErrorModel const & arg0) [copy 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')], visibility='private', is_virtual=True) ## 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')], visibility='private', is_virtual=True) ## 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')], visibility='private', is_virtual=True) ## 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')], visibility='private', is_virtual=True) ## error-model.h (module 'network'): void ns3::RateErrorModel::DoReset() [member function] cls.add_method('DoReset', 'void', [], visibility='private', is_virtual=True) return def register_Ns3ReceiveListErrorModel_methods(root_module, cls): ## error-model.h (module 'network'): ns3::ReceiveListErrorModel::ReceiveListErrorModel(ns3::ReceiveListErrorModel const & arg0) [copy 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')], visibility='private', is_virtual=True) ## error-model.h (module 'network'): void ns3::ReceiveListErrorModel::DoReset() [member function] cls.add_method('DoReset', 'void', [], visibility='private', is_virtual=True) 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::TimeValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::TimeValue const &', 'arg0')]) ## 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::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<ns3::AttributeChecker const> 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<ns3::AttributeChecker const> 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) [copy 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::TypeIdValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::TypeIdValue const &', 'arg0')]) ## 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::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<ns3::AttributeChecker const> 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<ns3::AttributeChecker const> 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(ns3::UintegerValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::UintegerValue const &', 'arg0')]) ## 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::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<ns3::AttributeChecker const> 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<ns3::AttributeChecker const> 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) [copy 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::AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::AddressValue const &', 'arg0')]) ## 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::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<ns3::AttributeChecker const> 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<ns3::AttributeChecker const> 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_Ns3BurstErrorModel_methods(root_module, cls): ## error-model.h (module 'network'): ns3::BurstErrorModel::BurstErrorModel(ns3::BurstErrorModel const & arg0) [copy 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')], visibility='private', is_virtual=True) ## error-model.h (module 'network'): void ns3::BurstErrorModel::DoReset() [member function] cls.add_method('DoReset', 'void', [], visibility='private', 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) [copy 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, size_t const size) [member function] cls.add_method('GetHash32', 'uint32_t', [param('char const *', 'buffer'), param('size_t const', 'size')], is_pure_virtual=True, is_virtual=True) ## hash-function.h (module 'core'): uint64_t ns3::Hash::Implementation::GetHash64(char const * buffer, 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-function.h (module 'core'): void ns3::Hash::Implementation::clear() [member function] cls.add_method('clear', 'void', [], is_pure_virtual=True, is_virtual=True) return def register_Ns3HashFunctionFnv1a_methods(root_module, cls): ## hash-fnv.h (module 'core'): ns3::Hash::Function::Fnv1a::Fnv1a(ns3::Hash::Function::Fnv1a const & arg0) [copy 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) [copy 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, 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-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) [copy 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, 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-function.h (module 'core'): uint64_t ns3::Hash::Function::Hash64::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-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) [copy 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, 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-murmur3.h (module 'core'): uint64_t ns3::Hash::Function::Murmur3::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-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.get_submodule('FatalImpl'), root_module) register_functions_ns3_Hash(module.get_submodule('Hash'), root_module) register_functions_ns3_TracedValueCallback(module.get_submodule('TracedValueCallback'), root_module) register_functions_ns3_internal(module.get_submodule('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.get_submodule('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()
gpl-2.0
skitazaki/jpgridmap
server/geojson/mapping.py
50
1326
GEO_INTERFACE_MARKER = "__geo_interface__" def is_mapping(ob): return hasattr(ob, "__getitem__") def to_mapping(ob): if hasattr(ob, GEO_INTERFACE_MARKER): candidate = ob.__geo_interface__ candidate = to_mapping(candidate) else: candidate = ob if not is_mapping(candidate): msg = "Expecting something that has %r or a mapping, got %r" msg %= (GEO_INTERFACE_MARKER, ob) raise ValueError(msg) return Mapping(candidate) class Mapping(object): """Define what a ``mapping`` is to geojson. Until py3k, where we have abstract base classes, this will have to do. """ def __init__(self, ob): super(Mapping, self).__init__() self._ob = ob def __contains__(self, name): return bool(self.get(name)) def __getitem__(self, key): return self._ob[key] def __iter__(self): return iter(self._ob) def __len__(self): return len(self._ob) def keys(self): return list(self._ob) def get(self, key, default=None): try: value = self._ob[key] except KeyError: value = default return value def update(self, other): for key in other: if not key in self: self[key] = other[key]
apache-2.0
jseabold/statsmodels
statsmodels/tsa/tests/test_adfuller_lag.py
4
1833
# -*- coding: utf-8 -*- """Test for autolag of adfuller Created on Wed May 30 21:39:46 2012 Author: Josef Perktold """ import numpy as np from numpy.testing import assert_equal, assert_almost_equal import statsmodels.tsa.stattools as tsast from statsmodels.datasets import macrodata def test_adf_autolag(): #see issue #246 #this is mostly a unit test d2 = macrodata.load_pandas().data for k_trend, tr in enumerate(['nc', 'c', 'ct', 'ctt']): #[None:'nc', 0:'c', 1:'ct', 2:'ctt'] x = np.log(d2['realgdp'].values) xd = np.diff(x) #check exog adf3 = tsast.adfuller(x, maxlag=None, autolag='aic', regression=tr, store=True, regresults=True) st2 = adf3[-1] assert_equal(len(st2.autolag_results), 15 + 1) #+1 for lagged level for i, res in sorted(st2.autolag_results.items())[:5]: lag = i - k_trend #assert correct design matrices in _autolag assert_equal(res.model.exog[-10:,k_trend], x[-11:-1]) assert_equal(res.model.exog[-1,k_trend+1:], xd[-lag:-1][::-1]) #min-ic lag of dfgls in Stata is also 2, or 9 for maic with notrend assert_equal(st2.usedlag, 2) #same result with lag fixed at usedlag of autolag adf2 = tsast.adfuller(x, maxlag=2, autolag=None, regression=tr) assert_almost_equal(adf3[:2], adf2[:2], decimal=12) tr = 'c' #check maxlag with autolag adf3 = tsast.adfuller(x, maxlag=5, autolag='aic', regression=tr, store=True, regresults=True) assert_equal(len(adf3[-1].autolag_results), 5 + 1) adf3 = tsast.adfuller(x, maxlag=0, autolag='aic', regression=tr, store=True, regresults=True) assert_equal(len(adf3[-1].autolag_results), 0 + 1)
bsd-3-clause
tiagofrepereira2012/tensorflow
tensorflow/examples/learn/text_classification.py
12
6651
# Copyright 2016 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. """Example of Estimator for DNN-based text classification with DBpedia data.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import sys import numpy as np import pandas from sklearn import metrics import tensorflow as tf FLAGS = None MAX_DOCUMENT_LENGTH = 10 EMBEDDING_SIZE = 50 n_words = 0 MAX_LABEL = 15 WORDS_FEATURE = 'words' # Name of the input words feature. def estimator_spec_for_softmax_classification( logits, labels, mode): """Returns EstimatorSpec instance for softmax classification.""" predicted_classes = tf.argmax(logits, 1) if mode == tf.estimator.ModeKeys.PREDICT: return tf.estimator.EstimatorSpec( mode=mode, predictions={ 'class': predicted_classes, 'prob': tf.nn.softmax(logits) }) onehot_labels = tf.one_hot(labels, MAX_LABEL, 1, 0) loss = tf.losses.softmax_cross_entropy( onehot_labels=onehot_labels, logits=logits) if mode == tf.estimator.ModeKeys.TRAIN: optimizer = tf.train.AdamOptimizer(learning_rate=0.01) train_op = optimizer.minimize(loss, global_step=tf.train.get_global_step()) return tf.estimator.EstimatorSpec(mode, loss=loss, train_op=train_op) eval_metric_ops = { 'accuracy': tf.metrics.accuracy( labels=labels, predictions=predicted_classes) } return tf.estimator.EstimatorSpec( mode=mode, loss=loss, eval_metric_ops=eval_metric_ops) def bag_of_words_model(features, labels, mode): """A bag-of-words model. Note it disregards the word order in the text.""" bow_column = tf.feature_column.categorical_column_with_identity( WORDS_FEATURE, num_buckets=n_words) bow_embedding_column = tf.feature_column.embedding_column( bow_column, dimension=EMBEDDING_SIZE) bow = tf.feature_column.input_layer( features, feature_columns=[bow_embedding_column]) logits = tf.layers.dense(bow, MAX_LABEL, activation=None) return estimator_spec_for_softmax_classification( logits=logits, labels=labels, mode=mode) def rnn_model(features, labels, mode): """RNN model to predict from sequence of words to a class.""" # Convert indexes of words into embeddings. # This creates embeddings matrix of [n_words, EMBEDDING_SIZE] and then # maps word indexes of the sequence into [batch_size, sequence_length, # EMBEDDING_SIZE]. word_vectors = tf.contrib.layers.embed_sequence( features[WORDS_FEATURE], vocab_size=n_words, embed_dim=EMBEDDING_SIZE) # Split into list of embedding per word, while removing doc length dim. # word_list results to be a list of tensors [batch_size, EMBEDDING_SIZE]. word_list = tf.unstack(word_vectors, axis=1) # Create a Gated Recurrent Unit cell with hidden size of EMBEDDING_SIZE. cell = tf.contrib.rnn.GRUCell(EMBEDDING_SIZE) # Create an unrolled Recurrent Neural Networks to length of # MAX_DOCUMENT_LENGTH and passes word_list as inputs for each unit. _, encoding = tf.contrib.rnn.static_rnn(cell, word_list, dtype=tf.float32) # Given encoding of RNN, take encoding of last step (e.g hidden size of the # neural network of last step) and pass it as features for softmax # classification over output classes. logits = tf.layers.dense(encoding, MAX_LABEL, activation=None) return estimator_spec_for_softmax_classification( logits=logits, labels=labels, mode=mode) def main(unused_argv): global n_words # Prepare training and testing data dbpedia = tf.contrib.learn.datasets.load_dataset( 'dbpedia', test_with_fake_data=FLAGS.test_with_fake_data) x_train = pandas.DataFrame(dbpedia.train.data)[1] y_train = pandas.Series(dbpedia.train.target) x_test = pandas.DataFrame(dbpedia.test.data)[1] y_test = pandas.Series(dbpedia.test.target) # Process vocabulary vocab_processor = tf.contrib.learn.preprocessing.VocabularyProcessor( MAX_DOCUMENT_LENGTH) x_transform_train = vocab_processor.fit_transform(x_train) x_transform_test = vocab_processor.transform(x_test) x_train = np.array(list(x_transform_train)) x_test = np.array(list(x_transform_test)) n_words = len(vocab_processor.vocabulary_) print('Total words: %d' % n_words) # Build model # Switch between rnn_model and bag_of_words_model to test different models. model_fn = rnn_model if FLAGS.bow_model: # Subtract 1 because VocabularyProcessor outputs a word-id matrix where word # ids start from 1 and 0 means 'no word'. But # categorical_column_with_identity assumes 0-based count and uses -1 for # missing word. x_train -= 1 x_test -= 1 model_fn = bag_of_words_model classifier = tf.estimator.Estimator(model_fn=model_fn) # Train. train_input_fn = tf.estimator.inputs.numpy_input_fn( x={WORDS_FEATURE: x_train}, y=y_train, batch_size=len(x_train), num_epochs=None, shuffle=True) classifier.train(input_fn=train_input_fn, steps=100) # Predict. test_input_fn = tf.estimator.inputs.numpy_input_fn( x={WORDS_FEATURE: x_test}, y=y_test, num_epochs=1, shuffle=False) predictions = classifier.predict(input_fn=test_input_fn) y_predicted = np.array(list(p['class'] for p in predictions)) y_predicted = y_predicted.reshape(np.array(y_test).shape) # Score with sklearn. score = metrics.accuracy_score(y_test, y_predicted) print('Accuracy (sklearn): {0:f}'.format(score)) # Score with tensorflow. scores = classifier.evaluate(input_fn=test_input_fn) print('Accuracy (tensorflow): {0:f}'.format(scores['accuracy'])) if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument( '--test_with_fake_data', default=False, help='Test the example code with fake data.', action='store_true') parser.add_argument( '--bow_model', default=False, help='Run with BOW model instead of RNN.', action='store_true') FLAGS, unparsed = parser.parse_known_args() tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
apache-2.0
WadeYuChen/django-oscar
src/oscar/apps/catalogue/receivers.py
60
1249
# -*- coding: utf-8 -*- from django.conf import settings if settings.OSCAR_DELETE_IMAGE_FILES: from oscar.core.loading import get_model from django.db import models from django.db.models.signals import post_delete from sorl import thumbnail from sorl.thumbnail.helpers import ThumbnailError ProductImage = get_model('catalogue', 'ProductImage') Category = get_model('catalogue', 'Category') def delete_image_files(sender, instance, **kwargs): """ Deletes the original image, created thumbnails, and any entries in sorl's key-value store. """ image_fields = (models.ImageField, thumbnail.ImageField) for field in instance._meta.fields: if isinstance(field, image_fields): # Make Django return ImageFieldFile instead of ImageField fieldfile = getattr(instance, field.name) try: thumbnail.delete(fieldfile) except ThumbnailError: pass # connect for all models with ImageFields - add as needed models_with_images = [ProductImage, Category] for sender in models_with_images: post_delete.connect(delete_image_files, sender=sender)
bsd-3-clause
DataDog/integrations-extras
portworx/datadog_checks/portworx/portworx.py
1
5120
from datadog_checks.base.checks.prometheus.prometheus_base import PrometheusCheck from datadog_checks.base.errors import CheckException EVENT_TYPE = SOURCE_TYPE_NAME = 'portworx' class PortworxCheck(PrometheusCheck): """ Collect px metrics from Portworx """ def __init__(self, name, init_config, agentConfig, instances=None): super(PortworxCheck, self).__init__(name, init_config, agentConfig, instances) self.NAMESPACE = 'portworx' self.metrics_mapper = { 'px_cluster_cpu_percent': 'cluster.cpu_percent', 'px_cluster_disk_available_bytes': 'cluster.disk_available_bytes', 'px_cluster_disk_total_bytes': 'cluster.disk_total_bytes', 'px_cluster_disk_utilized_bytes': 'cluster.disk_utilized_bytes', 'px_cluster_memory_utilized_percent': 'cluster.memory_utilized_percent', 'px_cluster_pendingio': 'cluster.pendingio', 'px_cluster_status_cluster_quorum': 'cluster.status.cluster_quorum', 'px_cluster_status_cluster_size': 'cluster.status.cluster_size', 'px_cluster_status_nodes_offline': 'cluster.status.nodes_offline', 'px_cluster_status_nodes_online': 'cluster.status.nodes_online', 'px_cluster_status_nodes_storage_down': 'cluster.status.nodes_storage_down', 'px_cluster_status_storage_nodes_offline': 'cluster.status.storage_nodes_offline', 'px_cluster_status_storage_nodes_online': 'cluster.status.storage_nodes_online', 'px_disk_stats_interval_seconds': 'disk_stats.interval_seconds', 'px_disk_stats_io_seconds': 'disk_stats.io_seconds', 'px_disk_stats_progress_io': 'disk_stats.progress_io', 'px_disk_stats_read_bytes': 'disk_stats.read_bytes', 'px_disk_stats_read_latency_seconds': 'disk_stats.read_latency_seconds', 'px_disk_stats_read_seconds': 'disk_stats.read_seconds', 'px_disk_stats_reads': 'disk_stats.reads', 'px_disk_stats_used_bytes': 'disk_stats.used_bytes', 'px_disk_stats_write_bytes': 'disk_stats.write_bytes', 'px_disk_stats_write_latency_seconds': 'disk_stats.write_latency_seconds', 'px_disk_stats_write_seconds': 'disk_stats.write_seconds', 'px_disk_stats_writes': 'disk_stats.writes', 'px_network_io_bytessent': 'network_io.bytessent', 'px_network_io_received_bytes': 'network_io.received_bytes', 'px_pool_stats_pool_flushed_bytes': 'pool_stats.flushed_bytes', 'px_pool_stats_pool_flushms': 'pool_stats.flushms', 'px_pool_stats_pool_num_flushes': 'pool_stats.num_flushes', 'px_pool_stats_pool_write_latency_seconds': 'pool_stats.write_latency_seconds', 'px_pool_stats_pool_writethroughput': 'pool_stats.writethroughput', 'px_pool_stats_pool_written_bytes': 'pool_stats.written_bytes', 'px_proc_stats_cpu_percenttime': 'proc.cpu_percenttime', 'px_proc_stats_res': 'proc.res', 'px_proc_stats_virt': 'proc.virt', 'px_volume_capacity_bytes': 'volume.capacity_bytes', 'px_volume_currhalevel': 'volume.currhalevel', 'px_volume_depth_io': 'volume.depth_io', 'px_volume_dev_depth_io': 'volume.dev.depth_io', 'px_volume_dev_read_latency_seconds': 'volume.dev.read_latency_seconds', 'px_volume_dev_readthroughput': 'volume.dev.readthroughput', 'px_volume_dev_write_latency_seconds': 'volume.dev.write_latency_seconds', 'px_volume_dev_writethroughput': 'volume.dev.writethroughput', 'px_volume_halevel': 'volume.halevel', 'px_volume_iopriority': 'volume.iopriority', 'px_volume_iops': 'volume.iops', 'px_volume_num_long_flushes': 'volume.num_long_flushes', 'px_volume_num_long_reads': 'volume.num_long_reads', 'px_volume_num_long_writes': 'volume.num_long_writes', 'px_volume_readthroughput': 'volume.readthroughput', 'px_volume_usage_bytes': 'volume.usage_bytes', 'px_volume_vol_read_latency_seconds': 'volume.vol_read_latency_seconds', 'px_volume_vol_write_latency_seconds': 'volume.vol_write_latency_seconds', 'px_volume_writethroughput': 'volume.writethroughput', 'px_volume_written_bytes': 'volume.written_bytes', 'fs_usage_bytes': 'fs.usage_bytes', 'fs_capacity_bytes': 'fs.capacity_bytes', } def check(self, instance): endpoint = instance.get('prometheus_endpoint') if endpoint is None: raise CheckException("Unable to find prometheus_endpoint in config file.") send_buckets = instance.get('send_histograms_buckets', True) # By default we send the buckets. if send_buckets is not None and str(send_buckets).lower() == 'false': send_buckets = False else: send_buckets = True self.process(endpoint, send_histograms_buckets=send_buckets, instance=instance)
bsd-3-clause
tempbottle/ironpython3
Tests/test_xrange.py
2
3215
##################################################################################### # # Copyright (c) Microsoft Corporation. All rights reserved. # # This source code is subject to terms and conditions of the Apache License, Version 2.0. A # copy of the license can be found in the License.html file at the root of this distribution. If # you cannot locate the Apache License, Version 2.0, please send an email to # ironpy@microsoft.com. By using this source code in any fashion, you are agreeing to be bound # by the terms of the Apache License, Version 2.0. # # You must not remove this notice, or any other, from this software. # # ##################################################################################### ## ## Test range and xrange ## ## * sbs_builtin\test_xrange covers many xrange corner cases ## from iptest.assert_util import * def test_range(): Assert(range(10) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) Assert(range(0) == []) Assert(range(-10) == []) Assert(range(3,10) == [3, 4, 5, 6, 7, 8, 9]) Assert(range(10,3) == []) Assert(range(-3,-10) == []) Assert(range(-10,-3) == [-10, -9, -8, -7, -6, -5, -4]) Assert(range(3,20,2) == [3, 5, 7, 9, 11, 13, 15, 17, 19]) Assert(range(3,20,-2) == []) Assert(range(20,3,2) == []) Assert(range(20,3,-2) == [20, 18, 16, 14, 12, 10, 8, 6, 4]) Assert(range(-3,-20,2) == []) Assert(range(-3,-20,-2) == [-3, -5, -7, -9, -11, -13, -15, -17, -19]) Assert(range(-20,-3, 2) == [-20, -18, -16, -14, -12, -10, -8, -6, -4]) Assert(range(-20,-3,-2) == []) def _xrange_eqv_range(r, o): Assert(len(r) == len(o)) for i in range(len(r)): Assert(r[i]==o[i]) if (1 - i) == len(r): AssertError(IndexError, lambda: r[1-i]) AssertError(IndexError, lambda: o[1-i]) else: Assert(r[1-i] == o[1-i]) def test_xrange_based_on_range(): for x in (10, -1, 0, 1, -10): _xrange_eqv_range(xrange(x), range(x)) for x in (3, -3, 10, -10): for y in (3, -3, 10, -10): _xrange_eqv_range(xrange(x, y), range(x, y)) for x in (3, -3, 20, -20): for y in (3, -3, 20, -20): for z in (2, -2): _xrange_eqv_range(xrange(x, y, z), range(x, y, z)) for x in (7, -7): for y in (20, 21, 22, 23, -20, -21, -22, -23): for z in (4, -4): _xrange_eqv_range(xrange(x, y, z), range(x, y, z)) def test_xrange_corner_cases(): import sys x = xrange(0, sys.maxint, sys.maxint-1) AreEqual(x[0], 0) AreEqual(x[1], sys.maxint-1) def test_xrange_coverage(): ## ToString AreEqual(str(xrange(0, 3, 1)), "xrange(3)") AreEqual(str(xrange(1, 3, 1)), "xrange(1, 3)") AreEqual(str(xrange(0, 5, 2)), "xrange(0, 6, 2)") ## Long AreEqual([x for x in xrange(5L)], range(5)) AreEqual([x for x in xrange(10L, 15L)], range(10, 15)) AreEqual([x for x in xrange(10L, 15L, 2)], range(10, 15,2 )) ## Ops AssertError(TypeError, lambda: xrange(4) + 4) AssertError(TypeError, lambda: xrange(4) * 4) AssertError(TypeError, lambda: xrange(4)[:2]) AssertError(TypeError, lambda: xrange(4)[1:2:3]) run_test(__name__)
apache-2.0
revinate/kubernetes
examples/cluster-dns/images/frontend/client.py
468
1227
#!/usr/bin/env python # Copyright 2015 The Kubernetes 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. import argparse import requests import socket from urlparse import urlparse def CheckServiceAddress(address): hostname = urlparse(address).hostname service_address = socket.gethostbyname(hostname) print service_address def GetServerResponse(address): print 'Send request to:', address response = requests.get(address) print response print response.content def Main(): parser = argparse.ArgumentParser() parser.add_argument('address') args = parser.parse_args() CheckServiceAddress(args.address) GetServerResponse(args.address) if __name__ == "__main__": Main()
apache-2.0
diogovk/ansible
lib/ansible/plugins/lookup/fileglob.py
176
1345
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import glob from ansible.plugins.lookup import LookupBase class LookupModule(LookupBase): def run(self, terms, variables=None, **kwargs): basedir = self.get_basedir(variables) ret = [] for term in terms: term_file = os.path.basename(term) dwimmed_path = self._loader.path_dwim_relative(basedir, 'files', os.path.dirname(term)) globbed = glob.glob(os.path.join(dwimmed_path, term_file)) ret.extend(g for g in globbed if os.path.isfile(g)) return ret
gpl-3.0
beiko-lab/gengis
bin/Lib/idlelib/run.py
3
11789
import sys import linecache import time import socket import traceback import thread import threading import Queue from idlelib import CallTips from idlelib import AutoComplete from idlelib import RemoteDebugger from idlelib import RemoteObjectBrowser from idlelib import StackViewer from idlelib import rpc import __main__ LOCALHOST = '127.0.0.1' try: import warnings except ImportError: pass else: def idle_formatwarning_subproc(message, category, filename, lineno, line=None): """Format warnings the IDLE way""" s = "\nWarning (from warnings module):\n" s += ' File \"%s\", line %s\n' % (filename, lineno) if line is None: line = linecache.getline(filename, lineno) line = line.strip() if line: s += " %s\n" % line s += "%s: %s\n" % (category.__name__, message) return s warnings.formatwarning = idle_formatwarning_subproc # Thread shared globals: Establish a queue between a subthread (which handles # the socket) and the main thread (which runs user code), plus global # completion, exit and interruptable (the main thread) flags: exit_now = False quitting = False interruptable = False def main(del_exitfunc=False): """Start the Python execution server in a subprocess In the Python subprocess, RPCServer is instantiated with handlerclass MyHandler, which inherits register/unregister methods from RPCHandler via the mix-in class SocketIO. When the RPCServer 'server' is instantiated, the TCPServer initialization creates an instance of run.MyHandler and calls its handle() method. handle() instantiates a run.Executive object, passing it a reference to the MyHandler object. That reference is saved as attribute rpchandler of the Executive instance. The Executive methods have access to the reference and can pass it on to entities that they command (e.g. RemoteDebugger.Debugger.start_debugger()). The latter, in turn, can call MyHandler(SocketIO) register/unregister methods via the reference to register and unregister themselves. """ global exit_now global quitting global no_exitfunc no_exitfunc = del_exitfunc #time.sleep(15) # test subprocess not responding try: assert(len(sys.argv) > 1) port = int(sys.argv[-1]) except: print>>sys.stderr, "IDLE Subprocess: no IP port passed in sys.argv." return sys.argv[:] = [""] sockthread = threading.Thread(target=manage_socket, name='SockThread', args=((LOCALHOST, port),)) sockthread.setDaemon(True) sockthread.start() while 1: try: if exit_now: try: exit() except KeyboardInterrupt: # exiting but got an extra KBI? Try again! continue try: seq, request = rpc.request_queue.get(block=True, timeout=0.05) except Queue.Empty: continue method, args, kwargs = request ret = method(*args, **kwargs) rpc.response_queue.put((seq, ret)) except KeyboardInterrupt: if quitting: exit_now = True continue except SystemExit: raise except: type, value, tb = sys.exc_info() try: print_exception() rpc.response_queue.put((seq, None)) except: # Link didn't work, print same exception to __stderr__ traceback.print_exception(type, value, tb, file=sys.__stderr__) exit() else: continue def manage_socket(address): for i in range(3): time.sleep(i) try: server = MyRPCServer(address, MyHandler) break except socket.error, err: print>>sys.__stderr__,"IDLE Subprocess: socket error: "\ + err.args[1] + ", retrying...." else: print>>sys.__stderr__, "IDLE Subprocess: Connection to "\ "IDLE GUI failed, exiting." show_socket_error(err, address) global exit_now exit_now = True return server.handle_request() # A single request only def show_socket_error(err, address): import Tkinter import tkMessageBox root = Tkinter.Tk() root.withdraw() if err.args[0] == 61: # connection refused msg = "IDLE's subprocess can't connect to %s:%d. This may be due "\ "to your personal firewall configuration. It is safe to "\ "allow this internal connection because no data is visible on "\ "external ports." % address tkMessageBox.showerror("IDLE Subprocess Error", msg, parent=root) else: tkMessageBox.showerror("IDLE Subprocess Error", "Socket Error: %s" % err.args[1]) root.destroy() def print_exception(): import linecache linecache.checkcache() flush_stdout() efile = sys.stderr typ, val, tb = excinfo = sys.exc_info() sys.last_type, sys.last_value, sys.last_traceback = excinfo tbe = traceback.extract_tb(tb) print>>efile, '\nTraceback (most recent call last):' exclude = ("run.py", "rpc.py", "threading.py", "Queue.py", "RemoteDebugger.py", "bdb.py") cleanup_traceback(tbe, exclude) traceback.print_list(tbe, file=efile) lines = traceback.format_exception_only(typ, val) for line in lines: print>>efile, line, def cleanup_traceback(tb, exclude): "Remove excluded traces from beginning/end of tb; get cached lines" orig_tb = tb[:] while tb: for rpcfile in exclude: if tb[0][0].count(rpcfile): break # found an exclude, break for: and delete tb[0] else: break # no excludes, have left RPC code, break while: del tb[0] while tb: for rpcfile in exclude: if tb[-1][0].count(rpcfile): break else: break del tb[-1] if len(tb) == 0: # exception was in IDLE internals, don't prune! tb[:] = orig_tb[:] print>>sys.stderr, "** IDLE Internal Exception: " rpchandler = rpc.objecttable['exec'].rpchandler for i in range(len(tb)): fn, ln, nm, line = tb[i] if nm == '?': nm = "-toplevel-" if not line and fn.startswith("<pyshell#"): line = rpchandler.remotecall('linecache', 'getline', (fn, ln), {}) tb[i] = fn, ln, nm, line def flush_stdout(): try: if sys.stdout.softspace: sys.stdout.softspace = 0 sys.stdout.write("\n") except (AttributeError, EOFError): pass def exit(): """Exit subprocess, possibly after first deleting sys.exitfunc If config-main.cfg/.def 'General' 'delete-exitfunc' is True, then any sys.exitfunc will be removed before exiting. (VPython support) """ if no_exitfunc: try: del sys.exitfunc except AttributeError: pass sys.exit(0) class MyRPCServer(rpc.RPCServer): def handle_error(self, request, client_address): """Override RPCServer method for IDLE Interrupt the MainThread and exit server if link is dropped. """ global quitting try: raise except SystemExit: raise except EOFError: global exit_now exit_now = True thread.interrupt_main() except: erf = sys.__stderr__ print>>erf, '\n' + '-'*40 print>>erf, 'Unhandled server exception!' print>>erf, 'Thread: %s' % threading.currentThread().getName() print>>erf, 'Client Address: ', client_address print>>erf, 'Request: ', repr(request) traceback.print_exc(file=erf) print>>erf, '\n*** Unrecoverable, server exiting!' print>>erf, '-'*40 quitting = True thread.interrupt_main() class MyHandler(rpc.RPCHandler): def handle(self): """Override base method""" executive = Executive(self) self.register("exec", executive) sys.stdin = self.console = self.get_remote_proxy("stdin") sys.stdout = self.get_remote_proxy("stdout") sys.stderr = self.get_remote_proxy("stderr") from idlelib import IOBinding sys.stdin.encoding = sys.stdout.encoding = \ sys.stderr.encoding = IOBinding.encoding self.interp = self.get_remote_proxy("interp") rpc.RPCHandler.getresponse(self, myseq=None, wait=0.05) def exithook(self): "override SocketIO method - wait for MainThread to shut us down" time.sleep(10) def EOFhook(self): "Override SocketIO method - terminate wait on callback and exit thread" global quitting quitting = True thread.interrupt_main() def decode_interrupthook(self): "interrupt awakened thread" global quitting quitting = True thread.interrupt_main() class Executive(object): def __init__(self, rpchandler): self.rpchandler = rpchandler self.locals = __main__.__dict__ self.calltip = CallTips.CallTips() self.autocomplete = AutoComplete.AutoComplete() def runcode(self, code): global interruptable try: self.usr_exc_info = None interruptable = True try: exec code in self.locals finally: interruptable = False except: self.usr_exc_info = sys.exc_info() if quitting: exit() # even print a user code SystemExit exception, continue print_exception() jit = self.rpchandler.console.getvar("<<toggle-jit-stack-viewer>>") if jit: self.rpchandler.interp.open_remote_stack_viewer() else: flush_stdout() def interrupt_the_server(self): if interruptable: thread.interrupt_main() def start_the_debugger(self, gui_adap_oid): return RemoteDebugger.start_debugger(self.rpchandler, gui_adap_oid) def stop_the_debugger(self, idb_adap_oid): "Unregister the Idb Adapter. Link objects and Idb then subject to GC" self.rpchandler.unregister(idb_adap_oid) def get_the_calltip(self, name): return self.calltip.fetch_tip(name) def get_the_completion_list(self, what, mode): return self.autocomplete.fetch_completions(what, mode) def stackviewer(self, flist_oid=None): if self.usr_exc_info: typ, val, tb = self.usr_exc_info else: return None flist = None if flist_oid is not None: flist = self.rpchandler.get_remote_proxy(flist_oid) while tb and tb.tb_frame.f_globals["__name__"] in ["rpc", "run"]: tb = tb.tb_next sys.last_type = typ sys.last_value = val item = StackViewer.StackTreeItem(flist, tb) return RemoteObjectBrowser.remote_object_tree_item(item)
gpl-3.0
pperichon/domoticz
plugins/examples/RAVEn.py
1
11003
# RAVEn Plugin # # Author: Dnpwwo, 2016 # # # Plugin parameter definition below will be parsed during startup and copied into Manifest.xml, this will then drive the user interface in the Hardware web page # """ <plugin key="RAVEn" name="RAVEn Zigbee energy monitor" author="dnpwwo" version="1.3.10" externallink="https://rainforestautomation.com/rfa-z106-raven/"> <params> <param field="SerialPort" label="Serial Port" width="150px" required="true" default="/dev/ttyRAVEn"/> <param field="Mode6" label="Debug" width="100px"> <options> <option label="True" value="Debug"/> <option label="False" value="Normal" default="true" /> <option label="Logging" value="File"/> </options> </param> </params> </plugin> """ import Domoticz import xml.etree.ElementTree as ET SerialConn = None demandFreq=30 # seconds between demand events summaryFreq=300 # seconds between summary updates fScale = demandFreq / 3600.0 summation = 0.0 hasConnected = False nextCommand = "" def onStart(): global SerialConn if Parameters["Mode6"] != "Normal": Domoticz.Debugging(1) if Parameters["Mode6"] == "Debug": f = open(Parameters["HomeFolder"]+"plugin.log","w") f.write("Plugin started.") f.close() if (len(Devices) == 0): Domoticz.Device(Name="Usage", Unit=1, Type=243, Subtype=29, Switchtype=0, Image=0, Options="").Create() Domoticz.Device("Total", 2, 113).Create() Domoticz.Log("Devices created.") Domoticz.Log("Plugin has " + str(len(Devices)) + " devices associated with it.") DumpConfigToLog() SerialConn = Domoticz.Connection(Name="RAVEn", Transport="Serial", Protocol="XML", Address=Parameters["SerialPort"], Baud=115200) SerialConn.Connect() return def onConnect(Connection, Status, Description): global SerialConn if (Status == 0): Domoticz.Log("Connected successfully to: "+Parameters["SerialPort"]) Connection.Send("<Command>\n <Name>restart</Name>\n</Command>") SerialConn = Connection else: Domoticz.Log("Failed to connect ("+str(Status)+") to: "+Parameters["SerialPort"]) Domoticz.Debug("Failed to connect ("+str(Status)+") to: "+Parameters["SerialPort"]+" with error: "+Description) return True def onMessage(Connection, Data): global hasConnected, nextCommand, fScale, summation strData = Data.decode("utf-8", "ignore") LogMessage(strData) xmltree = ET.fromstring(strData) if xmltree.tag == 'ConnectionStatus': strLog = "" if (xmltree.find('MeterMacId') != None): strLog = "MeterMacId: "+xmltree.find('MeterMacId').text+", " connectStatus = xmltree.find('Status').text strLog += "Connection Status = '"+connectStatus+"'" if (xmltree.find('Description') != None): strLog += " - "+xmltree.find('Description').text if (xmltree.find('LinkStrength') != None): strLog += ", Link Strength = "+str(int(xmltree.find('LinkStrength').text,16)) Domoticz.Log(strLog) if connectStatus == 'Initializing...': hasConnected = False elif (connectStatus == 'Connected') and (hasConnected == False): nextCommand = "get_device_info" hasConnected = True elif xmltree.tag == 'DeviceInfo': Domoticz.Log( "Manufacturer: %s, Device ID: %s, Install Code: %s" % (xmltree.find('Manufacturer').text, xmltree.find('DeviceMacId').text, xmltree.find('InstallCode').text) ) Domoticz.Log( "Hardware: Version %s, Firmware Version: %s, Model: %s" % (xmltree.find('HWVersion').text, xmltree.find('FWVersion').text, xmltree.find('ModelId').text) ) nextCommand = "get_network_info" elif xmltree.tag == 'NetworkInfo': LogMessage( "NetworkInfo response, Status = '%s' - %s, Link Strength = %d" % (xmltree.find('Status').text, xmltree.find('Description').text, int(xmltree.find('LinkStrength').text,16))) nextCommand = "get_meter_list" elif xmltree.tag == 'MeterList': nextCommand = "" for meter in xmltree.iter('MeterMacId'): LogMessage( "MeterMacId: %s, MeterList response" % meter.text) Connection.Send("<Command>\n <Name>get_meter_info</Name>\n <MeterMacId>"+meter.text+"</MeterMacId>\n</Command>\n") elif xmltree.tag == 'MeterInfo': LogMessage( "MeterMacId: %s, MeterInfo response, Enabled = %s" % (xmltree.find('MeterMacId').text, xmltree.find('Enabled').text)) Connection.Send("<Command>\n <Name>get_schedule</Name>\n <MeterMacId>"+xmltree.find('MeterMacId').text+"</MeterMacId>\n</Command>\n") elif xmltree.tag == 'ScheduleInfo': iFreq = int(xmltree.find('Frequency').text,16) LogMessage( "MeterMacId: %s, ScheduleInfo response: Type '%s', Frequency %d, Enabled %s" % (xmltree.find('MeterMacId').text, xmltree.find('Event').text, iFreq, xmltree.find('Enabled').text)) if (xmltree.find('Event').text == 'demand') and (iFreq != demandFreq): LogMessage( "MeterMacId: %s, Setting 'demand' schedule to: Frequency %d" % (xmltree.find('MeterMacId').text, demandFreq)) Connection.Send("<Command>\n <Name>set_schedule</Name>\n <MeterMacId>"+xmltree.find('MeterMacId').text+"</MeterMacId>\n <Event>demand</Event>\n <Frequency>" + str(hex(demandFreq)) + "</Frequency>\n <Enabled>Y</Enabled>\n</Command>\n") if (xmltree.find('Event').text == 'summation') and (iFreq != summaryFreq): LogMessage( "MeterMacId: %s, Setting 'summation' schedule to: Frequency %d" % (xmltree.find('MeterMacId').text, summaryFreq)) Connection.Send("<Command>\n <Name>set_schedule</Name>\n <MeterMacId>"+xmltree.find('MeterMacId').text+"</MeterMacId>\n <Event>summation</Event>\n <Frequency>" + str(hex(summaryFreq)) + "</Frequency>\n <Enabled>Y</Enabled>\n</Command>\n") if (xmltree.find('Event').text == 'summation'): Connection.Send("<Command>\n <Name>get_current_summation_delivered</Name>\n <MeterMacId>"+xmltree.find('MeterMacId').text+"</MeterMacId>\n <Refresh>Y</Refresh>\n</Command>\n") elif xmltree.tag == 'InstantaneousDemand': demand = float(getInstantDemandKWh(xmltree)) if (summation == 0.0): Domoticz.Log("MeterMacId: %s, Instantaneous Demand = %f, NO SUMMARY DATA" % (xmltree.find('MeterMacId').text, demand)) else: delta = fScale * demand summation = summation + delta Domoticz.Log( "MeterMacId: %s, Instantaneous Demand = %.3f, Summary Total = %.3f, Delta = %f" % (xmltree.find('MeterMacId').text, demand, summation, delta)) sValue = "%.3f;%.3f" % (demand,summation) Devices[1].Update(0, sValue.replace('.','')) elif xmltree.tag == 'CurrentSummationDelivered': total = float(getCurrentSummationKWh(xmltree)) if (total > summation): summation = total sValue = "%.3f" % (total) Devices[2].Update(0, sValue.replace('.','')) Domoticz.Log( "MeterMacId: %s, Current Summation = %.3f" % (xmltree.find('MeterMacId').text, total)) elif xmltree.tag == 'TimeCluster': Domoticz.Debug( xmltree.tag + " response" ) elif xmltree.tag == 'PriceCluster': Domoticz.Debug( xmltree.tag + " response" ) elif xmltree.tag == 'CurrentPeriodUsage': Domoticz.Debug( xmltree.tag + " response" ) elif xmltree.tag == 'LastPeriodUsage': Domoticz.Debug( xmltree.tag + " response" ) elif xmltree.tag == 'ProfileData': Domoticz.Debug( xmltree.tag + " response" ) else: Domoticz.Error("Unrecognised (not implemented) XML Fragment ("+xmltree.tag+").") return def onDisconnect(Connection): Domoticz.Log("Connection '"+Connection.Name+"' disconnected.") return def onHeartbeat(): global hasConnected, nextCommand, SerialConn if (SerialConn.Connected()): if (nextCommand != ""): Domoticz.Debug("Sending command: "+nextCommand) SerialConn.Send("<Command>\n <Name>"+nextCommand+"</Name>\n</Command>\n") else: hasConnected = False SerialConn.Connect() return True # RAVEn support functions def getCurrentSummationKWh(xmltree): '''Returns a single float value for the SummationDelivered from a Summation response from RAVEn''' # Get the Current Summation (Meter Reading) fReading = float(int(xmltree.find('SummationDelivered').text,16)) fResult = calculateRAVEnNumber(xmltree, fReading) return formatRAVEnDigits(xmltree, fResult) def getInstantDemandKWh(xmltree): '''Returns a single float value for the Demand from an Instantaneous Demand response from RAVEn''' # Get the Instantaneous Demand fDemand = float(int(xmltree.find('Demand').text,16)) fResult = calculateRAVEnNumber(xmltree, fDemand) return formatRAVEnDigits(xmltree, fResult) def calculateRAVEnNumber(xmltree, value): '''Calculates a float value from RAVEn using Multiplier and Divisor in XML response''' # Get calculation parameters from XML - Multiplier, Divisor fDivisor = float(int(xmltree.find('Divisor').text,16)) fMultiplier = float(int(xmltree.find('Multiplier').text,16)) if (fMultiplier > 0 and fDivisor > 0): fResult = float( (value * fMultiplier) / fDivisor) elif (fMultiplier > 0): fResult = float(value * fMultiplier) else: # (Divisor > 0) or anything else fResult = float(value / fDivisor) return fResult def formatRAVEnDigits(xmltree, value): '''Formats a float value according to DigitsRight, DigitsLeft and SuppressLeadingZero settings from RAVEn XML response''' # Get formatting parameters from XML - DigitsRight, DigitsLeft iDigitsRight = int(xmltree.find('DigitsRight').text,16) iDigitsLeft = int(xmltree.find('DigitsLeft').text,16) sResult = ("{:0%d.%df}" % (iDigitsLeft+iDigitsRight+1,iDigitsRight)).format(value) # Suppress Leading Zeros if specified in XML if xmltree.find('SuppressLeadingZero').text == 'Y': while sResult[0] == '0': sResult = sResult[1:] if sResult[0] == '.': sResult = '0' + sResult return sResult # Generic helper functions def LogMessage(Message): if Parameters["Mode6"] == "File": f = open(Parameters["HomeFolder"]+"plugin.log","a") f.write(Message+"\r\n") f.close() Domoticz.Debug(Message) def DumpConfigToLog(): for x in Parameters: if Parameters[x] != "": LogMessage( "'" + x + "':'" + str(Parameters[x]) + "'") LogMessage("Device count: " + str(len(Devices))) for x in Devices: LogMessage("Device: " + str(x) + " - " + str(Devices[x])) LogMessage("Device ID: '" + str(Devices[x].ID) + "'") LogMessage("Device Name: '" + Devices[x].Name + "'") LogMessage("Device nValue: " + str(Devices[x].nValue)) LogMessage("Device sValue: '" + Devices[x].sValue + "'") LogMessage("Device LastLevel: " + str(Devices[x].LastLevel)) return
gpl-3.0
ProfessionalIT/professionalit-webiste
sdk/google_appengine/lib/django-0.96/django/views/debug.py
32
23633
from django.conf import settings from django.template import Template, Context, TemplateDoesNotExist from django.utils.html import escape from django.http import HttpResponseServerError, HttpResponseNotFound import os, re HIDDEN_SETTINGS = re.compile('SECRET|PASSWORD|PROFANITIES_LIST') def linebreak_iter(template_source): yield 0 p = template_source.find('\n') while p >= 0: yield p+1 p = template_source.find('\n', p+1) yield len(template_source) + 1 def get_template_exception_info(exc_type, exc_value, tb): origin, (start, end) = exc_value.source template_source = origin.reload() context_lines = 10 line = 0 upto = 0 source_lines = [] before = during = after = "" for num, next in enumerate(linebreak_iter(template_source)): if start >= upto and end <= next: line = num before = escape(template_source[upto:start]) during = escape(template_source[start:end]) after = escape(template_source[end:next]) source_lines.append( (num, escape(template_source[upto:next])) ) upto = next total = len(source_lines) top = max(1, line - context_lines) bottom = min(total, line + 1 + context_lines) template_info = { 'message': exc_value.args[0], 'source_lines': source_lines[top:bottom], 'before': before, 'during': during, 'after': after, 'top': top, 'bottom': bottom, 'total': total, 'line': line, 'name': origin.name, } exc_info = hasattr(exc_value, 'exc_info') and exc_value.exc_info or (exc_type, exc_value, tb) return exc_info + (template_info,) def get_safe_settings(): "Returns a dictionary of the settings module, with sensitive settings blurred out." settings_dict = {} for k in dir(settings): if k.isupper(): if HIDDEN_SETTINGS.search(k): settings_dict[k] = '********************' else: settings_dict[k] = getattr(settings, k) return settings_dict def technical_500_response(request, exc_type, exc_value, tb): """ Create a technical server error response. The last three arguments are the values returned from sys.exc_info() and friends. """ template_info = None template_does_not_exist = False loader_debug_info = None if issubclass(exc_type, TemplateDoesNotExist): from django.template.loader import template_source_loaders template_does_not_exist = True loader_debug_info = [] for loader in template_source_loaders: try: source_list_func = getattr(__import__(loader.__module__, {}, {}, ['get_template_sources']), 'get_template_sources') # NOTE: This assumes exc_value is the name of the template that # the loader attempted to load. template_list = [{'name': t, 'exists': os.path.exists(t)} \ for t in source_list_func(str(exc_value))] except (ImportError, AttributeError): template_list = [] loader_debug_info.append({ 'loader': loader.__module__ + '.' + loader.__name__, 'templates': template_list, }) if settings.TEMPLATE_DEBUG and hasattr(exc_value, 'source'): exc_type, exc_value, tb, template_info = get_template_exception_info(exc_type, exc_value, tb) frames = [] while tb is not None: filename = tb.tb_frame.f_code.co_filename function = tb.tb_frame.f_code.co_name lineno = tb.tb_lineno - 1 pre_context_lineno, pre_context, context_line, post_context = _get_lines_from_file(filename, lineno, 7) if pre_context_lineno: frames.append({ 'tb': tb, 'filename': filename, 'function': function, 'lineno': lineno + 1, 'vars': tb.tb_frame.f_locals.items(), 'id': id(tb), 'pre_context': pre_context, 'context_line': context_line, 'post_context': post_context, 'pre_context_lineno': pre_context_lineno + 1, }) tb = tb.tb_next if not frames: frames = [{ 'filename': '&lt;unknown&gt;', 'function': '?', 'lineno': '?', }] t = Template(TECHNICAL_500_TEMPLATE, name='Technical 500 template') c = Context({ 'exception_type': exc_type.__name__, 'exception_value': exc_value, 'frames': frames, 'lastframe': frames[-1], 'request': request, 'request_protocol': request.is_secure() and "https" or "http", 'settings': get_safe_settings(), 'template_info': template_info, 'template_does_not_exist': template_does_not_exist, 'loader_debug_info': loader_debug_info, }) return HttpResponseServerError(t.render(c), mimetype='text/html') def technical_404_response(request, exception): "Create a technical 404 error response. The exception should be the Http404." try: tried = exception.args[0]['tried'] except (IndexError, TypeError): tried = [] else: if not tried: # tried exists but is an empty list. The URLconf must've been empty. return empty_urlconf(request) t = Template(TECHNICAL_404_TEMPLATE, name='Technical 404 template') c = Context({ 'root_urlconf': settings.ROOT_URLCONF, 'urlpatterns': tried, 'reason': str(exception), 'request': request, 'request_protocol': request.is_secure() and "https" or "http", 'settings': get_safe_settings(), }) return HttpResponseNotFound(t.render(c), mimetype='text/html') def empty_urlconf(request): "Create an empty URLconf 404 error response." t = Template(EMPTY_URLCONF_TEMPLATE, name='Empty URLConf template') c = Context({ 'project_name': settings.SETTINGS_MODULE.split('.')[0] }) return HttpResponseNotFound(t.render(c), mimetype='text/html') def _get_lines_from_file(filename, lineno, context_lines): """ Returns context_lines before and after lineno from file. Returns (pre_context_lineno, pre_context, context_line, post_context). """ try: source = open(filename).readlines() lower_bound = max(0, lineno - context_lines) upper_bound = lineno + context_lines pre_context = [line.strip('\n') for line in source[lower_bound:lineno]] context_line = source[lineno].strip('\n') post_context = [line.strip('\n') for line in source[lineno+1:upper_bound]] return lower_bound, pre_context, context_line, post_context except (OSError, IOError): return None, [], None, [] # # Templates are embedded in the file so that we know the error handler will # always work even if the template loader is broken. # TECHNICAL_500_TEMPLATE = """ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="robots" content="NONE,NOARCHIVE" /> <title>{{ exception_type }} at {{ request.path|escape }}</title> <style type="text/css"> html * { padding:0; margin:0; } body * { padding:10px 20px; } body * * { padding:0; } body { font:small sans-serif; } body>div { border-bottom:1px solid #ddd; } h1 { font-weight:normal; } h2 { margin-bottom:.8em; } h2 span { font-size:80%; color:#666; font-weight:normal; } h3 { margin:1em 0 .5em 0; } h4 { margin:0 0 .5em 0; font-weight: normal; } table { border:1px solid #ccc; border-collapse: collapse; width:100%; background:white; } tbody td, tbody th { vertical-align:top; padding:2px 3px; } thead th { padding:1px 6px 1px 3px; background:#fefefe; text-align:left; font-weight:normal; font-size:11px; border:1px solid #ddd; } tbody th { width:12em; text-align:right; color:#666; padding-right:.5em; } table.vars { margin:5px 0 2px 40px; } table.vars td, table.req td { font-family:monospace; } table td.code { width:100%; } table td.code div { overflow:hidden; } table.source th { color:#666; } table.source td { font-family:monospace; white-space:pre; border-bottom:1px solid #eee; } ul.traceback { list-style-type:none; } ul.traceback li.frame { margin-bottom:1em; } div.context { margin: 10px 0; } div.context ol { padding-left:30px; margin:0 10px; list-style-position: inside; } div.context ol li { font-family:monospace; white-space:pre; color:#666; cursor:pointer; } div.context ol.context-line li { color:black; background-color:#ccc; } div.context ol.context-line li span { float: right; } div.commands { margin-left: 40px; } div.commands a { color:black; text-decoration:none; } #summary { background: #ffc; } #summary h2 { font-weight: normal; color: #666; } #explanation { background:#eee; } #template, #template-not-exist { background:#f6f6f6; } #template-not-exist ul { margin: 0 0 0 20px; } #traceback { background:#eee; } #requestinfo { background:#f6f6f6; padding-left:120px; } #summary table { border:none; background:transparent; } #requestinfo h2, #requestinfo h3 { position:relative; margin-left:-100px; } #requestinfo h3 { margin-bottom:-1em; } .error { background: #ffc; } .specific { color:#cc3300; font-weight:bold; } </style> <script type="text/javascript"> //<!-- function getElementsByClassName(oElm, strTagName, strClassName){ // Written by Jonathan Snook, http://www.snook.ca/jon; Add-ons by Robert Nyman, http://www.robertnyman.com var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName); var arrReturnElements = new Array(); strClassName = strClassName.replace(/\-/g, "\\-"); var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)"); var oElement; for(var i=0; i<arrElements.length; i++){ oElement = arrElements[i]; if(oRegExp.test(oElement.className)){ arrReturnElements.push(oElement); } } return (arrReturnElements) } function hideAll(elems) { for (var e = 0; e < elems.length; e++) { elems[e].style.display = 'none'; } } window.onload = function() { hideAll(getElementsByClassName(document, 'table', 'vars')); hideAll(getElementsByClassName(document, 'ol', 'pre-context')); hideAll(getElementsByClassName(document, 'ol', 'post-context')); hideAll(getElementsByClassName(document, 'div', 'pastebin')); } function toggle() { for (var i = 0; i < arguments.length; i++) { var e = document.getElementById(arguments[i]); if (e) { e.style.display = e.style.display == 'none' ? 'block' : 'none'; } } return false; } function varToggle(link, id) { toggle('v' + id); var s = link.getElementsByTagName('span')[0]; var uarr = String.fromCharCode(0x25b6); var darr = String.fromCharCode(0x25bc); s.innerHTML = s.innerHTML == uarr ? darr : uarr; return false; } function switchPastebinFriendly(link) { s1 = "Switch to copy-and-paste view"; s2 = "Switch back to interactive view"; link.innerHTML = link.innerHTML == s1 ? s2 : s1; toggle('browserTraceback', 'pastebinTraceback'); return false; } //--> </script> </head> <body> <div id="summary"> <h1>{{ exception_type }} at {{ request.path|escape }}</h1> <h2>{{ exception_value|escape }}</h2> <table class="meta"> <tr> <th>Request Method:</th> <td>{{ request.META.REQUEST_METHOD }}</td> </tr> <tr> <th>Request URL:</th> <td>{{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path|escape }}</td> </tr> <tr> <th>Exception Type:</th> <td>{{ exception_type }}</td> </tr> <tr> <th>Exception Value:</th> <td>{{ exception_value|escape }}</td> </tr> <tr> <th>Exception Location:</th> <td>{{ lastframe.filename }} in {{ lastframe.function }}, line {{ lastframe.lineno }}</td> </tr> </table> </div> {% if template_does_not_exist %} <div id="template-not-exist"> <h2>Template-loader postmortem</h2> {% if loader_debug_info %} <p>Django tried loading these templates, in this order:</p> <ul> {% for loader in loader_debug_info %} <li>Using loader <code>{{ loader.loader }}</code>: <ul>{% for t in loader.templates %}<li><code>{{ t.name }}</code> (File {% if t.exists %}exists{% else %}does not exist{% endif %})</li>{% endfor %}</ul> </li> {% endfor %} </ul> {% else %} <p>Django couldn't find any templates because your <code>TEMPLATE_LOADERS</code> setting is empty!</p> {% endif %} </div> {% endif %} {% if template_info %} <div id="template"> <h2>Template error</h2> <p>In template <code>{{ template_info.name }}</code>, error at line <strong>{{ template_info.line }}</strong></p> <h3>{{ template_info.message|escape }}</h3> <table class="source{% if template_info.top %} cut-top{% endif %}{% ifnotequal template_info.bottom template_info.total %} cut-bottom{% endifnotequal %}"> {% for source_line in template_info.source_lines %} {% ifequal source_line.0 template_info.line %} <tr class="error"><th>{{ source_line.0 }}</th> <td>{{ template_info.before }}<span class="specific">{{ template_info.during }}</span>{{ template_info.after }}</td></tr> {% else %} <tr><th>{{ source_line.0 }}</th> <td>{{ source_line.1 }}</td></tr> {% endifequal %} {% endfor %} </table> </div> {% endif %} <div id="traceback"> <h2>Traceback <span>(innermost last)</span></h2> <div class="commands"><a href="#" onclick="return switchPastebinFriendly(this);">Switch to copy-and-paste view</a></div> <br/> <div id="browserTraceback"> <ul class="traceback"> {% for frame in frames %} <li class="frame"> <code>{{ frame.filename }}</code> in <code>{{ frame.function }}</code> {% if frame.context_line %} <div class="context" id="c{{ frame.id }}"> {% if frame.pre_context %} <ol start="{{ frame.pre_context_lineno }}" class="pre-context" id="pre{{ frame.id }}">{% for line in frame.pre_context %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ line|escape }}</li>{% endfor %}</ol> {% endif %} <ol start="{{ frame.lineno }}" class="context-line"><li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ frame.context_line|escape }} <span>...</span></li></ol> {% if frame.post_context %} <ol start='{{ frame.lineno|add:"1" }}' class="post-context" id="post{{ frame.id }}">{% for line in frame.post_context %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ line|escape }}</li>{% endfor %}</ol> {% endif %} </div> {% endif %} {% if frame.vars %} <div class="commands"> <a href="#" onclick="return varToggle(this, '{{ frame.id }}')"><span>&#x25b6;</span> Local vars</a> </div> <table class="vars" id="v{{ frame.id }}"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> {% for var in frame.vars|dictsort:"0" %} <tr> <td>{{ var.0 }}</td> <td class="code"><div>{{ var.1|pprint|escape }}</div></td> </tr> {% endfor %} </tbody> </table> {% endif %} </li> {% endfor %} </ul> </div> <div id="pastebinTraceback" class="pastebin"> <table> <tbody> <tr> <td> <code> Traceback (most recent call last):<br/> {% for frame in frames %} File "{{ frame.filename }}" in {{ frame.function }}<br/> {% if frame.context_line %} &nbsp;&nbsp;{{ frame.lineno }}. {{ frame.context_line|escape }}<br/> {% endif %} {% endfor %}<br/> &nbsp;&nbsp;{{ exception_type }} at {{ request.path|escape }}<br/> &nbsp;&nbsp;{{ exception_value|escape }}</code> </td> </tr> </tbody> </table> </div> </div> <div id="requestinfo"> <h2>Request information</h2> <h3 id="get-info">GET</h3> {% if request.GET %} <table class="req"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> {% for var in request.GET.items %} <tr> <td>{{ var.0 }}</td> <td class="code"><div>{{ var.1|pprint|escape }}</div></td> </tr> {% endfor %} </tbody> </table> {% else %} <p>No GET data</p> {% endif %} <h3 id="post-info">POST</h3> {% if request.POST %} <table class="req"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> {% for var in request.POST.items %} <tr> <td>{{ var.0 }}</td> <td class="code"><div>{{ var.1|pprint|escape }}</div></td> </tr> {% endfor %} </tbody> </table> {% else %} <p>No POST data</p> {% endif %} <h3 id="cookie-info">COOKIES</h3> {% if request.COOKIES %} <table class="req"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> {% for var in request.COOKIES.items %} <tr> <td>{{ var.0 }}</td> <td class="code"><div>{{ var.1|pprint|escape }}</div></td> </tr> {% endfor %} </tbody> </table> {% else %} <p>No cookie data</p> {% endif %} <h3 id="meta-info">META</h3> <table class="req"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> {% for var in request.META.items|dictsort:"0" %} <tr> <td>{{ var.0 }}</td> <td class="code"><div>{{ var.1|pprint|escape }}</div></td> </tr> {% endfor %} </tbody> </table> <h3 id="settings-info">Settings</h3> <h4>Using settings module <code>{{ settings.SETTINGS_MODULE }}</code></h4> <table class="req"> <thead> <tr> <th>Setting</th> <th>Value</th> </tr> </thead> <tbody> {% for var in settings.items|dictsort:"0" %} <tr> <td>{{ var.0 }}</td> <td class="code"><div>{{ var.1|pprint|escape }}</div></td> </tr> {% endfor %} </tbody> </table> </div> <div id="explanation"> <p> You're seeing this error because you have <code>DEBUG = True</code> in your Django settings file. Change that to <code>False</code>, and Django will display a standard 500 page. </p> </div> </body> </html> """ TECHNICAL_404_TEMPLATE = """ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Page not found at {{ request.path|escape }}</title> <meta name="robots" content="NONE,NOARCHIVE" /> <style type="text/css"> html * { padding:0; margin:0; } body * { padding:10px 20px; } body * * { padding:0; } body { font:small sans-serif; background:#eee; } body>div { border-bottom:1px solid #ddd; } h1 { font-weight:normal; margin-bottom:.4em; } h1 span { font-size:60%; color:#666; font-weight:normal; } table { border:none; border-collapse: collapse; width:100%; } td, th { vertical-align:top; padding:2px 3px; } th { width:12em; text-align:right; color:#666; padding-right:.5em; } #info { background:#f6f6f6; } #info ol { margin: 0.5em 4em; } #info ol li { font-family: monospace; } #summary { background: #ffc; } #explanation { background:#eee; border-bottom: 0px none; } </style> </head> <body> <div id="summary"> <h1>Page not found <span>(404)</span></h1> <table class="meta"> <tr> <th>Request Method:</th> <td>{{ request.META.REQUEST_METHOD }}</td> </tr> <tr> <th>Request URL:</th> <td>{{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path|escape }}</td> </tr> </table> </div> <div id="info"> {% if urlpatterns %} <p> Using the URLconf defined in <code>{{ settings.ROOT_URLCONF }}</code>, Django tried these URL patterns, in this order: </p> <ol> {% for pattern in urlpatterns %} <li>{{ pattern|escape }}</li> {% endfor %} </ol> <p>The current URL, <code>{{ request.path|escape }}</code>, didn't match any of these.</p> {% else %} <p>{{ reason|escape }}</p> {% endif %} </div> <div id="explanation"> <p> You're seeing this error because you have <code>DEBUG = True</code> in your Django settings file. Change that to <code>False</code>, and Django will display a standard 404 page. </p> </div> </body> </html> """ EMPTY_URLCONF_TEMPLATE = """ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"><head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="robots" content="NONE,NOARCHIVE"><title>Welcome to Django</title> <style type="text/css"> html * { padding:0; margin:0; } body * { padding:10px 20px; } body * * { padding:0; } body { font:small sans-serif; } body>div { border-bottom:1px solid #ddd; } h1 { font-weight:normal; } h2 { margin-bottom:.8em; } h2 span { font-size:80%; color:#666; font-weight:normal; } h3 { margin:1em 0 .5em 0; } h4 { margin:0 0 .5em 0; font-weight: normal; } table { border:1px solid #ccc; border-collapse: collapse; width:100%; background:white; } tbody td, tbody th { vertical-align:top; padding:2px 3px; } thead th { padding:1px 6px 1px 3px; background:#fefefe; text-align:left; font-weight:normal; font-size:11px; border:1px solid #ddd; } tbody th { width:12em; text-align:right; color:#666; padding-right:.5em; } ul { margin-left: 2em; margin-top: 1em; } #summary { background: #e0ebff; } #summary h2 { font-weight: normal; color: #666; } #explanation { background:#eee; } #instructions { background:#f6f6f6; } #summary table { border:none; background:transparent; } </style> </head> <body> <div id="summary"> <h1>It worked!</h1> <h2>Congratulations on your first Django-powered page.</h2> </div> <div id="instructions"> <p>Of course, you haven't actually done any work yet. Here's what to do next:</p> <ul> <li>If you plan to use a database, edit the <code>DATABASE_*</code> settings in <code>{{ project_name }}/settings.py</code>.</li> <li>Start your first app by running <code>python {{ project_name }}/manage.py startapp [appname]</code>.</li> </ul> </div> <div id="explanation"> <p> You're seeing this message because you have <code>DEBUG = True</code> in your Django settings file and you haven't configured any URLs. Get to work! </p> </div> </body></html> """
lgpl-3.0
cmisenas/artos
PyARTOS/GUI/CameraWindow.py
2
17193
"""Provides the CameraDetection class which creates a window for detecting objects in a video stream.""" try: # Python 3 import tkinter as Tkinter from tkinter import N, E, S, W from tkinter import ttk from tkinter import messagebox as tkMessageBox from tkinter import filedialog as tkFileDialog except: # Python 2 import Tkinter from Tkinter import N, E, S, W import ttk import tkMessageBox import tkFileDialog import os, gc from glob import glob from threading import Thread, Lock, Event try: from PIL import Image, ImageTk except: import Image, ImageTk from . import gui_utils from .. import utils, detecting from ..config import config from ..Camera.Capture import Capture from ..artos_wrapper import libartos # just for checking if the library could be loaded class DetectionFrame(ttk.Frame): """A frame displaying the class names and scores of possible detections.""" def _createWidgets(self): self._frames, self._classnameVars, self._scoreVars = [], [], [] for i in range(self.maxDetections): self._classnameVars.append(Tkinter.StringVar(self)) self._scoreVars.append(Tkinter.StringVar(self)) newFrame = ttk.Frame(self, style = 'CameraDetection.TFrame', padding = 5) newFrame._showing = False newFrame._lblClassname = ttk.Label(newFrame, textvariable = self._classnameVars[-1], style = 'CameraDetectionLabel.TLabel', font = 'TkDefaultFont 10 bold') newFrame._lblClassname.pack(side = 'top', fill = 'x') newFrame._lblScore = ttk.Label(newFrame, textvariable = self._scoreVars[-1], style = 'CameraDetectionLabel.TLabel') newFrame._lblScore.pack(side = 'top', fill = 'x') self._frames.append(newFrame) def _updateDetections(self): """Updates the displayed data according to the detections attribute.""" # Update labels and display frames for i, d in enumerate(self.detections): self._classnameVars[i].set(d.classname) self._scoreVars[i].set('Score: {:.4f}'.format(d.score)) self._frames[i]._lblClassname['foreground'] = gui_utils.rgb2hex(self.colorMap[d.classname]) if d.classname in self.colorMap else '#000000' if not self._frames[i]._showing: self._frames[i].pack(side = 'top', fill = 'x', pady = (0, 6)) self._frames[i]._showing = True # Hide unused frames for i in range(len(self.detections), self.maxDetections): if self._frames[i]._showing: self._frames[i].forget() self._frames[i]._showing = False else: break def __init__(self, master, maxDetections = 3, detections = (), colorMap = {}): """Creates a new DetectionFrame instance. maxDetections - Maximum number of detections to display (can't be changed later). detections - Detections as detecting.Detection objects (can be changed at any time by setting the detections attribute). colorMap - A dictionary that maps class names to colors which they should be displayed in. If a class name can not be found in this dictionary, it will be shown in black. Colors are expected to be given as (R, G, B) triples. """ ttk.Frame.__init__(self, master) self.__dict__['maxDetections'] = maxDetections self._createWidgets() self.bind('<Destroy>', self.onDestroy) self.__dict__['colorMap'] = colorMap self.detections = detections def onDestroy(self, evt): if (evt.widget is self): # Break reference cycles del self._classnameVars del self._scoreVars def __getattr__(self, name): if (name in self.__dict__): return self.__dict__[name] else: raise AttributeError('Attribute {} is not defined.'.format(name)) def __setattr__(self, name, value): if (name == 'maxDetections'): raise AttributeError('{0} is a read-only property'.format(name)) else: self.__dict__[name] = value if (name in ('detections', 'colorMap')): self._updateDetections() class CameraWindow(Tkinter.Toplevel): """A toplevel window that is used to detect objects in a video stream from a camera.""" def selectModelDir(self): """Shows a dialog for selecting the model directory.""" newDir = tkFileDialog.askdirectory(parent = self, mustexist = True, initialdir = self.modelDir.get()) if (newDir != ''): self.modelDir.set(newDir) self.initializeDetector() def initializeDetector(self): """Initializes the detector with the models from the directory specified in the Entry component.""" if (libartos is None): tkMessageBox.showerror(title = 'Library not found', message = 'libartos could not be found and loaded.') elif (self.modelDir.get() == '') or (not os.path.isdir(self.modelDir.get())): tkMessageBox.showerror(title = 'No model directory', message = 'The model directory could not be found.') else: # Search for model files models = glob(os.path.join(self.modelDir.get(), '*.txt')) # Search for a model list file modelList = os.path.join(self.modelDir.get(), 'models.list') if not os.path.isfile(modelList): modelList = None # Check if either a model list file exists or some models could be found in the directory if ((modelList is None) and (len(models) == 0)): tkMessageBox.showerror(title = 'No models found', message = 'The specified directory does not contain any model file.') else: self.detectorLock.acquire() try: # Destroy old detector (if any) if not (self.detector is None): del self.detector # Create new detector self.detector = detecting.Detector() if not (modelList is None): self.numModels = self.detector.addModels(modelList) else: for m in models: self.detector.addModel(utils.classnameFromFilename(m), m, 0.8) self.numModels = len(models) except Exception as e: tkMessageBox.showerror(title = 'Detector initialization failed', message = 'Could not initialize detector:\n{!s}'.format(e)) self.detector = None self.detectorLock.release() def changeDevice(self, deviceIndex): """Changes the currently active video device. deviceIndex specifies the index of the new device; negative values will stop the video capture. This function guarantees that a detector has been initialized and is available before capture starts. """ if (self.currentDeviceIndex != deviceIndex): if not (self.currentDevice is None): self.after_cancel(self.pollId) del self.currentDevice # stop running capture if (deviceIndex < 0): self.fpsText.set('No device opened') del self.lblVideo._img self.lblVideo["image"] = None self.frmDetection.detections = () self.currentDeviceIndex = -1 self.currentDevice = None gc.collect() # free some memory else: if self.detector is None: self.initializeDetector() if not (self.detector is None): if not self.detectorThread.is_alive(): self.detectorThread.start() self.currentDeviceIndex = deviceIndex self.currentDevice = Capture(deviceIndex) self.fpsTimer.start() self.fpsFrameCount = 0 self.pollVideoFrame() def pollVideoFrame(self): """Periodically grabs a snapshot from the currently active video device and displays it.""" try: frame = self.currentDevice.grabFrame() if not (frame is None): # Scale down if camera input is high-resolution if (frame.size[0] > self.maxVideoSize[0]) or (frame.size[1] > self.maxVideoSize[1]): frame.thumbnail(self.maxVideoSize, Image.BILINEAR) # Draw bounding boxes for d in self.detections: frame = d.drawToImage(frame, self.colorMap[d.classname] if d.classname in self.colorMap else (0, 0, 0)) # Update image on video label self.lblVideo._img = ImageTk.PhotoImage(frame) self.lblVideo["image"] = self.lblVideo._img # Calculate FPS self.fpsFrameCount += 1 if (self.fpsFrameCount == 10): self.fpsTimer.stop() self.fpsFrameCount = 0 self.fpsTimer.start() # Check for new detection results if self.detectionsAvailable.is_set(): for d in self.detections: if not d.classname in self.colorMap: self.colorMap[d.classname] = gui_utils.getAnnotationColor(self.nextColorIndex) self.nextColorIndex += 1 self.frmDetection.detections = self.detections self.detectionsAvailable.clear() self.detectionTimer.stop() # Provide a copy of the frame to the detecting thread if self.needNewFrame.is_set(): self.detectionFrame = frame.copy() self.needNewFrame.clear() self.frameAvailable.set() self.detectionTimer.start() # Update frame and detection rate self.fpsText.set('{:.1f} frames/sec | {:.1f} detections/sec | {:d} models loaded'.format(\ 10.0 * self.fpsTimer.rate, self.detectionTimer.rate, self.numModels)) finally: if not self.currentDevice is None: self.pollId = self.after(1, self.pollVideoFrame) def detect_threaded(self): """Detects objects in the video stream in a separate thread.""" self.needNewFrame.set() while not self.terminateThread.is_set(): if self.frameAvailable.wait(1): self.frameAvailable.clear() self.detectorLock.acquire() try: self.detections = self.detector.detect(self.detectionFrame) finally: self.detectorLock.release() self.detectionsAvailable.set() self.needNewFrame.set() def _createWidgets(self): s = ttk.Style(self.master) s.configure("CameraDetection.TFrame", background = '#cacaca') s.configure("CameraDetectionLabel.TLabel", background = '#cacaca') # Labels for images from stream and FPS inside a frame: self.frmVideo = ttk.Frame(self) self.frmVideo.pack(side = 'left', fill = 'y') self.lblVideo = ttk.Label(self.frmVideo, background = '#000000') self.lblVideo.pack(side = 'top', fill = 'both', expand = True) self.lblFPS = ttk.Label(self.frmVideo, textvariable = self.fpsText, anchor = 'center') self.lblFPS.pack(side = 'top', fill = 'x') # Container for control elements: self.frmCtrl = ttk.Frame(self) self.frmCtrl.pack(side = 'left', fill = 'y', expand = True, padx = 20, pady = 20) # Frame to display the detection results on: self.frmDetection = DetectionFrame(self.frmCtrl, colorMap = self.colorMap) self.frmDetection.pack(side = 'top', fill = 'both', expand = True, pady = (0, 20)) # Buttons for device selection: self.deviceButtons = [] self.deviceButtons.append(ttk.Button(self.frmCtrl, text = 'Stop', command = lambda: self.changeDevice(-1))) self.deviceButtons[-1].pack(side = 'top', fill = 'x') for devIndex, devName in self.devices: self.deviceButtons.append(ttk.Button(self.frmCtrl, text = devName, command = (lambda di = devIndex: self.changeDevice(di)))) self.deviceButtons[-1].pack(side = 'top', fill = 'x') # Label "Model Directory": self.lblModelDir = ttk.Label(self.frmCtrl, text = 'Model Directory:') self.lblModelDir.pack(side = 'top', fill = 'x', pady = (20, 0)) # Entry for model directory path: self.entrModelDir = ttk.Entry(self.frmCtrl, textvariable = self.modelDir) self.entrModelDir.pack(side = 'left', expand = True) # Button for choosing a model directory: self.btnModelDir = ttk.Button(self.frmCtrl, text = '...', width = 3, command = self.selectModelDir) self.btnModelDir.pack(side = 'left') # Button for setting the model directory: self.btnSetModelDir = ttk.Button(self.frmCtrl, text = 'Set', width = 5, command = self.initializeDetector) self.btnSetModelDir.pack(side = 'left') def __init__(self, master = None, autostart = True): Tkinter.Toplevel.__init__(self, master) try: self.master.state('withdrawn') except: pass # Intialize window self.title('Live Camera Detection') self.resizable(False, False) self.bind('<Destroy>', self.onDestroy, True) # Initialize video and detection related member variables self.devices = Capture.enumerateDevices() self.numModels = 0 self.colorMap = {} self.nextColorIndex = 0 self.maxVideoSize = tuple(config.getInt('GUI', x, min = 64) for x in ('max_video_width', 'max_video_height')) self.detector = None # Detector instance created by initializeDetector() self.detections = () self.detectionFrame = None # copy of a video frame for the detecting thread to work on self.detectorThread = Thread(name = 'CameraDetectorThread', target = self.detect_threaded) self.detectorLock = Lock() self.needNewFrame = Event() # signalled if the detecting thread request a new frame self.frameAvailable = Event() # signalled if a frame has been provided in 'detectionFrame' for the detecting thread self.detectionsAvailable = Event() # signalled if the detecting thread has stored new results in 'detections' self.terminateThread = Event() # signalled if the detecting thread shall terminate self.currentDevice = None # Capture object of the currently opened device self.currentDeviceIndex = -1 self.fpsTimer = utils.Timer(1) self.fpsFrameCount = 0 self.detectionTimer = utils.Timer(5) # Create slave widgets self.modelDir = Tkinter.StringVar(master = self, value = config.get('libartos', 'model_dir')) self.fpsText = Tkinter.StringVar(master = self, value = 'No device opened') self._createWidgets() # Autostart if (len(self.devices) > 0): if (autostart and (self.modelDir.get() != '')): self.changeDevice(0) # start video stream on first device available else: tkMessageBox.showerror(title = 'No video device available', message = 'Could not find any supported video device.') def onDestroy(self, evt): if (evt.widget is self): if not (self.currentDevice is None): self.after_cancel(self.pollId) # Stop detecting thread if self.detectorThread.is_alive(): self.terminateThread.set() self.detectorThread.join() # Stop running capture if not (self.currentDevice is None): del self.currentDevice # Cleanup try: self.master.state('normal') self.master.wait_visibility() self.master.lift() self.master.deiconify() del self.master.wndBatch # Break reference cycles of TCL variables, because their # __del__ method prevents the garbage collector from freeing them: del self.modelDir del self.fpsText del self.lblVideo._img except: pass
gpl-3.0
J861449197/edx-platform
common/djangoapps/student/migrations/0050_auto__add_manualenrollmentaudit.py
84
17352
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'ManualEnrollmentAudit' db.create_table('student_manualenrollmentaudit', ( ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('enrollment', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['student.CourseEnrollment'], null=True)), ('enrolled_by', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True)), ('enrolled_email', self.gf('django.db.models.fields.CharField')(max_length=255, db_index=True)), ('time_stamp', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, null=True, blank=True)), ('state_transition', self.gf('django.db.models.fields.CharField')(max_length=255)), ('reason', self.gf('django.db.models.fields.TextField')(null=True)), )) db.send_create_signal('student', ['ManualEnrollmentAudit']) def backwards(self, orm): # Deleting model 'ManualEnrollmentAudit' db.delete_table('student_manualenrollmentaudit') models = { 'auth.group': { 'Meta': {'object_name': 'Group'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) }, 'auth.permission': { 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) }, 'auth.user': { 'Meta': {'object_name': 'User'}, 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) }, 'contenttypes.contenttype': { 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) }, 'student.anonymoususerid': { 'Meta': {'object_name': 'AnonymousUserId'}, 'anonymous_user_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32'}), 'course_id': ('xmodule_django.models.CourseKeyField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) }, 'student.courseaccessrole': { 'Meta': {'unique_together': "(('user', 'org', 'course_id', 'role'),)", 'object_name': 'CourseAccessRole'}, 'course_id': ('xmodule_django.models.CourseKeyField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'org': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '64', 'blank': 'True'}), 'role': ('django.db.models.fields.CharField', [], {'max_length': '64', 'db_index': 'True'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) }, 'student.courseenrollment': { 'Meta': {'ordering': "('user', 'course_id')", 'unique_together': "(('user', 'course_id'),)", 'object_name': 'CourseEnrollment'}, 'course_id': ('xmodule_django.models.CourseKeyField', [], {'max_length': '255', 'db_index': 'True'}), 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'db_index': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'mode': ('django.db.models.fields.CharField', [], {'default': "'honor'", 'max_length': '100'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) }, 'student.courseenrollmentallowed': { 'Meta': {'unique_together': "(('email', 'course_id'),)", 'object_name': 'CourseEnrollmentAllowed'}, 'auto_enroll': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'course_id': ('xmodule_django.models.CourseKeyField', [], {'max_length': '255', 'db_index': 'True'}), 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'db_index': 'True', 'blank': 'True'}), 'email': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) }, 'student.dashboardconfiguration': { 'Meta': {'object_name': 'DashboardConfiguration'}, 'change_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'changed_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'on_delete': 'models.PROTECT'}), 'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'recent_enrollment_time_delta': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}) }, 'student.entranceexamconfiguration': { 'Meta': {'unique_together': "(('user', 'course_id'),)", 'object_name': 'EntranceExamConfiguration'}, 'course_id': ('xmodule_django.models.CourseKeyField', [], {'max_length': '255', 'db_index': 'True'}), 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'db_index': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'skip_entrance_exam': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) }, 'student.languageproficiency': { 'Meta': {'unique_together': "(('code', 'user_profile'),)", 'object_name': 'LanguageProficiency'}, 'code': ('django.db.models.fields.CharField', [], {'max_length': '16'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'user_profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'language_proficiencies'", 'to': "orm['student.UserProfile']"}) }, 'student.linkedinaddtoprofileconfiguration': { 'Meta': {'object_name': 'LinkedInAddToProfileConfiguration'}, 'change_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'changed_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'on_delete': 'models.PROTECT'}), 'company_identifier': ('django.db.models.fields.TextField', [], {}), 'dashboard_tracking_code': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), 'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'trk_partner_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '10', 'blank': 'True'}) }, 'student.loginfailures': { 'Meta': {'object_name': 'LoginFailures'}, 'failure_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'lockout_until': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) }, 'student.manualenrollmentaudit': { 'Meta': {'object_name': 'ManualEnrollmentAudit'}, 'enrolled_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), 'enrolled_email': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), 'enrollment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['student.CourseEnrollment']", 'null': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'reason': ('django.db.models.fields.TextField', [], {'null': 'True'}), 'state_transition': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'time_stamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}) }, 'student.passwordhistory': { 'Meta': {'object_name': 'PasswordHistory'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'time_set': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) }, 'student.pendingemailchange': { 'Meta': {'object_name': 'PendingEmailChange'}, 'activation_key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32', 'db_index': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'new_email': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}), 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'}) }, 'student.pendingnamechange': { 'Meta': {'object_name': 'PendingNameChange'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'new_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), 'rationale': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'}) }, 'student.registration': { 'Meta': {'object_name': 'Registration', 'db_table': "'auth_registration'"}, 'activation_key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32', 'db_index': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'unique': 'True'}) }, 'student.userprofile': { 'Meta': {'object_name': 'UserProfile', 'db_table': "'auth_userprofile'"}, 'allow_certificate': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'bio': ('django.db.models.fields.CharField', [], {'max_length': '3000', 'null': 'True', 'blank': 'True'}), 'city': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'country': ('django_countries.fields.CountryField', [], {'max_length': '2', 'null': 'True', 'blank': 'True'}), 'courseware': ('django.db.models.fields.CharField', [], {'default': "'course.xml'", 'max_length': '255', 'blank': 'True'}), 'gender': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '6', 'null': 'True', 'blank': 'True'}), 'goals': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'language': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}), 'level_of_education': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '6', 'null': 'True', 'blank': 'True'}), 'location': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}), 'mailing_address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'meta': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}), 'profile_image_uploaded_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), 'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': "orm['auth.User']"}), 'year_of_birth': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}) }, 'student.usersignupsource': { 'Meta': {'object_name': 'UserSignupSource'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'site': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) }, 'student.userstanding': { 'Meta': {'object_name': 'UserStanding'}, 'account_status': ('django.db.models.fields.CharField', [], {'max_length': '31', 'blank': 'True'}), 'changed_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'standing_last_changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'standing'", 'unique': 'True', 'to': "orm['auth.User']"}) }, 'student.usertestgroup': { 'Meta': {'object_name': 'UserTestGroup'}, 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}), 'users': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'db_index': 'True', 'symmetrical': 'False'}) } } complete_apps = ['student']
agpl-3.0
byashimov/django-controlcenter
test_project/settings.py
1
1423
SECRET_KEY = 'test' DEBUG = True ALLOWED_HOSTS = [] INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'controlcenter', ) MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', ) MIDDLEWARE = MIDDLEWARE_CLASSES # django > 1.10 ROOT_URLCONF = 'urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', # 'NAME': os.path.join(BASE_DIR, 'test.db'), } } LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True STATIC_URL = '/static/'
bsd-3-clause
KamalAwasthi/FullContact
myvenv/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/jpcntx.py
1777
19348
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .compat import wrap_ord NUM_OF_CATEGORY = 6 DONT_KNOW = -1 ENOUGH_REL_THRESHOLD = 100 MAX_REL_THRESHOLD = 1000 MINIMUM_DATA_THRESHOLD = 4 # This is hiragana 2-char sequence table, the number in each cell represents its frequency category jp2CharContext = ( (0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1), (2,4,0,4,0,3,0,4,0,3,4,4,4,2,4,3,3,4,3,2,3,3,4,2,3,3,3,2,4,1,4,3,3,1,5,4,3,4,3,4,3,5,3,0,3,5,4,2,0,3,1,0,3,3,0,3,3,0,1,1,0,4,3,0,3,3,0,4,0,2,0,3,5,5,5,5,4,0,4,1,0,3,4), (0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2), (0,4,0,5,0,5,0,4,0,4,5,4,4,3,5,3,5,1,5,3,4,3,4,4,3,4,3,3,4,3,5,4,4,3,5,5,3,5,5,5,3,5,5,3,4,5,5,3,1,3,2,0,3,4,0,4,2,0,4,2,1,5,3,2,3,5,0,4,0,2,0,5,4,4,5,4,5,0,4,0,0,4,4), (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), (0,3,0,4,0,3,0,3,0,4,5,4,3,3,3,3,4,3,5,4,4,3,5,4,4,3,4,3,4,4,4,4,5,3,4,4,3,4,5,5,4,5,5,1,4,5,4,3,0,3,3,1,3,3,0,4,4,0,3,3,1,5,3,3,3,5,0,4,0,3,0,4,4,3,4,3,3,0,4,1,1,3,4), (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), (0,4,0,3,0,3,0,4,0,3,4,4,3,2,2,1,2,1,3,1,3,3,3,3,3,4,3,1,3,3,5,3,3,0,4,3,0,5,4,3,3,5,4,4,3,4,4,5,0,1,2,0,1,2,0,2,2,0,1,0,0,5,2,2,1,4,0,3,0,1,0,4,4,3,5,4,3,0,2,1,0,4,3), (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), (0,3,0,5,0,4,0,2,1,4,4,2,4,1,4,2,4,2,4,3,3,3,4,3,3,3,3,1,4,2,3,3,3,1,4,4,1,1,1,4,3,3,2,0,2,4,3,2,0,3,3,0,3,1,1,0,0,0,3,3,0,4,2,2,3,4,0,4,0,3,0,4,4,5,3,4,4,0,3,0,0,1,4), (1,4,0,4,0,4,0,4,0,3,5,4,4,3,4,3,5,4,3,3,4,3,5,4,4,4,4,3,4,2,4,3,3,1,5,4,3,2,4,5,4,5,5,4,4,5,4,4,0,3,2,2,3,3,0,4,3,1,3,2,1,4,3,3,4,5,0,3,0,2,0,4,5,5,4,5,4,0,4,0,0,5,4), (0,5,0,5,0,4,0,3,0,4,4,3,4,3,3,3,4,0,4,4,4,3,4,3,4,3,3,1,4,2,4,3,4,0,5,4,1,4,5,4,4,5,3,2,4,3,4,3,2,4,1,3,3,3,2,3,2,0,4,3,3,4,3,3,3,4,0,4,0,3,0,4,5,4,4,4,3,0,4,1,0,1,3), (0,3,1,4,0,3,0,2,0,3,4,4,3,1,4,2,3,3,4,3,4,3,4,3,4,4,3,2,3,1,5,4,4,1,4,4,3,5,4,4,3,5,5,4,3,4,4,3,1,2,3,1,2,2,0,3,2,0,3,1,0,5,3,3,3,4,3,3,3,3,4,4,4,4,5,4,2,0,3,3,2,4,3), (0,2,0,3,0,1,0,1,0,0,3,2,0,0,2,0,1,0,2,1,3,3,3,1,2,3,1,0,1,0,4,2,1,1,3,3,0,4,3,3,1,4,3,3,0,3,3,2,0,0,0,0,1,0,0,2,0,0,0,0,0,4,1,0,2,3,2,2,2,1,3,3,3,4,4,3,2,0,3,1,0,3,3), (0,4,0,4,0,3,0,3,0,4,4,4,3,3,3,3,3,3,4,3,4,2,4,3,4,3,3,2,4,3,4,5,4,1,4,5,3,5,4,5,3,5,4,0,3,5,5,3,1,3,3,2,2,3,0,3,4,1,3,3,2,4,3,3,3,4,0,4,0,3,0,4,5,4,4,5,3,0,4,1,0,3,4), (0,2,0,3,0,3,0,0,0,2,2,2,1,0,1,0,0,0,3,0,3,0,3,0,1,3,1,0,3,1,3,3,3,1,3,3,3,0,1,3,1,3,4,0,0,3,1,1,0,3,2,0,0,0,0,1,3,0,1,0,0,3,3,2,0,3,0,0,0,0,0,3,4,3,4,3,3,0,3,0,0,2,3), (2,3,0,3,0,2,0,1,0,3,3,4,3,1,3,1,1,1,3,1,4,3,4,3,3,3,0,0,3,1,5,4,3,1,4,3,2,5,5,4,4,4,4,3,3,4,4,4,0,2,1,1,3,2,0,1,2,0,0,1,0,4,1,3,3,3,0,3,0,1,0,4,4,4,5,5,3,0,2,0,0,4,4), (0,2,0,1,0,3,1,3,0,2,3,3,3,0,3,1,0,0,3,0,3,2,3,1,3,2,1,1,0,0,4,2,1,0,2,3,1,4,3,2,0,4,4,3,1,3,1,3,0,1,0,0,1,0,0,0,1,0,0,0,0,4,1,1,1,2,0,3,0,0,0,3,4,2,4,3,2,0,1,0,0,3,3), (0,1,0,4,0,5,0,4,0,2,4,4,2,3,3,2,3,3,5,3,3,3,4,3,4,2,3,0,4,3,3,3,4,1,4,3,2,1,5,5,3,4,5,1,3,5,4,2,0,3,3,0,1,3,0,4,2,0,1,3,1,4,3,3,3,3,0,3,0,1,0,3,4,4,4,5,5,0,3,0,1,4,5), (0,2,0,3,0,3,0,0,0,2,3,1,3,0,4,0,1,1,3,0,3,4,3,2,3,1,0,3,3,2,3,1,3,0,2,3,0,2,1,4,1,2,2,0,0,3,3,0,0,2,0,0,0,1,0,0,0,0,2,2,0,3,2,1,3,3,0,2,0,2,0,0,3,3,1,2,4,0,3,0,2,2,3), (2,4,0,5,0,4,0,4,0,2,4,4,4,3,4,3,3,3,1,2,4,3,4,3,4,4,5,0,3,3,3,3,2,0,4,3,1,4,3,4,1,4,4,3,3,4,4,3,1,2,3,0,4,2,0,4,1,0,3,3,0,4,3,3,3,4,0,4,0,2,0,3,5,3,4,5,2,0,3,0,0,4,5), (0,3,0,4,0,1,0,1,0,1,3,2,2,1,3,0,3,0,2,0,2,0,3,0,2,0,0,0,1,0,1,1,0,0,3,1,0,0,0,4,0,3,1,0,2,1,3,0,0,0,0,0,0,3,0,0,0,0,0,0,0,4,2,2,3,1,0,3,0,0,0,1,4,4,4,3,0,0,4,0,0,1,4), (1,4,1,5,0,3,0,3,0,4,5,4,4,3,5,3,3,4,4,3,4,1,3,3,3,3,2,1,4,1,5,4,3,1,4,4,3,5,4,4,3,5,4,3,3,4,4,4,0,3,3,1,2,3,0,3,1,0,3,3,0,5,4,4,4,4,4,4,3,3,5,4,4,3,3,5,4,0,3,2,0,4,4), (0,2,0,3,0,1,0,0,0,1,3,3,3,2,4,1,3,0,3,1,3,0,2,2,1,1,0,0,2,0,4,3,1,0,4,3,0,4,4,4,1,4,3,1,1,3,3,1,0,2,0,0,1,3,0,0,0,0,2,0,0,4,3,2,4,3,5,4,3,3,3,4,3,3,4,3,3,0,2,1,0,3,3), (0,2,0,4,0,3,0,2,0,2,5,5,3,4,4,4,4,1,4,3,3,0,4,3,4,3,1,3,3,2,4,3,0,3,4,3,0,3,4,4,2,4,4,0,4,5,3,3,2,2,1,1,1,2,0,1,5,0,3,3,2,4,3,3,3,4,0,3,0,2,0,4,4,3,5,5,0,0,3,0,2,3,3), (0,3,0,4,0,3,0,1,0,3,4,3,3,1,3,3,3,0,3,1,3,0,4,3,3,1,1,0,3,0,3,3,0,0,4,4,0,1,5,4,3,3,5,0,3,3,4,3,0,2,0,1,1,1,0,1,3,0,1,2,1,3,3,2,3,3,0,3,0,1,0,1,3,3,4,4,1,0,1,2,2,1,3), (0,1,0,4,0,4,0,3,0,1,3,3,3,2,3,1,1,0,3,0,3,3,4,3,2,4,2,0,1,0,4,3,2,0,4,3,0,5,3,3,2,4,4,4,3,3,3,4,0,1,3,0,0,1,0,0,1,0,0,0,0,4,2,3,3,3,0,3,0,0,0,4,4,4,5,3,2,0,3,3,0,3,5), (0,2,0,3,0,0,0,3,0,1,3,0,2,0,0,0,1,0,3,1,1,3,3,0,0,3,0,0,3,0,2,3,1,0,3,1,0,3,3,2,0,4,2,2,0,2,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,2,1,2,0,1,0,1,0,0,0,1,3,1,2,0,0,0,1,0,0,1,4), (0,3,0,3,0,5,0,1,0,2,4,3,1,3,3,2,1,1,5,2,1,0,5,1,2,0,0,0,3,3,2,2,3,2,4,3,0,0,3,3,1,3,3,0,2,5,3,4,0,3,3,0,1,2,0,2,2,0,3,2,0,2,2,3,3,3,0,2,0,1,0,3,4,4,2,5,4,0,3,0,0,3,5), (0,3,0,3,0,3,0,1,0,3,3,3,3,0,3,0,2,0,2,1,1,0,2,0,1,0,0,0,2,1,0,0,1,0,3,2,0,0,3,3,1,2,3,1,0,3,3,0,0,1,0,0,0,0,0,2,0,0,0,0,0,2,3,1,2,3,0,3,0,1,0,3,2,1,0,4,3,0,1,1,0,3,3), (0,4,0,5,0,3,0,3,0,4,5,5,4,3,5,3,4,3,5,3,3,2,5,3,4,4,4,3,4,3,4,5,5,3,4,4,3,4,4,5,4,4,4,3,4,5,5,4,2,3,4,2,3,4,0,3,3,1,4,3,2,4,3,3,5,5,0,3,0,3,0,5,5,5,5,4,4,0,4,0,1,4,4), (0,4,0,4,0,3,0,3,0,3,5,4,4,2,3,2,5,1,3,2,5,1,4,2,3,2,3,3,4,3,3,3,3,2,5,4,1,3,3,5,3,4,4,0,4,4,3,1,1,3,1,0,2,3,0,2,3,0,3,0,0,4,3,1,3,4,0,3,0,2,0,4,4,4,3,4,5,0,4,0,0,3,4), (0,3,0,3,0,3,1,2,0,3,4,4,3,3,3,0,2,2,4,3,3,1,3,3,3,1,1,0,3,1,4,3,2,3,4,4,2,4,4,4,3,4,4,3,2,4,4,3,1,3,3,1,3,3,0,4,1,0,2,2,1,4,3,2,3,3,5,4,3,3,5,4,4,3,3,0,4,0,3,2,2,4,4), (0,2,0,1,0,0,0,0,0,1,2,1,3,0,0,0,0,0,2,0,1,2,1,0,0,1,0,0,0,0,3,0,0,1,0,1,1,3,1,0,0,0,1,1,0,1,1,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,1,2,2,0,3,4,0,0,0,1,1,0,0,1,0,0,0,0,0,1,1), (0,1,0,0,0,1,0,0,0,0,4,0,4,1,4,0,3,0,4,0,3,0,4,0,3,0,3,0,4,1,5,1,4,0,0,3,0,5,0,5,2,0,1,0,0,0,2,1,4,0,1,3,0,0,3,0,0,3,1,1,4,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0), (1,4,0,5,0,3,0,2,0,3,5,4,4,3,4,3,5,3,4,3,3,0,4,3,3,3,3,3,3,2,4,4,3,1,3,4,4,5,4,4,3,4,4,1,3,5,4,3,3,3,1,2,2,3,3,1,3,1,3,3,3,5,3,3,4,5,0,3,0,3,0,3,4,3,4,4,3,0,3,0,2,4,3), (0,1,0,4,0,0,0,0,0,1,4,0,4,1,4,2,4,0,3,0,1,0,1,0,0,0,0,0,2,0,3,1,1,1,0,3,0,0,0,1,2,1,0,0,1,1,1,1,0,1,0,0,0,1,0,0,3,0,0,0,0,3,2,0,2,2,0,1,0,0,0,2,3,2,3,3,0,0,0,0,2,1,0), (0,5,1,5,0,3,0,3,0,5,4,4,5,1,5,3,3,0,4,3,4,3,5,3,4,3,3,2,4,3,4,3,3,0,3,3,1,4,4,3,4,4,4,3,4,5,5,3,2,3,1,1,3,3,1,3,1,1,3,3,2,4,5,3,3,5,0,4,0,3,0,4,4,3,5,3,3,0,3,4,0,4,3), (0,5,0,5,0,3,0,2,0,4,4,3,5,2,4,3,3,3,4,4,4,3,5,3,5,3,3,1,4,0,4,3,3,0,3,3,0,4,4,4,4,5,4,3,3,5,5,3,2,3,1,2,3,2,0,1,0,0,3,2,2,4,4,3,1,5,0,4,0,3,0,4,3,1,3,2,1,0,3,3,0,3,3), (0,4,0,5,0,5,0,4,0,4,5,5,5,3,4,3,3,2,5,4,4,3,5,3,5,3,4,0,4,3,4,4,3,2,4,4,3,4,5,4,4,5,5,0,3,5,5,4,1,3,3,2,3,3,1,3,1,0,4,3,1,4,4,3,4,5,0,4,0,2,0,4,3,4,4,3,3,0,4,0,0,5,5), (0,4,0,4,0,5,0,1,1,3,3,4,4,3,4,1,3,0,5,1,3,0,3,1,3,1,1,0,3,0,3,3,4,0,4,3,0,4,4,4,3,4,4,0,3,5,4,1,0,3,0,0,2,3,0,3,1,0,3,1,0,3,2,1,3,5,0,3,0,1,0,3,2,3,3,4,4,0,2,2,0,4,4), (2,4,0,5,0,4,0,3,0,4,5,5,4,3,5,3,5,3,5,3,5,2,5,3,4,3,3,4,3,4,5,3,2,1,5,4,3,2,3,4,5,3,4,1,2,5,4,3,0,3,3,0,3,2,0,2,3,0,4,1,0,3,4,3,3,5,0,3,0,1,0,4,5,5,5,4,3,0,4,2,0,3,5), (0,5,0,4,0,4,0,2,0,5,4,3,4,3,4,3,3,3,4,3,4,2,5,3,5,3,4,1,4,3,4,4,4,0,3,5,0,4,4,4,4,5,3,1,3,4,5,3,3,3,3,3,3,3,0,2,2,0,3,3,2,4,3,3,3,5,3,4,1,3,3,5,3,2,0,0,0,0,4,3,1,3,3), (0,1,0,3,0,3,0,1,0,1,3,3,3,2,3,3,3,0,3,0,0,0,3,1,3,0,0,0,2,2,2,3,0,0,3,2,0,1,2,4,1,3,3,0,0,3,3,3,0,1,0,0,2,1,0,0,3,0,3,1,0,3,0,0,1,3,0,2,0,1,0,3,3,1,3,3,0,0,1,1,0,3,3), (0,2,0,3,0,2,1,4,0,2,2,3,1,1,3,1,1,0,2,0,3,1,2,3,1,3,0,0,1,0,4,3,2,3,3,3,1,4,2,3,3,3,3,1,0,3,1,4,0,1,1,0,1,2,0,1,1,0,1,1,0,3,1,3,2,2,0,1,0,0,0,2,3,3,3,1,0,0,0,0,0,2,3), (0,5,0,4,0,5,0,2,0,4,5,5,3,3,4,3,3,1,5,4,4,2,4,4,4,3,4,2,4,3,5,5,4,3,3,4,3,3,5,5,4,5,5,1,3,4,5,3,1,4,3,1,3,3,0,3,3,1,4,3,1,4,5,3,3,5,0,4,0,3,0,5,3,3,1,4,3,0,4,0,1,5,3), (0,5,0,5,0,4,0,2,0,4,4,3,4,3,3,3,3,3,5,4,4,4,4,4,4,5,3,3,5,2,4,4,4,3,4,4,3,3,4,4,5,5,3,3,4,3,4,3,3,4,3,3,3,3,1,2,2,1,4,3,3,5,4,4,3,4,0,4,0,3,0,4,4,4,4,4,1,0,4,2,0,2,4), (0,4,0,4,0,3,0,1,0,3,5,2,3,0,3,0,2,1,4,2,3,3,4,1,4,3,3,2,4,1,3,3,3,0,3,3,0,0,3,3,3,5,3,3,3,3,3,2,0,2,0,0,2,0,0,2,0,0,1,0,0,3,1,2,2,3,0,3,0,2,0,4,4,3,3,4,1,0,3,0,0,2,4), (0,0,0,4,0,0,0,0,0,0,1,0,1,0,2,0,0,0,0,0,1,0,2,0,1,0,0,0,0,0,3,1,3,0,3,2,0,0,0,1,0,3,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,4,0,2,0,0,0,0,0,0,2), (0,2,1,3,0,2,0,2,0,3,3,3,3,1,3,1,3,3,3,3,3,3,4,2,2,1,2,1,4,0,4,3,1,3,3,3,2,4,3,5,4,3,3,3,3,3,3,3,0,1,3,0,2,0,0,1,0,0,1,0,0,4,2,0,2,3,0,3,3,0,3,3,4,2,3,1,4,0,1,2,0,2,3), (0,3,0,3,0,1,0,3,0,2,3,3,3,0,3,1,2,0,3,3,2,3,3,2,3,2,3,1,3,0,4,3,2,0,3,3,1,4,3,3,2,3,4,3,1,3,3,1,1,0,1,1,0,1,0,1,0,1,0,0,0,4,1,1,0,3,0,3,1,0,2,3,3,3,3,3,1,0,0,2,0,3,3), (0,0,0,0,0,0,0,0,0,0,3,0,2,0,3,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,3,0,3,0,3,1,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,2,0,2,3,0,0,0,0,0,0,0,0,3), (0,2,0,3,1,3,0,3,0,2,3,3,3,1,3,1,3,1,3,1,3,3,3,1,3,0,2,3,1,1,4,3,3,2,3,3,1,2,2,4,1,3,3,0,1,4,2,3,0,1,3,0,3,0,0,1,3,0,2,0,0,3,3,2,1,3,0,3,0,2,0,3,4,4,4,3,1,0,3,0,0,3,3), (0,2,0,1,0,2,0,0,0,1,3,2,2,1,3,0,1,1,3,0,3,2,3,1,2,0,2,0,1,1,3,3,3,0,3,3,1,1,2,3,2,3,3,1,2,3,2,0,0,1,0,0,0,0,0,0,3,0,1,0,0,2,1,2,1,3,0,3,0,0,0,3,4,4,4,3,2,0,2,0,0,2,4), (0,0,0,1,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,2,2,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,3,1,0,0,0,0,0,0,0,3), (0,3,0,3,0,2,0,3,0,3,3,3,2,3,2,2,2,0,3,1,3,3,3,2,3,3,0,0,3,0,3,2,2,0,2,3,1,4,3,4,3,3,2,3,1,5,4,4,0,3,1,2,1,3,0,3,1,1,2,0,2,3,1,3,1,3,0,3,0,1,0,3,3,4,4,2,1,0,2,1,0,2,4), (0,1,0,3,0,1,0,2,0,1,4,2,5,1,4,0,2,0,2,1,3,1,4,0,2,1,0,0,2,1,4,1,1,0,3,3,0,5,1,3,2,3,3,1,0,3,2,3,0,1,0,0,0,0,0,0,1,0,0,0,0,4,0,1,0,3,0,2,0,1,0,3,3,3,4,3,3,0,0,0,0,2,3), (0,0,0,1,0,0,0,0,0,0,2,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,1,0,0,0,0,0,3), (0,1,0,3,0,4,0,3,0,2,4,3,1,0,3,2,2,1,3,1,2,2,3,1,1,1,2,1,3,0,1,2,0,1,3,2,1,3,0,5,5,1,0,0,1,3,2,1,0,3,0,0,1,0,0,0,0,0,3,4,0,1,1,1,3,2,0,2,0,1,0,2,3,3,1,2,3,0,1,0,1,0,4), (0,0,0,1,0,3,0,3,0,2,2,1,0,0,4,0,3,0,3,1,3,0,3,0,3,0,1,0,3,0,3,1,3,0,3,3,0,0,1,2,1,1,1,0,1,2,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,2,2,1,2,0,0,2,0,0,0,0,2,3,3,3,3,0,0,0,0,1,4), (0,0,0,3,0,3,0,0,0,0,3,1,1,0,3,0,1,0,2,0,1,0,0,0,0,0,0,0,1,0,3,0,2,0,2,3,0,0,2,2,3,1,2,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,2,0,0,0,0,2,3), (2,4,0,5,0,5,0,4,0,3,4,3,3,3,4,3,3,3,4,3,4,4,5,4,5,5,5,2,3,0,5,5,4,1,5,4,3,1,5,4,3,4,4,3,3,4,3,3,0,3,2,0,2,3,0,3,0,0,3,3,0,5,3,2,3,3,0,3,0,3,0,3,4,5,4,5,3,0,4,3,0,3,4), (0,3,0,3,0,3,0,3,0,3,3,4,3,2,3,2,3,0,4,3,3,3,3,3,3,3,3,0,3,2,4,3,3,1,3,4,3,4,4,4,3,4,4,3,2,4,4,1,0,2,0,0,1,1,0,2,0,0,3,1,0,5,3,2,1,3,0,3,0,1,2,4,3,2,4,3,3,0,3,2,0,4,4), (0,3,0,3,0,1,0,0,0,1,4,3,3,2,3,1,3,1,4,2,3,2,4,2,3,4,3,0,2,2,3,3,3,0,3,3,3,0,3,4,1,3,3,0,3,4,3,3,0,1,1,0,1,0,0,0,4,0,3,0,0,3,1,2,1,3,0,4,0,1,0,4,3,3,4,3,3,0,2,0,0,3,3), (0,3,0,4,0,1,0,3,0,3,4,3,3,0,3,3,3,1,3,1,3,3,4,3,3,3,0,0,3,1,5,3,3,1,3,3,2,5,4,3,3,4,5,3,2,5,3,4,0,1,0,0,0,0,0,2,0,0,1,1,0,4,2,2,1,3,0,3,0,2,0,4,4,3,5,3,2,0,1,1,0,3,4), (0,5,0,4,0,5,0,2,0,4,4,3,3,2,3,3,3,1,4,3,4,1,5,3,4,3,4,0,4,2,4,3,4,1,5,4,0,4,4,4,4,5,4,1,3,5,4,2,1,4,1,1,3,2,0,3,1,0,3,2,1,4,3,3,3,4,0,4,0,3,0,4,4,4,3,3,3,0,4,2,0,3,4), (1,4,0,4,0,3,0,1,0,3,3,3,1,1,3,3,2,2,3,3,1,0,3,2,2,1,2,0,3,1,2,1,2,0,3,2,0,2,2,3,3,4,3,0,3,3,1,2,0,1,1,3,1,2,0,0,3,0,1,1,0,3,2,2,3,3,0,3,0,0,0,2,3,3,4,3,3,0,1,0,0,1,4), (0,4,0,4,0,4,0,0,0,3,4,4,3,1,4,2,3,2,3,3,3,1,4,3,4,0,3,0,4,2,3,3,2,2,5,4,2,1,3,4,3,4,3,1,3,3,4,2,0,2,1,0,3,3,0,0,2,0,3,1,0,4,4,3,4,3,0,4,0,1,0,2,4,4,4,4,4,0,3,2,0,3,3), (0,0,0,1,0,4,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,3,2,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,2), (0,2,0,3,0,4,0,4,0,1,3,3,3,0,4,0,2,1,2,1,1,1,2,0,3,1,1,0,1,0,3,1,0,0,3,3,2,0,1,1,0,0,0,0,0,1,0,2,0,2,2,0,3,1,0,0,1,0,1,1,0,1,2,0,3,0,0,0,0,1,0,0,3,3,4,3,1,0,1,0,3,0,2), (0,0,0,3,0,5,0,0,0,0,1,0,2,0,3,1,0,1,3,0,0,0,2,0,0,0,1,0,0,0,1,1,0,0,4,0,0,0,2,3,0,1,4,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,1,0,0,0,0,0,0,0,2,0,0,3,0,0,0,0,0,3), (0,2,0,5,0,5,0,1,0,2,4,3,3,2,5,1,3,2,3,3,3,0,4,1,2,0,3,0,4,0,2,2,1,1,5,3,0,0,1,4,2,3,2,0,3,3,3,2,0,2,4,1,1,2,0,1,1,0,3,1,0,1,3,1,2,3,0,2,0,0,0,1,3,5,4,4,4,0,3,0,0,1,3), (0,4,0,5,0,4,0,4,0,4,5,4,3,3,4,3,3,3,4,3,4,4,5,3,4,5,4,2,4,2,3,4,3,1,4,4,1,3,5,4,4,5,5,4,4,5,5,5,2,3,3,1,4,3,1,3,3,0,3,3,1,4,3,4,4,4,0,3,0,4,0,3,3,4,4,5,0,0,4,3,0,4,5), (0,4,0,4,0,3,0,3,0,3,4,4,4,3,3,2,4,3,4,3,4,3,5,3,4,3,2,1,4,2,4,4,3,1,3,4,2,4,5,5,3,4,5,4,1,5,4,3,0,3,2,2,3,2,1,3,1,0,3,3,3,5,3,3,3,5,4,4,2,3,3,4,3,3,3,2,1,0,3,2,1,4,3), (0,4,0,5,0,4,0,3,0,3,5,5,3,2,4,3,4,0,5,4,4,1,4,4,4,3,3,3,4,3,5,5,2,3,3,4,1,2,5,5,3,5,5,2,3,5,5,4,0,3,2,0,3,3,1,1,5,1,4,1,0,4,3,2,3,5,0,4,0,3,0,5,4,3,4,3,0,0,4,1,0,4,4), (1,3,0,4,0,2,0,2,0,2,5,5,3,3,3,3,3,0,4,2,3,4,4,4,3,4,0,0,3,4,5,4,3,3,3,3,2,5,5,4,5,5,5,4,3,5,5,5,1,3,1,0,1,0,0,3,2,0,4,2,0,5,2,3,2,4,1,3,0,3,0,4,5,4,5,4,3,0,4,2,0,5,4), (0,3,0,4,0,5,0,3,0,3,4,4,3,2,3,2,3,3,3,3,3,2,4,3,3,2,2,0,3,3,3,3,3,1,3,3,3,0,4,4,3,4,4,1,1,4,4,2,0,3,1,0,1,1,0,4,1,0,2,3,1,3,3,1,3,4,0,3,0,1,0,3,1,3,0,0,1,0,2,0,0,4,4), (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), (0,3,0,3,0,2,0,3,0,1,5,4,3,3,3,1,4,2,1,2,3,4,4,2,4,4,5,0,3,1,4,3,4,0,4,3,3,3,2,3,2,5,3,4,3,2,2,3,0,0,3,0,2,1,0,1,2,0,0,0,0,2,1,1,3,1,0,2,0,4,0,3,4,4,4,5,2,0,2,0,0,1,3), (0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,0,0,1,1,0,0,0,4,2,1,1,0,1,0,3,2,0,0,3,1,1,1,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,1,0,0,0,2,0,0,0,1,4,0,4,2,1,0,0,0,0,0,1), (0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,3,1,0,0,0,2,0,2,1,0,0,1,2,1,0,1,1,0,0,3,0,0,0,0,0,0,0,0,0,0,0,1,3,1,0,0,0,0,0,1,0,0,2,1,0,0,0,0,0,0,0,0,2), (0,4,0,4,0,4,0,3,0,4,4,3,4,2,4,3,2,0,4,4,4,3,5,3,5,3,3,2,4,2,4,3,4,3,1,4,0,2,3,4,4,4,3,3,3,4,4,4,3,4,1,3,4,3,2,1,2,1,3,3,3,4,4,3,3,5,0,4,0,3,0,4,3,3,3,2,1,0,3,0,0,3,3), (0,4,0,3,0,3,0,3,0,3,5,5,3,3,3,3,4,3,4,3,3,3,4,4,4,3,3,3,3,4,3,5,3,3,1,3,2,4,5,5,5,5,4,3,4,5,5,3,2,2,3,3,3,3,2,3,3,1,2,3,2,4,3,3,3,4,0,4,0,2,0,4,3,2,2,1,2,0,3,0,0,4,1), ) class JapaneseContextAnalysis: def __init__(self): self.reset() def reset(self): self._mTotalRel = 0 # total sequence received # category counters, each interger counts sequence in its category self._mRelSample = [0] * NUM_OF_CATEGORY # if last byte in current buffer is not the last byte of a character, # we need to know how many bytes to skip in next buffer self._mNeedToSkipCharNum = 0 self._mLastCharOrder = -1 # The order of previous char # If this flag is set to True, detection is done and conclusion has # been made self._mDone = False def feed(self, aBuf, aLen): if self._mDone: return # The buffer we got is byte oriented, and a character may span in more than one # buffers. In case the last one or two byte in last buffer is not # complete, we record how many byte needed to complete that character # and skip these bytes here. We can choose to record those bytes as # well and analyse the character once it is complete, but since a # character will not make much difference, by simply skipping # this character will simply our logic and improve performance. i = self._mNeedToSkipCharNum while i < aLen: order, charLen = self.get_order(aBuf[i:i + 2]) i += charLen if i > aLen: self._mNeedToSkipCharNum = i - aLen self._mLastCharOrder = -1 else: if (order != -1) and (self._mLastCharOrder != -1): self._mTotalRel += 1 if self._mTotalRel > MAX_REL_THRESHOLD: self._mDone = True break self._mRelSample[jp2CharContext[self._mLastCharOrder][order]] += 1 self._mLastCharOrder = order def got_enough_data(self): return self._mTotalRel > ENOUGH_REL_THRESHOLD def get_confidence(self): # This is just one way to calculate confidence. It works well for me. if self._mTotalRel > MINIMUM_DATA_THRESHOLD: return (self._mTotalRel - self._mRelSample[0]) / self._mTotalRel else: return DONT_KNOW def get_order(self, aBuf): return -1, 1 class SJISContextAnalysis(JapaneseContextAnalysis): def __init__(self): self.charset_name = "SHIFT_JIS" def get_charset_name(self): return self.charset_name def get_order(self, aBuf): if not aBuf: return -1, 1 # find out current char's byte length first_char = wrap_ord(aBuf[0]) if ((0x81 <= first_char <= 0x9F) or (0xE0 <= first_char <= 0xFC)): charLen = 2 if (first_char == 0x87) or (0xFA <= first_char <= 0xFC): self.charset_name = "CP932" else: charLen = 1 # return its order if it is hiragana if len(aBuf) > 1: second_char = wrap_ord(aBuf[1]) if (first_char == 202) and (0x9F <= second_char <= 0xF1): return second_char - 0x9F, charLen return -1, charLen class EUCJPContextAnalysis(JapaneseContextAnalysis): def get_order(self, aBuf): if not aBuf: return -1, 1 # find out current char's byte length first_char = wrap_ord(aBuf[0]) if (first_char == 0x8E) or (0xA1 <= first_char <= 0xFE): charLen = 2 elif first_char == 0x8F: charLen = 3 else: charLen = 1 # return its order if it is hiragana if len(aBuf) > 1: second_char = wrap_ord(aBuf[1]) if (first_char == 0xA4) and (0xA1 <= second_char <= 0xF3): return second_char - 0xA1, charLen return -1, charLen # flake8: noqa
apache-2.0
dstcontrols/osisoftpy
src/osisoftpy/legacy/_client.py
1
1376
# -*- coding: utf-8 -*- """ osisoft_pi_webapi_python_client.client ~~~~~~~~~~~~~~~~~~~ This module contains the client used to access OSIsoft PI infrastructure and data """ from src.osisoftpy import _base, _server class client(_base): """A client to interact with the PI Web WebAPI""" def __init__(self, piWebApiDomain, userName='', password='', authenticationType='kerberos', verifySSL=False): super(client, self).__init__(piWebApiDomain, userName, password, authenticationType, verifySSL) def PIServers(self): """Retrieves the servers""" r = super(client, self).Request('dataservers') results = [] for item in r['Items']: try: results.insert(-1, _server( super(client, self).≈(), super(client, self).Session(), item['WebId'])) except Exception as e: print print('Unable to retrieve server information for "' + item['Name'] + '".') return results
apache-2.0
archifix/settings
sublime/Packages/backrefs/st3/backrefs/uniprops/unidata/linebreak.py
3
68020
"""Unicode Properties from Unicode version 6.1.0 (autogen).""" from __future__ import unicode_literals unicode_line_break = { "^ai": "\x00-\xa6\xa9\xab-\xb1\xb4-\xb5\xbb\xbf-\xd6\xd8-\xf6\xf8-\u02c6\u02c8\u02cc\u02ce-\u02cf\u02d1-\u02d7\u02dc\u02de-\u2014\u2017-\u201f\u2022-\u203a\u203c-\u2073\u2075-\u207e\u2080\u2085-\u2104\u2106-\u2112\u2114-\u2120\u2123-\u212a\u212c-\u2153\u2156-\u215a\u215c-\u215d\u215f\u216c-\u216f\u217a-\u2188\u218a-\u218f\u219a-\u21d1\u21d3\u21d5-\u21ff\u2201\u2204-\u2206\u2209-\u220a\u220c-\u220e\u2210\u2212-\u2214\u2216-\u2219\u221b-\u221c\u2221-\u2222\u2224\u2226\u222d\u222f-\u2233\u2238-\u223b\u223e-\u2247\u2249-\u224b\u224d-\u2251\u2253-\u225f\u2262-\u2263\u2268-\u2269\u226c-\u226d\u2270-\u2281\u2284-\u2285\u2288-\u2294\u2296-\u2298\u229a-\u22a4\u22a6-\u22be\u22c0-\u2311\u2313-\u245f\u24ff\u254c-\u254f\u2575-\u257f\u2590-\u2591\u2596-\u259f\u25a2\u25aa-\u25b1\u25b4-\u25b5\u25b8-\u25bb\u25be-\u25bf\u25c2-\u25c5\u25c9-\u25ca\u25cc-\u25cd\u25d2-\u25e1\u25e6-\u25ee\u25f0-\u2604\u2607-\u2608\u260a-\u260d\u2610-\u2613\u2618-\u261b\u261d\u261f-\u263f\u2641\u2643-\u265f\u2662\u2666\u266b\u266e\u2670-\u269d\u26a0-\u26bd\u26c0-\u26c3\u26ce\u26e2\u26e4-\u26e7\u2700-\u2756\u2758-\u2775\u2794-\u2b54\u2b5a-\u3247\u3250-\ufffc\ufffe-\U0001f0ff\U0001f10b-\U0001f10f\U0001f12e-\U0001f12f\U0001f16a-\U0001f16f\U0001f19b-\U0010ffff", "^al": "\x00-\x22\x24-\x25\x27-\x29\x2b-\x3b\x3f\x5c\x5b-\x5c\x5d\x7b-\x7d\x7f-\xa5\xa7-\xa8\xaa-\xab\xad\xb0-\xb4\xb6-\xbf\xd7\xf7\u02c7-\u02cd\u02d0\u02d8-\u02db\u02dd\u02df\u0300-\u036f\u0378-\u0379\u037e-\u0383\u038b\u038d\u03a2\u0483-\u0489\u0528-\u0530\u0557-\u0558\u0560\u0588-\u05bf\u05c1-\u05c2\u05c4-\u05f2\u05f5-\u05ff\u0605\u0609-\u060d\u0610-\u061f\u064b-\u066c\u0670\u06d4\u06d6-\u06dc\u06df-\u06e4\u06e7-\u06e8\u06ea-\u06ed\u06f0-\u06f9\u070e\u0711\u0730-\u074c\u07a6-\u07b0\u07b2-\u07c9\u07eb-\u07f3\u07f8-\u07f9\u07fb-\u07ff\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082f\u083f\u0859-\u085d\u085f-\u089f\u08a1\u08ad-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962-\u096f\u0978\u0980-\u0984\u098d-\u098e\u0991-\u0992\u09a9\u09b1\u09b3-\u09b5\u09ba-\u09bc\u09be-\u09cd\u09cf-\u09db\u09de\u09e2-\u09ef\u09f2-\u09f3\u09f9\u09fb-\u0a04\u0a0b-\u0a0e\u0a11-\u0a12\u0a29\u0a31\u0a34\u0a37\u0a3a-\u0a58\u0a5d\u0a5f-\u0a71\u0a75-\u0a84\u0a8e\u0a92\u0aa9\u0ab1\u0ab4\u0aba-\u0abc\u0abe-\u0acf\u0ad1-\u0adf\u0ae2-\u0aef\u0af1-\u0b04\u0b0d-\u0b0e\u0b11-\u0b12\u0b29\u0b31\u0b34\u0b3a-\u0b3c\u0b3e-\u0b5b\u0b5e\u0b62-\u0b6f\u0b78-\u0b82\u0b84\u0b8b-\u0b8d\u0b91\u0b96-\u0b98\u0b9b\u0b9d\u0ba0-\u0ba2\u0ba5-\u0ba7\u0bab-\u0bad\u0bba-\u0bcf\u0bd1-\u0bef\u0bf9\u0bfb-\u0c04\u0c0d\u0c11\u0c29\u0c34\u0c3a-\u0c3c\u0c3e-\u0c57\u0c5a-\u0c5f\u0c62-\u0c77\u0c80-\u0c84\u0c8d\u0c91\u0ca9\u0cb4\u0cba-\u0cbc\u0cbe-\u0cdd\u0cdf\u0ce2-\u0cf0\u0cf3-\u0d04\u0d0d\u0d11\u0d3b-\u0d3c\u0d3e-\u0d4d\u0d4f-\u0d5f\u0d62-\u0d6f\u0d76-\u0d79\u0d80-\u0d84\u0d97-\u0d99\u0db2\u0dbc\u0dbe-\u0dbf\u0dc7-\u0df3\u0df5-\u0e4e\u0e50-\u0eff\u0f01-\u0f04\u0f06-\u0f12\u0f14\u0f18-\u0f19\u0f20-\u0f29\u0f34-\u0f35\u0f37\u0f39-\u0f3f\u0f48\u0f6d-\u0f87\u0f8d-\u0fbf\u0fc6\u0fcd\u0fd0-\u0fd3\u0fd9-\u104b\u1050-\u109f\u10c6\u10c8-\u10cc\u10ce-\u10cf\u1100-\u11ff\u1249\u124e-\u124f\u1257\u1259\u125e-\u125f\u1289\u128e-\u128f\u12b1\u12b6-\u12b7\u12bf\u12c1\u12c6-\u12c7\u12d7\u1311\u1316-\u1317\u135b-\u135f\u1361\u137d-\u137f\u139a-\u139f\u13f5-\u1400\u1680\u169b-\u169f\u16eb-\u16ed\u16f1-\u16ff\u170d\u1712-\u171f\u1732-\u173f\u1752-\u175f\u176d\u1771-\u17d8\u17da-\u17ef\u17fa-\u17ff\u1802-\u1806\u1808-\u1809\u180b-\u181f\u1878-\u187f\u18a9\u18ab-\u18af\u18f6-\u18ff\u191d-\u193f\u1941-\u19df\u1a17-\u1a1d\u1a20-\u1b04\u1b34-\u1b44\u1b4c-\u1b5b\u1b5d-\u1b60\u1b6b-\u1b73\u1b7d-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bfb\u1c24-\u1c4c\u1c50-\u1c59\u1c7e-\u1cbf\u1cc8-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2-\u1cf4\u1cf7-\u1cff\u1dc0-\u1dff\u1f16-\u1f17\u1f1e-\u1f1f\u1f46-\u1f47\u1f4e-\u1f4f\u1f58\u1f5a\u1f5c\u1f5e\u1f7e-\u1f7f\u1fb5\u1fc5\u1fd4-\u1fd5\u1fdc\u1ff0-\u1ff1\u1ff5\u1ffd\u1fff-\u2016\u2018-\u2021\u2024-\u2037\u2039-\u203d\u2044-\u2049\u2056\u2058-\u205b\u205d-\u2060\u2065-\u206f\u2072-\u2074\u207d-\u207f\u2081-\u2084\u208d-\u208f\u209d-\u20ff\u2103\u2105\u2109\u2113\u2116\u2121-\u2122\u212b\u2154-\u2155\u215b\u215e\u2160-\u216b\u2170-\u2179\u2189-\u2199\u21d2\u21d4\u2200\u2202-\u2203\u2207-\u2208\u220b\u220f\u2211-\u2213\u2215\u221a\u221d-\u2220\u2223\u2225\u2227-\u222c\u222e\u2234-\u2237\u223c-\u223d\u2248\u224c\u2252\u2260-\u2261\u2264-\u2267\u226a-\u226b\u226e-\u226f\u2282-\u2283\u2286-\u2287\u2295\u2299\u22a5\u22bf\u2312\u2329-\u232a\u23f4-\u23ff\u2427-\u243f\u244b-\u24fe\u2500-\u254b\u2550-\u2574\u2580-\u258f\u2592-\u2595\u25a0-\u25a1\u25a3-\u25a9\u25b2-\u25b3\u25b6-\u25b7\u25bc-\u25bd\u25c0-\u25c1\u25c6-\u25c8\u25cb\u25ce-\u25d1\u25e2-\u25e5\u25ef\u2605-\u2606\u2609\u260e-\u260f\u2614-\u2617\u261c\u261e\u2640\u2642\u2660-\u2661\u2663-\u2665\u2667-\u266a\u266c-\u266d\u266f\u269e-\u269f\u26be-\u26bf\u26c4-\u26cd\u26cf-\u26e1\u26e3\u26e8-\u2700\u2757\u275b-\u275e\u2762-\u2763\u2768-\u2793\u27c5-\u27c6\u27e6-\u27ef\u2983-\u2998\u29d8-\u29db\u29fc-\u29fd\u2b4d-\u2b4f\u2b55-\u2bff\u2c2f\u2c5f\u2cef-\u2cf1\u2cf4-\u2cfc\u2cfe-\u2cff\u2d26\u2d28-\u2d2c\u2d2e-\u2d2f\u2d68-\u2d6e\u2d70-\u2d7f\u2d97-\u2d9f\u2da7\u2daf\u2db7\u2dbf\u2dc7\u2dcf\u2dd7\u2ddf-\u2e15\u2e17-\u2e19\u2e1c-\u2e1d\u2e20-\u2e2e\u2e30-\u2e31\u2e33-\u2e34\u2e3a-\u4dbf\u4e00-\ua4cf\ua4fe-\ua4ff\ua60d-\ua60f\ua620-\ua629\ua62c-\ua63f\ua66f-\ua672\ua674-\ua67d\ua698-\ua69f\ua6f0-\ua6f1\ua6f3-\ua6ff\ua78f\ua794-\ua79f\ua7ab-\ua7f7\ua802\ua806\ua80b\ua823-\ua827\ua82c-\ua82f\ua838\ua83a-\ua83f\ua874-\ua881\ua8b4-\ua8f1\ua8fc-\ua909\ua926-\ua92f\ua947-\ua95e\ua960-\ua983\ua9b3-\ua9c0\ua9c7-\ua9c9\ua9ce\ua9d0-\ua9dd\ua9e0-\ua9ff\uaa29-\uaa3f\uaa43\uaa4c-\uaa5b\uaa5d-\uaadf\uaaeb-\uaaf1\uaaf5-\uab00\uab07-\uab08\uab0f-\uab10\uab17-\uab1f\uab27\uab2f-\uabbf\uabe3-\ufaff\ufb07-\ufb12\ufb18-\ufb28\ufb2a-\ufb4f\ufbc2-\ufbd2\ufd3e-\ufd4f\ufd90-\ufd91\ufdc8-\ufdef\ufdfc\ufdfe-\ufe6f\ufe75\ufefd-\uff65\uff67-\uff70\uff9e-\uff9f\uffbf-\uffc1\uffc8-\uffc9\uffd0-\uffd1\uffd8-\uffd9\uffdd-\uffe7\uffef-\uffff\U0001000c\U00010027\U0001003b\U0001003e\U0001004e-\U0001004f\U0001005e-\U0001007f\U000100fb-\U00010106\U00010134-\U00010136\U0001018b-\U0001018f\U0001019c-\U000101cf\U000101fd-\U0001027f\U0001029d-\U0001029f\U000102d1-\U000102ff\U0001031f\U00010324-\U0001032f\U0001034b-\U0001037f\U0001039e-\U0001039f\U000103c4-\U000103c7\U000103d0\U000103d6-\U000103ff\U0001049e-\U000107ff\U00010806-\U00010807\U00010809\U00010836\U00010839-\U0001083b\U0001083d-\U0001083e\U00010856-\U00010857\U00010860-\U000108ff\U0001091c-\U0001091f\U0001093a-\U0001093e\U00010940-\U0001097f\U000109b8-\U000109bd\U000109c0-\U000109ff\U00010a01-\U00010a0f\U00010a14\U00010a18\U00010a34-\U00010a3f\U00010a48-\U00010a57\U00010a59-\U00010a5f\U00010a80-\U00010aff\U00010b36-\U00010b3f\U00010b56-\U00010b57\U00010b73-\U00010b77\U00010b80-\U00010bff\U00010c49-\U00010e5f\U00010e7f-\U00011002\U00011038-\U00011048\U0001104e-\U00011051\U00011066-\U00011082\U000110b0-\U000110ba\U000110be-\U000110cf\U000110e9-\U00011102\U00011127-\U00011182\U000111b3-\U000111c0\U000111c5-\U000111c6\U000111c8-\U0001167f\U000116ab-\U00011fff\U0001236f-\U000123ff\U00012463-\U00012fff\U00013258-\U0001325d\U00013282\U00013286-\U00013289\U00013379-\U0001337b\U0001342f-\U000167ff\U00016a39-\U00016eff\U00016f45-\U00016f4f\U00016f51-\U00016f92\U00016fa0-\U0001cfff\U0001d0f6-\U0001d0ff\U0001d127-\U0001d128\U0001d165-\U0001d169\U0001d16d-\U0001d182\U0001d185-\U0001d18b\U0001d1aa-\U0001d1ad\U0001d1de-\U0001d1ff\U0001d242-\U0001d244\U0001d246-\U0001d2ff\U0001d357-\U0001d35f\U0001d372-\U0001d3ff\U0001d455\U0001d49d\U0001d4a0-\U0001d4a1\U0001d4a3-\U0001d4a4\U0001d4a7-\U0001d4a8\U0001d4ad\U0001d4ba\U0001d4bc\U0001d4c4\U0001d506\U0001d50b-\U0001d50c\U0001d515\U0001d51d\U0001d53a\U0001d53f\U0001d545\U0001d547-\U0001d549\U0001d551\U0001d6a6-\U0001d6a7\U0001d7cc-\U0001edff\U0001ee04\U0001ee20\U0001ee23\U0001ee25-\U0001ee26\U0001ee28\U0001ee33\U0001ee38\U0001ee3a\U0001ee3c-\U0001ee41\U0001ee43-\U0001ee46\U0001ee48\U0001ee4a\U0001ee4c\U0001ee50\U0001ee53\U0001ee55-\U0001ee56\U0001ee58\U0001ee5a\U0001ee5c\U0001ee5e\U0001ee60\U0001ee63\U0001ee65-\U0001ee66\U0001ee6b\U0001ee73\U0001ee78\U0001ee7d\U0001ee7f\U0001ee8a\U0001ee9c-\U0001eea0\U0001eea4\U0001eeaa\U0001eebc-\U0001eeef\U0001eef2-\U0001efff\U0001f02c-\U0001f02f\U0001f094-\U0001f09f\U0001f0af-\U0001f0b0\U0001f0bf-\U0001f0c0\U0001f0d0\U0001f0e0-\U0001f12d\U0001f12f-\U0001f169\U0001f16c-\U0001f1e5\U0001f200-\U0001f2ff\U0001f321-\U0001f32f\U0001f336\U0001f37d-\U0001f37f\U0001f394-\U0001f39f\U0001f3c5\U0001f3cb-\U0001f3df\U0001f3f1-\U0001f3ff\U0001f43f\U0001f441\U0001f4f8\U0001f4fd-\U0001f4ff\U0001f53e-\U0001f53f\U0001f544-\U0001f54f\U0001f568-\U0001f5fa\U0001f641-\U0001f644\U0001f650-\U0001f67f\U0001f6c6-\U0001f6ff\U0001f774-\U0010ffff", "^b2": "\x00-\u2013\u2015-\u2e39\u2e3c-\U0010ffff", "^ba": "\x00-\x08\x0a-\x7b\x7d-\xac\xae-\u0589\u058b-\u05bd\u05bf-\u0963\u0966-\u0e59\u0e5c-\u0f0a\u0f0c-\u0f33\u0f35-\u0f7e\u0f80-\u0f84\u0f86-\u0fbd\u0fc0-\u0fd1\u0fd3-\u1049\u104c-\u1360\u1362-\u13ff\u1401-\u167f\u1681-\u16ea\u16ee-\u1734\u1737-\u17d3\u17d6-\u17d7\u17d9\u17db-\u1803\u1806-\u1b59\u1b5c\u1b61-\u1c3a\u1c40-\u1c7d\u1c80-\u1fff\u2007\u200b-\u200f\u2011\u2014-\u2026\u2028-\u2055\u2057\u205c\u2060-\u2cf9\u2cfd-\u2cfe\u2d00-\u2d6f\u2d71-\u2e0d\u2e16\u2e18\u2e1a-\u2e29\u2e2e-\u2e2f\u2e32\u2e35-\ua4fd\ua500-\ua60c\ua60e\ua610-\ua6f2\ua6f8-\ua8cd\ua8d0-\ua92d\ua930-\ua9c6\ua9ca-\uaa5c\uaa60-\uaaef\uaaf2-\uabea\uabec-\U000100ff\U00010103-\U0001039e\U000103a0-\U000103cf\U000103d1-\U00010856\U00010858-\U0001091e\U00010920-\U00010a4f\U00010a58-\U00010b38\U00010b40-\U00011046\U00011049-\U000110bd\U000110c2-\U0001113f\U00011144-\U000111c4\U000111c7\U000111c9-\U0001246f\U00012474-\U0010ffff", "^bb": "\x00-\xb3\xb5-\u02c7\u02c9-\u02cb\u02cd-\u02de\u02e0-\u0f00\u0f05\u0f08\u0f0b-\u0fcf\u0fd2\u0fd4-\u1805\u1807-\u1ffc\u1ffe-\ua873\ua876-\U0010ffff", "^bk": "\x00-\x0a\x0d-\u2027\u202a-\U0010ffff", "^cb": "\x00-\ufffb\ufffd-\U0010ffff", "^cj": "\x00-\u3040\u3042\u3044\u3046\u3048\u304a-\u3062\u3064-\u3082\u3084\u3086\u3088-\u308d\u308f-\u3094\u3097-\u30a0\u30a2\u30a4\u30a6\u30a8\u30aa-\u30c2\u30c4-\u30e2\u30e4\u30e6\u30e8-\u30ed\u30ef-\u30f4\u30f7-\u30fb\u30fd-\u31ef\u3200-\uff66\uff71-\U0010ffff", "^cl": "\x00-\x5c\x7c\x5c\x7e-\u0f3a\u0f3c\u0f3e-\u169b\u169d-\u2045\u2047-\u207d\u207f-\u208d\u208f-\u2329\u232b-\u2768\u276a\u276c\u276e\u2770\u2772\u2774\u2776-\u27c5\u27c7-\u27e6\u27e8\u27ea\u27ec\u27ee\u27f0-\u2983\u2985\u2987\u2989\u298b\u298d\u298f\u2991\u2993\u2995\u2997\u2999-\u29d8\u29da\u29dc-\u29fc\u29fe-\u2e22\u2e24\u2e26\u2e28\u2e2a-\u3000\u3003-\u3008\u300a\u300c\u300e\u3010\u3012-\u3014\u3016\u3018\u301a\u301c-\u301d\u3020-\ufd3e\ufd40-\ufe10\ufe13-\ufe17\ufe19-\ufe35\ufe37\ufe39\ufe3b\ufe3d\ufe3f\ufe41\ufe43\ufe45-\ufe47\ufe49-\ufe4f\ufe51\ufe53-\ufe59\ufe5b\ufe5d\ufe5f-\uff08\uff0a-\uff0b\uff0d\uff0f-\uff3c\uff3e-\uff5c\uff5e-\uff5f\uff62\uff65-\U0001325a\U0001325e-\U00013281\U00013283-\U00013286\U00013288\U0001328a-\U00013379\U0001337c-\U0010ffff", "^cm": "\x09-\x0d\x20-\x5c\x7e\x85\xa0-\u02ff\u034f\u035c-\u0362\u0370-\u0482\u048a-\u0590\u05be\u05c0\u05c3\u05c6\u05c8-\u060f\u061b-\u064a\u0660-\u066f\u0671-\u06d5\u06dd-\u06de\u06e5-\u06e6\u06e9\u06ee-\u0710\u0712-\u072f\u074b-\u07a5\u07b1-\u07ea\u07f4-\u0815\u081a\u0824\u0828\u082e-\u0858\u085c-\u08e3\u08ff\u0904-\u0939\u093d\u0950\u0958-\u0961\u0964-\u0980\u0984-\u09bb\u09bd\u09c5-\u09c6\u09c9-\u09ca\u09ce-\u09d6\u09d8-\u09e1\u09e4-\u0a00\u0a04-\u0a3b\u0a3d\u0a43-\u0a46\u0a49-\u0a4a\u0a4e-\u0a50\u0a52-\u0a6f\u0a72-\u0a74\u0a76-\u0a80\u0a84-\u0abb\u0abd\u0ac6\u0aca\u0ace-\u0ae1\u0ae4-\u0b00\u0b04-\u0b3b\u0b3d\u0b45-\u0b46\u0b49-\u0b4a\u0b4e-\u0b55\u0b58-\u0b61\u0b64-\u0b81\u0b83-\u0bbd\u0bc3-\u0bc5\u0bc9\u0bce-\u0bd6\u0bd8-\u0c00\u0c04-\u0c3d\u0c45\u0c49\u0c4e-\u0c54\u0c57-\u0c61\u0c64-\u0c81\u0c84-\u0cbb\u0cbd\u0cc5\u0cc9\u0cce-\u0cd4\u0cd7-\u0ce1\u0ce4-\u0d01\u0d04-\u0d3d\u0d45\u0d49\u0d4e-\u0d56\u0d58-\u0d61\u0d64-\u0d81\u0d84-\u0dc9\u0dcb-\u0dce\u0dd5\u0dd7\u0de0-\u0df1\u0df4-\u0f17\u0f1a-\u0f34\u0f36\u0f38\u0f3a-\u0f3d\u0f40-\u0f70\u0f7f\u0f85\u0f88-\u0f8c\u0f98\u0fbd-\u0fc5\u0fc7-\u135c\u1360-\u1711\u1715-\u1731\u1735-\u1751\u1754-\u1771\u1774-\u180a\u180e-\u18a8\u18aa-\u191f\u192c-\u192f\u193c-\u1a16\u1a1c-\u1a7e\u1a80-\u1aff\u1b05-\u1b33\u1b45-\u1b6a\u1b74-\u1b7f\u1b83-\u1ba0\u1bae-\u1be5\u1bf4-\u1c23\u1c38-\u1ccf\u1cd3\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5-\u1dbf\u1de7-\u1dfb\u1e00-\u200b\u2010-\u2029\u202f-\u2069\u2070-\u20cf\u20f1-\u2cee\u2cf2-\u2d7e\u2d80-\u2ddf\u2e00-\u3029\u3030-\u3098\u309b-\ua66e\ua673\ua67e-\ua69e\ua6a0-\ua6ef\ua6f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua828-\ua87f\ua882-\ua8b3\ua8c5-\ua8df\ua8f2-\ua925\ua92e-\ua946\ua954-\ua97f\ua984-\ua9b2\ua9c1-\uaa28\uaa37-\uaa42\uaa44-\uaa4b\uaa4e-\uaaea\uaaf0-\uaaf4\uaaf7-\uabe2\uabeb\uabee-\ufb1d\ufb1f-\ufdff\ufe10-\ufe1f\ufe27-\ufff8\ufffc-\U000101fc\U000101fe-\U00010a00\U00010a04\U00010a07-\U00010a0b\U00010a10-\U00010a37\U00010a3b-\U00010a3e\U00010a40-\U00010fff\U00011003-\U00011037\U00011047-\U0001107f\U00011083-\U000110af\U000110bb-\U000110ff\U00011103-\U00011126\U00011135-\U0001117f\U00011183-\U000111b2\U000111c1-\U000116aa\U000116b8-\U00016f50\U00016f7f-\U00016f8e\U00016f93-\U0001d164\U0001d16a-\U0001d16c\U0001d183-\U0001d184\U0001d18c-\U0001d1a9\U0001d1ae-\U0001d241\U0001d245-\U000e0000\U000e0002-\U000e001f\U000e0080-\U000e00ff\U000e01f0-\U0010ffff", "^cp": "\x00-\x28\x2a-\x5c\x5c\x5c\x5e-\U0010ffff", "^cr": "\x00-\x0c\x0e-\U0010ffff", "^ex": "\x00-\x20\x22-\x3e\x40-\u05c5\u05c7-\u061a\u061c-\u061d\u0620-\u06d3\u06d5-\u07f8\u07fa-\u0f0c\u0f12-\u0f13\u0f15-\u1801\u1804-\u1807\u180a-\u1943\u1946-\u2761\u2764-\u2cf8\u2cfa-\u2cfd\u2cff-\u2e2d\u2e2f-\ua60d\ua60f-\ua875\ua878-\ufe14\ufe17-\ufe55\ufe58-\uff00\uff02-\uff1e\uff20-\U0010ffff", "^gl": "\x00-\x9f\xa1-\u034e\u0350-\u035b\u0363-\u0f07\u0f09-\u0f0b\u0f0d-\u0f11\u0f13-\u0fd8\u0fdb-\u180d\u180f-\u2006\u2008-\u2010\u2012-\u202e\u2030-\U0010ffff", "^h2": "\x00-\uabff\uac01-\uac1b\uac1d-\uac37\uac39-\uac53\uac55-\uac6f\uac71-\uac8b\uac8d-\uaca7\uaca9-\uacc3\uacc5-\uacdf\uace1-\uacfb\uacfd-\uad17\uad19-\uad33\uad35-\uad4f\uad51-\uad6b\uad6d-\uad87\uad89-\uada3\uada5-\uadbf\uadc1-\uaddb\uaddd-\uadf7\uadf9-\uae13\uae15-\uae2f\uae31-\uae4b\uae4d-\uae67\uae69-\uae83\uae85-\uae9f\uaea1-\uaebb\uaebd-\uaed7\uaed9-\uaef3\uaef5-\uaf0f\uaf11-\uaf2b\uaf2d-\uaf47\uaf49-\uaf63\uaf65-\uaf7f\uaf81-\uaf9b\uaf9d-\uafb7\uafb9-\uafd3\uafd5-\uafef\uaff1-\ub00b\ub00d-\ub027\ub029-\ub043\ub045-\ub05f\ub061-\ub07b\ub07d-\ub097\ub099-\ub0b3\ub0b5-\ub0cf\ub0d1-\ub0eb\ub0ed-\ub107\ub109-\ub123\ub125-\ub13f\ub141-\ub15b\ub15d-\ub177\ub179-\ub193\ub195-\ub1af\ub1b1-\ub1cb\ub1cd-\ub1e7\ub1e9-\ub203\ub205-\ub21f\ub221-\ub23b\ub23d-\ub257\ub259-\ub273\ub275-\ub28f\ub291-\ub2ab\ub2ad-\ub2c7\ub2c9-\ub2e3\ub2e5-\ub2ff\ub301-\ub31b\ub31d-\ub337\ub339-\ub353\ub355-\ub36f\ub371-\ub38b\ub38d-\ub3a7\ub3a9-\ub3c3\ub3c5-\ub3df\ub3e1-\ub3fb\ub3fd-\ub417\ub419-\ub433\ub435-\ub44f\ub451-\ub46b\ub46d-\ub487\ub489-\ub4a3\ub4a5-\ub4bf\ub4c1-\ub4db\ub4dd-\ub4f7\ub4f9-\ub513\ub515-\ub52f\ub531-\ub54b\ub54d-\ub567\ub569-\ub583\ub585-\ub59f\ub5a1-\ub5bb\ub5bd-\ub5d7\ub5d9-\ub5f3\ub5f5-\ub60f\ub611-\ub62b\ub62d-\ub647\ub649-\ub663\ub665-\ub67f\ub681-\ub69b\ub69d-\ub6b7\ub6b9-\ub6d3\ub6d5-\ub6ef\ub6f1-\ub70b\ub70d-\ub727\ub729-\ub743\ub745-\ub75f\ub761-\ub77b\ub77d-\ub797\ub799-\ub7b3\ub7b5-\ub7cf\ub7d1-\ub7eb\ub7ed-\ub807\ub809-\ub823\ub825-\ub83f\ub841-\ub85b\ub85d-\ub877\ub879-\ub893\ub895-\ub8af\ub8b1-\ub8cb\ub8cd-\ub8e7\ub8e9-\ub903\ub905-\ub91f\ub921-\ub93b\ub93d-\ub957\ub959-\ub973\ub975-\ub98f\ub991-\ub9ab\ub9ad-\ub9c7\ub9c9-\ub9e3\ub9e5-\ub9ff\uba01-\uba1b\uba1d-\uba37\uba39-\uba53\uba55-\uba6f\uba71-\uba8b\uba8d-\ubaa7\ubaa9-\ubac3\ubac5-\ubadf\ubae1-\ubafb\ubafd-\ubb17\ubb19-\ubb33\ubb35-\ubb4f\ubb51-\ubb6b\ubb6d-\ubb87\ubb89-\ubba3\ubba5-\ubbbf\ubbc1-\ubbdb\ubbdd-\ubbf7\ubbf9-\ubc13\ubc15-\ubc2f\ubc31-\ubc4b\ubc4d-\ubc67\ubc69-\ubc83\ubc85-\ubc9f\ubca1-\ubcbb\ubcbd-\ubcd7\ubcd9-\ubcf3\ubcf5-\ubd0f\ubd11-\ubd2b\ubd2d-\ubd47\ubd49-\ubd63\ubd65-\ubd7f\ubd81-\ubd9b\ubd9d-\ubdb7\ubdb9-\ubdd3\ubdd5-\ubdef\ubdf1-\ube0b\ube0d-\ube27\ube29-\ube43\ube45-\ube5f\ube61-\ube7b\ube7d-\ube97\ube99-\ubeb3\ubeb5-\ubecf\ubed1-\ubeeb\ubeed-\ubf07\ubf09-\ubf23\ubf25-\ubf3f\ubf41-\ubf5b\ubf5d-\ubf77\ubf79-\ubf93\ubf95-\ubfaf\ubfb1-\ubfcb\ubfcd-\ubfe7\ubfe9-\uc003\uc005-\uc01f\uc021-\uc03b\uc03d-\uc057\uc059-\uc073\uc075-\uc08f\uc091-\uc0ab\uc0ad-\uc0c7\uc0c9-\uc0e3\uc0e5-\uc0ff\uc101-\uc11b\uc11d-\uc137\uc139-\uc153\uc155-\uc16f\uc171-\uc18b\uc18d-\uc1a7\uc1a9-\uc1c3\uc1c5-\uc1df\uc1e1-\uc1fb\uc1fd-\uc217\uc219-\uc233\uc235-\uc24f\uc251-\uc26b\uc26d-\uc287\uc289-\uc2a3\uc2a5-\uc2bf\uc2c1-\uc2db\uc2dd-\uc2f7\uc2f9-\uc313\uc315-\uc32f\uc331-\uc34b\uc34d-\uc367\uc369-\uc383\uc385-\uc39f\uc3a1-\uc3bb\uc3bd-\uc3d7\uc3d9-\uc3f3\uc3f5-\uc40f\uc411-\uc42b\uc42d-\uc447\uc449-\uc463\uc465-\uc47f\uc481-\uc49b\uc49d-\uc4b7\uc4b9-\uc4d3\uc4d5-\uc4ef\uc4f1-\uc50b\uc50d-\uc527\uc529-\uc543\uc545-\uc55f\uc561-\uc57b\uc57d-\uc597\uc599-\uc5b3\uc5b5-\uc5cf\uc5d1-\uc5eb\uc5ed-\uc607\uc609-\uc623\uc625-\uc63f\uc641-\uc65b\uc65d-\uc677\uc679-\uc693\uc695-\uc6af\uc6b1-\uc6cb\uc6cd-\uc6e7\uc6e9-\uc703\uc705-\uc71f\uc721-\uc73b\uc73d-\uc757\uc759-\uc773\uc775-\uc78f\uc791-\uc7ab\uc7ad-\uc7c7\uc7c9-\uc7e3\uc7e5-\uc7ff\uc801-\uc81b\uc81d-\uc837\uc839-\uc853\uc855-\uc86f\uc871-\uc88b\uc88d-\uc8a7\uc8a9-\uc8c3\uc8c5-\uc8df\uc8e1-\uc8fb\uc8fd-\uc917\uc919-\uc933\uc935-\uc94f\uc951-\uc96b\uc96d-\uc987\uc989-\uc9a3\uc9a5-\uc9bf\uc9c1-\uc9db\uc9dd-\uc9f7\uc9f9-\uca13\uca15-\uca2f\uca31-\uca4b\uca4d-\uca67\uca69-\uca83\uca85-\uca9f\ucaa1-\ucabb\ucabd-\ucad7\ucad9-\ucaf3\ucaf5-\ucb0f\ucb11-\ucb2b\ucb2d-\ucb47\ucb49-\ucb63\ucb65-\ucb7f\ucb81-\ucb9b\ucb9d-\ucbb7\ucbb9-\ucbd3\ucbd5-\ucbef\ucbf1-\ucc0b\ucc0d-\ucc27\ucc29-\ucc43\ucc45-\ucc5f\ucc61-\ucc7b\ucc7d-\ucc97\ucc99-\uccb3\uccb5-\ucccf\uccd1-\ucceb\ucced-\ucd07\ucd09-\ucd23\ucd25-\ucd3f\ucd41-\ucd5b\ucd5d-\ucd77\ucd79-\ucd93\ucd95-\ucdaf\ucdb1-\ucdcb\ucdcd-\ucde7\ucde9-\uce03\uce05-\uce1f\uce21-\uce3b\uce3d-\uce57\uce59-\uce73\uce75-\uce8f\uce91-\uceab\ucead-\ucec7\ucec9-\ucee3\ucee5-\uceff\ucf01-\ucf1b\ucf1d-\ucf37\ucf39-\ucf53\ucf55-\ucf6f\ucf71-\ucf8b\ucf8d-\ucfa7\ucfa9-\ucfc3\ucfc5-\ucfdf\ucfe1-\ucffb\ucffd-\ud017\ud019-\ud033\ud035-\ud04f\ud051-\ud06b\ud06d-\ud087\ud089-\ud0a3\ud0a5-\ud0bf\ud0c1-\ud0db\ud0dd-\ud0f7\ud0f9-\ud113\ud115-\ud12f\ud131-\ud14b\ud14d-\ud167\ud169-\ud183\ud185-\ud19f\ud1a1-\ud1bb\ud1bd-\ud1d7\ud1d9-\ud1f3\ud1f5-\ud20f\ud211-\ud22b\ud22d-\ud247\ud249-\ud263\ud265-\ud27f\ud281-\ud29b\ud29d-\ud2b7\ud2b9-\ud2d3\ud2d5-\ud2ef\ud2f1-\ud30b\ud30d-\ud327\ud329-\ud343\ud345-\ud35f\ud361-\ud37b\ud37d-\ud397\ud399-\ud3b3\ud3b5-\ud3cf\ud3d1-\ud3eb\ud3ed-\ud407\ud409-\ud423\ud425-\ud43f\ud441-\ud45b\ud45d-\ud477\ud479-\ud493\ud495-\ud4af\ud4b1-\ud4cb\ud4cd-\ud4e7\ud4e9-\ud503\ud505-\ud51f\ud521-\ud53b\ud53d-\ud557\ud559-\ud573\ud575-\ud58f\ud591-\ud5ab\ud5ad-\ud5c7\ud5c9-\ud5e3\ud5e5-\ud5ff\ud601-\ud61b\ud61d-\ud637\ud639-\ud653\ud655-\ud66f\ud671-\ud68b\ud68d-\ud6a7\ud6a9-\ud6c3\ud6c5-\ud6df\ud6e1-\ud6fb\ud6fd-\ud717\ud719-\ud733\ud735-\ud74f\ud751-\ud76b\ud76d-\ud787\ud789-\U0010ffff", "^h3": "\x00-\uac00\uac1c\uac38\uac54\uac70\uac8c\uaca8\uacc4\uace0\uacfc\uad18\uad34\uad50\uad6c\uad88\uada4\uadc0\uaddc\uadf8\uae14\uae30\uae4c\uae68\uae84\uaea0\uaebc\uaed8\uaef4\uaf10\uaf2c\uaf48\uaf64\uaf80\uaf9c\uafb8\uafd4\uaff0\ub00c\ub028\ub044\ub060\ub07c\ub098\ub0b4\ub0d0\ub0ec\ub108\ub124\ub140\ub15c\ub178\ub194\ub1b0\ub1cc\ub1e8\ub204\ub220\ub23c\ub258\ub274\ub290\ub2ac\ub2c8\ub2e4\ub300\ub31c\ub338\ub354\ub370\ub38c\ub3a8\ub3c4\ub3e0\ub3fc\ub418\ub434\ub450\ub46c\ub488\ub4a4\ub4c0\ub4dc\ub4f8\ub514\ub530\ub54c\ub568\ub584\ub5a0\ub5bc\ub5d8\ub5f4\ub610\ub62c\ub648\ub664\ub680\ub69c\ub6b8\ub6d4\ub6f0\ub70c\ub728\ub744\ub760\ub77c\ub798\ub7b4\ub7d0\ub7ec\ub808\ub824\ub840\ub85c\ub878\ub894\ub8b0\ub8cc\ub8e8\ub904\ub920\ub93c\ub958\ub974\ub990\ub9ac\ub9c8\ub9e4\uba00\uba1c\uba38\uba54\uba70\uba8c\ubaa8\ubac4\ubae0\ubafc\ubb18\ubb34\ubb50\ubb6c\ubb88\ubba4\ubbc0\ubbdc\ubbf8\ubc14\ubc30\ubc4c\ubc68\ubc84\ubca0\ubcbc\ubcd8\ubcf4\ubd10\ubd2c\ubd48\ubd64\ubd80\ubd9c\ubdb8\ubdd4\ubdf0\ube0c\ube28\ube44\ube60\ube7c\ube98\ubeb4\ubed0\ubeec\ubf08\ubf24\ubf40\ubf5c\ubf78\ubf94\ubfb0\ubfcc\ubfe8\uc004\uc020\uc03c\uc058\uc074\uc090\uc0ac\uc0c8\uc0e4\uc100\uc11c\uc138\uc154\uc170\uc18c\uc1a8\uc1c4\uc1e0\uc1fc\uc218\uc234\uc250\uc26c\uc288\uc2a4\uc2c0\uc2dc\uc2f8\uc314\uc330\uc34c\uc368\uc384\uc3a0\uc3bc\uc3d8\uc3f4\uc410\uc42c\uc448\uc464\uc480\uc49c\uc4b8\uc4d4\uc4f0\uc50c\uc528\uc544\uc560\uc57c\uc598\uc5b4\uc5d0\uc5ec\uc608\uc624\uc640\uc65c\uc678\uc694\uc6b0\uc6cc\uc6e8\uc704\uc720\uc73c\uc758\uc774\uc790\uc7ac\uc7c8\uc7e4\uc800\uc81c\uc838\uc854\uc870\uc88c\uc8a8\uc8c4\uc8e0\uc8fc\uc918\uc934\uc950\uc96c\uc988\uc9a4\uc9c0\uc9dc\uc9f8\uca14\uca30\uca4c\uca68\uca84\ucaa0\ucabc\ucad8\ucaf4\ucb10\ucb2c\ucb48\ucb64\ucb80\ucb9c\ucbb8\ucbd4\ucbf0\ucc0c\ucc28\ucc44\ucc60\ucc7c\ucc98\uccb4\uccd0\uccec\ucd08\ucd24\ucd40\ucd5c\ucd78\ucd94\ucdb0\ucdcc\ucde8\uce04\uce20\uce3c\uce58\uce74\uce90\uceac\ucec8\ucee4\ucf00\ucf1c\ucf38\ucf54\ucf70\ucf8c\ucfa8\ucfc4\ucfe0\ucffc\ud018\ud034\ud050\ud06c\ud088\ud0a4\ud0c0\ud0dc\ud0f8\ud114\ud130\ud14c\ud168\ud184\ud1a0\ud1bc\ud1d8\ud1f4\ud210\ud22c\ud248\ud264\ud280\ud29c\ud2b8\ud2d4\ud2f0\ud30c\ud328\ud344\ud360\ud37c\ud398\ud3b4\ud3d0\ud3ec\ud408\ud424\ud440\ud45c\ud478\ud494\ud4b0\ud4cc\ud4e8\ud504\ud520\ud53c\ud558\ud574\ud590\ud5ac\ud5c8\ud5e4\ud600\ud61c\ud638\ud654\ud670\ud68c\ud6a8\ud6c4\ud6e0\ud6fc\ud718\ud734\ud750\ud76c\ud788\ud7a4-\U0010ffff", "^hl": "\x00-\u05cf\u05eb-\u05ef\u05f3-\ufb1c\ufb1e\ufb29\ufb37\ufb3d\ufb3f\ufb42\ufb45\ufb50-\U0010ffff", "^hy": "\x00-\x2c\x2e-\U0010ffff", "^id": "\x00-\u2e7f\u2e9a\u2ef4-\u2eff\u2fd6-\u2fef\u2ffc-\u2fff\u3001-\u3002\u3005\u3008-\u3011\u3014-\u301f\u302a-\u302f\u303b-\u303c\u3040-\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087\u308e\u3095-\u309e\u30a0-\u30a1\u30a3\u30a5\u30a7\u30a9\u30c3\u30e3\u30e5\u30e7\u30ee\u30f5-\u30f6\u30fb-\u30fe\u3100-\u3104\u312e-\u3130\u318f\u31bb-\u31bf\u31e4-\u31ff\u321f\u3248-\u324f\u32ff\u4dc0-\u4dff\ua015\ua48d-\ua48f\ua4c7-\uf8ff\ufb00-\ufe2f\ufe35-\ufe44\ufe47-\ufe48\ufe50\ufe52-\ufe57\ufe59-\ufe5e\ufe67\ufe69-\ufe6a\ufe6c-\uff01\uff04-\uff05\uff08-\uff09\uff0c\uff0e\uff1a-\uff1b\uff1f\uff3b\uff3d\uff5b\uff5d\uff5f-\uffe1\uffe5-\U0001afff\U0001b002-\U0001f1ff\U0001f203-\U0001f20f\U0001f23b-\U0001f23f\U0001f249-\U0001f24f\U0001f252-\U0001ffff\U0002fffe-\U0002ffff\U0003fffe-\U0010ffff", "^in": "\x00-\u2023\u2027-\ufe18\ufe1a-\U0010ffff", "^is": "\x00-\x2b\x5c\x2d\x2f-\x39\x3c-\u037d\u037f-\u0588\u058a-\u060b\u060e-\u07f7\u07f9-\u2043\u2045-\ufe0f\ufe11-\ufe12\ufe15-\U0010ffff", "^jl": "\x00-\u10ff\u1160-\ua95f\ua97d-\U0010ffff", "^jt": "\x00-\u11a7\u1200-\ud7ca\ud7fc-\U0010ffff", "^jv": "\x00-\u115f\u11a8-\ud7af\ud7c7-\U0010ffff", "^lf": "\x00-\x09\x0b-\U0010ffff", "^nl": "\x00-\x84\x86-\U0010ffff", "^ns": "\x00-\u17d5\u17d7-\u203b\u203e-\u2046\u204a-\u3004\u3006-\u301b\u301d-\u303a\u303d-\u309a\u309f\u30a1-\u30fa\u30fc\u30ff-\ua014\ua016-\ufe53\ufe56-\uff19\uff1c-\uff64\uff66-\uff9d\uffa0-\U0010ffff", "^nu": "\x00-\x2f\x3a-\u065f\u066a\u066d-\u06ef\u06fa-\u07bf\u07ca-\u0965\u0970-\u09e5\u09f0-\u0a65\u0a70-\u0ae5\u0af0-\u0b65\u0b70-\u0be5\u0bf0-\u0c65\u0c70-\u0ce5\u0cf0-\u0d65\u0d70-\u0e4f\u0e5a-\u0ecf\u0eda-\u0f1f\u0f2a-\u103f\u104a-\u108f\u109a-\u17df\u17ea-\u180f\u181a-\u1945\u1950-\u19cf\u19da-\u1a7f\u1a8a-\u1a8f\u1a9a-\u1b4f\u1b5a-\u1baf\u1bba-\u1c3f\u1c4a-\u1c4f\u1c5a-\ua61f\ua62a-\ua8cf\ua8da-\ua8ff\ua90a-\ua9cf\ua9da-\uaa4f\uaa5a-\uabef\uabfa-\U0001049f\U000104aa-\U00011065\U00011070-\U000110ef\U000110fa-\U00011135\U00011140-\U000111cf\U000111da-\U000116bf\U000116ca-\U0001d7cd\U0001d800-\U0010ffff", "^op": "\x00-\x27\x29-\x5a\x5c\x5c-\x7a\x5c\x7c-\xa0\xa2-\xbe\xc0-\u0f39\u0f3b\u0f3d-\u169a\u169c-\u2019\u201b-\u201d\u201f-\u2044\u2046-\u207c\u207e-\u208c\u208e-\u2328\u232a-\u2767\u2769\u276b\u276d\u276f\u2771\u2773\u2775-\u27c4\u27c6-\u27e5\u27e7\u27e9\u27eb\u27ed\u27ef-\u2982\u2984\u2986\u2988\u298a\u298c\u298e\u2990\u2992\u2994\u2996\u2998-\u29d7\u29d9\u29db-\u29fb\u29fd-\u2e17\u2e19-\u2e21\u2e23\u2e25\u2e27\u2e29-\u3007\u3009\u300b\u300d\u300f\u3011-\u3013\u3015\u3017\u3019\u301b-\u301c\u301e-\ufd3d\ufd3f-\ufe16\ufe18-\ufe34\ufe36\ufe38\ufe3a\ufe3c\ufe3e\ufe40\ufe42\ufe44-\ufe46\ufe48-\ufe58\ufe5a\ufe5c\ufe5e-\uff07\uff09-\uff3a\uff3c-\uff5a\uff5c-\uff5e\uff60-\uff61\uff63-\U00013257\U0001325b-\U00013285\U00013287\U00013289-\U00013378\U0001337a-\U0010ffff", "^po": "\x00-\x24\x5c\x26-\xa1\xa3-\xaf\xb1-\u0608\u060c-\u0669\u066b-\u09f1\u09f4-\u09f8\u09fa-\u0d78\u0d7a-\u202f\u2038-\u20a6\u20a8-\u20b5\u20b7-\u2102\u2104-\u2108\u210a-\ua837\ua839-\ufdfb\ufdfd-\ufe69\ufe6b-\uff04\uff06-\uffdf\uffe1-\U0010ffff", "^pr": "\x00-\x23\x25-\x2a\x2c-\x5c\x5b\x5c\x5d-\xa2\xa6-\xb0\xb2-\u058e\u0590-\u09fa\u09fc-\u0af0\u0af2-\u0bf8\u0bfa-\u0e3e\u0e40-\u17da\u17dc-\u209f\u20a7\u20b6\u20ba-\u2115\u2117-\u2211\u2214-\ufe68\ufe6a-\uff03\uff05-\uffe0\uffe2-\uffe4\uffe7-\U0010ffff", "^qu": "\x00-\x21\x23-\x5c\x26\x28-\xaa\xac-\xba\xbc-\u2017\u201a\u201e\u2020-\u2038\u203b-\u275a\u275f-\u2dff\u2e0e-\u2e1b\u2e1e-\u2e1f\u2e22-\U0010ffff", "^sa": "\x00-\u0e00\u0e3b-\u0e3f\u0e4f-\u0e80\u0e83\u0e85-\u0e86\u0e89\u0e8b-\u0e8c\u0e8e-\u0e93\u0e98\u0ea0\u0ea4\u0ea6\u0ea8-\u0ea9\u0eac\u0eba\u0ebe-\u0ebf\u0ec5\u0ec7\u0ece-\u0edb\u0ee0-\u0fff\u1040-\u104f\u1090-\u1099\u10a0-\u177f\u17d4-\u17d6\u17d8-\u17db\u17de-\u194f\u196e-\u196f\u1975-\u197f\u19ac-\u19af\u19ca-\u19d9\u19db-\u19dd\u19e0-\u1a1f\u1a5f\u1a7d-\u1a9f\u1aae-\uaa5f\uaa7c-\uaa7f\uaac3-\uaada\uaae0-\U0010ffff", "^sg": "\x00-\ud7ff\ue000-\U0010ffff", "^sp": "\x00-\x1f\x21-\U0010ffff", "^sy": "\x00-\x2e\x30-\U0010ffff", "^unknown": "\x00-\u0377\u037a-\u037e\u0384-\u038a\u038c\u038e-\u03a1\u03a3-\u0527\u0531-\u0556\u0559-\u055f\u0561-\u0587\u0589-\u058a\u058f\u0591-\u05c7\u05d0-\u05ea\u05f0-\u05f4\u0600-\u0604\u0606-\u061b\u061e-\u070d\u070f-\u074a\u074d-\u07b1\u07c0-\u07fa\u0800-\u082d\u0830-\u083e\u0840-\u085b\u085e\u08a0\u08a2-\u08ac\u08e4-\u08fe\u0900-\u0977\u0979-\u097f\u0981-\u0983\u0985-\u098c\u098f-\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bc-\u09c4\u09c7-\u09c8\u09cb-\u09ce\u09d7\u09dc-\u09dd\u09df-\u09e3\u09e6-\u09fb\u0a01-\u0a03\u0a05-\u0a0a\u0a0f-\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32-\u0a33\u0a35-\u0a36\u0a38-\u0a39\u0a3c\u0a3e-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a51\u0a59-\u0a5c\u0a5e\u0a66-\u0a75\u0a81-\u0a83\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2-\u0ab3\u0ab5-\u0ab9\u0abc-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ad0\u0ae0-\u0ae3\u0ae6-\u0af1\u0b01-\u0b03\u0b05-\u0b0c\u0b0f-\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32-\u0b33\u0b35-\u0b39\u0b3c-\u0b44\u0b47-\u0b48\u0b4b-\u0b4d\u0b56-\u0b57\u0b5c-\u0b5d\u0b5f-\u0b63\u0b66-\u0b77\u0b82-\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99-\u0b9a\u0b9c\u0b9e-\u0b9f\u0ba3-\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd0\u0bd7\u0be6-\u0bfa\u0c01-\u0c03\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56\u0c58-\u0c59\u0c60-\u0c63\u0c66-\u0c6f\u0c78-\u0c7f\u0c82-\u0c83\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbc-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5-\u0cd6\u0cde\u0ce0-\u0ce3\u0ce6-\u0cef\u0cf1-\u0cf2\u0d02-\u0d03\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d-\u0d44\u0d46-\u0d48\u0d4a-\u0d4e\u0d57\u0d60-\u0d63\u0d66-\u0d75\u0d79-\u0d7f\u0d82-\u0d83\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2-\u0df4\u0e01-\u0e3a\u0e3f-\u0e5b\u0e81-\u0e82\u0e84\u0e87-\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa-\u0eab\u0ead-\u0eb9\u0ebb-\u0ebd\u0ec0-\u0ec4\u0ec6\u0ec8-\u0ecd\u0ed0-\u0ed9\u0edc-\u0edf\u0f00-\u0f47\u0f49-\u0f6c\u0f71-\u0f97\u0f99-\u0fbc\u0fbe-\u0fcc\u0fce-\u0fda\u1000-\u10c5\u10c7\u10cd\u10d0-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u135d-\u137c\u1380-\u1399\u13a0-\u13f4\u1400-\u169c\u16a0-\u16f0\u1700-\u170c\u170e-\u1714\u1720-\u1736\u1740-\u1753\u1760-\u176c\u176e-\u1770\u1772-\u1773\u1780-\u17dd\u17e0-\u17e9\u17f0-\u17f9\u1800-\u180e\u1810-\u1819\u1820-\u1877\u1880-\u18aa\u18b0-\u18f5\u1900-\u191c\u1920-\u192b\u1930-\u193b\u1940\u1944-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u19d0-\u19da\u19de-\u1a1b\u1a1e-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1aa0-\u1aad\u1b00-\u1b4b\u1b50-\u1b7c\u1b80-\u1bf3\u1bfc-\u1c37\u1c3b-\u1c49\u1c4d-\u1c7f\u1cc0-\u1cc7\u1cd0-\u1cf6\u1d00-\u1de6\u1dfc-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fc4\u1fc6-\u1fd3\u1fd6-\u1fdb\u1fdd-\u1fef\u1ff2-\u1ff4\u1ff6-\u1ffe\u2000-\u2064\u206a-\u2071\u2074-\u208e\u2090-\u209c\u20a0-\u20b9\u20d0-\u20f0\u2100-\u2189\u2190-\u23f3\u2400-\u2426\u2440-\u244a\u2460-\u26ff\u2701-\u2b4c\u2b50-\u2b59\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2cf3\u2cf9-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f-\u2d70\u2d7f-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2de0-\u2e3b\u2e80-\u2e99\u2e9b-\u2ef3\u2f00-\u2fd5\u2ff0-\u2ffb\u3000-\u303f\u3041-\u3096\u3099-\u30ff\u3105-\u312d\u3131-\u318e\u3190-\u31ba\u31c0-\u31e3\u31f0-\u321e\u3220-\u32fe\u3300-\ua48c\ua490-\ua4c6\ua4d0-\ua62b\ua640-\ua697\ua69f-\ua6f7\ua700-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua82b\ua830-\ua839\ua840-\ua877\ua880-\ua8c4\ua8ce-\ua8d9\ua8e0-\ua8fb\ua900-\ua953\ua95f-\ua97c\ua980-\ua9cd\ua9cf-\ua9d9\ua9de-\ua9df\uaa00-\uaa36\uaa40-\uaa4d\uaa50-\uaa59\uaa5c-\uaa7b\uaa80-\uaac2\uaadb-\uaaf6\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabed\uabf0-\uabf9\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\ud800-\ufb06\ufb13-\ufb17\ufb1d-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufbc1\ufbd3-\ufd3f\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfd\ufe00-\ufe19\ufe20-\ufe26\ufe30-\ufe52\ufe54-\ufe66\ufe68-\ufe6b\ufe70-\ufe74\ufe76-\ufefc\ufeff\uff01-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc\uffe0-\uffe6\uffe8-\uffee\ufff9-\ufffd\U00010000-\U0001000b\U0001000d-\U00010026\U00010028-\U0001003a\U0001003c-\U0001003d\U0001003f-\U0001004d\U00010050-\U0001005d\U00010080-\U000100fa\U00010100-\U00010102\U00010107-\U00010133\U00010137-\U0001018a\U00010190-\U0001019b\U000101d0-\U000101fd\U00010280-\U0001029c\U000102a0-\U000102d0\U00010300-\U0001031e\U00010320-\U00010323\U00010330-\U0001034a\U00010380-\U0001039d\U0001039f-\U000103c3\U000103c8-\U000103d5\U00010400-\U0001049d\U000104a0-\U000104a9\U00010800-\U00010805\U00010808\U0001080a-\U00010835\U00010837-\U00010838\U0001083c\U0001083f-\U00010855\U00010857-\U0001085f\U00010900-\U0001091b\U0001091f-\U00010939\U0001093f\U00010980-\U000109b7\U000109be-\U000109bf\U00010a00-\U00010a03\U00010a05-\U00010a06\U00010a0c-\U00010a13\U00010a15-\U00010a17\U00010a19-\U00010a33\U00010a38-\U00010a3a\U00010a3f-\U00010a47\U00010a50-\U00010a58\U00010a60-\U00010a7f\U00010b00-\U00010b35\U00010b39-\U00010b55\U00010b58-\U00010b72\U00010b78-\U00010b7f\U00010c00-\U00010c48\U00010e60-\U00010e7e\U00011000-\U0001104d\U00011052-\U0001106f\U00011080-\U000110c1\U000110d0-\U000110e8\U000110f0-\U000110f9\U00011100-\U00011134\U00011136-\U00011143\U00011180-\U000111c8\U000111d0-\U000111d9\U00011680-\U000116b7\U000116c0-\U000116c9\U00012000-\U0001236e\U00012400-\U00012462\U00012470-\U00012473\U00013000-\U0001342e\U00016800-\U00016a38\U00016f00-\U00016f44\U00016f50-\U00016f7e\U00016f8f-\U00016f9f\U0001b000-\U0001b001\U0001d000-\U0001d0f5\U0001d100-\U0001d126\U0001d129-\U0001d1dd\U0001d200-\U0001d245\U0001d300-\U0001d356\U0001d360-\U0001d371\U0001d400-\U0001d454\U0001d456-\U0001d49c\U0001d49e-\U0001d49f\U0001d4a2\U0001d4a5-\U0001d4a6\U0001d4a9-\U0001d4ac\U0001d4ae-\U0001d4b9\U0001d4bb\U0001d4bd-\U0001d4c3\U0001d4c5-\U0001d505\U0001d507-\U0001d50a\U0001d50d-\U0001d514\U0001d516-\U0001d51c\U0001d51e-\U0001d539\U0001d53b-\U0001d53e\U0001d540-\U0001d544\U0001d546\U0001d54a-\U0001d550\U0001d552-\U0001d6a5\U0001d6a8-\U0001d7cb\U0001d7ce-\U0001d7ff\U0001ee00-\U0001ee03\U0001ee05-\U0001ee1f\U0001ee21-\U0001ee22\U0001ee24\U0001ee27\U0001ee29-\U0001ee32\U0001ee34-\U0001ee37\U0001ee39\U0001ee3b\U0001ee42\U0001ee47\U0001ee49\U0001ee4b\U0001ee4d-\U0001ee4f\U0001ee51-\U0001ee52\U0001ee54\U0001ee57\U0001ee59\U0001ee5b\U0001ee5d\U0001ee5f\U0001ee61-\U0001ee62\U0001ee64\U0001ee67-\U0001ee6a\U0001ee6c-\U0001ee72\U0001ee74-\U0001ee77\U0001ee79-\U0001ee7c\U0001ee7e\U0001ee80-\U0001ee89\U0001ee8b-\U0001ee9b\U0001eea1-\U0001eea3\U0001eea5-\U0001eea9\U0001eeab-\U0001eebb\U0001eef0-\U0001eef1\U0001f000-\U0001f02b\U0001f030-\U0001f093\U0001f0a0-\U0001f0ae\U0001f0b1-\U0001f0be\U0001f0c1-\U0001f0cf\U0001f0d1-\U0001f0df\U0001f100-\U0001f10a\U0001f110-\U0001f12e\U0001f130-\U0001f16b\U0001f170-\U0001f19a\U0001f1e6-\U0001f202\U0001f210-\U0001f23a\U0001f240-\U0001f248\U0001f250-\U0001f251\U0001f300-\U0001f320\U0001f330-\U0001f335\U0001f337-\U0001f37c\U0001f380-\U0001f393\U0001f3a0-\U0001f3c4\U0001f3c6-\U0001f3ca\U0001f3e0-\U0001f3f0\U0001f400-\U0001f43e\U0001f440\U0001f442-\U0001f4f7\U0001f4f9-\U0001f4fc\U0001f500-\U0001f53d\U0001f540-\U0001f543\U0001f550-\U0001f567\U0001f5fb-\U0001f640\U0001f645-\U0001f64f\U0001f680-\U0001f6c5\U0001f700-\U0001f773\U00020000-\U0002fffd\U00030000-\U0003fffd\U000e0001\U000e0020-\U000e007f\U000e0100-\U000e01ef\U000f0000-\U000ffffd\U00100000-\U0010fffd", "^wj": "\x00-\u205f\u2061-\ufefe\uff00-\U0010ffff", "^xx": "\x00-\udfff\uf900-\U000effff\U000ffffe-\U000fffff\U0010fffe-\U0010ffff", "^zw": "\x00-\u200a\u200c-\U0010ffff", "ai": "\xa7-\xa8\xaa\xb2-\xb3\xb6-\xba\xbc-\xbe\xd7\xf7\u02c7\u02c9-\u02cb\u02cd\u02d0\u02d8-\u02db\u02dd\u2015-\u2016\u2020-\u2021\u203b\u2074\u207f\u2081-\u2084\u2105\u2113\u2121-\u2122\u212b\u2154-\u2155\u215b\u215e\u2160-\u216b\u2170-\u2179\u2189\u2190-\u2199\u21d2\u21d4\u2200\u2202-\u2203\u2207-\u2208\u220b\u220f\u2211\u2215\u221a\u221d-\u2220\u2223\u2225\u2227-\u222c\u222e\u2234-\u2237\u223c-\u223d\u2248\u224c\u2252\u2260-\u2261\u2264-\u2267\u226a-\u226b\u226e-\u226f\u2282-\u2283\u2286-\u2287\u2295\u2299\u22a5\u22bf\u2312\u2460-\u24fe\u2500-\u254b\u2550-\u2574\u2580-\u258f\u2592-\u2595\u25a0-\u25a1\u25a3-\u25a9\u25b2-\u25b3\u25b6-\u25b7\u25bc-\u25bd\u25c0-\u25c1\u25c6-\u25c8\u25cb\u25ce-\u25d1\u25e2-\u25e5\u25ef\u2605-\u2606\u2609\u260e-\u260f\u2614-\u2617\u261c\u261e\u2640\u2642\u2660-\u2661\u2663-\u2665\u2667-\u266a\u266c-\u266d\u266f\u269e-\u269f\u26be-\u26bf\u26c4-\u26cd\u26cf-\u26e1\u26e3\u26e8-\u26ff\u2757\u2776-\u2793\u2b55-\u2b59\u3248-\u324f\ufffd\U0001f100-\U0001f10a\U0001f110-\U0001f12d\U0001f130-\U0001f169\U0001f170-\U0001f19a", "al": "\x23\x5c\x26\x2a\x3c-\x3e\x40-\x5a\x5c\x5e-\x7a\x5c\x7e\xa6\xa9\xac\xae-\xaf\xb5\xc0-\xd6\xd8-\xf6\xf8-\u02c6\u02ce-\u02cf\u02d1-\u02d7\u02dc\u02de\u02e0-\u02ff\u0370-\u0377\u037a-\u037d\u0384-\u038a\u038c\u038e-\u03a1\u03a3-\u0482\u048a-\u0527\u0531-\u0556\u0559-\u055f\u0561-\u0587\u05c0\u05c3\u05f3-\u05f4\u0600-\u0604\u0606-\u0608\u060e-\u060f\u0620-\u064a\u066d-\u066f\u0671-\u06d3\u06d5\u06dd-\u06de\u06e5-\u06e6\u06e9\u06ee-\u06ef\u06fa-\u070d\u070f-\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4-\u07f7\u07fa\u0800-\u0815\u081a\u0824\u0828\u0830-\u083e\u0840-\u0858\u085e\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0970-\u0977\u0979-\u097f\u0985-\u098c\u098f-\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc-\u09dd\u09df-\u09e1\u09f0-\u09f1\u09f4-\u09f8\u09fa\u0a05-\u0a0a\u0a0f-\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32-\u0a33\u0a35-\u0a36\u0a38-\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2-\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0-\u0ae1\u0af0\u0b05-\u0b0c\u0b0f-\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32-\u0b33\u0b35-\u0b39\u0b3d\u0b5c-\u0b5d\u0b5f-\u0b61\u0b70-\u0b77\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99-\u0b9a\u0b9c\u0b9e-\u0b9f\u0ba3-\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0bf0-\u0bf8\u0bfa\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58-\u0c59\u0c60-\u0c61\u0c78-\u0c7f\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0-\u0ce1\u0cf1-\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60-\u0d61\u0d70-\u0d75\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0df4\u0e4f\u0f00\u0f05\u0f13\u0f15-\u0f17\u0f1a-\u0f1f\u0f2a-\u0f33\u0f36\u0f38\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u0fc0-\u0fc5\u0fc7-\u0fcc\u0fce-\u0fcf\u0fd4-\u0fd8\u104c-\u104f\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10ff\u1200-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1360\u1362-\u137c\u1380-\u1399\u13a0-\u13f4\u1401-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u17d9\u17f0-\u17f9\u1800-\u1801\u1807\u180a\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1940\u19e0-\u1a16\u1a1e-\u1a1f\u1b05-\u1b33\u1b45-\u1b4b\u1b5c\u1b61-\u1b6a\u1b74-\u1b7c\u1b83-\u1ba0\u1bae-\u1baf\u1bba-\u1be5\u1bfc-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1cc0-\u1cc7\u1cd3\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5-\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fc4\u1fc6-\u1fd3\u1fd6-\u1fdb\u1fdd-\u1fef\u1ff2-\u1ff4\u1ff6-\u1ffc\u1ffe\u2017\u2022-\u2023\u2038\u203e-\u2043\u204a-\u2055\u2057\u205c\u2061-\u2064\u2070-\u2071\u2075-\u207c\u2080\u2085-\u208c\u2090-\u209c\u2100-\u2102\u2104\u2106-\u2108\u210a-\u2112\u2114-\u2115\u2117-\u2120\u2123-\u212a\u212c-\u2153\u2156-\u215a\u215c-\u215d\u215f\u216c-\u216f\u217a-\u2188\u219a-\u21d1\u21d3\u21d5-\u21ff\u2201\u2204-\u2206\u2209-\u220a\u220c-\u220e\u2210\u2214\u2216-\u2219\u221b-\u221c\u2221-\u2222\u2224\u2226\u222d\u222f-\u2233\u2238-\u223b\u223e-\u2247\u2249-\u224b\u224d-\u2251\u2253-\u225f\u2262-\u2263\u2268-\u2269\u226c-\u226d\u2270-\u2281\u2284-\u2285\u2288-\u2294\u2296-\u2298\u229a-\u22a4\u22a6-\u22be\u22c0-\u2311\u2313-\u2328\u232b-\u23f3\u2400-\u2426\u2440-\u244a\u24ff\u254c-\u254f\u2575-\u257f\u2590-\u2591\u2596-\u259f\u25a2\u25aa-\u25b1\u25b4-\u25b5\u25b8-\u25bb\u25be-\u25bf\u25c2-\u25c5\u25c9-\u25ca\u25cc-\u25cd\u25d2-\u25e1\u25e6-\u25ee\u25f0-\u2604\u2607-\u2608\u260a-\u260d\u2610-\u2613\u2618-\u261b\u261d\u261f-\u263f\u2641\u2643-\u265f\u2662\u2666\u266b\u266e\u2670-\u269d\u26a0-\u26bd\u26c0-\u26c3\u26ce\u26e2\u26e4-\u26e7\u2701-\u2756\u2758-\u275a\u275f-\u2761\u2764-\u2767\u2794-\u27c4\u27c7-\u27e5\u27f0-\u2982\u2999-\u29d7\u29dc-\u29fb\u29fe-\u2b4c\u2b50-\u2b54\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2cee\u2cf2-\u2cf3\u2cfd\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e16\u2e1a-\u2e1b\u2e1e-\u2e1f\u2e2f\u2e32\u2e35-\u2e39\u4dc0-\u4dff\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a-\ua62b\ua640-\ua66e\ua673\ua67e-\ua697\ua6a0-\ua6ef\ua6f2\ua700-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua828-\ua82b\ua830-\ua837\ua839\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8fb\ua90a-\ua925\ua930-\ua946\ua95f\ua984-\ua9b2\ua9c1-\ua9c6\ua9ca-\ua9cd\ua9cf\ua9de-\ua9df\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa5c\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\ufb00-\ufb06\ufb13-\ufb17\ufb29\ufb50-\ufbc1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufdfd\ufe70-\ufe74\ufe76-\ufefc\uff66\uff71-\uff9d\uffa0-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc\uffe8-\uffee\U00010000-\U0001000b\U0001000d-\U00010026\U00010028-\U0001003a\U0001003c-\U0001003d\U0001003f-\U0001004d\U00010050-\U0001005d\U00010080-\U000100fa\U00010107-\U00010133\U00010137-\U0001018a\U00010190-\U0001019b\U000101d0-\U000101fc\U00010280-\U0001029c\U000102a0-\U000102d0\U00010300-\U0001031e\U00010320-\U00010323\U00010330-\U0001034a\U00010380-\U0001039d\U000103a0-\U000103c3\U000103c8-\U000103cf\U000103d1-\U000103d5\U00010400-\U0001049d\U00010800-\U00010805\U00010808\U0001080a-\U00010835\U00010837-\U00010838\U0001083c\U0001083f-\U00010855\U00010858-\U0001085f\U00010900-\U0001091b\U00010920-\U00010939\U0001093f\U00010980-\U000109b7\U000109be-\U000109bf\U00010a00\U00010a10-\U00010a13\U00010a15-\U00010a17\U00010a19-\U00010a33\U00010a40-\U00010a47\U00010a58\U00010a60-\U00010a7f\U00010b00-\U00010b35\U00010b40-\U00010b55\U00010b58-\U00010b72\U00010b78-\U00010b7f\U00010c00-\U00010c48\U00010e60-\U00010e7e\U00011003-\U00011037\U00011049-\U0001104d\U00011052-\U00011065\U00011083-\U000110af\U000110bb-\U000110bd\U000110d0-\U000110e8\U00011103-\U00011126\U00011183-\U000111b2\U000111c1-\U000111c4\U000111c7\U00011680-\U000116aa\U00012000-\U0001236e\U00012400-\U00012462\U00013000-\U00013257\U0001325e-\U00013281\U00013283-\U00013285\U0001328a-\U00013378\U0001337c-\U0001342e\U00016800-\U00016a38\U00016f00-\U00016f44\U00016f50\U00016f93-\U00016f9f\U0001d000-\U0001d0f5\U0001d100-\U0001d126\U0001d129-\U0001d164\U0001d16a-\U0001d16c\U0001d183-\U0001d184\U0001d18c-\U0001d1a9\U0001d1ae-\U0001d1dd\U0001d200-\U0001d241\U0001d245\U0001d300-\U0001d356\U0001d360-\U0001d371\U0001d400-\U0001d454\U0001d456-\U0001d49c\U0001d49e-\U0001d49f\U0001d4a2\U0001d4a5-\U0001d4a6\U0001d4a9-\U0001d4ac\U0001d4ae-\U0001d4b9\U0001d4bb\U0001d4bd-\U0001d4c3\U0001d4c5-\U0001d505\U0001d507-\U0001d50a\U0001d50d-\U0001d514\U0001d516-\U0001d51c\U0001d51e-\U0001d539\U0001d53b-\U0001d53e\U0001d540-\U0001d544\U0001d546\U0001d54a-\U0001d550\U0001d552-\U0001d6a5\U0001d6a8-\U0001d7cb\U0001ee00-\U0001ee03\U0001ee05-\U0001ee1f\U0001ee21-\U0001ee22\U0001ee24\U0001ee27\U0001ee29-\U0001ee32\U0001ee34-\U0001ee37\U0001ee39\U0001ee3b\U0001ee42\U0001ee47\U0001ee49\U0001ee4b\U0001ee4d-\U0001ee4f\U0001ee51-\U0001ee52\U0001ee54\U0001ee57\U0001ee59\U0001ee5b\U0001ee5d\U0001ee5f\U0001ee61-\U0001ee62\U0001ee64\U0001ee67-\U0001ee6a\U0001ee6c-\U0001ee72\U0001ee74-\U0001ee77\U0001ee79-\U0001ee7c\U0001ee7e\U0001ee80-\U0001ee89\U0001ee8b-\U0001ee9b\U0001eea1-\U0001eea3\U0001eea5-\U0001eea9\U0001eeab-\U0001eebb\U0001eef0-\U0001eef1\U0001f000-\U0001f02b\U0001f030-\U0001f093\U0001f0a0-\U0001f0ae\U0001f0b1-\U0001f0be\U0001f0c1-\U0001f0cf\U0001f0d1-\U0001f0df\U0001f12e\U0001f16a-\U0001f16b\U0001f1e6-\U0001f1ff\U0001f300-\U0001f320\U0001f330-\U0001f335\U0001f337-\U0001f37c\U0001f380-\U0001f393\U0001f3a0-\U0001f3c4\U0001f3c6-\U0001f3ca\U0001f3e0-\U0001f3f0\U0001f400-\U0001f43e\U0001f440\U0001f442-\U0001f4f7\U0001f4f9-\U0001f4fc\U0001f500-\U0001f53d\U0001f540-\U0001f543\U0001f550-\U0001f567\U0001f5fb-\U0001f640\U0001f645-\U0001f64f\U0001f680-\U0001f6c5\U0001f700-\U0001f773", "b2": "\u2014\u2e3a-\u2e3b", "ba": "\x09\x5c\x7c\xad\u058a\u05be\u0964-\u0965\u0e5a-\u0e5b\u0f0b\u0f34\u0f7f\u0f85\u0fbe-\u0fbf\u0fd2\u104a-\u104b\u1361\u1400\u1680\u16eb-\u16ed\u1735-\u1736\u17d4-\u17d5\u17d8\u17da\u1804-\u1805\u1b5a-\u1b5b\u1b5d-\u1b60\u1c3b-\u1c3f\u1c7e-\u1c7f\u2000-\u2006\u2008-\u200a\u2010\u2012-\u2013\u2027\u2056\u2058-\u205b\u205d-\u205f\u2cfa-\u2cfc\u2cff\u2d70\u2e0e-\u2e15\u2e17\u2e19\u2e2a-\u2e2d\u2e30-\u2e31\u2e33-\u2e34\ua4fe-\ua4ff\ua60d\ua60f\ua6f3-\ua6f7\ua8ce-\ua8cf\ua92e-\ua92f\ua9c7-\ua9c9\uaa5d-\uaa5f\uaaf0-\uaaf1\uabeb\U00010100-\U00010102\U0001039f\U000103d0\U00010857\U0001091f\U00010a50-\U00010a57\U00010b39-\U00010b3f\U00011047-\U00011048\U000110be-\U000110c1\U00011140-\U00011143\U000111c5-\U000111c6\U000111c8\U00012470-\U00012473", "bb": "\xb4\u02c8\u02cc\u02df\u0f01-\u0f04\u0f06-\u0f07\u0f09-\u0f0a\u0fd0-\u0fd1\u0fd3\u1806\u1ffd\ua874-\ua875", "bk": "\x0b-\x0c\u2028-\u2029", "cb": "\ufffc", "cj": "\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087\u308e\u3095-\u3096\u30a1\u30a3\u30a5\u30a7\u30a9\u30c3\u30e3\u30e5\u30e7\u30ee\u30f5-\u30f6\u30fc\u31f0-\u31ff\uff67-\uff70", "cl": "\x7d\u0f3b\u0f3d\u169c\u2046\u207e\u208e\u232a\u2769\u276b\u276d\u276f\u2771\u2773\u2775\u27c6\u27e7\u27e9\u27eb\u27ed\u27ef\u2984\u2986\u2988\u298a\u298c\u298e\u2990\u2992\u2994\u2996\u2998\u29d9\u29db\u29fd\u2e23\u2e25\u2e27\u2e29\u3001-\u3002\u3009\u300b\u300d\u300f\u3011\u3015\u3017\u3019\u301b\u301e-\u301f\ufd3f\ufe11-\ufe12\ufe18\ufe36\ufe38\ufe3a\ufe3c\ufe3e\ufe40\ufe42\ufe44\ufe48\ufe50\ufe52\ufe5a\ufe5c\ufe5e\uff09\uff0c\uff0e\uff3d\uff5d\uff60-\uff61\uff63-\uff64\U0001325b-\U0001325d\U00013282\U00013287\U00013289\U0001337a-\U0001337b", "cm": "\x00-\x08\x0e-\x1f\x7f-\x84\x86-\x9f\u0300-\u034e\u0350-\u035b\u0363-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05c7\u0610-\u061a\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7-\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e4-\u08fe\u0900-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962-\u0963\u0981-\u0983\u09bc\u09be-\u09c4\u09c7-\u09c8\u09cb-\u09cd\u09d7\u09e2-\u09e3\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a51\u0a70-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2-\u0ae3\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47-\u0b48\u0b4b-\u0b4d\u0b56-\u0b57\u0b62-\u0b63\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0c01-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56\u0c62-\u0c63\u0c82-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5-\u0cd6\u0ce2-\u0ce3\u0d02-\u0d03\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62-\u0d63\u0d82-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2-\u0df3\u0f18-\u0f19\u0f35\u0f37\u0f39\u0f3e-\u0f3f\u0f71-\u0f7e\u0f80-\u0f84\u0f86-\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u180b-\u180d\u18a9\u1920-\u192b\u1930-\u193b\u1a17-\u1a1b\u1a7f\u1b00-\u1b04\u1b34-\u1b44\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1be6-\u1bf3\u1c24-\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2-\u1cf4\u1dc0-\u1de6\u1dfc-\u1dff\u200c-\u200f\u202a-\u202e\u206a-\u206f\u20d0-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099-\u309a\ua66f-\ua672\ua674-\ua67d\ua69f\ua6f0-\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880-\ua881\ua8b4-\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\uaa29-\uaa36\uaa43\uaa4c-\uaa4d\uaaeb-\uaaef\uaaf5-\uaaf6\uabe3-\uabea\uabec-\uabed\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\ufff9-\ufffb\U000101fd\U00010a01-\U00010a03\U00010a05-\U00010a06\U00010a0c-\U00010a0f\U00010a38-\U00010a3a\U00010a3f\U00011000-\U00011002\U00011038-\U00011046\U00011080-\U00011082\U000110b0-\U000110ba\U00011100-\U00011102\U00011127-\U00011134\U00011180-\U00011182\U000111b3-\U000111c0\U000116ab-\U000116b7\U00016f51-\U00016f7e\U00016f8f-\U00016f92\U0001d165-\U0001d169\U0001d16d-\U0001d182\U0001d185-\U0001d18b\U0001d1aa-\U0001d1ad\U0001d242-\U0001d244\U000e0001\U000e0020-\U000e007f\U000e0100-\U000e01ef", "cp": "\x29\x5c\x5d", "cr": "\x0d", "ex": "\x21\x3f\u05c6\u061b\u061e-\u061f\u06d4\u07f9\u0f0d-\u0f11\u0f14\u1802-\u1803\u1808-\u1809\u1944-\u1945\u2762-\u2763\u2cf9\u2cfe\u2e2e\ua60e\ua876-\ua877\ufe15-\ufe16\ufe56-\ufe57\uff01\uff1f", "gl": "\xa0\u034f\u035c-\u0362\u0f08\u0f0c\u0f12\u0fd9-\u0fda\u180e\u2007\u2011\u202f", "h2": "\uac00\uac1c\uac38\uac54\uac70\uac8c\uaca8\uacc4\uace0\uacfc\uad18\uad34\uad50\uad6c\uad88\uada4\uadc0\uaddc\uadf8\uae14\uae30\uae4c\uae68\uae84\uaea0\uaebc\uaed8\uaef4\uaf10\uaf2c\uaf48\uaf64\uaf80\uaf9c\uafb8\uafd4\uaff0\ub00c\ub028\ub044\ub060\ub07c\ub098\ub0b4\ub0d0\ub0ec\ub108\ub124\ub140\ub15c\ub178\ub194\ub1b0\ub1cc\ub1e8\ub204\ub220\ub23c\ub258\ub274\ub290\ub2ac\ub2c8\ub2e4\ub300\ub31c\ub338\ub354\ub370\ub38c\ub3a8\ub3c4\ub3e0\ub3fc\ub418\ub434\ub450\ub46c\ub488\ub4a4\ub4c0\ub4dc\ub4f8\ub514\ub530\ub54c\ub568\ub584\ub5a0\ub5bc\ub5d8\ub5f4\ub610\ub62c\ub648\ub664\ub680\ub69c\ub6b8\ub6d4\ub6f0\ub70c\ub728\ub744\ub760\ub77c\ub798\ub7b4\ub7d0\ub7ec\ub808\ub824\ub840\ub85c\ub878\ub894\ub8b0\ub8cc\ub8e8\ub904\ub920\ub93c\ub958\ub974\ub990\ub9ac\ub9c8\ub9e4\uba00\uba1c\uba38\uba54\uba70\uba8c\ubaa8\ubac4\ubae0\ubafc\ubb18\ubb34\ubb50\ubb6c\ubb88\ubba4\ubbc0\ubbdc\ubbf8\ubc14\ubc30\ubc4c\ubc68\ubc84\ubca0\ubcbc\ubcd8\ubcf4\ubd10\ubd2c\ubd48\ubd64\ubd80\ubd9c\ubdb8\ubdd4\ubdf0\ube0c\ube28\ube44\ube60\ube7c\ube98\ubeb4\ubed0\ubeec\ubf08\ubf24\ubf40\ubf5c\ubf78\ubf94\ubfb0\ubfcc\ubfe8\uc004\uc020\uc03c\uc058\uc074\uc090\uc0ac\uc0c8\uc0e4\uc100\uc11c\uc138\uc154\uc170\uc18c\uc1a8\uc1c4\uc1e0\uc1fc\uc218\uc234\uc250\uc26c\uc288\uc2a4\uc2c0\uc2dc\uc2f8\uc314\uc330\uc34c\uc368\uc384\uc3a0\uc3bc\uc3d8\uc3f4\uc410\uc42c\uc448\uc464\uc480\uc49c\uc4b8\uc4d4\uc4f0\uc50c\uc528\uc544\uc560\uc57c\uc598\uc5b4\uc5d0\uc5ec\uc608\uc624\uc640\uc65c\uc678\uc694\uc6b0\uc6cc\uc6e8\uc704\uc720\uc73c\uc758\uc774\uc790\uc7ac\uc7c8\uc7e4\uc800\uc81c\uc838\uc854\uc870\uc88c\uc8a8\uc8c4\uc8e0\uc8fc\uc918\uc934\uc950\uc96c\uc988\uc9a4\uc9c0\uc9dc\uc9f8\uca14\uca30\uca4c\uca68\uca84\ucaa0\ucabc\ucad8\ucaf4\ucb10\ucb2c\ucb48\ucb64\ucb80\ucb9c\ucbb8\ucbd4\ucbf0\ucc0c\ucc28\ucc44\ucc60\ucc7c\ucc98\uccb4\uccd0\uccec\ucd08\ucd24\ucd40\ucd5c\ucd78\ucd94\ucdb0\ucdcc\ucde8\uce04\uce20\uce3c\uce58\uce74\uce90\uceac\ucec8\ucee4\ucf00\ucf1c\ucf38\ucf54\ucf70\ucf8c\ucfa8\ucfc4\ucfe0\ucffc\ud018\ud034\ud050\ud06c\ud088\ud0a4\ud0c0\ud0dc\ud0f8\ud114\ud130\ud14c\ud168\ud184\ud1a0\ud1bc\ud1d8\ud1f4\ud210\ud22c\ud248\ud264\ud280\ud29c\ud2b8\ud2d4\ud2f0\ud30c\ud328\ud344\ud360\ud37c\ud398\ud3b4\ud3d0\ud3ec\ud408\ud424\ud440\ud45c\ud478\ud494\ud4b0\ud4cc\ud4e8\ud504\ud520\ud53c\ud558\ud574\ud590\ud5ac\ud5c8\ud5e4\ud600\ud61c\ud638\ud654\ud670\ud68c\ud6a8\ud6c4\ud6e0\ud6fc\ud718\ud734\ud750\ud76c\ud788", "h3": "\uac01-\uac1b\uac1d-\uac37\uac39-\uac53\uac55-\uac6f\uac71-\uac8b\uac8d-\uaca7\uaca9-\uacc3\uacc5-\uacdf\uace1-\uacfb\uacfd-\uad17\uad19-\uad33\uad35-\uad4f\uad51-\uad6b\uad6d-\uad87\uad89-\uada3\uada5-\uadbf\uadc1-\uaddb\uaddd-\uadf7\uadf9-\uae13\uae15-\uae2f\uae31-\uae4b\uae4d-\uae67\uae69-\uae83\uae85-\uae9f\uaea1-\uaebb\uaebd-\uaed7\uaed9-\uaef3\uaef5-\uaf0f\uaf11-\uaf2b\uaf2d-\uaf47\uaf49-\uaf63\uaf65-\uaf7f\uaf81-\uaf9b\uaf9d-\uafb7\uafb9-\uafd3\uafd5-\uafef\uaff1-\ub00b\ub00d-\ub027\ub029-\ub043\ub045-\ub05f\ub061-\ub07b\ub07d-\ub097\ub099-\ub0b3\ub0b5-\ub0cf\ub0d1-\ub0eb\ub0ed-\ub107\ub109-\ub123\ub125-\ub13f\ub141-\ub15b\ub15d-\ub177\ub179-\ub193\ub195-\ub1af\ub1b1-\ub1cb\ub1cd-\ub1e7\ub1e9-\ub203\ub205-\ub21f\ub221-\ub23b\ub23d-\ub257\ub259-\ub273\ub275-\ub28f\ub291-\ub2ab\ub2ad-\ub2c7\ub2c9-\ub2e3\ub2e5-\ub2ff\ub301-\ub31b\ub31d-\ub337\ub339-\ub353\ub355-\ub36f\ub371-\ub38b\ub38d-\ub3a7\ub3a9-\ub3c3\ub3c5-\ub3df\ub3e1-\ub3fb\ub3fd-\ub417\ub419-\ub433\ub435-\ub44f\ub451-\ub46b\ub46d-\ub487\ub489-\ub4a3\ub4a5-\ub4bf\ub4c1-\ub4db\ub4dd-\ub4f7\ub4f9-\ub513\ub515-\ub52f\ub531-\ub54b\ub54d-\ub567\ub569-\ub583\ub585-\ub59f\ub5a1-\ub5bb\ub5bd-\ub5d7\ub5d9-\ub5f3\ub5f5-\ub60f\ub611-\ub62b\ub62d-\ub647\ub649-\ub663\ub665-\ub67f\ub681-\ub69b\ub69d-\ub6b7\ub6b9-\ub6d3\ub6d5-\ub6ef\ub6f1-\ub70b\ub70d-\ub727\ub729-\ub743\ub745-\ub75f\ub761-\ub77b\ub77d-\ub797\ub799-\ub7b3\ub7b5-\ub7cf\ub7d1-\ub7eb\ub7ed-\ub807\ub809-\ub823\ub825-\ub83f\ub841-\ub85b\ub85d-\ub877\ub879-\ub893\ub895-\ub8af\ub8b1-\ub8cb\ub8cd-\ub8e7\ub8e9-\ub903\ub905-\ub91f\ub921-\ub93b\ub93d-\ub957\ub959-\ub973\ub975-\ub98f\ub991-\ub9ab\ub9ad-\ub9c7\ub9c9-\ub9e3\ub9e5-\ub9ff\uba01-\uba1b\uba1d-\uba37\uba39-\uba53\uba55-\uba6f\uba71-\uba8b\uba8d-\ubaa7\ubaa9-\ubac3\ubac5-\ubadf\ubae1-\ubafb\ubafd-\ubb17\ubb19-\ubb33\ubb35-\ubb4f\ubb51-\ubb6b\ubb6d-\ubb87\ubb89-\ubba3\ubba5-\ubbbf\ubbc1-\ubbdb\ubbdd-\ubbf7\ubbf9-\ubc13\ubc15-\ubc2f\ubc31-\ubc4b\ubc4d-\ubc67\ubc69-\ubc83\ubc85-\ubc9f\ubca1-\ubcbb\ubcbd-\ubcd7\ubcd9-\ubcf3\ubcf5-\ubd0f\ubd11-\ubd2b\ubd2d-\ubd47\ubd49-\ubd63\ubd65-\ubd7f\ubd81-\ubd9b\ubd9d-\ubdb7\ubdb9-\ubdd3\ubdd5-\ubdef\ubdf1-\ube0b\ube0d-\ube27\ube29-\ube43\ube45-\ube5f\ube61-\ube7b\ube7d-\ube97\ube99-\ubeb3\ubeb5-\ubecf\ubed1-\ubeeb\ubeed-\ubf07\ubf09-\ubf23\ubf25-\ubf3f\ubf41-\ubf5b\ubf5d-\ubf77\ubf79-\ubf93\ubf95-\ubfaf\ubfb1-\ubfcb\ubfcd-\ubfe7\ubfe9-\uc003\uc005-\uc01f\uc021-\uc03b\uc03d-\uc057\uc059-\uc073\uc075-\uc08f\uc091-\uc0ab\uc0ad-\uc0c7\uc0c9-\uc0e3\uc0e5-\uc0ff\uc101-\uc11b\uc11d-\uc137\uc139-\uc153\uc155-\uc16f\uc171-\uc18b\uc18d-\uc1a7\uc1a9-\uc1c3\uc1c5-\uc1df\uc1e1-\uc1fb\uc1fd-\uc217\uc219-\uc233\uc235-\uc24f\uc251-\uc26b\uc26d-\uc287\uc289-\uc2a3\uc2a5-\uc2bf\uc2c1-\uc2db\uc2dd-\uc2f7\uc2f9-\uc313\uc315-\uc32f\uc331-\uc34b\uc34d-\uc367\uc369-\uc383\uc385-\uc39f\uc3a1-\uc3bb\uc3bd-\uc3d7\uc3d9-\uc3f3\uc3f5-\uc40f\uc411-\uc42b\uc42d-\uc447\uc449-\uc463\uc465-\uc47f\uc481-\uc49b\uc49d-\uc4b7\uc4b9-\uc4d3\uc4d5-\uc4ef\uc4f1-\uc50b\uc50d-\uc527\uc529-\uc543\uc545-\uc55f\uc561-\uc57b\uc57d-\uc597\uc599-\uc5b3\uc5b5-\uc5cf\uc5d1-\uc5eb\uc5ed-\uc607\uc609-\uc623\uc625-\uc63f\uc641-\uc65b\uc65d-\uc677\uc679-\uc693\uc695-\uc6af\uc6b1-\uc6cb\uc6cd-\uc6e7\uc6e9-\uc703\uc705-\uc71f\uc721-\uc73b\uc73d-\uc757\uc759-\uc773\uc775-\uc78f\uc791-\uc7ab\uc7ad-\uc7c7\uc7c9-\uc7e3\uc7e5-\uc7ff\uc801-\uc81b\uc81d-\uc837\uc839-\uc853\uc855-\uc86f\uc871-\uc88b\uc88d-\uc8a7\uc8a9-\uc8c3\uc8c5-\uc8df\uc8e1-\uc8fb\uc8fd-\uc917\uc919-\uc933\uc935-\uc94f\uc951-\uc96b\uc96d-\uc987\uc989-\uc9a3\uc9a5-\uc9bf\uc9c1-\uc9db\uc9dd-\uc9f7\uc9f9-\uca13\uca15-\uca2f\uca31-\uca4b\uca4d-\uca67\uca69-\uca83\uca85-\uca9f\ucaa1-\ucabb\ucabd-\ucad7\ucad9-\ucaf3\ucaf5-\ucb0f\ucb11-\ucb2b\ucb2d-\ucb47\ucb49-\ucb63\ucb65-\ucb7f\ucb81-\ucb9b\ucb9d-\ucbb7\ucbb9-\ucbd3\ucbd5-\ucbef\ucbf1-\ucc0b\ucc0d-\ucc27\ucc29-\ucc43\ucc45-\ucc5f\ucc61-\ucc7b\ucc7d-\ucc97\ucc99-\uccb3\uccb5-\ucccf\uccd1-\ucceb\ucced-\ucd07\ucd09-\ucd23\ucd25-\ucd3f\ucd41-\ucd5b\ucd5d-\ucd77\ucd79-\ucd93\ucd95-\ucdaf\ucdb1-\ucdcb\ucdcd-\ucde7\ucde9-\uce03\uce05-\uce1f\uce21-\uce3b\uce3d-\uce57\uce59-\uce73\uce75-\uce8f\uce91-\uceab\ucead-\ucec7\ucec9-\ucee3\ucee5-\uceff\ucf01-\ucf1b\ucf1d-\ucf37\ucf39-\ucf53\ucf55-\ucf6f\ucf71-\ucf8b\ucf8d-\ucfa7\ucfa9-\ucfc3\ucfc5-\ucfdf\ucfe1-\ucffb\ucffd-\ud017\ud019-\ud033\ud035-\ud04f\ud051-\ud06b\ud06d-\ud087\ud089-\ud0a3\ud0a5-\ud0bf\ud0c1-\ud0db\ud0dd-\ud0f7\ud0f9-\ud113\ud115-\ud12f\ud131-\ud14b\ud14d-\ud167\ud169-\ud183\ud185-\ud19f\ud1a1-\ud1bb\ud1bd-\ud1d7\ud1d9-\ud1f3\ud1f5-\ud20f\ud211-\ud22b\ud22d-\ud247\ud249-\ud263\ud265-\ud27f\ud281-\ud29b\ud29d-\ud2b7\ud2b9-\ud2d3\ud2d5-\ud2ef\ud2f1-\ud30b\ud30d-\ud327\ud329-\ud343\ud345-\ud35f\ud361-\ud37b\ud37d-\ud397\ud399-\ud3b3\ud3b5-\ud3cf\ud3d1-\ud3eb\ud3ed-\ud407\ud409-\ud423\ud425-\ud43f\ud441-\ud45b\ud45d-\ud477\ud479-\ud493\ud495-\ud4af\ud4b1-\ud4cb\ud4cd-\ud4e7\ud4e9-\ud503\ud505-\ud51f\ud521-\ud53b\ud53d-\ud557\ud559-\ud573\ud575-\ud58f\ud591-\ud5ab\ud5ad-\ud5c7\ud5c9-\ud5e3\ud5e5-\ud5ff\ud601-\ud61b\ud61d-\ud637\ud639-\ud653\ud655-\ud66f\ud671-\ud68b\ud68d-\ud6a7\ud6a9-\ud6c3\ud6c5-\ud6df\ud6e1-\ud6fb\ud6fd-\ud717\ud719-\ud733\ud735-\ud74f\ud751-\ud76b\ud76d-\ud787\ud789-\ud7a3", "hl": "\u05d0-\u05ea\u05f0-\u05f2\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4f", "hy": "\x5c\x2d", "id": "\u2e80-\u2e99\u2e9b-\u2ef3\u2f00-\u2fd5\u2ff0-\u2ffb\u3000\u3003-\u3004\u3006-\u3007\u3012-\u3013\u3020-\u3029\u3030-\u303a\u303d-\u303f\u3042\u3044\u3046\u3048\u304a-\u3062\u3064-\u3082\u3084\u3086\u3088-\u308d\u308f-\u3094\u309f\u30a2\u30a4\u30a6\u30a8\u30aa-\u30c2\u30c4-\u30e2\u30e4\u30e6\u30e8-\u30ed\u30ef-\u30f4\u30f7-\u30fa\u30ff\u3105-\u312d\u3131-\u318e\u3190-\u31ba\u31c0-\u31e3\u3200-\u321e\u3220-\u3247\u3250-\u32fe\u3300-\u4dbf\u4e00-\ua014\ua016-\ua48c\ua490-\ua4c6\uf900-\ufaff\ufe30-\ufe34\ufe45-\ufe46\ufe49-\ufe4f\ufe51\ufe58\ufe5f-\ufe66\ufe68\ufe6b\uff02-\uff03\uff06-\uff07\uff0a-\uff0b\uff0d\uff0f-\uff19\uff1c-\uff1e\uff20-\uff3a\uff3c\uff3e-\uff5a\uff5c\uff5e\uffe2-\uffe4\U0001b000-\U0001b001\U0001f200-\U0001f202\U0001f210-\U0001f23a\U0001f240-\U0001f248\U0001f250-\U0001f251\U00020000-\U0002fffd\U00030000-\U0003fffd", "in": "\u2024-\u2026\ufe19", "is": "\x2c\x2e\x3a-\x3b\u037e\u0589\u060c-\u060d\u07f8\u2044\ufe10\ufe13-\ufe14", "jl": "\u1100-\u115f\ua960-\ua97c", "jt": "\u11a8-\u11ff\ud7cb-\ud7fb", "jv": "\u1160-\u11a7\ud7b0-\ud7c6", "lf": "\x0a", "nl": "\x85", "ns": "\u17d6\u203c-\u203d\u2047-\u2049\u3005\u301c\u303b-\u303c\u309b-\u309e\u30a0\u30fb\u30fd-\u30fe\ua015\ufe54-\ufe55\uff1a-\uff1b\uff65\uff9e-\uff9f", "nu": "\x30-\x39\u0660-\u0669\u066b-\u066c\u06f0-\u06f9\u07c0-\u07c9\u0966-\u096f\u09e6-\u09ef\u0a66-\u0a6f\u0ae6-\u0aef\u0b66-\u0b6f\u0be6-\u0bef\u0c66-\u0c6f\u0ce6-\u0cef\u0d66-\u0d6f\u0e50-\u0e59\u0ed0-\u0ed9\u0f20-\u0f29\u1040-\u1049\u1090-\u1099\u17e0-\u17e9\u1810-\u1819\u1946-\u194f\u19d0-\u19d9\u1a80-\u1a89\u1a90-\u1a99\u1b50-\u1b59\u1bb0-\u1bb9\u1c40-\u1c49\u1c50-\u1c59\ua620-\ua629\ua8d0-\ua8d9\ua900-\ua909\ua9d0-\ua9d9\uaa50-\uaa59\uabf0-\uabf9\U000104a0-\U000104a9\U00011066-\U0001106f\U000110f0-\U000110f9\U00011136-\U0001113f\U000111d0-\U000111d9\U000116c0-\U000116c9\U0001d7ce-\U0001d7ff", "op": "\x28\x5c\x5b\x7b\xa1\xbf\u0f3a\u0f3c\u169b\u201a\u201e\u2045\u207d\u208d\u2329\u2768\u276a\u276c\u276e\u2770\u2772\u2774\u27c5\u27e6\u27e8\u27ea\u27ec\u27ee\u2983\u2985\u2987\u2989\u298b\u298d\u298f\u2991\u2993\u2995\u2997\u29d8\u29da\u29fc\u2e18\u2e22\u2e24\u2e26\u2e28\u3008\u300a\u300c\u300e\u3010\u3014\u3016\u3018\u301a\u301d\ufd3e\ufe17\ufe35\ufe37\ufe39\ufe3b\ufe3d\ufe3f\ufe41\ufe43\ufe47\ufe59\ufe5b\ufe5d\uff08\uff3b\uff5b\uff5f\uff62\U00013258-\U0001325a\U00013286\U00013288\U00013379", "po": "\x25\xa2\xb0\u0609-\u060b\u066a\u09f2-\u09f3\u09f9\u0d79\u2030-\u2037\u20a7\u20b6\u2103\u2109\ua838\ufdfc\ufe6a\uff05\uffe0", "pr": "\x24\x2b\x5c\x5c\xa3-\xa5\xb1\u058f\u09fb\u0af1\u0bf9\u0e3f\u17db\u20a0-\u20a6\u20a8-\u20b5\u20b7-\u20b9\u2116\u2212-\u2213\ufe69\uff04\uffe1\uffe5-\uffe6", "qu": "\x22\x27\xab\xbb\u2018-\u2019\u201b-\u201d\u201f\u2039-\u203a\u275b-\u275e\u2e00-\u2e0d\u2e1c-\u2e1d\u2e20-\u2e21", "sa": "\u0e01-\u0e3a\u0e40-\u0e4e\u0e81-\u0e82\u0e84\u0e87-\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa-\u0eab\u0ead-\u0eb9\u0ebb-\u0ebd\u0ec0-\u0ec4\u0ec6\u0ec8-\u0ecd\u0edc-\u0edf\u1000-\u103f\u1050-\u108f\u109a-\u109f\u1780-\u17d3\u17d7\u17dc-\u17dd\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u19da\u19de-\u19df\u1a20-\u1a5e\u1a60-\u1a7c\u1aa0-\u1aad\uaa60-\uaa7b\uaa80-\uaac2\uaadb-\uaadf", "sg": "\ud800-\udfff", "sp": "\x20", "sy": "\x2f", "unknown": "\u0378-\u0379\u037f-\u0383\u038b\u038d\u03a2\u0528-\u0530\u0557-\u0558\u0560\u0588\u058b-\u058e\u0590\u05c8-\u05cf\u05eb-\u05ef\u05f5-\u05ff\u0605\u061c-\u061d\u070e\u074b-\u074c\u07b2-\u07bf\u07fb-\u07ff\u082e-\u082f\u083f\u085c-\u085d\u085f-\u089f\u08a1\u08ad-\u08e3\u08ff\u0978\u0980\u0984\u098d-\u098e\u0991-\u0992\u09a9\u09b1\u09b3-\u09b5\u09ba-\u09bb\u09c5-\u09c6\u09c9-\u09ca\u09cf-\u09d6\u09d8-\u09db\u09de\u09e4-\u09e5\u09fc-\u0a00\u0a04\u0a0b-\u0a0e\u0a11-\u0a12\u0a29\u0a31\u0a34\u0a37\u0a3a-\u0a3b\u0a3d\u0a43-\u0a46\u0a49-\u0a4a\u0a4e-\u0a50\u0a52-\u0a58\u0a5d\u0a5f-\u0a65\u0a76-\u0a80\u0a84\u0a8e\u0a92\u0aa9\u0ab1\u0ab4\u0aba-\u0abb\u0ac6\u0aca\u0ace-\u0acf\u0ad1-\u0adf\u0ae4-\u0ae5\u0af2-\u0b00\u0b04\u0b0d-\u0b0e\u0b11-\u0b12\u0b29\u0b31\u0b34\u0b3a-\u0b3b\u0b45-\u0b46\u0b49-\u0b4a\u0b4e-\u0b55\u0b58-\u0b5b\u0b5e\u0b64-\u0b65\u0b78-\u0b81\u0b84\u0b8b-\u0b8d\u0b91\u0b96-\u0b98\u0b9b\u0b9d\u0ba0-\u0ba2\u0ba5-\u0ba7\u0bab-\u0bad\u0bba-\u0bbd\u0bc3-\u0bc5\u0bc9\u0bce-\u0bcf\u0bd1-\u0bd6\u0bd8-\u0be5\u0bfb-\u0c00\u0c04\u0c0d\u0c11\u0c29\u0c34\u0c3a-\u0c3c\u0c45\u0c49\u0c4e-\u0c54\u0c57\u0c5a-\u0c5f\u0c64-\u0c65\u0c70-\u0c77\u0c80-\u0c81\u0c84\u0c8d\u0c91\u0ca9\u0cb4\u0cba-\u0cbb\u0cc5\u0cc9\u0cce-\u0cd4\u0cd7-\u0cdd\u0cdf\u0ce4-\u0ce5\u0cf0\u0cf3-\u0d01\u0d04\u0d0d\u0d11\u0d3b-\u0d3c\u0d45\u0d49\u0d4f-\u0d56\u0d58-\u0d5f\u0d64-\u0d65\u0d76-\u0d78\u0d80-\u0d81\u0d84\u0d97-\u0d99\u0db2\u0dbc\u0dbe-\u0dbf\u0dc7-\u0dc9\u0dcb-\u0dce\u0dd5\u0dd7\u0de0-\u0df1\u0df5-\u0e00\u0e3b-\u0e3e\u0e5c-\u0e80\u0e83\u0e85-\u0e86\u0e89\u0e8b-\u0e8c\u0e8e-\u0e93\u0e98\u0ea0\u0ea4\u0ea6\u0ea8-\u0ea9\u0eac\u0eba\u0ebe-\u0ebf\u0ec5\u0ec7\u0ece-\u0ecf\u0eda-\u0edb\u0ee0-\u0eff\u0f48\u0f6d-\u0f70\u0f98\u0fbd\u0fcd\u0fdb-\u0fff\u10c6\u10c8-\u10cc\u10ce-\u10cf\u1249\u124e-\u124f\u1257\u1259\u125e-\u125f\u1289\u128e-\u128f\u12b1\u12b6-\u12b7\u12bf\u12c1\u12c6-\u12c7\u12d7\u1311\u1316-\u1317\u135b-\u135c\u137d-\u137f\u139a-\u139f\u13f5-\u13ff\u169d-\u169f\u16f1-\u16ff\u170d\u1715-\u171f\u1737-\u173f\u1754-\u175f\u176d\u1771\u1774-\u177f\u17de-\u17df\u17ea-\u17ef\u17fa-\u17ff\u180f\u181a-\u181f\u1878-\u187f\u18ab-\u18af\u18f6-\u18ff\u191d-\u191f\u192c-\u192f\u193c-\u193f\u1941-\u1943\u196e-\u196f\u1975-\u197f\u19ac-\u19af\u19ca-\u19cf\u19db-\u19dd\u1a1c-\u1a1d\u1a5f\u1a7d-\u1a7e\u1a8a-\u1a8f\u1a9a-\u1a9f\u1aae-\u1aff\u1b4c-\u1b4f\u1b7d-\u1b7f\u1bf4-\u1bfb\u1c38-\u1c3a\u1c4a-\u1c4c\u1c80-\u1cbf\u1cc8-\u1ccf\u1cf7-\u1cff\u1de7-\u1dfb\u1f16-\u1f17\u1f1e-\u1f1f\u1f46-\u1f47\u1f4e-\u1f4f\u1f58\u1f5a\u1f5c\u1f5e\u1f7e-\u1f7f\u1fb5\u1fc5\u1fd4-\u1fd5\u1fdc\u1ff0-\u1ff1\u1ff5\u1fff\u2065-\u2069\u2072-\u2073\u208f\u209d-\u209f\u20ba-\u20cf\u20f1-\u20ff\u218a-\u218f\u23f4-\u23ff\u2427-\u243f\u244b-\u245f\u2700\u2b4d-\u2b4f\u2b5a-\u2bff\u2c2f\u2c5f\u2cf4-\u2cf8\u2d26\u2d28-\u2d2c\u2d2e-\u2d2f\u2d68-\u2d6e\u2d71-\u2d7e\u2d97-\u2d9f\u2da7\u2daf\u2db7\u2dbf\u2dc7\u2dcf\u2dd7\u2ddf\u2e3c-\u2e7f\u2e9a\u2ef4-\u2eff\u2fd6-\u2fef\u2ffc-\u2fff\u3040\u3097-\u3098\u3100-\u3104\u312e-\u3130\u318f\u31bb-\u31bf\u31e4-\u31ef\u321f\u32ff\ua48d-\ua48f\ua4c7-\ua4cf\ua62c-\ua63f\ua698-\ua69e\ua6f8-\ua6ff\ua78f\ua794-\ua79f\ua7ab-\ua7f7\ua82c-\ua82f\ua83a-\ua83f\ua878-\ua87f\ua8c5-\ua8cd\ua8da-\ua8df\ua8fc-\ua8ff\ua954-\ua95e\ua97d-\ua97f\ua9ce\ua9da-\ua9dd\ua9e0-\ua9ff\uaa37-\uaa3f\uaa4e-\uaa4f\uaa5a-\uaa5b\uaa7c-\uaa7f\uaac3-\uaada\uaaf7-\uab00\uab07-\uab08\uab0f-\uab10\uab17-\uab1f\uab27\uab2f-\uabbf\uabee-\uabef\uabfa-\uabff\ud7a4-\ud7af\ud7c7-\ud7ca\ud7fc-\ud7ff\ufb07-\ufb12\ufb18-\ufb1c\ufb37\ufb3d\ufb3f\ufb42\ufb45\ufbc2-\ufbd2\ufd40-\ufd4f\ufd90-\ufd91\ufdc8-\ufdef\ufdfe-\ufdff\ufe1a-\ufe1f\ufe27-\ufe2f\ufe53\ufe67\ufe6c-\ufe6f\ufe75\ufefd-\ufefe\uff00\uffbf-\uffc1\uffc8-\uffc9\uffd0-\uffd1\uffd8-\uffd9\uffdd-\uffdf\uffe7\uffef-\ufff8\ufffe-\uffff\U0001000c\U00010027\U0001003b\U0001003e\U0001004e-\U0001004f\U0001005e-\U0001007f\U000100fb-\U000100ff\U00010103-\U00010106\U00010134-\U00010136\U0001018b-\U0001018f\U0001019c-\U000101cf\U000101fe-\U0001027f\U0001029d-\U0001029f\U000102d1-\U000102ff\U0001031f\U00010324-\U0001032f\U0001034b-\U0001037f\U0001039e\U000103c4-\U000103c7\U000103d6-\U000103ff\U0001049e-\U0001049f\U000104aa-\U000107ff\U00010806-\U00010807\U00010809\U00010836\U00010839-\U0001083b\U0001083d-\U0001083e\U00010856\U00010860-\U000108ff\U0001091c-\U0001091e\U0001093a-\U0001093e\U00010940-\U0001097f\U000109b8-\U000109bd\U000109c0-\U000109ff\U00010a04\U00010a07-\U00010a0b\U00010a14\U00010a18\U00010a34-\U00010a37\U00010a3b-\U00010a3e\U00010a48-\U00010a4f\U00010a59-\U00010a5f\U00010a80-\U00010aff\U00010b36-\U00010b38\U00010b56-\U00010b57\U00010b73-\U00010b77\U00010b80-\U00010bff\U00010c49-\U00010e5f\U00010e7f-\U00010fff\U0001104e-\U00011051\U00011070-\U0001107f\U000110c2-\U000110cf\U000110e9-\U000110ef\U000110fa-\U000110ff\U00011135\U00011144-\U0001117f\U000111c9-\U000111cf\U000111da-\U0001167f\U000116b8-\U000116bf\U000116ca-\U00011fff\U0001236f-\U000123ff\U00012463-\U0001246f\U00012474-\U00012fff\U0001342f-\U000167ff\U00016a39-\U00016eff\U00016f45-\U00016f4f\U00016f7f-\U00016f8e\U00016fa0-\U0001afff\U0001b002-\U0001cfff\U0001d0f6-\U0001d0ff\U0001d127-\U0001d128\U0001d1de-\U0001d1ff\U0001d246-\U0001d2ff\U0001d357-\U0001d35f\U0001d372-\U0001d3ff\U0001d455\U0001d49d\U0001d4a0-\U0001d4a1\U0001d4a3-\U0001d4a4\U0001d4a7-\U0001d4a8\U0001d4ad\U0001d4ba\U0001d4bc\U0001d4c4\U0001d506\U0001d50b-\U0001d50c\U0001d515\U0001d51d\U0001d53a\U0001d53f\U0001d545\U0001d547-\U0001d549\U0001d551\U0001d6a6-\U0001d6a7\U0001d7cc-\U0001d7cd\U0001d800-\U0001edff\U0001ee04\U0001ee20\U0001ee23\U0001ee25-\U0001ee26\U0001ee28\U0001ee33\U0001ee38\U0001ee3a\U0001ee3c-\U0001ee41\U0001ee43-\U0001ee46\U0001ee48\U0001ee4a\U0001ee4c\U0001ee50\U0001ee53\U0001ee55-\U0001ee56\U0001ee58\U0001ee5a\U0001ee5c\U0001ee5e\U0001ee60\U0001ee63\U0001ee65-\U0001ee66\U0001ee6b\U0001ee73\U0001ee78\U0001ee7d\U0001ee7f\U0001ee8a\U0001ee9c-\U0001eea0\U0001eea4\U0001eeaa\U0001eebc-\U0001eeef\U0001eef2-\U0001efff\U0001f02c-\U0001f02f\U0001f094-\U0001f09f\U0001f0af-\U0001f0b0\U0001f0bf-\U0001f0c0\U0001f0d0\U0001f0e0-\U0001f0ff\U0001f10b-\U0001f10f\U0001f12f\U0001f16c-\U0001f16f\U0001f19b-\U0001f1e5\U0001f203-\U0001f20f\U0001f23b-\U0001f23f\U0001f249-\U0001f24f\U0001f252-\U0001f2ff\U0001f321-\U0001f32f\U0001f336\U0001f37d-\U0001f37f\U0001f394-\U0001f39f\U0001f3c5\U0001f3cb-\U0001f3df\U0001f3f1-\U0001f3ff\U0001f43f\U0001f441\U0001f4f8\U0001f4fd-\U0001f4ff\U0001f53e-\U0001f53f\U0001f544-\U0001f54f\U0001f568-\U0001f5fa\U0001f641-\U0001f644\U0001f650-\U0001f67f\U0001f6c6-\U0001f6ff\U0001f774-\U0001ffff\U0002fffe-\U0002ffff\U0003fffe-\U000e0000\U000e0002-\U000e001f\U000e0080-\U000e00ff\U000e01f0-\U000effff\U000ffffe-\U000fffff\U0010fffe-\U0010ffff", "wj": "\u2060\ufeff", "xx": "\ue000-\uf8ff\U000f0000-\U000ffffd\U00100000-\U0010fffd", "zw": "\u200b" } ascii_line_break = { "^ai": "\x00-\xa6\xa9\xab-\xb1\xb4-\xb5\xbb\xbf-\xd6\xd8-\xf6\xf8-\xff", "^al": "\x00-\x22\x24-\x25\x27-\x29\x2b-\x3b\x3f\x5c\x5b-\x5c\x5d\x7b-\x7d\x7f-\xa5\xa7-\xa8\xaa-\xab\xad\xb0-\xb4\xb6-\xbf\xd7\xf7", "^b2": "\x00-\xff", "^ba": "\x00-\x08\x0a-\x7b\x7d-\xac\xae-\xff", "^bb": "\x00-\xb3\xb5-\xff", "^bk": "\x00-\x0a\x0d-\xff", "^cb": "\x00-\xff", "^cj": "\x00-\xff", "^cl": "\x00-\x5c\x7c\x5c\x7e-\xff", "^cm": "\x09-\x0d\x20-\x5c\x7e\x85\xa0-\xff", "^cp": "\x00-\x28\x2a-\x5c\x5c\x5c\x5e-\xff", "^cr": "\x00-\x0c\x0e-\xff", "^ex": "\x00-\x20\x22-\x3e\x40-\xff", "^gl": "\x00-\x9f\xa1-\xff", "^h2": "\x00-\xff", "^h3": "\x00-\xff", "^hl": "\x00-\xff", "^hy": "\x00-\x2c\x2e-\xff", "^id": "\x00-\xff", "^in": "\x00-\xff", "^is": "\x00-\x2b\x5c\x2d\x2f-\x39\x3c-\xff", "^jl": "\x00-\xff", "^jt": "\x00-\xff", "^jv": "\x00-\xff", "^lf": "\x00-\x09\x0b-\xff", "^nl": "\x00-\x84\x86-\xff", "^ns": "\x00-\xff", "^nu": "\x00-\x2f\x3a-\xff", "^op": "\x00-\x27\x29-\x5a\x5c\x5c-\x7a\x5c\x7c-\xa0\xa2-\xbe\xc0-\xff", "^po": "\x00-\x24\x5c\x26-\xa1\xa3-\xaf\xb1-\xff", "^pr": "\x00-\x23\x25-\x2a\x2c-\x5c\x5b\x5c\x5d-\xa2\xa6-\xb0\xb2-\xff", "^qu": "\x00-\x21\x23-\x5c\x26\x28-\xaa\xac-\xba\xbc-\xff", "^sa": "\x00-\xff", "^sg": "\x00-\xff", "^sp": "\x00-\x1f\x21-\xff", "^sy": "\x00-\x2e\x30-\xff", "^unknown": "\x00-\xff", "^wj": "\x00-\xff", "^xx": "\x00-\xff", "^zw": "\x00-\xff", "ai": "\xa7-\xa8\xaa\xb2-\xb3\xb6-\xba\xbc-\xbe\xd7\xf7", "al": "\x23\x5c\x26\x2a\x3c-\x3e\x40-\x5a\x5c\x5e-\x7a\x5c\x7e\xa6\xa9\xac\xae-\xaf\xb5\xc0-\xd6\xd8-\xf6\xf8-\xff", "b2": "", "ba": "\x09\x5c\x7c\xad", "bb": "\xb4", "bk": "\x0b-\x0c", "cb": "", "cj": "", "cl": "\x7d", "cm": "\x00-\x08\x0e-\x1f\x7f-\x84\x86-\x9f", "cp": "\x29\x5c\x5d", "cr": "\x0d", "ex": "\x21\x3f", "gl": "\xa0", "h2": "", "h3": "", "hl": "", "hy": "\x5c\x2d", "id": "", "in": "", "is": "\x2c\x2e\x3a-\x3b", "jl": "", "jt": "", "jv": "", "lf": "\x0a", "nl": "\x85", "ns": "", "nu": "\x30-\x39", "op": "\x28\x5c\x5b\x7b\xa1\xbf", "po": "\x25\xa2\xb0", "pr": "\x24\x2b\x5c\x5c\xa3-\xa5\xb1", "qu": "\x22\x27\xab\xbb", "sa": "", "sg": "", "sp": "\x20", "sy": "\x2f", "unknown": "", "wj": "", "xx": "", "zw": "" }
mit
avati/samba
python/samba/idmap.py
50
3258
# Unix SMB/CIFS implementation. # Copyright (C) 2008 Kai Blin <kai@samba.org> # # # 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/>. # """Convenience functions for using the idmap database.""" __docformat__ = "restructuredText" import ldb import samba class IDmapDB(samba.Ldb): """The IDmap database.""" # Mappings for ID_TYPE_UID, ID_TYPE_GID and ID_TYPE_BOTH TYPE_UID = 1 TYPE_GID = 2 TYPE_BOTH = 3 def __init__(self, url=None, lp=None, modules_dir=None, session_info=None, credentials=None, flags=0, options=None): """Opens the IDMap Database. For parameter meanings see the super class (samba.Ldb) """ self.lp = lp if url is None: url = lp.private_path("idmap.ldb") super(IDmapDB, self).__init__(url=url, lp=lp, modules_dir=modules_dir, session_info=session_info, credentials=credentials, flags=flags, options=options) def connect(self, url=None, flags=0, options=None): super(IDmapDB, self).connect(url=self.lp.private_path(url), flags=flags, options=options) def increment_xid(self): """Increment xidNumber, if not present it create and assign it to the lowerBound :return xid can that be used for SID/unixid mapping """ res = self.search(expression="distinguishedName=CN=CONFIG", base="", scope=ldb.SCOPE_SUBTREE) id = res[0].get("xidNumber") flag = ldb.FLAG_MOD_REPLACE if id is None: id = res[0].get("lowerBound") flag = ldb.FLAG_MOD_ADD newid = int(str(id)) + 1 msg = ldb.Message() msg.dn = ldb.Dn(self, "CN=CONFIG") msg["xidNumber"] = ldb.MessageElement(str(newid), flag, "xidNumber") self.modify(msg) return id def setup_name_mapping(self, sid, type, unixid=None): """Setup a mapping between a sam name and a unix name. :param sid: SID of the NT-side of the mapping. :param unixname: Unix id to map to, if none supplied the next one will be selected """ if unixid is None: unixid = self.increment_xid() type_string = "" if type == self.TYPE_UID: type_string = "ID_TYPE_UID" elif type == self.TYPE_GID: type_string = "ID_TYPE_GID" elif type == self.TYPE_BOTH: type_string = "ID_TYPE_BOTH" else: return mod = """ dn: CN=%s xidNumber: %s objectSid: %s objectClass: sidMap type: %s cn: %s """ % (sid, unixid, sid, type_string, sid) self.add(self.parse_ldif(mod).next()[1])
gpl-3.0
olasitarska/django
django/contrib/gis/maps/google/zoom.py
87
6678
from __future__ import unicode_literals from django.contrib.gis.geos import GEOSGeometry, LinearRing, Polygon, Point from django.contrib.gis.maps.google.gmap import GoogleMapException from django.utils.six.moves import xrange from math import pi, sin, log, exp, atan # Constants used for degree to radian conversion, and vice-versa. DTOR = pi / 180. RTOD = 180. / pi class GoogleZoom(object): """ GoogleZoom is a utility for performing operations related to the zoom levels on Google Maps. This class is inspired by the OpenStreetMap Mapnik tile generation routine `generate_tiles.py`, and the article "How Big Is the World" (Hack #16) in "Google Maps Hacks" by Rich Gibson and Schuyler Erle. `generate_tiles.py` may be found at: http://trac.openstreetmap.org/browser/applications/rendering/mapnik/generate_tiles.py "Google Maps Hacks" may be found at http://safari.oreilly.com/0596101619 """ def __init__(self, num_zoom=19, tilesize=256): "Initializes the Google Zoom object." # Google's tilesize is 256x256, square tiles are assumed. self._tilesize = tilesize # The number of zoom levels self._nzoom = num_zoom # Initializing arrays to hold the parameters for each one of the # zoom levels. self._degpp = [] # Degrees per pixel self._radpp = [] # Radians per pixel self._npix = [] # 1/2 the number of pixels for a tile at the given zoom level # Incrementing through the zoom levels and populating the parameter arrays. z = tilesize # The number of pixels per zoom level. for i in xrange(num_zoom): # Getting the degrees and radians per pixel, and the 1/2 the number of # for every zoom level. self._degpp.append(z / 360.) # degrees per pixel self._radpp.append(z / (2 * pi)) # radians per pixel self._npix.append(z / 2) # number of pixels to center of tile # Multiplying `z` by 2 for the next iteration. z *= 2 def __len__(self): "Returns the number of zoom levels." return self._nzoom def get_lon_lat(self, lonlat): "Unpacks longitude, latitude from GEOS Points and 2-tuples." if isinstance(lonlat, Point): lon, lat = lonlat.coords else: lon, lat = lonlat return lon, lat def lonlat_to_pixel(self, lonlat, zoom): "Converts a longitude, latitude coordinate pair for the given zoom level." # Setting up, unpacking the longitude, latitude values and getting the # number of pixels for the given zoom level. lon, lat = self.get_lon_lat(lonlat) npix = self._npix[zoom] # Calculating the pixel x coordinate by multiplying the longitude value # with the number of degrees/pixel at the given zoom level. px_x = round(npix + (lon * self._degpp[zoom])) # Creating the factor, and ensuring that 1 or -1 is not passed in as the # base to the logarithm. Here's why: # if fac = -1, we'll get log(0) which is undefined; # if fac = 1, our logarithm base will be divided by 0, also undefined. fac = min(max(sin(DTOR * lat), -0.9999), 0.9999) # Calculating the pixel y coordinate. px_y = round(npix + (0.5 * log((1 + fac) / (1 - fac)) * (-1.0 * self._radpp[zoom]))) # Returning the pixel x, y to the caller of the function. return (px_x, px_y) def pixel_to_lonlat(self, px, zoom): "Converts a pixel to a longitude, latitude pair at the given zoom level." if len(px) != 2: raise TypeError('Pixel should be a sequence of two elements.') # Getting the number of pixels for the given zoom level. npix = self._npix[zoom] # Calculating the longitude value, using the degrees per pixel. lon = (px[0] - npix) / self._degpp[zoom] # Calculating the latitude value. lat = RTOD * (2 * atan(exp((px[1] - npix) / (-1.0 * self._radpp[zoom]))) - 0.5 * pi) # Returning the longitude, latitude coordinate pair. return (lon, lat) def tile(self, lonlat, zoom): """ Returns a Polygon corresponding to the region represented by a fictional Google Tile for the given longitude/latitude pair and zoom level. This tile is used to determine the size of a tile at the given point. """ # The given lonlat is the center of the tile. delta = self._tilesize / 2 # Getting the pixel coordinates corresponding to the # the longitude/latitude. px = self.lonlat_to_pixel(lonlat, zoom) # Getting the lower-left and upper-right lat/lon coordinates # for the bounding box of the tile. ll = self.pixel_to_lonlat((px[0] - delta, px[1] - delta), zoom) ur = self.pixel_to_lonlat((px[0] + delta, px[1] + delta), zoom) # Constructing the Polygon, representing the tile and returning. return Polygon(LinearRing(ll, (ll[0], ur[1]), ur, (ur[0], ll[1]), ll), srid=4326) def get_zoom(self, geom): "Returns the optimal Zoom level for the given geometry." # Checking the input type. if not isinstance(geom, GEOSGeometry) or geom.srid != 4326: raise TypeError('get_zoom() expects a GEOS Geometry with an SRID of 4326.') # Getting the envelope for the geometry, and its associated width, height # and centroid. env = geom.envelope env_w, env_h = self.get_width_height(env.extent) center = env.centroid for z in xrange(self._nzoom): # Getting the tile at the zoom level. tile_w, tile_h = self.get_width_height(self.tile(center, z).extent) # When we span more than one tile, this is an approximately good # zoom level. if (env_w > tile_w) or (env_h > tile_h): if z == 0: raise GoogleMapException('Geometry width and height should not exceed that of the Earth.') return z - 1 # Otherwise, we've zoomed in to the max. return self._nzoom - 1 def get_width_height(self, extent): """ Returns the width and height for the given extent. """ # Getting the lower-left, upper-left, and upper-right # coordinates from the extent. ll = Point(extent[:2]) ul = Point(extent[0], extent[3]) ur = Point(extent[2:]) # Calculating the width and height. height = ll.distance(ul) width = ul.distance(ur) return width, height
bsd-3-clause
JoeWoo/grpc
src/python/grpcio_test/grpc_test/beta/test_utilities.py
8
2535
# Copyright 2015, Google Inc. # 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 Google Inc. nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """Test-appropriate entry points into the gRPC Python Beta API.""" from grpc._adapter import _intermediary_low from grpc.beta import implementations def not_really_secure_channel( host, port, client_credentials, server_host_override): """Creates an insecure Channel to a remote host. Args: host: The name of the remote host to which to connect. port: The port of the remote host to which to connect. client_credentials: The implementations.ClientCredentials with which to connect. server_host_override: The target name used for SSL host name checking. Returns: An implementations.Channel to the remote host through which RPCs may be conducted. """ hostport = '%s:%d' % (host, port) intermediary_low_channel = _intermediary_low.Channel( hostport, client_credentials._intermediary_low_credentials, server_host_override=server_host_override) return implementations.Channel( intermediary_low_channel._internal, intermediary_low_channel)
bsd-3-clause
tobegit3hub/once2016
website/home/models.py
1
1439
from __future__ import unicode_literals import datetime from django.db import models class UserPhoto(models.Model): user_name = models.CharField(max_length=128, default="") user_phone = models.CharField(max_length=128, default="") access_code = models.CharField(max_length=128) photo_name = models.CharField(max_length=128) class Appointment(models.Model): user_name = models.CharField(max_length=32) user_phone = models.CharField(max_length=32) #user_email = models.CharField(max_length=32) photo_type = models.CharField(max_length=32, default="") photo_people_number = models.CharField(max_length=32, default="") appointment_date = models.CharField(max_length=32, default="") appointment_time = models.CharField(max_length=32, default="") submit_time = models.DateTimeField(default=datetime.datetime.now) #finish_time = models.DateTimeField(default=datetime.datetime.now, blank=True) def __str__(self): return "{}-{}".format(self.appointment_date, self.appointment_time) class AvailableTime(models.Model): #day = models.DateTimeField(default=datetime.datetime.now) time1 = models.IntegerField(default=0) time2 = models.IntegerField(default=0) time3 = models.IntegerField(default=0) time4 = models.IntegerField(default=0) time5 = models.IntegerField(default=0) time6 = models.IntegerField(default=0) time7 = models.IntegerField(default=0) time8 = models.IntegerField(default=0)
apache-2.0
theicfire/djangofun
django/utils/simplejson/encoder.py
430
15620
"""Implementation of JSONEncoder """ import re c_encode_basestring_ascii = None c_make_encoder = None ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]') ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])') HAS_UTF8 = re.compile(r'[\x80-\xff]') ESCAPE_DCT = { '\\': '\\\\', '"': '\\"', '\b': '\\b', '\f': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', } for i in range(0x20): ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,)) # Assume this produces an infinity on all machines (probably not guaranteed) INFINITY = float('1e66666') FLOAT_REPR = repr def encode_basestring(s): """Return a JSON representation of a Python string """ def replace(match): return ESCAPE_DCT[match.group(0)] return '"' + ESCAPE.sub(replace, s) + '"' def py_encode_basestring_ascii(s): """Return an ASCII-only JSON representation of a Python string """ if isinstance(s, str) and HAS_UTF8.search(s) is not None: s = s.decode('utf-8') def replace(match): s = match.group(0) try: return ESCAPE_DCT[s] except KeyError: n = ord(s) if n < 0x10000: return '\\u%04x' % (n,) else: # surrogate pair n -= 0x10000 s1 = 0xd800 | ((n >> 10) & 0x3ff) s2 = 0xdc00 | (n & 0x3ff) return '\\u%04x\\u%04x' % (s1, s2) return '"' + str(ESCAPE_ASCII.sub(replace, s)) + '"' encode_basestring_ascii = c_encode_basestring_ascii or py_encode_basestring_ascii class JSONEncoder(object): """Extensible JSON <http://json.org> encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str, unicode | string | +-------------------+---------------+ | int, long, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). """ item_separator = ', ' key_separator = ': ' def __init__(self, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, encoding='utf-8', default=None): """Constructor for JSONEncoder, with sensible defaults. If skipkeys is False, then it is a TypeError to attempt encoding of keys that are not str, int, long, float or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is True, the output is guaranteed to be str objects with all incoming unicode characters escaped. If ensure_ascii is false, the output will be unicode object. If check_circular is True, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place. If allow_nan is True, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is True, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. If specified, separators should be a (item_separator, key_separator) tuple. The default is (', ', ': '). To get the most compact JSON representation you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. If encoding is not None, then all input strings will be transformed into unicode using that encoding prior to JSON-encoding. The default is UTF-8. """ self.skipkeys = skipkeys self.ensure_ascii = ensure_ascii self.check_circular = check_circular self.allow_nan = allow_nan self.sort_keys = sort_keys self.indent = indent if separators is not None: self.item_separator, self.key_separator = separators if default is not None: self.default = default self.encoding = encoding def default(self, o): """Implement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) return JSONEncoder.default(self, o) """ raise TypeError("%r is not JSON serializable" % (o,)) def encode(self, o): """Return a JSON string representation of a Python data structure. >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' """ # This is for extremely simple cases and benchmarks. if isinstance(o, basestring): if isinstance(o, str): _encoding = self.encoding if (_encoding is not None and not (_encoding == 'utf-8')): o = o.decode(_encoding) if self.ensure_ascii: return encode_basestring_ascii(o) else: return encode_basestring(o) # This doesn't pass the iterator directly to ''.join() because the # exceptions aren't as detailed. The list call should be roughly # equivalent to the PySequence_Fast that ''.join() would do. chunks = self.iterencode(o, _one_shot=True) if not isinstance(chunks, (list, tuple)): chunks = list(chunks) return ''.join(chunks) def iterencode(self, o, _one_shot=False): """Encode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) """ if self.check_circular: markers = {} else: markers = None if self.ensure_ascii: _encoder = encode_basestring_ascii else: _encoder = encode_basestring if self.encoding != 'utf-8': def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding): if isinstance(o, str): o = o.decode(_encoding) return _orig_encoder(o) def floatstr(o, allow_nan=self.allow_nan, _repr=FLOAT_REPR, _inf=INFINITY, _neginf=-INFINITY): # Check for specials. Note that this type of test is processor- and/or # platform-specific, so do tests which don't depend on the internals. if o != o: text = 'NaN' elif o == _inf: text = 'Infinity' elif o == _neginf: text = '-Infinity' else: return _repr(o) if not allow_nan: raise ValueError("Out of range float values are not JSON compliant: %r" % (o,)) return text if _one_shot and c_make_encoder is not None and not self.indent and not self.sort_keys: _iterencode = c_make_encoder( markers, self.default, _encoder, self.indent, self.key_separator, self.item_separator, self.sort_keys, self.skipkeys, self.allow_nan) else: _iterencode = _make_iterencode( markers, self.default, _encoder, self.indent, floatstr, self.key_separator, self.item_separator, self.sort_keys, self.skipkeys, _one_shot) return _iterencode(o, 0) def _make_iterencode(markers, _default, _encoder, _indent, _floatstr, _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot, ## HACK: hand-optimized bytecode; turn globals into locals False=False, True=True, ValueError=ValueError, basestring=basestring, dict=dict, float=float, id=id, int=int, isinstance=isinstance, list=list, long=long, str=str, tuple=tuple, ): def _iterencode_list(lst, _current_indent_level): if not lst: yield '[]' return if markers is not None: markerid = id(lst) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = lst buf = '[' if _indent is not None: _current_indent_level += 1 newline_indent = '\n' + (' ' * (_indent * _current_indent_level)) separator = _item_separator + newline_indent buf += newline_indent else: newline_indent = None separator = _item_separator first = True for value in lst: if first: first = False else: buf = separator if isinstance(value, basestring): yield buf + _encoder(value) elif value is None: yield buf + 'null' elif value is True: yield buf + 'true' elif value is False: yield buf + 'false' elif isinstance(value, (int, long)): yield buf + str(value) elif isinstance(value, float): yield buf + _floatstr(value) else: yield buf if isinstance(value, (list, tuple)): chunks = _iterencode_list(value, _current_indent_level) elif isinstance(value, dict): chunks = _iterencode_dict(value, _current_indent_level) else: chunks = _iterencode(value, _current_indent_level) for chunk in chunks: yield chunk if newline_indent is not None: _current_indent_level -= 1 yield '\n' + (' ' * (_indent * _current_indent_level)) yield ']' if markers is not None: del markers[markerid] def _iterencode_dict(dct, _current_indent_level): if not dct: yield '{}' return if markers is not None: markerid = id(dct) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = dct yield '{' if _indent is not None: _current_indent_level += 1 newline_indent = '\n' + (' ' * (_indent * _current_indent_level)) item_separator = _item_separator + newline_indent yield newline_indent else: newline_indent = None item_separator = _item_separator first = True if _sort_keys: items = dct.items() items.sort(key=lambda kv: kv[0]) else: items = dct.iteritems() for key, value in items: if isinstance(key, basestring): pass # JavaScript is weakly typed for these, so it makes sense to # also allow them. Many encoders seem to do something like this. elif isinstance(key, float): key = _floatstr(key) elif isinstance(key, (int, long)): key = str(key) elif key is True: key = 'true' elif key is False: key = 'false' elif key is None: key = 'null' elif _skipkeys: continue else: raise TypeError("key %r is not a string" % (key,)) if first: first = False else: yield item_separator yield _encoder(key) yield _key_separator if isinstance(value, basestring): yield _encoder(value) elif value is None: yield 'null' elif value is True: yield 'true' elif value is False: yield 'false' elif isinstance(value, (int, long)): yield str(value) elif isinstance(value, float): yield _floatstr(value) else: if isinstance(value, (list, tuple)): chunks = _iterencode_list(value, _current_indent_level) elif isinstance(value, dict): chunks = _iterencode_dict(value, _current_indent_level) else: chunks = _iterencode(value, _current_indent_level) for chunk in chunks: yield chunk if newline_indent is not None: _current_indent_level -= 1 yield '\n' + (' ' * (_indent * _current_indent_level)) yield '}' if markers is not None: del markers[markerid] def _iterencode(o, _current_indent_level): if isinstance(o, basestring): yield _encoder(o) elif o is None: yield 'null' elif o is True: yield 'true' elif o is False: yield 'false' elif isinstance(o, (int, long)): yield str(o) elif isinstance(o, float): yield _floatstr(o) elif isinstance(o, (list, tuple)): for chunk in _iterencode_list(o, _current_indent_level): yield chunk elif isinstance(o, dict): for chunk in _iterencode_dict(o, _current_indent_level): yield chunk else: if markers is not None: markerid = id(o) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = o o = _default(o) for chunk in _iterencode(o, _current_indent_level): yield chunk if markers is not None: del markers[markerid] return _iterencode
bsd-3-clause
tmerr/trevornet
trevornet/trevornet/idx.py
1
3888
#! /usr/bin/env python3 """ Parse an IDX file like the one used in the MNIST handwritten digit database. A description of the format is on this page: http://yann.lecun.com/exdb/mnist/ """ import struct import array import sys def _is_sequence(seq): return hasattr(seq, '__getitem__') and not hasattr(seq, 'strip') def find_dimensions(seq): """Find the dimensions sizes of the sequence by recursively finding deeper sequences. A sequence with maximum indexes seq[3][5] uses dimension sizes (3, 5). The length of this tuple is the number of dimensions. Params: lst: The sequence to find the dimensions of. Return: A list of dimension sizes """ sizes = [] if _is_sequence(seq): sizes.append(len(seq)) sizes += find_dimensions(seq[0]) return sizes def _build_magic_number(seq, typestr): typebytes = { 'B': b'\x08', 'b': b'\x09', 'h': b'\x0B', 'i': b'\x0C', 'f': b'\x0D', 'd': b'\x0E' } dimension_sizes = find_dimensions(seq) num_dimensions = len(dimension_sizes) dimensionbyte = num_dimensions.to_bytes(1, 'big') header = b'\x00\x00' + typebytes[typestr] + dimensionbyte return header def _build_dimension_sizes(seq): bytez = bytearray() dims = find_dimensions(seq) for size in dims: bytez += (struct.pack('>i', size)) return bytez def _build_data(seq, typecode): if not _is_sequence(seq): formatstring = '>{0}'.format(typecode) return struct.pack(formatstring, seq) data = bytearray() if _is_sequence(seq): for s in seq: data.extend(_build_data(s, typecode)) return data def list_to_idx(lst, typecode): """Convert an n dimensional list into IDX bytes. Params: lst: The n dimensional list to convert and write. typecode: The C type the data should be stored as. B: unsigned byte b: signed byte h: short (2 bytes) i: int (4 bytes) f: float (4 bytes) d: double (8 bytes) """ magicnumber = _build_magic_number(lst, typecode) dimension_sizes = _build_dimension_sizes(lst) data = _build_data(lst, typecode) return magicnumber + dimension_sizes + data def idx_to_list(bytez): """Convert the IDX bytes to nested lists Params: bytez: The IDX file bytes. """ # byte 0: 0 # byte 1: 0 if not (bytez[0] == 0 and bytez[1] == 0): raise IOError("IDX file should start with two 0 bytes") # byte 2: The number of dimensions # byte 3: The type code typebyte = bytez[2] numdims = bytez[3] # 4 bytes for each dimension: size of dimensions fmtstring = '>' + 'i'*numdims dimension_sizes = struct.unpack(fmtstring, bytez[4:4+4*numdims]) # Rest of the data starts here startoffset = 4 + 4*numdims typedata = { 0x08: ('B', 1), 0x09: ('b', 1), 0x0B: ('h', 2), 0x0C: ('i', 4), 0x0D: ('f', 4), 0x0E: ('d', 8) } typecode = typedata[typebyte][0] flatarray = array.array(typecode, bytez[startoffset:]) if sys.byteorder == 'little': flatarray.byteswap() if flatarray.itemsize != typedata[typebyte][1]: raise EnvironmentError("It's assumed a C int is 4 bytes") def _recursive(inputlst, dimsizes): """Recursively split the flat list into chunks and merge them back into a nested list structure.""" if len(dimsizes) == 1: return list(inputlst) outerlist = [] chunksize = len(inputlst)//dimsizes[0] for i in range(0, len(inputlst), chunksize): chunk = inputlst[i:i+chunksize] outerlist.append(_recursive(chunk, dimsizes[1:])) return outerlist return _recursive(flatarray, dimension_sizes)
mit
Zopieux/py3status
py3status/modules/external_script.py
10
1913
# -*- coding: utf-8 -*- """ Display output of given script. Display output of any executable script set by 'script_path'. Pay attention. The output must be one liner, or will break your i3status ! The script should not have any parameters, but it could work. Configuration parameters: - cache_timeout : how often we refresh this module in seconds - color : color of printed text - format : see placeholders below - script_path : script you want to show output of (compulsory) Format of status string placeholders: {output} - output of script given by "script_path" i3status.conf example: external_script { color = "#00FF00" format = "my name is {output}" script_path = "/usr/bin/whoami" @author frimdo ztracenastopa@centrum.cz """ import subprocess from time import time class Py3status: """ """ # available configuration parameters cache_timeout = 15 color = None format = '{output}' script_path = None def external_script(self, i3s_output_list, i3s_config): if self.script_path: return_value = subprocess.check_output(self.script_path, shell=True, universal_newlines=True) response = { 'cached_until': time() + self.cache_timeout, 'color': self.color, 'full_text': self.format.format(output=return_value.rstrip()) } else: response = { 'cached_until': time() + self.cache_timeout, 'full_text': '' } return response if __name__ == "__main__": from time import sleep x = Py3status() config = { 'color_good': '#00FF00', 'color_bad': '#FF0000', } while True: print(x.external_script([], config)) sleep(1)
bsd-3-clause
pipsiscool/audacity
lib-src/lv2/lv2/waflib/ansiterm.py
149
7136
#! /usr/bin/env python # encoding: utf-8 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file import sys,os try: if not(sys.stderr.isatty()and sys.stdout.isatty()): raise ValueError('not a tty') from ctypes import* class COORD(Structure): _fields_=[("X",c_short),("Y",c_short)] class SMALL_RECT(Structure): _fields_=[("Left",c_short),("Top",c_short),("Right",c_short),("Bottom",c_short)] class CONSOLE_SCREEN_BUFFER_INFO(Structure): _fields_=[("Size",COORD),("CursorPosition",COORD),("Attributes",c_short),("Window",SMALL_RECT),("MaximumWindowSize",COORD)] class CONSOLE_CURSOR_INFO(Structure): _fields_=[('dwSize',c_ulong),('bVisible',c_int)] sbinfo=CONSOLE_SCREEN_BUFFER_INFO() csinfo=CONSOLE_CURSOR_INFO() hconsole=windll.kernel32.GetStdHandle(-11) windll.kernel32.GetConsoleScreenBufferInfo(hconsole,byref(sbinfo)) if sbinfo.Size.X<9 or sbinfo.Size.Y<9:raise ValueError('small console') windll.kernel32.GetConsoleCursorInfo(hconsole,byref(csinfo)) except Exception: pass else: import re,threading is_vista=getattr(sys,"getwindowsversion",None)and sys.getwindowsversion()[0]>=6 try: _type=unicode except NameError: _type=str to_int=lambda number,default:number and int(number)or default wlock=threading.Lock() STD_OUTPUT_HANDLE=-11 STD_ERROR_HANDLE=-12 class AnsiTerm(object): def __init__(self): self.encoding=sys.stdout.encoding self.hconsole=windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE) self.cursor_history=[] self.orig_sbinfo=CONSOLE_SCREEN_BUFFER_INFO() self.orig_csinfo=CONSOLE_CURSOR_INFO() windll.kernel32.GetConsoleScreenBufferInfo(self.hconsole,byref(self.orig_sbinfo)) windll.kernel32.GetConsoleCursorInfo(hconsole,byref(self.orig_csinfo)) def screen_buffer_info(self): sbinfo=CONSOLE_SCREEN_BUFFER_INFO() windll.kernel32.GetConsoleScreenBufferInfo(self.hconsole,byref(sbinfo)) return sbinfo def clear_line(self,param): mode=param and int(param)or 0 sbinfo=self.screen_buffer_info() if mode==1: line_start=COORD(0,sbinfo.CursorPosition.Y) line_length=sbinfo.Size.X elif mode==2: line_start=COORD(sbinfo.CursorPosition.X,sbinfo.CursorPosition.Y) line_length=sbinfo.Size.X-sbinfo.CursorPosition.X else: line_start=sbinfo.CursorPosition line_length=sbinfo.Size.X-sbinfo.CursorPosition.X chars_written=c_int() windll.kernel32.FillConsoleOutputCharacterA(self.hconsole,c_wchar(' '),line_length,line_start,byref(chars_written)) windll.kernel32.FillConsoleOutputAttribute(self.hconsole,sbinfo.Attributes,line_length,line_start,byref(chars_written)) def clear_screen(self,param): mode=to_int(param,0) sbinfo=self.screen_buffer_info() if mode==1: clear_start=COORD(0,0) clear_length=sbinfo.CursorPosition.X*sbinfo.CursorPosition.Y elif mode==2: clear_start=COORD(0,0) clear_length=sbinfo.Size.X*sbinfo.Size.Y windll.kernel32.SetConsoleCursorPosition(self.hconsole,clear_start) else: clear_start=sbinfo.CursorPosition clear_length=((sbinfo.Size.X-sbinfo.CursorPosition.X)+sbinfo.Size.X*(sbinfo.Size.Y-sbinfo.CursorPosition.Y)) chars_written=c_int() windll.kernel32.FillConsoleOutputCharacterA(self.hconsole,c_wchar(' '),clear_length,clear_start,byref(chars_written)) windll.kernel32.FillConsoleOutputAttribute(self.hconsole,sbinfo.Attributes,clear_length,clear_start,byref(chars_written)) def push_cursor(self,param): sbinfo=self.screen_buffer_info() self.cursor_history.append(sbinfo.CursorPosition) def pop_cursor(self,param): if self.cursor_history: old_pos=self.cursor_history.pop() windll.kernel32.SetConsoleCursorPosition(self.hconsole,old_pos) def set_cursor(self,param): y,sep,x=param.partition(';') x=to_int(x,1)-1 y=to_int(y,1)-1 sbinfo=self.screen_buffer_info() new_pos=COORD(min(max(0,x),sbinfo.Size.X),min(max(0,y),sbinfo.Size.Y)) windll.kernel32.SetConsoleCursorPosition(self.hconsole,new_pos) def set_column(self,param): x=to_int(param,1)-1 sbinfo=self.screen_buffer_info() new_pos=COORD(min(max(0,x),sbinfo.Size.X),sbinfo.CursorPosition.Y) windll.kernel32.SetConsoleCursorPosition(self.hconsole,new_pos) def move_cursor(self,x_offset=0,y_offset=0): sbinfo=self.screen_buffer_info() new_pos=COORD(min(max(0,sbinfo.CursorPosition.X+x_offset),sbinfo.Size.X),min(max(0,sbinfo.CursorPosition.Y+y_offset),sbinfo.Size.Y)) windll.kernel32.SetConsoleCursorPosition(self.hconsole,new_pos) def move_up(self,param): self.move_cursor(y_offset=-to_int(param,1)) def move_down(self,param): self.move_cursor(y_offset=to_int(param,1)) def move_left(self,param): self.move_cursor(x_offset=-to_int(param,1)) def move_right(self,param): self.move_cursor(x_offset=to_int(param,1)) def next_line(self,param): sbinfo=self.screen_buffer_info() self.move_cursor(x_offset=-sbinfo.CursorPosition.X,y_offset=to_int(param,1)) def prev_line(self,param): sbinfo=self.screen_buffer_info() self.move_cursor(x_offset=-sbinfo.CursorPosition.X,y_offset=-to_int(param,1)) def rgb2bgr(self,c): return((c&1)<<2)|(c&2)|((c&4)>>2) def set_color(self,param): cols=param.split(';') sbinfo=CONSOLE_SCREEN_BUFFER_INFO() windll.kernel32.GetConsoleScreenBufferInfo(self.hconsole,byref(sbinfo)) attr=sbinfo.Attributes for c in cols: if is_vista: c=int(c) else: c=to_int(c,0) if c in range(30,38): attr=(attr&0xfff0)|self.rgb2bgr(c-30) elif c in range(40,48): attr=(attr&0xff0f)|(self.rgb2bgr(c-40)<<4) elif c==0: attr=self.orig_sbinfo.Attributes elif c==1: attr|=0x08 elif c==4: attr|=0x80 elif c==7: attr=(attr&0xff88)|((attr&0x70)>>4)|((attr&0x07)<<4) windll.kernel32.SetConsoleTextAttribute(self.hconsole,attr) def show_cursor(self,param): csinfo.bVisible=1 windll.kernel32.SetConsoleCursorInfo(self.hconsole,byref(csinfo)) def hide_cursor(self,param): csinfo.bVisible=0 windll.kernel32.SetConsoleCursorInfo(self.hconsole,byref(csinfo)) ansi_command_table={'A':move_up,'B':move_down,'C':move_right,'D':move_left,'E':next_line,'F':prev_line,'G':set_column,'H':set_cursor,'f':set_cursor,'J':clear_screen,'K':clear_line,'h':show_cursor,'l':hide_cursor,'m':set_color,'s':push_cursor,'u':pop_cursor,} ansi_tokens=re.compile('(?:\x1b\[([0-9?;]*)([a-zA-Z])|([^\x1b]+))') def write(self,text): try: wlock.acquire() for param,cmd,txt in self.ansi_tokens.findall(text): if cmd: cmd_func=self.ansi_command_table.get(cmd) if cmd_func: cmd_func(self,param) else: self.writeconsole(txt) finally: wlock.release() def writeconsole(self,txt): chars_written=c_int() writeconsole=windll.kernel32.WriteConsoleA if isinstance(txt,_type): writeconsole=windll.kernel32.WriteConsoleW TINY_STEP=3000 for x in range(0,len(txt),TINY_STEP): tiny=txt[x:x+TINY_STEP] writeconsole(self.hconsole,tiny,len(tiny),byref(chars_written),None) def flush(self): pass def isatty(self): return True sys.stderr=sys.stdout=AnsiTerm() os.environ['TERM']='vt100'
mit
KohlsTechnology/ansible
lib/ansible/modules/network/dellos9/dellos9_facts.py
50
17592
#!/usr/bin/python # # (c) 2015 Peter Sprygada, <psprygada@ansible.com> # Copyright (c) 2016 Dell Inc. # 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: dellos9_facts version_added: "2.2" author: "Dhivya P (@dhivyap)" short_description: Collect facts from remote devices running Dell EMC Networking OS9 description: - Collects a base set of device facts from a remote device that is running OS9. This module prepends all of the base network fact keys with C(ansible_net_<fact>). The facts module will always collect a base set of facts from the device and can enable or disable collection of additional facts. extends_documentation_fragment: dellos9 options: gather_subset: description: - When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include all, hardware, config, and interfaces. Can specify a list of values to include a larger subset. Values can also be used with an initial C(M(!)) to specify that a specific subset should not be collected. default: [ '!config' ] notes: - This module requires OS9 version 9.10.0.1P13 or above. - This module requires an increase of the SSH connection rate limit. Use the following command I(ip ssh connection-rate-limit 60) to configure the same. This can be also be done with the M(dellos9_config) module. """ EXAMPLES = """ # Collect all facts from the device - dellos9_facts: gather_subset: all # Collect only the config and default facts - dellos9_facts: gather_subset: - config # Do not collect hardware facts - dellos9_facts: gather_subset: - "!hardware" """ RETURN = """ ansible_net_gather_subset: description: The list of fact subsets collected from the device returned: always type: list # default ansible_net_model: description: The model name returned from the device returned: always type: str ansible_net_serialnum: description: The serial number of the remote device returned: always type: str ansible_net_version: description: The operating system version running on the remote device returned: always type: str ansible_net_hostname: description: The configured hostname of the device returned: always type: string ansible_net_image: description: The image file the device is running returned: always type: string # hardware ansible_net_filesystems: description: All file system names available on the device returned: when hardware is configured type: list ansible_net_memfree_mb: description: The available free memory on the remote device in Mb returned: when hardware is configured type: int ansible_net_memtotal_mb: description: The total memory on the remote device in Mb returned: when hardware is configured type: int # config ansible_net_config: description: The current active config from the device returned: when config is configured type: str # interfaces ansible_net_all_ipv4_addresses: description: All IPv4 addresses configured on the device returned: when interfaces is configured type: list ansible_net_all_ipv6_addresses: description: All IPv6 addresses configured on the device returned: when interfaces is configured type: list ansible_net_interfaces: description: A hash of all interfaces running on the system returned: when interfaces is configured type: dict ansible_net_neighbors: description: The list of LLDP neighbors from the remote device returned: when interfaces is configured type: dict """ import re try: from itertools import izip except ImportError: izip = zip from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.network.dellos9.dellos9 import run_commands from ansible.module_utils.network.dellos9.dellos9 import dellos9_argument_spec, check_args from ansible.module_utils.six import iteritems class FactsBase(object): COMMANDS = list() def __init__(self, module): self.module = module self.facts = dict() self.responses = None def populate(self): self.responses = run_commands(self.module, self.COMMANDS, check_rc=False) def run(self, cmd): return run_commands(self.module, cmd, check_rc=False) class Default(FactsBase): COMMANDS = [ 'show version', 'show inventory', 'show running-config | grep hostname' ] def populate(self): super(Default, self).populate() data = self.responses[0] self.facts['version'] = self.parse_version(data) self.facts['model'] = self.parse_model(data) self.facts['image'] = self.parse_image(data) data = self.responses[1] self.facts['serialnum'] = self.parse_serialnum(data) data = self.responses[2] self.facts['hostname'] = self.parse_hostname(data) def parse_version(self, data): match = re.search(r'Software Version:\s*(.+)', data) if match: return match.group(1) def parse_hostname(self, data): match = re.search(r'^hostname (.+)', data, re.M) if match: return match.group(1) def parse_model(self, data): match = re.search(r'^System Type:\s*(.+)', data, re.M) if match: return match.group(1) def parse_image(self, data): match = re.search(r'image file is "(.+)"', data) if match: return match.group(1) def parse_serialnum(self, data): for line in data.split('\n'): if line.startswith('*'): match = re.search( r'\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)', line, re.M) if match: return match.group(3) class Hardware(FactsBase): COMMANDS = [ 'show file-systems', 'show memory | except Processor' ] def populate(self): super(Hardware, self).populate() data = self.responses[0] self.facts['filesystems'] = self.parse_filesystems(data) data = self.responses[1] match = re.findall(r'\s(\d+)\s', data) if match: self.facts['memtotal_mb'] = int(match[0]) // 1024 self.facts['memfree_mb'] = int(match[2]) // 1024 def parse_filesystems(self, data): return re.findall(r'\s(\S+):$', data, re.M) class Config(FactsBase): COMMANDS = ['show running-config'] def populate(self): super(Config, self).populate() self.facts['config'] = self.responses[0] class Interfaces(FactsBase): COMMANDS = [ 'show interfaces', 'show ipv6 interface', 'show lldp neighbors detail', 'show inventory' ] def populate(self): super(Interfaces, self).populate() self.facts['all_ipv4_addresses'] = list() self.facts['all_ipv6_addresses'] = list() data = self.responses[0] interfaces = self.parse_interfaces(data) for key in interfaces.keys(): if "ManagementEthernet" in key: temp_parsed = interfaces[key] del interfaces[key] interfaces.update(self.parse_mgmt_interfaces(temp_parsed)) for key in interfaces.keys(): if "Vlan" in key: temp_parsed = interfaces[key] del interfaces[key] interfaces.update(self.parse_vlan_interfaces(temp_parsed)) self.facts['interfaces'] = self.populate_interfaces(interfaces) data = self.responses[1] if len(data) > 0: data = self.parse_ipv6_interfaces(data) self.populate_ipv6_interfaces(data) data = self.responses[3] if 'LLDP' in self.get_protocol_list(data): neighbors = self.responses[2] self.facts['neighbors'] = self.parse_neighbors(neighbors) def get_protocol_list(self, data): start = False protocol_list = list() for line in data.split('\n'): match = re.search(r'Software Protocol Configured\s*', line) if match: start = True continue if start: line = line.strip() if line.isalnum(): protocol_list.append(line) return protocol_list def populate_interfaces(self, interfaces): facts = dict() for key, value in interfaces.items(): intf = dict() intf['description'] = self.parse_description(value) intf['macaddress'] = self.parse_macaddress(value) ipv4 = self.parse_ipv4(value) intf['ipv4'] = self.parse_ipv4(value) if ipv4: self.add_ip_address(ipv4['address'], 'ipv4') intf['mtu'] = self.parse_mtu(value) intf['bandwidth'] = self.parse_bandwidth(value) intf['mediatype'] = self.parse_mediatype(value) intf['duplex'] = self.parse_duplex(value) intf['lineprotocol'] = self.parse_lineprotocol(value) intf['operstatus'] = self.parse_operstatus(value) intf['type'] = self.parse_type(value) facts[key] = intf return facts def populate_ipv6_interfaces(self, data): for key, value in data.items(): if key in self.facts['interfaces']: self.facts['interfaces'][key]['ipv6'] = list() addresses = re.findall(r'\s+(.+), subnet', value, re.M) subnets = re.findall(r', subnet is (\S+)', value, re.M) for addr, subnet in izip(addresses, subnets): ipv6 = dict(address=addr.strip(), subnet=subnet.strip()) self.add_ip_address(addr.strip(), 'ipv6') self.facts['interfaces'][key]['ipv6'].append(ipv6) def add_ip_address(self, address, family): if family == 'ipv4': self.facts['all_ipv4_addresses'].append(address) else: self.facts['all_ipv6_addresses'].append(address) def parse_neighbors(self, neighbors): facts = dict() for entry in neighbors.split( '========================================================================'): if entry == '': continue intf = self.parse_lldp_intf(entry) if intf not in facts: facts[intf] = list() fact = dict() fact['host'] = self.parse_lldp_host(entry) fact['port'] = self.parse_lldp_port(entry) facts[intf].append(fact) return facts def parse_interfaces(self, data): parsed = dict() newline_count = 0 interface_start = True for line in data.split('\n'): if interface_start: newline_count = 0 if len(line) == 0: newline_count += 1 if newline_count == 2: interface_start = True continue else: match = re.match(r'^(\S+) (\S+)', line) if match and interface_start: interface_start = False key = match.group(0) parsed[key] = line else: parsed[key] += '\n%s' % line return parsed def parse_mgmt_interfaces(self, data): parsed = dict() interface_start = True for line in data.split('\n'): match = re.match(r'^(\S+) (\S+)', line) if "Time since" in line: interface_start = True parsed[key] += '\n%s' % line continue elif match and interface_start: interface_start = False key = match.group(0) parsed[key] = line else: parsed[key] += '\n%s' % line return parsed def parse_vlan_interfaces(self, data): parsed = dict() interface_start = True line_before_end = False for line in data.split('\n'): match = re.match(r'^(\S+) (\S+)', line) match_endline = re.match(r'^\s*\d+ packets, \d+ bytes$', line) if "Output Statistics" in line: line_before_end = True parsed[key] += '\n%s' % line elif match_endline and line_before_end: line_before_end = False interface_start = True parsed[key] += '\n%s' % line elif match and interface_start: interface_start = False key = match.group(0) parsed[key] = line else: parsed[key] += '\n%s' % line return parsed def parse_ipv6_interfaces(self, data): parsed = dict() for line in data.split('\n'): if len(line) == 0: continue elif line[0] == ' ': parsed[key] += '\n%s' % line else: match = re.match(r'^(\S+) (\S+)', line) if match: key = match.group(0) parsed[key] = line return parsed def parse_description(self, data): match = re.search(r'Description: (.+)$', data, re.M) if match: return match.group(1) def parse_macaddress(self, data): match = re.search(r'address is (\S+)', data) if match: if match.group(1) != "not": return match.group(1) def parse_ipv4(self, data): match = re.search(r'Internet address is (\S+)', data) if match: if match.group(1) != "not": addr, masklen = match.group(1).split('/') return dict(address=addr, masklen=int(masklen)) def parse_mtu(self, data): match = re.search(r'MTU (\d+)', data) if match: return int(match.group(1)) def parse_bandwidth(self, data): match = re.search(r'LineSpeed (\d+)', data) if match: return int(match.group(1)) def parse_duplex(self, data): match = re.search(r'(\w+) duplex', data, re.M) if match: return match.group(1) def parse_mediatype(self, data): media = re.search(r'(.+) media present, (.+)', data, re.M) if media: match = re.search(r'type is (.+)$', media.group(0), re.M) return match.group(1) def parse_type(self, data): match = re.search(r'Hardware is (.+),', data, re.M) if match: return match.group(1) def parse_lineprotocol(self, data): match = re.search(r'line protocol is (\w+[ ]?\w*)\(?.*\)?$', data, re.M) if match: return match.group(1) def parse_operstatus(self, data): match = re.search(r'^(?:.+) is (.+),', data, re.M) if match: return match.group(1) def parse_lldp_intf(self, data): match = re.search(r'^\sLocal Interface (\S+\s\S+)', data, re.M) if match: return match.group(1) def parse_lldp_host(self, data): match = re.search(r'Remote System Name: (.+)$', data, re.M) if match: return match.group(1) def parse_lldp_port(self, data): match = re.search(r'Remote Port ID: (.+)$', data, re.M) if match: return match.group(1) FACT_SUBSETS = dict( default=Default, hardware=Hardware, interfaces=Interfaces, config=Config, ) VALID_SUBSETS = frozenset(FACT_SUBSETS.keys()) def main(): """main entry point for module execution """ argument_spec = dict( gather_subset=dict(default=['!config'], type='list') ) argument_spec.update(dellos9_argument_spec) module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) gather_subset = module.params['gather_subset'] runable_subsets = set() exclude_subsets = set() for subset in gather_subset: if subset == 'all': runable_subsets.update(VALID_SUBSETS) continue if subset.startswith('!'): subset = subset[1:] if subset == 'all': exclude_subsets.update(VALID_SUBSETS) continue exclude = True else: exclude = False if subset not in VALID_SUBSETS: module.fail_json(msg='Bad subset') if exclude: exclude_subsets.add(subset) else: runable_subsets.add(subset) if not runable_subsets: runable_subsets.update(VALID_SUBSETS) runable_subsets.difference_update(exclude_subsets) runable_subsets.add('default') facts = dict() facts['gather_subset'] = list(runable_subsets) instances = list() for key in runable_subsets: instances.append(FACT_SUBSETS[key](module)) for inst in instances: inst.populate() facts.update(inst.facts) ansible_facts = dict() for key, value in iteritems(facts): key = 'ansible_net_%s' % key ansible_facts[key] = value warnings = list() check_args(module, warnings) module.exit_json(ansible_facts=ansible_facts, warnings=warnings) if __name__ == '__main__': main()
gpl-3.0
adybbroe/oca_reader
mpef_oca/oca_reader.py
1
8139
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2016 Adam.Dybbroe # Author(s): # Adam.Dybbroe <a000680@c20671.ad.smhi.se> # 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/>. """Reader for the OCA products """ """ How to gather the LRIT files and skip the header: for file in `ls /disk2/testdata/OCA/L-000-MSG3__-MPEF________-OCAE_____-0000??___-*-__`;do echo $file; dd if=$file bs=1c skip=103 >> tmp;done """ import os import pygrib import numpy as np import os.path from glob import glob import tempfile import pyresample as pr from trollsift import parser from mpop.imageo import geo_image from mpop.imageo import palettes CFG_DIR = os.environ.get('MPEF_OCA_CONFIG_DIR', './') AREA_DEF_FILE = os.path.join(CFG_DIR, "areas.def") if not os.path.exists(AREA_DEF_FILE): raise IOError('Config file %s does not exist!' % AREA_DEF_FILE) LRIT_PATTERN = "L-000-{platform_name:_<5s}_-MPEF________-OCAE_____-{segment:_<9s}-{nominal_time:%Y%m%d%H%M}-{compressed:_<2s}" from .utils import (SCENE_TYPE_LAYERS, OCA_FIELDS, FIELDNAMES, get_reff_legend, get_cot_legend, get_scenetype_legend, get_ctp_legend) palette_func = {'ll_ctp': get_ctp_legend, 'ul_ctp': get_ctp_legend, 'ul_cot': get_cot_legend, 'll_cot': get_cot_legend, 'reff': get_reff_legend, 'scenetype': get_scenetype_legend} class Grib(object): def __init__(self, fname): self._abspath = os.path.abspath(fname) @property def nmsgs(self): '''Number of GRIB messages in file. ''' prop = 'nmsgs' attr = '_{}'.format(prop) if not hasattr(self, attr): grbs = pygrib.open(self._abspath) nmsgs = grbs.messages grbs.close() setattr(self, attr, nmsgs) return getattr(self, attr) def get(self, gmessage, key='values'): ''' Returns the value for the 'key' for a given message number 'gmessage' or message field name 'gmessage'. ''' grbs = pygrib.open(self._abspath) if type(gmessage) == int: mnbr = gmessage elif type(gmessage) == str: msg_found = False msgnum = 1 while msgnum < self.nmsgs + 1: if grbs[msgnum]['parameterName'] == gmessage: msg_found = True break msgnum = msgnum + 1 if msg_found: mnbr = msgnum else: print("No Grib message found with parameter name = %s" % gmessage) return None if grbs[mnbr].valid_key(key): arr = grbs[mnbr][key] grbs.close() return arr else: grbs.close() return class OCAField(object): """One OCA data field with metadata""" def __init__(self, units=None, longname='', shortname=''): self.units = units self.data = None self.error = None self.longname = None self.shortname = None class OCAData(object): """The OCA scene data""" def __init__(self): self._lritfiles = None self._gribfilename = None self._store_grib = False self.scenetype = OCAField() self.cost = OCAField() self.ul_cot = OCAField() self.ll_cot = OCAField() self.ul_ctp = OCAField() self.ll_ctp = OCAField() self.reff = OCAField() self._projectables = [] for field in FIELDNAMES.keys(): self._projectables.append(field) self.timeslot = None self.area_def = pr.utils.load_area(AREA_DEF_FILE, 'met09globeFull') def readgrib(self): """Read the data""" oca = Grib(self._gribfilename) self.scenetype.data = oca.get('Pixel scene type')[::-1, ::-1] self.scenetype.longname = OCA_FIELDS[0]['Pixel scene type'] for field in FIELDNAMES.keys(): setattr(getattr(self, field), 'data', oca.get( FIELDNAMES[field][0])[::-1, ::-1]) param = [s for s in OCA_FIELDS if FIELDNAMES[field][0] in s][0] if 'units' in param: setattr(getattr(self, field), 'units', param['units']) if 'abbrev' in param: setattr(getattr(self, field), 'shortname', param['abbrev']) setattr(getattr(self, field), 'longname', param[FIELDNAMES[field][0]]) param_name = FIELDNAMES[field][1] if param_name: setattr( getattr(self, field), 'error', oca.get(param_name)[::-1, ::-1]) if not self._store_grib: os.remove(self._gribfilename) def read_from_lrit(self, filenames, gribfilename=None): """Read and concatenate the LRIT segments""" self._lritfiles = filenames if len(filenames) == 0: print("No files provided!") return if gribfilename: self._store_grib = True self._gribfilename = gribfilename else: self._store_grib = False self._gribfilename = tempfile.mktemp(suffix='.grb') p__ = parser.Parser(LRIT_PATTERN) bstr = {} nsegments = 0 for lritfile in self._lritfiles: if os.path.basename(lritfile).find('PRO') > 0: print("PRO file... %s: Skip it..." % lritfile) continue res = p__.parse(os.path.basename(lritfile)) segm = int(res['segment'].strip('_')) if not self.timeslot: self.timeslot = res['nominal_time'] print("Segment = %d" % segm) nsegments = nsegments + 1 with open(lritfile) as fpt: fpt.seek(103) bstr[segm] = fpt.read() fstr = bstr[1] for idx in range(2, nsegments + 1): fstr = fstr + bstr[idx] with open(self._gribfilename, 'wb') as fpt: fpt.write(fstr) self.readgrib() def project(self, areaid): """Project the data""" lons, lats = self.area_def.get_lonlats() lons = np.ma.masked_outside(lons, -180, 180) lats = np.ma.masked_outside(lats, -90, 90) swath_def = pr.geometry.SwathDefinition(lons, lats) out_area_def = pr.utils.load_area(AREA_DEF_FILE, areaid) for item in self._projectables: data = getattr(getattr(self, item), 'data') result = pr.kd_tree.resample_nearest(swath_def, data, out_area_def, radius_of_influence=20000, fill_value=None) setattr(getattr(self, item), 'data', result) self.area_def = out_area_def def make_image(self, fieldname): """Make an mpop GeoImage image of the oca parameter 'fieldname'""" palette = palette_func[fieldname]() data = getattr(getattr(self, fieldname), 'data') if fieldname in ['ul_ctp', 'll_ctp']: data = (22. - data / 5000.).astype('Int16') elif fieldname in ['reff']: data = (data * 1000000. + 0.5).astype('uint8') img = geo_image.GeoImage(data, self.area_def.area_id, self.timeslot, fill_value=(0), mode="P", palette=palette) return img
gpl-3.0
ajoaoff/django
django/db/backends/postgresql/client.py
346
2112
import os import subprocess from django.core.files.temp import NamedTemporaryFile from django.db.backends.base.client import BaseDatabaseClient from django.utils.six import print_ def _escape_pgpass(txt): """ Escape a fragment of a PostgreSQL .pgpass file. """ return txt.replace('\\', '\\\\').replace(':', '\\:') class DatabaseClient(BaseDatabaseClient): executable_name = 'psql' @classmethod def runshell_db(cls, settings_dict): args = [cls.executable_name] host = settings_dict.get('HOST', '') port = settings_dict.get('PORT', '') name = settings_dict.get('NAME', '') user = settings_dict.get('USER', '') passwd = settings_dict.get('PASSWORD', '') if user: args += ['-U', user] if host: args += ['-h', host] if port: args += ['-p', str(port)] args += [name] temp_pgpass = None try: if passwd: # Create temporary .pgpass file. temp_pgpass = NamedTemporaryFile(mode='w+') try: print_( _escape_pgpass(host) or '*', str(port) or '*', _escape_pgpass(name) or '*', _escape_pgpass(user) or '*', _escape_pgpass(passwd), file=temp_pgpass, sep=':', flush=True, ) os.environ['PGPASSFILE'] = temp_pgpass.name except UnicodeEncodeError: # If the current locale can't encode the data, we let # the user input the password manually. pass subprocess.call(args) finally: if temp_pgpass: temp_pgpass.close() if 'PGPASSFILE' in os.environ: # unit tests need cleanup del os.environ['PGPASSFILE'] def runshell(self): DatabaseClient.runshell_db(self.connection.settings_dict)
bsd-3-clause
t0in4/django
django/middleware/cache.py
372
7303
""" Cache middleware. If enabled, each Django-powered page will be cached based on URL. The canonical way to enable cache middleware is to set ``UpdateCacheMiddleware`` as your first piece of middleware, and ``FetchFromCacheMiddleware`` as the last:: MIDDLEWARE_CLASSES = [ 'django.middleware.cache.UpdateCacheMiddleware', ... 'django.middleware.cache.FetchFromCacheMiddleware' ] This is counter-intuitive, but correct: ``UpdateCacheMiddleware`` needs to run last during the response phase, which processes middleware bottom-up; ``FetchFromCacheMiddleware`` needs to run last during the request phase, which processes middleware top-down. The single-class ``CacheMiddleware`` can be used for some simple sites. However, if any other piece of middleware needs to affect the cache key, you'll need to use the two-part ``UpdateCacheMiddleware`` and ``FetchFromCacheMiddleware``. This'll most often happen when you're using Django's ``LocaleMiddleware``. More details about how the caching works: * Only GET or HEAD-requests with status code 200 are cached. * The number of seconds each page is stored for is set by the "max-age" section of the response's "Cache-Control" header, falling back to the CACHE_MIDDLEWARE_SECONDS setting if the section was not found. * This middleware expects that a HEAD request is answered with the same response headers exactly like the corresponding GET request. * When a hit occurs, a shallow copy of the original response object is returned from process_request. * Pages will be cached based on the contents of the request headers listed in the response's "Vary" header. * This middleware also sets ETag, Last-Modified, Expires and Cache-Control headers on the response object. """ from django.conf import settings from django.core.cache import DEFAULT_CACHE_ALIAS, caches from django.utils.cache import ( get_cache_key, get_max_age, has_vary_header, learn_cache_key, patch_response_headers, ) class UpdateCacheMiddleware(object): """ Response-phase cache middleware that updates the cache if the response is cacheable. Must be used as part of the two-part update/fetch cache middleware. UpdateCacheMiddleware must be the first piece of middleware in MIDDLEWARE_CLASSES so that it'll get called last during the response phase. """ def __init__(self): self.cache_timeout = settings.CACHE_MIDDLEWARE_SECONDS self.key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX self.cache_alias = settings.CACHE_MIDDLEWARE_ALIAS self.cache = caches[self.cache_alias] def _should_update_cache(self, request, response): return hasattr(request, '_cache_update_cache') and request._cache_update_cache def process_response(self, request, response): """Sets the cache, if needed.""" if not self._should_update_cache(request, response): # We don't need to update the cache, just return. return response if response.streaming or response.status_code != 200: return response # Don't cache responses that set a user-specific (and maybe security # sensitive) cookie in response to a cookie-less request. if not request.COOKIES and response.cookies and has_vary_header(response, 'Cookie'): return response # Try to get the timeout from the "max-age" section of the "Cache- # Control" header before reverting to using the default cache_timeout # length. timeout = get_max_age(response) if timeout is None: timeout = self.cache_timeout elif timeout == 0: # max-age was set to 0, don't bother caching. return response patch_response_headers(response, timeout) if timeout: cache_key = learn_cache_key(request, response, timeout, self.key_prefix, cache=self.cache) if hasattr(response, 'render') and callable(response.render): response.add_post_render_callback( lambda r: self.cache.set(cache_key, r, timeout) ) else: self.cache.set(cache_key, response, timeout) return response class FetchFromCacheMiddleware(object): """ Request-phase cache middleware that fetches a page from the cache. Must be used as part of the two-part update/fetch cache middleware. FetchFromCacheMiddleware must be the last piece of middleware in MIDDLEWARE_CLASSES so that it'll get called last during the request phase. """ def __init__(self): self.key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX self.cache_alias = settings.CACHE_MIDDLEWARE_ALIAS self.cache = caches[self.cache_alias] def process_request(self, request): """ Checks whether the page is already cached and returns the cached version if available. """ if request.method not in ('GET', 'HEAD'): request._cache_update_cache = False return None # Don't bother checking the cache. # try and get the cached GET response cache_key = get_cache_key(request, self.key_prefix, 'GET', cache=self.cache) if cache_key is None: request._cache_update_cache = True return None # No cache information available, need to rebuild. response = self.cache.get(cache_key) # if it wasn't found and we are looking for a HEAD, try looking just for that if response is None and request.method == 'HEAD': cache_key = get_cache_key(request, self.key_prefix, 'HEAD', cache=self.cache) response = self.cache.get(cache_key) if response is None: request._cache_update_cache = True return None # No cache information available, need to rebuild. # hit, return cached response request._cache_update_cache = False return response class CacheMiddleware(UpdateCacheMiddleware, FetchFromCacheMiddleware): """ Cache middleware that provides basic behavior for many simple sites. Also used as the hook point for the cache decorator, which is generated using the decorator-from-middleware utility. """ def __init__(self, cache_timeout=None, **kwargs): # We need to differentiate between "provided, but using default value", # and "not provided". If the value is provided using a default, then # we fall back to system defaults. If it is not provided at all, # we need to use middleware defaults. try: key_prefix = kwargs['key_prefix'] if key_prefix is None: key_prefix = '' except KeyError: key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX self.key_prefix = key_prefix try: cache_alias = kwargs['cache_alias'] if cache_alias is None: cache_alias = DEFAULT_CACHE_ALIAS except KeyError: cache_alias = settings.CACHE_MIDDLEWARE_ALIAS self.cache_alias = cache_alias if cache_timeout is None: cache_timeout = settings.CACHE_MIDDLEWARE_SECONDS self.cache_timeout = cache_timeout self.cache = caches[self.cache_alias]
bsd-3-clause