No dangerous default values. Double to single quotes.

This commit is contained in:
Pedro Algarvio 2014-02-18 19:50:45 +00:00
parent 0c5af800a1
commit d2f6cab4d2

View File

@ -23,9 +23,9 @@ class InvalidFunction(StateException):
class StateRegistry(object): class StateRegistry(object):
""" '''
The StateRegistry holds all of the states that have been created. The StateRegistry holds all of the states that have been created.
""" '''
def __init__(self): def __init__(self):
self.empty() self.empty()
@ -111,7 +111,7 @@ class StateRequisite(object):
class StateFactory(object): class StateFactory(object):
""" '''
The StateFactory is used to generate new States through a natural syntax The StateFactory is used to generate new States through a natural syntax
It is used by initializing it with the name of the salt module:: It is used by initializing it with the name of the salt module::
@ -124,11 +124,13 @@ class StateFactory(object):
File.managed('/path/', owner='root', group='root') File.managed('/path/', owner='root', group='root')
The kwargs are passed through to the State object The kwargs are passed through to the State object
""" '''
def __init__(self, module, registry, valid_funcs=[]): def __init__(self, module, registry, valid_funcs=None):
self.module = module self.module = module
self.valid_funcs = valid_funcs
self.registry = registry self.registry = registry
if valid_funcs is None:
valid_funcs = []
self.valid_funcs = valid_funcs
def __getattr__(self, func): def __getattr__(self, func):
if len(self.valid_funcs) > 0 and func not in self.valid_funcs: if len(self.valid_funcs) > 0 and func not in self.valid_funcs:
@ -146,16 +148,16 @@ class StateFactory(object):
return make_state return make_state
def __call__(self, id_, requisite='require'): def __call__(self, id_, requisite='require'):
""" '''
When an object is called it is being used as a requisite When an object is called it is being used as a requisite
""" '''
# return the correct data structure for the requisite # return the correct data structure for the requisite
return StateRequisite(requisite, self.module, id_, return StateRequisite(requisite, self.module, id_,
registry=self.registry) registry=self.registry)
class State(object): class State(object):
""" '''
This represents a single item in the state tree This represents a single item in the state tree
The id_ is the id of the state, the func is the full name of the salt The id_ is the id of the state, the func is the full name of the salt
@ -164,7 +166,7 @@ class State(object):
The registry is where the state should be stored. It is optional and will The registry is where the state should be stored. It is optional and will
use the default registry if not specified. use the default registry if not specified.
""" '''
def __init__(self, id_, module, func, registry, **kwargs): def __init__(self, id_, module, func, registry, **kwargs):
self.id_ = id_ self.id_ = id_