Commit 2146af1c authored by Eric Pellegrini's avatar Eric Pellegrini
Browse files

updated docstrings and stub files

parent 9b63ba84
......@@ -6,7 +6,7 @@ import os
import pprint
import yaml
from typing import List
from typing import Dict, List
class PackerTemplate:
"""This class implements one packer template.
......@@ -55,8 +55,13 @@ class PackerTemplate:
def _update_builder(self, builder):
"""Update a builder.
def _update_builder(self, builder: Dict[str,str]):
"""Update some fields of a builder.
builder: dict
The builder to update.
builder["output_directory"] = "builds"
......@@ -70,7 +75,17 @@ class PackerTemplate:
# For convenience set the vm name with a fixed standardized value
builder["vm_name"] = "{}-{}".format(self._name,builder["type"])
def _update_provisioner(self, provisioner, base_dir):
def _update_provisioner(self, provisioner : Dict[str,str], base_dir : str):
"""Update some fields of a provisioner.
provisioner: dict
The provisioner to update.
base_dir: str
The base directory for this provisioner.
if not provisioner["type"] in ["file","shell"]:
......@@ -203,14 +218,14 @@ class PackerTemplate:
fin = open(manifest_file, "r")
# If the manifest does not exist, the provisioners list is set to an empty list
except FileNotFoundError:
manifest_data = []
manifest_data: List = []
root_node = yaml.safe_load(fin)
manifest_data = root_node["provisioners"]
# Loop over the provisioners list and update when necessary relative paths with absolute one for packer to run correctly
for provisioner in manifest_data:
# Extend the current provisioners list with the ones of the selected packages
......@@ -253,7 +268,7 @@ class PackerTemplate:
"""Returns the string representation for this :class:`PackerTemplate`.
d = collections.OrderedDict()
d : collections.OrderedDict = collections.OrderedDict()
d["description"] = self._description
d["variables"] = self._variables
d["builders"] = self._builders
......@@ -105,7 +105,7 @@ class Packman:
fin = open(manifest_file, "r")
# If the file does not exist, the manifest contents is just an empty dict
except FileNotFoundError:
manifest_data = {}
manifest_data : Dict[str,str] = {}
manifest_data = yaml.safe_load(fin)
from typing import Any, List
class PackerTemplate:
def __init__(self, name: str, yaml_node: dict, packages: List[str]) -> None: ...
def __init__(self, name: str, yaml_node: dict, packages: List[str], packages_base_dir: str, templates_base_dir: str) -> None: ...
def builders(self) -> list: ...
from .PackerTemplate import PackerTemplate as PackerTemplate
from typing import Any, List, Optional
class Packman:
def __init__(self, input_file: str, templates_base_dir: str) -> None: ...
def get_templates_selection(self, selected_templates: Optional[Any]=...) -> Any: ...
def get_template(self, template_name: Any) -> Any: ...
def run(self, selected_templates: Optional[List[str]]=..., log: Optional[bool]=...) -> Any: ...
def __init__(self, input_file: str, templates_base_dir: Optional[str]=..., packages_base_dir: Optional[str]=...) -> None: ...
def get_templates_selection(self, selected_templates: Optional[Any] = ...): ...
def get_template(self, template_name: Any): ...
def run(self, selected_templates: Optional[List[str]]=..., log: Optional[bool]=..., key_rate: Optional[int]=...) -> Any: ...
def build(self, selected_templates: Optional[List[str]]=..., **kwargs: Any) -> Any: ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment