diff options
author | Lu Fang <lufang@fb.com> | 2019-01-30 09:30:22 -0800 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2019-01-30 09:36:00 -0800 |
commit | b1b00f329efb6fa023b8e2d561d03ff5d312063c (patch) | |
tree | 1ddf8b0f9b9b0d3ee952589cc6b725a55b85a4c5 /torch/utils | |
parent | 3b91df3744d960db3592c807c4f54a4509ce61c7 (diff) | |
download | pytorch-b1b00f329efb6fa023b8e2d561d03ff5d312063c.tar.gz pytorch-b1b00f329efb6fa023b8e2d561d03ff5d312063c.tar.bz2 pytorch-b1b00f329efb6fa023b8e2d561d03ff5d312063c.zip |
Fix the flake8 linter
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16549
Reviewed By: bddppq
Differential Revision: D13877435
Pulled By: houseroad
fbshipit-source-id: dbe575ba3f6dd30d27ac6aa5eec2eea025063540
Diffstat (limited to 'torch/utils')
-rw-r--r-- | torch/utils/bottleneck/__main__.py | 2 | ||||
-rw-r--r-- | torch/utils/collect_env.py | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/torch/utils/bottleneck/__main__.py b/torch/utils/bottleneck/__main__.py index b4661de751..ae5de6b9da 100644 --- a/torch/utils/bottleneck/__main__.py +++ b/torch/utils/bottleneck/__main__.py @@ -130,7 +130,7 @@ def print_autograd_prof_summary(prof, mode, sortby='cpu_time', topk=15): print(warn.format(autograd_prof_sortby)) sortby = 'cpu_time' - if mode is 'CUDA': + if mode == 'CUDA': cuda_warning = ('\n\tBecause the autograd profiler uses the CUDA event API,\n' '\tthe CUDA time column reports approximately max(cuda_time, cpu_time).\n' '\tPlease ignore this output if your code does not use CUDA.\n') diff --git a/torch/utils/collect_env.py b/torch/utils/collect_env.py index b406629818..eed856d848 100644 --- a/torch/utils/collect_env.py +++ b/torch/utils/collect_env.py @@ -52,7 +52,7 @@ def run(command): def run_and_read_all(run_lambda, command): """Runs command using run_lambda; reads and returns entire output if rc is 0""" rc, out, _ = run_lambda(command) - if rc is not 0: + if rc != 0: return None return out @@ -60,7 +60,7 @@ def run_and_read_all(run_lambda, command): def run_and_parse_first_match(run_lambda, command, regex): """Runs command using run_lambda, returns the first regex match if it exists""" rc, out, _ = run_lambda(command) - if rc is not 0: + if rc != 0: return None match = re.search(regex, out) if match is None: @@ -98,7 +98,7 @@ def get_gpu_info(run_lambda): smi = get_nvidia_smi() uuid_regex = re.compile(r' \(UUID: .+?\)') rc, out, _ = run_lambda(smi + ' -L') - if rc is not 0: + if rc != 0: return None # Anonymize GPUs by removing their UUID return re.sub(uuid_regex, '', out) @@ -165,7 +165,7 @@ def check_release_file(run_lambda): def get_os(run_lambda): platform = get_platform() - if platform is 'win32' or platform is 'cygwin': + if platform == 'win32' or platform == 'cygwin': return get_windows_version(run_lambda) if platform == 'darwin': @@ -208,7 +208,7 @@ def get_pip_packages(run_lambda): out3 = run_with_pip('pip3') num_pips = len([x for x in [out2, out3] if x is not None]) - if num_pips is 0: + if num_pips == 0: return 'pip', out2 if num_pips == 1: |