language
stringclasses
1 value
code
stringlengths
407
33.3k
instruction
stringclasses
1 value
flaws
listlengths
1
17
flaw_count
int64
1
17
python
# coding=utf-8 # Copyright 2019 The TensorFlow Datasets 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 appl...
Review this code and list any quality issues.
[ { "issue": "Function 'main' is 33 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 42 } ]
1
python
from warnings import simplefilter simplefilter(action='ignore', category=FutureWarning) import numpy as np import argparse import pandas as pd from tqdm.auto import tqdm from datetime import datetime from sklearn.metrics import log_loss import seaborn as sns import matplotlib.pyplot as plt from utils.functions import...
Review this code and list any quality issues.
[ { "issue": "Function 'main' has cyclomatic complexity 39 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 27 }, { "issue": "Function 'main' is 255 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical", ...
3
python
""" Copyright (c) 2022 Huawei Technologies Co.,Ltd. openGauss is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W...
Review this code and list any quality issues.
[ { "issue": "Function 'test_systools' is 31 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 59 } ]
1
python
import atexit from threading import Event, Thread, current_thread from time import time from warnings import warn __all__ = ["TMonitor", "TqdmSynchronisationWarning"] class TqdmSynchronisationWarning(RuntimeWarning): """tqdm multi-thread/-process errors which may cause incorrect nesting but otherwise no adve...
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": 53 } ]
1
python
''' * * (C) Copyright Broadcom Corporation 2015 * * 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 appli...
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": 35 }, { "issue": "Function 'step1' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 4...
4
python
""" This script is brought from https://github.com/nkolot/SPIN Adhere to their licence to use this script """ import math import torch import numpy as np import os.path as osp import torch.nn as nn from lib.core.config import DATA_DIR from lib.utils.geometry import rotation_matrix_to_angle_axis, rot6d_to_rotmat from ...
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": 18 }, { "issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 18 }, { ...
6
python
from typing import Optional from typing import Union from collections.abc import Callable import numpy as np from .typing import RandomStateType from .typing import Literal class DictionaryLearning: components_: np.ndarray error_: np.ndarray n_iter_: int def __init__( self, n_compon...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 18 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 16 }, { "issue": "Function '__init__' has 9 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 48 }, {...
13
python
# coding: utf-8 # ----------------------------------------------------------------------------------- # <copyright company="Aspose" file="insert_list_online_request.py"> # Copyright (c) 2021 Aspose.Words for Cloud # </copyright> # <summary> # Permission is hereby granted, free of charge, to any person obtaining a c...
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": 47 }, { "issue": "Function 'create_http_request' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", "severity": "maj...
3
python
# ROS/IOP Bridge # Copyright (c) 2017 Fraunhofer # # This program is dual licensed; you can redistribute it and/or # modify it under the terms of the GNU General Public License # version 2 as published by the Free Software Foundation, or # enter into a proprietary license agreement with the copyright # holder. # # This...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 47 }, { "issue": "Function 'ocu_client' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", ...
7
python
"""Command line wrapper to serve one or more named Bokeh scripts or folders.""" import logging import os import re import pathlib import tempfile from typing import Any, Dict, Tuple import bokeh.server.views import click from bokeh.application.application import Application from bokeh.command.util import build_single_...
Review this code and list any quality issues.
[ { "issue": "Function '_get_applications' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 105 }, { "issue": "Function '_get_server_kwargs' has 5 parameters. Consider using a parameter object to reduce arity.", "severity":...
4
python
import functools import operator import os import os.path import sys import numpy as np # Bamboo utilities current_file = os.path.realpath(__file__) current_dir = os.path.dirname(current_file) sys.path.insert(0, os.path.join(os.path.dirname(current_dir), 'common_python')) import tools # ==============================...
Review this code and list any quality issues.
[ { "issue": "Function 'construct_model' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 57 }, { "issue": "Function 'construct_model' is 55 lines long. Functions over 25 lines are harder to test and maintain.", "severity":...
2
python
from runner_master import runner import os import io import torch import logging from PIL import Image, ImageFile from runner_master.runner.data import datasets # to fix "OSError: image file is truncated" ImageFile.LOAD_TRUNCATED_IMAGES = True class ImagenameDataset(datasets.ImglistDatasetV2): def getitem(self, i...
Review this code and list any quality issues.
[ { "issue": "Function 'getitem' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 13 } ]
1
python
import json from transformers.tokenization_utils import PreTrainedTokenizer from yacs.config import CfgNode from openprompt.data_utils.data_utils import InputFeatures import re from openprompt import Verbalizer from typing import * import torch import torch.nn as nn import torch.nn.functional as F from openprompt.utils...
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": 29 }, { "issue": "Function 'add_prefix' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "...
3
python
# -*- coding: utf-8 -*- """ .. autoclass:: Blueprint """ from sanic.blueprints import Blueprint as BaseBlueprint, FutureRoute __all__ = ('Blueprint',) class Blueprint(BaseBlueprint): """Create a new blueprint. :param name: unique name of the blueprint :param url_prefix: URL to be prefixed before all ro...
Review this code and list any quality issues.
[ { "issue": "Function 'register' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 27 } ]
1
python
# Copyright [yyyy] [name of copyright owner] # 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.or...
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": 28 }, { "issue": "Function 'step' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 3...
6
python
#!/usr/bin/env python import krylov import splitting import tool import numpy as np import math import metric import accel def parse_args(): """command line arguments""" import argparse parser = argparse.ArgumentParser(description='benchmark LCP solvers') parser.add_argument('filenames', nargs=...
Review this code and list any quality issues.
[ { "issue": "Function 'bench' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 124 }, { "issue": "Function 'bench' is 40 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line...
2
python
import torch import torch.nn as nn class ChamferLoss(nn.Module): def __init__(self): super(ChamferLoss, self).__init__() self.use_cuda = torch.cuda.is_available() def forward(self, preds, gts, reverse=True, bidirectional=True): def compute_loss(preds, gts): P = self.batch...
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": 11 } ]
1
python
""" Copyright (c) 2019 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://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 11 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 44 }, { "issue": "Function 'forward' is 35 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 57 } ]
2
python
#!/usr/bin/env python """ a small class for Principal Component Analysis Usage: p = PCA( A, fraction=0.90 ) In: A: an array of e.g. 1000 observations x 20 variables, 1000 rows x 20 columns fraction: use principal components that account for e.g. 90 % of the total variance Out: p.U, p.d, p.Vt: f...
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": 114 } ]
1
python
import sm import aslam_backend as aopt import aslam_cv as cv import numpy as np def addPoseDesignVariable(problem, T0=sm.Transformation()): q_Dv = aopt.RotationQuaternionDv( T0.q() ) q_Dv.setActive( True ) problem.addDesignVariable(q_Dv) t_Dv = aopt.EuclideanPointDv( T0.t() ) t_Dv.setActive( True )...
Review this code and list any quality issues.
[ { "issue": "Function 'stereoCalibrate' has cyclomatic complexity 28 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 15 }, { "issue": "Function 'stereoCalibrate' is 115 lines long. Functions over 25 lines are harder to test and maintain.", "sever...
7
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 u...
Review this code and list any quality issues.
[ { "issue": "Function 'test_residual_bidirectional' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 106 } ]
1
python
import logging from finorch.config.config import api_config_manager from finorch.sessions.cit.client import CITClient from finorch.sessions.abstract_session import AbstractSession from finorch.sessions.cit.wrapper import CITWrapper from finorch.transport.ssh import SshTransport class CITSession(AbstractSession): ...
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": 16 } ]
1
python
import _plotly_utils.basevalidators class LineValidator(_plotly_utils.basevalidators.CompoundValidator): def __init__( self, plotly_name='line', parent_name='scattergeo.marker', **kwargs ): super(LineValidator, self).__init__( plotly_name=plotly_name, parent_name=paren...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' is 81 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 6 } ]
1
python
def wer(r, h): """ Calculation of WER with Levenshtein distance. Works only for iterables up to 254 elements (uint8). O(nm) time ans space complexity. Parameters ---------- r : list h : list Returns ------- int Examples -------- >>> wer("who is there".split(),...
Review this code and list any quality issues.
[ { "issue": "Function 'wer' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 1 } ]
1
python
# Copyright (c) 2013, Blue Lynx and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ import math from frappe.utils import getdate, get_time, flt from datetime import datetime, timedelta, date, time import calendar def execute(fil...
Review this code and list any quality issues.
[ { "issue": "Function 'get_column' is 53 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 19 }, { "issue": "Function 'get_data' has cyclomatic complexity 23 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical"...
5
python
def cycle_sort(data: list): cap = len(data) for start in range(0, cap - 1): # get item item = data[start] # get new pos for said item pos = start for i in range(start + 1, cap): if data[i] < item: pos += 1 # if there isnt a new pos, ski...
Review this code and list any quality issues.
[ { "issue": "Function 'cycle_sort' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 1 } ]
1
python
""" #EmbraceTheS's options menu state. """ import state import menu import globes import pygame import joystick import volume class Options(state.State): """ Option menu state with the options to clear high scores, and adjust brightness/volume (not yet implemented) """ TEXT = [] BACKGROUND = Non...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 20 }, { "issue": "Function '__init__' is 30 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", ...
5
python
# !usr/bin/env python # -*- coding: utf-8 -*- # # Licensed under a 3-clause BSD license. # from __future__ import print_function, division, absolute_import from flask import request def process_request(request=None, as_dict=None, param=None): '''Generally process the request for POST or GET, and build a form dic...
Review this code and list any quality issues.
[ { "issue": "Function 'process_request' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 11 } ]
1
python
import pytest from rasa.core.channels.channel import UserMessage from rasa.core.domain import Domain from rasa.core.events import SlotSet, ActionExecuted, Restarted from rasa.core.tracker_store import ( TrackerStore, InMemoryTrackerStore, RedisTrackerStore, SQLTrackerStore, ) from rasa.utils.endpoints ...
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": 93 } ]
1
python
"""randomdest.py - dearpygui app to plot random destinations""" import math import os import random import requests from dotenv import load_dotenv from dearpygui.core import * from dearpygui.simple import * # globals/constants EARTH_RADIUS = 6378.1 MAX_DIST = 16 # destination radius in KM maps_key = "" BASE_URL = "...
Review this code and list any quality issues.
[ { "issue": "Function 'show_route' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 117 }, { "issue": "Function 'main' is 36 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "...
2
python
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from optionaldict import optionaldict from teambition.api.base import TeambitionAPI class Works(TeambitionAPI): def get(self, id=None, parent_id=None, page=None, count=None, all=None): """ 获取文件信息 详情请参考 ...
Review this code and list any quality issues.
[ { "issue": "Function 'get' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 10 }, { "issue": "Function 'create' has 10 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 38 }, { "issu...
4
python
from common.python.simulations import BlockSimulation, properties_from_ini from collections import deque # max queue size MAX_QUEUE = 1023 # min FPGA deadtime between queued pulses MIN_QUEUE_DELTA = 4 # time taken to clear queue QUEUE_CLEAR_TIME = 4 NAMES, PROPERTIES = properties_from_ini(__file__, "pulse.block.in...
Review this code and list any quality issues.
[ { "issue": "Function 'do_pulse' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 34 }, { "issue": "Function 'on_changes' has cyclomatic complexity 33 (threshold: 5). Consider breaking it into smaller functions.", "sev...
3
python
def generate_gaussianFile(geom, grid, logger, outdir="./", igrid=0, maxbq=200): gaussianfile = outdir + \ "input_batch_{:05d}.com".format(igrid) f = open(gaussianfile, "w") # f.write("%OldChk=/home/aartigas/chk/molecule_spe.chk\n".format()) f.write("%nproc=8\n".format()) f.write("%mem=1000MB\...
Review this code and list any quality issues.
[ { "issue": "Function 'generate_gaussianFile' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 1 }, { "issue": "Function 'generate_gaussianFile' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major",...
2
python
import torch from mmdet.core import force_fp32, images_to_levels from ..builder import HEADS from ..losses import carl_loss, isr_p from .retina_head import RetinaHead @HEADS.register_module() class PISARetinaHead(RetinaHead): """PISA Retinanet Head. The head owns the same structure with Retinanet Head, but ...
Review this code and list any quality issues.
[ { "issue": "Function 'loss' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 21 }, { "issue": "Function 'loss' is 98 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line":...
3
python
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from itertools import chain import numpy as np import torch from torch import nn as nn from torch.autograd import Variable from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence from tqdm import tqdm import sys from diff_repres...
Review this code and list any quality issues.
[ { "issue": "Function 'forward' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 33 }, { "issue": "Function 'forward' is 42 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "l...
2
python
# Copyright 2019 Google LLC # # 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 # # https://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 'main' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 26 } ]
1
python
class Solution: def search(self, nums: List[int], target: int) -> bool: i,j=0,len(nums) while i<j: m=i+(j-i)//2 if nums[m]==target: return True if nums[m]>nums[i]: if target>=nums[i] and target<nums[m]: j=m else:...
Review this code and list any quality issues.
[ { "issue": "Function 'search' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 2 } ]
1
python
# -*- coding: utf-8 -*- #/usr/bin/env python import numpy as np import matplotlib.pylab as plt from timer import Timer from chebpy import ETDRK4FxCy, ETDRK4FxCy2, BC, ETDRK4 from chebpy import ROBIN, DIRICHLET def test_etdrk4fxcy(): ''' The test function is u = e^[f(x,y) - t] where ...
Review this code and list any quality issues.
[ { "issue": "Function 'test_etdrk4fxcy' is 79 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 12 }, { "issue": "Function 'test_etdrk4' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "lin...
2
python
from flask import Flask, jsonify,render_template,request from config import API_KEY import datetime from collections import defaultdict import requests import pandas as pd import sys import logging from itertools import repeat app = Flask(__name__) gunicorn_error_logger = logging.getLogger('gunicorn.error') app.logger...
Review this code and list any quality issues.
[ { "issue": "Function 'getDistanceMatrix' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 39 }, { "issue": "Function 'getChartData' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major...
3
python
import numbers, random class Sprite1d: """A one-dimensional sprite with subpixel positioning.""" def __init__(self, icon, color_list, speed=0, acceleration=0, bound=(0, 1), position=0, center=None): self.color_list = color_list if hasattr(color_list, 'dtype'): self...
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": 6 }, { "issue": "Function '_combine_numpy' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 43 }, { ...
3
python
import os import pystac from pystac.utils import str_to_datetime import rasterio as rio from shapely.geometry import box, mapping, shape from stactools.cgls_lc100.constants import ( PROVIDER_NAME, ITEM_TIF_IMAGE_NAME, DISCRETE_CLASSIFICATION_CLASS_NAMES, DISCRETE_CLASSIFICATION_CLASS_PALETTE) def create_ite...
Review this code and list any quality issues.
[ { "issue": "Function 'create_item' is 57 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 13 } ]
1
python
# Copyright 2019 The Simons Foundation, Inc. - All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
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": 32 } ]
1
python
import os import re import tempfile from argparse import ArgumentParser, RawTextHelpFormatter from typing import Any from django.conf import settings from django.db import connection from django.utils.timezone import now as timezone_now from scripts.lib.zulip_tools import TIMESTAMP_FORMAT, parse_os_release, run from ...
Review this code and list any quality issues.
[ { "issue": "Function 'handle' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 29 }, { "issue": "Function 'handle' is 99 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "li...
2
python
# Copyright (c) 2009-2017 The Regents of the University of Michigan # This file is part of the HOOMD-blue project, released under the BSD 3-Clause License. # Maintainer: joaander / All Developers are free to add commands for new features R""" Electrostatic potentials. Charged interactions are usually long ranged, an...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 79 }, { "issue": "Function 'set_params' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", ...
7
python
from tensorflow.keras.models import load_model from clean import downsample_mono, envelope from kapre.time_frequency import STFT, Magnitude, ApplyFilterbank, MagnitudeToDecibel from sklearn.preprocessing import LabelEncoder import numpy as np from glob import glob import argparse import os import pandas as pd from tqdm...
Review this code and list any quality issues.
[ { "issue": "Function 'make_prediction' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 13 }, { "issue": "Function 'make_prediction' is 35 lines long. Functions over 25 lines are harder to test and maintain.", "severity":...
2
python
from functools import partial from pprint import pprint import matplotlib.pyplot as plt # import test2 from simglucose.controller.base import Controller #from datetime import datetime, timedelta, time import numpy as np import math percent_value = 0.05 sign = lambda x: math.copysign(1, x) normalize_f = lambda x: (x...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' is 31 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical", "line": 20 }, { "issue": "Function '__init__' has 9 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 20 }...
10
python
#!/usr/bin/env python3 # -*- encoding: 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 Apach...
Review this code and list any quality issues.
[ { "issue": "Function 'heron_class' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 41 }, { "issue": "Function 'heron_class' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", ...
5
python
# Residual Dense Network for Image Super-Resolution # https://arxiv.org/abs/1802.08797 # modified from: https://github.com/thstkdgus35/EDSR-PyTorch from argparse import Namespace import torch import torch.nn as nn from models import register class RDB_Conv(nn.Module): def __init__(self, inChannels...
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": 29 }, { "issue": "Function '__init__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line"...
4
python
# Copyright 2015 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
Review this code and list any quality issues.
[ { "issue": "Function 'test_basic_metadata_definition_namespaces' is 32 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 27 } ]
1
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This script runs tests on the system to check for compliance against different CIS Benchmarks. No changes are made to system files by this script. Audit only. License: MIT """ from argparse import ArgumentParser from datetime import datetime from time import sleep imp...
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": 30 }, { "issue": "Function '__init__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "li...
2
python
""" Test for the SmartThings lock platform. The only mocking required is of the underlying SmartThings API object so real HTTP calls are not initiated during testing. """ from pysmartthings import Attribute, Capability from pysmartthings.device import Status from openpeerpower.components.lock import DOMAIN as LOCK_DO...
Review this code and list any quality issues.
[ { "issue": "Function 'test_lock' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 40 } ]
1
python
from django.test import TestCase from rest_framework.test import APIRequestFactory, APIClient from .models import * from rest_framework import status # Create your tests here. class ProductCategoryTest(TestCase): @classmethod def setUpTestData(cls): ProductCategory.objects.create(name_product_category...
Review this code and list any quality issues.
[ { "issue": "Function 'setUpTestData' is 46 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 10 } ]
1
python
#!/usr/bin/env python3 """ Polyglot v2 node server for WeatherFlow Weather Station data. Copyright (c) 2018,2019 Robert Paauwe """ import polyinterface import sys import time import datetime import urllib3 import json import socket import math import threading LOGGER = polyinterface.LOGGER class WindNode(polyinterfac...
Review this code and list any quality issues.
[ { "issue": "Function 'update' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 54 } ]
1
python
import random import networkx as nx class Node: def __init__(self, ID=None, message=None, highercmnd=None, lev=None, parent=None, childNo=None, children_list=None, cmndlineup=None, cmndnodes=None, ancestor_list=None, descendant_list=None): self.ID = ID # an...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 12 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 5 } ]
1
python
from platform import python_version import hashlib import hmac import jwt import os import requests import sys import time from uuid import uuid4 import warnings if sys.version_info[0] == 3: string_types = (str, bytes) else: string_types = (unicode, str) __version__ = '2.0.0' class Error(Exception): pa...
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": 38 }, { "issue": "Function 'signature' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity...
3
python
from metrics import bleu, rouge import argparse def get_args(): ''' Parse input arguments: preds_path: The directory in which labels and predictions files are dumped after inference config_id: The config id mentioned in the labels and predictions filenames ''' parser = argparse.Argument...
Review this code and list any quality issues.
[ { "issue": "Function 'micro_compute_prf' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 40 }, { "issue": "Function 'ent_f1' is 32 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor...
2
python
""" Cache middleware. If enabled, each Django-powered page will be cached based on URL. The canonical way to enable cache middleware is to set ``UpdateCacheMiddleware`` as your first piece of middleware, and ``FetchFromCacheMiddleware`` as the last:: MIDDLEWARE = [ 'django.middleware.cache.UpdateCacheMiddl...
Review this code and list any quality issues.
[ { "issue": "Function 'process_response' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 79 }, { "issue": "Function 'process_response' is 32 lines long. Functions over 25 lines are harder to test and maintain.", "severit...
5
python
# Copyright 2010 New Relic, 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 writ...
Review this code and list any quality issues.
[ { "issue": "Function '_prepare_request' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 33 }, { "issue": "Function '_prepare_request_stream' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "li...
5
python
""" Implementation of a network using an Encoder-Decoder architecture. """ import torch.nn as tnn from torch import Tensor from reinvent_models.link_invent.networks.decoder import Decoder from reinvent_models.link_invent.networks.encoder import Encoder class EncoderDecoder(tnn.Module): """ An e...
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": 23 }, { "issue": "Function 'forward_decoder' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 46 } ]
2
python
#!/usr/bin/env python # ROS node libs import time import numpy as np import rospy import torch # from geometry_msgs.msg import Quaternion, Pose, Point, Vector3 from pyquaternion import Quaternion from google.protobuf import text_format from sensor_msgs.msg import PointCloud2 from std_msgs.msg import Header, ColorRGBA...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' is 51 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 30 }, { "issue": "Function 'lidar_callback' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major"...
3
python
# Copyright 2018 Dustin Ingram # # 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, so...
Review this code and list any quality issues.
[ { "issue": "Function 'check' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 77 }, { "issue": "Function 'check' is 33 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line"...
2
python
#!/usr/bin/env python # Sourced from https://gist.github.com/seventhskye/0cc7b2804252975d36dca047ab7729e9 with some modifications import os import boto3 def main(): client = boto3.client('s3') Bucket = os.environ.get('S3_BUCKET') Prefix = os.environ.get('S3_PREFIX', '') # leave blank to delete the entire conte...
Review this code and list any quality issues.
[ { "issue": "Function 'main' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 8 }, { "issue": "Function 'main' is 45 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": ...
2
python
import time import boto3 from lib.Logger import Logger from lib.popen import subprocess_popen def prepare(): # 0. Initialize boto3 clients emr = boto3.client('emr') ec2 = boto3.client('ec2') # 1. Create an EMR cluster on AWS logger.info("Creating the EMR cluster...") with open("./cloud/cluste...
Review this code and list any quality issues.
[ { "issue": "Function 'prepare' has cyclomatic complexity 23 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 7 }, { "issue": "Function 'prepare' is 77 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical", ...
2
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2012-2020 Snowflake Computing Inc. All right reserved. # import json import logging from .auth import Auth from .auth_by_plugin import AuthByPlugin from .compat import unescape, urlencode, urlsplit from .constants import HTTP_HEADER_ACCEPT, HTTP_HEADER_C...
Review this code and list any quality issues.
[ { "issue": "Function '_is_prefix_equal' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 22 }, { "issue": "Function 'authenticate' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major"...
6
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # Kyle Fitzsimmons, 2017 from datetime import datetime import pytz from models import db, PromptResponse class MobilePromptsActions: def get(self, prompts_uuids): prompts_filters = PromptResponse.prompt_uuid.in_(prompts_uuids) return db.session.query...
Review this code and list any quality issues.
[ { "issue": "Function 'upsert' is 32 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 26 } ]
1
python
import os from moviepy.editor import VideoFileClip, concatenate_videoclips import random import numpy as np import time # from video_facial_landmarks_minmax import calculate_distance from video_pose_landmarks import calculate_pose_distance TEST = True TEST_TIME = 20 INIT_NUM = float("Inf") WINDOW_TIME = 10 PADDED_TIME...
Review this code and list any quality issues.
[ { "issue": "Function 'crosscut' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 25 }, { "issue": "Function 'crosscut' is 67 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", ...
2
python
#!@PYTHON_EXECUTABLE@ #ckwg +28 # Copyright 2011-2013 by Kitware, Inc. # 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 of source code must retain the above copyright notice,...
Review this code and list any quality issues.
[ { "issue": "Function 'example_scheduler.__del__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 97 } ]
1
python
import time import pytest from limits.errors import ConfigurationError from limits.storage import ( MemcachedStorage, MemoryStorage, MongoDBStorage, RedisClusterStorage, RedisSentinelStorage, RedisStorage, Storage, storage_from_string, ) from limits.strategies import MovingWindowRateLi...
Review this code and list any quality issues.
[ { "issue": "Function 'test_storage_string' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 103 } ]
1
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (...
Review this code and list any quality issues.
[ { "issue": "Function 'test_generate_create_kudu_table_with_data' is 39 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 88 }, { "issue": "Function 'test_generate_create_parquet_table' is 28 lines long. Functions over 25 lines are harder to test ...
3
python
import os import numpy as np import numba as nb def create_folder(storage_path): if not os.path.isdir(storage_path): os.makedirs(storage_path,exist_ok=True) lsdir = os.listdir(storage_path) for item in ["info","hist","soln","figs"]: if item not in lsdir: os.makedirs(storage_pat...
Review this code and list any quality issues.
[ { "issue": "Function 'create_folder' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 5 }, { "issue": "Function 'np_apply_along_axis_kd' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions....
2
python
## # Copyright (c) 2006-2016 Apple Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
Review this code and list any quality issues.
[ { "issue": "Function 'verify' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 24 } ]
1
python
#!/usr/bin/python # -*- coding: utf-8 -*- # s3upload.py # It is an example that handles S3 buckets on AWS. # It uses Client API (low-level) of Boto3. # Upload a local file to a S3 bucket. # You must provide 1 parameter: # BUCKET_NAME = Name of the bucket # OBJECT_NAME = Object file name in the bucket # LOCAL_FI...
Review this code and list any quality issues.
[ { "issue": "Function 'main' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 17 }, { "issue": "Function 'main' is 31 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": ...
2
python
# state.py - fsmonitor persistent state # # Copyright 2013-2016 Facebook, Inc. # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. from __future__ import absolute_import import errno import os import socket import struct from mercur...
Review this code and list any quality issues.
[ { "issue": "Function 'get' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 38 }, { "issue": "Function 'get' is 45 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 38...
2
python
import numpy as np from skimage.segmentation import random_walker from skimage.transform import resize from skimage._shared._warnings import expected_warnings from skimage._shared import testing # older versions of scipy raise a warning with new NumPy because they use # numpy.rank() instead of arr.ndim or numpy.linal...
Review this code and list any quality issues.
[ { "issue": "Function 'test_spacing_1' is 35 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 238 } ]
1
python
import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import xavier_init from mmdet.core import auto_fp16 from ..registry import NECKS from ..utils import ConvModule from mmdet.ops.context_block import ContextBlock from mmdet.models.plugins.squeeze_excitation import ChannelSELayer @NECKS....
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 17 }, { "issue": "Function '__init__' is 104 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical...
5
python
import os import sys import polib import django from django.conf import settings from django.core.management.base import BaseCommand from django.utils import translation # This is almost a management command, but we do not want it to be added to the django-admin namespace for the simple # reason that it is not expec...
Review this code and list any quality issues.
[ { "issue": "Function 'handle' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 28 }, { "issue": "Function 'handle' is 53 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical", ...
2
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 #...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 10 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 113 }, { "issue": "Function 'parse_from_uri' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor",...
5
python
# Copyright 2016, 2017 IBM Corp. # # 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 'authenticate_basic' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 60 }, { "issue": "Function 'authenticate_basic' is 43 lines long. Functions over 25 lines are harder to test and maintain.", "sev...
2
python
import collections from src.importer.known_jobs import KnownJobs from src.preprocessing import preproc from src.util import loe_util, jobtitle_util mw_tokens = ['m/w', 'w/m', 'm/f', 'f/m', 'M/W', 'W/M', 'M/F', 'F/M'] def find_jobs(sentence): jobs = [] # find known jobs for hit in find_job_b...
Review this code and list any quality issues.
[ { "issue": "Function 'expand_left_right' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 48 } ]
1
python
""" The player's AI code Functions here are called by clock.py to run the AI code """ import random import math from clientLogic.logging import logPrint from clientLogic import clientData, commands def onConnect(): """ Called when the player initially connects to the server but before the tank first spaw...
Review this code and list any quality issues.
[ { "issue": "Function 'onTick' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 25 } ]
1
python
# Copyright 2014 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
Review this code and list any quality issues.
[ { "issue": "Function 'test_list_parsing' is 75 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 30 } ]
1
python
# -*- coding: utf-8 -*- # Django Clone - https://github.com/mohammadroghani/django-clone # Copyright © 2016 Mohammad Roghani <mohammadroghani43@gmail.com> # Copyright © 2016 Amir Keivan Mohtashami <akmohtashami97@gmail.com> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this soft...
Review this code and list any quality issues.
[ { "issue": "Function 'test_get_all_related_objects' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 61 } ]
1
python
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
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": 35 }, { "issue": "Function '__init__' is 67 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical...
5
python
import re import socket import sys import threading from random import randint host = 'irc.freenode.org' port = 6667 nick = 'gabe_the_dog' real_name = 'Gabe the dog' channel = '#spbnet' size = 2048 youtube_prefix = 'https://www.youtube.com/watch?v=' gabe_the_dog_sources = [ 'i1H0leZhXcY', 'i11RMG_U3R4', '...
Review this code and list any quality issues.
[ { "issue": "Function 'receive_routine' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 88 } ]
1
python
#!/usr/bin/env python r""" Run many simulations with varying :math:`\theta`. The simulations are run. Separate script should plot bifurcation diagram. """ import argparse import os import sys import shutil import numpy as np from mpi4py import MPI from saf.fm.nonlinear import Config from saf.action import solve fr...
Review this code and list any quality issues.
[ { "issue": "Function '_worker_single_task' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 35 } ]
1
python
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in co...
Review this code and list any quality issues.
[ { "issue": "Function 'session_id' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 23 }, { "issue": "Function 'test_log_stream' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 36 } ]
2
python
# Copyright 2017 The TensorFlow 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...
Review this code and list any quality issues.
[ { "issue": "Function 'main' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 100 }, { "issue": "Function 'main' is 54 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line"...
2
python
# coding:utf-8 import logging from base64 import b64encode import regex as re import six from flanker import _email from flanker.mime.message import charsets, errors _log = logging.getLogger(__name__) _RE_FOLDING_WHITE_SPACES = re.compile(r"(?:\n\r?|\r\n?)") # This spec refers to http://tools.ietf.org/html/rfc2047...
Review this code and list any quality issues.
[ { "issue": "Function 'mime_to_unicode' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 41 }, { "issue": "Function 'mime_to_unicode' is 37 lines long. Functions over 25 lines are harder to test and maintain.", "severity"...
4
python
# -*- coding: utf-8 -*- import os import numpy as np import cv2 import re from shapely import wkt from shapely.geometry import box, Polygon import pandas as pd import geopandas as gpd from osgeo import gdal, gdalnumeric, osr, ogr def ensure_dir(file_path): directory = os.path.dirname(file_path) if not os.pat...
Review this code and list any quality issues.
[ { "issue": "Function 'getResolution' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 19 }, { "issue": "Function 'readGDAL2numpy' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", ...
9
python
""" Configuration of libweasyl. libweasyl depends on some global state to be set up in order for e.g. database access to work correctly. This might be nicer if python had a way of parameterizing modules, but we can't, so this is what we have. It does mean that only one libweasyl configuration can exist in a running py...
Review this code and list any quality issues.
[ { "issue": "Function 'configure_libweasyl' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 15 } ]
1
python
"""Python STIX2 Memory Source/Sink""" import io import itertools import json import os from stix2 import v20, v21 from stix2.base import _STIXBase from stix2.datastore import DataSink, DataSource, DataStoreMixin from stix2.datastore.filters import FilterSet, apply_common_filters from stix2.parsing import parse def ...
Review this code and list any quality issues.
[ { "issue": "Function '_add' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 15 }, { "issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 17...
4
python
from __future__ import annotations import collections import logging import typing from aoc.helpers import Puzzle __all__ = ["part_one", "part_two", "prepare_puzzle"] log = logging.getLogger(__name__) class Instruction(typing.NamedTuple): """A ConsoleApplication instruction.""" operation: str argument...
Review this code and list any quality issues.
[ { "issue": "Function 'run' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 57 }, { "issue": "Function 'debugger' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.", "severity": "ma...
3
python
import torch.optim as optim import env as grounding_env from models import * from torch.autograd import Variable import logging def ensure_shared_grads(model, shared_model): for param, shared_param in zip(model.parameters(), shared_model.parameters()): if shared_param....
Review this code and list any quality issues.
[ { "issue": "Function 'train' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 18 }, { "issue": "Function 'train' is 106 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "lin...
2
python
from gym import envs, logger import os def should_skip_env_spec_for_tests(spec): # We skip tests for envs that require dependencies or are otherwise # troublesome to run frequently ep = spec._entry_point # Skip mujoco tests for pull request CI skip_mujoco = not (os.environ.get('MUJOCO_KEY_BUNDLE') ...
Review this code and list any quality issues.
[ { "issue": "Function 'should_skip_env_spec_for_tests' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 4 } ]
1
python
import glob import struct import wave from collections import Counter from operator import itemgetter import librosa import numpy as np from tslearn.metrics import dtw def compute_mfcc_from_file(file): time_characteristic = create_time_characteristics_of_a_file(file) mfcc = librosa.feature.mfcc(y=time_charac...
Review this code and list any quality issues.
[ { "issue": "Function 'calculate_dict' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 35 } ]
1
python
import pandas as pd from sklearn.metrics import confusion_matrix, accuracy_score, precision_score, recall_score, f1_score def evaluate(clf, x_train, x_test, y_train, y_test, name, training_data_name, embedding, params=None): predictions = clf.predict(x_train) # train_tn, train_fp, train_fn, train_tp = confusi...
Review this code and list any quality issues.
[ { "issue": "Function 'evaluate' has 9 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 5 } ]
1
python
# Copyright 2019 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 'testBuild' is 30 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 36 } ]
1
python
""" MPC with open-loop Gaussian policies """ from .controller import Controller from mjmpc.utils.control_utils import generate_noise, scale_ctrl import copy import numpy as np import scipy.special class OLGaussianMPC(Controller): def __init__(self, d_state, d_obs, ...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' is 45 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical", "line": 11 }, { "issue": "Function '__init__' has 22 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 11 ...
2
python
#!/usr/bin/env python # # Copyright 2012-2015 clowwindy # # 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 'get_cipher' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 110 }, { "issue": "Function 'decrypt' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "lin...
3
python
# -*- coding: utf-8 -*- """ Created on Fri Nov 2 15:19:45 2018 @author: kite """ import datetime, time from pymongo import UpdateOne, ASCENDING, UpdateMany from database import DB_CONN from stock_util import get_trading_dates, get_all_codes import tushare as ts import numpy as np import pandas as pd import requests ...
Review this code and list any quality issues.
[ { "issue": "Function 'fixing_is_st' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 64 }, { "issue": "Function 'fixing_is_st' is 45 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "maj...
4