Skip to content

Commit dfab35e

Browse files
authored
chore(lint): correct linting on older samples (#13528)
1 parent cdae4ca commit dfab35e

File tree

10 files changed

+22
-18
lines changed

10 files changed

+22
-18
lines changed

appengine/standard/memcache/guestbook/main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
"""
2020

2121
# [START gae_memcache_guestbook_all]
22-
import cgi
23-
import cStringIO
2422
import logging
2523
import urllib
2624

25+
import cgi
26+
import cStringIO
27+
2728
from google.appengine.api import memcache
2829
from google.appengine.api import users
2930
from google.appengine.ext import ndb

appengine/standard/ndb/overview/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
"""
2222

2323
# [START gae_ndb_overview]
24-
import cgi
2524
import textwrap
2625
import urllib
2726

27+
import cgi
28+
2829
from google.appengine.ext import ndb
2930

3031
import webapp2

appengine/standard/ndb/transactions/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import cgi
1615
import random
1716
import urllib
1817

18+
import cgi
19+
1920
import flask
2021

2122
# [START gae_ndb_transactions_import]

appengine/standard/urlfetch/snippets/main.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@
1919
import logging
2020
import urllib
2121

22-
# [START gae_urlfetch_snippets_imports_urllib2]
23-
import urllib2
24-
# [END gae_urlfetch_snippets_imports_urllib2]
2522

2623
# [START gae_urlfetch_snippets_imports_urlfetch]
2724
from google.appengine.api import urlfetch
2825
# [END gae_urlfetch_snippets_imports_urlfetch]
2926

27+
# [START gae_urlfetch_snippets_imports_urllib2]
28+
import urllib2
29+
# [END gae_urlfetch_snippets_imports_urllib2]
30+
3031
import webapp2
3132

3233

cloud_tasks/http_queues/delete_http_queue_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def q():
5959
try:
6060
client.delete_queue(name=queue.name)
6161
except Exception as e:
62-
if type(e) == NotFound: # It's still gone, anyway, so it's fine
62+
if type(e) is NotFound: # It's still gone, anyway, so it's fine
6363
pass
6464
else:
6565
print(f"Tried my best to clean up, but could not: {e}")

compute/managed-instances/demo/app.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def init():
5050
@app.route("/")
5151
def index():
5252
"""Returns the demo UI."""
53-
global _cpu_burner, _is_healthy
53+
global _cpu_burner, _is_healthy # noqa: F824
5454
return render_template(
5555
"index.html",
5656
hostname=gethostname(),
@@ -68,15 +68,15 @@ def health():
6868
Returns:
6969
HTTP status 200 if 'healthy', HTTP status 500 if 'unhealthy'
7070
"""
71-
global _is_healthy
71+
global _is_healthy # noqa: F824
7272
template = render_template("health.html", healthy=_is_healthy)
7373
return make_response(template, 200 if _is_healthy else 500)
7474

7575

7676
@app.route("/makeHealthy")
7777
def make_healthy():
7878
"""Sets the server to simulate a 'healthy' status."""
79-
global _cpu_burner, _is_healthy
79+
global _cpu_burner, _is_healthy # noqa: F824
8080
_is_healthy = True
8181

8282
template = render_template(
@@ -95,7 +95,7 @@ def make_healthy():
9595
@app.route("/makeUnhealthy")
9696
def make_unhealthy():
9797
"""Sets the server to simulate an 'unhealthy' status."""
98-
global _cpu_burner, _is_healthy
98+
global _cpu_burner, _is_healthy # noqa: F824
9999
_is_healthy = False
100100

101101
template = render_template(
@@ -114,7 +114,7 @@ def make_unhealthy():
114114
@app.route("/startLoad")
115115
def start_load():
116116
"""Sets the server to simulate high CPU load."""
117-
global _cpu_burner, _is_healthy
117+
global _cpu_burner, _is_healthy # noqa: F824
118118
_cpu_burner.start()
119119

120120
template = render_template(
@@ -133,7 +133,7 @@ def start_load():
133133
@app.route("/stopLoad")
134134
def stop_load():
135135
"""Sets the server to stop simulating CPU load."""
136-
global _cpu_burner, _is_healthy
136+
global _cpu_burner, _is_healthy # noqa: F824
137137
_cpu_burner.stop()
138138

139139
template = render_template(

endpoints/getting-started/clients/service_to_service_gae_default/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
Google App Engine Default Service Account."""
1717

1818
import base64
19-
import httplib
2019
import json
2120
import time
2221

2322
from google.appengine.api import app_identity
23+
import httplib
2424
import webapp2
2525

2626
DEFAULT_SERVICE_ACCOUNT = "[email protected]"

endpoints/getting-started/clients/service_to_service_google_id_token/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
Default Service Account using Google ID token."""
1717

1818
import base64
19-
import httplib
2019
import json
2120
import time
2221
import urllib
2322

2423
from google.appengine.api import app_identity
24+
import httplib
2525
import webapp2
2626

2727
SERVICE_ACCOUNT_EMAIL = "[email protected]"

endpoints/getting-started/clients/service_to_service_non_default/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
Service Account."""
1717

1818
import base64
19-
import httplib
2019
import json
2120
import time
2221

2322
import google.auth.app_engine
2423
import googleapiclient.discovery
24+
import httplib
2525
import webapp2
2626

2727
SERVICE_ACCOUNT_EMAIL = "YOUR-SERVICE-ACCOUNT-EMAIL"

functions/tips-lazy-globals/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def lazy_globals(request):
5151
Response object using `make_response`
5252
<http://flask.pocoo.org/docs/1.0/api/#flask.Flask.make_response>.
5353
"""
54-
global lazy_global, non_lazy_global
54+
global lazy_global, non_lazy_global # noqa: F824
5555

5656
# This value is initialized only if (and when) the function is called
5757
if not lazy_global:

0 commit comments

Comments
 (0)