q-optimize/c3

View on GitHub

Showing 160 of 330 total issues

Function sweep has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def sweep(x_init, fun=None, fun_grad=None, grad_lookup=None, options={}):
Severity: Minor
Found in c3/libraries/algorithms.py - About 35 mins to fix

    Function adaptive_scan has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def adaptive_scan(x_init, fun=None, fun_grad=None, grad_lookup=None, options={}):
    Severity: Minor
    Found in c3/libraries/algorithms.py - About 35 mins to fix

      Function pwc has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def pwc(
      Severity: Minor
      Found in c3/libraries/propagation.py - About 35 mins to fix

        Function gcmaes has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def gcmaes(x_init, fun=None, fun_grad=None, grad_lookup=None, options={}):
        Severity: Minor
        Found in c3/libraries/algorithms.py - About 35 mins to fix

          Function lindbladian_RB_left has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def lindbladian_RB_left(
          Severity: Minor
          Found in c3/libraries/fidelities.py - About 35 mins to fix

            Function _log_one_dataset has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def _log_one_dataset(
            Severity: Minor
            Found in c3/optimizers/modellearning.py - About 35 mins to fix

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

                  def __init__(
              Severity: Minor
              Found in c3/optimizers/optimizer.py - About 35 mins to fix

                Function set_opt_map has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def set_opt_map(self, opt_map) -> None:
                        """
                        Set the opt_map, i.e. which parameters will be optimized.
                        """
                        opt_map = self.get_opt_map(opt_map)
                Severity: Minor
                Found in c3/parametermap.py - About 35 mins 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 orbit_infid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                def orbit_infid(
                    propagators,
                    RB_number: int = 30,
                    RB_length: int = 20,
                    lindbladian=False,
                Severity: Minor
                Found in c3/libraries/fidelities.py - About 35 mins 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __init__(self, name, desc="", comment="", params=None):
                        self.name = name
                        self.desc = desc
                        self.comment = comment
                        self.params = {}
                Severity: Minor
                Found in c3/c3objs.py - About 35 mins 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 set_components has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def set_components(self, subsystems, couplings=None, max_excitations=0) -> None:
                        for comp in subsystems:
                            self.subsystems[comp.name] = comp
                        for comp in couplings:
                            self.couplings[comp.name] = comp
                Severity: Minor
                Found in c3/model.py - About 35 mins 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 set_prop_method has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def set_prop_method(self, prop_method=None) -> None:
                        """
                        Configure the selected propagation method by either linking the function handle or
                        looking it up in the library.
                        """
                Severity: Minor
                Found in c3/experiment.py - About 35 mins 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_opt_map has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get_opt_map(self, opt_map=None) -> List[List[str]]:
                        if opt_map is None:
                            opt_map = self.opt_map
                
                        for i, equiv_ids in enumerate(opt_map):
                Severity: Minor
                Found in c3/parametermap.py - About 35 mins 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 flattop_variant has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                def flattop_variant(t, params):
                    """
                    Flattop variant.
                    """
                    t_up = params["t_up"]
                Severity: Minor
                Found in c3/libraries/envelopes.py - About 35 mins 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_timings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get_timings(self, chan, name, minimal_time=False):
                        key = chan + "-" + name
                        if key in self._timings:
                            return self._timings[key]
                        opts = self._options[chan][name]
                Severity: Minor
                Found in c3/signal/gates.py - About 35 mins 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 __create_matrix_representations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __create_matrix_representations(self) -> None:
                        """
                        Using the annihilation operators as basis, compute the matrix represenations.
                        """
                        indx = 0
                Severity: Minor
                Found in c3/model.py - About 35 mins 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __init__(
                        self,
                        name: str,
                        desc: str = None,
                        comment: str = None,
                Severity: Minor
                Found in c3/libraries/chip.py - About 35 mins 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 add_component has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def add_component(self, comp: C3obj, chan: str, options=None, name=None) -> None:
                        """
                        Add one component, e.g. an envelope, local oscillator, to a channel.
                
                        Parameters
                Severity: Minor
                Found in c3/signal/gates.py - About 35 mins 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 set_fid_func has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def set_fid_func(self, fid_func) -> None:
                        if type(fid_func) is str:
                            if self.pmap.model.lindbladian:
                                fid = "lindbladian_" + fid_func
                            else:
                Severity: Minor
                Found in c3/optimizers/optimalcontrol.py - About 35 mins 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 evaluate_sequences has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                def evaluate_sequences(propagators: Dict, sequences: list):
                    """
                    Compute the total propagator of a sequence of gates.
                
                    Parameters
                Severity: Minor
                Found in c3/libraries/propagation.py - About 35 mins 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

                Severity
                Category
                Status
                Source
                Language