KarrLab/datanator_query_python

View on GitHub

Showing 101 of 190 total issues

File query_protein.py has 898 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from datanator_query_python.util import mongo_util, file_util
from datanator_query_python.query import query_taxon_tree, query_kegg_orthology
from pymongo.collation import Collation, CollationStrength
from pymongo import ASCENDING
from collections import deque
Severity: Major
Found in datanator_query_python/query/query_protein.py - About 2 days to fix

    Function inchi_to_inchikey has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

        def inchi_to_inchikey(self, szINCHISource):
            '''
                fork from git@github.com:mnowotka/chembl_ikey.git
            '''
            flagstd = 'S'
    Severity: Minor
    Found in datanator_query_python/util/chem_util.py - About 6 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    File query_taxon_tree.py has 398 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from datanator_query_python.util import mongo_util, chem_util, file_util
    from datanator_query_python.aggregate import pipelines
    import os
    import json
    from pymongo.collation import Collation, CollationStrength
    Severity: Minor
    Found in datanator_query_python/query/query_taxon_tree.py - About 5 hrs to fix

      File query_sabiork_old.py has 379 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      from datanator_query_python.util import mongo_util, chem_util, file_util
      from datanator_query_python.aggregate import lookups
      from pymongo.collation import Collation, CollationStrength
      from . import query_taxon_tree, query_sabio_compound
      import json
      Severity: Minor
      Found in datanator_query_python/query/query_sabiork_old.py - About 5 hrs to fix

        File full_text_search.py has 376 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        from karr_lab_aws_manager.elasticsearch_kl import query_builder as es_query_builder
        import numpy as np
        import math
        import json
        import requests
        Severity: Minor
        Found in datanator_query_python/query/full_text_search.py - About 5 hrs to fix

          QueryProtein has 30 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class QueryProtein(mongo_util.MongoUtil):
          
              def __init__(self, username=None, password=None, server=None, authSource='admin',
                           database='datanator', max_entries=float('inf'), verbose=True, collection_str='uniprot',
                           readPreference='nearest', replicaSet=None):
          Severity: Minor
          Found in datanator_query_python/query/query_protein.py - About 3 hrs to fix

            Function get_kinlawid_by_name has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_kinlawid_by_name(self, substrates, products):
                    ''' Get kinlaw_id from substrates and products, all in one reaction
            
                        Args:
                            substrates: (:obj:`list` of :obj:`str`): list of substrate names
            Severity: Minor
            Found in datanator_query_python/query/query_sabiork.py - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function parse_router has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                def parse_router(self, lines=0):
                    """Parse router lines to get API performance values.
            
                    Args:
                        lines(:obj:`int`, optional): Number of lines to parse. If 0, parse all lines.
            Severity: Minor
            Found in datanator_query_python/util/parse_heroku_logs.py - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function get_kinlawid_by_rxn has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_kinlawid_by_rxn(self, substrates, products):
                    ''' Find the kinlaw_id defined in sabio_rk using 
                        rxn participants' inchi string
            
                        Args:
            Severity: Minor
            Found in datanator_query_python/query/query_sabiork.py - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function get_equivalent_protein_with_anchor has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_equivalent_protein_with_anchor(self, _id, max_distance, max_depth=float('inf')):
                    '''
                        Get replacement abundance value by taxonomic distance
                        with the same kegg_orthology number.
            
            
            Severity: Minor
            Found in datanator_query_python/query/query_protein.py - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function get_equivalent_kegg_with_anchor_obsolete has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_equivalent_kegg_with_anchor_obsolete(self, ko, anchor, max_distance, max_depth=float('inf')):
                    '''
                        Get replacement abundance value by taxonomic distance
                        with the same kegg_orthology number.
            
            
            Severity: Minor
            Found in datanator_query_python/query/query_protein.py - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function get_kinlaw_by_rxn_ortho has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_kinlaw_by_rxn_ortho(self, substrates, products, dof=0,
                                      projection={'kinlaw_id': 1, '_id': 0, "enzymes": 1},
                                      bound='loose', skip=0, limit=0):
                    ''' Find the kinlaw_id defined in sabio_rk using 
                        rxn participants' inchikey
            Severity: Minor
            Found in datanator_query_python/query/query_sabiork_old.py - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function extract_values has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def extract_values(self, obj, key):
                    """Pull all values of specified key from nested JSON.
                    """
                    arr = []
            
            
            Severity: Minor
            Found in datanator_query_python/util/file_util.py - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function get_equivalent_protein has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_equivalent_protein(self, _id, max_distance, max_depth=float('inf')):
                    '''
                        Get replacement abundance value by taxonomic distance
                        with the same kegg_orthology number.
            
            
            Severity: Minor
            Found in datanator_query_python/query/query_protein.py - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, cache_dirname=None, MongoDB=None, replicaSet=None, db=None,
            Severity: Major
            Found in datanator_query_python/query/query_metabolites_meta.py - About 1 hr to fix

              Function __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self, cache_dirname=None, MongoDB=None, replicaSet=None, db='datanator',
              Severity: Major
              Found in datanator_query_python/query/query_pax.py - About 1 hr to fix

                Function __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(self, cache_dirname=None, MongoDB=None, replicaSet=None, db='datanator',
                Severity: Major
                Found in datanator_query_python/query/query_sabiork_old.py - About 1 hr to fix

                  Function __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def __init__(self, cache_dirname=None, collection_str='taxon_tree', 
                  Severity: Major
                  Found in datanator_query_python/query/query_taxon_tree.py - About 1 hr to fix

                    Function __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def __init__(self, cache_dirname=None, MongoDB=None, replicaSet=None, db='datanator',
                    Severity: Major
                    Found in datanator_query_python/query/query_sabio_reaction_entries.py - About 1 hr to fix

                      Function inchi_to_inchikey has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def inchi_to_inchikey(self, szINCHISource):
                              '''
                                  fork from git@github.com:mnowotka/chembl_ikey.git
                              '''
                              flagstd = 'S'
                      Severity: Minor
                      Found in datanator_query_python/util/chem_util.py - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language