Skip to content

Commit

Permalink
chore: some lint fixes (#3747)
Browse files Browse the repository at this point in the history
  • Loading branch information
Takashi Matsuo committed May 12, 2020
1 parent 369dcca commit 58011b2
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 36 deletions.
3 changes: 2 additions & 1 deletion iam/api-client/access_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
# limitations under the License.

import os
import pytest
import uuid

from googleapiclient import errors
import pytest
from retrying import retry

import access
import service_accounts


# Setting up variables for testing
GCLOUD_PROJECT = os.environ["GCLOUD_PROJECT"]

Expand Down
6 changes: 4 additions & 2 deletions iam/api-client/custom_roles_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
# limitations under the License.

import os
import pytest
import uuid

import custom_roles
import googleapiclient.errors
import pytest

import custom_roles


GCLOUD_PROJECT = os.environ["GCLOUD_PROJECT"]

Expand Down
2 changes: 1 addition & 1 deletion iot/api-client/codelabs/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def on_publish(unused_client, userdata, mid):


def on_subscribe(unused_client, unused_userdata, mid, granted_qos):
print('on_subscribe: mid {}, qos {granted_qos}'.format(mid))
print('on_subscribe: mid {}, qos {}'.format(mid, granted_qos))
try:
client_addr, response = gateway_state.pending_subscribes[mid]
udpSerSock.sendto(response.encode(), client_addr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
import time

from google.cloud import pubsub
from google.oauth2 import service_account
from googleapiclient import discovery
from googleapiclient.errors import HttpError
from google.oauth2 import service_account


API_SCOPES = ['https://www.googleapis.com/auth/cloud-platform']
Expand Down
10 changes: 5 additions & 5 deletions iot/api-client/gcs_file_to_device/gcs_send_to_device_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@

from google.cloud import pubsub
from google.cloud import storage

# Add manager for bootstrapping device registry / device for testing
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'manager')) # noqa
import manager

import mock
import pytest
import requests

import gcs_send_to_device as gcs_to_device

# Add manager for bootstrapping device registry / device for testing
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'manager')) # noqa
import manager # noqa


gcs_bucket = os.environ['CLOUD_STORAGE_BUCKET']
project_id = os.environ['GCLOUD_PROJECT']
service_account_json = os.environ['GOOGLE_APPLICATION_CREDENTIALS']
Expand Down
9 changes: 4 additions & 5 deletions iot/api-client/http_example/cloudiot_http_example_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@
import time

from google.cloud import pubsub

# Add manager for bootstrapping device registry / device for testing
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'manager')) # noqa
import manager

import pytest

import cloudiot_http_example

# Add manager for bootstrapping device registry / device for testing
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'manager')) # noqa
import manager # noqa


cloud_region = 'us-central1'
device_id_template = 'test-device-{}'
Expand Down
9 changes: 5 additions & 4 deletions iot/api-client/manager/manager_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
import time
import uuid

# Add command receiver for bootstrapping device registry / device for testing
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'mqtt_example')) # noqa
from google.cloud import pubsub
import pytest

import manager
import cloudiot_mqtt_example
# Add command receiver for bootstrapping device registry / device for testing
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'mqtt_example')) # noqa
import cloudiot_mqtt_example # noqa
import manager # noqa


cloud_region = 'us-central1'
device_id_template = 'test-device-{}'
Expand Down
9 changes: 5 additions & 4 deletions iot/api-client/mqtt_example/cloudiot_mqtt_example_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@

import pytest

# Add manager for bootstrapping device registry / device for testing
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'manager')) # noqa
import cloudiot_mqtt_example
import manager
from fixtures import test_topic # noqa
from fixtures import test_registry_id # noqa
from fixtures import test_device_id # noqa
from fixtures import device_and_gateways # noqa
# Add manager for bootstrapping device registry / device for testing
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'manager')) # noqa
import cloudiot_mqtt_example # noqa
import manager # noqa


cloud_region = 'us-central1'
ca_cert_path = 'resources/roots.pem'
Expand Down
2 changes: 1 addition & 1 deletion iot/api-client/mqtt_example/cloudiot_mqtt_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

# Add manager as library
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'manager')) # noqa
import cloudiot_mqtt_example
import cloudiot_mqtt_example # noqa


# [START iot_mqtt_image]
Expand Down
14 changes: 7 additions & 7 deletions iot/api-client/mqtt_example/cloudiot_mqtt_image_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
import sys

# Add manager as library
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'manager')) # noqa
import cloudiot_mqtt_image
import manager
from fixtures import test_topic # noqa
from fixtures import test_subscription # noqa
from fixtures import test_registry_id # noqa
from fixtures import test_device_id # noqa
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'manager')) # noqa
import cloudiot_mqtt_image # noqa
import manager # noqa
from fixtures import test_topic # noqa
from fixtures import test_subscription # noqa
from fixtures import test_registry_id # noqa
from fixtures import test_device_id # noqa


cloud_region = 'us-central1'
Expand Down
6 changes: 3 additions & 3 deletions iot/api-client/mqtt_example/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
import uuid

import backoff
from googleapiclient.errors import HttpError
from google.cloud import pubsub
from google.api_core.exceptions import AlreadyExists
from google.api_core.exceptions import NotFound
from google.cloud import pubsub
from googleapiclient.errors import HttpError
import pytest

# Add manager as library
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'manager')) # noqa
import manager
import manager # noqa


cloud_region = 'us-central1'
Expand Down
4 changes: 2 additions & 2 deletions iot/api-client/mqtt_example/gateway_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import time

sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'manager')) # noqa
import cloudiot_mqtt_example # noqa
import manager # noqa

import cloudiot_mqtt_example
import manager

logging.getLogger('googleapiclient.discovery_cache').setLevel(logging.CRITICAL)

Expand Down

0 comments on commit 58011b2

Please sign in to comment.