diff options
| author | Brant Knudson <bknudson@us.ibm.com> | 2014-10-11 16:20:54 -0500 |
|---|---|---|
| committer | Brant Knudson <bknudson@us.ibm.com> | 2014-12-04 19:04:15 -0600 |
| commit | 3c8d35247ebfc57663f363ba9522da27b8748262 (patch) | |
| tree | 9608b4b767be52d66416f2e869a95424f3b2623e /keystoneclient/auth | |
| parent | cc0c93fc0c4c5d0240a5a96c57f1fd62988ee6aa (diff) | |
| download | python-keystoneclient-3c8d35247ebfc57663f363ba9522da27b8748262.tar.gz | |
Correct documenting constructor parameters
When the docs are rendered to HTML, any docs on __init__ are not
displayed. The parameters to the constructor have to be documented on
the class rather than on the __init__ method.
Also, corrected other minor issues in the same areas.
Change-Id: Ic56da33f6b99fe5efb636c289e3c4e1569f0c84c
Diffstat (limited to 'keystoneclient/auth')
| -rw-r--r-- | keystoneclient/auth/identity/generic/password.py | 18 | ||||
| -rw-r--r-- | keystoneclient/auth/identity/generic/token.py | 8 | ||||
| -rw-r--r-- | keystoneclient/auth/identity/v2.py | 51 | ||||
| -rw-r--r-- | keystoneclient/auth/identity/v3.py | 60 |
4 files changed, 64 insertions, 73 deletions
diff --git a/keystoneclient/auth/identity/generic/password.py b/keystoneclient/auth/identity/generic/password.py index c8d9b7a..a8950a3 100644 --- a/keystoneclient/auth/identity/generic/password.py +++ b/keystoneclient/auth/identity/generic/password.py @@ -34,19 +34,19 @@ def get_options(): class Password(base.BaseGenericPlugin): - """A common user/password authentication plugin.""" + """A common user/password authentication plugin. + + :param string username: Username for authentication. + :param string user_id: User ID for authentication. + :param string password: Password for authentication. + :param string user_domain_id: User's domain ID for authentication. + :param string user_domain_name: User's domain name for authentication. + + """ @utils.positional() def __init__(self, auth_url, username=None, user_id=None, password=None, user_domain_id=None, user_domain_name=None, **kwargs): - """Construct plugin. - - :param string username: Username for authentication. - :param string user_id: User ID for authentication. - :param string password: Password for authentication. - :param string user_domain_id: User's domain ID for authentication. - :param string user_domain_name: User's domain name for authentication. - """ super(Password, self).__init__(auth_url=auth_url, **kwargs) self._username = username diff --git a/keystoneclient/auth/identity/generic/token.py b/keystoneclient/auth/identity/generic/token.py index 547ce36..d309dfa 100644 --- a/keystoneclient/auth/identity/generic/token.py +++ b/keystoneclient/auth/identity/generic/token.py @@ -29,12 +29,12 @@ def get_options(): class Token(base.BaseGenericPlugin): + """Generic token auth plugin. - def __init__(self, auth_url, token=None, **kwargs): - """Construct a plugin. + :param string token: Token for authentication. + """ - :param string token: Token for authentication. - """ + def __init__(self, auth_url, token=None, **kwargs): super(Token, self).__init__(auth_url, **kwargs) self._token = token diff --git a/keystoneclient/auth/identity/v2.py b/keystoneclient/auth/identity/v2.py index 23d4c43..995044f 100644 --- a/keystoneclient/auth/identity/v2.py +++ b/keystoneclient/auth/identity/v2.py @@ -26,6 +26,15 @@ _logger = logging.getLogger(__name__) @six.add_metaclass(abc.ABCMeta) class Auth(base.BaseIdentityPlugin): + """Identity V2 Authentication Plugin. + + :param string auth_url: Identity service endpoint for authorization. + :param string trust_id: Trust ID for trust scoping. + :param string tenant_id: Tenant ID for project scoping. + :param string tenant_name: Tenant name for project scoping. + :param bool reauthenticate: Allow fetching a new token if the current one + is going to expire. (optional) default True + """ @classmethod def get_options(cls): @@ -45,16 +54,6 @@ class Auth(base.BaseIdentityPlugin): tenant_id=None, tenant_name=None, reauthenticate=True): - """Construct an Identity V2 Authentication Plugin. - - :param string auth_url: Identity service endpoint for authorization. - :param string trust_id: Trust ID for trust scoping. - :param string tenant_id: Tenant ID for project scoping. - :param string tenant_name: Tenant name for project scoping. - :param bool reauthenticate: Allow fetching a new token if the current - one is going to expire. - (optional) default True - """ super(Auth, self).__init__(auth_url=auth_url, reauthenticate=reauthenticate) @@ -100,21 +99,21 @@ _NOT_PASSED = object() class Password(Auth): + """A plugin for authenticating with a username and password. - @utils.positional(4) - def __init__(self, auth_url, username=_NOT_PASSED, password=None, - user_id=_NOT_PASSED, **kwargs): - """A plugin for authenticating with a username and password. + A username or user_id must be provided. - A username or user_id must be provided. + :param string auth_url: Identity service endpoint for authorization. + :param string username: Username for authentication. + :param string password: Password for authentication. + :param string user_id: User ID for authentication. - :param string auth_url: Identity service endpoint for authorization. - :param string username: Username for authentication. - :param string password: Password for authentication. - :param string user_id: User ID for authentication. + :raises TypeError: if a user_id or username is not provided. + """ - :raises TypeError: if a user_id or username is not provided. - """ + @utils.positional(4) + def __init__(self, auth_url, username=_NOT_PASSED, password=None, + user_id=_NOT_PASSED, **kwargs): super(Password, self).__init__(auth_url, **kwargs) if username is _NOT_PASSED and user_id is _NOT_PASSED: @@ -157,13 +156,13 @@ class Password(Auth): class Token(Auth): + """A plugin for authenticating with an existing token. - def __init__(self, auth_url, token, **kwargs): - """A plugin for authenticating with an existing token. + :param string auth_url: Identity service endpoint for authorization. + :param string token: Existing token for authentication. + """ - :param string auth_url: Identity service endpoint for authorization. - :param string token: Existing token for authentication. - """ + def __init__(self, auth_url, token, **kwargs): super(Token, self).__init__(auth_url, **kwargs) self.token = token diff --git a/keystoneclient/auth/identity/v3.py b/keystoneclient/auth/identity/v3.py index 0749924..8f723ff 100644 --- a/keystoneclient/auth/identity/v3.py +++ b/keystoneclient/auth/identity/v3.py @@ -26,6 +26,20 @@ _logger = logging.getLogger(__name__) class Auth(base.BaseIdentityPlugin): + """Identity V3 Authentication Plugin. + + :param string auth_url: Identity service endpoint for authentication. + :param list auth_methods: A collection of methods to authenticate with. + :param string trust_id: Trust ID for trust scoping. + :param string domain_id: Domain ID for domain scoping. + :param string domain_name: Domain name for domain scoping. + :param string project_id: Project ID for project scoping. + :param string project_name: Project name for project scoping. + :param string project_domain_id: Project's domain ID for project. + :param string project_domain_name: Project's domain name for project. + :param bool reauthenticate: Allow fetching a new token if the current one + is going to expire. (optional) default True + """ @utils.positional() def __init__(self, auth_url, auth_methods, @@ -37,22 +51,6 @@ class Auth(base.BaseIdentityPlugin): project_domain_id=None, project_domain_name=None, reauthenticate=True): - """Construct an Identity V3 Authentication Plugin. - - :param string auth_url: Identity service endpoint for authentication. - :param list auth_methods: A collection of methods to authenticate with. - :param string trust_id: Trust ID for trust scoping. - :param string domain_id: Domain ID for domain scoping. - :param string domain_name: Domain name for domain scoping. - :param string project_id: Project ID for project scoping. - :param string project_name: Project name for project scoping. - :param string project_domain_id: Project's domain ID for project. - :param string project_domain_name: Project's domain name for project. - :param bool reauthenticate: Allow fetching a new token if the current - one is going to expire. - (optional) default True - """ - super(Auth, self).__init__(auth_url=auth_url, reauthenticate=reauthenticate) @@ -207,6 +205,14 @@ class AuthConstructor(Auth): class PasswordMethod(AuthMethod): + """Construct a User/Password based authentication method. + + :param string password: Password for authentication. + :param string username: Username for authentication. + :param string user_id: User ID for authentication. + :param string user_domain_id: User's domain ID for authentication. + :param string user_domain_name: User's domain name for authentication. + """ _method_parameters = ['user_id', 'username', @@ -214,17 +220,6 @@ class PasswordMethod(AuthMethod): 'user_domain_name', 'password'] - def __init__(self, **kwargs): - """Construct a User/Password based authentication method. - - :param string password: Password for authentication. - :param string username: Username for authentication. - :param string user_id: User ID for authentication. - :param string user_domain_id: User's domain ID for authentication. - :param string user_domain_name: User's domain name for authentication. - """ - super(PasswordMethod, self).__init__(**kwargs) - def get_auth_data(self, session, auth, headers, **kwargs): user = {'password': self.password} @@ -261,15 +256,12 @@ class Password(AuthConstructor): class TokenMethod(AuthMethod): + """Construct an Auth plugin to fetch a token from a token. - _method_parameters = ['token'] - - def __init__(self, **kwargs): - """Construct an Auth plugin to fetch a token from a token. + :param string token: Token for authentication. + """ - :param string token: Token for authentication. - """ - super(TokenMethod, self).__init__(**kwargs) + _method_parameters = ['token'] def get_auth_data(self, session, auth, headers, **kwargs): headers['X-Auth-Token'] = self.token |
