language
stringclasses
1 value
code
stringlengths
407
33.3k
instruction
stringclasses
1 value
flaws
listlengths
1
17
flaw_count
int64
1
17
python
# https://leetcode.com/problems/design-twitter/ # # algorithms # Medium (27.98%) # Total Accepted: 37,655 # Total Submissions: 134,594 from collections import defaultdict from bisect import insort class Twitter(object): def __init__(self): """ Initialize your data structure here. """...
Review this code and list any quality issues.
[ { "issue": "Function 'unfollow' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 74 } ]
1
python
#!/usr/bin/env python # # Public Domain 2014-2017 MongoDB, Inc. # Public Domain 2008-2014 WiredTiger, Inc. # # This is free and unencumbered software released into the public domain. # # Anyone is free to copy, modify, publish, use, compile, sell, or # distribute this software, either in source code form or as a compil...
Review this code and list any quality issues.
[ { "issue": "Function 'check' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 65 }, { "issue": "Function 'check' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 65 ...
4
python
from SDWLE.cards.base import HeroCard from SDWLE.constants import CHARACTER_CLASS, MINION_TYPE from SDWLE.powers import MagePower, DruidPower, HunterPower, PaladinPower, PriestPower, RoguePower,\ ShamanPower, WarlockPower, WarriorPower, JaraxxusPower, DieInsect class Malfurion(HeroCard): def __init__(self): ...
Review this code and list any quality issues.
[ { "issue": "Function 'hero_for_class' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 63 } ]
1
python
r"""Compute action detection performance for the AVA dataset. Please send any questions about this code to the Google Group ava-dataset-users: https://groups.google.com/forum/#!forum/ava-dataset-users Example usage: python -O get_ava_performance.py \ -l ava/ava_action_list_v2.1_for_activitynet_2018.pbtxt.txt \ -g...
Review this code and list any quality issues.
[ { "issue": "Function 'read_csv' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 41 }, { "issue": "Function 'read_csv' is 32 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", ...
4
python
import logging import asyncio from asyncio import CancelledError from aiohttp import ClientSession, WSMsgType, ClientTimeout, WSServerHandshakeError import json import datetime import traceback import typing from .const import ( LOGIN_URL, DEX_URL, Guid ) from .space import NoonSpace from .line import NoonL...
Review this code and list any quality issues.
[ { "issue": "Function 'authenticate' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 86 }, { "issue": "Function 'authenticate' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "mino...
6
python
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # Modified by BaseDetection, Inc. and its affiliates. All Rights Reserved """ Detection Training Script. This scripts reads a given config file and runs the training or evaluation. It is an entry point that is made to train standard models in cvpod...
Review this code and list any quality issues.
[ { "issue": "Function 'build_evaluator' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 48 }, { "issue": "Function 'stage_main' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", ...
4
python
import importlib import json import os import shutil import subprocess from pathlib import Path from shutil import which from typing import List, Optional, Tuple from setuptools import find_packages from typer import Argument, Option, Typer from .paths import ( GLOBAL_APP_DIR, GLOBAL_EXTENSIONS_DIR, GLOBA...
Review this code and list any quality issues.
[ { "issue": "Function '_build_extension' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 218 }, { "issue": "Function '_get_extensions_metadata' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller fun...
2
python
from flask import Flask, render_template, request import json import requests app = Flask(__name__) @app.route('/') def stop_words(): URL_prefix = 'https://api.github.com/search/code?q=' URL_suffix = '+repo:spotify/mkdocs-monorepo-plugin/docs' reportfile = open('./templates/stopWordsSearch.html', 'w') ...
Review this code and list any quality issues.
[ { "issue": "Function 'stop_words' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 8 }, { "issue": "Function 'stop_words' is 67 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", ...
2
python
from django.apps import apps from django.db import DEFAULT_DB_ALIAS, router from django.db.models import signals from django.utils.encoding import smart_text from django.utils import six from django.utils.six.moves import input def update_contenttypes(app_config, verbosity=2, interactive=True, using=DEFAULT_DB_ALIAS,...
Review this code and list any quality issues.
[ { "issue": "Function 'update_contenttypes' has cyclomatic complexity 20 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 9 }, { "issue": "Function 'update_contenttypes' is 63 lines long. Functions over 25 lines are harder to test and maintain.", ...
3
python
#!/usr/bin/env python3 # Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. fro...
Review this code and list any quality issues.
[ { "issue": "Function 'main' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 17 }, { "issue": "Function 'main' is 63 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": ...
2
python
import chainer from chainer import training from chainer.training import extensions from chainer.datasets import TupleDataset from chainer import Chain from chainer import links as L from chainer import functions as F from chainer import reporter from chainer import cuda import numpy as np def dot(a, b): """ Sim...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' is 35 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical", "line": 31 }, { "issue": "Function '__init__' has 11 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 31 ...
8
python
import json from pathlib import Path from typing import Optional import typer from . import utils from .utils import example from .utils.iohelper import AltTemporaryDirectory @example() def check( project_dir: Path = Path("."), checkout: Optional[str] = None, strict: bool = True ) -> bool: """Checks to see ...
Review this code and list any quality issues.
[ { "issue": "Function 'check' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 13 } ]
1
python
#!/usr/bin/env python2 # Copyright (c) 2014-2020 The Bitcoin Core developers # Copyright (c) 2014-2020 The Skicoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test merkleblock fetch/validation # from test_...
Review this code and list any quality issues.
[ { "issue": "Function 'run_test' is 38 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 35 } ]
1
python
"""Test zha switch.""" from unittest.mock import call, patch import pytest import zigpy.zcl.clusters.general as general import zigpy.zcl.foundation as zcl_f from homeassistant.components.switch import DOMAIN from homeassistant.const import STATE_OFF, STATE_ON, STATE_UNAVAILABLE from .common import ( async_enable...
Review this code and list any quality issues.
[ { "issue": "Function 'test_switch' is 47 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 37 } ]
1
python
# -*- coding: utf-8 -*- ''' Covenant Add-on This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ...
Review this code and list any quality issues.
[ { "issue": "Function 'movie' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 36 }, { "issue": "Function 'sources' has cyclomatic complexity 36 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line"...
3
python
"""Helper functions for the distribution.""" import importlib import json import pathlib import subprocess import sys import types import os from typing import Optional, List import requests import repobee_plug as plug import _repobee.ext from _repobee import distinfo from _repobee import plugin class DependencyRe...
Review this code and list any quality issues.
[ { "issue": "Function 'pip' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 135 } ]
1
python
""" Tests for `kolibri.utils.cli` module. """ from __future__ import absolute_import from __future__ import print_function import logging import os import tempfile import pytest from django.db.utils import OperationalError from mock import patch import kolibri from kolibri.plugins.utils import autoremove_unavailable...
Review this code and list any quality issues.
[ { "issue": "Function 'log_logger' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 26 }, { "issue": "Function 'test_kolibri_listen_port_env' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", ...
2
python
""" Define the sublayers in encoder/decoder layer """ import numpy as np import torch import torch.nn as nn import torch.nn.functional as F class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super().__init__() se...
Review this code and list any quality issues.
[ { "issue": "Function 'forward' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 15 }, { "issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 29 }, { "is...
3
python
# Author: Tom Dupre la Tour # Joan Massich <mailsik@gmail.com> # # License: BSD 3 clause import numpy as np import pytest import scipy.sparse as sp from numpy.testing import assert_array_equal from sklearn.utils._seq_dataset import ( ArrayDataset32, ArrayDataset64, CSRDataset32, CSRDataset64) from sklearn...
Review this code and list any quality issues.
[ { "issue": "Function 'test_seq_dataset_shuffle' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 88 } ]
1
python
import torch from torch import nn, optim, multiprocessing from torch.utils.data import DataLoader from torch.utils.tensorboard.writer import SummaryWriter from tqdm import tqdm from time import time from collections import defaultdict from utils.run_utils import get_logger from utils.train_utils import CheckpointMan...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 30 }, { "issue": "Function '__init__' is 46 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical...
14
python
from nodes import * from tokens import Token, TokenType class Interpreter: def __init__(self, ast): self.ast = ast def eval(self): return self.evalHelper(self.ast) def evalHelper(self, ast): if isinstance(ast, NumberNode): return ast.node elif isinstance(ast, ...
Review this code and list any quality issues.
[ { "issue": "Function 'evalHelper' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 12 }, { "issue": "Function 'postfix_eval' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "sev...
3
python
import hashlib import json import os import boto3 from .retry import retry_on_aws_too_many_requests batch = boto3.client('batch') class JobDefinition: @classmethod def clear_all(cls): deleted_count = 0 for jobdef in batch.describe_job_definitions(status='ACTIVE')['jobDefinitions']: ...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 8 (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"...
3
python
# # @lc app=leetcode id=447 lang=python # # [447] Number of Boomerangs # # https://leetcode.com/problems/number-of-boomerangs/description/ # # algorithms # Easy (49.20%) # Likes: 296 # Dislikes: 447 # Total Accepted: 54.7K # Total Submissions: 109.6K # Testcase Example: '[[0,0],[1,0],[2,0]]' # # Given n points i...
Review this code and list any quality issues.
[ { "issue": "Function '_numberOfBoomerangs' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 44 }, { "issue": "Function 'numberOfBoomerangs' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functio...
2
python
#!/usr/bin/env python # -*- coding: utf-8 -*- from conans import ConanFile, CMake, tools import os import shutil class LibtiffConan(ConanFile): name = "libtiff" description = "Library for Tag Image File Format (TIFF)" url = "https://github.com/conan-io/conan-center-index" author = "Bincrafters <bincr...
Review this code and list any quality issues.
[ { "issue": "Function 'build' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 40 }, { "issue": "Function 'build' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line"...
3
python
# This script reads a PNG file containing a single row of 26 x 26 tiles and outputs binary data. # NumPy and Pillow are required as dependencies. # # Specify an input PNG file and an optional output file as arguments. # If an output file is not given, the binary data will be written in the console. # # The original gra...
Review this code and list any quality issues.
[ { "issue": "Function 'main' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 26 }, { "issue": "Function 'main' is 32 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": ...
2
python
# Copyright 2020 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. import os import sys import logging from .utils import path_from_root...
Review this code and list any quality issues.
[ { "issue": "Function 'normalize_config_settings' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 56 }, { "issue": "Function 'normalize_config_settings' is 32 lines long. Functions over 25 lines are harder to test and mainta...
5
python
import FWCore.ParameterSet.Config as cms from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask, addToProcessAndTask def applySubstructure( process, postfix="" ) : task = getPatAlgosToolsTask(process) from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection from PhysicsTools.Pat...
Review this code and list any quality issues.
[ { "issue": "Function 'applySubstructure' is 241 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 5 } ]
1
python
__source__ = 'https://leetcode.com/problems/letter-combinations-of-a-phone-number/' # https://github.com/kamyu104/LeetCode/blob/master/Python/letter-combinations-of-a-phone-number.py # Time: O(n * 4^n) # Space: O(n) # Brute Force Search # # Description: Leetcode # 17. Letter Combinations of a Phone Number # # Given a ...
Review this code and list any quality issues.
[ { "issue": "Function 'letterCombinationsRecu' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 70 } ]
1
python
""" Consolidate Services Description of all APIs # noqa: E501 The version of the OpenAPI document: version not set Generated by: https://openapi-generator.tech """ import re # noqa: F401 import sys # noqa: F401 from argocd_python_client.model_utils import ( # noqa: F401 ApiTypeError, Mo...
Review this code and list any quality issues.
[ { "issue": "Function '_from_openapi_data' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 113 }, { "issue": "Function '_from_openapi_data' is 30 lines long. Functions over 25 lines are harder to test and maintain.", "sev...
4
python
# # Copyright (c) 2018 Via Technology Ltd. All Rights Reserved. # Consult your license regarding permissions and restrictions. # """ operations related to airspaces and intersections. """ from psycopg2 import Error, InternalError from psycopg2.extensions import AsIs from psycopg2.extras import DictCursor from itertoo...
Review this code and list any quality issues.
[ { "issue": "Function 'find_sectors_intersected_by' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 74 }, { "issue": "Function 'find_user_sectors_intersected_by' has 6 parameters. Consider using a parameter object to reduce arity.", "severit...
7
python
import numpy as np from tinygrad.tensor import Function from extra.cherry import * # ************* unary ops ************* class ReLU(Function): def forward(ctx, input): ctx.save_for_backward(input) return cherry_unop(input, UnaryOps.RELU) def backward(ctx, grad_output): input, = ctx.saved_tensors ...
Review this code and list any quality issues.
[ { "issue": "Function 'forward' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 49 }, { "issue": "Function 'forward' has cyclomatic complexity 26 (threshold: 5). Consider breaking it into smaller functions.", "severity": ...
6
python
import json import os from optparse import make_option from cnntools.models import CaffeCNN from cnntools.tasks import schedule_training from django.core.management.base import BaseCommand class Command(BaseCommand): args = '<netid> <local?> <base_lr?> <weights?> <cpu?> <debug_info?> <desc?>' help = 'Starts ...
Review this code and list any quality issues.
[ { "issue": "Function 'handle' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 91 } ]
1
python
import importlib.util import os import stat import typing from email.utils import parsedate import anyio from starlette.datastructures import URL, Headers from starlette.exceptions import HTTPException from starlette.responses import FileResponse, RedirectResponse, Response from starlette.types import Receive, Scope,...
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 'get_response' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "...
5
python
import os import torch import torch.nn as nn import numpy as np from contextlib import contextmanager from functools import partial from torch.optim import Adam, SGD from spirl.utils.general_utils import ParamDict, get_clipped_optimizer, AttrDict, prefix_dict, map_dict, \ nan_ho...
Review this code and list any quality issues.
[ { "issue": "Function 'log_outputs' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 72 }, { "issue": "Function 'log_outputs' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", ...
4
python
""" elasticapm.contrib.django.client ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2011-2017 Elasticsearch Large portions are :copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import import logging import django fr...
Review this code and list any quality issues.
[ { "issue": "Function 'get_user_info' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 71 }, { "issue": "Function 'get_data_from_request' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions...
4
python
#!/usr/bin/env python import asyncio from collections import deque import logging import time from typing import List, Dict, Optional, Tuple, Set, Deque from hummingbot.client.command import __all__ as commands from hummingbot.core.clock import Clock from hummingbot.core.data_type.order_book_tracker import OrderBookT...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 90 }, { "issue": "Function '_handle_command' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor...
5
python
""" Climate Change Project """ import plotly.graph_objects as go from PIL import Image, ImageDraw, ImageFont from computing_data import calc_high_actual_pd, \ calc_low_actual_pd, \ calc_median_actual_pd, \ make_high_rcp_list, make_low_rcp_list, \ make_median_rcp_list, rcp_to_slice, temp_to_rgb from read...
Review this code and list any quality issues.
[ { "issue": "Function 'plot_temp_data' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 14 }, { "issue": "Function 'draw_table' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line"...
3
python
from __future__ import print_function, division from numpy import array, argmax from pyscf.nao import tddft_iter class tddft_iter_x_zip(tddft_iter): """ Iterative TDDFT with a high-energy part of the KS eigenvectors compressed """ def __init__(self, **kw): from pyscf.nao.m_fermi_dirac import fermi_dirac_occu...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 9 } ]
1
python
import os from maya import cmds import avalon.maya import pype.api from pype.hosts.maya.lib import extract_alembic class ExtractAnimation(pype.api.Extractor): """Produce an alembic of just point positions and normals. Positions and normals, uvs, creases are preserved, but nothing more, for plain and pr...
Review this code and list any quality issues.
[ { "issue": "Function 'process' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 22 }, { "issue": "Function 'process' is 52 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "...
2
python
import numpy as np from numpy.core.numerictypes import typecodes import inspect import functools import re import builtins import os from concurrent.futures import ThreadPoolExecutor as thread_pool from concurrent.futures import ProcessPoolExecutor as process_pool from concurrent.futures import as_completed def _iter...
Review this code and list any quality issues.
[ { "issue": "Function '_parse_signature' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 32 }, { "issue": "Function '_parse_signature' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severit...
15
python
import numpy as np from .robot_model import RobotModel from ...utils.mjcf_utils import xml_path_completion class Panda(RobotModel): """Panda is a sensitive single-arm robot designed by Franka.""" def __init__(self, idn=0, bottom_offset=(0, 0, -0.913)): """ Args: idn (int or str): ...
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": 9 } ]
1
python
# coding: utf-8 """ Kubernetes No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: v1.19.15 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six f...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 55 }, { "issue": "Function '__init__' has 9 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", ...
3
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import #::: modules import numpy as np import os, sys import ellc from transitleastsquares import catalog_info import astropy.constants as ac import astropy.units as u import lightkurve as lk import pandas as pd ...
Review this code and list any quality issues.
[ { "issue": "Function 'make_model' is 42 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 59 } ]
1
python
import time import sys import os import threading try: import ConfigParser as ConfigParsers except ImportError: import configparser as ConfigParsers from common import CommonVariables from pwd import getpwuid from stat import * import traceback # [pre_post] # "timeout" : (in seconds), # # .......
Review this code and list any quality issues.
[ { "issue": "Function 'pre_check' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 75 }, { "issue": "Function 'load_modules' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", "seve...
7
python
import requests import os from consul import base __all__ = ["Consul"] class HTTPClient(base.HTTPClient): def __init__(self, *args, **kwargs): self.timeout = kwargs.pop("timeout", None) super(HTTPClient, self).__init__(*args, **kwargs) self.session = requests.session() self._pid...
Review this code and list any quality issues.
[ { "issue": "Function '_request' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 21 }, { "issue": "Function 'get' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 40 }, { "issue"...
6
python
import numpy as np from typing import Union, List, Callable import logging from multiBatelo.score_functions import create_exponential_score_function DEFAULT_K_VALUE = 32 DEFAULT_D_VALUE = 400 DEFAULT_SCORING_FUNCTION_BASE = 1 _default_logger = logging.getLogger("multielo.multielo") class MultiElo: """ Gen...
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": 21 }, { "issue": "Function 'get_actual_scores' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", ...
2
python
# =============================================================================== # NAME: InstanceTopologyHTMLVisitor.py # # DESCRIPTION: A visitor responsible for the generation of HTML tables # of event ID's, etc. # # AUTHOR: reder # EMAIL: reder@jpl.nasa.gov # DATE CREATED : Sep. 13, 2016 # # Copyrigh...
Review this code and list any quality issues.
[ { "issue": "Function 'initFilesVisit' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 92 } ]
1
python
# Copyright 2014 by Saket Choudhary. Based on test_Clustalw_tool.py by Peter # Cock . # # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. # Last Checked with samtools [0.1.18 (r982:295)] from Bio imp...
Review this code and list any quality issues.
[ { "issue": "Function 'setUp' is 36 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 72 } ]
1
python
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor import re class ToypicsIE(InfoExtractor): IE_DESC = 'Toypics video' _VALID_URL = r'https?://videos\.toypics\.net/view/(?P<id>[0-9]+)' _TEST = { 'url': 'http://videos.toypics.net/view/514/chancebulged,-2-1/',...
Review this code and list any quality issues.
[ { "issue": "Function '_real_extract' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 59 } ]
1
python
# -*- coding: utf-8 -*- # this file is released under public domain and you can use without limitations ######################################################################### ## Customize your APP title, subtitle and menus here ######################################################################### response.logo...
Review this code and list any quality issues.
[ { "issue": "Function '_' is 100 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 36 } ]
1
python
# -*- coding: utf-8 -*- import email import json import logging import smtplib from email.header import Header from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from zvt import zvt_config from zvt.networking.request import get_http_session, sync_get, sync_post class Informer(object)...
Review this code and list any quality issues.
[ { "issue": "Function 'send_message' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 17 }, { "issue": "Function 'send_message_' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", ...
9
python
import re from . import csv SDC_SOURCE_FILE_COLUMN = "_sdc_source_file" SDC_SOURCE_LINENO_COLUMN = "_sdc_source_lineno" # TODO: Add additional logging # TODO: conn needs get_files and get_file_handle functions def get_schema_for_table(conn, table_spec): files = conn.get_files(table_spec['search_prefix'], table_...
Review this code and list any quality issues.
[ { "issue": "Function 'sample_file' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 31 }, { "issue": "Function 'sample_file' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", ...
4
python
import warnings from inspect import isfunction, signature import pkg_resources import pytest from appdaemon.plugins.hass.hassapi import Hass from appdaemontestframework.common import AppdaemonTestFrameworkError class AutomationFixtureError(AppdaemonTestFrameworkError): pass def _instantiate_and_initialize_aut...
Review this code and list any quality issues.
[ { "issue": "Function '_instantiate_and_initialize_automation' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 15 } ]
1
python
# Copyright (c) 2012-2013, 2015-2016 ARM Limited # All rights reserved # # The license below extends only to copyright in the software and shall # not be construed as granting a license to any other intellectual # property including but not limited to intellectual property relating # to a hardware implementation of the...
Review this code and list any quality issues.
[ { "issue": "Function 'config_cache' has cyclomatic complexity 29 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 52 }, { "issue": "Function 'config_cache' is 107 lines long. Functions over 25 lines are harder to test and maintain.", "severity": ...
2
python
from flask import render_template, request from flask_script import Manager, Server from app import app from model import Content, Summary, Article import app.static.summ as summarizationModel import os, json, logging @app.route('/', endpoint='ACCESS') @app.route('/index.html', endpoint='ACCESSFILE') def index(): ...
Review this code and list any quality issues.
[ { "issue": "Function 'run_decode' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 20 } ]
1
python
#!/usr/bin/env python # # Public Domain 2014-2016 MongoDB, Inc. # Public Domain 2008-2014 WiredTiger, Inc. # # This is free and unencumbered software released into the public domain. # # Anyone is free to copy, modify, publish, use, compile, sell, or # distribute this software, either in source code form or as a compil...
Review this code and list any quality issues.
[ { "issue": "Function 'test_lsm' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 63 } ]
1
python
import os import time from slackclient import SlackClient import bot_id # Instructor and student imports import wray.slacklib import joe.slacklib import chris.slacklib # constants try: AT_BOT = "<@" + bot_id.get_id() + ">" except TypeError: pass # instantiate client slack_client = SlackClient(os.environ.get...
Review this code and list any quality issues.
[ { "issue": "Function 'parse_slack_output' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 43 } ]
1
python
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT license. from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import collections import inspect from athena.onnx import constants ...
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": 24 }, { "issue": "Function '__call__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line"...
3
python
# -*- coding: utf-8 -*- """ Created on Wed Aug 7 09:36:45 2019 @author: MyPC """ import pandas as pd import matplotlib.pyplot as plt import matplotlib import math import pymssql import numpy as np import copy import re from sklearn import preprocessing from sklearn.linear_model import LinearRegression...
Review this code and list any quality issues.
[ { "issue": "Function 'plot_map' is 31 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 31 } ]
1
python
from __future__ import print_function import itertools from PhysicsTools.Heppy.analyzers.core.Analyzer import Analyzer from PhysicsTools.Heppy.analyzers.core.AutoHandle import AutoHandle from PhysicsTools.HeppyCore.framework.event import Event from PhysicsTools.HeppyCore.statistics.counter import Counter, Counters fr...
Review this code and list any quality issues.
[ { "issue": "Function 'beginLoop' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 26 } ]
1
python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Program to preprocess training and test data using word2vec, dep2vec and fact2vec embeddings and prepare corresponding weight vectors to be used in CNN Copyright (C) 2016 Ubiquitous Knowledge Processing (UKP) Lab Technische Universität Darmstadt Licensed under the Ap...
Review this code and list any quality issues.
[ { "issue": "Function 'preprocess_data' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 32 }, { "issue": "Function 'preprocess_data' is 94 lines long. Functions over 25 lines are harder to test and maintain.", "severity"...
3
python
from typing import List from blogs.api.interface import IBlogApiExecutor from domain.blog.blog_entry import BlogEntry, BlogEntries from domain.doc.doc_entry import DocEntries, DocEntry from dump.blog_to_doc_mapping import BlogDocEntryMapping from dump.interface import IDumpEntriesAccessor from files.conf.category_grou...
Review this code and list any quality issues.
[ { "issue": "Function 'push_entry_to_docs_and_blog' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 14 }, { "issue": "Function 'push_entry_from_docs_to_blog' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": ...
3
python
"""A high-level interface to local Galaxy instances using bioblend.""" from six import StringIO from planemo.bioblend import ensure_module from planemo.bioblend import galaxy DEFAULT_MASTER_API_KEY = "test_key" def gi(port=None, url=None, key=None): """Return a bioblend ``GalaxyInstance`` for Galaxy on this por...
Review this code and list any quality issues.
[ { "issue": "Function 'summarize_history' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 57 }, { "issue": "Function 'summarize_history' is 38 lines long. Functions over 25 lines are harder to test and maintain.", "severi...
2
python
from django.db.models import Manager from django.db.models.query import QuerySet from django.contrib.contenttypes.models import ContentType import itertools class VoteQuerySet(QuerySet): def delete(self, *args, **kwargs): """Handles updating the related `votes` and `score` fields attached to the model."""...
Review this code and list any quality issues.
[ { "issue": "Function 'update_recommendations' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 85 } ]
1
python
from System import IntPtr from System.Runtime.InteropServices import Marshal import Ironclad from Ironclad import CPyMarshal from Ironclad.Structs import METH, Py_TPFLAGS, PyGetSetDef, PyMemberDef, PyMethodDef, PyTypeObject from tests.utils.memory import OffsetPtr def _new_struct(type_, fields, *values): ...
Review this code and list any quality issues.
[ { "issue": "Function 'MakeGetSetDef' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 48 }, { "issue": "Function 'MakeMemberDef' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 63 }, ...
3
python
# -*- coding: utf-8 -*- # 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 "Lic...
Review this code and list any quality issues.
[ { "issue": "Function 'handle_post' has cyclomatic complexity 36 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 46 }, { "issue": "Function 'handle_post' is 127 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "c...
3
python
import datetime import hashlib import json import logging import os.path import sys from typing import TYPE_CHECKING from pip._vendor.packaging.version import parse as parse_version from pip._internal.index.collector import LinkCollector from pip._internal.index.package_finder import PackageFinder from pip._internal....
Review this code and list any quality issues.
[ { "issue": "Function 'pip_self_version_check' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 109 }, { "issue": "Function 'pip_self_version_check' is 55 lines long. Functions over 25 lines are harder to test and maintain.",...
2
python
from userbot import bot from telethon import events import asyncio from datetime import datetime from telethon.tl.types import User, Chat, Channel from uniborg.util import admin_cmd @bot.on(admin_cmd(pattern=r"stats")) async def _(event): if event.fwd_from: return start = datetime.now() u = 0 g...
Review this code and list any quality issues.
[ { "issue": "Function '_' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 9 }, { "issue": "Function '_' is 40 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 9 } ]
2
python
# This file will track detections import tqdm import cv2 import matplotlib.pyplot as plt import matplotlib.patches as patches from matplotlib.ticker import NullLocator from cs231aApproachingOdt import utils as myutils from PIL import Image import os import torch import torchvision.ops.boxes as bops def match_detectio...
Review this code and list any quality issues.
[ { "issue": "Function 'match_detections' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 14 }, { "issue": "Function 'match_detections' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "lin...
3
python
import csv from django.contrib.auth import get_user_model from django.db.models.aggregates import Sum from django.http.response import HttpResponse from django.utils.decorators import method_decorator from djoser.serializers import SetPasswordSerializer from djoser.views import TokenCreateView from drf_yasg.utils impo...
Review this code and list any quality issues.
[ { "issue": "Function 'alt_endpoint_delete' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 260 }, { "issue": "Function 'recipe_validate' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": ...
3
python
from __future__ import print_function from __future__ import absolute_import from __future__ import division from compas.utilities import geometric_key __all__ = [ 'mesh_delete_duplicate_vertices' ] def mesh_delete_duplicate_vertices(mesh, precision=None): """Cull all duplicate vertices of a mesh and sanit...
Review this code and list any quality issues.
[ { "issue": "Function 'mesh_delete_duplicate_vertices' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 13 } ]
1
python
import sys sys.path.insert(0, "../") # our fake sigrokdecode lives one dir upper from pd import Decoder class DS1307(): def __init__(self): self.sigrokDecoder = Decoder() def get_capabilities(self): settings = {} for option in self.sigrokDecoder.options : settingType = '' choices = ...
Review this code and list any quality issues.
[ { "issue": "Function 'get_capabilities' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 11 } ]
1
python
import torch import numpy as np import json, sys, re, string import collections from collections import Counter from collections import OrderedDict def get_sp_pred(pred_sp_idx, data): """get the prediction of supporting facts in original format Arguments: pred_sp_idx {[type]} -- [description] ...
Review this code and list any quality issues.
[ { "issue": "Function 'process_logit' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 23 }, { "issue": "Function 'process_logit' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", ...
4
python
import copy ########################################### This function reads in block from file def grid_from_file(file_name): lst=[] f=open(file_name) for line in f: lst2=[] for i in line: if i == "x": lst2.append(i) elif i.isdigit(): ...
Review this code and list any quality issues.
[ { "issue": "Function 'block_selector' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 62 } ]
1
python
import logging import urllib import requests import base64 """ HASS module to read Aerogarde bounty info, later there will be an option to control the light writen by @epotex """ _LOGGER = logging.getLogger(__name__) DOMAIN = 'aerogarden' agent = "BountyWiFi/1.1.13 (iPhone; iOS 10.3.2; Scale/2.00)" port = "8080...
Review this code and list any quality issues.
[ { "issue": "Function 'setup' is 80 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 39 } ]
1
python
import time from datetime import datetime from requests import Response import json import os import TunnelSSH import Helpers import SettingsStorage import sys def create_tunnel(tun: dict): timeout_time: datetime = datetime.fromisoformat(tun["timeout_time"]) if timeout_time <= datetime.utcnow(): Help...
Review this code and list any quality issues.
[ { "issue": "Function 'parse_success_resp' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 63 }, { "issue": "Function 'main' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "seve...
3
python
# 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 writing, software # distributed under t...
Review this code and list any quality issues.
[ { "issue": "Function 'test_scaling_policy' is 65 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 33 } ]
1
python
#!/usr/bin/python3 """Create class""" class Square: """Square class""" def __init__(self, size=0, position=(0, 0)): """Initialize Square""" self.__size = size self.position = position """if type(size) is not int: raise TypeError("size must be an integer") if...
Review this code and list any quality issues.
[ { "issue": "Function 'position' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 52 } ]
1
python
#This is a mixin class for signal analyzers to be used by f2_system class #Todo: Analyzers should be a independent class #Last modification by Marko Kosunen, marko.kosunen@aalto.fi, 30.07.2018 18:09 import numpy as np import scipy.signal as sig import matplotlib as mpl mpl.use('Agg') #To enble plotting without X impor...
Review this code and list any quality issues.
[ { "issue": "Function 'spectrum_analyzer' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 70 }, { "issue": "Function 'plot_generic' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.", "severity":...
4
python
""" McsCMOS ~~~~~~~ Wrapper and Helper to access MCS CMOS Data within H5 Files :copyright: (c) 2018 by Multi Channel Systems MCS GmbH :license: see LICENSE for more details """ import h5py import numpy as np class CMOSData(h5py.File): """ Wrapper for a HDF5 File conta...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 18 }, { "issue": "Function '__init__' is 34 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", ...
2
python
# -*- coding: utf-8 -*- from codecs import open import logging import colander import deform from itsdangerous import BadData, SignatureExpired from h import i18n, models, validators from h.accounts import util from h.services.user import UserNotActivated from h.models.user import ( EMAIL_MAX_LENGTH, USERNAME...
Review this code and list any quality issues.
[ { "issue": "Function 'deserialize' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 208 } ]
1
python
#!/usr/bin/python import hashlib, re, sys, os, base64, time, random, hmac # stripped down from https://github.com/vbuterin/pybitcointools/blob/master/bitcoin/main.py ### Elliptic curve parameters P = 2**256-2**32-2**9-2**8-2**7-2**6-2**4-1 N = 1157920892373161954235709850086879078528375642790749043826051631415181614...
Review this code and list any quality issues.
[ { "issue": "Function 'get_code_string' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 30 }, { "issue": "Function 'base10_multiply' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", ...
8
python
#!/usr/bin/python # -*- coding: utf-8 -*- ########################################################### # KivyCalendar (X11/MIT License) # Calendar & Date picker widgets for Kivy (http://kivy.org) # https://bitbucket.org/xxblx/kivycalendar # # Oleg Kozlov (xxblx), 2015 # https://xxblx.bitbucket.org/ ###################...
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": 74 }, { "issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 126 }, { "...
4
python
''' The management of salt command line utilities are stored in here ''' # Import python libs import os import sys # Import salt components import salt.cli.caller import salt.cli.cp import salt.cli.key import salt.cli.batch import salt.client import salt.output import salt.runner import optparse from salt.utils impo...
Review this code and list any quality issues.
[ { "issue": "Function 'run' has cyclomatic complexity 18 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 30 }, { "issue": "Function 'run' is 58 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical", "li...
3
python
from logging import getLogger from typing import ( List, Optional, Set, ) from pydantic import ( BaseModel, Extra, Field, ) from galaxy import exceptions from galaxy.datatypes.registry import Registry from galaxy.managers.collections import DatasetCollectionManager from galaxy.managers.collect...
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": 84 }, { "issue": "Function 'contents' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 204 } ]
2
python
from __future__ import annotations import typing as t from functools import singledispatch from inflection import underscore from sqlalchemy import Date from sqlalchemy import DateTime from sqlalchemy import Text from sqlalchemy import Time from sqlalchemy import Unicode from sqlalchemy import UnicodeText from sqlalc...
Review this code and list any quality issues.
[ { "issue": "Function '_get_number_comparator.condition' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 213 }, { "issue": "Function 'generate_filters' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into sma...
3
python
import logging import chevron import re from itertools import dropwhile import snex.util as util logger = logging.getLogger(__name__) DEFAULT = { # :snippet global-default-config lang: python "output_template": "```{{lang}}\n{{{snippet}}}\n```\n", "valid_param_keys": ["name", "lang", "lnum", "fname", "pat...
Review this code and list any quality issues.
[ { "issue": "Function 'from_raw_data' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 28 }, { "issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 50 }, { ...
4
python
__all__ = ('modulize',) import sys from types import FunctionType, GetSetDescriptorType, MappingProxyType, ModuleType from .docs import has_docs NoneType = type(None) try: from _weakref import ref as WeakrefType except ImportError: from weakref import ref as WeakrefType # This 2 type can be function Wrapp...
Review this code and list any quality issues.
[ { "issue": "Function '_modulize_function' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 31 }, { "issue": "Function '_modulize_function' has 5 parameters. Consider using a parameter object to reduce arity.", "severity":...
6
python
import shutil import tempfile from django.conf import settings from django.core.files.uploadedfile import SimpleUploadedFile from django.core.cache import cache from django.contrib.auth import get_user_model from django.test import Client, TestCase, override_settings from django.urls import reverse from django import...
Review this code and list any quality issues.
[ { "issue": "Function 'test_paginator_pages' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 43 }, { "issue": "Function 'setUpClass' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", ...
2
python
# Copyright 2017 The Bazel Authors. 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 la...
Review this code and list any quality issues.
[ { "issue": "Function '_shell_spawn_e2e_test_impl' is 33 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 55 } ]
1
python
import glob import datetime import inference import numpy as np flist = [] def run_classifier(): flist = [] list1 = glob.glob("./images/*.jpg") list1.sort() print("Printing the time of Interesting Events.....\n\n") temp = str(inference.run_inference_on_image()) for i in r...
Review this code and list any quality issues.
[ { "issue": "Function 'run_classifier' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 6 }, { "issue": "Function 'run_classifier' is 35 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "m...
2
python
import re import sys import inspect _py2 = sys.version_info[0] == 2 _py3 = sys.version_info[0] == 3 # noinspection PyPep8Naming class route(object): def __init__(self, rule, **options): """ Class Initializer - This will only execute if using BottleCBV's original route() style. """ ...
Review this code and list any quality issues.
[ { "issue": "Function 'register' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 173 }, { "issue": "Function 'register' is 51 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", ...
5
python
#!/usr/bin/python # # Logic for computing missing and duplicate files using Postgresql DB. # import os import fnmatch # from shutil import copy2 # from shutil import copyfile from dbutils import required as db MISSING_FROM_COMP_FOLDER = "missing_from_comp" MISSING_FROM_SRC_FOLDER = "missing_from_source" FILE_NAME_C...
Review this code and list any quality issues.
[ { "issue": "Function 'handleMissing' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 35 }, { "issue": "Function 'handleMissing' is 31 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "mi...
2
python
"""Decoder portion of the model.""" import torch import torch.nn.functional as F from torch import nn def _build_base_decoder(): """Builds the base decoder shared by all three decoder types.""" return nn.Sequential(nn.Conv2d(in_channels=1280, out_channels=256, kernel_size=(3, 3), stride=1, padding=1), ...
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": 17 } ]
1
python
import numpy as np import editdistance class Decoder(): def __init__(self, vocab): self.vocab_list = [char for char in vocab] def predict(self, batch_size, logits, y, lengths, y_lengths, n_show=5): decoded = self.decode(logits, lengths) cursor = 0 gt = [] n = min(n_sh...
Review this code and list any quality issues.
[ { "issue": "Function 'predict' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 9 } ]
1
python
# MIT License # # Copyright (c) 2018-2019 Red Hat, Inc. # 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 the rights # to use, copy, modify, m...
Review this code and list any quality issues.
[ { "issue": "Function 'initiate_git_repo' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 75 }, { "issue": "Function 'initiate_git_repo' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severi...
3
python
import os import time from membound_cases import memory_bound_cases_list from utils import (arch_name, datatime_with_format, dtype2str, dump2json, geometric_mean, md_table_header, scaled_repeat_times, size2str) import taichi as ti class MemoryBound: suite_name = 'memoryboun...
Review this code and list any quality issues.
[ { "issue": "Function '_save_suite_info_as_json' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 58 }, { "issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "ma...
2
python
import json import os from mako.template import Template from models.pomodoro_model import PomodoroModel from datetime import datetime class ExportPomsResource: def on_get(self, req, resp): """Handles GET requests""" resp.content_type = 'text/html' dir_path = os.path.dirname(os.path.real...
Review this code and list any quality issues.
[ { "issue": "Function 'on_post' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 19 } ]
1
python
import csv import json def read_data_file(filename): all_records = [] with open(filename, mode='r') as csv_file: csv_reader = csv.reader(csv_file) row_count = 0 for row in csv_reader: all_records.append(row) return all_records def parse_play_fields(play_fields): pla...
Review this code and list any quality issues.
[ { "issue": "Function 'get_fields' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 70 }, { "issue": "Function 'get_fields' is 36 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major",...
2
python
from rubicon.java.android_events import Handler, PythonRunnable from rubicon.java.jni import java from travertino.size import at_least from ..libs.android import R__color from ..libs.android.graphics import BitmapFactory, Rect from ..libs.android.view import Gravity, OnClickListener, View__MeasureSpec from ..libs.andr...
Review this code and list any quality issues.
[ { "issue": "Function 'create' is 34 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 55 }, { "issue": "Function '_make_row' is 48 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 94 } ...
2