From 369dcca5f14cd1b80a325bd54e5d4d5a089579b2 Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Tue, 12 May 2020 16:39:41 -0700 Subject: [PATCH] chore: some lint fixes (#3746) --- healthcare/api-client/fhir/fhir_resources.py | 5 +++-- healthcare/api-client/fhir/fhir_resources_test.py | 9 +++++---- healthcare/api-client/fhir/fhir_stores.py | 2 +- healthcare/api-client/fhir/fhir_stores_test.py | 10 ++++++---- healthcare/api-client/hl7v2/hl7v2_messages.py | 4 ++-- healthcare/api-client/hl7v2/hl7v2_messages_test.py | 9 +++++---- healthcare/api-client/hl7v2/hl7v2_stores.py | 2 +- healthcare/api-client/hl7v2/hl7v2_stores_test.py | 10 ++++++---- healthcare/api-client/v1/datasets/datasets_test.py | 3 ++- healthcare/api-client/v1/dicom/dicom_stores_test.py | 7 ++++--- healthcare/api-client/v1/dicom/dicomweb_test.py | 8 ++++---- healthcare/api-client/v1/fhir/fhir_resources.py | 4 ++-- healthcare/api-client/v1/fhir/fhir_resources_test.py | 6 +++--- healthcare/api-client/v1/fhir/fhir_stores_test.py | 9 +++++---- healthcare/api-client/v1/hl7v2/hl7v2_messages.py | 2 +- healthcare/api-client/v1/hl7v2/hl7v2_messages_test.py | 9 +++++---- healthcare/api-client/v1/hl7v2/hl7v2_stores_test.py | 7 ++++--- 17 files changed, 59 insertions(+), 47 deletions(-) diff --git a/healthcare/api-client/fhir/fhir_resources.py b/healthcare/api-client/fhir/fhir_resources.py index 836ab421663e..d5b25814debb 100644 --- a/healthcare/api-client/fhir/fhir_resources.py +++ b/healthcare/api-client/fhir/fhir_resources.py @@ -19,6 +19,7 @@ from google.auth.transport import requests from google.oauth2 import service_account + _BASE_URL = "https://healthcare.googleapis.com/v1beta1" @@ -95,7 +96,7 @@ def create_encounter( ): """Creates a new Encounter resource in a FHIR store based on a Patient.""" url = "{}/projects/{}/locations/{}".format( - base_url, project_id, cloud_region, patient_id + base_url, project_id, cloud_region ) fhir_store_path = "{}/datasets/{}/fhirStores/{}/fhir/Encounter".format( @@ -152,7 +153,7 @@ def create_observation( an Encounter. """ url = "{}/projects/{}/locations/{}".format( - base_url, project_id, cloud_region, patient_id + base_url, project_id, cloud_region ) fhir_store_path = "{}/datasets/{}/fhirStores/{}/fhir/Observation".format( diff --git a/healthcare/api-client/fhir/fhir_resources_test.py b/healthcare/api-client/fhir/fhir_resources_test.py index 50fa1bdfff8e..605ede8a124c 100644 --- a/healthcare/api-client/fhir/fhir_resources_test.py +++ b/healthcare/api-client/fhir/fhir_resources_test.py @@ -13,18 +13,19 @@ # limitations under the License. import os -import pytest import sys import uuid import backoff +import pytest from requests.exceptions import HTTPError # Add datasets for bootstrapping datasets for testing sys.path.append(os.path.join(os.path.dirname(__file__), "..", "datasets")) # noqa -import datasets -import fhir_stores -import fhir_resources +import datasets # noqa +import fhir_stores # noqa +import fhir_resources # noqa + cloud_region = "us-central1" base_url = "https://healthcare.googleapis.com/v1beta1" diff --git a/healthcare/api-client/fhir/fhir_stores.py b/healthcare/api-client/fhir/fhir_stores.py index f39be964af9c..ed7c74b2d801 100644 --- a/healthcare/api-client/fhir/fhir_stores.py +++ b/healthcare/api-client/fhir/fhir_stores.py @@ -15,8 +15,8 @@ import argparse import os -from googleapiclient import discovery from google.oauth2 import service_account +from googleapiclient import discovery # [START healthcare_get_client] diff --git a/healthcare/api-client/fhir/fhir_stores_test.py b/healthcare/api-client/fhir/fhir_stores_test.py index b502ddaf77a4..ad7b348d2ef1 100644 --- a/healthcare/api-client/fhir/fhir_stores_test.py +++ b/healthcare/api-client/fhir/fhir_stores_test.py @@ -13,17 +13,19 @@ # limitations under the License. import os -import pytest import sys import time import uuid -from google.cloud import exceptions, storage +from google.cloud import exceptions +from google.cloud import storage +import pytest # Add datasets for bootstrapping datasets for testing sys.path.append(os.path.join(os.path.dirname(__file__), "..", "datasets")) # noqa -import datasets -import fhir_stores +import datasets # noqa +import fhir_stores # noqa + cloud_region = "us-central1" project_id = os.environ["GOOGLE_CLOUD_PROJECT"] diff --git a/healthcare/api-client/hl7v2/hl7v2_messages.py b/healthcare/api-client/hl7v2/hl7v2_messages.py index 1304e03510dd..eb8c2b93b652 100644 --- a/healthcare/api-client/hl7v2/hl7v2_messages.py +++ b/healthcare/api-client/hl7v2/hl7v2_messages.py @@ -16,9 +16,9 @@ import json import os +from google.oauth2 import service_account from googleapiclient import discovery from googleapiclient.errors import HttpError -from google.oauth2 import service_account # [START healthcare_get_client] @@ -212,7 +212,7 @@ def patch_hl7v2_message( """Updates the message.""" client = get_client(service_account_json) hl7v2_message_parent = 'projects/{}/locations/{}'.format( - project_id, cloud_region, dataset_id, hl7v2_store_id) + project_id, cloud_region) hl7v2_message_name = '{}/datasets/{}/hl7V2Stores/{}/messages/{}'.format( hl7v2_message_parent, dataset_id, hl7v2_store_id, hl7v2_message_id) diff --git a/healthcare/api-client/hl7v2/hl7v2_messages_test.py b/healthcare/api-client/hl7v2/hl7v2_messages_test.py index f6b3a91e3098..2290fe1858e0 100644 --- a/healthcare/api-client/hl7v2/hl7v2_messages_test.py +++ b/healthcare/api-client/hl7v2/hl7v2_messages_test.py @@ -13,17 +13,18 @@ # limitations under the License. import os -import pytest import sys import uuid import backoff +import pytest # Add datasets for bootstrapping datasets for testing sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'datasets')) # noqa -import datasets -import hl7v2_stores -import hl7v2_messages +import datasets # noqa +import hl7v2_messages # noqa +import hl7v2_stores # noqa + cloud_region = 'us-central1' project_id = os.environ['GOOGLE_CLOUD_PROJECT'] diff --git a/healthcare/api-client/hl7v2/hl7v2_stores.py b/healthcare/api-client/hl7v2/hl7v2_stores.py index 9bdb7a0e28aa..4420a92ded3c 100644 --- a/healthcare/api-client/hl7v2/hl7v2_stores.py +++ b/healthcare/api-client/hl7v2/hl7v2_stores.py @@ -15,9 +15,9 @@ import argparse import os +from google.oauth2 import service_account from googleapiclient import discovery from googleapiclient.errors import HttpError -from google.oauth2 import service_account # [START healthcare_get_client] diff --git a/healthcare/api-client/hl7v2/hl7v2_stores_test.py b/healthcare/api-client/hl7v2/hl7v2_stores_test.py index 3417e4f603a5..7731bcc49056 100644 --- a/healthcare/api-client/hl7v2/hl7v2_stores_test.py +++ b/healthcare/api-client/hl7v2/hl7v2_stores_test.py @@ -13,14 +13,16 @@ # limitations under the License. import os -import pytest import sys import uuid +import pytest + # Add datasets for bootstrapping datasets for testing -sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'datasets')) # noqa -import datasets -import hl7v2_stores +sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'datasets')) # noqa +import datasets # noqa +import hl7v2_stores # noqa + cloud_region = 'us-central1' project_id = os.environ['GOOGLE_CLOUD_PROJECT'] diff --git a/healthcare/api-client/v1/datasets/datasets_test.py b/healthcare/api-client/v1/datasets/datasets_test.py index de77edc5d6a5..d12be975a261 100644 --- a/healthcare/api-client/v1/datasets/datasets_test.py +++ b/healthcare/api-client/v1/datasets/datasets_test.py @@ -13,14 +13,15 @@ # limitations under the License. import os -import pytest import uuid from googleapiclient.errors import HttpError +import pytest from retrying import retry import datasets + cloud_region = 'us-central1' project_id = os.environ['GOOGLE_CLOUD_PROJECT'] diff --git a/healthcare/api-client/v1/dicom/dicom_stores_test.py b/healthcare/api-client/v1/dicom/dicom_stores_test.py index b7524315fe0c..dc45da9fb79b 100644 --- a/healthcare/api-client/v1/dicom/dicom_stores_test.py +++ b/healthcare/api-client/v1/dicom/dicom_stores_test.py @@ -13,17 +13,18 @@ # limitations under the License. import os -import pytest import sys import uuid import backoff from googleapiclient.errors import HttpError +import pytest # Add datasets for bootstrapping datasets for testing sys.path.append(os.path.join(os.path.dirname(__file__), "..", "datasets")) # noqa -import datasets -import dicom_stores +import datasets # noqa +import dicom_stores # noqa + cloud_region = "us-central1" project_id = os.environ["GOOGLE_CLOUD_PROJECT"] diff --git a/healthcare/api-client/v1/dicom/dicomweb_test.py b/healthcare/api-client/v1/dicom/dicomweb_test.py index 8fc8d91c4a59..6815c66851aa 100644 --- a/healthcare/api-client/v1/dicom/dicomweb_test.py +++ b/healthcare/api-client/v1/dicom/dicomweb_test.py @@ -13,18 +13,18 @@ # limitations under the License. import os -import pytest import sys import uuid import backoff from googleapiclient.errors import HttpError +import pytest # Add datasets for bootstrapping datasets for testing sys.path.append(os.path.join(os.path.dirname(__file__), "..", "datasets")) # noqa -import datasets -import dicom_stores -import dicomweb +import datasets # noqa +import dicom_stores # noqa +import dicomweb # noqa cloud_region = "us-central1" base_url = "https://healthcare.googleapis.com/v1" diff --git a/healthcare/api-client/v1/fhir/fhir_resources.py b/healthcare/api-client/v1/fhir/fhir_resources.py index 17072088c36a..849dec29d477 100644 --- a/healthcare/api-client/v1/fhir/fhir_resources.py +++ b/healthcare/api-client/v1/fhir/fhir_resources.py @@ -82,7 +82,7 @@ def create_encounter( ): """Creates a new Encounter resource in a FHIR store based on a Patient.""" url = "{}/projects/{}/locations/{}".format( - base_url, project_id, cloud_region, patient_id + base_url, project_id, cloud_region ) fhir_store_path = "{}/datasets/{}/fhirStores/{}/fhir/Encounter".format( @@ -139,7 +139,7 @@ def create_observation( an Encounter. """ url = "{}/projects/{}/locations/{}".format( - base_url, project_id, cloud_region, patient_id + base_url, project_id, cloud_region ) fhir_store_path = "{}/datasets/{}/fhirStores/{}/fhir/Observation".format( diff --git a/healthcare/api-client/v1/fhir/fhir_resources_test.py b/healthcare/api-client/v1/fhir/fhir_resources_test.py index 782bd412ebde..040c810c7bee 100644 --- a/healthcare/api-client/v1/fhir/fhir_resources_test.py +++ b/healthcare/api-client/v1/fhir/fhir_resources_test.py @@ -22,9 +22,9 @@ # Add datasets for bootstrapping datasets for testing sys.path.append(os.path.join(os.path.dirname(__file__), "..", "datasets")) # noqa -import datasets -import fhir_stores -import fhir_resources +import datasets # noqa +import fhir_stores # noqa +import fhir_resources # noqa base_url = "https://healthcare.googleapis.com/v1" cloud_region = "us-central1" diff --git a/healthcare/api-client/v1/fhir/fhir_stores_test.py b/healthcare/api-client/v1/fhir/fhir_stores_test.py index 898f6ba14935..bef2d13852f7 100644 --- a/healthcare/api-client/v1/fhir/fhir_stores_test.py +++ b/healthcare/api-client/v1/fhir/fhir_stores_test.py @@ -17,14 +17,15 @@ import uuid import backoff -import pytest -from googleapiclient.errors import HttpError from google.cloud import storage +from googleapiclient.errors import HttpError +import pytest # Add datasets for bootstrapping datasets for testing sys.path.append(os.path.join(os.path.dirname(__file__), "..", "datasets")) # noqa -import datasets -import fhir_stores +import datasets # noqa +import fhir_stores # noqa + cloud_region = "us-central1" project_id = os.environ["GOOGLE_CLOUD_PROJECT"] diff --git a/healthcare/api-client/v1/hl7v2/hl7v2_messages.py b/healthcare/api-client/v1/hl7v2/hl7v2_messages.py index ab5c8f54d746..61c1e30a55c6 100644 --- a/healthcare/api-client/v1/hl7v2/hl7v2_messages.py +++ b/healthcare/api-client/v1/hl7v2/hl7v2_messages.py @@ -208,7 +208,7 @@ def patch_hl7v2_message( """Updates the message.""" client = get_client() hl7v2_message_parent = "projects/{}/locations/{}".format( - project_id, cloud_region, dataset_id, hl7v2_store_id + project_id, cloud_region ) hl7v2_message_name = "{}/datasets/{}/hl7V2Stores/{}/messages/{}".format( hl7v2_message_parent, dataset_id, hl7v2_store_id, hl7v2_message_id diff --git a/healthcare/api-client/v1/hl7v2/hl7v2_messages_test.py b/healthcare/api-client/v1/hl7v2/hl7v2_messages_test.py index 7676585e2885..06ae20b41a35 100644 --- a/healthcare/api-client/v1/hl7v2/hl7v2_messages_test.py +++ b/healthcare/api-client/v1/hl7v2/hl7v2_messages_test.py @@ -13,18 +13,19 @@ # limitations under the License. import os -import pytest import sys import uuid import backoff from googleapiclient.errors import HttpError +import pytest # Add datasets for bootstrapping datasets for testing sys.path.append(os.path.join(os.path.dirname(__file__), "..", "datasets")) # noqa -import datasets -import hl7v2_stores -import hl7v2_messages +import datasets # noqa +import hl7v2_messages # noqa +import hl7v2_stores # noqa + cloud_region = "us-central1" project_id = os.environ["GOOGLE_CLOUD_PROJECT"] diff --git a/healthcare/api-client/v1/hl7v2/hl7v2_stores_test.py b/healthcare/api-client/v1/hl7v2/hl7v2_stores_test.py index 48f9afa5f0c0..c74ac536129f 100644 --- a/healthcare/api-client/v1/hl7v2/hl7v2_stores_test.py +++ b/healthcare/api-client/v1/hl7v2/hl7v2_stores_test.py @@ -13,17 +13,18 @@ # limitations under the License. import os -import pytest import sys import uuid import backoff from googleapiclient.errors import HttpError +import pytest # Add datasets for bootstrapping datasets for testing sys.path.append(os.path.join(os.path.dirname(__file__), "..", "datasets")) # noqa -import datasets -import hl7v2_stores +import datasets # noqa +import hl7v2_stores # noqa + cloud_region = "us-central1" project_id = os.environ["GOOGLE_CLOUD_PROJECT"]