dseuss/mpnum

View on GitHub
mpnum/povm/mppovm.py

Summary

Maintainability
F
1 wk
Test Coverage

File mppovm.py has 1229 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# encoding: utf-8


r'''Matrix-product representation of POVMs

Severity: Major
Found in mpnum/povm/mppovm.py - About 3 days to fix

    MPPovm has 34 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class MPPovm(mp.MPArray):
        """MPArray representation of multipartite POVM
    
        There are two different ways to write down a POVM in matrix product form
    
    
    Severity: Minor
    Found in mpnum/povm/mppovm.py - About 4 hrs to fix

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

          def expectations(self, mpa, mode='auto'):
              """Computes the exp. values of the POVM elements with given state
      
              :param mpa: State given as MPDO, MPS, or PMPS
              :param mode: In which form `mpa` is given. Possible values: 'mpdo',
      Severity: Minor
      Found in mpnum/povm/mppovm.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 pmf_as_array has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def pmf_as_array(self, state, mode='auto', eps=1e-10, impl='auto'):
              """Compute the POVM's PMF for `state` as full array
      
              Parameters: See :func:`MPPovm.pmf`.
      
      
      Severity: Minor
      Found in mpnum/povm/mppovm.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 lfun has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def lfun(self, coeff, funs, state, mode='auto', eps=1e-10):
              """Evaluate a linear combination of functions of POVM outcomes
      
              :param np.ndarray coeff: A length `n_funs` array with the
                  coefficients of the linear combination. If `None`, return
      Severity: Minor
      Found in mpnum/povm/mppovm.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 match_elems has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def match_elems(self, other, exclude_dup=(), eps=1e-10):
              """Find POVM elements in `other` which have information on `self`
      
              We find all POVM sites in `self` which have only one possible
              outcome. We discard these outputs in `other` and afterwards
      Severity: Minor
      Found in mpnum/povm/mppovm.py - About 1 hr to fix

        Function sample has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def sample(self, rng, state, n_samples, method='cond', n_group=1,
        Severity: Major
        Found in mpnum/povm/mppovm.py - About 1 hr to fix

          Function sample has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def sample(self, rng, state, n_samples, method, n_group=1, mode='auto',
          Severity: Major
          Found in mpnum/povm/mppovm.py - About 1 hr to fix

            Function _sample_cond has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def _sample_cond(self, rng, state, mode, n_samples, n_group, out, eps):
            Severity: Major
            Found in mpnum/povm/mppovm.py - About 50 mins to fix

              Function _sample_direct has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def _sample_direct(self, rng, state, mode, n_samples, out, eps):
              Severity: Minor
              Found in mpnum/povm/mppovm.py - About 45 mins to fix

                Function _mppl_lfun_estimator has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def _mppl_lfun_estimator(self, est_coeff, est_funs, other, n_samples,
                Severity: Minor
                Found in mpnum/povm/mppovm.py - About 45 mins to fix

                  Function lfun_from has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def lfun_from(self, other, coeff, state, mode='auto', other_weights=None,
                  Severity: Minor
                  Found in mpnum/povm/mppovm.py - About 45 mins to fix

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

                        def est_lfun(self, coeff, funs, samples, weights=None, eps=1e-10):
                    Severity: Minor
                    Found in mpnum/povm/mppovm.py - About 35 mins to fix

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

                          def lfun(self, coeff, funs, state, mode='auto', eps=1e-10):
                      Severity: Minor
                      Found in mpnum/povm/mppovm.py - About 35 mins to fix

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

                            def lfun(self, coeff, funs, state, mode='auto', eps=1e-10):
                        Severity: Minor
                        Found in mpnum/povm/mppovm.py - About 35 mins to fix

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

                              def block_pmfs_as_array(self, state, mode, asarray=False, eps=1e-10,
                          Severity: Minor
                          Found in mpnum/povm/mppovm.py - About 35 mins to fix

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

                                def est_lfun(self, coeff, funs, samples, weights=None, eps=1e-10):
                            Severity: Minor
                            Found in mpnum/povm/mppovm.py - About 35 mins to fix

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

                                  def block_pmfs_as_array(self, state, mode, asarray=False, eps=1e-10,
                              Severity: Minor
                              Found in mpnum/povm/mppovm.py - About 35 mins to fix

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

                                    def est_lfun(self, coeff, funs, samples, weights=None, eps=1e-10):
                                        """Estimate a linear combination of functions of POVM outcomes
                                
                                        This function estimates the function with exact value given by
                                        :func:`MPPovm.lfun`; see there for description of the
                                Severity: Minor
                                Found in mpnum/povm/mppovm.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

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                        eye3d = mp.MPArray.from_kron(
                                            # Drop inner products between different elements
                                            np.fromfunction(lambda i, j, k: (i == j) & (j == k), [outdim] * 3)
                                            for outdim in other.outdims
                                Severity: Major
                                Found in mpnum/povm/mppovm.py and 1 other location - About 3 hrs to fix
                                mpnum/povm/mppovm.py on lines 612..615

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 64.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                        eye3d = mp.MPArray.from_kron(
                                            # Drop inner products between different elements
                                            np.fromfunction(lambda i, j, k: (i == j) & (j == k), [outdim] * 3)
                                            for outdim in self.outdims
                                Severity: Major
                                Found in mpnum/povm/mppovm.py and 1 other location - About 3 hrs to fix
                                mpnum/povm/mppovm.py on lines 620..623

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 64.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                    def unpack_samples(self, samples):
                                        """Unpack samples into several integers per sample
                                
                                        :returns: Iterator over output from :func:`MPPovm.unpack_samples`
                                
                                
                                Severity: Major
                                Found in mpnum/povm/mppovm.py and 1 other location - About 2 hrs to fix
                                mpnum/povm/mppovm.py on lines 1348..1356

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 56.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Identical blocks of code found in 2 locations. Consider refactoring.
                                Open

                                        if any((n[c != 0.0] == 0).any() for n, c in zip(n_sam, coeff)):
                                            return np.nan, np.nan
                                Severity: Major
                                Found in mpnum/povm/mppovm.py and 1 other location - About 2 hrs to fix
                                mpnum/povm/mppovm.py on lines 1499..1500

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 56.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                    def pack_samples(self, samples):
                                        """Pack samples into one integer per sample
                                
                                        :returns: Iterator over output from :func:`MPPovm.pack_samples`
                                
                                
                                Severity: Major
                                Found in mpnum/povm/mppovm.py and 1 other location - About 2 hrs to fix
                                mpnum/povm/mppovm.py on lines 1358..1366

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 56.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Identical blocks of code found in 2 locations. Consider refactoring.
                                Open

                                        if any((n[c != 0.0] == 0).any() for n, c in zip(n_sam, coeff)):
                                            return np.nan, np.nan
                                Severity: Major
                                Found in mpnum/povm/mppovm.py and 1 other location - About 2 hrs to fix
                                mpnum/povm/mppovm.py on lines 1530..1531

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 56.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                        if mode == 'mps':
                                            for psi_red in mpsmpo.reductions_mps_as_pmps(mpa, len(self)):
                                                rho_red = mpsmpo.pmps_to_mpo(psi_red)
                                                yield mp.dot(pmap, rho_red.ravel())
                                            return
                                Severity: Major
                                Found in mpnum/povm/mppovm.py and 1 other location - About 1 hr to fix
                                mpnum/povm/mppovm.py on lines 386..390

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 46.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                        elif mode == 'pmps':
                                            for psi_red in mpsmpo.reductions_pmps(mpa, len(self)):
                                                rho_red = mpsmpo.pmps_to_mpo(psi_red)
                                                yield mp.dot(pmap, rho_red.ravel())
                                            return
                                Severity: Major
                                Found in mpnum/povm/mppovm.py and 1 other location - About 1 hr to fix
                                mpnum/povm/mppovm.py on lines 377..381

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 46.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                    @property
                                    def outdims(self):
                                        """Outcome dimensions"""
                                        # First physical leg dimension
                                        return tuple(lt.shape[1] for lt in self._lt)
                                Severity: Minor
                                Found in mpnum/povm/mppovm.py and 1 other location - About 50 mins to fix
                                mpnum/povm/mppovm.py on lines 212..216

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 36.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                    @property
                                    def hdims(self):
                                        """Local Hilbert space dimensions"""
                                        # Second physical leg dimension (equals third physical leg dimension)
                                        return tuple(lt.shape[2] for lt in self._lt)
                                Severity: Minor
                                Found in mpnum/povm/mppovm.py and 1 other location - About 50 mins to fix
                                mpnum/povm/mppovm.py on lines 196..200

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 36.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 3 locations. Consider refactoring.
                                Open

                                        inner = mp.dot(self.conj(), other,
                                                       axes=((1, 2), (1, 2)), astype=mp.MPArray)
                                Severity: Major
                                Found in mpnum/povm/mppovm.py and 2 other locations - About 40 mins to fix
                                mpnum/povm/mppovm.py on lines 610..611
                                mpnum/povm/mppovm.py on lines 618..619

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 34.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 3 locations. Consider refactoring.
                                Open

                                        onormsq = mp.dot(other.conj(), other,
                                                         axes=((1, 2), (1, 2)), astype=mp.MPArray)
                                Severity: Major
                                Found in mpnum/povm/mppovm.py and 2 other locations - About 40 mins to fix
                                mpnum/povm/mppovm.py on lines 607..608
                                mpnum/povm/mppovm.py on lines 610..611

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 34.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 3 locations. Consider refactoring.
                                Open

                                        snormsq = mp.dot(self.conj(), self,
                                                         axes=((1, 2), (1, 2)), astype=mp.MPArray)
                                Severity: Major
                                Found in mpnum/povm/mppovm.py and 2 other locations - About 40 mins to fix
                                mpnum/povm/mppovm.py on lines 607..608
                                mpnum/povm/mppovm.py on lines 618..619

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 34.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                There are no issues that match your filters.

                                Category
                                Status