From: Paul Brossier Date: Mon, 16 May 2016 01:24:09 +0000 (+0200) Subject: python/: fix comparisons to None X-Git-Tag: 0.4.4~300^2~19 X-Git-Url: https://git.aubio.org/?p=aubio.git;a=commitdiff_plain;h=dc654f8f8ca6675edf071f77ce1f934c6ad97e6b python/: fix comparisons to None --- diff --git a/python/demos/demo_bpm_extract.py b/python/demos/demo_bpm_extract.py index 7935f428..ba7fbad7 100755 --- a/python/demos/demo_bpm_extract.py +++ b/python/demos/demo_bpm_extract.py @@ -8,7 +8,7 @@ def get_file_bpm(path, params = None): path: path to the file param: dictionary of parameters """ - if params == None: + if params is None: params = {} try: win_s = params['win_s'] diff --git a/python/lib/aubio/slicing.py b/python/lib/aubio/slicing.py index b274ef2d..fa9d2e34 100644 --- a/python/lib/aubio/slicing.py +++ b/python/lib/aubio/slicing.py @@ -14,10 +14,10 @@ def slice_source_at_stamps(source_file, timestamps, timestamps_end=None, if timestamps[0] != 0: timestamps = [0] + timestamps - if timestamps_end != None: + if timestamps_end is not None: timestamps_end = [timestamps[1] - 1] + timestamps_end - if timestamps_end != None: + if timestamps_end is not None: if len(timestamps_end) != len(timestamps): raise ValueError("len(timestamps_end) != len(timestamps)") else: @@ -27,7 +27,7 @@ def slice_source_at_stamps(source_file, timestamps, timestamps_end=None, #print regions source_base_name, _ = os.path.splitext(os.path.basename(source_file)) - if output_dir != None: + if output_dir is not None: if not os.path.isdir(output_dir): os.makedirs(output_dir) source_base_name = os.path.join(output_dir, source_base_name)