language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | from collections.abc import Mapping
import numpy as np
from pickydict import PickyDict
from .utils import load_known_key_conversions
_key_regex_replacements = {r"\s": "_",
r"[!?.,;:]": ""}
_key_replacements = load_known_key_conversions()
class Metadata:
"""Class to handle spectrum met... | Review this code and list any quality issues. | [
{
"issue": "Function '__eq__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 66
}
] | 1 |
python | import os
import errno
import certifi
import requests
from deriva.core import urlsplit, get_new_requests_session, stob, make_dirs, DEFAULT_SESSION_CONFIG
from deriva.transfer.download import DerivaDownloadError, DerivaDownloadConfigurationError, \
DerivaDownloadAuthenticationError, DerivaDownloadAuthorizationError
... | Review this code and list any quality issues. | [
{
"issue": "Function 'catalogQuery' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 60
},
{
"issue": "Function 'catalogQuery' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "min... | 4 |
python | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Enrique Fernandez
# Released under the BSD License.
#
# Authors:
# * Enrique Fernandez
import Tkinter
import rospy
from geometry_msgs.msg import Twist, Vector3
import numpy
class MouseTeleop():
def __init__(self):
# Retrieve params... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 19
},
{
"issue": "Function '__init__' is 58 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 3 |
python | from typing import Tuple, Union, Callable, Optional, Sequence
from pytest_mock import MockerFixture
import pytest
import numpy as np
import dask.array as da
from squidpy.im import (
segment,
ImageContainer,
SegmentationCustom,
SegmentationWatershed,
)
from squidpy.im._segment import _SEG_DTYPE
from sq... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_dask_segment' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 151
}
] | 1 |
python | from stable_baselines.ppo2.run_mujoco import eval_return
import cma
import numpy as np
from stable_baselines.low_dim_analysis.eval_util import *
from stable_baselines.low_dim_analysis.common import do_pca, plot_2d, \
dump_rows_write_csv, generate_run_dir, do_proj_on_first_n_IPCA, get_allinone_concat_df
from sklear... | Review this code and list any quality issues. | [
{
"issue": "Function 'plot_cma_returns' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 26
},
{
"issue": "Function 'do_cma' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
... | 6 |
python | import csv
import logging
from datetime import datetime, timedelta
from typing import Any, Dict, Optional
from scrapy import Spider
from sqlalchemy.dialects.postgresql import insert
from opennem.core.normalizers import normalize_duid
from opennem.db import SessionLocal, get_database_engine
from opennem.db.models.open... | Review this code and list any quality issues. | [
{
"issue": "Function 'process_item' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 82
},
{
"issue": "Function 'process_item' is 53 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "maj... | 2 |
python | import numpy as np
import pandas as pd
from sklearn.cluster import KMeans
import itertools
import findspark
import pyspark
from pyspark.sql.functions import pandas_udf, PandasUDFType
from pyspark.sql.types import *
import time
def simulate_sbm_dc_data(sbm_matrix, sample_size=1000, partition_num=10, cluster_num=3):
... | Review this code and list any quality issues. | [
{
"issue": "Function 'simulate_sbm_dc_data' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 12
},
{
"issue": "Function 'get_laplace_matrix' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller funct... | 7 |
python | import os.path as pt
import numpy as np
import torchvision.transforms as transforms
import torch
from torch.utils.data import DataLoader
from torchvision.datasets import EMNIST
def ceil(x: float):
return int(np.ceil(x))
class MyEMNIST(EMNIST):
""" Reimplements get_item to transform tensor input to pil imag... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 33
},
{
"issue": "Function '__init__' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 3 |
python | import os
import numpy as np
import pandas as pd
from qlib.data.dataset.processor import Processor
from qlib.data.dataset.utils import fetch_df_by_index
from typing import Dict
class HighFreqTrans(Processor):
def __init__(self, dtype: str = "bool"):
self.dtype = dtype
def fit(self, df_features):
... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 25
},
{
"issue": "Function 'fit' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 38
... | 2 |
python | """
Dump/export our own data to a local file.
Script is installed as `location_dump`.
"""
import argparse
import os
import os.path
import sys
from sqlalchemy import text
from ichnaea.db import (
configure_db,
db_worker_session,
)
from ichnaea.geocalc import bbox
from ichnaea.log import (
configure_loggi... | Review this code and list any quality issues. | [
{
"issue": "Function 'dump_model' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 43
},
{
"issue": "Function 'dump_file' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"li... | 4 |
python | """
Convert an RDF graph into an image for displaying in the notebook, via GraphViz
It has two parts:
- conversion from rdf into dot language. Code based in rdflib.utils.rdf2dot
- rendering of the dot graph into an image. Code based on
ipython-hierarchymagic, which in turn bases it from Sphinx
See https://... | Review this code and list any quality issues. | [
{
"issue": "Function 'label' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 130
},
{
"issue": "Function 'rdf2dot' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "m... | 5 |
python | from . import ac
from . import q_learning
from . import rnnq_learning
AC = ac.ActorCritic
MFAC = ac.MFAC
IL = q_learning.DQN
MFQ = q_learning.MFQ
POMFQ = q_learning.POMFQ
rnnIL = rnnq_learning.DQN
rnnMFQ = rnnq_learning.MFQ
def spawn_ai(algo_name, sess, env, handle, human_name, max_steps):
if algo_name == 'mfq':
... | Review this code and list any quality issues. | [
{
"issue": "Function 'spawn_ai' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 12
},
{
"issue": "Function 'spawn_ai' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line"... | 2 |
python | from lib.types import IStdin, IStdout
def main(stdin: IStdin, stdout: IStdout):
stdout.write('*** You are a student at PWN_University and you are all set to graduate at the end of the semester. Unfortunately the night before graduation you learned you were going to fail your last class and now you’re afraid the sc... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 3
},
{
"issue": "Function 'main' is 51 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 3... | 2 |
python | # Import the Twython class
from twython import Twython
import json
import os
import pandas as pd
from tqdm import tqdm
try:
os.remove('twitter_dataset.csv')
except OSError:
pass
def main():
old_df = pd.read_csv('data/twitter_dataset_2.csv', lineterminator='\n')
#first load the dictonary with the top u... | 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": 13
},
{
"issue": "Function 'main' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 2 |
python | """Data structure of RSS and useful functions.
"""
#
# Copyright (c) 2005-2020 shinGETsu Project.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain ... | 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": 44
},
{
"issue": "Function '__init__' has 9 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 73
},
{
... | 3 |
python | # Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
from .kern import Kern
import numpy as np
from ...core.parameterization import Param
from paramz.transformations import Logexp
from paramz.caching import Cache_this
class Static(Kern):
def __init__(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 'gradients_Z_expectations' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 41... | 12 |
python | # Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
# external
from mixbox import fields
import cybox.common
from cybox.common.tools import ToolInformationList
# internal
import stix
import stix.bindings.stix_common as stix_common_binding
# relative
from .vocabs im... | 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": 33
}
] | 1 |
python | import os
import sys
import dlib
import glob
import csv
import pickle as pp
from sklearn.neighbors import KNeighborsClassifier
import pandas as pd
from sklearn import preprocessing
# from sklearn.model_selection import train_test_split
import webbrowser
from timeit import Timer
from keras.preprocessing.image import img... | Review this code and list any quality issues. | [
{
"issue": "Function 'upload' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 104
}
] | 1 |
python | # Copyright 2013-2019 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)
from spack import *
import sys
class NaluWind(CMakePackage):
"""Nalu-Wind: Wind energy focused variant of Nalu."""
... | Review this code and list any quality issues. | [
{
"issue": "Function 'cmake_args' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 67
},
{
"issue": "Function 'cmake_args' is 64 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",... | 2 |
python | from docutils.parsers.rst import roles
from docutils import nodes
from docutils.parsers.rst.states import Inliner
import docutils.parsers.rst.roles
def strike_role(role, rawtext, text, lineno, inliner: Inliner, options={}, content=[]):
"""
USAGE: :del:`your context`
:param role: my-strike
:param raw... | Review this code and list any quality issues. | [
{
"issue": "Function 'strike_role' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 7
}
] | 1 |
python | import logging
import pathlib
from unittest import mock
from cabinetry import templates
@mock.patch("cabinetry.route.apply_to_all_templates")
@mock.patch("cabinetry.templates.builder._Builder")
def test_build(mock_builder, mock_apply):
config = {"General": {"HistogramFolder": "path/", "InputPath": "file.root"}}
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_collect' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 46
}
] | 1 |
python | #!/usr/bin/env python
import socket
import re
class RobotFeedback:
"""Class for the Mecademic Robot allowing for live positional
feedback of the Mecademic Robot.
Attributes
----------
address : string
The IP address associated to the Mecademic robot.
socket : socket
Socket con... | Review this code and list any quality issues. | [
{
"issue": "Function 'connect' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 65
},
{
"issue": "Function 'get_data' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": ... | 4 |
python | from django.db.models import Q
from apps.configattribute.models import ConfigAttribute
from apps.property.models import GenericProperty
from apps.utils.data_helpers.manager import DataManager
from apps.utils.iotile.variable import SYSTEM_VID
from apps.utils.timezone_utils import display_formatted_ts
class TripInfo(o... | Review this code and list any quality issues. | [
{
"issue": "Function '_get_config_attributes' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 57
},
{
"issue": "Function 'analyze' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity":... | 2 |
python | import os
import numpy as np
import pandas as pd
import binascii
import warnings
import tempfile
from math import ceil
from multiprocessing import cpu_count, sharedctypes
from multiprocessing.pool import Pool
from sklearn.metrics import r2_score
from deepimpute.net import Net
from deepimpute.normalizer import Normaliz... | 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": 49
},
{
"issue": "Function 'fit' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 89
... | 4 |
python | # -*- coding: utf-8 -*-
""" Command line configuration parser """
import sys
import os.path
import argparse
import configparser
def parse():
""" Parse command line options """
parser = argparse.ArgumentParser(
description='Dynamic DynamoDB - Auto provisioning AWS DynamoDB')
parser.add_argument(
... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse' is 201 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 9
}
] | 1 |
python | # -*- coding: utf-8 -*-
from requests import Session
from requests.adapters import HTTPAdapter
from requests.exceptions import ConnectionError
import json
from time import sleep, time
from pprint import pprint
from itertools import cycle
from .storage import nodes, api_total
#from .proxy import Proxy
class Http():
... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_response' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 57
},
{
"issue": "Function 'get_response' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "mino... | 4 |
python | import PIL.Image
import PIL.ImageColor
import PIL.ImageEnhance
import zeit.cms.repository.folder
import zeit.connector.interfaces
import zeit.content.image.interfaces
import zope.app.appsetup.product
import zope.component
import zope.interface
import zope.security.proxy
class ImageTransform(object):
zope.interfa... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_variant_image' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 49
},
{
"issue": "Function 'create_variant_image' has 5 parameters. Consider using a parameter object to reduce arity.",
"severi... | 8 |
python | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 29 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 23
},
{
"issue": "Function '__init__' is 43 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical... | 4 |
python | """
Copyright (c) 2016, Jose Dolz .All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the f... | Review this code and list any quality issues. | [
{
"issue": "Function 'startTraining' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 39
},
{
"issue": "Function 'startTraining' is 137 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "... | 2 |
python |
# Online References used :
# https://github.com/imadmali/movie-scraper/blob/master/MojoLinkExtract.py
# https://www.crummy.com/software/BeautifulSoup/bs4/doc/
# https://nycdatascience.com/blog/student-works/scraping-box-office-mojo/
# https://www.youtube.com/watch?v=XQgXKtPSzUI
# https://www.youtube.com/watch?v=aIPqt-... | Review this code and list any quality issues. | [
{
"issue": "Function 'scrape_data_for_actors' has cyclomatic complexity 17 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 18
},
{
"issue": "Function 'scrape_data_for_actors' is 76 lines long. Functions over 25 lines are harder to test and maintain.... | 2 |
python | import os
import shutil
import subprocess
from pathlib import Path
from dotenv import dotenv_values
COMPOSAPY_ROOT_DIR = Path(__file__).parent
COMP_APP_PROD_DIR = COMPOSAPY_ROOT_DIR.parent.parent.joinpath("Product")
DATALAB_SERVICE_STATIC_DIR = COMP_APP_PROD_DIR.joinpath(
"CompAnalytics.DataLabService", "static"
)... | Review this code and list any quality issues. | [
{
"issue": "Function 'update_composapy_wheel' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 48
},
{
"issue": "Function 'update_composapy_wheel' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
... | 2 |
python | from sympy import Symbol, gamma, oo, nan, zoo, factorial, sqrt, Rational, log,\
polygamma, EulerGamma, pi, uppergamma, S, expand_func, loggamma, sin, cos, \
O, cancel
x = Symbol('x')
y = Symbol('y')
n = Symbol('n', integer=True)
def test_gamma():
assert gamma(nan) == nan
assert gamma(oo) == oo... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_polygamma_expand_func' is 43 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 82
}
] | 1 |
python | from datetime import datetime
import re
from urllib.parse import quote
from django.db import models
from django.utils.html import urlize
from django.utils.timezone import make_aware, utc
from django.utils.translation import ugettext_lazy as _
from requests_oauthlib import OAuth1
import requests
from mezzanine.conf i... | Review this code and list any quality issues. | [
{
"issue": "Function 'run' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 48
},
{
"issue": "Function 'run' is 81 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"li... | 2 |
python | from twisted.internet import reactor
from twisted.web import client, error, http
from twisted.web.resource import Resource
from hookah import queue
import urllib
import sys, os
from urllib import unquote
import cgi
import StringIO
import mimetools
import mimetypes
# TODO: Make these configurable
RETRIES = 3
DELAY_MUL... | Review this code and list any quality issues. | [
{
"issue": "Function 'encode_multipart_formdata' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 30
},
{
"issue": "Function 'cgi_environ_factory' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller ... | 6 |
python | ##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS I... | Review this code and list any quality issues. | [
{
"issue": "Function 'datetime_to_minutes' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 36
}
] | 1 |
python | # Given a list of pts text files, build a complete dataset from it.
import glob
import os
import PIL.Image
import cv2
import numpy as np
from time import time
from argparse import ArgumentParser
from scipy.spatial import cKDTree
import tensorflow as tf
import SaddlePoints
import errno
def mkdir_p(path):
try:
os.... | Review this code and list any quality issues. | [
{
"issue": "Function 'addOverlay' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 83
},
{
"issue": "Function 'main' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line":... | 3 |
python | # Телеграм-бот v.002 - бот создаёт меню, присылает собачку, и анекдот
import telebot # pyTelegramBotAPI 4.3.1
from telebot import types
import requests
import bs4
bot = telebot.TeleBot('5105972662:AAG24fr382U1_hosO4Zrb-tv_BTakAV1MPk') # Создаем экземпляр бота
# --------------------------------------------... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_text_messages' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 29
},
{
"issue": "Function 'get_text_messages' is 45 lines long. Functions over 25 lines are harder to test and maintain.",
"sever... | 2 |
python | # -*- coding: utf-8 -*-
# @Author: Manuel Rodriguez <valle>
# @Date: 28-Aug-2017
# @Email: valle.mrv@gmail.com
# @Filename: models.py
# @Last modified by: valle
# @Last modified time: 15-Feb-2018
# @License: Apache license vesion 2.0
from __future__ import unicode_literals
from django.db.models import Q
from dj... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_vendedor' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 110
},
{
"issue": "Function 'get_vendedor' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "min... | 7 |
python | # Copyright 2020 Pulser Development 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 'Local' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 59
}
] | 1 |
python | from CreateTimeGraphs import *
def create_diag(dc):
"""Time spent on TeamSpeak per user"""
globalTime = timedelta()
for u in dc.users:
# Time in seconds
u.time = timedelta()
for con in u.connections:
# Increase connected time
u.time += con.duration()
us = sorted(dc.users, key = lambda u: -u.time)
for ... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_diag' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 3
}
] | 1 |
python | import os
"""This submodule aims to provide utilities for the gaussian software package.
It will allow the user to quickly write custom interfaces to analyse the output files.
"""
class Extractor:
"""This class supports data extraction from gaussian output files.
It provides functionality to extract all the ... | Review this code and list any quality issues. | [
{
"issue": "Function 'check_normal_execution' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 24
},
{
"issue": "Function 'check_frequencies' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller funct... | 6 |
python | #
# Copyright (c), 2016-2020, SISSA (International School for Advanced Studies).
# All rights reserved.
# This file is distributed under the terms of the MIT License.
# See the file 'LICENSE' in the root directory of the present
# distribution, or http://opensource.org/licenses/MIT.
#
# @author Davide Brunato <brunato@... | Review this code and list any quality issues. | [
{
"issue": "Function 'is_dummy_component' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 56
}
] | 1 |
python | import json
import logging
import os
import sys
import lambda_utils as utils
"""
Configure these environment variables in your Lambda environment or
CloudFormation Inputs settings):
1. TARGET_FQDN (mandatory): The Fully Qualified DNS Name used for application
cluster
2. ELB_TG_ARN (mandatory): The ARN of the Elastic... | Review this code and list any quality issues. | [
{
"issue": "Function 'lambda_handler' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 38
}
] | 1 |
python | # https://towardsdatascience.com/elucidating-policy-iteration-in-reinforcement-learning-jacks-car-rental-problem-d41b34c8aec7
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import poisson
import sys
class Poisson:
def __init__(self, exp_num):
self.exp_num = exp_... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 11
},
{
"issue": "Function '__init__' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 4 |
python | #!/usr/bin/env python
from ansible.module_utils.basic import *
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: cisco_ucs_ldap_provider_group
short_description: configures ldap provider group on... | Review this code and list any quality issues. | [
{
"issue": "Function 'setup_ldap_provider_group' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 101
}
] | 1 |
python | import MySQLdb as sql
from config import sqlconfig
class users:
def __init__():
self.connection = sql.connect(
host=sqlconfig.host, user=sqlconfig.user, passwd=sqlconfig.passwd
)
self.cursor = self.connection.cursor()
def __del__():
self.cursor.close()
sel... | Review this code and list any quality issues. | [
{
"issue": "Function 'new_user' is 45 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 17
}
] | 1 |
python | import glob
import json
from docutils import nodes
from sphinx.util.docutils import SphinxDirective
from sphinx.util import logging
def add_prop_attr_row(prop, attr, tbody, key = None):
desc_row = nodes.row()
tbody += desc_row
desc_row += nodes.entry()
desc_key_entry = nodes.entry()
desc_row += d... | Review this code and list any quality issues. | [
{
"issue": "Function 'add_table_row' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 20
},
{
"issue": "Function 'run' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | """ TSP SIMULATED ANNEALING """
# Imports
import math
import numpy as np
# read data from file
f = open("TSP-configurations/eil51.tsp.txt", "r")
# f = open("TSP-configurations/a280.tsp.txt", "r")
# f = open("TSP-configurations/pcb442.tsp.txt", "r")
network = f.readlines()[6:-1]
# create dictionary to store coordina... | Review this code and list any quality issues. | [
{
"issue": "Function 'SA' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 58
},
{
"issue": "Function 'SA' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 58
... | 3 |
python | from itertools import combinations
__author__ = "\n".join(['Ben Edwards (bedwards@cs.unm.edu)',
'Huston Hedinger (h@graphalchemist.com)',
'Dan Schult (dschult@colgate.edu)'])
__all__ = ['dispersion']
def dispersion(G, u=None, v=None, normalized=True, alpha=1.0, b=0.0,... | Review this code and list any quality issues. | [
{
"issue": "Function 'dispersion._dispersion' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 51
},
{
"issue": "Function 'dispersion' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",... | 3 |
python | #!/usr/bin/env python3
# 2017, Georg Sauthoff <mail@gms.tf>, GPLv3
import sys
def skip_comments(lines):
state = 0
for line in lines:
n = len(line)
l = ''
p = 0
while p < n:
if state == 0:
a = line.find('//', p)
b = line.find('/*', p)
if a > -1 and (a ... | Review this code and list any quality issues. | [
{
"issue": "Function 'skip_comments' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 7
},
{
"issue": "Function 'skip_comments' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "ma... | 5 |
python | import argparse
import sys
import os
import subprocess
from pathlib import Path
import threading
def main():
# Cd to scripts/build.py directory
os.chdir(os.path.dirname(__file__))
# Initialize parser
parser = argparse.ArgumentParser()
# Adding optional arguments
parser.add_argument("-r", ... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 8
},
{
"issue": "Function 'main' is 52 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": ... | 2 |
python | import ipaddress
import socket
import os
def execute_sysctl_command(params):
print("-> sysctl "+params)
os.system('sysctl ' + params)
def ip_string_to_unsigned_int(ip):
ip_ = 0
bytes_ = ip.split(".")
if len(bytes_) == 4:
ip_ = socket.htonl((int(bytes_[0]) << 24) + (int(bytes_[1]) << 16) +... | Review this code and list any quality issues. | [
{
"issue": "Function 'generate_sysctl_params_string_apiv03' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 17
}
] | 1 |
python | import logging
import os
import sys
import json
import time
import re
UNCENSORED_LOGGING = os.getenv("UNCENSORED_LOGGING")
LOG_CENSOR = [
{ "regex": r"(eyJ0e[A-Za-z0-9-_]{10})[A-Za-z0-9-_]*\.[A-Za-z0-9-_]*\.[A-Za-z0-9-_]*([A-Za-z0-9-_]{10})",
"replace": "\\g<1>XXX<JWTTOKEN>XXX\\g<2>",
"des... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_log' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 96
}
] | 1 |
python | import tensorflow as tf
from tensorflow.keras import backend as K
from tensorflow.keras.layers import Layer
from tensorflow.keras.initializers import RandomUniform, Initializer, Constant
import numpy as np
class InitCentersRandom(Initializer):
""" Initializer for initialization of centers of RBF network
as... | 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": 48
}
] | 1 |
python | import argparse
import glob
import os
import os.path as osp
import sys
import warnings
from multiprocessing import Pool
import mmcv
import numpy as np
# custom import
import pandas as pd
import pdb
def extract_frame(vid_item):
"""Generate optical flow using dense flow.
Args:
vid_item (list): Video ... | Review this code and list any quality issues. | [
{
"issue": "Function 'extract_frame' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 16
},
{
"issue": "Function 'extract_frame' is 83 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "m... | 3 |
python | """MeiliSearchHelper
Wrapper on top of the MeiliSearch API client"""
import meilisearch
from builtins import range
def remove_bad_encoding(value):
return value.replace(''', "'")
def clean_one_field(value):
if isinstance(value, bool):
return str(value)
elif isinstance(value, str):
ret... | 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": 101
}
] | 1 |
python |
from Comparison import Comparison
from Action import Action
from TransitionCodegen import TransitionCodegen
from TransitionGraphic import TransitionGraphic
import xml.etree.ElementTree as ET
class Transition:
def __init__(self, id):
self.id = id
self.fromStateID = None
s... | Review this code and list any quality issues. | [
{
"issue": "Function 'parseCfg' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 24
}
] | 1 |
python | from PIL import Image, ImageDraw, ImageFont
import numpy as np
from decimal import Decimal, ROUND_HALF_UP
from math import radians, tan, cos, sin
from os import path
_round = lambda f, r=ROUND_HALF_UP: int(Decimal(str(f)).quantize(Decimal("0"), rounding=r))
rgb = lambda r, g, b: (r, g, b)
upper_font_path = path.join(... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_gradient_2d' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 14
},
{
"issue": "Function 'getTextWidth' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 21
},... | 8 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Idiota object types
tree - A tree (directory listing) object that represents the directory structure in a tree object.
commit(ref) - A object that represents the changes in a single commit.
blob - A blob object that represents a file or a piece of... | Review this code and list any quality issues. | [
{
"issue": "Function 'iter_refs' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 136
}
] | 1 |
python | #===----------------------------------------------------------------------===##
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===----------------------------------... | Review this code and list any quality issues. | [
{
"issue": "Function 'getTestsInDirectory' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 127
},
{
"issue": "Function 'getTestsInDirectory' has 5 parameters. Consider using a parameter object to reduce arity.",
"severit... | 7 |
python | # SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of sourc... | 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": 48
}
] | 1 |
python | class RNNConfig(object):
"""
Holds logistic regression model hyperparams.
:param height: image height
:type heights: int
:param width: image width
:type width: int
:param channels: image channels
:type channels: int
:param batch_size: batch size for training
:type batch_size: in... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 13 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 24
}
] | 1 |
python | import hashlib
import json
import sys
from logbook import Logger, StreamHandler
from pycoin.coins.bitcoin.networks import BitcoinMainnet
import pycoin.ui.key_from_text
import pycoin.key
import socket
script_for_address = BitcoinMainnet.ui.script_for_address
log = Logger(__name__)
class Connection:
def __init_... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 34
}
] | 1 |
python | # Copyright 2020 Microsoft 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... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 26
},
{
"issue": "Function 'check_for_match' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"sev... | 7 |
python | from confd_gnmi_adapter import GnmiServerAdapter
class GnmiNetconfServerAdapter(GnmiServerAdapter):
@classmethod
def get_adapter(cls):
pass
def set(self, prefix, path, val):
pass
def get_subscription_handler(self, subscription_list):
pass
def capabilities(self):
... | Review this code and list any quality issues. | [
{
"issue": "Function 'get' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 19
}
] | 1 |
python | from o3seespy.base_model import OpenSeesObject
class LayerBase(OpenSeesObject):
op_base_type = "layer"
class Straight(LayerBase):
"""
The Straight Layer Class
The layer command is used to generate a number of fibers along a line or a circular arc.
"""
op_type = 'straight'
def __ini... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 16
},
{
"issue": "Function '__init__' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 50
}
] | 2 |
python | # BirdWeather edits by @timsterc
# Other edits by @CaiusX and @mcguirepr89
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
os.environ['CUDA_VISIBLE_DEVICES'] = ''
try:
import tflite_runtime.interpreter as tflite
except:
from tensorflow import lite as tflite
import argparse
import operator
import librosa
im... | Review this code and list any quality issues. | [
{
"issue": "Function 'splitSignal' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 71
},
{
"issue": "Function 'convertMetadata' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
... | 7 |
python | #!/usr/bin/env python
# encoding: utf-8
"""
Test problem demonstrating 3D hot-sphere rising in an stabilized atmosphere
in Cartesian coordinates
This problem evolves the 3D Euler equations using an F-wave
method, with gravitational source term modifications.
The primary variables are:
density (rho), x,y, a... | Review this code and list any quality issues. | [
{
"issue": "Function 'customBCLowerZ' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 127
},
{
"issue": "Function 'customBCUpperZ' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 135
... | 7 |
python | from conans import ConanFile, tools, AutoToolsBuildEnvironment
from conans.errors import ConanInvalidConfiguration
from contextlib import contextmanager
import os
import shutil
class SwigConan(ConanFile):
name = "swig_installer"
version = "4.0.1"
description = "SWIG is a software development tool that con... | Review this code and list any quality issues. | [
{
"issue": "Function 'build' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 78
}
] | 1 |
python | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Review this code and list any quality issues. | [
{
"issue": "Function '_schedule_reduce' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 25
},
{
"issue": "Function '_schedule_reduce' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity... | 3 |
python | import boto3
import json
import logging
from crhelper import CfnResource
logger = logging.getLogger(__name__)
helper = CfnResource(
json_logging=False, log_level='DEBUG', boto_level='CRITICAL')
try:
sc = boto3.client("servicecatalog")
except Exception as e:
helper.init_failure(e)
def get_parameters(even... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_provider' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 24
}
] | 1 |
python | ##############################################
# #
# Ferdinand 0.40, Ian Thompson, LLNL #
# #
# gnd,endf,fresco,azure,hyrma #
# #
#####################################... | Review this code and list any quality issues. | [
{
"issue": "Function 'reconstructPointwise' has cyclomatic complexity 63 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 20
},
{
"issue": "Function 'reconstructPointwise' is 186 lines long. Functions over 25 lines are harder to test and maintain.",
... | 3 |
python | """ Generic script for monitoring counts from a counter """
import numpy as np
import time
import pyqtgraph as pg
from pylabnet.gui.pyqt.external_gui import Window
from pylabnet.utils.logging.logger import LogClient
from pylabnet.scripts.pause_script import PauseService
from pylabnet.network.core.generic_server import... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 34
},
{
"issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 34
},
{
... | 6 |
python | ## Message passing over a discrete BN ##
## Library created by Pablo Martínez Olmos, University Carlos III Madrid ##
## olmos@tsc.uc3m.es ##
## Last modification 15/11/2016 ##
import numpy as np
## Messages are stored in the logaritmic domain ##
## Global constants (to control numerical issues)
inf_log=100 #To impo... | Review this code and list any quality issues. | [
{
"issue": "Function 'update_var_to_factor' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 152
},
{
"issue": "Function 'update_factor_to_var' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller fun... | 2 |
python | from six import text_type
from rest_framework import HTTP_HEADER_ENCODING, exceptions
from django.core.exceptions import PermissionDenied
from django.utils.translation import ugettext_lazy as _
from atlassian_connect_django.models.connect import AtlassianUser
from atlassian_connect_django import helpers
from .models i... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_atlassian_security_context_and_user_from_request' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 17
},
{
"issue": "Function 'get_atlassian_security_context_and_user_from_request' is 28 lines long.... | 2 |
python | #!/usr/bin/env python
import uuid
from construct import Container
class SMAPI_Request(object):
'''
Implentation of a ICUV Request
'''
def __init__(self, function_name, target_identifier,
authenticated_userid=b"", password=b"", additional_parameters=b""):
self._function_n... | 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": 12
}
] | 1 |
python | # Copyright (c) 2016-2017, Neil Booth
#
# All rights reserved.
#
# See the file "LICENCE" for information about the copyright
# and warranty status of this software.
'''Class for handling asynchronous connections to a blockchain
daemon.'''
import asyncio
import itertools
import json
import time
import aiohttp
from a... | 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": 41
},
{
"issue": "Function '_send' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": ... | 4 |
python | #===============================================================================
# Copyright 2020-2021 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.apa... | Review this code and list any quality issues. | [
{
"issue": "Function 'daal4py_classifier_predict' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 47
},
{
"issue": "Function 'daal4py_classifier_predict' is 41 lines long. Functions over 25 lines are harder to test and maint... | 6 |
python |
from genologics.lims import Lims
from genologics.config import BASEURI, USERNAME, PASSWORD
from multiqc.utils import report, config
from multiqc.modules.base_module import BaseMultiqcModule
from multiqc.plots import table
from collections import OrderedDict
import logging
import re
class MultiQC_clarity_metadata(Ba... | 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": 14
},
{
"issue": "Function 'get_samples' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
... | 10 |
python | # Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | Review this code and list any quality issues. | [
{
"issue": "Function 'cmp_versions' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 19
}
] | 1 |
python | import json
import sys
from os import path
header_comment = '# %%\n'
def nb2py(notebook):
result = []
cells = notebook['cells']
for cell in cells:
cell_type = cell['cell_type']
if cell_type == 'markdown':
result.append('%s"""\n%s\n"""'%
(header_comm... | Review this code and list any quality issues. | [
{
"issue": "Function 'py2nb' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 25
},
{
"issue": "Function 'py2nb' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line"... | 2 |
python | import io
import json
import gzip
from base64 import b64decode
from http.cookies import SimpleCookie
import chardet
import rfc3986
import graphene
import yaml
from requests.structures import CaseInsensitiveDict
from requests.cookies import RequestsCookieJar
from starlette.datastructures import MutableHeaders
from sta... | Review this code and list any quality issues. | [
{
"issue": "Function 'media' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 219
}
] | 1 |
python | # Copyright 2018
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | Review this code and list any quality issues. | [
{
"issue": "Function 'model' is 75 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 36
},
{
"issue": "Function 'model' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 36
}
] | 2 |
python | """
Author: Andrew Harris
Python 3.8
"""
import logging
import os
import pandas as pd
from ete3 import Tree
from tqdm import tqdm
############################### Set up logger #################################
def set_logger_level(WORKING_DIR, LOG_LEVEL):
logger = logging.getLogger(__name__)
# Remove existing ... | Review this code and list any quality issues. | [
{
"issue": "Function 'remove_heterotachy_info' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 27
},
{
"issue": "Function 'topobinner' has cyclomatic complexity 18 (threshold: 5). Consider breaking it into smaller functions.... | 4 |
python | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
####################################################################################
### Copyright (C) 2015-2019 by ABLIFE
####################################################################################
#########################################################... | Review this code and list any quality issues. | [
{
"issue": "Function 'configOpt' is 53 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 62
},
{
"issue": "Function 'main' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"li... | 3 |
python | """
The Sims 4 Community Library is licensed under the Creative Commons Attribution 4.0 International public license (CC BY 4.0).
https://creativecommons.org/licenses/by/4.0/
https://creativecommons.org/licenses/by/4.0/legalcode
Copyright (c) COLONOLNUTTY
"""
from typing import Any, Union
from interactions.base.inter... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_name' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 38
},
{
"issue": "Function 'get_name' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 4 |
python | #!/usr/bin/env python
""" Maps point charges obtained by GPAW and HORTON on the original'
' GROMACS topology initially modified by insertHbyList.py """
## jlh 2018/04/02
import ast
import h5py
import ase.io
from ase.io.cube import read_cube_data
import parmed as pmd
from parmed import gromacs
from insertHby... | Review this code and list any quality issues. | [
{
"issue": "Function 'aa2ua_cube' has 10 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 48
}
] | 1 |
python | import plotly.graph_objects as go
from mainapp.app_settings import cell_length_meter
def getLineChart(
data,
timestamp,
coordinates,
colorScale,
timeline,
color_range,
dragmode=False,
quick_select_range=True,
calibration_time=None,
show_... | Review this code and list any quality issues. | [
{
"issue": "Function 'getLineChart' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 6
},
{
"issue": "Function 'getLineChart' is 122 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "c... | 3 |
python | from __future__ import absolute_import
from sentry.testutils import TestCase
from sentry.api.fields.actor import Actor
from sentry.models import ProjectOwnership, User, Team
from sentry.models.projectownership import resolve_actors
from sentry.ownership.grammar import Rule, Owner, Matcher, dump_schema
class ProjectO... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_get_owners_basic' is 63 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 20
}
] | 1 |
python | import os
import helpers
import numpy
import pytest
import toughio
write_read = lambda output, writer_kws, reader_kws: helpers.write_read(
"output",
output,
toughio.write_output,
toughio.read_output,
writer_kws=writer_kws,
reader_kws=reader_kws,
)
@pytest.mark.parametrize(
"filename, da... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_output_eleme' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 71
}
] | 1 |
python | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 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": 48
}
] | 1 |
python | #!/usr/bin/env python
# Copyright 2016 Tesora, 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 ... | Review this code and list any quality issues. | [
{
"issue": "Function 'ignore' has cyclomatic complexity 21 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 103
},
{
"issue": "Function 'ignore' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 6 |
python | import logging
import re
import pytest
import yaml
from tests.common.helpers.assertions import pytest_assert
from tests.common.helpers.platform_api import chassis
from platform_api_test_base import PlatformApiTestBase
logger = logging.getLogger(__name__)
pytestmark = [
pytest.mark.disable_loganalyzer, # disab... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_get_system_eeprom_info' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 111
}
] | 1 |
python | import logging
from typing import Optional, Any
from opentrons import types
from opentrons.calibration_storage import get
from opentrons.calibration_storage.types import TipLengthCalNotFound
from opentrons.hardware_control.dev_types import PipetteDict
from opentrons.protocol_api.labware import Labware, Well
from opent... | Review this code and list any quality issues. | [
{
"issue": "Function 'validate_blowout_location' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 14
}
] | 1 |
python | """
========================================================
06. Remove epochs based on peak-to-peak (PTP) amplitudes
========================================================
Epochs containing peak-to-peak above the thresholds defined
in the 'reject' parameter are removed from the data.
This step will drop epochs con... | Review this code and list any quality issues. | [
{
"issue": "Function 'drop_ptp' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 30
},
{
"issue": "Function 'drop_ptp' is 50 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | #!/usr/bin/env python3
import tkinter as tk
import binascii, pyaes, sys, base64, os.path, os
from tkinter import *
from pathlib import Path
from tkinter.font import Font
from tkinter.filedialog import askopenfilename
import secrets
import string
def main():
global entry3
input2 = entry3.get()
# Open file
... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 11
}
] | 1 |
python | from __future__ import division
import discord, math, operator
from discord.ext import commands
from pyparsing import (Literal,CaselessLiteral,Word,Combine,Group,Optional,
ZeroOrMore,Forward,nums,alphas,oneOf)
__author__='Paul McGuire'
__version__ = '$Revision: 0.0 $'
__date__ = '$Date: 2009-03-20... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 32
},
{
"issue": "Function 'evaluateStack' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",... | 4 |
python | """Utility for currying functions."""
from functools import wraps
from inspect import signature, isbuiltin, isclass
def curry(func, args=None, kwargs=None, n=None, use_defaults=False):
if use_defaults:
return CurriedDefault(func, args, kwargs, n)
return Curried(func, args, kwargs, n)
class Curried... | Review this code and list any quality issues. | [
{
"issue": "Function 'curry' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 7
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 15
}
] | 2 |
python | #!/usr/bin/env python
##
# Python script to tidy mediasession.bs
#
# adapted from: https://github.com/w3c/webvtt/blob/41cac9c211f9c581de466bb9b8b5dd11a160ffad/format.py
##
import re
import sys
# http://stackoverflow.com/q/1732348
pattern = re.compile(r'<(\w+).*?>|</(\w+)>|<!--(.*?)-->', re.DOTALL)
INDENT = ' '
COL... | Review this code and list any quality issues. | [
{
"issue": "Function 'tokenize' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 21
},
{
"issue": "Function 'validate' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity":... | 4 |
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.base.exchange import Exchange
import math
class lykke (Exchange):
def describe(self):
return self.deep_extend(supe... | Review this code and list any quality issues. | [
{
"issue": "Function 'describe' is 85 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 12
},
{
"issue": "Function 'create_order' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 118
},... | 12 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.