Skip to content

Commit beec423

Browse files
committed
More import cleanup and delinting
1 parent 17a0ab3 commit beec423

File tree

22 files changed

+77
-83
lines changed

22 files changed

+77
-83
lines changed

apps_script/execute/execute.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717

1818
from googleapiclient import errors
1919
from googleapiclient.discovery import build
20-
from oauth2client import file as oauth_file, client, tools
20+
from oauth2client import client
21+
from oauth2client import file as oauth_file
22+
from oauth2client import tools
2123

2224

2325
def main():

docs/mail-merge/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,23 @@ The unit-test script is `docs_mail_merge_test.py`; see the file for a list of th
8080
## Reference
8181

8282
- Google Drive API
83-
- [API documentation](https://developers.google.com/drive/)
84-
- [Support channels](https://developers.google.com/drive/api/v3/support/)
83+
- [API documentation](https://developers.google.com/drive/)
84+
- [Support channels](https://developers.google.com/drive/api/v3/support/)
8585
- Google Docs API
86-
- [API documentation](https://developers.google.com/docs/)
87-
- [Support channels](https://developers.google.com/docs/api/support/)
86+
- [API documentation](https://developers.google.com/docs/)
87+
- [Support channels](https://developers.google.com/docs/api/support/)
8888
- Google Sheets API
89-
- [API documentation](https://developers.google.com/sheets/)
90-
- [Support channels](https://developers.google.com/sheets/api/support/)
89+
- [API documentation](https://developers.google.com/sheets/)
90+
- [Support channels](https://developers.google.com/sheets/api/support/)
9191
- G Suite APIs
92-
- [G Suite developer overview & video](https://developers.google.com/gsuite/)
93-
- [G Suite (REST) APIs intro codelab](https://g.co/codelabs/gsuite-apis-intro/) (30 mins)
94-
- [Google APIs client libraries](https://developers.google.com/api-client-library/)
92+
- [G Suite developer overview & video](https://developers.google.com/gsuite/)
93+
- [G Suite (REST) APIs intro codelab](https://g.co/codelabs/gsuite-apis-intro/) (30 mins)
94+
- [Google APIs client libraries](https://developers.google.com/api-client-library/)
9595
- Introductory videos
96-
- [New Google APIs project setup](https://goo.gl/RbyTFD) (6:54)
97-
- [Common OAuth2 boilerplate code (Python)](https://goo.gl/KMfbeK) (3:48)
98-
- [REST APIs intro (Drive API)](https://goo.gl/ZIgf8k) (6:20)
99-
- [Introducing the Docs API](https://youtu.be/jeU-tWKeb6g) (2:57)
96+
- [New Google APIs project setup](https://goo.gl/RbyTFD) (6:54)
97+
- [Common OAuth2 boilerplate code (Python)](https://goo.gl/KMfbeK) (3:48)
98+
- [REST APIs intro (Drive API)](https://goo.gl/ZIgf8k) (6:20)
99+
- [Introducing the Docs API](https://youtu.be/jeU-tWKeb6g) (2:57)
100100

101101
## Enhancements
102102

docs/mail-merge/docs_mail_merge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
from googleapiclient import discovery
2626
from httplib2 import Http
27-
from oauth2client import file, client, tools
27+
from oauth2client import client, file, tools
2828

2929
# Fill-in IDs of your Docs template & any Sheets data source
3030
DOCS_FILE_ID = 'YOUR_TMPL_DOC_FILE_ID'

docs/mail-merge/docs_mail_merge_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424

2525
import unittest
2626

27-
from googleapiclient import discovery
2827
import google.auth
29-
from docs_mail_merge import (get_data, get_http_client, _copy_template)
28+
from docs_mail_merge import _copy_template, get_data, get_http_client
29+
from googleapiclient import discovery
3030

3131

3232
class TestDocsMailMerge(unittest.TestCase):

docs/output-json/output-json.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323

2424
from apiclient import discovery
2525
from httplib2 import Http
26-
from oauth2client import client
27-
from oauth2client import file
28-
from oauth2client import tools
26+
from oauth2client import client, file, tools
2927

3028
# Set doc ID, as found at `https://docs.google.com/document/d/YOUR_DOC_ID/edit`
3129
DOCUMENT_ID = 'YOUR_DOC_ID'

drive/driveapp/main.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
"""
77

88
from __future__ import print_function
9+
910
import pprint
10-
import six
11-
import httplib2
12-
from googleapiclient.discovery import build
11+
1312
import googleapiclient.http
13+
import httplib2
1414
import oauth2client.client
15+
import six
16+
from googleapiclient.discovery import build
1517

1618
# OAuth 2.0 scope that will be authorized.
1719
# Check https://developers.google.com/drive/scopes for all available scopes.

events/next18/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,27 @@ command-line tool that:
1919
* Run the tool with no arguments to complete the OAuth consent flow:
2020

2121
```bash
22-
$ python qbr_tool.py
22+
python qbr_tool.py
2323
```
2424

2525
* Run the tool:
2626

27+
2728
```bash
2829
# Create the spreadsheet from the Google Slides template.
2930
# For example, 13My9SxkotWssCc2F5yaXp2fzGrzoYV6maytr3qAT9GQ
30-
$ python qbr_tool.py create_sheet --template_id <your template id>;
31+
python qbr_tool.py create_sheet --template_id <your template id>;
3132

3233
# Outputs:
3334
# Spreadsheet URL: https://docs.google.com/spreadsheets/d/<spreadsheet id>
3435

3536
# Add data from the stub customer service
36-
$ python qbr_tool.py add_customers \
37+
python qbr_tool.py add_customers \
3738
--spreadsheet_id <spreadsheet id> \
3839
--customer_id jupiter
3940

4041
# Generate the filled in presentation
41-
$ python qbr_tool.py create_presentations
42+
python qbr_tool.py create_presentations
4243
--spreadsheet_id <spreadsheet id> \
4344
--customer_id jupiter
4445

events/next18/qbr_tool.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@
2525
import argparse
2626
import re
2727

28-
from googleapiclient.discovery import build
29-
from httplib2 import Http
30-
from oauth2client import file as oauth_file, client, tools
31-
3228
import customer_data_service
3329
import customer_spreadsheet_reader
3430
import presentation_reader
3531
import presentation_writer
3632
import spreadsheet_writer
33+
from googleapiclient.discovery import build
34+
from httplib2 import Http
35+
from oauth2client import client
36+
from oauth2client import file as oauth_file
37+
from oauth2client import tools
3738

3839
SCOPES = ['https://www.googleapis.com/auth/drive']
3940
store = oauth_file.Storage('token.json')

forms/snippets/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Google Forms API
1+
# Google Forms API
22

33
The Google Forms API is currently in Restricted Beta. To use the API and these samples prior to General Availability,
44
your Google Cloud project must be allowlisted. To request that your project be allowlisted, complete the

forms/snippets/add_item.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@
1717

1818
from apiclient import discovery
1919
from httplib2 import Http
20-
from oauth2client import client
21-
from oauth2client import file
22-
from oauth2client import tools
20+
from oauth2client import client, file, tools
2321

2422
SCOPES = "https://www.googleapis.com/auth/forms.body"
25-
DISCOVERY_DOC = "https://forms.googleapis.com/$discovery/rest?version=v1beta&key=<YOUR_API_KEY>&labels=FORMS_BETA_TESTERS"
23+
API_KEY = "<YOUR_API_KEY>"
24+
DISCOVERY_DOC = f"https://forms.googleapis.com/$discovery/rest?version=v1beta&key={API_KEY}&labels=FORMS_BETA_TESTERS"
2625

2726
store = file.Storage('credentials.json')
2827
creds = None

0 commit comments

Comments
 (0)