Skip to content

Convert six assignment statements to augmented source code #27

Description

@elfring

👀 Some source code analysis tools can help to find opportunities for improving software components.
💭 I propose to increase the usage of augmented assignment statements accordingly.

diff --git a/fdog/libs/addtaxon.py b/fdog/libs/addtaxon.py
index 8e38620..b25b3b3 100644
--- a/fdog/libs/addtaxon.py
+++ b/fdog/libs/addtaxon.py
@@ -91,7 +91,7 @@ def create_genome(args):
             ### check if id longer than 20 character
             if len(id) > 20:
                 long_id = 1
-                mod_id_index = mod_id_index + 1
+                mod_id_index += 1
                 id = '%s_%s' % (spec_name.split('@')[1], mod_id_index)
                 if not ori_id in id_dict:
                     id_dict[ori_id] = id
@@ -157,7 +157,7 @@ def create_annoFile(outPath, genome_file, cpus, force):
     """ Create annotation json for a given genome_file """
     annoCmd = 'fas.doAnno -i %s -o %s --cpus %s' % (genome_file, outPath+'/annotation_dir', cpus)
     if force:
-        annoCmd = annoCmd + " --force"
+        annoCmd += " --force"
     try:
         subprocess.call([annoCmd], shell = True)
     except:
diff --git a/fdog/libs/alignment.py b/fdog/libs/alignment.py
index 507eaa5..7c1699c 100644
--- a/fdog/libs/alignment.py
+++ b/fdog/libs/alignment.py
@@ -123,5 +123,5 @@ def calc_aln_score(fa1, fa2, aln_strategy = 'local', debugCore = False):
             if gene_id in aln_score:
                 if re.search('\(\s+\d+\)', l):
                     l = re.sub(r'\(\s+','(', l)
-                aln_score[gene_id] = aln_score[gene_id] + int(l.split()[2])
+                aln_score[gene_id] += int(l.split()[2])
     return(aln_score)
diff --git a/fdog/libs/blast.py b/fdog/libs/blast.py
index ff41608..3c8dc5d 100644
--- a/fdog/libs/blast.py
+++ b/fdog/libs/blast.py
@@ -75,7 +75,7 @@ def make_blastdb(args):
     (specName, specFile, outPath, silent) = args
     blastCmd = 'makeblastdb -dbtype prot -in %s -out %s/coreTaxa_dir/%s/%s' % (specFile, outPath, specName, specName)
     if silent == True:
-        blastCmd = blastCmd + '> /dev/null 2>&1'
+        blastCmd += '> /dev/null 2>&1'
     try:
         subprocess.call([blastCmd], shell = True)
     except:
diff --git a/fdog/libs/zzz.py b/fdog/libs/zzz.py
index 219ac76..8bd4f22 100644
--- a/fdog/libs/zzz.py
+++ b/fdog/libs/zzz.py
@@ -87,10 +87,10 @@ def count_line(file, pattern, contain):
         for line in f:
             if contain:
                 if pattern in line:
-                    nline = nline + 1
+                    nline += 1
             else:
                 if not pattern in line:
-                    nline = nline + 1
+                    nline += 1
     return(nline)
 
 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions