language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | import sys
from math import floor
from time import time, localtime
from shutil import get_terminal_size
from platform import system
from typing import Union
from .func import get_stdout
class ProgressBar:
def __init__(self, bar_type: str) -> None:
self.machine = False
self.hide = False
... | 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": 13
},
{
"issue": "Function '__init__' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 4 |
python | # Copyright 2014 Muchos authors (see 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 or agreed... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_defaults' is 45 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 18
}
] | 1 |
python | import ast
import inspect
import keyword
import sys
import traceback
from clikit.api.io import IO
class ExceptionTrace(object):
"""
Renders the trace of an exception.
"""
THEME = {
"comment": "<fg=black;options=bold>",
"keyword": "<fg=yellow>",
"builtin": "<fg=blue>",
... | Review this code and list any quality issues. | [
{
"issue": "Function '_format_tree' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 91
},
{
"issue": "Function '_format_tree' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "min... | 2 |
python | '''
Encoder functions for all standard FieldTypes.
Encoders are responsible for converting a python object into bytes*
*Not all encoders return bytes objects.
FieldTypes that operate on the bit level cant be expected to return
even byte sized amounts of bits, so they operate differently.
A FieldTypes serializer and e... | Review this code and list any quality issues. | [
{
"issue": "Function 'encoder_wrapper.wrapped_encoder' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 38
},
{
"issue": "Function 'encode_24bit_numeric' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
... | 3 |
python | import tensorflow as tf
from networks.network import Network
from ..fast_rcnn.config import cfg
import pdb
n_classes = 21
_feat_stride = [16,]
anchor_scales = [2,4,8,16,32]
class Resnet50_test(Network):
def __init__(self, trainable=True):
self.inputs = []
self.data = tf.placeholder(tf.float32, shap... | Review this code and list any quality issues. | [
{
"issue": "Function 'setup' is 175 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 19
}
] | 1 |
python | import mysql
import pickle
import hashlib
import mysql.connector
from mysql.connector import pooling
import settings
import datetime
from time import sleep
def initDatabase():
global connection_pool
connection_object = connection_pool.get_connection()
cursor = connection_object.cursor()
cursor.execute(... | Review this code and list any quality issues. | [
{
"issue": "Function 'getCompletedScripts' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 203
}
] | 1 |
python | # -*- coding: utf-8 -*-
"""This module contains an adapter for reading Modbus data and sending it to Procem RTL worker."""
# Copyright (c) TUT Tampere University of Technology 2015-2018.
# This software has been developed in Procem-project funded by Business Finland.
# This code is licensed under the MIT license.
# Se... | Review this code and list any quality issues. | [
{
"issue": "Function 'readRegisterGroups' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 53
},
{
"issue": "Function 'readRegisterGroups' is 54 lines long. Functions over 25 lines are harder to test and maintain.",
"sev... | 4 |
python | import glob
import os
import tarfile
from subprocess import check_call
import modules.config as c
import modules.functions as f
def run_task_build_pdfium():
f.debug("Building PDFium...")
target = "android"
build_dir = os.path.join("build", target)
f.create_dir(build_dir)
target_dir = os.path.jo... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_task_build' is 71 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 77
},
{
"issue": "Function 'run_task_install' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity":... | 4 |
python | import os
import stat
from pathlib import Path
from shutil import move, rmtree
from typing import Optional, Set, Union
from warnings import warn
from cookiecutter.generate import generate_files
from git import Repo
from .cookiecutter import CookiecutterContext, generate_cookiecutter_context
from .cruft import CruftSt... | Review this code and list any quality issues. | [
{
"issue": "Function '_remove_single_path' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 128
}
] | 1 |
python | from enum import Enum
from datetime import datetime, date
from dateutil.relativedelta import relativedelta, MO
import argparse
import holidays
import pandas as pd
class BGEHolidays(holidays.HolidayBase):
def _populate(self, year):
holidays.UnitedStates._populate(self, year)
# Remove Martin Luther... | Review this code and list any quality issues. | [
{
"issue": "Function 'getTOU' has cyclomatic complexity 36 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 47
},
{
"issue": "Function 'getTOU' is 44 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 2 |
python | import tkinter as tk
from tkinter import *
import cv2
import csv
import os
import numpy as np
from PIL import Image,ImageTk
import pandas as pd
import datetime
import time
##Error screen2
def del_sc2():
sc2.destroy()
def err_screen1():
global sc2
sc2 = tk.Tk()
sc2.geometry('300x100')
sc2.iconbitma... | Review this code and list any quality issues. | [
{
"issue": "Function 'Fillattendances' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 26
},
{
"issue": "Function 'Fillattendances' is 90 lines long. Functions over 25 lines are harder to test and maintain.",
"severity"... | 2 |
python | # coding=utf-8
# Copyright 2020 TF.Text 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 or ag... | 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 '__init__' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 174
},
... | 3 |
python | from btc.utils import mod_inverse, int2hex
# Parameters for SECP256k1 elliptic curve (used by Bitcoin)
SECP256K1_A = 0
SECP256K1_B = 7
SECP256K1_GX = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
SECP256K1_GY = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8
SECP256K1_P = 2**25... | 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": 18
},
{
"issue": "Function 'is_contained' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 124
},
{
... | 3 |
python | # GPLv3 License
#
# Copyright (C) 2020 Ubisoft
#
# 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 2 of the License, or
# (at your option) any later version.
#
# This program is dis... | Review this code and list any quality issues. | [
{
"issue": "Function 'save' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 113
},
{
"issue": "Function 'save' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 113
... | 8 |
python | import tensorrt as trt
import pycuda.driver as cuda
import numpy as np
import pycuda.autoinit
def allocate_buffers(engine, batch_size, data_type):
"""
This is the function to allocate buffers for input and output in the device
Args:
engine : The path to the TensorRT engine.
batch_size : The bat... | Review this code and list any quality issues. | [
{
"issue": "Function 'do_inference' has 10 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 39
}
] | 1 |
python | """parquet - tool for inspecting parquet files."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import logging
import sys
def setup_logging(options=None):
"""Configure logging based on options... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 25
}
] | 1 |
python | import heapq
import sys
from itertools import product
def load_data(path):
with open(path) as f:
return {
(i, j): int(value)
for i, line in enumerate(f.readlines())
for j, value in enumerate(line.strip())
}
def get_neighbours(loc, n_rows, n_cols):
neighbou... | Review this code and list any quality issues. | [
{
"issue": "Function 'answer' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 26
},
{
"issue": "Function 'extend' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "mi... | 2 |
python | import re
from vsmetaEncoder import vsmetaInfo
from datetime import datetime, date
class VsMetaInfoGenerator(vsmetaInfo.VsMetaInfo):
def __init__(self, feedItem):
super(VsMetaInfoGenerator, self).__init__()
self.feedItem = feedItem
self.download_url = ''
# parse feedItem
... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 8
}
] | 1 |
python | from collections import deque
from typing import Dict, Set, Deque, List, Optional
from sc2.data import Race
from sc2.position import Point2
from sharpy.events import UnitDestroyedEvent
from sharpy.interfaces import IMemoryManager
from sharpy.managers.core import ManagerBase
from sc2.ids.unit_typeid import UnitTypeId
f... | Review this code and list any quality issues. | [
{
"issue": "Function 'update' has cyclomatic complexity 18 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 68
},
{
"issue": "Function 'update' is 48 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 2 |
python | from gpiozero import LED
from time import sleep
import socket
import serial
#low level IC control pins
led1 = LED(13) #A0 pin
led2 = LED(6) #A1 pin
led3 = LED(5) #A2 pin
led4 = LED(27) #led4+5 = device rest plate
led5 = LED(22)
###setup communication with C# host software
##TCP_IP = '169.254.130.182'
##TCP_PORT = 500... | Review this code and list any quality issues. | [
{
"issue": "Function 'SwapDevice' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 90
},
{
"issue": "Function 'SwapDevice' is 57 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",... | 6 |
python | from functools import partial
from typing import Callable, List, Union
import numpy as np
import pandas as pd
from scipy.stats import friedmanchisquare, rankdata
from sklearn.metrics.pairwise import pairwise_distances
from statsmodels.stats.libqsturng import qsturng
Matrix = List[List[float]]
def friedman_nemenyi(t... | Review this code and list any quality issues. | [
{
"issue": "Function '_get_dist_func' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 61
},
{
"issue": "Function 'dunn' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity... | 6 |
python | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 38
},
{
"issue": "Function 'get' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 113
}
] | 2 |
python | import pickle
import torch
import torch.nn as nn
import torch.nn.functional as F
from os.path import join as pjoin
from memory import ReplayMemory, Transition, State
from model import DRRN
from util import *
import logger
import sentencepiece as spm
device = torch.device("cuda" if torch.cuda.is_available() else "cpu"... | Review this code and list any quality issues. | [
{
"issue": "Function 'observe' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 29
}
] | 1 |
python | import abc
import csv
from collections import namedtuple, defaultdict, OrderedDict, Counter
import numpy as np
from sklearn.feature_extraction import DictVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.metrics.pairwise import cosine_similarity as sim
from sklearn.pipeline import Pi... | Review this code and list any quality issues. | [
{
"issue": "Function 'disambiguate_word' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 100
},
{
"issue": "Function 'disambiguate_word' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions... | 3 |
python | #!/usr/bin/env python3
from password_manager import User, Credentials
def create_user(fname, lname, uname, email, password):
'''
Function that creates a new user
'''
new_user = User(fname, lname, uname, email, password)
return new_user
def save_users(user):
'''
Function that saves a new user
'''
use... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_user' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 4
},
{
"issue": "Function 'main' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": ... | 3 |
python | import sys
import os
import torch
import pandas as pd
import datetime
from argparse import ArgumentParser
import numpy as np
from torch import nn, optim
import torch.nn.functional as F
from torch.utils.data import DataLoader, random_split
from icecream import ic
import pytorch_lightning as pl
from pytorch_lightning.me... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 26
},
{
"issue": "Function '__init__' has 14 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 26
... | 3 |
python | """
Setup authentication from various providers
"""
import json
import os
import subprocess
import shutil
from hubploy.config import get_config
from ruamel.yaml import YAML
yaml = YAML(typ='rt')
def registry_auth(deployment):
"""
Do appropriate registry authentication for given deployment
"""
config... | Review this code and list any quality issues. | [
{
"issue": "Function 'registry_auth' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 15
},
{
"issue": "Function 'cluster_auth_gcloud' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "mi... | 3 |
python | # Copyright 2011 Justin Santa Barbara
# 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 requ... | Review this code and list any quality issues. | [
{
"issue": "Function '_get_volumes' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 93
},
{
"issue": "Function '_image_uuid_from_ref' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity... | 5 |
python | import os
import random
import subprocess
import numpy as np
import torch
import time
try:
import torch_xla
import torch_xla.core.xla_model as xm
XLA = True
except ModuleNotFoundError:
XLA = False
def freeze_module(module):
for i, param in enumerate(module.parameters()):
param.requires_gra... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_device' has cyclomatic complexity 19 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 31
},
{
"issue": "Function 'get_device' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "crit... | 2 |
python | #!/usr/bin/env python
import sys, os, pwd, grp, signal, time, base64
from resource_management import *
from resource_management.core.exceptions import Fail
from resource_management.core.logger import Logger
from resource_management.core.resources.system import Execute, Directory, File
from resource_management.core.shel... | Review this code and list any quality issues. | [
{
"issue": "Function 'airflow_make_systemd_scripts_webserver' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 11
},
{
"issue": "Function 'airflow_make_systemd_scripts_scheduler' is 34 lines long. Functions over 25 lines are harder to test... | 4 |
python | #!/usr/bin/env python
#
# Copyright 2012 The Closure Linter 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
#... | Review this code and list any quality issues. | [
{
"issue": "Function 'ParseFunctionsAndComments' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 63
}
] | 1 |
python | import asyncio
import json
import logging
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) # noqa
from runners.support.agent import DemoAgent, default_genesis_txns
from runners.support.utils import (
log_json,
log_msg,
log_status,
log_timer,
prompt... | 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": 94
},
{
"issue": "Function 'main' is 51 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line":... | 2 |
python | """Example 003: List envelopes in the user's account"""
from flask import render_template, url_for, redirect, session, flash, request
from os import path
import json
from app import app, ds_config, views
from datetime import datetime, timedelta
from docusign_esign import *
from docusign_esign.rest import ApiException
... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_controller' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 23
},
{
"issue": "Function 'create_controller' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severi... | 2 |
python | from dgl import BatchedDGLGraph
from dgl.nn.pytorch.conv import GINConv
from torch import nn
from models.GNN.GNNModelBase import GNNModelBase
from models.utils import TypeConditionalLinear
class GIN(GNNModelBase):
"""
Graph Isomorphism Network as described in https://arxiv.org/pdf/1810.00826.pdf
"""
... | 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": 14
},
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 45
},
{
"i... | 4 |
python | import datetime
from flask import jsonify
from flask import request
from flask.views import MethodView
from chainerui.database import db
from chainerui.models.log import Log
from chainerui.models.project import Project
from chainerui.models.result import Result
class LogAPI(MethodView):
def post(self, project_... | 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
},
{
"issue": "Function 'post' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 2 |
python | from PIL import Image
import os
import sys
from os import listdir
from os.path import isfile, join
def main():
folder_path = sys.argv[1]
output_folder_path = folder_path + '_png'
try:
os.mkdir(output_folder_path)
except:
if not os.listdir(output_folder_path):
print('Folder... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 8
}
] | 1 |
python | # pacman imports
from pacman.model.routing_info.\
dict_based_partitioned_partition_n_keys_map import \
DictBasedPartitionedPartitionNKeysMap
# spinnMachine imports
from spinn_machine.utilities.progress_bar import ProgressBar
# front end common imports
from spinn_front_end_common.abstract_models.\
abstract... | Review this code and list any quality issues. | [
{
"issue": "Function '__call__' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 26
},
{
"issue": "Function '__call__' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 5 |
python | from django.contrib.sites.models import Site, get_current_site
from django.core import urlresolvers, paginator
from django.core.exceptions import ImproperlyConfigured
import urllib
PING_URL = "http://www.google.com/webmasters/tools/ping"
class SitemapNotFound(Exception):
pass
def ping_google(sitemap_ur... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_urls' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 64
}
] | 1 |
python | # Copyright 2020-2021, The Autoware Foundation
#
# 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 agre... | Review this code and list any quality issues. | [
{
"issue": "Function 'generate_launch_description' is 209 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 29
}
] | 1 |
python | #! /usr/bin/python
from flask import Flask, request, jsonify
import boto3
import os
from queue import Queue
from threading import Thread
import time
s3 = boto3.client('s3')
s3_raw = boto3.resource('s3').Bucket('isitanime-data-raw')
s3_dest = boto3.resource('s3').Bucket('isitanime-data-clean')
app = Flask(__name__)
@... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_keys' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 68
},
{
"issue": "Function 'get_keys' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | ################################################################################
from subprocess import Popen, PIPE, STDOUT
from threading import Thread
import bz2, json, click
from newsroom import jsonl
from . import readiter
from tqdm import tqdm
###################################################################... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 75
}
] | 1 |
python | ''' The application's Globals object '''
import logging
import time
from threading import Lock
import re
from paste.deploy.converters import asbool
from pylons import config
import ckan
import ckan.model as model
import ckan.logic as logic
log = logging.getLogger(__name__)
# mappings translate between config set... | Review this code and list any quality issues. | [
{
"issue": "Function 'process_app_global' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 94
},
{
"issue": "Function 'reset.get_config_value' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller func... | 2 |
python | import configparser
class BotConfig:
def __init__(self, path):
parser = configparser.ConfigParser()
# open the file implicitly because parser.read() will not fail if file is not readable
file = open(path)
parser.read_file(file)
file.close()
if 'Bot' not in parser... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 5
},
{
"issue": "Function '__init__' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | """Actor-Critic Algorithm."""
from rllib.util.neural_networks.utilities import broadcast_to_tensor
from .abstract_algorithm import AbstractAlgorithm
class ActorCritic(AbstractAlgorithm):
r"""Implementation of Policy Gradient algorithm.
Policy-Gradient is an on-policy model-free control algorithm.
Policy... | 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": 44
}
] | 1 |
python | class Node:
def __init__(self, data):
self.data = data
self.next_node = None
class LinkedList:
def __init__(self):
self.head = None
self.no_of_nodes = 0
# O(1) for insertion at the start of LL
def insert_at_start(self, data):
self.no_of_nodes = sel... | Review this code and list any quality issues. | [
{
"issue": "Function 'remove_from_ll' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 45
}
] | 1 |
python | from exceptions.exceptions import NGSIUsageError
from utils.jsondict import lookup_string_match
from flask import request
from reporter.reporter import _validate_query_params
from translators.crate import CrateTranslatorInstance
import logging
from .geo_query_handler import handle_geo_query
def query_NTNENA(id_=None,... | Review this code and list any quality issues. | [
{
"issue": "Function 'query_NTNENA' has cyclomatic complexity 24 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 10
},
{
"issue": "Function 'query_NTNENA' is 109 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": ... | 3 |
python | from typing import Any, Dict
import argparse
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
CONV_DIM = 64
FC_DIM = 128
WINDOW_WIDTH = 28
WINDOW_STRIDE = 28
class ConvBlock(nn.Module):
"""
Simple 3x3 conv with padding size 1 (to leave the input size unchanged), followed by a Re... | 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": 19
}
] | 1 |
python | import os
import torch
from tensorboardX import SummaryWriter
import time
import glob
import re
import datetime
import argparse
from pathlib import Path
import torch.distributed as dist
from pcdet.datasets import build_dataloader
from pcdet.models import build_network
from pcdet.utils import common_utils
from pcdet.con... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse_config' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 18
},
{
"issue": "Function 'eval_single_ckpt' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": ... | 8 |
python | from __future__ import print_function, absolute_import
from six import iteritems, iterkeys, itervalues
from six.moves import range
from _file_reader import FileReader
from f06_table import F06Table
class _DummyTable(object):
def __init__(self):
self.header = []
self.data = []
self.line_n... | Review this code and list any quality issues. | [
{
"issue": "Function 'read' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 41
},
{
"issue": "Function 'read' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 3 |
python | class Node:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
self.height = 1
def insert(node, val):
if not node:
return Node(val)
if val <= node.val:
node.left = insert(node.left, val)
else:
node.right = insert(node.rig... | Review this code and list any quality issues. | [
{
"issue": "Function 'delete' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 33
}
] | 1 |
python | #!python3
import re
from blackmamba.system import Pythonista
def _comment_line(line, hash_prefix=''):
stripped = line.strip()
if stripped.startswith('#'):
return line
if not stripped:
return hash_prefix + '# \n'
return hash_prefix + '# ' + line[len(hash_prefix):]
_UNCOMMENT_RE = ... | Review this code and list any quality issues. | [
{
"issue": "Function '_hash_prefix' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 41
}
] | 1 |
python | # -*- coding: utf-8 -*-
"""Calculate the mobility demand.
SPDX-FileCopyrightText: 2016-2019 Uwe Krien <krien@uni-bremen.de>
SPDX-License-Identifier: MIT
"""
__copyright__ = "Uwe Krien <krien@uni-bremen.de>"
__license__ = "MIT"
import os
import pandas as pd
from collections import namedtuple
from reegis import geo... | Review this code and list any quality issues. | [
{
"issue": "Function 'format_kba_table' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 20
},
{
"issue": "Function 'get_mileage_by_type_and_fuel' is 44 lines long. Functions over 25 lines are harder to test and maintain.",
"severity":... | 2 |
python | import os
from rpython.rlib.rpoll import POLLIN, PollError
from rpython.rlib import streamio
from topaz.coerce import Coerce
from topaz.error import error_for_oserror
from topaz.module import ClassDef
from topaz.modules.fcntl import fcntl
from topaz.objects.objectobject import W_Object
from topaz.objects.stringobject... | Review this code and list any quality issues. | [
{
"issue": "Function 'method_sysopen' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 76
},
{
"issue": "Function 'method_initialize' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "min... | 6 |
python | __author__ = 'mnowotka'
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
import requests
import requests_cache
from chembl_webresource_client.spore_client import Client, make_spore_function
from chembl_webresource_client.query_set import QuerySet
from chembl_webresource_... | Review this code and list any quality issues. | [
{
"issue": "Function 'client_from_url' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 22
},
{
"issue": "Function 'client_from_url' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity"... | 2 |
python | def XXX(nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: float
"""
len1 = len(nums1)
len2 = len(nums2)
if (len1 == 0) & (len2 == 0):
return 0
if (len1 != 0) & (len2 == 0):
if len1 % 2 == 0:
return (nums1[len1 // 2 - 1] + nums1[len1... | Review this code and list any quality issues. | [
{
"issue": "Function 'XXX' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 1
},
{
"issue": "Function 'XXX' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 1
... | 2 |
python | # Copyright (C) 2008 The Android Open Source 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 ... | Review this code and list any quality issues. | [
{
"issue": "Function '_GetProjectByPath' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 144
},
{
"issue": "Function 'GetProjects' has cyclomatic complexity 31 (threshold: 5). Consider breaking it into smaller functions.",
... | 5 |
python | """
Utilities and base functions for Services.
"""
import abc
import datetime
from typing import Any, Dict, List, Optional, Set, Tuple
from pydantic import validator
from qcelemental.models import ComputeError
from ..interface.models import ObjectId, ProtoModel
from ..interface.models.rest_models import TaskQueuePOS... | Review this code and list any quality issues. | [
{
"issue": "Function 'done' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 31
},
{
"issue": "Function 'initialize_from_api' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
... | 3 |
python | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.fsl.utils import ImageMeants
def test_ImageMeants_inputs():
input_map = dict(args=dict(argstr='%s',
),
eig=dict(argstr='--eig',
),
environ=dict(nohash=True,
usedefault=True,
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_ImageMeants_inputs' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 5
}
] | 1 |
python | import logging
import pprint
from vnc_api.gen.resource_client import Card
from vnc_api.gen.resource_client import Hardware
from vnc_api.gen.resource_client import Node
from vnc_api.gen.resource_client import NodeProfile
from vnc_api.gen.resource_client import Port
from vnc_api.gen.resource_client import Tag
from vnc_a... | Review this code and list any quality issues. | [
{
"issue": "Function 'print_node_profile' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 37
},
{
"issue": "Function 'create_node_profile' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"sev... | 4 |
python | import numpy as np
from torchvision import transforms
import os
from PIL import Image, ImageOps
import numbers
import torch
class ResizeImage():
def __init__(self, size):
if isinstance(size, int):
self.size = (int(size), int(size))
else:
self.size = size
def __call__(s... | Review this code and list any quality issues. | [
{
"issue": "Function 'image_test_10crop' is 72 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 189
}
] | 1 |
python | # -*- coding: utf-8 -*-
# Copyright 2020 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
#
# 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__' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 66
},
{
"issue": "Function '__init__' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical"... | 4 |
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 'get_conn' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 64
},
{
"issue": "Function 'get_conn' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 4 |
python | from xml.etree import ElementTree as ET
from gomatic.mixins import CommonEqualityMixin
def fetch_artifact_src_from(element):
if 'srcfile' in element.attrib:
return FetchArtifactFile(element.attrib['srcfile'])
if 'srcdir' in element.attrib:
return FetchArtifactDir(element.attrib['srcdir'])
... | 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": 43
},
{
"issue": "Function '_append_to_gocd_18_3_and_above' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity... | 2 |
python |
def notebookUI(samplenxs, mtnxs, initdos=None, options=None, load_options_path=None):
import yaml
if options is not None and load_options_path:
raise RuntimeError(
"Both options and load_options_path were set: %s, %s" %(
options, load_options_path)
)
if load_opti... | Review this code and list any quality issues. | [
{
"issue": "Function 'notebookUI.submit' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 55
},
{
"issue": "Function 'notebookUI' is 52 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"li... | 5 |
python | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os.path
import shutil
import sys
import tempfile
import spack.util.environment
class Octave(AutotoolsPackage, GNU... | Review this code and list any quality issues. | [
{
"issue": "Function 'configure_args' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 149
},
{
"issue": "Function 'configure_args' is 100 lines long. Functions over 25 lines are harder to test and maintain.",
"severity"... | 2 |
python | """ common utilities """
import itertools
import numpy as np
from pandas import (
DataFrame,
Float64Index,
MultiIndex,
Series,
UInt64Index,
date_range,
)
import pandas._testing as tm
def _mklbl(prefix, n):
return [f"{prefix}{i}" for i in range(n)]
def _axify(obj, key, axis):
# crea... | Review this code and list any quality issues. | [
{
"issue": "Function 'setup_method' is 52 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 44
},
{
"issue": "Function 'get_value' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 122
}... | 4 |
python | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import common, Form
from odoo.tools import mute_logger
class TestDropship(common.TransactionCase):
def test_change_qty(self):
# enable the dropship and MTO route on the product
prod ... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_change_qty' is 43 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 9
},
{
"issue": "Function 'test_00_dropship' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python |
from goalgen import *
class NewGuide:
def __init__(self, useTFBase, useTFFire, catchArsonist, useMA, prioritizeNew):
self.tfBase = useTFBase
self.tfFire = useTFFire
self.catchArsonist = catchArsonist
self.useMA = useMA
self.prioritizeNew = prioritizeNew
self.step = 0
def init(self, world, mem, memKe... | 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": 6
},
{
"issue": "Function 'get_new_goals' has cyclomatic complexity 18 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
... | 3 |
python | import os
import re
import inspect
def _get_parser_list(dirname):
files = [ f.replace('.py','') for f in os.listdir(dirname) if not f.startswith('__')
]
return files
def _import_parsers(parserfiles):
m = re.compile('.+parsers',re.I)
_modules = __import__('weatherterm.parsers',globals(),locals(),pa... | Review this code and list any quality issues. | [
{
"issue": "Function '_import_parsers' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 10
}
] | 1 |
python | from collections import deque, defaultdict
from itertools import islice
from functools import wraps
from fuzzysearch.common import FuzzySearchBase, Match, \
count_differences_with_maximum, get_best_match_in_group, group_matches
from fuzzysearch.compat import text_type
from fuzzysearch.search_exact import search_ex... | Review this code and list any quality issues. | [
{
"issue": "Function '_find_near_matches_substitutions_lp' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 83
},
{
"issue": "Function '_find_near_matches_substitutions_lp' is 26 lines long. Functions over 25 lines are harder... | 6 |
python | import json
from banal import ensure_list
from functools import cache
from pantomime.types import JSON
from requests.exceptions import RequestException
from opensanctions.core import Dataset, Context
from opensanctions import helpers as h
FORMATS = ["%d %b %Y", "%d %B %Y", "%Y", "%b %Y", "%B %Y"]
@cache
def deref_u... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse_result' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 22
},
{
"issue": "Function 'parse_result' is 80 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "majo... | 2 |
python | # Copyright (C) 2018 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 'train.training_loop' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 112
},
{
"issue": "Function 'train' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "maj... | 3 |
python | # -*- coding: utf-8 -*- #
"""*********************************************************************************************"""
# FileName [ expert.py ]
# Synopsis [ the phone linear downstream wrapper ]
# Author [ S3PRL ]
# Copyright [ Copyleft(c), Speech Lab, NTU, Taiwan ]
"""******************... | 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": 37
},
{
"issue": "Function 'forward' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 93
},
{
"is... | 3 |
python | from torch.optim.lr_scheduler import _LRScheduler
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch.optim.lr_scheduler import CosineAnnealingLR
class GradualWarmupScheduler(_LRScheduler):
""" Gradually warm-up(increasing) learning rate in optimizer.
Proposed in 'Accurate, Large Minibatch SGD: T... | 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": 15
},
{
"issue": "Function 'get_lr' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": ... | 2 |
python | from unittest import TestCase
from unittest.mock import patch
from django.utils import timezone
from django.core import signing, mail
from django.contrib.sites.shortcuts import get_current_site
from django.contrib.auth.models import AnonymousUser
from django.shortcuts import reverse
from comment.conf import settings
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_get_comment_context_data' is 48 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 78
}
] | 1 |
python | # -*- coding: utf-8 -*-
from PyQt5.QtWidgets import QApplication
from Page.page import Page
class Attendance(Page):
def __init__(self, parent=None):
super(Page, self).__init__(parent)
self.setupUi(self)
self.getDataFromDB()
self.setRowHeader(self.row_sum)
self.field = ['编号', '姓名', '迟到', '早退', '病假'... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 10
}
] | 1 |
python | import functools
import time
def timer(function):
@functools.wraps(function)
def wrapper(*args, **kwargs) -> float:
time_list = []
ans = None
for i in range(0, 10):
start = time.perf_counter()
ans = function(*args, **kwargs)
end = time.perf_counter()
... | Review this code and list any quality issues. | [
{
"issue": "Function 'sol_b' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 51
}
] | 1 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Simple script to plot waveforms in one or more files.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from future.builtins import * # NOQA
from argparse import ArgumentParser
from obspy import Stream, _... | 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": 17
}
] | 1 |
python | #!/usr/bin/env python3
#
# Plots the power spectra and Fourier-space biases for the HI.
#
import numpy as np
import os, sys
import matplotlib.pyplot as plt
from pmesh.pm import ParticleMesh
from scipy.interpolate import InterpolatedUnivariateSpline as ius
from nbodykit.lab import BigFileMesh, BigFileCatalog, FFTPower
f... | Review this code and list any quality issues. | [
{
"issue": "Function 'make_rep_plot.makeplot' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 79
},
{
"issue": "Function 'make_rep_plot' has cyclomatic complexity 33 (threshold: 5). Consider breaking it into smaller functions.",
"severity":... | 3 |
python | """Support for monitoring the local system for anomalous events."""
from __future__ import annotations
import asyncio
import time
from dataclasses import dataclass
import datetime
import logging
from typing import Any, Dict, Optional, List
import pprint
import voluptuous as vol
from homeassistant.components import p... | Review this code and list any quality issues. | [
{
"issue": "Function 'async_setup_platform' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 89
},
{
"issue": "Function 'async_manage_sensor_registry_updates._set_next_deadline' has cyclomatic complexity 7 (threshold: 5). Consider breaking... | 3 |
python | # -*- coding:utf-8 -*-
__author__ = 'Randolph'
import os
import sys
import time
import logging
sys.path.append('../')
logging.getLogger('tensorflow').disabled = True
import tensorflow as tf
from utils import checkmate as cm
from utils import data_helpers as dh
from utils import param_parser as parser
from sklearn.me... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_tarnn' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 27
},
{
"issue": "Function 'test_tarnn' is 70 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 2 |
python | # Databricks notebook source
import pandas as pd
from os import listdir
from os.path import join, basename
import struct
import pickle
import json
import os
from scipy import misc
import datetime as dt
from pyspark.sql.types import *
from pyspark.sql.functions import udf
from pyspark.ml.evaluation import MulticlassCla... | Review this code and list any quality issues. | [
{
"issue": "Function 'Inception_v1' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 112
}
] | 1 |
python | #!/usr/bin/env python
# Copyright (c) 2016 The UUV Simulator 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... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 26
},
{
"issue": "Function '_speed_windup' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 93
},... | 4 |
python | # coding: utf-8
"""
InfluxDB OSS API Service.
The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. # noqa: E501
OpenAPI spec version: 2.0.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa:... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_dict' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 114
}
] | 1 |
python | # -*- coding: utf-8 -*-
"""
@Time : 2020/10/21 10:39
@Auth : Qi
@IDE : PyCharm
@Title: 6. Z 字形变换
@Link : https://leetcode-cn.com/problems/zigzag-conversion/
"""
class Solution:
def convert(self, s: str, numRows: int) -> str:
if numRows <= 0:
return ''
if numRows == 1:
retu... | Review this code and list any quality issues. | [
{
"issue": "Function 'convert' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 12
}
] | 1 |
python | import unittest
from conans.client.conf import get_default_settings_yml
from conans.client.generators.pkg_config import PkgConfigGenerator
from conans.model.build_info import CppInfo
from conans.model.conan_file import ConanFile
from conans.model.env_info import EnvValues
from conans.model.ref import ConanFileReferenc... | Review this code and list any quality issues. | [
{
"issue": "Function 'variables_setup_test' is 63 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 15
},
{
"issue": "Function 'pkg_config_custom_names_test' is 92 lines long. Functions over 25 lines are harder to test and maintain.",
"severi... | 2 |
python | #!/usr/bin/env python3
# Copyright (c) 2018-2020 The Particl Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import os
import json
import configparser
from test_framework.test_falcon import (
FalconTestFramewo... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_test' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 38
},
{
"issue": "Function 'run_test' is 144 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 2 |
python | from mmdet.apis import init_detector, inference_detector, show_result, draw_poly_detections
import mmcv
from mmcv import Config
from mmdet.datasets import get_dataset
import cv2
import os
import numpy as np
from tqdm import tqdm
import DOTA_devkit.polyiou as polyiou
import math
import pdb
def py_cpu_nms_poly_fast_np(d... | Review this code and list any quality issues. | [
{
"issue": "Function 'py_cpu_nms_poly_fast_np' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 13
},
{
"issue": "Function 'py_cpu_nms_poly_fast_np' is 42 lines long. Functions over 25 lines are harder to test and maintain.",... | 2 |
python | import numpy as np
import cv2
import imageMarker
lucas_kanade_params = dict(
winSize= (4, 4),
maxLevel= 3, #level of pyramids used
criteria= (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 0.03)
)
def mark_features_on_all_images(images, features_coordinates):
marked_images = []
marked_frame_... | Review this code and list any quality issues. | [
{
"issue": "Function 'mark_features_on_all_images' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 11
},
{
"issue": "Function 'mark_features_on_all_images' is 40 lines long. Functions over 25 lines are harder to test and mai... | 2 |
python | from bokeh.io import show, output_notebook
from bokeh.models import (CDSView, ColorBar, ColumnDataSource,
CustomJS, CustomJSFilter,
GeoJSONDataSource, HoverTool,
LinearColorMapper, Slider)
from bokeh.layouts import column, row, widgetbox
# p... | Review this code and list any quality issues. | [
{
"issue": "Function 'plot' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 11
}
] | 1 |
python | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 50 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 87
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 87
}
] | 2 |
python | # Auto-generated at 2021-09-27T17:01:26.691956+08:00
# from: Justice Lobby Service (1.33.0)
# Copyright (c) 2018 - 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
# pylint: disable=duplicate-code
# pylin... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_dict' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 172
},
{
"issue": "Function 'parse_response' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"seve... | 3 |
python | #!/usr/bin/env python
from Bio import SeqIO
import argparse
import pathlib
def get_arguments():
parser = argparse.ArgumentParser(description='Extract CDS from a genbank to output a fasta',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('input', type=str,
help='Path to input... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_features' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 22
}
] | 1 |
python | import logging
import pandas as pd
from stock.models import MyStock
from stock.models import ValuationRatio
from yahooquery import Ticker
logger = logging.getLogger("stock")
class MyValuationRatio:
def __init__(self, symbol):
self.stock = MyStock.objects.get(symbol=symbol)
def get(self):
s... | Review this code and list any quality issues. | [
{
"issue": "Function 'get' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 16
},
{
"issue": "Function 'get' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 16... | 2 |
python | # Copyright 2014-2015 Canonical Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | Review this code and list any quality issues. | [
{
"issue": "Function 'clone' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 42
},
{
"issue": "Function 'install' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 54
}
] | 2 |
python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Timed calls to subprocess, so that real execution times can be obtained.
"""
__author__ = "Miguel Hernández Cabronero <miguel.hernandez@uab.cat>"
__date__ = "23/05/2020"
import os
import subprocess
import re
import time
import platform
import shutil
class InvocationE... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_status_output_time' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 22
},
{
"issue": "Function 'get_status_output_time' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
... | 2 |
python |
def _close_(fh):
"""Implementation of perl close"""
global AUTODIE, TRACEBACK, OS_ERROR, TRACE_RUN
try:
if hasattr(fh, '_sp'): # issue 72: subprocess
fh.flush()
fh._sp.communicate()
if TRACE_RUN:
sp = subprocess.CompletedProcess(f"op... | Review this code and list any quality issues. | [
{
"issue": "Function '_close_' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 2
}
] | 1 |
python | def for_O():
"""printing capital 'O' using for loop"""
for row in range(5):
for col in range(5):
if col==0 and row not in(0,4) or col==4 and row not in(0,4) or row==0 and col in(1,2,3) or row==4 and col in(1,2,3) :
print("*",end=" ")
else:
p... | Review this code and list any quality issues. | [
{
"issue": "Function 'for_O' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 1
},
{
"issue": "Function 'while_O' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "m... | 2 |
python | import os
import hashlib
from PyQt5 import uic
from PyQt5.QtWidgets import QMainWindow, QMessageBox
from internationalization import LANGUAGE
from logic import Hash
from windows.message import Message
from databaseAccess import DbMethods
class AddWindow(QMainWindow):
def __init__(self, lang):
QMainWindow._... | Review this code and list any quality issues. | [
{
"issue": "Function 'add_user' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 29
},
{
"issue": "Function 'add_user' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import List, Tuple, Union, Optional
from overrides import overrides, EnforceOverrides
from torch.utils.data.dataset import Dataset
import torchvision
from torchvision.transforms import transforms
from torch.utils.data impo... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_datasets' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 24
}
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.