Showing 55 of 487 total issues
Function make_ChimeraModel
has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring. Open
def make_ChimeraModel(linear, quadratic):
"""ChimeraModel factory.
Returns:
generated ChimeraModel class
- Read upRead up
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 sample
has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring. Open
def sample(
self,
bqm: Union[
"openj.model.model.BinaryQuadraticModel", dimod.BinaryQuadraticModel
],
- Read upRead up
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
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:
- Read upRead up
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_KingGraph
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
def make_KingGraph(linear=None, quadratic=None, king_graph=None):
"""KingGraph factory
Returns:
generated KingGraph class
- Read upRead up
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 sa_sampler.py
has 501 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
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
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:
- Read upRead up
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:
- Read upRead up
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 _sample_hubo_old
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def _sample_hubo_old(
self,
J: Union[
dict, "openj.model.model.BinaryPolynomialModel", cimod.BinaryPolynomialModel
],
- Read upRead up
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 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
- Read upRead up
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 sample
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def sample(
self,
bqm: Union[
"openjij.model.model.BinaryQuadraticModel", dimod.BinaryQuadraticModel
],
- Read upRead up
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 chimera_model.py
has 285 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
File sqa_sampler.py
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
from __future__ import annotations
try:
from typing import Optional, Union
except ImportError:
from typing_extensions import Optional, Union
Function convert_response
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def convert_response(response):
if isinstance(response, oj.sampler.response.Response):
return response
try:
- Read upRead up
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 and "vartype" in kwargs:
key_condition = isinstance(kwargs["keys"], list) or isinstance(
kwargs["keys"], tuple
)
val_condition = isinstance(kwargs["values"], list) or isinstance(
Function sample
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def sample(
Function base_sample_hubo
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def base_sample_hubo(
Function sample_hubo
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def sample_hubo(
Function _sample_hubo_old
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def _sample_hubo_old(
Function sample
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def sample(