Showing 51 of 317 total issues

Avoid deeply nested control flow statements.
Open

                    if np.imag(data[m, n]) >= 0.0:
                        f.write("%.10f+%.10fj" % (np.real(data[m, n]),
                                                  np.imag(data[m, n])))
                    else:
                        f.write("%.10f%.10fj" % (np.real(data[m, n]),
Severity: Major
Found in qutip/fileio.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if n != N - 1:
                            f.write(sep)
                    f.write("\n")
    Severity: Major
    Found in qutip/fileio.py - About 45 mins to fix

      Function __init__ has 12 arguments (exceeds 10 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Major
      Found in qutip/solver/heom/bofin_solvers.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if m == n:
                                W += real(rho[m, m] * (-1) ** m * genlaguerre(m, 0)(B))
        
                            elif n > m:
                                W += 2.0 * real(rho[m, n] * (-1) ** m *
        Severity: Major
        Found in qutip/wigner.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if n != N - 1:
                                  f.write(sep)
                          f.write("\n")
          Severity: Major
          Found in qutip/fileio.py - About 45 mins to fix

            Function nm_mcsolve has 12 arguments (exceeds 10 allowed). Consider refactoring.
            Open

            def nm_mcsolve(H, state, tlist, ops_and_rates=(), e_ops=None, ntraj=500, *,
            Severity: Major
            Found in qutip/solver/nm_mcsolve.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if np.imag(data[m, n]) >= 0.0:
                                      f.write("%.10e+%.10ej" % (np.real(data[m, n]),
                                                                np.imag(data[m, n])))
                                  else:
                                      f.write("%.10e%.10ej" % (np.real(data[m, n]),
              Severity: Major
              Found in qutip/fileio.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if n != N - 1:
                                        f.write(sep)
                                f.write("\n")
                Severity: Major
                Found in qutip/fileio.py - About 45 mins to fix

                  Function correlation_2op_2t has 11 arguments (exceeds 10 allowed). Consider refactoring.
                  Open

                  def correlation_2op_2t(H, state0, tlist, taulist, c_ops, a_op, b_op,
                  Severity: Major
                  Found in qutip/solver/correlation.py - About 35 mins to fix

                    Function rcsolve has 11 arguments (exceeds 10 allowed). Consider refactoring.
                    Open

                    def rcsolve(Hsys, psi0, tlist, e_ops, Q, wc, alpha, N, w_th, sparse=False,
                    Severity: Major
                    Found in qutip/legacy/rcsolve.py - About 35 mins to fix

                      Function correlation_3op_2t has 11 arguments (exceeds 10 allowed). Consider refactoring.
                      Open

                      def correlation_3op_2t(H, state0, tlist, taulist, c_ops, a_op, b_op, c_op,
                      Severity: Major
                      Found in qutip/solver/correlation.py - About 35 mins to fix

                        Function steadystate has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                        Open

                        def steadystate(A, c_ops=[], *, method='direct', solver=None, **kwargs):
                            """
                            Calculates the steady state for quantum evolution subject to the supplied
                            Hamiltonian or Liouvillian operator and (if given a Hamiltonian) a list of
                            collapse operators.
                        Severity: Minor
                        Found in qutip/solver/steadystate.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 solve_csr_dense has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                        Open

                        def solve_csr_dense(matrix: Union[CSR, Dia], target: Dense, method=None,
                                            options: dict={}) -> Dense:
                            """
                            Solve ``Ax=b`` for ``x``.
                        
                        
                        Severity: Minor
                        Found in qutip/core/data/solve.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 _find_mkl has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                        Open

                        def _find_mkl():
                            """
                            Finds the MKL runtime library for the Anaconda and Intel Python
                            distributions.
                            """
                        Severity: Minor
                        Found in qutip/settings.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

                        Avoid too many return statements within this function.
                        Open

                                return (fidelity(oper_choi, target_choi)/d)**2
                        Severity: Major
                        Found in qutip/core/metrics.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return Qobj(_data.add(A, A.adjoint()), dims=dims,
                          Severity: Major
                          Found in qutip/core/operators.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return process_fidelity(target, oper)  # reverse order
                            Severity: Major
                            Found in qutip/core/metrics.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return Qobj(out_data,
                              Severity: Major
                              Found in qutip/core/tensor.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        return composite(*(arg.dag() for arg in args)).dag()
                                Severity: Major
                                Found in qutip/core/tensor.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                          return self._sum_abs.sum_states
                                  Severity: Major
                                  Found in qutip/solver/multitrajresult.py - About 30 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language