@staticmethod<EOL><INDENT>def from_dict(name, values):<DEDENT>
<EOL>count = <NUM_LIT:1><EOL>count_value = values.get('<STR_LIT:count>', <NUM_LIT:1>)<EOL>if isinstance(count_value, int):<EOL><INDENT>count = max(count_value, <NUM_LIT:1>)<EOL><DEDENT>def with_index(name, idx):<EOL><INDENT>if name and idx:<EOL><INDENT>return '<STR_LIT>' % (name, idx)<EOL><DEDENT>return name<EOL><DEDENT>def get_instance(n, idx=None):<EOL><INDENT>return BlockadeContainerConfig(<EOL>with_index(n, idx),<EOL>values['<STR_LIT:image>'],<EOL>command=values.get('<STR_LIT>'),<EOL>links=values.get('<STR_LIT>'),<EOL>volumes=values.get('<STR_LIT>'),<EOL>publish_ports=values.get('<STR_LIT>'),<EOL>expose_ports=values.get('<STR_LIT>'),<EOL>environment=values.get('<STR_LIT>'),<EOL>hostname=values.get('<STR_LIT>'),<EOL>dns=values.get('<STR_LIT>'),<EOL>start_delay=values.get('<STR_LIT>', <NUM_LIT:0>),<EOL>neutral=values.get('<STR_LIT>', False),<EOL>holy=values.get('<STR_LIT>', False),<EOL>container_name=with_index(values.get('<STR_LIT>'), idx),<EOL>cap_add=values.get('<STR_LIT>'))<EOL><DEDENT>if count == <NUM_LIT:1>:<EOL><INDENT>yield get_instance(name)<EOL><DEDENT>else:<EOL><INDENT>for idx in range(<NUM_LIT:1>, count+<NUM_LIT:1>):<EOL><INDENT>yield get_instance(name, idx)<EOL><DEDENT><DEDENT>
Convert a dictionary of configuration values
into a sequence of BlockadeContainerConfig instances