compiler.py docstrings
@@ -31,6 +31,7 @@ class Compiler():
def __init__(self):
self.modules = []
+
@staticmethod
def instance():
"""
@@ -44,6 +45,7 @@ class Compiler():
Compiler.__instance = Compiler()
return Compiler.__instance
+
@property
def default(self):
"""
@@ -59,6 +61,7 @@ class Compiler():
return None
+
@staticmethod
def write_file(data, path):
"""
@@ -73,11 +76,13 @@ class Compiler():
return None
+
def write(self):
"""
Write the default module to a byte string.
- :return: a byte string of the compiled Python program
+ :return: the compiled Python program as a byte string
+ :rtype: bytes
"""
module = self.default
@@ -85,6 +90,7 @@ class Compiler():
return out_bytes
+
@staticmethod
def load_and_save(path, output_path=None):
"""
@@ -93,9 +99,8 @@ class Compiler():
:param path: The path of the Python file to compile
:param output_path: Optional path to save the compiled `.avm` file
- :return: Returns the instance of the compiler
+ :return: the instance of the compiler
- Usage:
The following returns the compiler object for inspection
.. code-block:: python
@@ -118,6 +123,7 @@ class Compiler():
return data
+
@staticmethod
def load(path):
"""
@@ -126,7 +132,6 @@ class Compiler():
:param path: the path of the Python file to compile
:return: The instance of the compiler
- Usage:
The following returns the compiler object for inspection.
.. code-block:: python
