Skip to content

Commit

Permalink
Enable pylint doclinters (#10)
Browse files Browse the repository at this point in the history
* Enabling docstring linters

* Updated docstring text
  • Loading branch information
hiranya911 committed Mar 29, 2017
1 parent e2edf79 commit f033d26
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ persistent=no

# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
load-plugins=
load-plugins=pylint.extensions.docparams,pylint.extensions.docstyle

# Use multiple processes to speed up Pylint.
jobs=1
Expand Down Expand Up @@ -65,7 +65,7 @@ enable=indexing-exception,old-raise-syntax
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=design,similarities,no-self-use,attribute-defined-outside-init,locally-disabled,star-args,pointless-except,bad-option-value,global-statement,fixme,suppressed-message,useless-suppression,locally-enabled,file-ignored
disable=design,similarities,no-self-use,attribute-defined-outside-init,locally-disabled,star-args,pointless-except,bad-option-value,global-statement,fixme,suppressed-message,useless-suppression,locally-enabled,file-ignored,missing-type-doc


[REPORTS]
Expand Down
4 changes: 2 additions & 2 deletions firebase_admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def initialize_app(credential=None, options=None, name=_DEFAULT_APP_NAME):
name: Name of the app (optional).
Returns:
A newly initialized instance of App.
App: A newly initialized instance of App.
Raises:
ValueError: If the app name is already in use, or any of the
Expand Down Expand Up @@ -92,7 +92,7 @@ def get_app(name=_DEFAULT_APP_NAME):
name: Name of the App instance to retrieve (optional).
Returns:
An App instance.
App: An App instance with the given name.
Raises:
ValueError: If the specified name is not a string, or if the specified
Expand Down
10 changes: 5 additions & 5 deletions firebase_admin/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _get_token_generator(app):
app: A Firebase App instance (or None to use the default App).
Returns:
A _TokenGenerator instance.
_TokenGenerator: A _TokenGenerator for the specified App instance.
Raises:
ValueError: If the app argument is invalid.
Expand All @@ -73,7 +73,7 @@ def create_custom_token(uid, developer_claims=None, app=None):
app: An App instance (optional).
Returns:
A token string minted from the input parameters.
string: A token minted from the input parameters.
Raises:
ValueError: If input parameters are invalid.
Expand All @@ -93,7 +93,7 @@ def verify_id_token(id_token, app=None):
app: An App instance (optional).
Returns:
A dict consisting of the key-value pairs parsed from the decoded JWT.
dict: A dictionary of key-value pairs parsed from the decoded JWT.
Raises:
ValueError: If the input parameters are invalid, or if the App was not
Expand Down Expand Up @@ -140,7 +140,7 @@ def create_custom_token(self, uid, developer_claims=None):
developer_claims: A dictionary of claims to be included in the token.
Returns:
A token string minted from the input parameters.
string: A token string minted from the input parameters.
Raises:
ValueError: If input parameters are invalid.
Expand Down Expand Up @@ -195,7 +195,7 @@ def verify_id_token(self, id_token):
id_token: A string of the encoded JWT.
Returns:
A dict consisting of the key-value pairs parsed from the decoded JWT.
dict: A dictionary of key-value pairs parsed from the decoded JWT.
Raises:
ValueError: The app was not initialized with a credentials.Certificate instance.
Expand Down
33 changes: 28 additions & 5 deletions firebase_admin/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ class Base(object):
"""Provides OAuth2 access tokens for accessing Firebase services."""

def get_access_token(self):
"""Fetches a Google OAuth2 access token using this credential instance.
Returns:
An oauth2client.client.AccessTokenInfo instance
"""
"""Fetches a Google OAuth2 access token using this credential instance."""
raise NotImplementedError

def get_credential(self):
Expand Down Expand Up @@ -76,9 +72,18 @@ def service_account_email(self):
return self._service_account_email

def get_access_token(self):
"""Fetches a Google OAuth2 access token using this certificate credential.
Returns:
oauth2client.client.AccessTokenInfo: An access token obtained via oauth2client.
"""
return self._g_credential.get_access_token(_http)

def get_credential(self):
"""Returns the underlying Google credential.
Returns:
oauth2client.client.GoogleCredentials: An oauth2client credential instance."""
return self._g_credential


Expand All @@ -96,9 +101,18 @@ def __init__(self):
self._g_credential = client.GoogleCredentials.get_application_default()

def get_access_token(self):
"""Fetches a Google OAuth2 access token using this application default credential.
Returns:
oauth2client.client.AccessTokenInfo: An access token obtained via oauth2client.
"""
return self._g_credential.get_access_token(_http)

def get_credential(self):
"""Returns the underlying Google credential.
Returns:
oauth2client.client.GoogleCredentials: An oauth2client credential instance."""
return self._g_credential


Expand Down Expand Up @@ -143,7 +157,16 @@ def refresh_token(self):
return self._refresh_token

def get_access_token(self):
"""Fetches a Google OAuth2 access token using this refresh token credential.
Returns:
oauth2client.client.AccessTokenInfo: An access token obtained via oauth2client.
"""
return self._g_credential.get_access_token(_http)

def get_credential(self):
"""Returns the underlying Google credential.
Returns:
oauth2client.client.GoogleCredentials: An oauth2client credential instance."""
return self._g_credential
6 changes: 3 additions & 3 deletions firebase_admin/jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def encode(payload, signer, headers=None):
headers: An dictionary of headers (optional).
Returns:
A signed JWT token as a string
string: A signed JWT token.
"""
header = {'typ': 'JWT', 'alg': 'RS256'}
if headers:
Expand Down Expand Up @@ -86,7 +86,7 @@ def decode(token):
token: A signed JWT token as a string.
Returns:
A 2-tuple where the first element is a dictionary of JWT headers,
tuple: A 2-tuple where the first element is a dictionary of JWT headers,
and the second element is a dictionary of payload claims.
Raises:
Expand Down Expand Up @@ -118,7 +118,7 @@ def verify_id_token(id_token, cert_uri, audience=None, kid=None, http=None):
http: An httplib2 HTTP client instance.
Returns:
A dictionary of claims extracted from the ID token.
dict: A dictionary of claims extracted from the ID token.
Raises:
ValueError: Certificate URI is None or empty.
Expand Down

0 comments on commit f033d26

Please sign in to comment.