-Copyright (c) 2013, Schneider Electric Buildings AB
-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 Schneider Electric Buildings AB nor the
- names of 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 HOLDER 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.
-
-Schneider Electric Buildings AB does not make any claims concerning code
-generated by the asn1ate library.
+Copyright (c) 2013-2015, Schneider Electric Buildings AB\r
+All rights reserved.\r
+\r
+Redistribution and use in source and binary forms, with or without\r
+modification, are permitted provided that the following conditions are met:\r
+ * Redistributions of source code must retain the above copyright\r
+ notice, this list of conditions and the following disclaimer.\r
+ * Redistributions in binary form must reproduce the above copyright\r
+ notice, this list of conditions and the following disclaimer in the\r
+ documentation and/or other materials provided with the distribution.\r
+ * Neither the name of Schneider Electric Buildings AB nor the\r
+ names of contributors may be used to endorse or promote products\r
+ derived from this software without specific prior written permission.\r
+\r
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND\r
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\r
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\r
+Schneider Electric Buildings AB does not make any claims concerning code\r
+generated by the asn1ate library.\r
-# Copyright (c) 2013, Schneider Electric Buildings AB
-# 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 Schneider Electric Buildings AB nor the
-# names of 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 HOLDER 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.
-
-try:
- # Python 2
- from cStringIO import StringIO
-except ImportError:
- # Python 3
- from io import StringIO
-
-from datetime import datetime
-
-
-def auto_generated_header(source_filename=None):
- prefix = '# Auto-generated'
- if source_filename:
- prefix += ' from %s' % source_filename
-
- return '%s by asn1ate on %s' % (prefix, datetime.now())
-
-
-class NullBackend(object):
- """ Code generator to create an empty file.
- Used to create __init__.py files.
- """
- def __init__(self, *args):
- pass
-
- def generate_code(self, *args):
- pass
-
-
-class PythonWriter(object):
- """ Indentation-aware text stream. """
- def __init__(self, out_stream, indent_size=4):
- self.out = out_stream
- self.indent_size = indent_size
- self.current_indent = 0
-
- def push_indent(self):
- self.current_indent += self.indent_size
-
- def pop_indent(self):
- self.current_indent -= self.indent_size
-
- def write_line(self, line):
- if line is not None:
- line = self._indent(line) if line else line
- self.out.write('%s\n' % line)
-
- def write_blanks(self, count=1):
- for i in range(0, count):
- self.out.write('\n')
-
- def write_block(self, block):
- """ Reindents after every line break. """
- block = block.rstrip()
- for line in block.split('\n'):
- self.write_line(line)
-
- def write_enumeration(self, items):
- self.write_block(',\n'.join(items))
-
- def get_fragment(self):
- return PythonFragment(self.indent_size)
-
- def _indent(self, line):
- return ' ' * self.current_indent + line
-
-
-class PythonFragment(PythonWriter):
- """ A buffering python writer, useful for nested structures.
- """
- def __init__(self, indent_size=4):
- self.buf = StringIO()
- super(PythonFragment, self).__init__(self.buf, indent_size)
-
- def __str__(self):
- return self.buf.getvalue()
+# Copyright (c) 2013-2015, Schneider Electric Buildings AB\r
+# All rights reserved.\r
+#\r
+# Redistribution and use in source and binary forms, with or without\r
+# modification, are permitted provided that the following conditions are met:\r
+# * Redistributions of source code must retain the above copyright\r
+# notice, this list of conditions and the following disclaimer.\r
+# * Redistributions in binary form must reproduce the above copyright\r
+# notice, this list of conditions and the following disclaimer in the\r
+# documentation and/or other materials provided with the distribution.\r
+# * Neither the name of Schneider Electric Buildings AB nor the\r
+# names of contributors may be used to endorse or promote products\r
+# derived from this software without specific prior written permission.\r
+#\r
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND\r
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\r
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\r
+try:\r
+ # Python 2\r
+ from cStringIO import StringIO\r
+except ImportError:\r
+ # Python 3\r
+ from io import StringIO\r
+\r
+from datetime import datetime\r
+\r
+\r
+def auto_generated_header(source_filename=None):\r
+ prefix = '# Auto-generated'\r
+ if source_filename:\r
+ prefix += ' from %s' % source_filename\r
+\r
+ return '%s by asn1ate on %s' % (prefix, datetime.now())\r
+\r
+\r
+class NullBackend(object):\r
+ """ Code generator to create an empty file.\r
+ Used to create __init__.py files.\r
+ """\r
+ def __init__(self, *args):\r
+ pass\r
+\r
+ def generate_code(self, *args):\r
+ pass\r
+\r
+\r
+class PythonWriter(object):\r
+ """ Indentation-aware text stream. """\r
+ def __init__(self, out_stream, indent_size=4):\r
+ self.out = out_stream\r
+ self.indent_size = indent_size\r
+ self.current_indent = 0\r
+\r
+ def push_indent(self):\r
+ self.current_indent += self.indent_size\r
+\r
+ def pop_indent(self):\r
+ self.current_indent -= self.indent_size\r
+\r
+ def write_line(self, line):\r
+ if line is not None:\r
+ line = self._indent(line) if line else line\r
+ self.out.write('%s\n' % line)\r
+\r
+ def write_blanks(self, count=1):\r
+ for i in range(0, count):\r
+ self.out.write('\n')\r
+\r
+ def write_block(self, block):\r
+ """ Reindents after every line break. """\r
+ block = block.rstrip()\r
+ for line in block.split('\n'):\r
+ self.write_line(line)\r
+\r
+ def write_enumeration(self, items):\r
+ self.write_block(',\n'.join(items))\r
+\r
+ def get_fragment(self):\r
+ return PythonFragment(self.indent_size)\r
+\r
+ def _indent(self, line):\r
+ return ' ' * self.current_indent + line\r
+\r
+\r
+class PythonFragment(PythonWriter):\r
+ """ A buffering python writer, useful for nested structures.\r
+ """\r
+ def __init__(self, indent_size=4):\r
+ self.buf = StringIO()\r
+ super(PythonFragment, self).__init__(self.buf, indent_size)\r
+\r
+ def __str__(self):\r
+ return self.buf.getvalue()\r