OpenJij/OpenJij

View on GitHub
openjij/model/model.py

Summary

Maintainability
F
5 days
Test Coverage
D
60%

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 openjij/model/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

File model.py has 485 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2023 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: Minor
Found in openjij/model/model.py - About 7 hrs to fix

    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 openjij/model/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_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 openjij/model/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:
    Severity: Minor
    Found in openjij/model/model.py by radon

    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:
    Severity: Minor
    Found in openjij/model/model.py by radon

    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:
    Severity: Minor
    Found in openjij/model/model.py by radon

    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

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

    def BinaryQuadraticModel(linear, quadratic, *args, **kwargs):
        """Generate BinaryQuadraticModel object.
    
        Attributes:
            vartype (dimod.Vartype): variable type SPIN or BINARY
    Severity: Minor
    Found in openjij/model/model.py - About 3 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    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":
    Severity: Minor
    Found in openjij/model/model.py by radon

    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
    Severity: Minor
    Found in openjij/model/model.py by radon

    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
    Severity: Minor
    Found in openjij/model/model.py by radon

    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
    Severity: Minor
    Found in openjij/model/model.py by radon

    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 openjij/model/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 openjij/model/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 openjij/model/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 openjij/model/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 openjij/model/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 openjij/model/model.py - About 40 mins to fix

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

          def bqm_from_numpy_matrix(
          Severity: Minor
          Found in openjij/model/model.py - About 35 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 openjij/model/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 _BinaryPolynomialModel_from_list(
            Severity: Major
            Found in openjij/model/model.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

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

                Avoid too many return statements within this function.
                Open

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

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

                  def make_BinaryPolynomialModel_from_hising(*args, **kwargs):
                  Severity: Critical
                  Found in openjij/model/model.py by sonar-python

                  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):
                  Severity: Critical
                  Found in openjij/model/model.py by sonar-python

                  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):
                  Severity: Critical
                  Found in openjij/model/model.py by sonar-python

                  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 26 to the 15 allowed.
                  Open

                  def BinaryQuadraticModel(linear, quadratic, *args, **kwargs):
                  Severity: Critical
                  Found in openjij/model/model.py by sonar-python

                  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 "417" or change one of the implementations.
                  Open

                              raise TypeError("Invalid argument for this function")
                  Severity: Major
                  Found in openjij/model/model.py by sonar-python

                  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 "313" or change one of the implementations.
                  Open

                              raise TypeError("Invalid argument for this function")
                  Severity: Major
                  Found in openjij/model/model.py by sonar-python

                  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 "186" or change one of the implementations.
                  Open

                                  raise TypeError(
                                      f"Offset or vartype is configured incorrectly. Vartype must be set."
                                  )
                  Severity: Major
                  Found in openjij/model/model.py by sonar-python

                  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 "500" or change one of the implementations.
                  Open

                              raise TypeError("Invalid argument for this function")
                  Severity: Major
                  Found in openjij/model/model.py by sonar-python

                  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
                  

                  Line too long (87 > 79 characters)
                  Open

                                  return _BinaryPolynomialModel_from_dict(args[0], _to_cxxcimod(args[1]))
                  Severity: Minor
                  Found in openjij/model/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 openjij/model/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 openjij/model/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 openjij/model/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

                              variables (list): represents variables of the binary quadratic model
                  Severity: Minor
                  Found in openjij/model/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.

                  Expected 2 blank lines after class or function definition, found 1
                  Open

                  BinaryQuadraticModel.from_ising = bqm_from_ising
                  Severity: Minor
                  Found in openjij/model/model.py by pep8

                  Separate top-level function and class definitions with two blank lines.

                  Method definitions inside a class are separated by a single blank
                  line.
                  
                  Extra blank lines may be used (sparingly) to separate groups of
                  related functions.  Blank lines may be omitted between a bunch of
                  related one-liners (e.g. a set of dummy implementations).
                  
                  Use blank lines in functions, sparingly, to indicate logical
                  sections.
                  
                  Okay: def a():\n    pass\n\n\ndef b():\n    pass
                  Okay: def a():\n    pass\n\n\nasync def b():\n    pass
                  Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
                  Okay: default = 1\nfoo = 1
                  Okay: classify = 1\nfoo = 1
                  
                  E301: class Foo:\n    b = 0\n    def bar():\n        pass
                  E302: def a():\n    pass\n\ndef b(n):\n    pass
                  E302: def a():\n    pass\n\nasync def b(n):\n    pass
                  E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
                  E303: def a():\n\n\n\n    pass
                  E304: @decorator\n\ndef a():\n    pass
                  E305: def a():\n    pass\na()
                  E306: def a():\n    def b():\n        pass\n    def c():\n        pass

                  Line too long (87 > 79 characters)
                  Open

                                  val_condition = isinstance(args[1], list) or isinstance(args[1], tuple)
                  Severity: Minor
                  Found in openjij/model/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 openjij/model/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 openjij/model/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

                                      f"Offset or vartype is configured incorrectly. Vartype must be set."
                  Severity: Minor
                  Found in openjij/model/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

                      lambda obj, **kwargs: make_BinaryQuadraticModel_from_JSON(obj).from_serializable(
                  Severity: Minor
                  Found in openjij/model/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 openjij/model/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 openjij/model/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 openjij/model/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.

                  Expected 2 blank lines, found 1
                  Open

                  def bqm_from_qubo(Q, offset=0.0, **kwargs):
                  Severity: Minor
                  Found in openjij/model/model.py by pep8

                  Separate top-level function and class definitions with two blank lines.

                  Method definitions inside a class are separated by a single blank
                  line.
                  
                  Extra blank lines may be used (sparingly) to separate groups of
                  related functions.  Blank lines may be omitted between a bunch of
                  related one-liners (e.g. a set of dummy implementations).
                  
                  Use blank lines in functions, sparingly, to indicate logical
                  sections.
                  
                  Okay: def a():\n    pass\n\n\ndef b():\n    pass
                  Okay: def a():\n    pass\n\n\nasync def b():\n    pass
                  Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
                  Okay: default = 1\nfoo = 1
                  Okay: classify = 1\nfoo = 1
                  
                  E301: class Foo:\n    b = 0\n    def bar():\n        pass
                  E302: def a():\n    pass\n\ndef b(n):\n    pass
                  E302: def a():\n    pass\n\nasync def b(n):\n    pass
                  E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
                  E303: def a():\n\n\n\n    pass
                  E304: @decorator\n\ndef a():\n    pass
                  E305: def a():\n    pass\na()
                  E306: def a():\n    def b():\n        pass\n    def c():\n        pass

                  Line too long (86 > 79 characters)
                  Open

                                  offset (float): offset of the energy due to qubo->ising transformation
                  Severity: Minor
                  Found in openjij/model/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 openjij/model/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

                                      f"Offset or vartype is configured incorrectly. Vartype must be set."
                  Severity: Minor
                  Found in openjij/model/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 (92 > 79 characters)
                  Open

                                          f"Offset or vartype is configured incorrectly. Vartype must be set."
                  Severity: Minor
                  Found in openjij/model/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 openjij/model/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 openjij/model/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

                                      f"Offset or vartype is configured incorrectly. Vartype must be set."
                  Severity: Minor
                  Found in openjij/model/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.

                  Expected 2 blank lines after class or function definition, found 1
                  Open

                  BinaryQuadraticModel.from_qubo = bqm_from_qubo
                  Severity: Minor
                  Found in openjij/model/model.py by pep8

                  Separate top-level function and class definitions with two blank lines.

                  Method definitions inside a class are separated by a single blank
                  line.
                  
                  Extra blank lines may be used (sparingly) to separate groups of
                  related functions.  Blank lines may be omitted between a bunch of
                  related one-liners (e.g. a set of dummy implementations).
                  
                  Use blank lines in functions, sparingly, to indicate logical
                  sections.
                  
                  Okay: def a():\n    pass\n\n\ndef b():\n    pass
                  Okay: def a():\n    pass\n\n\nasync def b():\n    pass
                  Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
                  Okay: default = 1\nfoo = 1
                  Okay: classify = 1\nfoo = 1
                  
                  E301: class Foo:\n    b = 0\n    def bar():\n        pass
                  E302: def a():\n    pass\n\ndef b(n):\n    pass
                  E302: def a():\n    pass\n\nasync def b(n):\n    pass
                  E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
                  E303: def a():\n\n\n\n    pass
                  E304: @decorator\n\ndef a():\n    pass
                  E305: def a():\n    pass\na()
                  E306: def a():\n    def b():\n        pass\n    def c():\n        pass

                  Line too long (99 > 79 characters)
                  Open

                  | The methods and usage are basically the same as `dimod <https://github.com/dwavesystems/dimod>`_.
                  Severity: Minor
                  Found in openjij/model/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 openjij/model/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 openjij/model/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 openjij/model/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 openjij/model/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 (92 > 79 characters)
                  Open

                              offset (float): represents constant energy term when convert to SPIN from BINARY
                  Severity: Minor
                  Found in openjij/model/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 (92 > 79 characters)
                  Open

                                          f"Offset or vartype is configured incorrectly. Vartype must be set."
                  Severity: Minor
                  Found in openjij/model/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 openjij/model/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

                                      kwargs["keys"], kwargs["values"], _to_cxxcimod(kwargs["vartype"])
                  Severity: Minor
                  Found in openjij/model/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 openjij/model/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 openjij/model/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 openjij/model/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

                          offset (float): represents constant energy term when convert to SPIN from BINARY
                  Severity: Minor
                  Found in openjij/model/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

                          You can also use strings and tuples of integers (up to 4 elements) as indices::
                  Severity: Minor
                  Found in openjij/model/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 openjij/model/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_from_dict" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
                  Open

                  def _BinaryPolynomialModel_from_dict(polynomial: dict, vartype):
                  Severity: Major
                  Found in openjij/model/model.py by sonar-python

                  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):
                  Severity: Major
                  Found in openjij/model/model.py by sonar-python

                  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):
                  Severity: Major
                  Found in openjij/model/model.py by sonar-python

                  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):
                  Severity: Major
                  Found in openjij/model/model.py by sonar-python

                  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):
                  Severity: Major
                  Found in openjij/model/model.py by sonar-python

                  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):
                  Severity: Major
                  Found in openjij/model/model.py by sonar-python

                  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" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
                  Open

                  def BinaryPolynomialModel(*args, **kwargs):
                  Severity: Major
                  Found in openjij/model/model.py by sonar-python

                  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):
                  Severity: Major
                  Found in openjij/model/model.py by sonar-python

                  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):
                  Severity: Major
                  Found in openjij/model/model.py by sonar-python

                  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):
                  Severity: Major
                  Found in openjij/model/model.py by sonar-python

                  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_BinaryQuadraticModel" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
                  Open

                  def make_BinaryQuadraticModel(linear: dict, quadratic: dict, sparse):
                  Severity: Major
                  Found in openjij/model/model.py by sonar-python

                  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_BinaryQuadraticModel_from_JSON" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
                  Open

                  def make_BinaryQuadraticModel_from_JSON(obj: dict):
                  Severity: Major
                  Found in openjij/model/model.py by sonar-python

                  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 "BinaryQuadraticModel" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
                  Open

                  def BinaryQuadraticModel(linear, quadratic, *args, **kwargs):
                  Severity: Major
                  Found in openjij/model/model.py by sonar-python

                  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):
                  Severity: Major
                  Found in openjij/model/model.py by sonar-python

                  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