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
sys.path.append('../../../tests')
import yaml
from functools import partial
import time
import random
import string
import ensure
from textwrap import dedent
from ensure import release
from ensure import cluster
from ensure import machinedeployment
from ensure import kubeadmconfig
from ensure import kubead... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_kyverno_policy_reports' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 81
}
] | 1 |
python | """
Simple dataset loaders.
For more datasets and more comprehensive loaders, you may turn to dedicated
libraries like `fuel`.
"""
import gzip
import hashlib
import os
import pickle
from typing import *
import idx2numpy
import numpy as np
from ..typing_ import *
from ..utils import CacheDir, validate_enum_arg
__al... | Review this code and list any quality issues. | [
{
"issue": "Function 'load_mnist_like' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 62
},
{
"issue": "Function '_cifar_load_batch' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 15... | 2 |
python | # coding: utf-8
"""
ThingsBoard REST API
ThingsBoard open-source IoT platform REST API documentation. # noqa: E501
OpenAPI spec version: 3.3.3-SNAPSHOT
Contact: info@thingsboard.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
impor... | 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": 45
},
{
"issue": "Function 'to_dict' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line":... | 2 |
python | # Copyright (C) 2017 shimoda kuri65536@hotmail.com
# Copyright (C) 2009 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 r... | 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": 35
}
] | 1 |
python | import json
import logging
import subprocess
from nodemgr.common import utils
from nodemgr.common.sandesh.nodeinfo.cpuinfo.ttypes import ProcessCpuInfo
class PodmanContainerMemoryCpuUsage:
def __init__(self, query_, pid_):
self._query = query_
self._cgroup = '/sys/fs/cgroup/memory{0}/memory.stat'.... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_process_mem_cpu_info' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 36
}
] | 1 |
python | #!/usr/bin/python3
# Copyright 2020 Timothy Trippel
#
# 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 'parse_args' is 57 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 76
}
] | 1 |
python | # Copyright 2015 Metaswitch Networks
#
# 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 w... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_main' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 217
},
{
"issue": "Function 'test_main_execute_error' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 2... | 2 |
python | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import torch
import torch.distributions as torchdist
from torch.distributions import constraints
import pyro
import pyro.distributions as dist
from pyro.contrib.gp.models.model import GPModel
from pyro.contrib.gp.util import condi... | 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": 69
},
{
"issue": "Function 'iter_sample.sample_next' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line... | 2 |
python | import gc
#PC only
import json, socket, re, time
import random, os
os.system('start /wait cmd /c pip install psutil')
import psutil
gc.enable()
gc.collect()
class WebServer:
def __init__(self, system):
self._call = system
self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self... | Review this code and list any quality issues. | [
{
"issue": "Function 'Filter_Json' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 40
},
{
"issue": "Function 'Filter_Json' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor"... | 4 |
python | """
"""
from collections import OrderedDict
import numpy as np
from halotools.utils import sliding_conditional_percentile
from astropy.table import Table
from ..utils.galprops import compute_lg_ssfr
SANDY_SCRATCH_PATH = "/global/cscratch1/sd/sihany/TNG300-1/output"
BEBOP = "/lcrc/project/halotools/C3EMC/TNG300-1"
NER... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_value_added_tng_data' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 30
}
] | 1 |
python | #!/usr/bin/python
import os
import sys
import glob
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.link import TCLink
from mininet.cli import CLI
script_deps = [ 'ethtool' ]
def check_scripts():
dir = os.path.abspath(os.path.dirname(sys.argv[0]))
for fname in glob.glob(dir + ... | Review this code and list any quality issues. | [
{
"issue": "Function 'check_scripts' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 14
}
] | 1 |
python | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 10 15:49:15 2018
@author: fei.wu
"""
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import tiny_face_model
import util
import cv2
import numpy a... | Review this code and list any quality issues. | [
{
"issue": "Function 'overlay_bounding_boxes' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 25
},
{
"issue": "Function 'evaluate' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"severity":... | 3 |
python | from collimator_zigzagBlade_old import Collimator_geom, Parameter_error
import os, sys
from instrument.geometry.pml import weave
from instrument.geometry import operations,shapes
from instrument.geometry.pml.Renderer import Renderer as base
parent_dir = os.path.abspath(os.pardir)
libpath = os.path.join(parent_dir, 'c3... | Review this code and list any quality issues. | [
{
"issue": "Function 'create' is 83 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 24
},
{
"issue": "Function 'create' has 10 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 24
}
] | 2 |
python | from __future__ import absolute_import, division, print_function, unicode_literals
import torch
from tests import utils
class SimpleAddModule(torch.nn.Module):
def __init__(self, inplace=False):
super(SimpleAddModule, self).__init__()
self.inplace = inplace
def forward(self, a, b):
i... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_add' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 68
}
] | 1 |
python | '''Encode target locations and labels.'''
import torch
import math
import itertools
class DataEncoder:
def __init__(self):
'''Compute default box sizes with scale and aspect transform.'''
scale = 300.
steps = [s / scale for s in (8, 16, 32, 64, 100, 300)]
sizes = [s / scale for s i... | 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": 8
},
{
"issue": "Function 'nms' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "mino... | 4 |
python | #!/usr/bin/env python
#
# Public Domain 2014-2018 MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compil... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_bulk_load_col_delete' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 100
}
] | 1 |
python | # Copyright 2021 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | Review this code and list any quality issues. | [
{
"issue": "Function 'dimensionality_and_warping_ranges' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 81
},
{
"issue": "Function 'dimensionality_and_warping_ranges' is 31 lines long. Functions over 25 lines are harder to ... | 5 |
python | import time
import re
import jwt
import requests
import json
from pprint import pprint
from abc import abstractmethod, ABC
import logging
logging.basicConfig(filename='app.log', level=logging.DEBUG,
format='%(asctime)s - %(message)s', datefmt='%d-%b-%y %H:%M:%S')
class Response:
def __init__(s... | 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 'requestAccessToken' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 44... | 3 |
python | import numpy as np
class UtilInverse():
def __init__(self, verbose=True):
self.verbose = verbose
def find_nearest_ind(self, array, value):
index = []
for ind in range(len(array)-1):
if array[ind] < value and array[ind+1] > value:
index.append(ind)
... | Review this code and list any quality issues. | [
{
"issue": "Function 'find_nearest_ind' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 7
},
{
"issue": "Function 'check_for_stable_point' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functio... | 2 |
python | print("\nArduboy image viewer v1.0 by Mr.Blinky Jul.2019\n")
#requires pyserial and PILlow to be installed.
#Use "python -m pip install pyserial" and "python -m pip install pillow" on commandline
import sys
import time
import os
try:
from serial.tools.list_ports import comports
from serial import Seri... | Review this code and list any quality issues. | [
{
"issue": "Function 'getComPort' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 44
},
{
"issue": "Function 'bootloaderStart' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"s... | 3 |
python | __all__ = [
'LXMLTreeBuilderForXML',
'LXMLTreeBuilder',
]
from StringIO import StringIO
import collections
from lxml import etree
from bs4.element import Comment, Doctype, NamespacedAttribute
from bs4.builder import (
FAST,
HTML,
HTMLTreeBuilder,
PERMISSIVE,
TreeBuilder,
XML)
from b... | Review this code and list any quality issues. | [
{
"issue": "Function 'start' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 94
},
{
"issue": "Function 'start' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line"... | 3 |
python | """
obj generator
Order of faces position/texcoord/normal
https://www.loc.gov/preservation/digital/formats/fdd/fdd000508.shtml
Ka: specifies ambient color, to account for light that is scattered about
the entire scene.
Kd: specifies diffuse color, which typically contributes most of the color
... | 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": 58
},
{
"issue": "Function '__init__' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 5 |
python | ##
# The MIT License (MIT)
#
# Copyright (c) 2015 Frankly Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, m... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse_query_value' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 64
},
{
"issue": "Function 'format_query_value' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions... | 8 |
python | """ Helpers for training """
from math import pi
import tensorflow as tf
def piecewise_constant(global_step, *args, **kwargs):
""" Constant learning rate decay (uses global_step param instead of x) """
return tf.train.piecewise_constant(global_step, *args, **kwargs)
def cyclic_learning_rate(learning_rate, gl... | Review this code and list any quality issues. | [
{
"issue": "Function 'cyclic_learning_rate' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 10
}
] | 1 |
python | from ..helpers import get_allowed
import os
import web
class RemoveProviderR:
"""
This endpoint allows for removing a provider such as openstack or vmware.
A Vent machine runs on a provider, this will not remove existing Vent
machines on the specified provider. Note that a provider can only be
rem... | Review this code and list any quality issues. | [
{
"issue": "Function 'GET' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 15
}
] | 1 |
python | from pprint import pprint
import click
from senseclust.queries import joined, joined_freq
from wikiparse.tables import headword, word_sense
from sqlalchemy.sql import distinct, select
from sqlalchemy.sql.functions import count
from os.path import join as pjoin
from senseclust.wordnet import get_lemma_objs, WORDNETS
fro... | Review this code and list any quality issues. | [
{
"issue": "Function 'gen' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 30
},
{
"issue": "Function 'gen' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 30... | 6 |
python | import copy, pathlib, typing, abc
from filepattern.functions import get_regex, get_matching, parse_directory, \
parse_vector, logger, VARIABLES, output_name, \
_parse, parse_filename
class PatternObject():
""" Abstract base class for handling file... | Review this code and list any quality issues. | [
{
"issue": "Function 'output_name' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 91
},
{
"issue": "Function '__iter__' has cyclomatic complexity 21 (threshold: 5). Consider breaking it into smaller functions.",
"sever... | 3 |
python | # Copyright 2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | Review this code and list any quality issues. | [
{
"issue": "Function 'configure_data_sdk' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 73
}
] | 1 |
python | from collections import deque
from typing import List
def maxSlidingWindow(nums: List[int], k: int) -> List[int]:
"""Return the max sliding window of size 'k' on 'nums'."""
maxWindow = []
# Keep track of the indices of the 'max' candidates.
# Elements are guaranteed to be in decreasing order.
max... | Review this code and list any quality issues. | [
{
"issue": "Function 'maxSlidingWindow' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 4
}
] | 1 |
python | import sys
import os
import argparse
import cPickle as pickle
from ConfigParser import ConfigParser as ConfigParser
from itertools import product
import numpy as np
from sklearn.decomposition import PCA
from matplotlib import pyplot as plt
from matplotlib.legend_handler import HandlerLine2D
from sklearn.manifold impo... | Review this code and list any quality issues. | [
{
"issue": "Function 'perfAnalysis' has cyclomatic complexity 19 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 58
},
{
"issue": "Function 'perfAnalysis' is 68 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "... | 2 |
python | # ==================================================================================================
# Copyright 2011 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | Review this code and list any quality issues. | [
{
"issue": "Function 'setup_parser' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 36
},
{
"issue": "Function 'console_output' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "mi... | 5 |
python | class Solution:
def XXX(self, root: TreeNode) -> List[List[int]]:
if not root:
return []
#思想就是使用队列辅助,首先根节点入队,然后开始循环,当队列不为空,不停的出队并将出队节点的左右节点入队
res=[]
q=[root]
count1,count2=1,0
#主要问题就是这个输出格式有点脑瘫,非得一层一起输出,所以这里定义两个变量count1,count2,为什么定两个,可以理解成一个用来统计下一层有多少节点,一... | Review this code and list any quality issues. | [
{
"issue": "Function 'XXX' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 2
}
] | 1 |
python | """Common code for DNS Authenticator Plugins."""
import abc
import logging
import os
import stat
from time import sleep
import configobj
import zope.interface
from acme import challenges
from certbot import errors
from certbot import interfaces
from certbot.display import ops
from certbot.display import util as disp... | Review this code and list any quality issues. | [
{
"issue": "Function 'require' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 245
}
] | 1 |
python | #import PyPDF2 # PyPDF2 extracts texts from PDF markup. We found that it worked relatively poor with CVPR papers. Spaces between words are often omitted in the outputs.
import textract # textract uses external OCR command "tesseract" to extract texts. The workflow is to first convert pdf files to ppm images and then ap... | Review this code and list any quality issues. | [
{
"issue": "Function 'extract_keywords_from_pdf' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 20
}
] | 1 |
python | from algoliaqb import AlgoliaQueryBuilder
def test_normal_filters():
aqb = AlgoliaQueryBuilder(
search_param="search",
filter_map={
"is_reported": "is_reported"
}
)
flask_request_args = {
"is_reported": True
}
filter_query = aqb.get_filter_query(flask_... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_date_filter' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 50
},
{
"issue": "Function 'test_not_using_normal_string_filters' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"se... | 2 |
python | """
Author : Raquel G. Alhama
Desc:
"""
def strid_to_opts(strid):
"""
Given model id as string, extract parameter dictionary.
Reverse of config_loader.opts2strid
:param strid:
:return:
"""
raise NotImplementedError
#Method not finished
parts = strid.split("_")
param_keys=",".s... | Review this code and list any quality issues. | [
{
"issue": "Function 'strid_to_opts' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 5
}
] | 1 |
python | import numpy as np
import pandas as pd
from typing import List
from anndata import AnnData
from sccloud.io import read_input
def search_genes(
data: AnnData,
gene_list: List[str],
rec_key: str = "de_res",
measure: str = "percentage",
) -> pd.DataFrame:
"""Extract and display gene expressions for ... | Review this code and list any quality issues. | [
{
"issue": "Function 'search_de_genes' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 51
},
{
"issue": "Function 'search_de_genes' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity":... | 7 |
python | import logging
import os
import json
import shutil
import threading
from typing import Any, List
from django.contrib.auth import login
from django.forms.models import BaseModelForm
from django.http.request import HttpRequest
from django.http.response import HttpResponse
from django.views.generic import ListView, Detai... | Review this code and list any quality issues. | [
{
"issue": "Function 'form_valid' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 108
},
{
"issue": "Function 'delete' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 164
... | 2 |
python | from pyxtal.crystal import random_cluster
from copy import deepcopy
from optparse import OptionParser
from random import randint, choice
from scipy.optimize import minimize
from scipy.spatial.distance import pdist, cdist
from pyxtal.molecule import PointGroupAnalyzer
from pymatgen import Molecule
from pyxtal.database.c... | Review this code and list any quality issues. | [
{
"issue": "Function 'predict' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 131
},
{
"issue": "Function 'relaxation' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"lin... | 3 |
python | """
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... | 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": 213
},
{
"issue": "Function '__init__' is 50 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 3 |
python | #!/usr/bin/env python3
# Copyright (c) 2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test HD Wallet keypool restore function.
Two nodes. Node1 is under test. Node0 is providing transactions an... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_test' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 27
}
] | 1 |
python | '''
Created on 09/12/2016
@author: Alvaro Paricio
@description: Calculator of TRAFFIC ASSIGNMENT ZONES (TAZ). Given a networkfile and a polygon description, get all the nodes of the network included inside the polygon.
'''
import sys
sys.path.insert(1,'lib')
import argparse as arg
from TazGeometry import taz_test, MuT... | Review this code and list any quality issues. | [
{
"issue": "Function 'getConfig' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 17
}
] | 1 |
python | import importlib
import sys
from contextlib import ContextDecorator
def lazy_load(
module_name, element, boto3_name=None, backend=None, warn_repurpose=False
):
def f(*args, **kwargs):
if warn_repurpose:
import warnings
warnings.warn(
f"Module {element} has been... | Review this code and list any quality issues. | [
{
"issue": "Function 'lazy_load' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 6
}
] | 1 |
python | import os
import sys
import platform
import datetime
from modules.Public import StrFormatter
class Merger:
currdir = ""
mergedir = ""
run_merge = {
"active_tab": False,
"mouse": False,
"keyboard": False
}
strfmr = None
def __init__(self):
'''
... | Review this code and list any quality issues. | [
{
"issue": "Function 'start' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 35
},
{
"issue": "Function 'start' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line... | 4 |
python | #!/usr/bin/env python
# coding=utf-8
import numpy as np
import os
import os.path as op
import argparse
import torch
from Buzznauts.utils import load_dict, saveasnii, get_fmri, set_device
from Buzznauts.analysis.baseline import get_activations, predict_fmri_fast
from tqdm import tqdm
def main():
description = 'En... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 14
},
{
"issue": "Function 'main' is 121 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line":... | 2 |
python | from django.conf import settings
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.shortcuts import render
from wagtail.core.models import Page
from wagtail.search.models import Query
from .models import ActionApproach, Resource, Solution, People
def search(request):
# Search
... | Review this code and list any quality issues. | [
{
"issue": "Function 'search' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 10
},
{
"issue": "Function 'search' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"lin... | 2 |
python | """Certbot Route53 authenticator plugin."""
import collections
import logging
import time
import boto3
import zope.interface
from botocore.exceptions import NoCredentialsError, ClientError
from certbot import errors
from certbot import interfaces
from certbot.plugins import dns_common
from acme.magic_typing import D... | Review this code and list any quality issues. | [
{
"issue": "Function '_find_zone_id_for_domain' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 74
},
{
"issue": "Function '_change_txt_record' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
... | 2 |
python | # coding=utf-8
# Copyright 2021 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 'random_initializer' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 58
},
{
"issue": "Function 'fixed_random_initializer' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
... | 2 |
python | import os
os.environ['CUDA_VISIBLE_DEVICES'] = '3'
import pyroomacoustics as pra
import numpy as np
from pydub import AudioSegment
from sklearn.utils import shuffle
from glob import glob
import random
import json
from malaya_speech.train.model.conformer.model import Model as ConformerModel
from malaya_speech.train.mo... | Review this code and list any quality issues. | [
{
"issue": "Function 'calc' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 79
},
{
"issue": "Function 'calc' is 76 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"... | 6 |
python | '''
Support for the TelosB / Tmote Sky platforms, and close clones.
Utilizes the GoodFET firmware with CCSPI application, and the GoodFET client code.
'''
import os
import time
import struct
import time
from datetime import datetime, timedelta
from kbutils import KBCapabilities, makeFCS
from GoodFETCCSPI import GoodF... | Review this code and list any quality issues. | [
{
"issue": "Function 'inject' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 129
},
{
"issue": "Function 'inject' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 1... | 4 |
python | # coding: utf-8
"""
ARTIK Cloud API
No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 2.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License"... | 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": "critical",
"line": 35
},
{
"issue": "Function '__init__' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 35
}... | 3 |
python | # import warnings filter
from warnings import simplefilter
# ignore all future warnings
simplefilter(action = "ignore", category = FutureWarning)
import os
import sys
import tqdm
import time
import json
import glob
import gdown
import urllib
import zipfile
import hashlib
import argparse
import numpy as np
from traini... | Review this code and list any quality issues. | [
{
"issue": "Function 'prepare' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 146
},
{
"issue": "Function 'prepare' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 3 |
python | import numpy as np
import pytest
import pandas as pd
from pandas import Series
import pandas._testing as tm
def test_get():
# GH 6383
s = Series(
np.array(
[
43,
48,
60,
48,
50,
51,
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_get' is 92 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 9
}
] | 1 |
python | #!/usr/bin/python
#
# build.py
#
# chain nova and neuton service requests to build predefined compute topologies
#
# topology is defined in python language 'spec' files
#
# by default the program will build the topology requested form a clean slate,
# but give the correct option (-c) it will also attempt to complete a ... | Review this code and list any quality issues. | [
{
"issue": "Function 'process_servers' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 281
}
] | 1 |
python | import time
from modules import cbpi
from modules.core.controller import KettleController
from modules.core.props import Property
@cbpi.controller
class SimpleCascadeHysteresis(KettleController):
"""
This hysteresis controls MashTun temp. It creates hysteresis on HLT temp not allowing it to reach
much hig... | Review this code and list any quality issues. | [
{
"issue": "Function 'run' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 34
},
{
"issue": "Function 'run' is 47 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 34... | 5 |
python | import unittest
import utils
from grammar import Grammar
class SplitByCommasTest(unittest.TestCase):
def test_simple(self):
self.assertEqual(['A', 'B', 'C'], utils.split_by('A, B, C', ','))
def test_without_space(self):
self.assertEqual(['A', 'B', 'C'], utils.split_by('A,B,C', ','))
def... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_remove_rules1' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 114
},
{
"issue": "Function 'test_remove_rules2' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor... | 2 |
python | from cryptography.x509 import load_pem_x509_certificate
from cryptography.hazmat.primitives.serialization import (
load_pem_private_key, load_pem_public_key, load_ssh_public_key,
)
from cryptography.hazmat.backends import default_backend
from authlib.common.encoding import to_bytes
def load_pem_key(raw, ssh_type=... | Review this code and list any quality issues. | [
{
"issue": "Function 'load_pem_key' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 9
}
] | 1 |
python | # vim: set fileencoding=utf8 :
"""Some hooks that might be useful."""
import os
import glob
import subprocess
from StringIO import StringIO
import logging
from slugify import slugify
from wok.exceptions import DependencyException
try:
from lxml import etree
except ImportError:
etree = None
try:
import ... | Review this code and list any quality issues. | [
{
"issue": "Function '__call__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 39
},
{
"issue": "Function '__call__' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 3 |
python | class Solution:
def isValidSudoku(self, board: List[List[str]]) -> bool:
BZip = list(zip(*board))
def Checkline(li):
temp = [i for i in li if i!="."]
return len(set(temp))==len(temp)
def check_row(board):
for i in b... | Review this code and list any quality issues. | [
{
"issue": "Function 'isValidSudoku.square' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 21
}
] | 1 |
python |
import numpy as np
import librosa
from tqdm import tqdm
from audiomisc import ks_key
from constants import VERTICALCUTOFF, FFT_SIZE, FFT_HOP
def stft(x, fft_size, hopsamp):
window = np.hanning(fft_size)
return np.array([np.fft.rfft(window*x[i:i+fft_size])
for i in range(0, len(x)-fft_siz... | Review this code and list any quality issues. | [
{
"issue": "Function 'wav_to_spec' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 14
},
{
"issue": "Function 'wav_to_spec' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor"... | 2 |
python | from __future__ import print_function
import mxnet as mx
import numpy as np
from timeit import default_timer as timer
from dataset.iterator import DetTestImageIter
import cv2
class ImageDetector(object):
"""
SSD detector which hold a detection network and wraps detection API
Parameters:
----------
symbol : mx.Sy... | 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": 29
},
{
"issue": "Function 'scale_and_plot_rects' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "mi... | 2 |
python | """
Copyright 2022 RICHARD TJÖRNHAMMAR
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, sof... | Review this code and list any quality issues. | [
{
"issue": "Function 'seeded_kmeans' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 33
},
{
"issue": "Function 'seeded_kmeans' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "mi... | 14 |
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": 44
}
] | 1 |
python | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... | Review this code and list any quality issues. | [
{
"issue": "Function 'process_fidelity' has cyclomatic complexity 19 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 38
},
{
"issue": "Function 'process_fidelity' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"seve... | 4 |
python | """
This file offers the methods to automatically retrieve the graph Pontibacter chinhatensis.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--prote... | Review this code and list any quality issues. | [
{
"issue": "Function 'PontibacterChinhatensis' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 30
}
] | 1 |
python | from typing import Any, Tuple, Union, Mapping, Callable, Optional, Sequence
from typing_extensions import Literal
from enum import auto
from types import MappingProxyType
from pathlib import Path
import scvelo as scv
from anndata import AnnData
from cellrank import logging as logg
from cellrank.tl import Lineage
from... | Review this code and list any quality issues. | [
{
"issue": "Function '_get_distances' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 44
},
{
"issue": "Function 'circular_projection' has cyclomatic complexity 34 (threshold: 5). Consider breaking it into smaller functions.... | 4 |
python | import tensorflow as tf
from tensorflow.python.eager import context
from tensorflow.python.framework import ops
from tensorflow.python.ops import clip_ops
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import resource_variable_ops
from tensorflow... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 43 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 21
},
{
"issue": "Function '__init__' has 17 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 21
... | 7 |
python |
"""
compute Sea Surface Height Above Geoid, zos
"""
from __future__ import absolute_import, division, print_function
import xarray
import logging
from e3sm_to_cmip import mpas
from e3sm_to_cmip.util import print_message
# 'MPAS' as a placeholder for raw variables needed
RAW_VARIABLES = ['MPASO', 'MPAS_mesh', 'MPAS_... | Review this code and list any quality issues. | [
{
"issue": "Function 'handle' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 22
}
] | 1 |
python | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 3 21:21:19 2020
Project: chemplot (Chemical Space Visualization)
Content: Descriptor operation methods
@author: murat cihan sorkun
"""
from rdkit import Chem
from rdkit.Chem import AllChem
import pandas as pd
import math
import mordred
from mordred import Calculator, d... | Review this code and list any quality issues. | [
{
"issue": "Function 'generate_mordred_descriptors' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 47
},
{
"issue": "Function 'generate_mordred_descriptors' is 40 lines long. Functions over 25 lines are harder to test and m... | 5 |
python | """This module defines functions and globals required for the
command line interface of browser-history."""
import sys
import argparse
from browser_history import get_history, generic, browsers, utils
# get list of all implemented browser by finding subclasses of generic.Browser
AVAILABLE_BROWSERS = ', '.join(b.__nam... | 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": 47
},
{
"issue": "Function 'main' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 2 |
python | import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import tensorflow as tf
from dataset.dataloader import load_tfds
from time import time
import argparse
from nets.simple_basline import SimpleBaseline
from nets.evopose2d import EvoPose
from nets.hrnet import HRNet
from utils import detect_hardware
def speed_test(stra... | Review this code and list any quality issues. | [
{
"issue": "Function 'speed_test' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 13
},
{
"issue": "Function 'speed_test' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | import importlib
import pkgutil
import signal
import string
import sys
import traceback
from contextlib import contextmanager
from datetime import datetime, tzinfo
from pathlib import Path
from typing import Iterable, Optional, Set, Tuple, Union
import pytz
from .aliases import PathOrStr
from .exceptions import SigTe... | Review this code and list any quality issues. | [
{
"issue": "Function 'resolve_module_name' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 68
},
{
"issue": "Function 'import_module_and_submodules' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into small... | 4 |
python | """
>>> DRAFT "py_merge"! <<<
Builtin "sorted()" function, but using all CPU cores available for speedup!
It supports all kwargs of "sorted()": "cmp", "key" and "reverse",
however items of "iterable" and all of these kwargs should be picklable:
https://docs.python.org/2/library/pickle.html#what-can-be-pickled-and-unp... | Review this code and list any quality issues. | [
{
"issue": "Function 'multicore_sorted' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 62
},
{
"issue": "Function 'multicore_sorted' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity... | 4 |
python | #!/usr/bin/env python3
# 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.
"""
Catch all for a number of "other" scripts.
"""
import os
import unittest
import parlai.utils.testing as testing_uti... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_convert' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 17
},
{
"issue": "Function 'test_vacuum' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line":... | 2 |
python | """Test the Abode camera class."""
import os
import unittest
import requests_mock
import abodepy
import abodepy.helpers.constants as CONST
import tests.mock as MOCK
import tests.mock.devices.ir_camera as IRCAMERA
import tests.mock.login as LOGIN
import tests.mock.oauth_claims as OAUTH_CLAIMS
import tests.mock.logout ... | Review this code and list any quality issues. | [
{
"issue": "Function 'tests_camera_properties' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 35
},
{
"issue": "Function 'tests_camera_image_update' is 48 lines long. Functions over 25 lines are harder to test and maintain.",
"severi... | 3 |
python | # coding=utf-8
# Copyright (c) 2021, Arm Limited and Contributors.
# SPDX-License-Identifier: Apache-2.0
# Copyright 2021 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 Lic... | Review this code and list any quality issues. | [
{
"issue": "Function 'train' has cyclomatic complexity 33 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 46
},
{
"issue": "Function 'train' is 190 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 2 |
python | #!/usr/bin/env python3
# Copyright (c) 2015-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test multiple RPC users."""
from test_framework.test_framework import BitcoinTestFramework
from test_f... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_test' is 77 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 32
}
] | 1 |
python | import unittest
import rlbench.backend.task as task
import os
from rlbench.backend.utils import task_file_to_task_class
from pyrep import PyRep
from pyrep.robots.arms.panda import Panda
from pyrep.robots.end_effectors.panda_gripper import PandaGripper
from rlbench.backend.const import TTT_FILE
from tools.task_validator... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_run_task_validator' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 32
}
] | 1 |
python | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation.
# Copyright 2012, Red Hat, 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:/... | Review this code and list any quality issues. | [
{
"issue": "Function 'forever_retry_uncaught_exceptions.inner_func' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 72
}
] | 1 |
python | # Copyright 2020 The TEMPO Collaboration
#
# 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... | 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": 51
},
{
"issue": "Function '_initialize_mps_mpo' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line"... | 7 |
python | from __future__ import print_function
import keras
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Conv2D, MaxPooling2D, BatchNormalization
from keras imp... | Review this code and list any quality issues. | [
{
"issue": "Function 'build_model' is 65 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 27
},
{
"issue": "Function 'train' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 144
... | 2 |
python | # -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
# -----------------------------------------------------------------------------
try... | Review this code and list any quality issues. | [
{
"issue": "Function 'describe' is 125 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 25
},
{
"issue": "Function 'fetch_ticker' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 1... | 8 |
python | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def addTwoNumbers(self, l1: Optional[ListNode], l2: Optional[ListNode]) -> Optional[ListNode]:
n = cur = ListNode(-1)
carry ... | Review this code and list any quality issues. | [
{
"issue": "Function 'addTwoNumbers' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 7
}
] | 1 |
python | #!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 78
},
{
"issue": "Function '__init__' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical... | 4 |
python | import numpy as np
from wavedata.wavedata.tools.core import geometry_utils
class VoxelGrid2D(object):
"""
Voxel grids represent occupancy info. The voxelize_2d method projects a point cloud
onto a plane, while saving height and point density information for each voxel.
"""
# Class Constants
... | Review this code and list any quality issues. | [
{
"issue": "Function 'voxelize_2d' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 43
},
{
"issue": "Function 'voxelize_2d' is 60 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major"... | 3 |
python | #!/usr/bin/env python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | Review this code and list any quality issues. | [
{
"issue": "Function 'CreateUnit' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 87
},
{
"issue": "Function 'main' is 56 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 156
},... | 3 |
python | import subprocess
import argparse
import json
import pprint
from sys import exit
import uuid
import ast
import numpy as np
import netCDF4 as nc
import os
# python parameter_sweep.py case_name
def main():
parser = argparse.ArgumentParser(prog='Paramlist Generator')
parser.add_argument('case_name')
args = pa... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 130 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 13
},
{
"issue": "Function 'sweep' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 170
}
] | 2 |
python | # -*- coding: utf-8 -*-
# Description: cpuidle netdata python.d module
# Author: Steven Noonan (tycho)
import glob
import os
import platform
import time
from base import SimpleService
import ctypes
syscall = ctypes.CDLL('libc.so.6').syscall
# default module values (can be overridden per job in `config`)
# update_eve... | Review this code and list any quality issues. | [
{
"issue": "Function 'check' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 88
}
] | 1 |
python | #
# Copyright (c) 2009-2016, Jack Poulson
# All rights reserved.
#
# This file is part of Elemental and is under the BSD 2-Clause License,
# which can be found in the LICENSE file in the root directory, or at
# http://opensource.org/licenses/BSD-2-Clause
#
import El
n0 = 50
n1 = 50
display = False
worldRank = E... | Review this code and list any quality issues. | [
{
"issue": "Function 'StackedFD2D' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 19
},
{
"issue": "Function 'StackedFD2D' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major... | 2 |
python | import discord
import constants as c
from discord.ext import commands
import random as r
urls=['https://cdn.discordapp.com/attachments/433007901800398858/433047585121501194/maxresdefault.jpg','https://cdn.discordapp.com/attachments/442868510776098818/442879211296915466/9bt3n9w40bp01.jpg','https://cdn.discordapp.com... | Review this code and list any quality issues. | [
{
"issue": "Function 'on_message' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 41
}
] | 1 |
python | """We want to export the field to some data files.
"""
from root.config.main import *
from screws.freeze.main import FrozenOnly
from screws.miscellaneous.timer import check_filename, check_no_splcharacter
from scipy.io import savemat
class _3dCSC_SF_Export_Field(FrozenOnly):
""""""
def __init__(self, sf):
... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_file' has cyclomatic complexity 35 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 21
},
{
"issue": "Function 'to_file' is 110 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical"... | 2 |
python | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 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": "minor",
"line": 27
},
{
"issue": "Function 'decode' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"l... | 3 |
python | """
OpenAPI definition
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v0
Contact: support@gooddata.com
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sy... | Review this code and list any quality issues. | [
{
"issue": "Function '_from_openapi_data' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 104
},
{
"issue": "Function '_from_openapi_data' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"sev... | 4 |
python | # -*- coding: utf-8 -*-
"""
pyspecific.py
~~~~~~~~~~~~~
Sphinx extension with Python doc-specific markup.
:copyright: 2008-2014 by Georg Brandl.
:license: Python license.
"""
import re
import codecs
from os import path
from time import asctime
from pprint import pformat
from docutils.io import St... | Review this code and list any quality issues. | [
{
"issue": "Function 'issue_role' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 80
},
{
"issue": "Function 'source_role' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 89
},
{
... | 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 'queue_task_instance' has 10 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 89
}
] | 1 |
python | #importing some useful packages
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
#reading in an image
image = mpimg.imread('test_images/solidWhiteRight.jpg');
#printing out some stats and plotting
print('This image is:', type(image), 'with dimesions:', image.shape)
plt.im... | Review this code and list any quality issues. | [
{
"issue": "Function 'draw_lines' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 61
},
{
"issue": "Function 'draw_lines' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",... | 5 |
python | #!/usr/bin/python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | Review this code and list any quality issues. | [
{
"issue": "Function 'doAllRequests' has cyclomatic complexity 23 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 107
},
{
"issue": "Function 'doAllRequests' is 106 lines long. Functions over 25 lines are harder to test and maintain.",
"severity... | 2 |
python | ################################################################################
# Copyright 2019 Noblis, Inc #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 24
},
{
"issue": "Function '__call__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 29
}
] | 2 |
python | from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import NoAlertPresentException
import... | Review this code and list any quality issues. | [
{
"issue": "Function 'change_system_setting' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 152
}
] | 1 |
python | #!/usr/bin/env python
#--------------------------------------------------------------
# This is a Enge Function Factory specific for the J-PARC. Some
# Enge's function parameters are defined by the aperture and length,
# and others are defined by the field distribution formula from Trace3D
# documentation.
#---------... | Review this code and list any quality issues. | [
{
"issue": "Function 'JPARC_EngeFunctionFactory' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 18
}
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.