Changeset - 0b1a23b88f9a
[Not reviewed]
default
0 4 0
Thomas De Schampheleire - 5 years ago 2020-11-07 20:59:03
thomas.de_schampheleire@nokia.com
cleanup: get rid of redundant assignments 'foo = foo'

Redundant assignments were searched with:

grep '^ *\(.*\) = \1$' `hg files`

Some of these cases have resulted from earlier cleanup, like:

foo = safe_unicode(foo)

and later batch removing safe_unicode usage. See e.g. commit
e35373106528b29461b7f5144780cb9ec79f765d .


Note: two false positives occur:

kallithea/tests/models/test_settings.py:39:
setting.app_settings_value = setting.app_settings_value
kallithea/tests/models/test_settings.py:42:
setting.app_settings_value = setting.app_settings_value

which is not a plain assignment but where 'app_settings_value' is a property
method with side effects.
4 files changed with 0 insertions and 7 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/api/api.py
Show inline comments
 
@@ -1140,13 +1140,12 @@ class ApiController(JSONRPCController):
 
        repo = get_repo_or_error(repoid)
 

	
 
        if not HasPermissionAny('hg.admin')():
 
            if not HasRepoPermissionLevel('read')(repo.repo_name):
 
                raise JSONRPCError('repository `%s` does not exist' % (repoid,))
 

	
 
        ret_type = ret_type
 
        _map = {}
 
        try:
 
            _d, _f = ScmModel().get_nodes(repo, revision, root_path,
 
                                          flat=False)
 
            _map = {
 
                'all': _d + _f,
kallithea/model/repo.py
Show inline comments
 
@@ -318,14 +318,12 @@ class RepoModel(object):
 

	
 
        """
 
        owner = db.User.guess_instance(owner)
 
        fork_of = db.Repository.guess_instance(fork_of)
 
        repo_group = db.RepoGroup.guess_instance(repo_group)
 
        try:
 
            repo_name = repo_name
 
            description = description
 
            # repo name is just a name of repository
 
            # while repo_name_full is a full qualified name that is combined
 
            # with name and path of group
 
            repo_name_full = repo_name
 
            repo_name = repo_name.split(kallithea.URL_SEP)[-1]
 
            if kallithea.lib.utils2.repo_name_slug(repo_name) != repo_name:
kallithea/model/scm.py
Show inline comments
 
@@ -448,13 +448,12 @@ class ScmModel(object):
 
            content = nodes[f_path]['content']
 
            f_path = self._sanitize_path(f_path)
 
            if not isinstance(content, str) and not isinstance(content, bytes):
 
                content = content.read()
 
            processed_nodes.append((f_path, content))
 

	
 
        message = message
 
        committer = user.full_contact
 
        if not author:
 
            author = committer
 

	
 
        if not parent_cs:
 
            parent_cs = EmptyChangeset(alias=scm_instance.alias)
 
@@ -490,13 +489,12 @@ class ScmModel(object):
 
        """
 
        Commits specified nodes to repo. Again.
 
        """
 
        user = db.User.guess_instance(user)
 
        scm_instance = repo.scm_instance_no_cache()
 

	
 
        message = message
 
        committer = user.full_contact
 
        if not author:
 
            author = committer
 

	
 
        if not parent_cs:
 
            parent_cs = EmptyChangeset(alias=scm_instance.alias)
 
@@ -569,13 +567,12 @@ class ScmModel(object):
 
            f_path = self._sanitize_path(f_path)
 
            # content can be empty but for compatibility it allows same dicts
 
            # structure as add_nodes
 
            content = nodes[f_path].get('content')
 
            processed_nodes.append((f_path, content))
 

	
 
        message = message
 
        committer = user.full_contact
 
        if not author:
 
            author = committer
 

	
 
        if not parent_cs:
 
            parent_cs = EmptyChangeset(alias=scm_instance.alias)
kallithea/tests/scripts/manual_test_crawler.py
Show inline comments
 
@@ -80,13 +80,12 @@ o.addheaders = [
 
urllib.request.install_opener(o)
 

	
 

	
 
def _get_repo(proj):
 
    if isinstance(proj, str):
 
        repo = vcs.get_repo(os.path.join(PROJECT_PATH, proj))
 
        proj = proj
 
    else:
 
        repo = proj
 
        proj = repo.name
 

	
 
    return repo, proj
 

	
0 comments (0 inline, 0 general)