language
stringclasses
1 value
code
stringlengths
407
33.3k
instruction
stringclasses
1 value
flaws
listlengths
1
17
flaw_count
int64
1
17
python
""" Classes for GP models with Stan that perform transfer optimization. """ from argparse import Namespace import numpy as np import copy from .gp_stan import StanGp from .regression.transfer_regression import TransferRegression from ..util.misc_util import dict_to_namespace class StanTransferGp(StanGp): """ ...
Review this code and list any quality issues.
[ { "issue": "Function 'gen_list' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 78 } ]
1
python
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from ... import _utilities, _tables from...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 25 }, { "issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line...
4
python
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from mvn.utils.img import to_numpy, to_torch from mvn.utils import multiview def integrate_tensor_2d(heatmaps, softmax=True): """Applies softmax to heatmaps and integrates them to get their's "center of masses" Args: ...
Review this code and list any quality issues.
[ { "issue": "Function 'unproject_heatmaps' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 99 }, { "issue": "Function 'unproject_heatmaps' is 46 lines long. Functions over 25 lines are harder to test and maintain.", "seve...
3
python
import logging import os import numpy as np import torch from torch.utils.data import Dataset, DataLoader import torchvision.transforms as transforms from torch.utils.data.distributed import DistributedSampler from .dataset import CheXpert def _get_mean_and_std(dataset: Dataset): """Compute the mean and std of ...
Review this code and list any quality issues.
[ { "issue": "Function 'get_dataloader' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 80 }, { "issue": "Function 'get_dataloader_test' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 8...
11
python
#!/usr/bin/python2 """ 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"); yo...
Review this code and list any quality issues.
[ { "issue": "Function 'hive_service' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 24 }, { "issue": "Function 'hive_service' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "mino...
2
python
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from __future__ import unicode_literals from ..utils import Generate5tt def test_Generate5tt_inputs(): input_map = dict( algorithm=dict( argstr='%s', mandatory=True, position=-3, ), args=dict(argstr='...
Review this code and list any quality issues.
[ { "issue": "Function 'test_Generate5tt_inputs' is 48 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 6 } ]
1
python
import scrapy, re from alleco.objects.official import Official class ross_t(scrapy.Spider): name = "ross_t" muniName = "ROSS" muniType = "TOWNSHIP" complete = True def start_requests(self): urls = ['https://www.ross.pa.us/245/Board-of-Commissioners', 'https://www.ross.pa.us/225/Other-Elected-Offic...
Review this code and list any quality issues.
[ { "issue": "Function 'parse' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 16 }, { "issue": "Function 'parse' is 32 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line...
2
python
# -*- coding: utf-8 -*- # Copyright 2020 Green Valley Belgium NV # # 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 appl...
Review this code and list any quality issues.
[ { "issue": "Function 'process_updated_customer_signup_message' is 41 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 36 }, { "issue": "Function 'process_updated_customer_signup_message' has 7 parameters. Consider using a parameter object to red...
3
python
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. import unittest import numpy as np import numpy.testing as npt import six from caffe2.python import core, workspace from ml.rl.caffe_utils import C2 from ml.rl.preprocessing import identify_types, normalization from ml.rl.p...
Review this code and list any quality issues.
[ { "issue": "Function 'test_prepare_normalization_and_normalize' has cyclomatic complexity 21 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 38 }, { "issue": "Function 'test_prepare_normalization_and_normalize' is 109 lines long. Functions over 25 l...
6
python
#! /usr/bin/env python # encoding: utf-8 # WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file import os,sys,traceback,base64,signal try: import cPickle except ImportError: import pickle as cPickle try: import subprocess32 as subprocess except ImportError: import subprocess try: TimeoutEx...
Review this code and list any quality issues.
[ { "issue": "Function 'run' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 19 }, { "issue": "Function 'run' is 34 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 19...
2
python
# -*- coding: utf-8 -*- """ Class and program to colorize python source code for ANSI terminals. Based on an HTML code highlighter by Jurgen Hermann found at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52298 Modifications by Fernando Perez (fperez@colorado.edu). Information on the original HTML highligh...
Review this code and list any quality issues.
[ { "issue": "Function 'format2' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 135 }, { "issue": "Function 'format2' is 49 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", ...
6
python
# Standard Library from copy import deepcopy # 3rd Party # Internal # ########################################################################### # class MetaData (dict): """ A class for holding information about an object """ def __init__ (self,*args,**kwargs): super(MetaData,self).__...
Review this code and list any quality issues.
[ { "issue": "Function 'combine' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 51 }, { "issue": "Function 'combine' is 32 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "...
2
python
# -*- coding: utf-8 -*- # Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is # holder of all proprietary rights on this computer program. # You can only use this computer program if you have closed # a license agreement with MPG or you get the right to use the computer # program from someone who is...
Review this code and list any quality issues.
[ { "issue": "Function 'find_dynamic_lmk_idx_and_bcoords' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 29 }, { "issue": "Function 'lbs' is 30 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical", ...
3
python
""" foxBMS Software License Copyright 2010-2016, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. All rights reserved. BSD 3-Clause License Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions ...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 8 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 67 }, { "issue": "Function 'main' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line"...
3
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 use ...
Review this code and list any quality issues.
[ { "issue": "Function 'delete_by_query' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 66 }, { "issue": "Function 'delete_by_query' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity":...
4
python
from decimal import * # Purpose: read in SSDEEP output and print findings. # Author: Tanner G. def main(): file = open("ssdeep_comparison", "r") # read past first line of output file.readline() filea_data = file.readline() fileb_data = file.readline() file.close() totalCount = 0 similarities = 0 index = 0 ...
Review this code and list any quality issues.
[ { "issue": "Function 'main' is 32 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 6 } ]
1
python
"""Provides the Objector class.""" from json import loads from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union from .exceptions import ClientException, RedditAPIException from .models.reddit.base import RedditBase from .util import snake_case_keys if TYPE_CHECKING: # pragma: no cover from ... impo...
Review this code and list any quality issues.
[ { "issue": "Function '_objectify_dict' has cyclomatic complexity 23 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 58 }, { "issue": "Function '_objectify_dict' is 66 lines long. Functions over 25 lines are harder to test and maintain.", "severi...
4
python
# coding: utf-8 from __future__ import unicode_literals from io import StringIO, BytesIO from pathlib import Path import pytest from .util import load_test_model from ..tokens import Doc from ..strings import StringStore from .. import util # These languages are used for generic tokenizer tests – only add a languag...
Review this code and list any quality issues.
[ { "issue": "Function 'pytest_runtest_setup' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 201 } ]
1
python
#!/usr/bin/env python import os import shutil import glob import time import sys import subprocess import string from optparse import OptionParser, make_option import ConfigParser SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) PKG_NAME = os.path.basename(SCRIPT_DIR) PARAMETERS = None #XW_ENV = "export DBUS_...
Review this code and list any quality issues.
[ { "issue": "Function 'uninstPKGs' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 107 }, { "issue": "Function 'instPKGs' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severit...
4
python
class FieldC(): def __init__(self, name, column_type, primary_key, default): self.name = name self.column_type = column_type self.primary_key = primary_key self.default = default def __str__(self): return '<%s, %s:%s>' % (self.__class__.__name__, self.column_type...
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": 2 }, { "issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 13 } ]
2
python
import pysam from optparse import OptionParser from x_gene_annotation import * class mRNA_Transfer(): def call_transfer_mut(self, sf_rna, sf_dna_up, sf_dna_bottom, sf_candidate): m_rna_vars = self.load_variants(sf_rna) m_DNA_RNA_ovlp_vars = self.get_overlap_variants(sf_dna_bottom, m_rna_vars) ...
Review this code and list any quality issues.
[ { "issue": "Function 'call_transfer_mut' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 7 } ]
1
python
# -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: import pytest from ....testing import example_data from ...niftyreg import get_custom_path from ..asl import FitAsl from ...niftyreg.tests.test_regutils import no_nifty_tool @py...
Review this code and list any quality issues.
[ { "issue": "Function 'test_fit_asl' is 36 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 16 } ]
1
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # # king_phisher/server/plugins.py # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, t...
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": 74 }, { "issue": "Function '__init__' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", ...
2
python
from tkinter import* import random import time root = Tk() root.geometry("1600x700+0+0") root.title("Restaurant Management System") Tops = Frame(root,bg="white",width = 1600,height=50,relief=SUNKEN) Tops.pack(side=TOP) f1 = Frame(root,width = 900,height=700,relief=SUNKEN) f1.pack(side=LEFT) f2 = Frame(root ,width =...
Review this code and list any quality issues.
[ { "issue": "Function 'Ref' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 49 }, { "issue": "Function 'price' is 35 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 244 } ]
2
python
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType import copy as _copy class Font(_BaseLayoutHierarchyType): # class properties # -------------------- _parent_path_str = "layout.scene.xaxis.title" _path_str = "layout.scene.xaxis.title.font" _valid_props = {"colo...
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": 144 }, { "issue": "Function '__init__' is 34 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", ...
3
python
import IoTSensor import LORAGateway class GatewayPlacement: def __init__(self, sensor_list): self._sensor_list = sensor_list self._gateway_list = [] def add_gateway(self, gateway): self._gateway_list.append(gateway) def remove_gateway(self, gateway): self._gateway_list.re...
Review this code and list any quality issues.
[ { "issue": "Function 'sensors_covered' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 16 } ]
1
python
"""Class to hold the tracks and cameras of a 3D scene. This can be the output of either data association or of bundle adjustment. Authors: Ayush Baid, John Lambert, Xiaolong Wu """ import itertools from typing import Any, Dict, List, Optional, Tuple import numpy as np from gtsam import PinholeCameraCal3Bundler, Pose3...
Review this code and list any quality issues.
[ { "issue": "Function '__eq__' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 39 }, { "issue": "Function 'from_selected_cameras' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", ...
2
python
import pytest from testutils.factories import create_test_person from django.contrib.auth.models import User, Permission from openstates.data.models import Person, Organization from people_admin.models import UnmatchedName, NameStatus, DeltaSet from people_admin.views import MATCHER_PERM, EDIT_PERM, RETIRE_PERM import ...
Review this code and list any quality issues.
[ { "issue": "Function 'test_retire_person' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 147 } ]
1
python
""" # Copyright 2021 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 applicable law or ...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' is 30 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 31 }, { "issue": "Function 'check_vm_image' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": ...
8
python
import torch, math from torch.optim.optimizer import Optimizer # RAdam + LARS class Ralamb(Optimizer): def __init__(self, params, lr=1e-3, betas=(0.9, 0.999), eps=1e-8, weight_decay=0): defaults = dict(lr=lr, betas=betas, eps=eps, weight_decay=weight_decay) self.buffer = [[None, None, None] for in...
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": 7 }, { "issue": "Function 'step' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 15...
3
python
""" Created by Michele Bianco, 9 July 2021 """ import numpy as np, pkg_resources from tqdm import tqdm import tensorflow as tf from tensorflow.keras.models import load_model from tensorflow.keras import backend as K from tensorflow.python.ops import nn_ops from tensorflow.python.framework import ops from tensorflow....
Review this code and list any quality issues.
[ { "issue": "Function 'sigmoid_balanced_cross_entropy_with_logits' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 16 }, { "issue": "Function '__init__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", ...
6
python
import pandas as pd __author__ = 'slei' class AddHeuristicTSP: """ Finds the shortest path using a heuristic method """ def __init__(self, cities_df): self.df = cities_df self.edges = list((t.origin, t.destination) for t in df.itertuples()) self.distance = dict([((t.origin, t.destina...
Review this code and list any quality issues.
[ { "issue": "Function 'find_subtour' is 46 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 22 } ]
1
python
#!/usr/bin/env python3 # Copyright (c) 2016 The Sikacoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test Hierarchical Deterministic wallet function.""" from test_framework.test_framework import SikacoinTest...
Review this code and list any quality issues.
[ { "issue": "Function 'run_test' is 56 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 20 } ]
1
python
import torch.nn as nn import torch from torch.autograd import Variable import math import torch.utils.model_zoo as model_zoo from commons.siam_mask.models.features import Features __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152'] model_urls = { 'resnet18': 'https://dow...
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": 30 }, { "issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 62 }, { "i...
8
python
# import gevent.monkey # gevent.monkey.patch_socket() from pyEtherCAT import MasterEtherCAT import time import os #============================================================================# # C95用の簡易EtherCATパッケージです。 # 本来は細かいパケットに付いて理解を深めた上で仕組みを構築していきますが、 # 説明も実験も追いつかず、ひとまずGPIOで高速にON/OFF出来る部分だけを纏めました。 # 動作は Linux(R...
Review this code and list any quality issues.
[ { "issue": "Function 'EtherCAT_SetUp' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 21 }, { "issue": "Function 'main' is 39 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 67 ...
2
python
# Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. import itertools import os import shutil import tempfile import mock from nose.tools import raises, assert_raises try: from . import parse_s3 from digits.tools.mock_s3_walker import MockS3Walker import_failed = False except ImportError:...
Review this code and list any quality issues.
[ { "issue": "Function 'test_making_2' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 194 }, { "issue": "Function 'test_mock_url' is 37 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "m...
2
python
import re import time import typing import logging from calendar import monthrange from datetime import datetime from collections import Iterable from heapq import heappush, heappop from . import types # noqa from . exceptions import BrokerError from . interfaces import App, Plugin, Logger from . utils import cached_p...
Review this code and list any quality issues.
[ { "issue": "Function 'on_task_start' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 45 }, { "issue": "Function 'on_task_done' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 49 }, ...
14
python
#!/usr/bin/env python3 from app import app, db, functions from app.functions import Color import subprocess import os import shlex import shutil from config import Config from datetime import datetime from cryptography.fernet import InvalidToken from app.cipher import CipherTest, Cipher, new_cipher_key, encrypt, decryp...
Review this code and list any quality issues.
[ { "issue": "Function 'init_db' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 79 } ]
1
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # Software License Agreement (BSD License) # # Copyright (c) 2021, Kei Okada # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions...
Review this code and list any quality issues.
[ { "issue": "Function 'test_rwt_robot_monitor_plotter' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 109 }, { "issue": "Function 'test_rwt_robot_monitor_plotter' is 44 lines long. Functions over 25 lines are harder to test ...
2
python
import pandas as pd from datanator.util import rna_halflife_util import datetime import datanator.config.core import datetime from pymongo.collation import Collation, CollationStrength class Halflife(rna_halflife_util.RnaHLUtil): def __init__(self, cache_dir=None, server=None, src_db=None, protein_col=None, ...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 13 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 11 }, { "issue": "Function 'fill_uniprot' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", ...
5
python
import os from pathlib import Path import numpy as np import pytest from jina import Flow, Document from jina.clients import Client from jina.logging.profile import TimeContext from jina.parsers import set_client_cli_parser from typing import Dict from jina import DocumentArray, Executor, requests class DumpExecuto...
Review this code and list any quality issues.
[ { "issue": "Function 'test_dump_reload' is 37 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 95 }, { "issue": "Function 'test_dump_reload' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "lin...
2
python
# -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
Review this code and list any quality issues.
[ { "issue": "Function 'load_entity' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 15 }, { "issue": "Function 'load_entity' is 32 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major...
7
python
# -*- coding: utf-8 -*- ########################################################################## # NSAp - Copyright (C) CEA, 2019 # Distributed under the terms of the CeCILL-B license, as published by # the CEA-CNRS-INRIA. Refer to the LICENSE file or to # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html #...
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": 83 }, { "issue": "Function '__call__' is 35 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 93 } ]
2
python
# -*- coding: utf-8 -*- from PySide2 import QtCore, QtGui, QtWidgets import json import core_functions as cf import numpy as np from UI_labeled_slider import LabeledSlider class Ui_AssignGroup(object): def setupUi(self, AssignGroups): # Note: this is not how it should be done but currently I don't know ...
Review this code and list any quality issues.
[ { "issue": "Function 'setupUi' is 128 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 12 } ]
1
python
import numpy as np def FNS(scores): domination = np.all(scores[:, None, :] <= scores[None, :, :], axis=2) # domination[i, j] = "i dominuje j" domination &= np.any(scores[:, None, :] < scores[None, :, :], axis=2) Nx = domination.sum(0) Pf = [] ranks = np.zeros(scores.shape[0]) r = 0 Q = n...
Review this code and list any quality issues.
[ { "issue": "Function 'mutation' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 71 }, { "issue": "Function 'split_and_select' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 134 ...
7
python
""" Misc functions. """ import ipaddress import datetime import hashlib import json import netaddr import netifaces import os import re import requests import scapy.all as sc import subprocess import sys import threading import time import traceback import uuid import server_config IPv4_REGEX = re.compile(r'[0-9]{...
Review this code and list any quality issues.
[ { "issue": "Function 'gget_network_ip_range' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 168 }, { "issue": "Function 'get_my_mac_set' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller function...
2
python
# Project: py-trans # Author: Itz-fork import aiohttp from .language_codes import _get_full_lang_name, _get_lang_code from .errors import check_internet_connection, UnknownErrorOccurred class Async_PyTranslator: """ Async PyTranslator Class Note: Before Trying to Translate Create an instance of ...
Review this code and list any quality issues.
[ { "issue": "Function 'translate' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 44 } ]
1
python
""" Miscellaneous package utilities. .. include:: ../include/links.rst """ from itertools import chain, combinations from IPython import embed import numpy def all_subclasses(cls): """ Collect all the subclasses of the provided class. The search follows the inheritance to the highest-level class. I...
Review this code and list any quality issues.
[ { "issue": "Function 'string_table' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 36 } ]
1
python
import math import tensorflow as tf import os import struct import pdb import numpy as np from datasets import dataset_factory from nets import nets_factory import nets.resnet_v2 as resnet_v2 from preprocessing import preprocessing_factory slim = tf.contrib.slim def merge_predictions(predictions_fn): ''' Merge...
Review this code and list any quality issues.
[ { "issue": "Function 'merge_predictions' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 13 }, { "issue": "Function 'merge_predictions' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severi...
2
python
from __future__ import division import sys, os def run(args): for path in args: problem = None if (not os.path.isfile(path) or os.path.islink(path)): problem = "not a regular file" else: try: file_content = open(path, "rb").read() except Exception: problem = "no read acc...
Review this code and list any quality issues.
[ { "issue": "Function 'run' has cyclomatic complexity 17 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 4 }, { "issue": "Function 'run' is 43 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical", "lin...
2
python
""" ArcBall.py -- Math utilities, vector, matrix types and ArcBall quaternion rotation class >>> unit_test_ArcBall_module () unit testing ArcBall Quat for first drag [ 0.08438914 -0.08534209 -0.06240178 0.99080837] First transform [[ 0.97764552 -0.1380603 0.15858325 0. ] [ 0.10925253 0.97796899 0.1778779...
Review this code and list any quality issues.
[ { "issue": "Function 'unit_test_ArcBall_module' is 33 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 250 } ]
1
python
import os import boto3 import fsspec import pytest from moto import mock_s3 from datasets.filesystems import ( COMPRESSION_FILESYSTEMS, HfFileSystem, S3FileSystem, extract_path_from_uri, is_remote_filesystem, ) from .utils import require_lz4, require_zstandard @pytest.fixture(scope="function") ...
Review this code and list any quality issues.
[ { "issue": "Function 'test_compression_filesystems' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 66 } ]
1
python
# Copyright 2014 Facebook, Inc. # You are hereby granted a non-exclusive, worldwide, royalty-free license to # use, copy, modify, and distribute this software in source code or binary # form for use in connection with the web services and APIs provided by # Facebook. # As with any software that integrates with the Fa...
Review this code and list any quality issues.
[ { "issue": "Function 'api_get' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 51 }, { "issue": "Function 'api_get' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "l...
3
python
# encoding: utf-8 import datetime import re import requests from ckan.common import config from ckan.common import asbool from six import text_type, string_types from ckan.common import _, json import ckan.lib.maintain as maintain log = __import__('logging').getLogger(__name__) class License(object): """Doma...
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": 21 }, { "issue": "Function 'load_licenses' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "sever...
2
python
from loguru import logger from flask import request from flasgger import swag_from from flask_restful import Resource from jwt.exceptions import ExpiredSignatureError from ada_friend_app.modulo.cripto import Sha256 from ada_friend_app.modulo.jwt_auth import Token from ada_friend_app.api.resposta_api import Resposta fr...
Review this code and list any quality issues.
[ { "issue": "Function 'post' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 15 } ]
1
python
import sys import matplotlib.pyplot as plt import numpy as np import pandas as pd class Simulation: def __init__(self, init_investment, stock_returns, strategy, predicted_movements=None): self.init_investment = init_investment self.predicted_movements = predicted_movements self.stock_retur...
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": 8 } ]
1
python
import unittest from pyowm.agroapi10.polygon import Polygon, GeoPoint, GeoPolygon class TestPolygon(unittest.TestCase): geopoint= GeoPoint(34, -56.3) geopolygon = GeoPolygon([ [[2.3, 57.32], [23.19, -20.2], [-120.4, 19.15], [2.3, 57.32]] ]) def test_polygon_fails_with_wrong_parameters(self):...
Review this code and list any quality issues.
[ { "issue": "Function 'test_from_dict' is 52 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 28 } ]
1
python
import spacy from spacy.lang.en import English from spacy.util import minibatch, compounding from spacy.util import decaying class ExperimentParam: def __init__(self, TRAIN_DATA: list, max_batch_sizes: dict, model_type='ner', dropout_start: float = 0.6, dropout_end: float = 0.2, interval: float =...
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": 8 } ]
1
python
import torch import torch.optim as optim import torch.nn.functional as F import torch.nn as nn # import sys # sys.path.append("../simulated_fqi/") from simulated_fqi import NFQNetwork, ContrastiveNFQNetwork import matplotlib.pyplot as plt import numpy as np def train(x, y, groups, network, optimizer): predicted...
Review this code and list any quality issues.
[ { "issue": "Function 'train' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 13 } ]
1
python
""" OpenVINO DL Workbench Class for creation job for creating and exporting inference report Copyright (c) 2020 Intel Corporation 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://...
Review this code and list any quality issues.
[ { "issue": "Function 'run' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 42 } ]
1
python
# Copyright 2010 Google 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 agreed to in writing,...
Review this code and list any quality issues.
[ { "issue": "Function 'initialize_handler' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 26 } ]
1
python
# Copyright 2017 Rice University # # 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 writin...
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": 20 } ]
1
python
# coding: utf-8 """ Automox Console API API for use with the Automox Console # noqa: E501 OpenAPI spec version: 2021-11-16 Contact: support@automox.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six class OneOfDeviceFilter...
Review this code and list any quality issues.
[ { "issue": "Function 'to_dict' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 40 } ]
1
python
""" TODO: Add doc what this file is doing """ from marshmallow import Schema, post_dump class RootSchema(Schema): SKIP_VALUES = [None] @post_dump def remove_skip_values(self, data, many, **kwargs): return { key: value for key, value in data.items() if value not in self.SKI...
Review this code and list any quality issues.
[ { "issue": "Function 'add_extra' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 18 }, { "issue": "Function 'add_extra' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "lin...
2
python
# coding=utf-8 # Copyright 2018 The TF-Agents Authors. # # 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...
Review this code and list any quality issues.
[ { "issue": "Function '_action' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 102 }, { "issue": "Function '_action' is 45 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "...
2
python
from os import system def comprar(comida, juguetes): comprado = "" while not comprado: system("cls") comprar = (input("Que quiere comprar? Alimentos | Juguetes : ")).lower() if comprar == "alimento": print(f"Carne: {comida['carne']['cantidad']}|Agua: {comida['agua']['cantidad']}|Huesos: {comida['hueso'...
Review this code and list any quality issues.
[ { "issue": "Function 'comprar' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 3 } ]
1
python
import numpy as np class NeuralNetwork(object): def __init__(self, topology, epsilon, numLabels): self.theta = [] self.topology = topology self.numLabels = numLabels self.gradientChecking = False for layer in range(len(self.topology)): if layer == 0: ...
Review this code and list any quality issues.
[ { "issue": "Function 'gradientDescent' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 15 }, { "issue": "Function 'gradientDescent' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "majo...
5
python
#!/usr/bin/env python3 """Read a correct swagger file and check whether it conforms to a style guide.""" import argparse import pathlib from typing import List import sys import swagger_to.intermediate import swagger_to.style import swagger_to.swagger def main() -> int: """Execute the main routine.""" parse...
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": 14 } ]
1
python
# coding: utf-8 """ Katib Swagger description for Katib # noqa: E501 The version of the OpenAPI document: v1beta1-0.1 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six from kubeflow.katib.configuration import Configuration class V1beta1Experiment...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 63 }, { "issue": "Function '__init__' is 38 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical...
4
python
from collections import namedtuple import os import json import numpy as np from tqdm import tqdm from data_generators.utils import load_image_rgb # Copied from: https://github.com/mcordts/cityscapesScripts/blob/master/cityscapesscripts/helpers/labels.py # # Cityscapes labels # #-------------------------------------...
Review this code and list any quality issues.
[ { "issue": "Function 'load_kitti' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 93 } ]
1
python
# Copyright (c) 2018-2022 Micro Focus or one of its affiliates. # Copyright (c) 2018 Uber Technologies, 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/licen...
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": 58 } ]
1
python
#!/usr/bin/python from __future__ import (absolute_import, division, print_function) # Copyright 2019 Fortinet, Inc. # # 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 Lic...
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": 228 } ]
1
python
import pycurl import sys, getopt from StringIO import StringIO import json import copy from importCommon import * from importNormativeTypes import * import importCommon ######################################################################################################################################################...
Review this code and list any quality issues.
[ { "issue": "Function 'importOnapTypes' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 22 }, { "issue": "Function 'main' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", ...
3
python
from datetime import datetime, timezone from http import HTTPStatus from json import dumps, load from logging import getLogger from os import environ from unittest.mock import MagicMock, patch from mypy_boto3_events import EventBridgeClient from mypy_boto3_lambda import LambdaClient from mypy_boto3_sns.type_defs impor...
Review this code and list any quality issues.
[ { "issue": "Function 'should_notify_slack_with_finished_details_when_url_set' is 42 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 66 }, { "issue": "Function 'should_notify_slack_when_step_function_failed' is 33 lines long. Functions over 25 l...
3
python
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2015, Joseph Callen <jcallen () csc.com> # Copyright: (c) 2018, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ...
Review this code and list any quality issues.
[ { "issue": "Function 'create_datacenter' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 107 }, { "issue": "Function 'create_datacenter' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "sever...
2
python
# -*- coding: utf-8 -*- import re from six.moves import http_client from six.moves import urllib from wsgiref.headers import Headers class Request(object): def __init__(self, environ): self.environ = environ @property def path(self): return self.environ['PATH_INFO'] @property de...
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": 25 } ]
1
python
#!/usr/bin/python from __future__ import (absolute_import, division, print_function) # Copyright 2019 Fortinet, Inc. # # 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 Lic...
Review this code and list any quality issues.
[ { "issue": "Function 'ips_rule_settings' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 236 }, { "issue": "Function 'main' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "sev...
3
python
import glob import logging import os from typing import Any, Dict, List, Optional from django.conf import settings from zerver.lib.storage import static_path # See https://jackstromberg.com/2013/01/useraccountcontrol-attributeflag-values/ # for docs on what these values mean. LDAP_USER_ACCOUNT_CONTROL_NORMAL = '512'...
Review this code and list any quality issues.
[ { "issue": "Function 'generate_dev_ldap_dir' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 15 }, { "issue": "Function 'generate_dev_ldap_dir' is 38 lines long. Functions over 25 lines are harder to test and maintain.", ...
2
python
from motor.motor_asyncio import AsyncIOMotorClient from pymongo import MongoClient __all__ = ['PymongoConnection', 'MotorConnection'] class PymongoConnection: def __init__(self, host="127.0.0.1", port="27017", db="default", user=None, password=None): """Create database connection.""" if user and...
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": 9 }, { "issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 31 } ]
2
python
import os, collections, sqlite3 from flask import Flask, render_template from flask.ext.bootstrap import Bootstrap from AsciiDammit import asciiDammit app = Flask(__name__) bootstrap = Bootstrap(app) import util as wpu configDict = {} appDataDirDict = {} appName = "waypointapp" @app.route('/') def index(): appName...
Review this code and list any quality issues.
[ { "issue": "Function 'reportAppIndex' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 21 }, { "issue": "Function 'reportHelper' has cyclomatic complexity 24 (threshold: 5). Consider breaking it into smaller functions.", ...
3
python
""" Created: 16 August 2018 Last Updated: 16 August 2018 Dan Marley daniel.edison.marley@cernSPAMNOT.ch Texas A&M University ----- Class for performing deep learning in pytorch Designed for running on desktop at TAMU with specific set of software installed --> not guaranteed to work in CMSSW environment! D...
Review this code and list any quality issues.
[ { "issue": "Function 'train_model' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 126 }, { "issue": "Function 'train_model' is 43 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor...
2
python
""" Segment_tree creates a segment tree with a given array and function, allowing queries to be done later in log(N) time function takes 2 values and returns a same type value """ class SegmentTree: def __init__(self, arr, function): self.segment = [0 for x in range(3 * len(arr) + 3)] self.arr = a...
Review this code and list any quality issues.
[ { "issue": "Function '__query' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 23 }, { "issue": "Function '__query' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": ...
2
python
import copy import math import matplotlib.pyplot as plt import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from utils.utils import clones class LayerNormGoogle(nn.Module): def __init__(self, features, epsilon=1e-6): super(LayerNormGo...
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": 51 }, { "issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 65 }, { "i...
7
python
from tensorflow import keras from constants import TRADING_DAYS_PER_WEEK, INDEX_RETURN_INDICATOR_NUMBER from ..constants import * MODEL_NAME = 'ifcp_model_ver1_2' ROLLING_WINDOW_SIZE = TRADING_DAYS_PER_WEEK def build_model(): fund1_return = keras.Input(shape=(ROLLING_WINDOW_SIZE, 1), name=FUND1_RETURN_NAME) ...
Review this code and list any quality issues.
[ { "issue": "Function 'build_model' is 48 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 10 } ]
1
python
# encoding: utf-8 from datetime import datetime, timedelta from django.conf import settings from django.contrib.auth.models import Group from django.core.management.base import BaseCommand from dateutil.tz import tzlocal from core.models import Event, Venue from programme.models import ProgrammeEventMeta, TimeBlock...
Review this code and list any quality issues.
[ { "issue": "Function 'handle' is 48 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 19 } ]
1
python
import argparse import numpy as np import cv2 from TauLidarCommon.frame import FrameType from TauLidarCamera.camera import Camera def setup(serialPort=None): port = None camera = None # if no serial port is specified, scan for available Tau Camera devices if serialPort is None: ports = Camera...
Review this code and list any quality issues.
[ { "issue": "Function 'setup' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 8 } ]
1
python
# Created by Thomas Jones on 06/11/15 - thomas@tomtecsolutions.com # branding.py, a plugin for minqlx to brand your server. # This plugin is released to everyone, for any purpose. It comes with no warranty, no guarantee it works, it's released AS IS. # You can modify everything, except for lines 1-4 and the !tomtec_ver...
Review this code and list any quality issues.
[ { "issue": "Function 'brand_map' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 46 }, { "issue": "Function 'brand_map' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", ...
2
python
# HitObject class class HitObject: def __init__(self, start_x, start_y, end_x, end_y, time, object_type): self.start_x = start_x self.start_y = start_y self.end_x = end_x self.end_y = end_y self.time = time self.object_type = object_type # hit_circle, eve...
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": 5 } ]
1
python
import operator from functools import reduce from django.contrib.auth import get_user_model from django.contrib.auth.decorators import login_required from django.db.models import Q, Sum from django.shortcuts import HttpResponse, get_object_or_404, redirect, render from django.views.generic import View from django.view...
Review this code and list any quality issues.
[ { "issue": "Function 'get' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 132 }, { "issue": "Function 'post' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": ...
3
python
# Author: Javad Amirian # Email: amiryan.j@gmail.com import xml.etree.ElementTree as et import numpy as np import pandas as pd from opentraj.toolkit.core.trajdataset import TrajDataset from opentraj.toolkit.utils.calibration.camera_calibration_tsai import * def load_pets(path, **kwargs): """ :param path: a...
Review this code and list any quality issues.
[ { "issue": "Function 'load_pets' is 68 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 13 } ]
1
python
import torch import torch.nn as nn import torch.nn.functional as F from mp.models.segmentation.unet_fepegar import UNet2D ### UNet Wrapper ### class UNet2D_dis(UNet2D): r"""Wrapper for UNet2D to access encoder and decoder seperately. """ def __init__(self, *args, **kwargs): super(UNet2D_dis, self)....
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": 103 }, { "issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 125 }, { ...
8
python
"""Tornado handlers for nbgrader assignment list web service.""" import os import json import contextlib import traceback from tornado import web from notebook.utils import url_path_join as ujoin from nbgrader.exchange import ExchangeFactory from nbgrader.coursedir import CourseDirectory from nbgrader.auth import A...
Review this code and list any quality issues.
[ { "issue": "Function 'submit_assignment' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 34 } ]
1
python
import os import shutil from multiprocessing.pool import Pool import cv2 import numpy as np from functools import partial from path import Path def process_scene(input_directory, output_folder): K = np.array([[525.0, 0.0, 320.0], [0.0, 525.0, 240.0], [0.0, 0.0, 1.0]]) prin...
Review this code and list any quality issues.
[ { "issue": "Function 'process_scene' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 11 }, { "issue": "Function 'process_scene' is 30 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "mi...
3
python
import pygame import math import glob import os tilesize = 128 # pixels per tile def tiletosurface(tile): pass def maptosurface(sx,sy,ex,ey,oholmap): pass def main(windowsize,tilepipe,OHOLMap): wt = math.floor(windowsize/tilesize) cx,cy,first = 0,0,True if OHOLMap.data != {}: for x in OHOL...
Review this code and list any quality issues.
[ { "issue": "Function 'maptosurface' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 10 }, { "issue": "Function 'main' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line"...
2
python
import json import os import sys import disnake from disnake.ext import commands from disnake.ext.commands import Context from helpers import json_manager, checks import logging if not os.path.isfile("../config.json"): sys.exit("'config.json' not found by general-normal! Please add it and try again.") else: ...
Review this code and list any quality issues.
[ { "issue": "Function 'blacklist_add' is 32 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 94 } ]
1
python
# Copyright (c) 2019 UniMoRe, Matteo Spallanzani import torch from ..utils.utils import xywh2xyxy, bbox_iou def clip_boxes(boxes): boxes[:, [0, 2]] = boxes[:, [0, 2]].clamp(min=0, max=1) boxes[:, [1, 3]] = boxes[:, [1, 3]].clamp(min=0, max=1) def postprocess_pr(pr_outs, conf_thres=0.001, overlap_thres=0.5...
Review this code and list any quality issues.
[ { "issue": "Function 'postprocess_pr' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 13 }, { "issue": "Function 'postprocess_pr' is 39 lines long. Functions over 25 lines are harder to test and maintain.", "severity": ...
2
python
# Copyright 2020-2022 OpenDR European Project # # 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 'setUpClass' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 52 }, { "issue": "Function 'test_infer.test_model' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", ...
2
python
#!/usr/bin/env python3 import argparse import os import subprocess import sys def setup(): global args, workdir programs = ['ruby', 'git', 'apt-cacher-ng', 'make', 'wget'] if args.kvm: programs += ['python-vm-builder', 'qemu-kvm', 'qemu-utils'] elif args.docker: dockers = ['docker.io',...
Review this code and list any quality issues.
[ { "issue": "Function 'setup' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 8 }, { "issue": "Function 'setup' is 37 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line"...
5
python
import copy import torch.nn as nn from rlkit.launchers.launcher_util import setup_logger import rlkit.torch.pytorch_util as ptu from rlkit.core.ma_eval_util import get_generic_ma_path_information def experiment(variant): num_agent = variant['num_agent'] from differential_game import DifferentialGame expl_e...
Review this code and list any quality issues.
[ { "issue": "Function 'experiment' is 100 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 7 } ]
1
python
# LICENSE: Simplified BSD https://github.com/mmp2/megaman/blob/master/LICENSE from nose import SkipTest import numpy as np from numpy.testing import assert_allclose, assert_raises, assert_equal from scipy.sparse import isspmatrix from scipy.spatial.distance import cdist, pdist, squareform from megaman.geometry impor...
Review this code and list any quality issues.
[ { "issue": "Function 'test_adjacency' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 36 } ]
1