q-optimize/c3

View on GitHub

Showing 160 of 330 total issues

Function gcmaes has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

def gcmaes(x_init, fun=None, fun_grad=None, grad_lookup=None, options={}):
    """
    EXPERIMENTAL CMA-Es where every point in the cloud is optimized with LBFG-S and the
    resulting cloud and results are used for the CMA update.
    """
Severity: Minor
Found in c3/libraries/algorithms.py - About 3 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 process has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def process(self, populations, labels=None):
        """
        Apply a readout procedure to a population vector. Very specialized
        at the moment.

Severity: Minor
Found in c3/experiment.py - About 3 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 __check_signal_chains has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def __check_signal_chains(self) -> None:
        for channel, chain in self.chains.items():
            signals = 0
            for device_id, sources in chain.items():
                # all source devices need to exist and have the same resolution
Severity: Minor
Found in c3/generator/generator.py - About 3 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 RB has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def RB(
    propagators,
    min_length: int = 5,
    max_length: int = 500,
    num_lengths: int = 20,
Severity: Minor
Found in c3/libraries/fidelities.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 sweep has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def sweep(x_init, fun=None, fun_grad=None, grad_lookup=None, options={}):
    """
    One dimensional scan of the function values around the initial point.

    Parameters
Severity: Minor
Found in c3/libraries/algorithms.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 run_cfg has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def run_cfg(cfg, opt_config_filename, debug=False):
    """Execute an optimization problem described in the cfg file.

    Parameters
    ----------
Severity: Minor
Found in c3/main.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_Hamiltonian has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def get_Hamiltonian(self, signal=None):
        """Get a hamiltonian with an optional signal. This will return an hamiltonian over time.
        Can be used e.g. for tuning the frequency of a transmon, where the control hamiltonian is not easily accessible.
        If max.excitation is non-zero the resulting Hamiltonian is cut accordingly"""
        if signal is None:
Severity: Minor
Found in c3/model.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 tf_batch_propagate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def tf_batch_propagate(
    hamiltonian, hks, signals, dt, batch_size, col_ops=None, lindbladian=False
):
    """
    Propagate signal in batches
Severity: Minor
Found in c3/libraries/propagation.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 __init__ has 18 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in c3/libraries/chip.py - About 2 hrs to fix

    File optimalcontrol.py has 260 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """Object that deals with the open loop optimal control."""
    
    import os
    import shutil
    
    
    Severity: Minor
    Found in c3/optimizers/optimalcontrol.py - About 2 hrs to fix

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

          def __init__(
      Severity: Major
      Found in c3/libraries/chip.py - About 2 hrs to fix

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

            def __init__(
        Severity: Major
        Found in c3/optimizers/optimalcontrol.py - About 2 hrs to fix

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

              def fromdict(self, cfg: dict) -> None:
                  for key, gate in cfg.items():
                      if "mapto" in gate.keys():
                          instr = copy.deepcopy(self.instructions[gate["mapto"]])
                          instr.name = key
          Severity: Minor
          Found in c3/parametermap.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 two_qubit_gate_tomography has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          def two_qubit_gate_tomography(gate):
              """
              Sequences to generate tomography for evaluating a two qubit gate.
              """
              # THE 4 GATES
          Severity: Minor
          Found in c3/utils/qt_utils.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 set_parameters has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def set_parameters(
                  self, values: Union[List, np.ndarray], opt_map=None, extend_bounds=False
              ) -> None:
                  """Set the values in the original instruction class.
          
          
          Severity: Minor
          Found in c3/parametermap.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 pwc has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          def pwc(
              model: Model,
              gen: Generator,
              instr: Instruction,
              folding_stack: list,
          Severity: Minor
          Found in c3/libraries/propagation.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 a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(
                  self,
                  sampling,
                  batch_sizes,
                  pmap,
          Severity: Minor
          Found in c3/optimizers/modellearning.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 15 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Major
          Found in c3/libraries/chip.py - About 1 hr to fix

            Function create_experiment has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def create_experiment():
                lindblad = False
                dressed = True
                qubit_lvls = 3
                freq = 5e9
            Severity: Minor
            Found in examples/single_qubit_blackbox_exp.py - About 1 hr to fix

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

                  def __init__(
              Severity: Major
              Found in c3/libraries/chip.py - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language