language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | from logging import debug, info, warning, error, exception
import re
from datetime import datetime, timedelta
from .. import AbstractServiceHandler
from data.models import Episode, UnprocessedStream
class ServiceHandler(AbstractServiceHandler):
_show_url = "http://crunchyroll.com/{id}"
_show_re = re.compile("crunch... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_seasonal_streams' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 90
},
{
"issue": "Function 'get_seasonal_streams' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"... | 2 |
python | #!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test re-org scenarios with a mempool that contains transactions
# that spend (directly or indirectly)... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_test' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 36
}
] | 1 |
python | #!/usr/bin/env pytest
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: FlatGeobuf driver test suite.
# Author: Björn Harrtell <bjorn@wololo.org>
#
###############################################################... | Review this code and list any quality issues. | [
{
"issue": "Function 'verify_flatgeobuf_copy' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 44
},
{
"issue": "Function 'verify_flatgeobuf_copy' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
... | 6 |
python | # coding=utf-8
# Copyright 2018 The HuggingFace Inc. team.
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | Review this code and list any quality issues. | [
{
"issue": "Function 'from_pretrained' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 115
}
] | 1 |
python | ## -*- coding: utf-8 -*-
from .vendor.Qt import QtCore, QtGui, QtWidgets
import maya.cmds as cmds
import maya.mel as mel
import maya.OpenMayaUI as OpenMayaUI
import maya.OpenMaya as OpenMaya
import json
import os
def maya_version():
return int(cmds.about(v=True)[:4])
def maya_api_version():
return int(cmds.ab... | Review this code and list any quality issues. | [
{
"issue": "Function 'draw_data_to_multi_line_data' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 56
}
] | 1 |
python | import numpy as np
from cottonwood.core.activation import Tanh
from cottonwood.core.initializers import LSUV
from cottonwood.core.layers.generic_layer import GenericLayer
from cottonwood.core.optimizers import SGD
import cottonwood.core.toolbox as tb
class Dense(GenericLayer):
def __init__(
self,
... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 10
},
{
"issue": "Function '__init__' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 10
}... | 2 |
python | import math
import numpy as np
import tensorflow as tf
from ..learning.nn.injectors import SkipGramInjector
def sensor2vec(num_sensors, sensor_event_list, embedding_size=20,
batch_size=128, num_skips=8, skip_window=5,
num_neg_samples=64, learning_rate=1.0):
"""Sensor to Vector
""... | Review this code and list any quality issues. | [
{
"issue": "Function 'sensor2vec' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 7
},
{
"issue": "Function 'sensor2vec' is 53 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critic... | 6 |
python | # ******************* BLOG MODULE ****************************** #
# ** Created by Yossep
# ** github: https://github.com/j2B237/
# ** Project : Joblogueur
# ** Description:
#
# Within this module we have many functions designed to help display posts
# Methods such as :
# display all posts
# display posts per category
... | Review this code and list any quality issues. | [
{
"issue": "Function 'index' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 109
},
{
"issue": "Function 'post' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line"... | 4 |
python | #!/usr/bin/env python
import random
import argparse
import cv2
import torch
import torch.nn as nn
import torch.optim as optim
from tensorboardX import SummaryWriter
import torchvision.utils as vutils
import gym
import gym.spaces
import numpy as np
log = gym.logger
log.set_level(gym.logger.INFO)
LATENT_VECTOR_SIZE... | Review this code and list any quality issues. | [
{
"issue": "Function 'iterate_batches' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 115
}
] | 1 |
python | # -*- coding: utf8 -*-
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | Review this code and list any quality issues. | [
{
"issue": "Function 'filter_items' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 58
}
] | 1 |
python | """
Harness for visualising a neural network.
-- kandasamy@cs.cmu.edu
"""
# pylint: disable=invalid-name
import functools
import graphviz as gv
import os
import networkx as nx
import numpy as np
# Parameters for plotting
_SAVE_FORMAT = 'eps'
# _SAVE_FORMAT = 'png'
_LAYER_SHAPE = 'rectangle'
_IPOP_SHAPE = 'circle... | Review this code and list any quality issues. | [
{
"issue": "Function 'apply_styles' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 63
},
{
"issue": "Function 'tonxgraph' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"sever... | 3 |
python | import functools
import os
from contextlib import contextmanager
from .platforms.basepath import BasePath, Root, InstallRoot, DestDir # noqa
from .platforms.host import platform_info
Path = platform_info().Path
def abspath(path, type=Path, **kwargs):
return type.abspath(path, **kwargs)
def commonprefix(paths... | Review this code and list any quality issues. | [
{
"issue": "Function 'commonprefix' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 15
}
] | 1 |
python | import argparse
import binascii
import sys
import time
from inkfish.proof_of_time import (create_proof_of_time_wesolowski,
create_proof_of_time_nwesolowski,
create_proof_of_time_pietrzak,
check_proof_of_time_wesolo... | Review this code and list any quality issues. | [
{
"issue": "Function 'pot' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 40
},
{
"issue": "Function 'pot' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 4... | 2 |
python | import pathlib
from ruamel import yaml
from qhub.schema import verify
from qhub.provider.cicd.linter import comment_on_pr
def create_validate_subcommand(subparser):
subparser = subparser.add_parser("validate")
subparser.add_argument(
"configdeprecated",
help="qhub configuration yaml file (dep... | Review this code and list any quality issues. | [
{
"issue": "Function 'handle_validate' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 24
}
] | 1 |
python | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import datetime
import decimal
import io
import uuid
from flask import current_app
from flask import json as _json
from flask import request
from sqlalchemy import types
import arrow
text_type = str
def _wrap_reader_for_text(fp, encoding):
if is... | Review this code and list any quality issues. | [
{
"issue": "Function 'default' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 65
},
{
"issue": "Function 'jsonify' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": ... | 2 |
python | """An implementation of Matching Layer."""
import typing
import tensorflow as tf
from tensorflow.keras import layers
class MatchingLayer(layers.Layer):
"""
Layer that computes a matching matrix between samples in two tensors.
:param normalize: Whether to L2-normalize samples along the
dot produc... | Review this code and list any quality issues. | [
{
"issue": "Function 'call' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 67
},
{
"issue": "Function 'compute_output_shape' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"s... | 2 |
python | # SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2021 Scipp contributors (https://github.com/scipp)
# @author Neil Vaytet
from .. import config
from ..core import concatenate, values, dtype, units, nanmin, nanmax, histogram, \
full_like
from ..core import Variable, DataArray
from ..core import abs as ab... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse_params' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 48
},
{
"issue": "Function 'parse_params' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "... | 2 |
python | # Copyright 2012 Google Inc. All Rights Reserved.
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Review this code and list any quality issues. | [
{
"issue": "Function 'store_score' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 29
},
{
"issue": "Function 'update_assessment_transaction' has 5 parameters. Consider using a parameter object to reduce arity.",
"severi... | 2 |
python | #
# Copyright (c) 2015 Juniper Networks, Inc. All rights reserved.
#
#!/usr/bin/python
doc = """\
Node manager listens to process state change events and
other flag value change events to provide advanced service
management functionality.
Rules files looks like following:
====================
{ "Rules": [
{"pro... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 26 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 61
},
{
"issue": "Function 'main' is 170 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 2 |
python | # Copyright 2012 Nebula, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | Review this code and list any quality issues. | [
{
"issue": "Function 'validate_steps' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 148
},
{
"issue": "Function 'post' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"li... | 3 |
python | import argparse
import os
import numpy as np
import tensorflow as tf
from matplotlib import pyplot as plt
from PIL import Image
import models
def predict(model_data_path, image_path):
# Default input size
height = 228
width = 304
channels = 3
batch_size = 1
# Read image
img = Image.o... | Review this code and list any quality issues. | [
{
"issue": "Function 'predict' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 10
}
] | 1 |
python | import inspect
import io
import json
import logging as logginglib
import sys
from datetime import datetime
from typing import Any, Callable, Dict, List, Optional, Set, TextIO, Tuple
from typing_extensions import Literal
from hpc.autoscale import hpclogging as logging
from hpc.autoscale.codeanalysis import hpcwrapclas... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 22
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line"... | 8 |
python | from __future__ import absolute_import
import numpy as np
from scipy.spatial import Delaunay
from spektral.utils import label_to_one_hot, numpy_to_nx
RETURN_TYPES = {'numpy', 'networkx'}
MAX_K = 7 # Maximum number of nodes in a graph
def generate_data(return_type='networkx', classes=0, n_samples_in_class=1000,
... | Review this code and list any quality issues. | [
{
"issue": "Function 'generate_data' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 12
},
{
"issue": "Function 'generate_data' is 56 lines long. Functions over 25 lines are harder to test and maintain.",
"severity":... | 3 |
python | #
# Copyright (c) 2009 Testrepository Contributors
#
# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
# license at the users choice. A copy of both licenses are available in the
# project source as Apache-2.0 and BSD. You may not use this file except in
# compliance with one of these two lice... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 36
},
{
"issue": "Function '_format_error' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 51
},
{
... | 12 |
python | #!/usr/bin/env python
import argparse
import os,time
import numpy as np
from astropy.io import fits
from astropy.table import Table
from pypeit import msgs
from pypeit.par.util import make_pypeit_file
class SmartFormatter(argparse.HelpFormatter):
def _split_lines(self, text, width):
if text.startswith('R... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 18 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 41
},
{
"issue": "Function 'main' is 88 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"... | 2 |
python | from django.contrib.admin import ModelAdmin
from django.contrib.gis.admin.widgets import OpenLayersWidget
from django.contrib.gis.gdal import OGRGeomType
from django.contrib.gis.db import models
class GeoModelAdmin(ModelAdmin):
"""
The administration options class for Geographic models. Map settings
may be... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_map_widget' is 43 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 63
}
] | 1 |
python | ######################################################################
# Copyright
# John Holland <john@zoner.org>
# All rights reserved.
#
# This software is licensed as described in the file LICENSE.txt, which
# you should have received as part of this distribution.
#
##############################################... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 23
},
{
"issue": "Function '_set_value' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 26
},
{
... | 4 |
python | load(
"//haskell:providers.bzl",
"HaskellInfo",
"HaskellLibraryInfo",
)
load(":private/set.bzl", "set")
def gather_dep_info(ctx, deps):
"""Collapse dependencies into a single `HaskellInfo`.
Args:
ctx: Rule context.
deps: deps attribute.
Returns:
HaskellInfo: Unified informat... | Review this code and list any quality issues. | [
{
"issue": "Function 'gather_dep_info' has cyclomatic complexity 22 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 8
},
{
"issue": "Function 'gather_dep_info' is 79 lines long. Functions over 25 lines are harder to test and maintain.",
"severit... | 2 |
python | # -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2020, David Swarbrick.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation ... | Review this code and list any quality issues. | [
{
"issue": "Function '_test_img_resize' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 49
}
] | 1 |
python | # Copyright (C) 2019-2020, Therapixel SA.
# All rights reserved.
# This file is subject to the terms and conditions described in the
# LICENSE file distributed in this package.
"""The dcm2model module provides methods that can be used to convert pydicom.Dataset
instances to sqlalchemy instances.
"""
from typing import ... | Review this code and list any quality issues. | [
{
"issue": "Function 'dcm2image' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 140
}
] | 1 |
python | from typing import Callable, Optional
import gin
import gym
from interact.agents.ddpg.ddpg import DDPGAgent
from interact.agents.utils import register
@gin.configurable(name_or_fn="td3", denylist=["env_fn"])
@register("td3")
class TD3Agent(DDPGAgent):
"""The Twin Delayed DDPG (TD3) algorithm.
This algorith... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 63 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 66
},
{
"issue": "Function '__init__' has 30 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 66
... | 2 |
python | # Copyright (c) 2022, Leonardo Lamanna
# All rights reserved.
# This source code is licensed under the MIT-style license found in the
# LICENSE file in the root directory of this source tree.
import pandas as pd
import os
pd.options.display.max_colwidth = 100
def generate_latex_table(data_file, labels, tab_name, ca... | Review this code and list any quality issues. | [
{
"issue": "Function 'generate_latex_table' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 12
},
{
"issue": "Function 'generate_domain_objects_table' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
... | 3 |
python | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------------------... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 18 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 71
}
] | 1 |
python | import py
import sys, shutil, os
from rpython.tool.udir import udir
from pypy.interpreter.gateway import interp2app
from pypy.module._cffi_backend.newtype import _clean_cache
if sys.platform == 'win32':
WIN32 = True
else:
WIN32 = False
class AppTestRecompilerPython:
spaceconfig = dict(usemodules=['_cffi_b... | Review this code and list any quality issues. | [
{
"issue": "Function 'setup_class' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 15
},
{
"issue": "Function 'setup_class' is 86 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major"... | 2 |
python | """
Tests the continuous link flap in SONiC.
Parameters:
--orch_cpu_threshold <port> (int): Which port you want the test to send traffic
to. Default is 3.
"""
import logging
import time
import pytest
from tests.common.helpers.assertions import pytest_assert, pytest_require
from tests.common import port_t... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_cont_link_flap' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 30
},
{
"issue": "Function 'test_cont_link_flap' is 67 lines long. Functions over 25 lines are harder to test and maintain.",
... | 3 |
python | # -*- coding: utf-8 -*-
import os
import sys
from news_crawler.spiders import BaseSpider
from scrapy.spiders import Rule
from scrapy.linkextractors import LinkExtractor
from datetime import datetime
sys.path.insert(0, os.path.join(os.getcwd(), "..",))
from news_crawler.items import NewsCrawlerItem
from new... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse_item' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 42
},
{
"issue": "Function 'parse_item' is 43 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",... | 2 |
python | #!/usr/bin/env python
"""Copyright (c) 2005-2019, University of Oxford.
All rights reserved.
University of Oxford means the Chancellor, Masters and Scholars of the
University of Oxford, having an administrative office at Wellington
Square, Oxford OX1 2JD, UK.
This file is part of Chaste.
Redistribution and use in ... | Review this code and list any quality issues. | [
{
"issue": "Function 'coverage_ignore' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 127
}
] | 1 |
python | #!/usr/bin/env python3
""" Health authority back end REST and static content server """
__copyright__ = """
Copyright 2020 Diomidis Spinellis
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 L... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 121
}
] | 1 |
python | import matplotlib as mp
import pandas as pd
import seaborn as sb
import report.config as config
from ..util import create_file, sort_dataframe
from .util import savefig, set_scales, set_labels, task_labels
def draw_parallel_coord(df, class_column,
x_labels=True, yscale='linear',
... | Review this code and list any quality issues. | [
{
"issue": "Function 'draw_parallel_coord' has 10 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 10
},
{
"issue": "Function 'draw_score_parallel_coord' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critic... | 2 |
python | async def greet(ctx):
greetings = [
"Ahn nyong ha se yo",
"Ahn-nyong-ha-se-yo",
"Ahoj",
"An-nyŏng-ha-se-yo",
"As-salamu alaykum",
"Assalamo aleikum",
"Assalamualaikum",
"Avuxeni",
"Bonġu",
"Bonjour",
"Bună ziua",
"Ciao",... | Review this code and list any quality issues. | [
{
"issue": "Function 'greet' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 1
},
{
"issue": "Function 'greet' is 88 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line":... | 2 |
python | """
Utility functions using the pyesgf package.
"""
import sys
from urllib.parse import quote_plus
def ats_url(base_url):
"""
Return the URL for the ESGF SAML AttributeService
"""
# Strip '/' from url as necessary
base_url = base_url.rstrip('/')
return '/'.join([base_url,
... | Review this code and list any quality issues. | [
{
"issue": "Function 'urlencode' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 56
},
{
"issue": "Function 'urlencode' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | import torch
from .elliptical_slice import EllipticalSliceSampler
class MeanEllipticalSliceSampler(EllipticalSliceSampler):
def __init__(self, f_init, dist, lnpdf, nsamples, pdf_params=()):
"""
Implementation of elliptical slice sampling (Murray, Adams, & Mckay, 2010).
f_init: initial val... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 7
}
] | 1 |
python | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 39
},
{
"issue": "Function '_registries_delete_initial' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"l... | 3 |
python | # -*- coding: utf-8 -*-
# Copyright (c) 2020-2021 Salvador E. Tropea
# Copyright (c) 2020-2021 Instituto Nacional de Tecnologïa Industrial
# License: Apache 2.0
# Project: KiAuto (formerly kicad-automation-scripts)
import os
import re
import json
import configparser
from contextlib import contextmanager
from sys import... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 18 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 57
},
{
"issue": "Function '__init__' is 118 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critica... | 2 |
python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
####################################################################################################################################################################################################################################
############################################... | Review this code and list any quality issues. | [
{
"issue": "Function 'initializationCode' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 125
},
{
"issue": "Function 'determineNextMove' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line"... | 2 |
python | import get_coefficients_as_list
import check_diagonal_dominant
# function that computes in gauss jacobi method
def gauss_jacobi(no_of_unknowns):
coefficient_list = get_coefficients_as_list.get_coefficients_as_list(no_of_unknowns)
if check_diagonal_dominant.is_diagonally_dominant(coefficient_list):
print("Compu... | Review this code and list any quality issues. | [
{
"issue": "Function 'gauss_jacobi' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 5
}
] | 1 |
python | # Copyright (c) 2015 Huawei Technologies Co., Ltd.
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | Review this code and list any quality issues. | [
{
"issue": "Function 'revert' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 58
},
{
"issue": "Function 'revert' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 162
},
{
"issu... | 6 |
python | #
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.
#
import sys
import os
import logging
import json
import test_case
from vnc_api.exceptions import NoIdError, RefsExistError
from vnc_api.gen.resource_client import *
from vnc_api.gen.resource_xsd import *
from vnc_api.utils import obj_type_to_vnc_class
... | Review this code and list any quality issues. | [
{
"issue": "Function 'setUpClass' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 195
}
] | 1 |
python | #main game section
# %%
plansza_do_gry = {'7':' ','8':' ','9':' ',
'4':' ','5':' ','6':' ',
'1':' ','2':' ','3':' '}
klawisze_gry=[]
for key in plansza_do_gry:
klawisze_gry.append(key)
# print(klawisze_gry)
def drukuj_plansze(pole):
print(f"{pole['7']} | {pole['8']} | {p... | Review this code and list any quality issues. | [
{
"issue": "Function 'gra' has cyclomatic complexity 17 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 24
},
{
"issue": "Function 'gra' is 65 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"li... | 2 |
python | from functools import partial
from unittest.mock import Mock, patch
import graphene
import pytest
from django.contrib.auth.models import AnonymousUser
from django.db.models import Q
from django.shortcuts import reverse
from graphql.error import GraphQLError
from graphql_relay import to_global_id
from ...core.utils im... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_jwt_middleware' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 31
},
{
"issue": "Function 'test_real_query' is 146 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",... | 3 |
python | import numpy
import os
import math
from azureml.core.model import Model
from azureml.core.dataset import Dataset
from inference_schema.schema_decorators \
import input_schema, output_schema
from inference_schema.parameter_types.numpy_parameter_type \
import NumpyParameterType
import keras
from keras.m... | Review this code and list any quality issues. | [
{
"issue": "Function 'run' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 95
},
{
"issue": "Function 'run' is 56 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 95... | 2 |
python | from basic_functions import *
import csv
from collections import deque
inf = 1000
def table_phase0():
trans_ep = []
with open('trans_ep_phase0.csv', mode='r') as f:
for line in map(str.strip, f):
trans_ep.append([int(i) for i in line.replace('\n', '').split(',')])
trans = []
w... | Review this code and list any quality issues. | [
{
"issue": "Function 'table_phase0' has cyclomatic complexity 41 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 7
},
{
"issue": "Function 'table_phase0' is 90 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "c... | 4 |
python | def numOfAbled(L,k):
hori=0
verti=0
for i in range(len(L)):
for j in range(len(L)-k+1):
num=0
for m in range(k):
if L[i][j+m]!=1:
break
else :
num+=1
if num==k:
if j==len(L)-k:... | Review this code and list any quality issues. | [
{
"issue": "Function 'numOfAbled' has cyclomatic complexity 23 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 1
},
{
"issue": "Function 'numOfAbled' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "criti... | 2 |
python | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from poetry.poetry import Poetry
from poetry.utils._compat import Path
from poetry.utils.toml_file import TomlFile
fixtures_dir = Path(__file__).parent / "fixtures"
def test_poetry():
poetry = Poetry.create(s... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_poetry' is 77 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 13
}
] | 1 |
python | #! python
"""
Modified version of barcode report for use on CCS inputs
"""
from pprint import pformat
import functools
import logging
import json
import os.path as op
import sys
from pbcommand.models import DataStore, FileTypes
from pbcommand.models.report import PlotGroup
from pbcommand.cli import pbparser_runner
f... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_to_report' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 67
},
{
"issue": "Function 'run_to_report' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"lin... | 2 |
python | #!/usr/bin/python3
# mari von steinkirch @2013
# steinkirch at gmail
def find_edit_distance(str1, str2):
''' computes the edit distance between two strings '''
m = len(str1)
n = len(str2)
diff = lambda c1, c2: 0 if c1 == c2 else 1
E = [[0] * (n + 1) for i in range(m + 1)]
for i in range(m + 1):
E[i][0] = i
f... | Review this code and list any quality issues. | [
{
"issue": "Function 'find_edit_distance' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 6
}
] | 1 |
python | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import pathlib
from collections import namedtuple
import torchaudio
import shutil
Speaker = namedtuple('Speaker', ['id', 'gender', 'subset'])
FileRecord = namedtuple(
'FileRecord', ['fname', 'length', 'speaker', 'book', 'text_file'])
def get... | Review this code and list any quality issues. | [
{
"issue": "Function 'materialize' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 91
}
] | 1 |
python |
"""
# BEGIN TAG_DEMO
>>> tag('br') # <1>
'<br />'
>>> tag('p', 'hello') # <2>
'<p>hello</p>'
>>> print(tag('p', 'hello', 'world'))
<p>hello</p>
<p>world</p>
>>> tag('p', 'hello', id=33) # <3>
'<p id="33">hello</p>'
>>> print(tag('p', 'hello', 'world', cls='sidebar')) # <4>
<p class="sidebar">hello</p>
<p class="s... | Review this code and list any quality issues. | [
{
"issue": "Function 'tag' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 29
}
] | 1 |
python | """Entity for Zigbee Home Automation."""
from __future__ import annotations
import asyncio
from collections.abc import Callable
import functools
import logging
from typing import TYPE_CHECKING, Any
from homeassistant.const import ATTR_NAME
from homeassistant.core import CALLBACK_TYPE, Event, callback
from homeassista... | Review this code and list any quality issues. | [
{
"issue": "Function 'async_accept_signal' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 129
},
{
"issue": "Function 'log' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 147
},
... | 6 |
python | # Copyright 2012 New Dream Network, LLC (DreamHost)
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | Review this code and list any quality issues. | [
{
"issue": "Function 'add_command_parsers' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 115
}
] | 1 |
python | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 52
}
] | 1 |
python | import pandas as pd
import numpy as np
import statsmodels.api as sm
from enum import Enum
class ParValue(Enum):
TSTAT = 1
PVALUE = 2
STD = 3
class OneReg:
def __init__(self, reg, show_list=[], hide_list=[], blocks=[], bottom_blocks=[]):
self.reg = reg
if show_list == []:
se... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 12
},
{
"issue": "Function 'create_columns' has cyclomatic complexity 20 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
... | 10 |
python | # Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import
import os
import subprocess
import tempfile
from subprocess import CalledProcessError
from textwrap import dedent
import pytest
from pex.common im... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_venv_pex' is 52 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 136
},
{
"issue": "Function 'test_binary_path' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 3 |
python | from sklearn import tree
from sklearn import preprocessing
from sklearn.model_selection import cross_val_score
from sklearn.metrics import mean_absolute_error, f1_score
import pandas as pd
from pandas.api.types import (
is_numeric_dtype,
is_bool_dtype,
is_categorical_dtype,
is_string_dtype,
is_date... | Review this code and list any quality issues. | [
{
"issue": "Function '_calculate_model_cv_score_' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 32
},
{
"issue": "Function '_infer_task' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity... | 6 |
python |
#
# Py-Alpha-AMD Registration Framework
# Author: Johan Ofverstedt
# Reference: Fast and Robust Symmetric Image Registration Based on Distances Combining Intensity and Spatial Information
#
# Copyright 2019 Johan Ofverstedt
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this softwa... | Review this code and list any quality issues. | [
{
"issue": "Function 'initialize' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 174
},
{
"issue": "Function 'initialize' is 43 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",... | 4 |
python | import argparse
import discretisedfield as df
def convert_files(input_files, output_files):
for input_file, output_file in zip(input_files, output_files):
field = df.Field.fromfile(input_file)
field.write(output_file)
def main():
parser = argparse.ArgumentParser(
prog='ovf2vtk',
... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 11
}
] | 1 |
python | # Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
import re # noqa: F401
import sys # noqa: F401
from datadog_api_client.v2.model_uti... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 106
},
{
"issue": "Function '__init__' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 3 |
python | # Copyright 2017 Google Inc. All Rights Reserved.
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | Review this code and list any quality issues. | [
{
"issue": "Function 'testGetIterator' is 74 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 31
},
{
"issue": "Function 'testGetIteratorWithShard' is 62 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "maj... | 4 |
python | import os
import matplotlib
import json
from datetime import datetime
from matplotlib import pyplot
def show_results_graph(timer, name=None):
with (open('light_plot.json', 'r')) as f:
data = json.load(f)
with (open('light_plot_imporved.json', 'r')) as f:
data_improved = json.load(f)
os.r... | Review this code and list any quality issues. | [
{
"issue": "Function 'show_results_graph' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 8
}
] | 1 |
python | #
#
#
import unittest, sys
import IfxPy
import config
from testfunctions import IfxPyTestFunctions
class IfxPyTestCase(unittest.TestCase):
def test_148_CallSPDiffBindPattern_01(self):
obj = IfxPyTestFunctions()
obj.assert_expect(self.run_test_148)
def run_test_148(self):
conn = IfxPy.connect(conf... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_test_148' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 18
}
] | 1 |
python | import multiprocessing
import random
import time
from pysys.constants import *
from xpybuild.xpybuild_basetest import XpybuildBaseTest
class PySysTest(XpybuildBaseTest):
buildRoot = None # can override this with -XbuildRoot=path to measure your own build
def execute(self):
buildroot = self.buildRoot if self.buil... | Review this code and list any quality issues. | [
{
"issue": "Function 'execute' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 11
},
{
"issue": "Function 'execute' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"... | 2 |
python | import enum
from typing import Any
import click
import pandas as pd
import numpy as np
import structlog
import pathlib
import pydantic
import datetime
import zoltpy.util
from covidactnow.datapublic import common_init, common_df
from scripts import helpers
from covidactnow.datapublic.common_fields import (
GetB... | Review this code and list any quality issues. | [
{
"issue": "Function 'transform' is 47 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 115
},
{
"issue": "Function 'get_latest_forecast_date' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severi... | 2 |
python | import numpy as np
import random
import copy
from collections import namedtuple, deque
import torch
import torch.nn.functional as F
import torch.optim as optim
from model_ddpg import Actor, Critic
from replay_buffer import ReplayBuffer, PrioritizedReplayBuffer
BUFFER_SIZE = int(1e6) # replay buffer size
START_SIZE = ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 28
},
{
"issue": "Function 'get_critic_Q' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 67
},
{... | 8 |
python | from flask import url_for
from app.questionnaire.rules import evaluate_skip_conditions
from app.templating.summary.question import Question
class Block:
def __init__(self, block_schema, group_id, answer_store, metadata, schema, group_instance):
self.id = block_schema['id']
self.title = block_sch... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 9
},
{
"issue": "Function '_build_questions' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 27
}
] | 2 |
python | # ------------------------------------------------------------------------------
# CodeHawk Binary Analyzer
# Author: Henny Sipma
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2021 Aarno Labs LLC
#
# Permission is hereby granted, free of ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 61
},
{
"issue": "Function 'get' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 127... | 4 |
python | import unittest
from unittest.mock import MagicMock
from samsung_multiroom.service import REPEAT_ALL
from samsung_multiroom.service import REPEAT_OFF
from samsung_multiroom.service.tunein import TuneInPlayer
def _get_player():
api = MagicMock()
api.get_preset_list.return_value = [
{
'kind... | Review this code and list any quality issues. | [
{
"issue": "Function '_get_player' is 59 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 9
},
{
"issue": "Function 'test_play' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 87
... | 2 |
python | #Based on gerthvh's menu_8button.py
#BlockComPhone PitftGraphicLib v0.1 For Portrait Pitft Only
import sys, pygame
from pygame.locals import *
import time
import subprocess
import os
from subprocess import *
#os.system('adafruit-pitft-touch-cal -f') #Confirm orentation #But TOO Laggy
os.environ["SDL_FBDEV"] =... | Review this code and list any quality issues. | [
{
"issue": "Function 'make_button' has 9 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 65
},
{
"issue": "Function 'make_label' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 76
},
... | 3 |
python | from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D
from tensorflow.keras.layers import MaxPooling2D
from tensorflow.keras.layers import Activation
from tensorflow.keras.layers import Flatten
from tensorflow.keras.layers import Dense
from tensorflow.keras import backend as K
clas... | Review this code and list any quality issues. | [
{
"issue": "Function 'build' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 12
}
] | 1 |
python | # -*- coding: utf-8 -*-
import os
import sys
from ..common.file import get_file_name
from ..common.log import logger
def add_sys_path(file_path: str, project_name: str):
if not os.path.exists(file_path):
raise FileNotFoundError("{} not found".format(file_path))
flag = False
parent_path = os.path.... | Review this code and list any quality issues. | [
{
"issue": "Function 'add_sys_path' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 9
}
] | 1 |
python | import os
import enum
from typing import Counter
from sqlalchemy import Column, String, Integer, create_engine
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 70
},
{
"issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 124
},
{
"... | 5 |
python | # -*- coding: UTF-8 -*-
import sys
import logging
import argparse
import shutil
from typing import Dict, List
from echoscope.util import file_util, log_util
from echoscope.config import config
from echoscope.model import config_model
from echoscope.source import source, mysql_source, clickhouse_source
from echoscope... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 56
}
] | 1 |
python | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.14.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteri... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_dict' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 75
}
] | 1 |
python | from diagrams import Cluster, Diagram
from graphviz import Digraph
from .PipelineNode import PipelineNode
import sklearn
from sklearn import *
import regex as re
import warnings
#warnings.filterwarnings("ignore")
class PipelineDiagram:
def __init__(self, pipeline, file_name='ml_pipeline.png'):
self.pipe =... | Review this code and list any quality issues. | [
{
"issue": "Function 'find_category' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 50
}
] | 1 |
python | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 24 21:46:41 2019
You are not expected to understand my codes!
@Author: Kotori_Y
@Blog: blog.moyule.me
@Weibo: Kotori-Y
@Mail: yzjkid9@gmail.com
I love Megumi forerver!
"""
print(__doc__)
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection ... | Review this code and list any quality issues. | [
{
"issue": "Function 'Selection' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 118
}
] | 1 |
python | from six import iteritems, itervalues
from collections import OrderedDict, MutableMapping, Iterable
from functools import wraps
import anvil.config as cfg
def to_list(query):
if isinstance(query, list):
return query
elif isinstance(query, str):
return [query]
elif isinstance(query, dict):
... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_list' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 7
},
{
"issue": "Function 'gen_flatten_dict_depth_two' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",... | 3 |
python | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/04b_classification.model.meta_arch.common.ipynb (unless otherwise specified).
__all__ = ['GeneralizedImageClassifier']
# Cell
import logging
from collections import namedtuple
from typing import *
import torch
from omegaconf import DictConfig, OmegaConf
from pytorch_li... | Review this code and list any quality issues. | [
{
"issue": "Function 'from_config_dict' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 62
},
{
"issue": "Function 'from_config_dict' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity... | 2 |
python | from util import getPrime, inv, gcd
from random import randrange
from time import time
from datetime import timedelta
def gen_keys():
p = getPrime(512)
q = getPrime(512)
p_s = p ** 2
n = p_s * q
phi = (p_s - p) * (q - 1)
e = randrange(1, phi)
g = gcd(e, phi)
while g != 1:
e = r... | Review this code and list any quality issues. | [
{
"issue": "Function 'hensel' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 34
}
] | 1 |
python | import pygame # importa a biblioteca Pygame
import random # importa a biblioteca Random
from audioplayer import AudioPlayer
inicio = False
source = "/home/joao/Arquivos/jogoCobrinha/"
# Começar partida
def iniciar(inicio, tela, fonte, texto):
texto = fonte.render("Pressione T para iniciar: ", True, cor_pontos)
... | Review this code and list any quality issues. | [
{
"issue": "Function 'mover_cobra' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 102
},
{
"issue": "Function 'mover_cobra' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "majo... | 4 |
python | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_dialog_report_compare_coder_file.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog_reportCompareCoderFile(object):
... | Review this code and list any quality issues. | [
{
"issue": "Function 'setupUi' is 81 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 14
}
] | 1 |
python | import logging
import json
from django.shortcuts import render,HttpResponse
from django.http import Http404
from django.views import View
from django.core.paginator import Paginator,EmptyPage,PageNotAnInteger
from . import models
from . import constants
from utils.json_fun import to_json_data
from utils.res_code import... | Review this code and list any quality issues. | [
{
"issue": "Function 'get' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 56
},
{
"issue": "Function 'get' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 56... | 4 |
python | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 10 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 47
}
] | 1 |
python | import logging
from django.conf import settings
from django_elasticsearch_dsl import DocType, Index, fields
from elasticsearch import Elasticsearch
from readthedocs.projects.models import HTMLFile, Project
project_conf = settings.ES_INDEXES['project']
project_index = Index(project_conf['name'])
project_index.setting... | Review this code and list any quality issues. | [
{
"issue": "Function 'prepare_domains' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 101
}
] | 1 |
python | import argparse
from packaging.version import Version
from pdm import termui
from pdm.cli.commands.base import BaseCommand
from pdm.exceptions import PdmUsageError
from pdm.models.candidates import Candidate
from pdm.models.project_info import ProjectInfo
from pdm.models.requirements import parse_requirement
from pdm... | Review this code and list any quality issues. | [
{
"issue": "Function 'handle' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 37
},
{
"issue": "Function 'handle' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"li... | 2 |
python | from .LagrangePolynomial import LagrangeExpand
from pytorch_lightning import LightningModule, Trainer
from high_order_layers_torch.PolynomialLayers import *
from torch.nn import Conv2d
import torch.nn as nn
import torch
from .utils import *
def conv2d_wrapper(
in_channels: int,
out_channels: int,
kernel_... | Review this code and list any quality issues. | [
{
"issue": "Function 'conv2d_wrapper' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 11
},
{
"issue": "Function 'conv2d_wrapper' has 12 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"... | 6 |
python | import os
import yaml
import asyncio
import platform
from functools import lru_cache
from typing import List, Dict, Coroutine, Union
from . import info
from . import common
def get_path_fname() -> str:
"""
Return the file name that stores the repo locations.
"""
root = common.get_config_dir()
ret... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_repos' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 21
}
] | 1 |
python | #!/usr/bin/env python3
# Requires PyAudio and PySpeech and more.
import speech_recognition as sr
from time import ctime
import time
import os
from gtts import gTTS
import random
from pygame import mixer
from pyicloud import PyiCloudService
from datetime import date
import re
from re import findall, finditer
from urlli... | Review this code and list any quality issues. | [
{
"issue": "Function 'jarvis' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 84
},
{
"issue": "Function 'jarvis' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"lin... | 2 |
python | # -*- coding: utf-8 -*-
"""
pyrseas.column
~~~~~~~~~~~~~~
This module defines two classes: Column derived from
DbSchemaObject and ColumnDict derived from DbObjectDict.
"""
from pyrseas.dbobject import DbObjectDict, DbSchemaObject, quote_id
class Column(DbSchemaObject):
"A table column definition"... | Review this code and list any quality issues. | [
{
"issue": "Function 'diff_map' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 93
},
{
"issue": "Function 'diff_map' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity"... | 2 |
python | # -*- coding: utf-8 -*-
import hashlib
from unittest.mock import MagicMock
from asyncy.AppConfig import Expose
from asyncy.Containers import Containers
from asyncy.Exceptions import ActionNotFound, ContainerSpecNotRegisteredError,\
EnvironmentVariableNotFound, K8sError
from asyncy.Kubernetes import Kubernetes
from... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_get_container_name' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 51
},
{
"issue": "Function 'test_start' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "m... | 5 |
python | """
Interface to a test suite module (one or more runs) used by ProductModelProgram
"""
from operator import concat
from .model import Model
from functools import reduce
class TestSuite(Model):
def __init__(self, module, exclude, include):
Model.__init__(self, module, exclude, include)
def post_init(self):
... | Review this code and list any quality issues. | [
{
"issue": "Function 'post_init' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 14
}
] | 1 |
python | from __future__ import annotations
import string
from dataclasses import dataclass
from typing import Any, Tuple
from expression import Error, Nothing, Ok, Option, Some, TaggedUnion, match, pipe, tag
from expression.collections import Block
from expression.extra.parser import (
Parser,
and_then,
any_of,
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_pstring' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 83
}
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.