# HG changeset patch # User Marcin Kuzminski # Date 2018-11-21 17:05:27 # Node ID 462664f19133948dcfee686e7938fad72f569e67 # Parent 3c9caf8ef3a6c4d71c194e6059bd33240b72021d code: code cleanups, use is None instead of == None. diff --git a/rhodecode/apps/admin/views/settings.py b/rhodecode/apps/admin/views/settings.py --- a/rhodecode/apps/admin/views/settings.py +++ b/rhodecode/apps/admin/views/settings.py @@ -175,8 +175,7 @@ class AdminSettingsView(BaseAppView): try: if c.visual.allow_repo_location_change: - model.update_global_path_setting( - form_result['paths_root_path']) + model.update_global_path_setting(form_result['paths_root_path']) model.update_global_ssl_setting(form_result['web_push_ssl']) model.update_global_hook_settings(form_result) diff --git a/rhodecode/lib/diff_match_patch.py b/rhodecode/lib/diff_match_patch.py --- a/rhodecode/lib/diff_match_patch.py +++ b/rhodecode/lib/diff_match_patch.py @@ -95,7 +95,7 @@ class diff_match_patch: Array of changes. """ # Set a deadline by which time the diff must be complete. - if deadline == None: + if deadline is None: # Unlike in most languages, Python counts time in seconds. if self.Diff_Timeout <= 0: deadline = sys.maxint @@ -103,7 +103,7 @@ class diff_match_patch: deadline = time.time() + self.Diff_Timeout # Check for null inputs. - if text1 == None or text2 == None: + if text1 is None or text2 is None: raise ValueError("Null inputs. (diff_main)") # Check for equality (speedup). @@ -1227,7 +1227,7 @@ class diff_match_patch: Best match index or -1. """ # Check for null inputs. - if text == None or pattern == None: + if text is None or pattern is None: raise ValueError("Null inputs. (match_main)") loc = max(0, min(loc, len(text))) diff --git a/rhodecode/model/pull_request.py b/rhodecode/model/pull_request.py --- a/rhodecode/model/pull_request.py +++ b/rhodecode/model/pull_request.py @@ -1576,10 +1576,8 @@ class PullRequestModel(BaseModel): from rc_reviewers.utils import get_default_reviewers_data from rc_reviewers.utils import validate_default_reviewers except ImportError: - from rhodecode.apps.repository.utils import \ - get_default_reviewers_data - from rhodecode.apps.repository.utils import \ - validate_default_reviewers + from rhodecode.apps.repository.utils import get_default_reviewers_data + from rhodecode.apps.repository.utils import validate_default_reviewers return get_default_reviewers_data, validate_default_reviewers diff --git a/rhodecode/model/settings.py b/rhodecode/model/settings.py --- a/rhodecode/model/settings.py +++ b/rhodecode/model/settings.py @@ -582,7 +582,6 @@ class VcsSettingsModel(object): self._create_or_update_ui( self.repo_settings, *phases, value=safe_str(data[phases_key])) - def create_or_update_global_hg_settings(self, data): largefiles, largefiles_store, phases, hgsubversion, evolve \ = self.GLOBAL_HG_SETTINGS diff --git a/rhodecode/tests/vcs/test_repository.py b/rhodecode/tests/vcs/test_repository.py --- a/rhodecode/tests/vcs/test_repository.py +++ b/rhodecode/tests/vcs/test_repository.py @@ -259,13 +259,13 @@ class TestRepositoryGetCommonAncestor: commit_id1=original[0].raw_id, commit_id2=unrelated[0].raw_id, repo2=unrelated - ) == None + ) is None assert original.get_common_ancestor( commit_id1=original[-1].raw_id, commit_id2=unrelated[-1].raw_id, repo2=unrelated - ) == None + ) is None @pytest.mark.backends("git", "hg")