Skip to content

Commit 289dfa8

Browse files
committed
Get docs building cleanly.
Still need to wire up `tox -e doc`.
1 parent 800c5f7 commit 289dfa8

File tree

11 files changed

+91
-78
lines changed

11 files changed

+91
-78
lines changed

doc-build

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,5 @@
2222
# Notes: You may have to update the location of the
2323
# App Engine library for your local system.
2424

25-
[[ -d docs ]] || mkdir -p docs
2625
cd docs
27-
export DJANGO_SETTINGS_MODULE=fakesettings
28-
export PYTHONPATH=$(pwd)/..
29-
epydoc --output epy --graph all --parse-only --docformat plaintext oauth2client
26+
make html

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33

44
# You can set these variables from the command line.
5-
SPHINXOPTS =
5+
SPHINXOPTS = -W
66
SPHINXBUILD = sphinx-build
77
PAPER =
88
BUILDDIR = _build

docs/conf.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,12 @@
5555
# |version| and |release|, also used in various other places throughout the
5656
# built documents.
5757
#
58+
59+
import oauth2client
5860
# The short X.Y version.
59-
version = '1.4.4'
61+
version = oauth2client.__version__
6062
# The full version, including alpha/beta/rc tags.
61-
release = '1.4.4'
63+
release = oauth2client.__version__
6264

6365
# The language for content autogenerated by Sphinx. Refer to documentation
6466
# for a list of supported languages.
@@ -107,7 +109,7 @@
107109

108110
import sphinx_bootstrap_theme
109111

110-
html_logo = 'google_logo.png'
112+
html_logo = '_static/google_logo.png'
111113
html_theme = 'bootstrap'
112114
html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()
113115
html_theme_options = {

docs/contributing.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ Please fill out either the individual or corporate Contributor License
88
Agreement.
99

1010
* If you are an individual writing original source code and you're sure you
11-
own the intellectual property, then you'll need to sign an `individual CLA
12-
<https://developers.google.com/open-source/cla/individual>`_.
11+
own the intellectual property, then you'll need to sign an `individual CLA
12+
<https://developers.google.com/open-source/cla/individual>`_.
1313
* If you work for a company that wants to allow you to contribute your work to
14-
oauth2client, then you'll need to sign a `corporate CLA
15-
<https://developers.google.com/open-source/cla/corporate>`_.
14+
oauth2client, then you'll need to sign a `corporate CLA
15+
<https://developers.google.com/open-source/cla/corporate>`_.
1616

1717
Follow either of the
1818
two links above to access the appropriate CLA and instructions for how to sign

docs/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,9 @@ Please see the `contributing page <contributing.html>`_ for more information.
4444
In particular, we love pull requests -- but please make sure to sign the
4545
contributor license agreement.
4646

47+
.. toctree::
48+
:maxdepth: 1
49+
:hidden:
50+
51+
source/modules
52+
contributing

oauth2client/appengine.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -571,16 +571,14 @@ class OAuth2Decorator(object):
571571
Instantiate and then use with oauth_required or oauth_aware
572572
as decorators on webapp.RequestHandler methods.
573573
574-
Example:
574+
::
575575
576576
decorator = OAuth2Decorator(
577577
client_id='837...ent.com',
578578
client_secret='Qh...wwI',
579579
scope='https://www.googleapis.com/auth/plus')
580580
581-
582581
class MainHandler(webapp.RequestHandler):
583-
584582
@decorator.oauth_required
585583
def get(self):
586584
http = decorator.http()
@@ -847,7 +845,8 @@ def callback_path(self):
847845
def callback_handler(self):
848846
"""RequestHandler for the OAuth 2.0 redirect callback.
849847
850-
Usage:
848+
Usage::
849+
851850
app = webapp.WSGIApplication([
852851
('/index', MyIndexHandler),
853852
...,
@@ -910,20 +909,19 @@ class OAuth2DecoratorFromClientSecrets(OAuth2Decorator):
910909
Uses a clientsecrets file as the source for all the information when
911910
constructing an OAuth2Decorator.
912911
913-
Example:
912+
::
914913
915914
decorator = OAuth2DecoratorFromClientSecrets(
916915
os.path.join(os.path.dirname(__file__), 'client_secrets.json')
917916
scope='https://www.googleapis.com/auth/plus')
918917
919-
920918
class MainHandler(webapp.RequestHandler):
921-
922919
@decorator.oauth_required
923920
def get(self):
924921
http = decorator.http()
925922
# http is authorized with the user's Credentials and can be used
926923
# in API calls
924+
927925
"""
928926

929927
@util.positional(3)

oauth2client/client.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -499,13 +499,13 @@ def authorize(self, http):
499499
it.
500500
501501
Args:
502-
http: An instance of httplib2.Http
503-
or something that acts like it.
502+
http: An instance of ``httplib2.Http`` or something that acts
503+
like it.
504504
505505
Returns:
506506
A modified instance of http that was passed in.
507507
508-
Example:
508+
Example::
509509
510510
h = httplib2.Http()
511511
h = credentials.authorize(h)
@@ -515,6 +515,7 @@ def authorize(self, http):
515515
signing. So instead we have to overload 'request' with a closure
516516
that adds in the Authorization header and then calls the original
517517
version of 'request()'.
518+
518519
"""
519520
request_orig = http.request
520521

@@ -859,7 +860,8 @@ class AccessTokenCredentials(OAuth2Credentials):
859860
860861
AccessTokenCredentials objects may be safely pickled and unpickled.
861862
862-
Usage:
863+
Usage::
864+
863865
credentials = AccessTokenCredentials('<an access token>',
864866
'my-user-agent/1.0')
865867
http = httplib2.Http()
@@ -1688,8 +1690,8 @@ class DeviceFlowInfo(collections.namedtuple('DeviceFlowInfo', (
16881690
def FromResponse(cls, response):
16891691
"""Create a DeviceFlowInfo from a server response.
16901692
1691-
The response should be a dict containing entries as described
1692-
here:
1693+
The response should be a dict containing entries as described here:
1694+
16931695
http://tools.ietf.org/html/draft-ietf-oauth-v2-05#section-3.7.1
16941696
"""
16951697
# device_code, user_code, and verification_url are required.

oauth2client/clientsecrets.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,12 @@ def loadfile(filename, cache=None):
112112
Typical cache storage would be App Engine memcache service,
113113
but you can pass in any other cache client that implements
114114
these methods:
115-
- get(key, namespace=ns)
116-
- set(key, value, namespace=ns)
117115
118-
Usage:
116+
* ``get(key, namespace=ns)``
117+
* ``set(key, value, namespace=ns)``
118+
119+
Usage::
120+
119121
# without caching
120122
client_type, client_info = loadfile('secrets.json')
121123
# using App Engine memcache service

oauth2client/locked_file.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
This module first tries to use fcntl locking to ensure serialized access
1818
to a file, then falls back on a lock file if that is unavialable.
1919
20-
Usage:
20+
Usage::
21+
2122
f = LockedFile('filename', 'r+b', 'rb')
2223
f.open_and_lock()
2324
if f.is_locked():
@@ -26,6 +27,7 @@
2627
else:
2728
print('Acquired filename with rb mode')
2829
f.unlock_and_close()
30+
2931
"""
3032

3133
from __future__ import print_function

oauth2client/multistore_file.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,29 @@
1919
both in a single process and across processes.
2020
2121
The credential themselves are keyed off of:
22+
2223
* client_id
2324
* user_agent
2425
* scope
2526
26-
The format of the stored data is like so:
27-
{
28-
'file_version': 1,
29-
'data': [
30-
{
31-
'key': {
32-
'clientId': '<client id>',
33-
'userAgent': '<user agent>',
34-
'scope': '<scope>'
35-
},
36-
'credential': {
37-
# JSON serialized Credentials.
27+
The format of the stored data is like so::
28+
29+
{
30+
'file_version': 1,
31+
'data': [
32+
{
33+
'key': {
34+
'clientId': '<client id>',
35+
'userAgent': '<user agent>',
36+
'scope': '<scope>'
37+
},
38+
'credential': {
39+
# JSON serialized Credentials.
40+
}
3841
}
39-
}
40-
]
41-
}
42+
]
43+
}
44+
4245
"""
4346

4447
__author__ = '[email protected] (Joe Beda)'
@@ -62,12 +65,10 @@
6265

6366
class Error(Exception):
6467
"""Base error for this module."""
65-
pass
6668

6769

6870
class NewerCredentialStoreError(Error):
69-
"""The credential store is a newer version that supported."""
70-
pass
71+
"""The credential store is a newer version than supported."""
7172

7273

7374
@util.positional(4)

oauth2client/util.py

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -51,56 +51,58 @@
5151
def positional(max_positional_args):
5252
"""A decorator to declare that only the first N arguments my be positional.
5353
54-
This decorator makes it easy to support Python 3 style key-word only
55-
parameters. For example, in Python 3 it is possible to write:
54+
This decorator makes it easy to support Python 3 style keyword-only
55+
parameters. For example, in Python 3 it is possible to write::
5656
5757
def fn(pos1, *, kwonly1=None, kwonly1=None):
5858
...
5959
60-
All named parameters after * must be a keyword:
60+
All named parameters after ``*`` must be a keyword::
6161
6262
fn(10, 'kw1', 'kw2') # Raises exception.
6363
fn(10, kwonly1='kw1') # Ok.
6464
65-
Example:
66-
To define a function like above, do:
65+
Example
66+
^^^^^^^
6767
68-
@positional(1)
69-
def fn(pos1, kwonly1=None, kwonly2=None):
70-
...
68+
To define a function like above, do::
69+
70+
@positional(1)
71+
def fn(pos1, kwonly1=None, kwonly2=None):
72+
...
7173
72-
If no default value is provided to a keyword argument, it becomes a required
73-
keyword argument:
74+
If no default value is provided to a keyword argument, it becomes a required
75+
keyword argument::
7476
75-
@positional(0)
76-
def fn(required_kw):
77-
...
77+
@positional(0)
78+
def fn(required_kw):
79+
...
7880
79-
This must be called with the keyword parameter:
81+
This must be called with the keyword parameter::
8082
81-
fn() # Raises exception.
82-
fn(10) # Raises exception.
83-
fn(required_kw=10) # Ok.
83+
fn() # Raises exception.
84+
fn(10) # Raises exception.
85+
fn(required_kw=10) # Ok.
8486
85-
When defining instance or class methods always remember to account for
86-
'self' and 'cls':
87+
When defining instance or class methods always remember to account for
88+
``self`` and ``cls``::
8789
88-
class MyClass(object):
90+
class MyClass(object):
8991
90-
@positional(2)
91-
def my_method(self, pos1, kwonly1=None):
92-
...
92+
@positional(2)
93+
def my_method(self, pos1, kwonly1=None):
94+
...
9395
94-
@classmethod
95-
@positional(2)
96-
def my_method(cls, pos1, kwonly1=None):
97-
...
96+
@classmethod
97+
@positional(2)
98+
def my_method(cls, pos1, kwonly1=None):
99+
...
98100
99101
The positional decorator behavior is controlled by
100-
util.positional_parameters_enforcement, which may be set to
101-
POSITIONAL_EXCEPTION, POSITIONAL_WARNING or POSITIONAL_IGNORE to raise an
102-
exception, log a warning, or do nothing, respectively, if a declaration is
103-
violated.
102+
``util.positional_parameters_enforcement``, which may be set to
103+
``POSITIONAL_EXCEPTION``, ``POSITIONAL_WARNING`` or
104+
``POSITIONAL_IGNORE`` to raise an exception, log a warning, or do
105+
nothing, respectively, if a declaration is violated.
104106
105107
Args:
106108
max_positional_arguments: Maximum number of positional arguments. All
@@ -114,6 +116,7 @@ def my_method(cls, pos1, kwonly1=None):
114116
TypeError if a key-word only argument is provided as a positional
115117
parameter, but only if util.positional_parameters_enforcement is set to
116118
POSITIONAL_EXCEPTION.
119+
117120
"""
118121
def positional_decorator(wrapped):
119122
def positional_wrapper(*args, **kwargs):

0 commit comments

Comments
 (0)