OpenJij/cimod

View on GitHub
cimod/model/binary_polynomial_model.py

Summary

Maintainability
F
1 wk
Test Coverage
F
56%

Function make_BinaryPolynomialModel has a Cognitive Complexity of 221 (exceeds 5 allowed). Consider refactoring.
Open

def make_BinaryPolynomialModel(polynomial, index_type=None, tuple_size=0):
    """BinaryPolynomialModel factory.
       Generate BinaryPolynomialModel class with the base class specified by the arguments linear and quadratic
    Args:
        polynomial (dict): polynomial bias including linear bias
Severity: Minor
Found in cimod/model/binary_polynomial_model.py - About 4 days 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 binary_polynomial_model.py has 659 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2022 Jij Inc.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Severity: Major
Found in cimod/model/binary_polynomial_model.py - About 1 day to fix

    Function BinaryPolynomialModel has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
    Open

    def BinaryPolynomialModel(*args, **kwargs):
        if kwargs == {}:
            if len(args) <= 1:
                raise TypeError("Invalid argument for this function")
            elif len(args) == 2:
    Severity: Minor
    Found in cimod/model/binary_polynomial_model.py - About 1 day 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 make_BinaryPolynomialModel_from_hubo has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
    Open

    def make_BinaryPolynomialModel_from_hubo(*args, **kwargs):
        if kwargs == {}:
            if len(args) == 0:
                raise TypeError("Invalid argument for this function")
            elif len(args) == 1:
    Severity: Minor
    Found in cimod/model/binary_polynomial_model.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

    Function make_BinaryPolynomialModel_from_hising has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
    Open

    def make_BinaryPolynomialModel_from_hising(*args, **kwargs):
        if kwargs == {}:
            if len(args) == 0:
                raise TypeError("Invalid argument for this function")
            elif len(args) == 1:
    Severity: Minor
    Found in cimod/model/binary_polynomial_model.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

    Cyclomatic complexity is too high in function BinaryPolynomialModel. (35)
    Open

    def BinaryPolynomialModel(*args, **kwargs):
        if kwargs == {}:
            if len(args) <= 1:
                raise TypeError("Invalid argument for this function")
            elif len(args) == 2:

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function make_BinaryPolynomialModel_from_hubo. (25)
    Open

    def make_BinaryPolynomialModel_from_hubo(*args, **kwargs):
        if kwargs == {}:
            if len(args) == 0:
                raise TypeError("Invalid argument for this function")
            elif len(args) == 1:

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function make_BinaryPolynomialModel_from_hising. (25)
    Open

    def make_BinaryPolynomialModel_from_hising(*args, **kwargs):
        if kwargs == {}:
            if len(args) == 0:
                raise TypeError("Invalid argument for this function")
            elif len(args) == 1:

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function make_BinaryPolynomialModel. (12)
    Open

    def make_BinaryPolynomialModel(polynomial, index_type=None, tuple_size=0):
        """BinaryPolynomialModel factory.
           Generate BinaryPolynomialModel class with the base class specified by the arguments linear and quadratic
        Args:
            polynomial (dict): polynomial bias including linear bias

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Consider simplifying this complex logical expression.
    Open

                    if "keys" in kwargs and "values" in kwargs and "vartype" in kwargs:
                        if len(args) != 0:
                            raise TypeError("Invalid argument for this function")
                        super().add_interactions_from(
                            kwargs["keys"], kwargs["values"], to_cxxcimod(kwargs["vartype"])
    Severity: Critical
    Found in cimod/model/binary_polynomial_model.py - About 2 hrs to fix

      Cyclomatic complexity is too high in function make_BinaryPolynomialModel_from_JSON. (7)
      Open

      def make_BinaryPolynomialModel_from_JSON(obj):
          if obj["type"] != "BinaryPolynomialModel":
              raise Exception('Type must be "BinaryPolynomialModel"')
          mock_polynomial = {}
          if obj["index_type"] == "IndexType.INT":

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in function _BinaryPolynomialModel_from_list. (6)
      Open

      def _BinaryPolynomialModel_from_list(keys: list, values: list, vartype):
          if len(keys) == 0:
              Model = make_BinaryPolynomialModel({})
              return Model(keys, values, to_cxxcimod(vartype))
          i = 0

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in function _make_BinaryPolynomialModel_from_hising_from_list. (6)
      Open

      def _make_BinaryPolynomialModel_from_hising_from_list(keys: list, values: list):
          if len(keys) == 0:
              return make_BinaryPolynomialModel({}).from_hising(keys, values)
      
          i = 0

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in function _make_BinaryPolynomialModel_from_hubo_from_list. (6)
      Open

      def _make_BinaryPolynomialModel_from_hubo_from_list(keys: list, values: list):
          if len(keys) == 0:
              return make_BinaryPolynomialModel({}).from_hubo(keys, values)
      
          i = 0

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Consider simplifying this complex logical expression.
      Open

              if "keys" in kwargs and "values" in kwargs and "vartype" in kwargs:
                  key_condition = isinstance(kwargs["keys"], list) or isinstance(
                      kwargs["keys"], tuple
                  )
                  val_condition = isinstance(kwargs["values"], list) or isinstance(
      Severity: Critical
      Found in cimod/model/binary_polynomial_model.py - About 1 hr to fix

        Function _make_BinaryPolynomialModel_from_hubo_from_list has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def _make_BinaryPolynomialModel_from_hubo_from_list(keys: list, values: list):
            if len(keys) == 0:
                return make_BinaryPolynomialModel({}).from_hubo(keys, values)
        
            i = 0
        Severity: Minor
        Found in cimod/model/binary_polynomial_model.py - About 45 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 _make_BinaryPolynomialModel_from_hising_from_list has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def _make_BinaryPolynomialModel_from_hising_from_list(keys: list, values: list):
            if len(keys) == 0:
                return make_BinaryPolynomialModel({}).from_hising(keys, values)
        
            i = 0
        Severity: Minor
        Found in cimod/model/binary_polynomial_model.py - About 45 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 _BinaryPolynomialModel_from_list has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def _BinaryPolynomialModel_from_list(keys: list, values: list, vartype):
            if len(keys) == 0:
                Model = make_BinaryPolynomialModel({})
                return Model(keys, values, to_cxxcimod(vartype))
            i = 0
        Severity: Minor
        Found in cimod/model/binary_polynomial_model.py - About 45 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

        Consider simplifying this complex logical expression.
        Open

                if "keys" in kwargs and "values" in kwargs:
                    key_condition = isinstance(kwargs["keys"], list) or isinstance(
                        kwargs["keys"], tuple
                    )
                    val_condition = isinstance(kwargs["values"], list) or isinstance(
        Severity: Major
        Found in cimod/model/binary_polynomial_model.py - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                  if "keys" in kwargs and "values" in kwargs:
                      key_condition = isinstance(kwargs["keys"], list) or isinstance(
                          kwargs["keys"], tuple
                      )
                      val_condition = isinstance(kwargs["values"], list) or isinstance(
          Severity: Major
          Found in cimod/model/binary_polynomial_model.py - About 40 mins to fix

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

            def make_BinaryPolynomialModel_from_JSON(obj):
                if obj["type"] != "BinaryPolynomialModel":
                    raise Exception('Type must be "BinaryPolynomialModel"')
                mock_polynomial = {}
                if obj["index_type"] == "IndexType.INT":
            Severity: Minor
            Found in cimod/model/binary_polynomial_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

            Avoid too many return statements within this function.
            Open

                                return super().get_polynomial(*args, **kwargs)
            Severity: Major
            Found in cimod/model/binary_polynomial_model.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                                  return super().remove_interaction(*args, **kwargs)
              Severity: Major
              Found in cimod/model/binary_polynomial_model.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                return make_BinaryPolynomialModel({}, tuple, 4)
                Severity: Major
                Found in cimod/model/binary_polynomial_model.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                      return _BinaryPolynomialModel_from_list(
                  Severity: Major
                  Found in cimod/model/binary_polynomial_model.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                        return super().get_polynomial(*args, **kwargs)
                    Severity: Major
                    Found in cimod/model/binary_polynomial_model.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                          return super().get_polynomial(args)
                      Severity: Major
                      Found in cimod/model/binary_polynomial_model.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                            return _BinaryPolynomialModel_from_dict(
                        Severity: Major
                        Found in cimod/model/binary_polynomial_model.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                              return super().remove_interactions_from(*args, **kwargs)
                          Severity: Major
                          Found in cimod/model/binary_polynomial_model.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                            return _BinaryPolynomialModel_from_list(
                            Severity: Major
                            Found in cimod/model/binary_polynomial_model.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                                  return super().remove_interaction(args)
                              Severity: Major
                              Found in cimod/model/binary_polynomial_model.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                                return cxxcimod.BinaryPolynomialModel_tuple4, "IndexType.INT_TUPLE_4"
                                Severity: Major
                                Found in cimod/model/binary_polynomial_model.py - About 30 mins to fix

                                  Refactor this function to reduce its Cognitive Complexity from 235 to the 15 allowed.
                                  Open

                                  def make_BinaryPolynomialModel(polynomial, index_type=None, tuple_size=0):

                                  Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                  See

                                  Refactor this function to reduce its Cognitive Complexity from 48 to the 15 allowed.
                                  Open

                                  def make_BinaryPolynomialModel_from_hising(*args, **kwargs):

                                  Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                  See

                                  Refactor this function to reduce its Cognitive Complexity from 48 to the 15 allowed.
                                  Open

                                  def make_BinaryPolynomialModel_from_hubo(*args, **kwargs):

                                  Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                  See

                                  Refactor this function to reduce its Cognitive Complexity from 66 to the 15 allowed.
                                  Open

                                  def BinaryPolynomialModel(*args, **kwargs):

                                  Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                  See

                                  Either merge this branch with the identical one on line "478" or change one of the implementations.
                                  Open

                                              raise TypeError("Invalid argument for this function")

                                  Having two branches in the same if structure with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then they should be combined.

                                  Noncompliant Code Example

                                  if 0 <= a < 10:
                                      do_the_thing()
                                  elif 10 <= a < 20:
                                      do_the_other_thing()
                                  elif 20 <= a < 50:
                                      do_the_thing()  # Noncompliant; duplicates first condition
                                  else:
                                      do_the_rest()
                                  
                                  b = 4 if a > 12 else 4
                                  

                                  Compliant Solution

                                  if (0 <= a < 10) or (20 <= a < 50):
                                      do_the_thing()
                                  elif 10 <= a < 20:
                                      do_the_other_thing()
                                  else:
                                      do_the_rest()
                                  
                                  b = 4
                                  

                                  or

                                  if 0 <= a < 10:
                                      do_the_thing()
                                  elif 10 <= a < 20:
                                      do_the_other_thing()
                                  elif 20 <= a < 50:
                                      do_the_third_thing()
                                  else:
                                      do_the_rest()
                                  
                                  b = 8 if a > 12 else 4
                                  

                                  Either merge this branch with the identical one on line "582" or change one of the implementations.
                                  Open

                                              raise TypeError("Invalid argument for this function")

                                  Having two branches in the same if structure with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then they should be combined.

                                  Noncompliant Code Example

                                  if 0 <= a < 10:
                                      do_the_thing()
                                  elif 10 <= a < 20:
                                      do_the_other_thing()
                                  elif 20 <= a < 50:
                                      do_the_thing()  # Noncompliant; duplicates first condition
                                  else:
                                      do_the_rest()
                                  
                                  b = 4 if a > 12 else 4
                                  

                                  Compliant Solution

                                  if (0 <= a < 10) or (20 <= a < 50):
                                      do_the_thing()
                                  elif 10 <= a < 20:
                                      do_the_other_thing()
                                  else:
                                      do_the_rest()
                                  
                                  b = 4
                                  

                                  or

                                  if 0 <= a < 10:
                                      do_the_thing()
                                  elif 10 <= a < 20:
                                      do_the_other_thing()
                                  elif 20 <= a < 50:
                                      do_the_third_thing()
                                  else:
                                      do_the_rest()
                                  
                                  b = 8 if a > 12 else 4
                                  

                                  Either merge this branch with the identical one on line "665" or change one of the implementations.
                                  Open

                                              raise TypeError("Invalid argument for this function")

                                  Having two branches in the same if structure with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then they should be combined.

                                  Noncompliant Code Example

                                  if 0 <= a < 10:
                                      do_the_thing()
                                  elif 10 <= a < 20:
                                      do_the_other_thing()
                                  elif 20 <= a < 50:
                                      do_the_thing()  # Noncompliant; duplicates first condition
                                  else:
                                      do_the_rest()
                                  
                                  b = 4 if a > 12 else 4
                                  

                                  Compliant Solution

                                  if (0 <= a < 10) or (20 <= a < 50):
                                      do_the_thing()
                                  elif 10 <= a < 20:
                                      do_the_other_thing()
                                  else:
                                      do_the_rest()
                                  
                                  b = 4
                                  

                                  or

                                  if 0 <= a < 10:
                                      do_the_thing()
                                  elif 10 <= a < 20:
                                      do_the_other_thing()
                                  elif 20 <= a < 50:
                                      do_the_third_thing()
                                  else:
                                      do_the_rest()
                                  
                                  b = 8 if a > 12 else 4
                                  

                                  Remove this commented out code.
                                  Open

                                      """
                                  class Variables:
                                      def __init__(self, bpm):
                                          self._bpm = bpm
                                  
                                  

                                  Programmers should not comment out code as it bloats programs and reduces readability.

                                  Unused code should be deleted and can be retrieved from source control history if required.

                                  See

                                  • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                  • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                  • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                  • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                  Line too long (80 > 79 characters)
                                  Open

                                                              kwargs["polynomial"], to_cxxcimod(kwargs["vartype"])
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (85 > 79 characters)
                                  Open

                                                      return Model(self.get_key_list(), self.get_value_list(), vartype)
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (88 > 79 characters)
                                  Open

                                                  return _make_BinaryPolynomialModel_from_hubo_from_list(args[0], args[1])
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (83 > 79 characters)
                                  Open

                                              key_condition = isinstance(args[0], list) or isinstance(args[0], tuple)
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (84 > 79 characters)
                                  Open

                                                          super().add_interactions_from(args[0], to_cxxcimod(args[1]))
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (85 > 79 characters)
                                  Open

                                                              args[0], kwargs["values"], to_cxxcimod(kwargs["vartype"])
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (83 > 79 characters)
                                  Open

                                              val_condition = isinstance(args[1], list) or isinstance(args[1], tuple)
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (85 > 79 characters)
                                  Open

                                                  _make_BinaryPolynomialModel_from_hubo_from_dict(kwargs["polynomial"])
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (80 > 79 characters)
                                  Open

                                                                  args[0], args[1], to_cxxcimod(kwargs["vartype"])
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (111 > 79 characters)
                                  Open

                                         Generate BinaryPolynomialModel class with the base class specified by the arguments linear and quadratic
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (85 > 79 characters)
                                  Open

                                                  return cxxcimod.BinaryPolynomialModel_tuple4, "IndexType.INT_TUPLE_4"
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (83 > 79 characters)
                                  Open

                                          def add_interaction(self, key: list, value, vartype=cxxcimod.Vartype.NONE):
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Comparison to false should be 'if cond is false:' or 'if not cond:'
                                  Open

                                              elif inplace == False:
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Comparison to singletons should use "is" or "is not".

                                  Comparisons to singletons like None should always be done
                                  with "is" or "is not", never the equality operators.
                                  
                                  Okay: if arg is not None:
                                  E711: if arg != None:
                                  E711: if None == arg:
                                  E712: if arg == True:
                                  E712: if False == arg:
                                  
                                  Also, beware of writing if x when you really mean if x is not None
                                  -- e.g. when testing whether a variable or argument that defaults to
                                  None was set to some other value.  The other value might have a type
                                  (such as a container) that could be false in a boolean context!

                                  Line too long (87 > 79 characters)
                                  Open

                                                  val_condition = isinstance(args[1], list) or isinstance(args[1], tuple)
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (85 > 79 characters)
                                  Open

                                                  return cxxcimod.BinaryPolynomialModel_tuple2, "IndexType.INT_TUPLE_2"
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (83 > 79 characters)
                                  Open

                                              base, base_type = base_selector(type(second_tuple[0]), second_tuple[0])
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (81 > 79 characters)
                                  Open

                                              base, base_type = base_selector(type(first_tuple[0]), first_tuple[0])
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (86 > 79 characters)
                                  Open

                                                  return _BinaryPolynomialModel_from_dict(args[0], to_cxxcimod(args[1]))
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (83 > 79 characters)
                                  Open

                                              key_condition = isinstance(args[0], list) or isinstance(args[0], tuple)
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (85 > 79 characters)
                                  Open

                                                  return cxxcimod.BinaryPolynomialModel_tuple3, "IndexType.INT_TUPLE_3"
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (83 > 79 characters)
                                  Open

                                                      key_condition = isinstance(kwargs["keys"], list) or isinstance(
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (81 > 79 characters)
                                  Open

                                                  return _make_BinaryPolynomialModel_from_hising_from_dict(args[0])
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (83 > 79 characters)
                                  Open

                                              key_condition = isinstance(args[0], list) or isinstance(args[0], tuple)
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (83 > 79 characters)
                                  Open

                                                  if "keys" in kwargs and "values" in kwargs and "vartype" in kwargs:
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (83 > 79 characters)
                                  Open

                                              key_condition = isinstance(args[0], list) or isinstance(args[0], tuple)
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (83 > 79 characters)
                                  Open

                                              val_condition = isinstance(args[1], list) or isinstance(args[1], tuple)
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (83 > 79 characters)
                                  Open

                                              key_condition = isinstance(args[0], list) or isinstance(args[0], tuple)
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (81 > 79 characters)
                                  Open

                                                              raise TypeError("Invalid argument for this function")
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (80 > 79 characters)
                                  Open

                                                          key_condition = isinstance(args[0], list) or isinstance(
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (80 > 79 characters)
                                  Open

                                                          val_condition = isinstance(args[1], list) or isinstance(
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (87 > 79 characters)
                                  Open

                                                  _make_BinaryPolynomialModel_from_hising_from_dict(kwargs["polynomial"])
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (85 > 79 characters)
                                  Open

                                                      val_condition = isinstance(kwargs["values"], list) or isinstance(
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (87 > 79 characters)
                                  Open

                                                          super().add_interactions_from(kwargs["keys"], kwargs["values"])
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (87 > 79 characters)
                                  Open

                                                  key_condition = isinstance(args[0], list) or isinstance(args[0], tuple)
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (83 > 79 characters)
                                  Open

                                              val_condition = isinstance(args[1], list) or isinstance(args[1], tuple)
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (84 > 79 characters)
                                  Open

                                          return make_BinaryPolynomialModel(mock_polynomial).from_hising(keys, values)
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (88 > 79 characters)
                                  Open

                                                          kwargs["keys"], kwargs["values"], to_cxxcimod(kwargs["vartype"])
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (80 > 79 characters)
                                  Open

                                  def _make_BinaryPolynomialModel_from_hising_from_list(keys: list, values: list):
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (141 > 79 characters)
                                  Open

                                             The dictionaries between indices and integers are self.ind_to_num (indices -> integers) and self.num_to_ind (integers -> indices).
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (81 > 79 characters)
                                  Open

                                                              raise TypeError("Invalid argument for this function")
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (80 > 79 characters)
                                  Open

                                                          super().add_interactions_from(args[0], kwargs["values"])
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (82 > 79 characters)
                                  Open

                                              variables (list): labels of each variables sorted by results variables
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (85 > 79 characters)
                                  Open

                                                      val_condition = isinstance(kwargs["values"], list) or isinstance(
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (82 > 79 characters)
                                  Open

                                          return make_BinaryPolynomialModel(mock_polynomial).from_hubo(keys, values)
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (85 > 79 characters)
                                  Open

                                                      val_condition = isinstance(kwargs["values"], list) or isinstance(
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (84 > 79 characters)
                                  Open

                                                      kwargs["keys"], kwargs["values"], to_cxxcimod(kwargs["vartype"])
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (83 > 79 characters)
                                  Open

                                              key_condition = isinstance(args[0], list) or isinstance(args[0], tuple)
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (81 > 79 characters)
                                  Open

                                      lambda *args, **kwargs: make_BinaryPolynomialModel_from_hubo(*args, **kwargs)
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (80 > 79 characters)
                                  Open

                                      lambda obj: make_BinaryPolynomialModel_from_JSON(obj).from_serializable(obj)
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Line too long (83 > 79 characters)
                                  Open

                                      lambda *args, **kwargs: make_BinaryPolynomialModel_from_hising(*args, **kwargs)
                                  Severity: Minor
                                  Found in cimod/model/binary_polynomial_model.py by pep8

                                  Limit all lines to a maximum of 79 characters.

                                  There are still many devices around that are limited to 80 character
                                  lines; plus, limiting windows to 80 characters makes it possible to
                                  have several windows side-by-side.  The default wrapping on such
                                  devices looks ugly.  Therefore, please limit all lines to a maximum
                                  of 79 characters. For flowing long blocks of text (docstrings or
                                  comments), limiting the length to 72 characters is recommended.
                                  
                                  Reports error E501.

                                  Rename function "BinaryPolynomialModel" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
                                  Open

                                  def BinaryPolynomialModel(*args, **kwargs):

                                  Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

                                  Noncompliant Code Example

                                  With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

                                  def MyFunction(a,b):
                                      ...
                                  

                                  Compliant Solution

                                  def my_function(a,b):
                                      ...
                                  

                                  Rename function "make_BinaryPolynomialModel" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
                                  Open

                                  def make_BinaryPolynomialModel(polynomial, index_type=None, tuple_size=0):

                                  Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

                                  Noncompliant Code Example

                                  With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

                                  def MyFunction(a,b):
                                      ...
                                  

                                  Compliant Solution

                                  def my_function(a,b):
                                      ...
                                  

                                  Rename function "_BinaryPolynomialModel_from_list" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
                                  Open

                                  def _BinaryPolynomialModel_from_list(keys: list, values: list, vartype):

                                  Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

                                  Noncompliant Code Example

                                  With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

                                  def MyFunction(a,b):
                                      ...
                                  

                                  Compliant Solution

                                  def my_function(a,b):
                                      ...
                                  

                                  Rename function "_BinaryPolynomialModel_from_dict" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
                                  Open

                                  def _BinaryPolynomialModel_from_dict(polynomial: dict, vartype):

                                  Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

                                  Noncompliant Code Example

                                  With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

                                  def MyFunction(a,b):
                                      ...
                                  

                                  Compliant Solution

                                  def my_function(a,b):
                                      ...
                                  

                                  Rename function "_make_BinaryPolynomialModel_from_hubo_from_list" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
                                  Open

                                  def _make_BinaryPolynomialModel_from_hubo_from_list(keys: list, values: list):

                                  Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

                                  Noncompliant Code Example

                                  With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

                                  def MyFunction(a,b):
                                      ...
                                  

                                  Compliant Solution

                                  def my_function(a,b):
                                      ...
                                  

                                  Rename function "make_BinaryPolynomialModel_from_hising" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
                                  Open

                                  def make_BinaryPolynomialModel_from_hising(*args, **kwargs):

                                  Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

                                  Noncompliant Code Example

                                  With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

                                  def MyFunction(a,b):
                                      ...
                                  

                                  Compliant Solution

                                  def my_function(a,b):
                                      ...
                                  

                                  Rename function "_make_BinaryPolynomialModel_from_hising_from_list" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
                                  Open

                                  def _make_BinaryPolynomialModel_from_hising_from_list(keys: list, values: list):

                                  Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

                                  Noncompliant Code Example

                                  With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

                                  def MyFunction(a,b):
                                      ...
                                  

                                  Compliant Solution

                                  def my_function(a,b):
                                      ...
                                  

                                  Rename function "make_BinaryPolynomialModel_from_JSON" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
                                  Open

                                  def make_BinaryPolynomialModel_from_JSON(obj):

                                  Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

                                  Noncompliant Code Example

                                  With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

                                  def MyFunction(a,b):
                                      ...
                                  

                                  Compliant Solution

                                  def my_function(a,b):
                                      ...
                                  

                                  Rename function "_make_BinaryPolynomialModel_from_hising_from_dict" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
                                  Open

                                  def _make_BinaryPolynomialModel_from_hising_from_dict(polynomial: dict):

                                  Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

                                  Noncompliant Code Example

                                  With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

                                  def MyFunction(a,b):
                                      ...
                                  

                                  Compliant Solution

                                  def my_function(a,b):
                                      ...
                                  

                                  Rename function "_make_BinaryPolynomialModel_from_hubo_from_dict" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
                                  Open

                                  def _make_BinaryPolynomialModel_from_hubo_from_dict(polynomial: dict):

                                  Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

                                  Noncompliant Code Example

                                  With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

                                  def MyFunction(a,b):
                                      ...
                                  

                                  Compliant Solution

                                  def my_function(a,b):
                                      ...
                                  

                                  Rename function "make_BinaryPolynomialModel_from_hubo" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
                                  Open

                                  def make_BinaryPolynomialModel_from_hubo(*args, **kwargs):

                                  Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

                                  Noncompliant Code Example

                                  With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

                                  def MyFunction(a,b):
                                      ...
                                  

                                  Compliant Solution

                                  def my_function(a,b):
                                      ...
                                  

                                  There are no issues that match your filters.

                                  Category
                                  Status