Pylint fixing base_could_client,acloud_main,avd and common_operations.
- fix pylint errors
- Add some pylint disable comments to avoid pylint error temporarily
Bug: None
Test: run pylint
Change-Id: Ibf2ca67631d540cb6dc8d2fa463225cb52860a1e
diff --git a/public/acloud_main.py b/public/acloud_main.py
index cdf37eb..823bafb 100644
--- a/public/acloud_main.py
+++ b/public/acloud_main.py
@@ -13,7 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-
r"""Cloud Android Driver.
This CLI manages google compute engine project for android devices.
@@ -65,7 +64,6 @@
import argparse
import getpass
import logging
-import os
import sys
# TODO: Find a better way to handling this import logic.
@@ -90,6 +88,7 @@
CMD_SSHKEY = "project_sshkey"
+# pylint: disable=too-many-statements
def _ParseArgs(args):
"""Parse args.
@@ -99,8 +98,9 @@
Returns:
Parsed args.
"""
- usage = ",".join([CMD_CREATE, CMD_CREATE_CUTTLEFISH, CMD_DELETE,
- CMD_CLEANUP, CMD_SSHKEY])
+ usage = ",".join([
+ CMD_CREATE, CMD_CREATE_CUTTLEFISH, CMD_DELETE, CMD_CLEANUP, CMD_SSHKEY
+ ])
parser = argparse.ArgumentParser(
description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter,
@@ -124,10 +124,11 @@
dest="branch",
help="Android branch, e.g. mnc-dev or git_mnc-dev")
# TODO: Support HEAD (the latest build)
- create_parser.add_argument("--build_id",
- type=str,
- dest="build_id",
- help="Android build id, e.g. 2145099, P2804227")
+ create_parser.add_argument(
+ "--build_id",
+ type=str,
+ dest="build_id",
+ help="Android build id, e.g. 2145099, P2804227")
create_parser.add_argument(
"--spec",
type=str,
@@ -135,24 +136,26 @@
required=False,
help="The name of a pre-configured device spec that we are "
"going to use. Choose from: %s" % ", ".join(constants.SPEC_NAMES))
- create_parser.add_argument("--num",
- type=int,
- dest="num",
- required=False,
- default=1,
- help="Number of instances to create.")
+ create_parser.add_argument(
+ "--num",
+ type=int,
+ dest="num",
+ required=False,
+ default=1,
+ help="Number of instances to create.")
create_parser.add_argument(
"--gce_image",
type=str,
dest="gce_image",
required=False,
help="Name of an existing compute engine image to reuse.")
- create_parser.add_argument("--local_disk_image",
- type=str,
- dest="local_disk_image",
- required=False,
- help="Path to a local disk image to use, "
- "e.g /tmp/avd-system.tar.gz")
+ create_parser.add_argument(
+ "--local_disk_image",
+ type=str,
+ dest="local_disk_image",
+ required=False,
+ help="Path to a local disk image to use, "
+ "e.g /tmp/avd-system.tar.gz")
create_parser.add_argument(
"--no_cleanup",
dest="no_cleanup",
@@ -179,7 +182,8 @@
action="store_true",
dest="autoconnect",
required=False,
- help="For each instance created, we will automatically creates both 2 ssh"
+ help=
+ "For each instance created, we will automatically creates both 2 ssh"
" tunnels forwarding both adb & vnc. Then add the device to adb.")
subparser_list.append(create_parser)
@@ -238,7 +242,8 @@
action="store_true",
dest="autoconnect",
required=False,
- help="For each instance created, we will automatically creates both 2 ssh"
+ help=
+ "For each instance created, we will automatically creates both 2 ssh"
" tunnels forwarding both adb & vnc. Then add the device to adb.")
subparser_list.append(create_cf_parser)
@@ -307,7 +312,8 @@
action="store_true",
dest="autoconnect",
required=False,
- help="For each instance created, we will automatically creates both 2 ssh"
+ help=
+ "For each instance created, we will automatically creates both 2 ssh"
" tunnels forwarding both adb & vnc. Then add the device to adb.")
subparser_list.append(create_gf_parser)
@@ -355,12 +361,12 @@
dest="ssh_rsa_path",
required=True,
help="Absolute path to the file that contains the public rsa key "
- "that will be added as project-wide ssh key.")
+ "that will be added as project-wide ssh key.")
subparser_list.append(sshkey_parser)
# Add common arguments.
- for p in subparser_list:
- acloud_common.AddCommonArguments(p)
+ for parser in subparser_list:
+ acloud_common.AddCommonArguments(parser)
return parser.parse_args(args)
@@ -402,8 +408,8 @@
raise errors.CommandArgError(
"%s is not valid. Choose from: %s" %
(parsed_args.spec, ", ".join(constants.SPEC_NAMES)))
- if not ((parsed_args.build_id and parsed_args.build_target) or
- parsed_args.gce_image or parsed_args.local_disk_image):
+ if not ((parsed_args.build_id and parsed_args.build_target)
+ or parsed_args.gce_image or parsed_args.local_disk_image):
raise errors.CommandArgError(
"At least one of the following should be specified: "
"--build_id and --build_target, or --gce_image, or "
@@ -414,21 +420,22 @@
if parsed_args.which in [CMD_CREATE_CUTTLEFISH, CMD_CREATE_GOLDFISH]:
if not parsed_args.build_id or not parsed_args.build_target:
- raise errors.CommandArgError("Must specify --build_id and --build_target")
+ raise errors.CommandArgError(
+ "Must specify --build_id and --build_target")
if parsed_args.which == CMD_CREATE_GOLDFISH:
if not parsed_args.emulator_build_id:
- raise errors.CommandArgError("Must specify --emulator_build_id")
+ raise errors.CommandArgError("Must specify --emulator_build_id")
if parsed_args.which in [
- CMD_CREATE, CMD_CREATE_CUTTLEFISH, CMD_CREATE_GOLDFISH
+ CMD_CREATE, CMD_CREATE_CUTTLEFISH, CMD_CREATE_GOLDFISH
]:
- if (parsed_args.serial_log_file and
- not parsed_args.serial_log_file.endswith(".tar.gz")):
+ if (parsed_args.serial_log_file
+ and not parsed_args.serial_log_file.endswith(".tar.gz")):
raise errors.CommandArgError(
"--serial_log_file must ends with .tar.gz")
- if (parsed_args.logcat_file and
- not parsed_args.logcat_file.endswith(".tar.gz")):
+ if (parsed_args.logcat_file
+ and not parsed_args.logcat_file.endswith(".tar.gz")):
raise errors.CommandArgError(
"--logcat_file must ends with .tar.gz")
@@ -514,8 +521,8 @@
logcat_file=args.logcat_file,
autoconnect=args.autoconnect)
elif args.which == CMD_DELETE:
- report = device_driver.DeleteAndroidVirtualDevices(cfg,
- args.instance_names)
+ report = device_driver.DeleteAndroidVirtualDevices(
+ cfg, args.instance_names)
elif args.which == CMD_CLEANUP:
report = device_driver.Cleanup(cfg, args.expiration_mins)
elif args.which == CMD_SSHKEY: