language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | from __future__ import division
import argparse
from mmcv import Config
from mmcv.runner import load_checkpoint
from mmfashion.apis import get_root_logger, init_dist, test_cate_attr_predictor
from mmfashion.datasets.utils import get_dataset
from mmfashion.models import build_predictor
def parse_args():
parser =... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 38
}
] | 1 |
python | from ..ioc import interface, model
from ..types import HTTPResponse, UUID, Timestamp, Optional, List
from ..util.generate_spec import generate_spec
@model
class CriterionModel:
'''
type: object
required:
- user
- name
properties:
id:
type: string
description: Criterion ID
example: d29... | 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": 110
}
] | 1 |
python | import torch
import torch.nn as nn
"""
usage
z_rand = generate_noise([1,nzx,nzy], device=opt.device)
z_rand = z_rand.expand(1,3,Z_opt.shape[2],Z_opt.shape[3])
z_prev1 = 0.95*Z_opt +0.05*z_rand
"""
def upsampling(im, sx, sy):
m = nn.Upsample(size=[round(sx), round(sy)], mode='... | Review this code and list any quality issues. | [
{
"issue": "Function 'generate_noise' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 18
}
] | 1 |
python | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from contextlib import contextmanager
from contextvars import ContextVar
from pathlib import Path
from time import monotonic
from typing impor... | Review this code and list any quality issues. | [
{
"issue": "Function 'try_parse' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 54
}
] | 1 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Experiment with a gaussian naive bayes model with a variety of balancing techniques on the cleaned data set
"""
__author__ = "John Hoff"
__email__ = "john.hoff@braindonor.net"
__copyright__ = "Copyright 2019, John Hoff"
__license__ = "Creative Commons Attribution-... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_gaussian_naive_bayes' is 56 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 28
}
] | 1 |
python | #!/usr/bin/env python
# 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 applicab... | Review this code and list any quality issues. | [
{
"issue": "Function 'pypi_license' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 105
},
{
"issue": "Function 'parse_line' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"sev... | 8 |
python | #!/usr/bin/python
"""
This python script was created to find missing files in given folders.
Copyright (c) 2016 Thomas Richard
Following MIT license (see copying.txt)
The software is provided "as is", without warranty of any kind, express or
implied, including but not limited to the warranties of merchantability,
f... | Review this code and list any quality issues. | [
{
"issue": "Function 'find_missing' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 63
},
{
"issue": "Function 'find_missing' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "mino... | 4 |
python | import tkinter as tk
from PIL import ImageTk, Image
from file_import import FileImport
class Buttons:
def __init__(self, parent, player):
self.player = player
self.parent = parent
#clean these up
unskip_img = ImageTk.PhotoImage(Image.open("assets/unskip.png").resize((25,25)))
... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 44 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 6
}
] | 1 |
python | import numpy as np
import scipy
from scipy.sparse import linalg
from sklearn.metrics import accuracy_score
class LSSVM:
def __init__(self, kernel = 'linear', C = 1.0,gamma = 1.0, d = 2.0):
kernels = {
'rbf':self.rbf,
'poly':self.polynomial,
'linear':self.linear
}... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 7
}
] | 1 |
python | import cv2
import numpy as np
from random import randint, uniform
import string, random
def addNoise(image):
row,col = image.shape
s_vs_p = 0.4
amount = 0.01
out = np.copy(image)
# Salt mode
num_salt = np.ceil(amount * image.size * s_vs_p)
coords = [np.random.randint(0, i - 1, int(num_... | Review this code and list any quality issues. | [
{
"issue": "Function 'addText' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 40
},
{
"issue": "Function 'genSymbolImg' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"li... | 3 |
python | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.conf.urls import url
from django.contrib import admin
from django.forms.models import modelform_factory
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from .. import settings as filer_settings
from ..... | Review this code and list any quality issues. | [
{
"issue": "Function 'ajax_upload' has cyclomatic complexity 17 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 72
},
{
"issue": "Function 'ajax_upload' is 83 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "cr... | 2 |
python | from datetime import datetime
from flask import current_app, jsonify
from flask_bcrypt import Bcrypt
import json
from api.extensions import db, Base, ma
class User(db.Model):
"""
This model holds information about a user registered
"""
__tablename__ = "user"
id = db.Column(db.Integer, primary_key... | 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": 34
}
] | 1 |
python | import sys
import re
import string
# dictionary to store clean data.
cleaned_data = {}
# list of professors
professors = []
# list of courses
courses = []
def createdict(profname, course_list):
new_course_list = []
is_course_match = False
profname = profname.title()
prof_courses = course_list.split('... | Review this code and list any quality issues. | [
{
"issue": "Function 'createdict' has cyclomatic complexity 22 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 13
},
{
"issue": "Function 'createdict' is 62 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "crit... | 2 |
python | from typing import Any, List
from thinc.neural.ops import get_array_module
from spacy.pipeline import Pipe
from spacy.tokens import Doc
from spacy.vocab import Vocab
from spacy.util import minibatch
from ..wrapper import PyTT_Wrapper
from ..model_registry import get_model_function
from ..activations import Activations... | Review this code and list any quality issues. | [
{
"issue": "Function 'set_annotations' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 164
},
{
"issue": "Function 'set_annotations' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity"... | 3 |
python | #!/usr/bin/env python3
import argparse
import logging
import numpy as np
import pystella as ps
from pystella.model.sn_tau import StellaTauDetail
mpl_logger = logging.getLogger('matplotlib')
mpl_logger.setLevel(logging.WARNING)
__author__ = 'bakl'
# todo Show filters
# todo show valuse for filters
# todo compute SE... | Review this code and list any quality issues. | [
{
"issue": "Function 'plot_tau_phot' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 67
},
{
"issue": "Function 'plot_tau_phot' is 48 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "m... | 6 |
python | import struct
import time
import six
from six import iteritems
from .batch import Batch
def _check_table_existence(method):
def wrap(table, *args, **kwargs):
if not table._exists():
raise IOError('TableNotFoundException: %s' % table.name)
return method(table, *args, **kwargs)
retu... | Review this code and list any quality issues. | [
{
"issue": "Function 'row' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 73
},
{
"issue": "Function 'row' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 7... | 16 |
python | import torch
# import torchtext
import torch.nn as nn
# from torchtext.vocab import Vocab, build_vocab_from_iterator
# from torchtext.utils import unicode_csv_reader
# from torchtext.data.datasets_utils import _RawTextIterableDataset
from torch import Tensor
from typing import Iterable, List
# import sentencepiece as s... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 9 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 82
},
{
"issue": "Function 'forward' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 104
},
{
... | 3 |
python | # -*- coding: utf-8 -*-
"""
Module for reading/writing data from/to legacy PyNN formats.
PyNN is available at http://neuralensemble.org/PyNN
Classes:
PyNNNumpyIO
PyNNTextIO
Supported: Read/Write
Authors: Andrew Davison, Pierre Yger
"""
from itertools import chain
import numpy
import quantities as pq
import... | Review this code and list any quality issues. | [
{
"issue": "Function 'read_segment' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 97
},
{
"issue": "Function 'write_segment' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"... | 3 |
python | # -*- coding: utf-8 -*-
"""
OpenCV Python image average color detection script. You can use this to finding darkest color.
Coded by : Lakmal Niranga. 2016
"""
import os
import cv2
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return ... | Review this code and list any quality issues. | [
{
"issue": "Function 'setupUi' is 111 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 27
}
] | 1 |
python | #!/usr/bin/python3
"""
Responsible for ingesting data related to the business performance over time. Data is placed into the asx_company_financial_metric
collection, ready for the core viewer app to use. Stocks whose financial details have been retrieved in the past month are skipped.
"""
import pymongo
import argparse... | Review this code and list any quality issues. | [
{
"issue": "Function 'melt_dataframes' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 17
},
{
"issue": "Function 'fill_stock_quote_gaps' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller function... | 3 |
python | import socket
from logging import getLogger
from .abs import AddressProviderAbs, AddressProviderException
logger = getLogger(__name__)
class AddressProviderHostName(AddressProviderAbs):
@property
def name(self):
return "hostname"
def _detect_ip_address(self) -> None:
try:
da... | Review this code and list any quality issues. | [
{
"issue": "Function '_detect_ip_address' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 14
},
{
"issue": "Function '_detect_ip_address' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"seve... | 2 |
python | import argparse
import re
import sys
from collections import Counter
sys.path.append("..")
from ml_humor_recogniser import read_data
from screenplay import Line
def run(data, output):
screenplays = read_data(data)
txt = screenplays_to_txt(screenplays)
word_counts = get_word_counts(txt)
word_probabil... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_word_counts' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 30
}
] | 1 |
python | #!/usr/bin/env python
#
# Copyright (C) 2009-2020 the sqlparse authors and contributors
# <see AUTHORS file>
#
# This example is part of python-sqlparse and is released under
# the BSD License: https://opensource.org/licenses/BSD-3-Clause
#
# This example illustrates how to extract table names from nested
# SELECT stat... | Review this code and list any quality issues. | [
{
"issue": "Function 'extract_from_part' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 29
},
{
"issue": "Function 'extract_table_identifiers' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller fu... | 2 |
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_should_respond_200' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 81
},
{
"issue": "Function 'test_should_respond_200_serialized' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
... | 3 |
python | """
Script for evaluating trained model on Keras (validate/test).
"""
import argparse
import time
import logging
import keras
from common.logger_utils import initialize_logging
from keras_.utils import prepare_ke_context, prepare_model, get_data_rec, get_data_generator, backend_agnostic_compile
def parse_args():... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse_args' is 92 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 13
},
{
"issue": "Function 'test' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 121
},... | 4 |
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": 50
},
{
"issue": "Function '__init__' is 70 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical"... | 4 |
python | # -*- coding: utf-8 -*- #
# Copyright 2014 Google LLC. 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 requir... | Review this code and list any quality issues. | [
{
"issue": "Function 'AddSSHArgs' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 49
},
{
"issue": "Function 'Run' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
... | 3 |
python | """Author: Brandon Trabucco, Copyright 2019, MIT License"""
from playground.algorithms.algorithm import Algorithm
import tensorflow as tf
class DDPG(Algorithm):
def __init__(
self,
policy,
target_policy,
qf,
target_qf,
replay_buffer,
... | 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": 10
},
{
"issue": "Function '__init__' has 14 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 10
... | 4 |
python | # -*- coding: utf-8 -*-
import os
import numpy as np
import matplotlib as m
import matplotlib.pyplot as plt
from scipy.fftpack import *
from plot_spectr import *
def main_routine():
print(os.getcwd())
nfile = './store.dat'
#Read the file by blocks to reduce required memory
with open(nfile,'r') as f:
nel =... | Review this code and list any quality issues. | [
{
"issue": "Function 'plot_spectr' is 78 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 27
}
] | 1 |
python | # -*- coding: utf-8 -*-
import pathlib
import time
from asyncy.Stories import MAX_BYTES_LOGGING, Stories
from asyncy.utils import Dict, Resolver
from pytest import mark
def test_stories_init(app, logger, story):
assert story.entrypoint == app.stories['hello.story']['entrypoint']
assert story.app == app
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_stories_context_for_function_call_with_args' is 45 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 274
}
] | 1 |
python | # -*- coding: utf-8 -*-
"""
UNET LOwered Model :
This customized UNet Model has been generated lowering the filters to their 25% .
"""
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras.layers import Input , Conv2D , MaxPooling2D , D... | Review this code and list any quality issues. | [
{
"issue": "Function 'UNet' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 19
}
] | 1 |
python | from __future__ import absolute_import
import os
import sys
from django.core.management.base import BaseCommand
import celery
import djcelery
DB_SHARED_THREAD = """\
DatabaseWrapper objects created in a thread can only \
be used in that same thread. The object with alias '%s' \
was created in thread id %s and this... | Review this code and list any quality issues. | [
{
"issue": "Function 'handle_default_options' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 78
}
] | 1 |
python | #
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
import json
from datetime import datetime
from typing import Dict, Generator
import smartsheet
from airbyte_cdk import AirbyteLogger
from airbyte_cdk.models import (
AirbyteCatalog,
AirbyteConnectionStatus,
AirbyteMessage,
AirbyteRecordMess... | Review this code and list any quality issues. | [
{
"issue": "Function 'read' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 90
},
{
"issue": "Function 'read' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line":... | 3 |
python | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | Review this code and list any quality issues. | [
{
"issue": "Function '_final_aggregation' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 23
}
] | 1 |
python | import gym
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import copy
from torch.utils.tensorboard import SummaryWriter
from torch.distributions import Normal
class Actor(nn.Module):
def __init__(self, state_dim, action_dim, hidden_width, max_action):
super(Actor, se... | 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": 12
},
{
"issue": "Function 'store' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 81
},
{
"issu... | 3 |
python | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 17 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 117
},
{
"issue": "Function '__init__' is 74 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critica... | 4 |
python | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import networkx as nx
from typing import Any, Dict, List, Optional, Tuple
from graspologic.layouts.classes import NodePosition
import matplotlib.pyplot as plt
def _calculate_x_y_domain(
positions: List[NodePosition],
) -> Tuple[Tuple[float,... | Review this code and list any quality issues. | [
{
"issue": "Function '_draw_graph' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 70
},
{
"issue": "Function '_draw_graph' is 74 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "cri... | 7 |
python | from sys import exit
def gold_room():
print("This room is full of gold. How much do you take?")
choice=input("> ")
if "0" in choice or "1" in choice:
how_much=int(choice)
else:
dead("Man,learn to type a number.")
if how_much < 50:
print("Nice,you're not greedy,you win!")... | Review this code and list any quality issues. | [
{
"issue": "Function 'bear_room' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 15
}
] | 1 |
python | # -*- coding: utf-8 -*-
from typing import Dict, Tuple, Any, Optional
import re
import string
import ast
import codecs
import argparse
import yaml
from reportlab.pdfgen import canvas
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.cidfonts import UnicodeCIDFont
from reportlab.pdfbase.ttfonts import TT... | Review this code and list any quality issues. | [
{
"issue": "Function 'put_string' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 88
},
{
"issue": "Function 'put_textbox' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 94
},
{
... | 6 |
python | import subprocess, os
import tempfile, qiime2
from q2_pepsirf.format_types import PeptideFastaFmt, ProteinFastaFmt, PepsirfLinkTSVFormat
# Name: link
# Process: runs pepsirf's link module
# Method inputs/parameters: protein_file, peptide_file, meta,
# kmer_size, kmer_redundancy_control, outfile, pepsirf_binary... | Review this code and list any quality issues. | [
{
"issue": "Function 'link' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"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 ... | 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": 102
}
] | 1 |
python | import os
import os.path as op
import warnings
import gc
from nose.tools import assert_true, assert_raises
import numpy as np
from numpy.testing import (assert_array_almost_equal, assert_equal,
assert_array_equal, assert_allclose)
from mne.datasets import testing
from mne.io import Raw
from... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_convert_forward' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 56
},
{
"issue": "Function 'test_io_forward' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",... | 5 |
python | import sys
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
from torch.autograd import Variable
def conv3x3(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=True)
def conv_in... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 26
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 52
},
{
"i... | 3 |
python | # -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can r... | Review this code and list any quality issues. | [
{
"issue": "Function 'total_closed_points_by_date' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 111
},
{
"issue": "Function 'total_closed_points_by_date' is 42 lines long. Functions over 25 lines are harder to test and m... | 2 |
python | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Willow Garage, 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:
#
# * Redistri... | Review this code and list any quality issues. | [
{
"issue": "Function '_rollback_env_variable' has cyclomatic complexity 20 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 91
},
{
"issue": "Function '_get_workspaces' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller fu... | 6 |
python | """
Definition of views.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import config
from django.shortcuts import render, HttpResponse
from django.http import HttpRequest, JsonResponse
from django.template import RequestContext
import ee
import datetime as dt
import types
im... | Review this code and list any quality issues. | [
{
"issue": "Function 'download_data' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 146
},
{
"issue": "Function 'chart_data' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"se... | 2 |
python |
from flask import Blueprint, abort, current_app, jsonify, request
from sqlalchemy.exc import IntegrityError
from app.config import QueueNames
from app.dao.annual_billing_dao import set_default_free_allowance_for_service
from app.dao.dao_utils import transaction
from app.dao.fact_billing_dao import fetch_usage_year_fo... | Review this code and list any quality issues. | [
{
"issue": "Function 'update_organisation' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 105
},
{
"issue": "Function 'send_notifications_on_mou_signed' is 31 lines long. Functions over 25 lines are harder to test and maint... | 2 |
python | import sys
from launch import LaunchDescription, LaunchService
from launch_ros.actions import Node
def generate_launch_description():
opcua_parameters = {
"server_address": "opc.tcp://192.168.100.30:4840/",
"node_ids": ["ns=4;s=|var|CODESYS CONTROL FOR Raspberry Pi MC SL.Application.IO.bool_from_p... | Review this code and list any quality issues. | [
{
"issue": "Function 'generate_launch_description' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 5
}
] | 1 |
python | import boto3
import json
import os
from sam_spot_bot_create_job.bot_dao import BotDao
# Global variables are reused across execution contexts (if available)
session = boto3.Session()
def lambda_handler(event, context):
"""
Sample json in API request body -
{
"name": name,
"fi... | Review this code and list any quality issues. | [
{
"issue": "Function 'lambda_handler' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 10
}
] | 1 |
python | '''
Copyright (C) 2014 Parrot SA
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, this list of conditions and the following di... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse' has cyclomatic complexity 36 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 89
},
{
"issue": "Function 'parse' is 80 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 3 |
python | # ######################################################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... | 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": 26
}
] | 1 |
python | # Combination Sum
'''
Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. You may return the combinations in any order.
The same number may be chosen from candidates an unlimited number of times. Two... | Review this code and list any quality issues. | [
{
"issue": "Function 'combinationSum.backtrack' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 47
}
] | 1 |
python | import paddle
from paddle import nn
import math
import numpy as np
def _cfg(url='', **kwargs):
return {
'url': url,
'num_classes': 2, 'input_size': (3, 600, 600), 'pool_size': None,
'crop_pct': .9, 'interpolation': 'bicubic',
'mean': (0.5, 0.5, 0.5), 'std': (0.5, 0.5, 0.5),
... | 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": 86
},
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 118
},
{
"... | 6 |
python | # *****************************************************************************
# * Copyright 2020 Amazon.com, Inc. and its affiliates. All Rights Reserved. *
# *
# Licensed under the Amazon Software License (the "License"). *
... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 24
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 24
}
] | 2 |
python | #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module that contains implementations for asset files
"""
from __future__ import print_function, division, absolute_import
__author__ = "Tomas Poveda"
__license__ = "MIT"
__maintainer__ = "Tomas Poveda"
__email__ = "tpovedatd@gmail.com"
import os
import logging
imp... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_file' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 79
},
{
"issue": "Function 'get_file_paths' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
... | 3 |
python | #! /usr/bin/python3
"""
contains extra preprocessing steps for raw data, including:
- using regular expression to capture misclassified Skills in Experience class
- separating terms with special characters (e.g. '/', ',')
"""
from preprocessing.src.utils import * # pylint: disable=all
import re
import inflec... | Review this code and list any quality issues. | [
{
"issue": "Function 'identify_misclassified_exp' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 31
},
{
"issue": "Function 'capture_misclassified_skills' has cyclomatic complexity 9 (threshold: 5). Consider breaking it int... | 4 |
python | import argparse
import getpass
import os
import re
import socket
from datetime import datetime
import github
from dateutil.relativedelta import relativedelta
from github import Github
from termcolor import colored
CHANGED_FILES_PAD = 50
STATE_OPEN = 'open'
STATE_MERGED = 'merged'
STATE_CLOSED = 'closed'
class Pull... | Review this code and list any quality issues. | [
{
"issue": "Function 'labeled_text' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 155
},
{
"issue": "Function 'timedelta_from_history_arg' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severit... | 3 |
python | #!/usr/bin/env python
# Copyright 2016 Palo Alto Networks, 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... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 135
}
] | 1 |
python | import _plotly_utils.basevalidators
class ErrorYValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name='error_y', parent_name='bar', **kwargs):
super(ErrorYValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
d... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 66 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 6
}
] | 1 |
python | #!/usr/bin/python2
import sys
import os
from time import sleep
from threading import Timer
import rospy
import baxter_interface
from baxter_interface import CHECK_VERSION
class JointPlayer(object):
def __init__(self, filename, loops=1):
self.filename=filename
self.loops=loops
def t... | Review this code and list any quality issues. | [
{
"issue": "Function 'clean_line' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 26
},
{
"issue": "Function 'play_file' has cyclomatic complexity 17 (threshold: 5). Consider breaking it into smaller functions.",
"severi... | 3 |
python | # -*- coding: utf-8 -*- #
"""
Created on Tue Mar 3 11:18:30 2015
@author: wcgrizolli
"""
import sys
import numpy as np
import matplotlib.pyplot as plt
from myFourierLib import *
sys.path.append('/home/wcgrizolli/pythonWorkspace/wgTools')
import wgTools as wgt
sys.path.append('/home/wcgrizolli/pythonWorkspace/... | Review this code and list any quality issues. | [
{
"issue": "Function 'circ' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 52
},
{
"issue": "Function 'tFuncLens' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 59
},
{
"issu... | 3 |
python | """
`busio` - Bus protocol support like I2C and SPI
=================================================
See `CircuitPython:busio` in CircuitPython for more details.
* Author(s): cefn
"""
import threading
from adafruit_blinka import Enum, Lockable, agnostic
from adafruit_blinka.agnostic import board_id, detector
impor... | 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 'readfrom_into' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line... | 14 |
python | import math
import warnings
import torch
from typing import List, Union
from torch import Tensor, nn
from ..common import EncoderModule, _take
__all__ = ["GenericTimmEncoder", "make_n_channel_input_std_conv"]
class GenericTimmEncoder(EncoderModule):
def __init__(self, timm_encoder: Union[nn.Module, str], layer... | Review this code and list any quality issues. | [
{
"issue": "Function 'make_n_channel_input_std_conv' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 39
}
] | 1 |
python | import os
import csv
import sys
import time
import pandas as pd
from sklearn.preprocessing import StandardScaler
from typing import Tuple
from sklearn.externals import joblib
from sklearn.model_selection import train_test_split
# 每个特征集的特征数量
FEATURE_NUM = {
'IS09_emotion': 384,
'IS10_paraling': 1582,
'IS11_... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_data' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 109
},
{
"issue": "Function 'get_data' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | import argparse
from sys import platform
from models import * # set ONNX_EXPORT in models.py
from utils.datasets import *
from utils.utils import *
def detect(save_img=False):
img_size = (320, 192) if ONNX_EXPORT else opt.img_size # (320, 192) or (416, 256) or (608, 352) for (height, width)
out, source, we... | Review this code and list any quality issues. | [
{
"issue": "Function 'detect' has cyclomatic complexity 39 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 9
},
{
"issue": "Function 'detect' is 102 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 2 |
python | # coding=utf-8
# pylint: disable-msg=E1101,W0612
import numpy as np
import pytest
import pandas as pd
import pandas.util.testing as tm
from .common import TestData
class TestSeriesReplace(TestData):
def test_replace(self):
N = 100
ser = pd.Series(np.random.randn(N))
ser[0:4] = np.nan
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_replace' is 49 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 14
}
] | 1 |
python | import os
import statistics
import csv
from collections import Counter
import pandas as pd
import numpy as np
class ExpSetup:
def __init__(self, ped_x, ped_y, ped_orient, ped_speed, car_speed, min_dist, min_ttc, min_dist_awa, det, col):
self.ped_x = ped_x
self.ped_y = ped_y
self.ped_orient... | 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": 10
},
{
"issue": "Function 'add_result' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 38
},
{
... | 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... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_worker_started_with_required_arguments' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 160
}
] | 1 |
python | #!/usr/bin/env python
# coding: utf-8
# In this notebook, I delete a triple from the neighbourhood of the target triple based on the **L2 metric = euclidean distance** between the candidate triple's embedding and the target triple's embedding
#
# - 'triple' embedding is computed by applying the model's scoring functi... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_deletions' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 61
},
{
"issue": "Function 'get_deletions' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "mi... | 3 |
python | from hashlib import sha256
import json
import time
import multiprocessing
import time
import numpy as np
class Block:
def __init__(
self, depth, transactions, timestamp,
previous_hash, nonce=0
):
self.depth = depth
self.transactions = transactions
self.timestamp = timest... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 9
},
{
"issue": "Function 'add_block' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line"... | 2 |
python | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import platform
import shutil
import time
import warnings
import torch
import mmcv
import wandb
from mmcv.runner.hooks import HOOKS, Hook
from mmcv.runner.base_runner import BaseRunner
from mmcv.runner.builder import RUNNERS
from mmcv.runner.checkpoi... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 19 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 39
},
{
"issue": "Function '__init__' is 74 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical... | 10 |
python | # -*- coding:utf-8 -*-
import copy
import numpy as np
from scipy._lib.six import xrange
class KDTree:
def __init__(self, bucket_size, dimensions, parent=None):
self.bucket_size = bucket_size
self.parent = None
self.left = None
self.right = None
self.split_dimension = None
... | Review this code and list any quality issues. | [
{
"issue": "Function 'nodeSplit' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 81
},
{
"issue": "Function 'nodeSplit' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 3 |
python | # Copyright 2021 The TensorFlow Probability 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 o... | Review this code and list any quality issues. | [
{
"issue": "Function 'testInstantiate' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 26
},
{
"issue": "Function 'testMeanSameAsGPRM' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 6 |
python | from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_import
from builtins import * # NOQA
from future import standard_library
standard_library.install_aliases() # NOQA
import argparse
import os
import random
# This prevents num... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 77 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 33
}
] | 1 |
python | import sys
from pymunk import Body, Circle, ShapeFilter
from configsingleton import ConfigSingleton
from common import *
from common.drawing import draw_circle
class Landmark(object):
def __init__(self, mask, radius):
self.body = Body(0, 0, Body.STATIC)
self.body.position = 0, 0
self.body.a... | 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": 8
}
] | 1 |
python | # -*- coding: utf-8 -*-
"""Tools for handling LaTeX."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from io import BytesIO, open
from base64 import encodestring
import os
import tempfile
import shutil
import subprocess
from IPython.utils.process import find_cm... | Review this code and list any quality issues. | [
{
"issue": "Function 'latex_to_png' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 58
},
{
"issue": "Function 'genelatex' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"sever... | 2 |
python | ###########################################################################
#
# 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
#
# https://www.apache.org/l... | Review this code and list any quality issues. | [
{
"issue": "Function 'cm_to_dv' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 72
},
{
"issue": "Function 'cm_to_dv' is 110 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 2 |
python | # -*- coding: utf-8 -*-
import time
import numpy as np
from PyQt4 import QtGui, QtCore
from ..Stage import Stage, MoveFuture, StageInterface
from acq4.drivers.PatchStar import PatchStar as PatchStarDriver
from acq4.util.Mutex import Mutex
from acq4.util.Thread import Thread
from acq4.pyqtgraph import debug, ptime, Spin... | Review this code and list any quality issues. | [
{
"issue": "Function '_move' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 102
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 165
}
] | 2 |
python | import os
import json
import requests
from typing import Optional
from . import credentials
from . import info
from . import session
class Client(session.Session):
_SCHOOL_NAME : str = None
_EMAIL : str = None
_ID : int = None
_PASSWORD : str = None
markingPeriods : list = []
hasCachedCredenti... | 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 'setCredentials' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 40
}
] | 2 |
python | import numpy as np
import mindspore
from mindspore import context, ops, Tensor, nn
from mindspore.common.parameter import Parameter, ParameterTuple
import copy
context.set_context(mode=context.PYNATIVE_MODE, device_target="CPU")
_update_op = ops.MultitypeFuncGraph("update_op")
@_update_op.register("Tensor", "Tens... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 55
},
{
"issue": "Function '__init__' has 10 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 55
... | 2 |
python | import tensorflow as tf
class BaseTrain:
def __init__(self, sess, model, data, config, logger):
self.model = model
self.logger = logger
self.config = config
self.sess = sess
self.data = data
self.init = tf.group(tf.global_variables_initializer(), tf.local_variables_... | 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": 5
}
] | 1 |
python | # -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/Slot
Release: R5
Version: 4.5.0
Build ID: 0d95498
Last updated: 2021-04-03T00:34:11.075+00:00
"""
from pydantic.validators import bytes_validator # noqa: F401
from fhir.resources import fhirtypes # noqa: F401
from fhir.resources import slot
... | Review this code and list any quality issues. | [
{
"issue": "Function 'impl_slot_1' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 14
}
] | 1 |
python | #!/usr/bin/env python3
import sys
import codecs
def main():
syllable_counts = {}
filepath = sys.argv[1]
lines = codecs.open(filepath, encoding="iso-8859-1").read().split("\n")
for line in lines:
if line.startswith(";;;") or len(line) == 0 or line.isspace():
continue
w... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 6
}
] | 1 |
python | from . import models
import pandas as pd
import zipfile
import os
import re
# def curve_io_formatter(x_column, y_columns, y_names, x_axis, y_axis, log=False):
# curves = []
# for index, output in enumerate(y_columns):
# curve = {round(float(k), 3): round(float(v), 3) for k, v in zip(x_column, output)}
... | Review this code and list any quality issues. | [
{
"issue": "Function 'extract_experiment_table' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 21
}
] | 1 |
python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 16 05:48:26 2021
@author: thales
Generate random samples from parsers
"""
from numpy.random import (poisson , binomial, randint)
from tokenlib import (Item , Etok, mk_stream)
import lib
import state
def bernoulli(p):
return binomial(1,p)
... | Review this code and list any quality issues. | [
{
"issue": "Function 'type_sample' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 113
},
{
"issue": "Function 'type_sample' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor... | 2 |
python | import numpy as np
from onpolicy.envs.mpe.core import World, Agent, Landmark
from onpolicy.envs.mpe.scenario import BaseScenario
import random
#
# # the non-ensemble version of <ensemble_push>
#
#
class Scenario(BaseScenario):
def make_world(self, args):
world = World()
world.world_length = ar... | Review this code and list any quality issues. | [
{
"issue": "Function 'make_world' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 12
},
{
"issue": "Function 'reset_world' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"sever... | 3 |
python | import _plotly_utils.basevalidators
class ColorbarValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name="colorbar", parent_name="choroplethmapbox", **kwargs
):
super(ColorbarValidator, self).__init__(
plotly_name=plotly_name,
parent_... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 226 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 5
}
] | 1 |
python | # Copyright 2013-2022 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 sys
import six
import llnl.util.tty as tty
import llnl.util.tty.colify as colify
import spack.repo
import spack.... | Review this code and list any quality issues. | [
{
"issue": "Function 'tags' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 60
},
{
"issue": "Function 'tags' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line":... | 2 |
python | # -*- coding: utf-8 -*-
"""
Created on Sat May 15 00:21:05 2021
@author: marina
"""
import os
import shutil
import pyedflib
import numpy as np
import pandas as pd
import sys
import mne
from pywt import wavedec
from sklearn.preprocessing import LabelEncoder
import matplotlib.pyplot as plt
from scipy import signal
from... | Review this code and list any quality issues. | [
{
"issue": "Function 'extract_windows' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 73
}
] | 1 |
python | # coding=utf-8
import json
import requests
import time
# noinspection PyPackageRequirements
import websocket
# noinspection PyPackageRequirements
from bs4 import BeautifulSoup
from threading import Thread
from urllib.parse import urlparse
import metasmoke
from globalvars import GlobalVars
import datahandling
# noinsp... | Review this code and list any quality issues. | [
{
"issue": "Function 'check_websocket_for_deletion' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 30
},
{
"issue": "Function 'check_websocket_for_deletion' is 46 lines long. Functions over 25 lines are harder to test a... | 3 |
python | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import onnx
from ..base import Base
from . import expect
class Xor(Base):
@staticmethod
def export():
node = onnx.helper.make_node(... | Review this code and list any quality issues. | [
{
"issue": "Function 'export_xor_broadcast' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 45
},
{
"issue": "Function 'export_xor_axis' is 43 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",... | 2 |
python | # Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_Q' is 65 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 139
},
{
"issue": "Function 'test_expected_circuit' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"l... | 2 |
python | from __future__ import division, print_function
import numpy
from sklearn.linear_model.logistic import LogisticRegression
from sklearn.metrics import roc_auc_score, mean_squared_error, log_loss
from sklearn.base import clone
from sklearn.datasets import make_blobs
from hep_ml import nnet
from hep_ml.commonutils impor... | Review this code and list any quality issues. | [
{
"issue": "Function 'check_single_classification_network' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 28
}
] | 1 |
python | # Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
import dace
import numpy as np
import pytest
from dace.libraries import standard
from dace.transformation import interstate
def _make_sdfg(name, storage=dace.dtypes.StorageType.CPU_Heap, isview=False):
N = dace.symbol('N', dtype=dace.int... | Review this code and list any quality issues. | [
{
"issue": "Function '_make_sdfg' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 9
},
{
"issue": "Function '_make_sdfg' is 46 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | # -*- coding: utf-8 -*-
"""
Copyright [2009-2018] EMBL-European Bioinformatics Institute
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 'select_possible' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 97
},
{
"issue": "Function 'parse_psl' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"s... | 3 |
python | import re
from collections import Counter
def words(text): return re.findall(r'\w+', text.lower())
WORDS = Counter()
TOTAL_WORDS = 0
def init(filename = 'big.txt'):
global WORDS
global TOTAL_WORDS
#统计词频,并存储为词典
WORDS = Counter(words(open(filename).read()))
#统计总词数
TOTAL_WORDS=sum(WORDS.values()... | Review this code and list any quality issues. | [
{
"issue": "Function 'edits1' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 38
}
] | 1 |
python | import random
from typing import Dict
import torch
from torch import Tensor, nn
from torch.nn import functional as F
class RNNDecoder(nn.Module):
@property
def max_gen_length(self) -> int:
return self.hparams["dec_max_gen_length"]
@property
def EOS_idx(self) -> int:
return self.hpara... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_step_input' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 57
},
{
"issue": "Function 'forward' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",... | 2 |
python | # -*- coding: utf8 -*-
from __future__ import absolute_import
from __future__ import division, print_function, unicode_literals
from collections import namedtuple
from operator import attrgetter
from ..utils import ItemsCount
from .._compat import to_unicode
from ..nlp.stemmers import null_stemmer
from nltk import w... | Review this code and list any quality issues. | [
{
"issue": "Function '_get_best_sentences' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 40
}
] | 1 |
python | #!/usr/bin/env python3
# Copyright (c) 2016-2019 The Qtum Core developers
# Copyright (c) 2020 The Metrix Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import BitcoinTestFramewo... | Review this code and list any quality issues. | [
{
"issue": "Function 'assert_state' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 50
},
{
"issue": "Function 'assert_state' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 50
... | 3 |
python | # coding=utf-8
# Copyright 2020 The Google Research 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 applicab... | Review this code and list any quality issues. | [
{
"issue": "Function '_read_and_decode' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 28
},
{
"issue": "Function '_read_and_decode' is 45 lines long. Functions over 25 lines are harder to test and maintain.",
"severity... | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.