Showing 24 of 52 total issues
Avoid too many return
statements within this function. Open
return False
Function _make_layer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _make_layer(self, block, planes, blocks, stride=1, dilation=1,
new_level=True, residual=True):
assert dilation == 1 or dilation % 2 == 0
downsample = None
if stride != 1 or self.inplanes != planes * block.expansion:
- 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 update_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_path(self,board):
color = board.color_to_move()
# leaf node, either terminal or unvisited
if len(self.children)==0:
- 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_kfen_history
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sample_kfen_history(game,k=4):
num_moves = len([0 for _ in game.mainline()])
if num_moves <=1: raise StopIteration("Not enough moves in the pgn")
sampled_move_id = np.random.randint(num_moves-1)#exclude checkmates
start_board_fen = chess.Board().fen()
- 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"