language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | import io
import pandas as pd
import json
from flask import (flash,
request,
redirect,
url_for,
jsonify,
render_template,
Blueprint,
abort)
from logzero import logger
from datetime impor... | Review this code and list any quality issues. | [
{
"issue": "Function 'submit_h2' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 83
},
{
"issue": "Function 'submit_h2' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 3 |
python | # -*- coding: utf-8 -*-
from numpy import log as nplog
from pandas_ta.utils import get_offset, verify_series
def log_return(close, length=None, cumulative=False, offset=None, **kwargs):
"""Indicator: Log Return"""
# Validate Arguments
close = verify_series(close)
length = int(length) if length and len... | Review this code and list any quality issues. | [
{
"issue": "Function 'log_return' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 6
},
{
"issue": "Function 'log_return' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"li... | 2 |
python | #!/usr/bin/env python3
"""Tool to download files from BaseSpace."""
import sys
import traceback
import atexit
import argparse
import requests
class BaseSpaceDownloadError(Exception):
"""BaseSpace download error."""
pass
def main():
"""Entry point."""
session = requests.Session()
atexit.registe... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 17
}
] | 1 |
python | from django.shortcuts import (
render,
redirect,
reverse,
get_object_or_404,
get_list_or_404,
)
from django.db.models import Q
from django.urls import reverse_lazy
from django.contrib.auth import authenti... | Review this code and list any quality issues. | [
{
"issue": "Function 'password_reset' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 307
},
{
"issue": "Function 'password_reset' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": ... | 2 |
python | #
# Copyright 2021 XEBIALABS
#
# 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, modify, merge, publish, distribute, subli... | 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 'lookup_item_by_formatted_id' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line":... | 6 |
python | """Generic script exporter class for any kernel language"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import entrypoints
from .templateexporter import TemplateExporter
from traitlets import Dict, default
from .base import get_exporter
class ScriptExporter(... | Review this code and list any quality issues. | [
{
"issue": "Function 'from_notebook_node' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 38
}
] | 1 |
python | import scrapy
import pickle
import os
import ast
from urllib import parse
from scrapy.selector import Selector
class XinjiangSpider(scrapy.Spider):
name = "Xinjiang"
if not os.path.exists('../../data/HTML_pk/%s' % name):
os.makedirs('../../data/HTML_pk/%s' % name)
if not os.path.exists('../../data/... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse_content' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 40
},
{
"issue": "Function 'parse_content' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "mi... | 2 |
python | import time,random
from collections import OrderedDict
from simulator import Simulator
class TrafficLight(object):
"""A traffic light that switches periodically."""
valid_states = [True, False] # True = NS open, False = EW open
def __init__(self, state=None, period=None):
self.state = state if ... | 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": 33
},
{
"issue": "Function 'reset' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "m... | 7 |
python | ###########################################################################################
# Created by Jason Downing #
# Some code originally found at this Stackoverflow Post: #
# https://stackoverflow.com/questions/1896... | Review this code and list any quality issues. | [
{
"issue": "Function 'cannon' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 63
},
{
"issue": "Function 'cannon' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"lin... | 6 |
python | import pytest
import json
import time
from ldclient.client import LDClient, Config
from ldclient.feature_store import InMemoryFeatureStore
from ldclient.flag import EvaluationDetail
from ldclient.interfaces import FeatureStore
from ldclient.versioned_data_kind import FEATURES
from testing.stub_util import MockEventProc... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_all_flags_state_returns_state_with_reasons' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 218
},
{
"issue": "Function 'test_all_flags_state_can_be_filtered_for_client_side_flags' is 36 lines long. Functions ov... | 3 |
python | #!/usr/bin/env python
import argparse
import csv
import gzip
import os
from functools import partial
import numpy
import pandas
from Bio import SeqIO
def nice_size(size):
# Returns a readably formatted string with the size
words = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB']
prefix = ''
try:
... | Review this code and list any quality issues. | [
{
"issue": "Function 'nice_size' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 14
},
{
"issue": "Function 'output_statistics' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"... | 4 |
python | FILENAME = 'sequences_full.csv'
VOCAB_SIZE = None
UNK = 'UNK'
POS_TAGS = { 'CC' : '<CC>', 'CD' : '<CD>', 'DT' : '<DT>', 'EX' : '<EX>', 'FW' : '<FW>', 'IN' : '<IN>', 'JJ' : '<JJ>', 'JJR' : '<JJR>', 'JJS' : '<JJS>', 'LS' : '<LS>', 'MD' : '<MD>', 'NN' : '<NN>', 'NNS' : '<NNS>', 'NNP' : '<NNP>', 'NNPS' : '<NNPS>', 'PDT' :... | Review this code and list any quality issues. | [
{
"issue": "Function 'process_data' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 117
}
] | 1 |
python | import numpy as np
"""
This file implements various first-order update rules that are commonly used
for training neural networks. Each update rule accepts current weights and the
gradient of the loss with respect to those weights and produces the next set of
weights. Each update rule has the same interface:
def updat... | Review this code and list any quality issues. | [
{
"issue": "Function 'adam' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 125
}
] | 1 |
python | import numpy as np
import re, os
from pmesh.pm import ParticleMesh
from nbodykit.lab import BigFileCatalog, BigFileMesh, MultipleSpeciesCatalog, FFTPower
from nbodykit import setup_logging
from mpi4py import MPI
import HImodels
# enable logging, we have some clue what's going on.
setup_logging('info')
#... | Review this code and list any quality issues. | [
{
"issue": "Function 'distribution' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 64
},
{
"issue": "Function 'distribution' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
... | 2 |
python | # Copyright (c) 2020 Antti Kivi
# Licensed under the MIT License
"""A module that contains the class that represents the project
that the build script acts on.
"""
import importlib
import json
import logging
import os
from typing import Any, List
from .support.system import System
from .support import environment
... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 62
},
{
"issue": "Function '__init__' is 72 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 7 |
python | # Copyright (c) 2012-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Bitcoin base58 encoding and decoding.
Based on https://bitcointalk.org/index.php?topic=1026.0 (public domain)
'''
import has... | Review this code and list any quality issues. | [
{
"issue": "Function 'b58decode' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 57
}
] | 1 |
python | from absl import logging
import numpy as np
import tensorflow as tf
import cv2
YOLOV3_LAYER_LIST = [
'yolo_darknet',
'yolo_conv_0',
'yolo_output_0',
'yolo_conv_1',
'yolo_output_1',
'yolo_conv_2',
'yolo_output_2',
]
YOLOV3_TINY_LAYER_LIST = [
'yolo_darknet',
'yolo_conv_0',
'yolo... | Review this code and list any quality issues. | [
{
"issue": "Function 'load_darknet_weights' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 25
},
{
"issue": "Function 'load_darknet_weights' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
... | 2 |
python | # Copyright 2021 Raven Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 35
},
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 72
},
{
"i... | 4 |
python | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache 2.0 License.
import socket
import ssl
import msgpack
import struct
import select
import contextlib
import json
import logging
import time
import os
from enum import IntEnum
from cryptography import x509
from cryptography.hazmat.back... | 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": 55
},
{
"issue": "Function '__init__' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 77
},
{
... | 7 |
python | import time
import types
import pytest
import teek
from teek.extras import tooltips
def run_event_loop(for_how_long):
# this is dumb
start = time.time()
while time.time() < start + for_how_long:
teek.update()
@pytest.mark.slow
def test_set_tooltip():
window = teek.Window()
assert not ha... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_set_tooltip' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 17
}
] | 1 |
python | import os
import sys
import re
import shutil
import argparse
import string
from build.sdk_build_utils import *
IOS_ARCHS = ['i386', 'x86_64', 'armv7', 'arm64']
def updateUmbrellaHeader(filename, args):
with open(filename, 'r') as f:
lines = f.readlines()
for i in range(0, len(lines)):
match = re.searc... | Review this code and list any quality issues. | [
{
"issue": "Function 'updateUmbrellaHeader' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 11
},
{
"issue": "Function 'buildIOSLib' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",... | 6 |
python | import numpy
import math
from rpncalc.classes import ActionEnum
class BinaryOperator(ActionEnum):
addition = '+'
subtraction = '-'
multiplication = '*'
division = '/'
integer_division = '//'
power = '^'
atan2 = 'atan2', \
"Returns quadrant correct polar coordinate theta = atan2(y,... | Review this code and list any quality issues. | [
{
"issue": "Function 'action' has cyclomatic complexity 17 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 27
},
{
"issue": "Function 'action' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 2 |
python | import rospy
from pid import PID
from yaw_controller import YawController
from lowpass import LowPassFilter
GAS_DENSITY = 2.858
ONE_MPH = 0.44704
class Controller(object):
def __init__(self, vehicle_mass, fuel_capacity, brake_deadband, decel_limit, accel_limit, wheel_radius, wheel_base, steer_ratio, max_lat_acce... | 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": 11
},
{
"issue": "Function 'control' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"li... | 3 |
python | # -*- coding:utf-8 -*-
"""
钉钉机器人接口
Author: HuangTao
Date: 2018/08/04
Update: 2018/12/24 1. 增加markdown格式消息推送;
"""
from quant.utils import logger
from quant.utils.http_client import AsyncHttpRequests
class DingTalk:
""" 钉钉机器人接口
"""
BASE_URL = 'https://oapi.dingtalk.com/robot/send?access_token='
@... | Review this code and list any quality issues. | [
{
"issue": "Function 'send_text_msg' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 21
},
{
"issue": "Function 'send_markdown_msg' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 45
... | 2 |
python | # coding: utf-8
"""
3Di API
3Di simulation API (latest stable version: v3) Framework release: 2.9.0 3Di core release: 2.2.2 deployed on: 11:01AM (UTC) on January 11, 2022 # noqa: E501
The version of the OpenAPI document: v3
Contact: info@nelen-schuurmans.nl
Generated by: https://openapi-ge... | 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": 52
},
{
"issue": "Function 'to_dict' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line":... | 2 |
python | # coding=utf-8
# Copyright 2022 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 'main' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 62
}
] | 1 |
python | """ Script for running depth inference assuming MOTS dataset structure """
import logging
import os
import sys
from pathlib import Path, PurePath
import click
import matplotlib.pyplot as plt
import numpy as np
import tensorflow.compat.v1 as tf
from IPython.core import ultratb
from PIL import Image
import diw
from diw... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 65
},
{
"issue": "Function 'main' is 43 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line":... | 2 |
python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This file is part of Androwarn.
#
# Copyright (C) 2012, 2019, Thomas Debize <tdebize at mail.com>
# All rights reserved.
#
# Androwarn is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
#... | Review this code and list any quality issues. | [
{
"issue": "Function 'detect_Telephony_Manager_Leakages' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 47
}
] | 1 |
python | from decimal import Decimal as D
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.utils.translation import ugettext_lazy as _
from izi.core import loading
Scale = loading.get_class('shipping.scales', 'Scale')
weight_precision = getattr(
settings, 'IZI_SHIPPING_W... | 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": 46
}
] | 1 |
python | """
Copyright:
Copyright 2019 by Katsuya SHIMABUKURO.
License:
MIT, see LICENSE for details.
"""
import pathlib
import gzip
import requests
import tqdm
import numpy as np
from gensim.models import KeyedVectors
FILE_ID = '0B7XkCwpI5KDYNlNUTTlSS21pQmM'
SOURCE_URL = 'https://drive.google.com/uc?export=download&i... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 23
}
] | 1 |
python | import numpy
import pandas
import xarray as xr
import numpy as np
from dolo.compiler.model import Model
from dolo.numeric.optimize.ncpsolve import ncpsolve
from dolo.numeric.optimize.newton import newton as newton_solver
from dolo.numeric.optimize.newton import SerialDifferentiableFunction
## TODO: extend for mc proc... | Review this code and list any quality issues. | [
{
"issue": "Function 'response' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 14
},
{
"issue": "Function 'simulate' has cyclomatic complexity 21 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"l... | 10 |
python | # pylint doesn't understand the way that pytest constructs fixture dependnecies
# pylint: disable=redefined-outer-name
import datetime
import os
import shutil
import subprocess
import sys
import tempfile
import uuid
import airflow.plugins_manager
import docker
import pytest
from dagster import check
from dagster.core... | Review this code and list any quality issues. | [
{
"issue": "Function 'airflow_test' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 97
},
{
"issue": "Function 'airflow_test' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "mino... | 3 |
python | # U S Σ R Δ T O R / Ümüd
""" U S Σ R Δ T O R """
from userbot import LOGS
from telethon.tl.types import DocumentAttributeFilename
def __list_all_modules():
from os.path import dirname, basename, isfile
import glob
mod_paths = glob.glob(dirname(__file__) + "/*.py")
all_modules = [
basename(f)... | Review this code and list any quality issues. | [
{
"issue": "Function 'MEDIACHECK' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 24
}
] | 1 |
python | def remove_punctuation(st, case='l'):
""" takes in a string and returns a list of words with no punctuation"""
punctuation = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}“”‘’~'
all_words = st.split()
cap_words = []
for c in punctuation:
st = st.replace(c, '')
if case == 'u':
for word in all... | Review this code and list any quality issues. | [
{
"issue": "Function 'remove_punctuation' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 1
}
] | 1 |
python | # -*- coding:utf-8 -*-
"""
Author:
Weichen Shen,wcshen1994@163.com
Reference:
[1] Lian J, Zhou X, Zhang F, et al. xDeepFM: Combining Explicit and Implicit Feature Interactions for Recommender Systems[J]. arXiv preprint arXiv:1803.05170, 2018.(https://arxiv.org/pdf/1803.05170.pdf)
"""
import tensorflow as tf
fr... | Review this code and list any quality issues. | [
{
"issue": "Function 'xDeepFM' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 17
},
{
"issue": "Function 'xDeepFM' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"... | 2 |
python | import sys, os
import shutil
def SilentMkdir(theDir):
try:
os.mkdir(theDir)
except:
pass
return 0
def Run_00_CameraInit(baseDir,binDir,srcImageDir):
SilentMkdir(baseDir + "/00_CameraInit")
binName = binDir + "\\aliceVision_cameraInit.exe"
dstDir = baseDir + "/00_CameraInit/"
cmdLine = binName
cmdLine =... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 278
},
{
"issue": "Function 'main' is 59 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line"... | 2 |
python | """
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | Review this code and list any quality issues. | [
{
"issue": "Function '_conv2d_layer' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 79
},
{
"issue": "Function '_conv2d_layer' has 11 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"li... | 4 |
python | """The baseline Pommerman environment.
This evironment acts as game manager for Pommerman. Further environments,
such as in v1.py, will inherit from this.
"""
import json
import os
import numpy as np
import time
from gym import spaces
from gym.utils import seeding
import gym
from .. import characters
from .. import ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 28
},
{
"issue": "Function '__init__' has 12 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 28
... | 7 |
python | import syft as sy
import torch
from typing import Dict
from typing import Any
import logging
logger = logging.getLogger(__name__)
def extract_batches_per_worker(federated_train_loader: sy.FederatedDataLoader):
"""Extracts the batches from the federated_train_loader and stores them
in a dictionary (keys = ... | Review this code and list any quality issues. | [
{
"issue": "Function 'iris_data_partial' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 138
}
] | 1 |
python | # -*- coding: future_fstrings -*-
from django.db import models
from django.contrib.auth.models import User
import datetime
from pytz import timezone
def now():
# return Main.objects.all().first().now
return datetime.datetime.now()
def set_now(d):
m = Main.objects.all().first()
m.now = d
m.save()
class Team(mode... | Review this code and list any quality issues. | [
{
"issue": "Function 'setFav' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 46
}
] | 1 |
python | import numpy as np
from random import random
import matplotlib.pyplot as plt
import time
import logging
logging.basicConfig(level=logging.INFO,filename='simulation.log', filemode='w',format='%(asctime)s - %(message)s',datefmt='%d-%b-%y %H:%M:%S')
np.seterr(all='warn')
#################################################... | Review this code and list any quality issues. | [
{
"issue": "Function 'monteCarlo' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 57
},
{
"issue": "Function 'monteCarlo' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"l... | 2 |
python | # Copyright (c) 2021 PPViT Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | Review this code and list any quality issues. | [
{
"issue": "Function 'convert' has cyclomatic complexity 26 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 67
},
{
"issue": "Function 'convert' is 61 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",... | 3 |
python | from django.shortcuts import render, redirect
from .credentials import REDIRECT_URI, CLIENT_SECRET, CLIENT_ID
from rest_framework.views import APIView
from requests import Request, post
from rest_framework import status
from rest_framework.response import Response
from .util import *
from api.models import Room
from .m... | Review this code and list any quality issues. | [
{
"issue": "Function 'get' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 61
},
{
"issue": "Function 'get' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 61... | 2 |
python | #!/usr/bin/env python
"""
<Program Name>
test_keydb.py
<Author>
Vladimir Diaz <vladimir.v.diaz@gmail.com>
<Started>
October 2012.
<Copyright>
See LICENSE for licensing information.
<Purpose>
Unit test for 'keydb.py'.
"""
# Help with Python 3 compatibility, where the print statement is a function, an
# i... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_add_key' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 101
},
{
"issue": "Function 'test_create_keydb_from_root_metadata' is 47 lines long. Functions over 25 lines are harder to test and maintain.",
"sever... | 2 |
python | import torch
from torch.autograd import Variable
import onmt.translate.Beam
import onmt.io
class Translator(object):
"""
Uses a model to translate a batch of sentences.
Args:
model (:obj:`onmt.modules.NMTModel`):
NMT model to use for translation
fields (dict of Fields): data fie... | 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": 26
},
{
"issue": "Function '__init__' has 12 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 26
... | 4 |
python | '''
THE OXYTOCIN RECEPTOR METABOLIC PATHWAY
VERSION 1.0
G alpha q11 coupled receptor
last modification 4 October 2020
References:
1. Chang, Chiung-wen, Ethan Poteet, John A. Schetz, Zeynep H. Gümüş,
and Harel Weinst... | Review this code and list any quality issues. | [
{
"issue": "Function 'network' is 144 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 49
}
] | 1 |
python | # Copyright 2019 The Forte Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | Review this code and list any quality issues. | [
{
"issue": "Function '_process' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 67
},
{
"issue": "Function '_process' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 2 |
python | #Is it possible to use numpy.ufunc.reduce over an iterator of ndarrays?
#I have a generator function that yields ndarrays (all of the same shape and dtype) and I would like to find the maximum value at each index.
#Currently I have code that looks like this:
def main():
import numpy as np
import cv2
sh... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 74 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 8
}
] | 1 |
python | import json
import logging
import os
from unittest.mock import patch
from common import LicenseInfo, MockImageStore
import raw_pixel as rwp
_license_info = (
'cc0',
'1.0',
'https://creativecommons.org/publicdomain/zero/1.0/',
None
)
license_info = LicenseInfo(*_license_info)
rwp.image_store = MockIma... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_get_image_properties' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 79
}
] | 1 |
python | # Django-Expenses
# Copyright © 2018-2021, Chris Warrick.
# All rights reserved.
# See /LICENSE for licensing information.
"""Category management."""
from collections import defaultdict
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from ... | Review this code and list any quality issues. | [
{
"issue": "Function 'category_delete' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 116
},
{
"issue": "Function 'category_delete' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity"... | 4 |
python | #!/usr/bin/env 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")... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_configure_default' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 30
},
{
"issue": "Function 'test_pre_upgrade_restart_23' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"sever... | 2 |
python | #!/usr/bin/env python3
#
# Copyright (c) 2020, Somia Reality Oy
# All rights reserved.
# Installing dependencies:
#
# - Ubuntu/Debian: apt install python3-cryptography python3-jwcrypto
# - Using pip: pip3 install cryptography jwcrypto
from argparse import ArgumentParser
from base64 import b64decode, urlsafe_b64de... | Review this code and list any quality issues. | [
{
"issue": "Function 'assert_secure_metadata' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 30
}
] | 1 |
python | # Copyright 2013 NEC Corporation. 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 ... | Review this code and list any quality issues. | [
{
"issue": "Function 'resource_setup' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 27
}
] | 1 |
python | import numpy as np
import pandas as pd
from gym.utils import seeding
import gym
from gym import spaces
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
# shares normalization factor
# 100 shares per trade
HMAX_NORMALIZE = 100
# initial amount of money we have in our account
INITIAL_ACCOUNT_BALA... | Review this code and list any quality issues. | [
{
"issue": "Function 'step' is 54 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 105
}
] | 1 |
python | """ Tests some user inputs to the model to make sure the validation is performed correctly """
# pylint: disable=redefined-outer-name
from copy import deepcopy
import pytest
from asldro.data.filepaths import GROUND_TRUTH_DATA
from asldro.validators.parameters import ValidationError
from asldro.validators.user_parameter... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_user_input_valid' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 17
},
{
"issue": "Function 'test_mismatch_asl_context_array_sizes' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
... | 5 |
python | from functools import partial, wraps
from logging import getLogger
from time import sleep
from cornice.resource import resource
from couchdb import ResourceConflict
from dateorro import calc_datetime
from jsonpointer import resolve_pointer
from pyramid.compat import decode_path_info
from pyramid.exceptions import URLD... | Review this code and list any quality issues. | [
{
"issue": "Function 'object_from_data' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 139
},
{
"issue": "Function 'extract_doc' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor"... | 11 |
python | # coding: utf-8
"""
Sematext Cloud API
API Explorer provides access and documentation for Sematext REST API. The REST API requires the API Key to be sent as part of `Authorization` header. E.g.: `Authorization : apiKey e5f18450-205a-48eb-8589-7d49edaea813`. # noqa: E501
OpenAPI spec version: v3
... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_dict' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 92
}
] | 1 |
python | # database.py creates a .db file for performing umls searches.
import atexit
import os
import sqlite3
import sys
from read_config import enabled_modules
features_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if features_dir not in sys.path:
sys.path.append(features_dir)
# find where umls tabl... | Review this code and list any quality issues. | [
{
"issue": "Function 'umls_db_cleanup' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 31
},
{
"issue": "Function 'create_db' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"se... | 3 |
python | import cv2
import mediapipe
import numpy
import pydirectinput
class FingerDetector:
wScr, hScr = pydirectinput.size() #Get the current screen resolution
pX, pY = 0, 0
cX, cY = 0, 0
def __init__(self):
"""
Initialize all objects
"""
#Load the mediapipe libraries/solut... | Review this code and list any quality issues. | [
{
"issue": "Function 'fingerDetection' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 66
}
] | 1 |
python | #!/usr/bin/python
#
# Copyright (c) 2011, The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import optparse
# This script generates a JSON .nmf file, which provides the mapping to indicate
# which .nexe fil... | 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": 28
}
] | 1 |
python | # import PIL
import matplotlib.pyplot as plt
import numpy as np
import math
import cv2
import torch
from torch_geometric.data import Data
def load_ply(path):
"""
Loads a 3D mesh model from a PLY file.
:param path: Path to a PLY file.
:return: The loaded model given by a dictionary with items:
'pt... | Review this code and list any quality issues. | [
{
"issue": "Function 'load_ply' has cyclomatic complexity 36 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 10
},
{
"issue": "Function 'load_ply' is 118 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critica... | 4 |
python | from typing import List, Tuple
from chia.types.blockchain_format.coin import Coin
from chia.types.blockchain_format.program import Program
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.types.coin_spend import CoinSpend
from chia.types.condition_opcodes import ConditionOpcode
from chia.util.has... | Review this code and list any quality issues. | [
{
"issue": "Function 'generate_launch_conditions_and_coin_spend' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 33
}
] | 1 |
python | # -*- coding: utf-8 -*-
import unicodedata
import binascii
from django.core.exceptions import ValidationError
from django.utils.deconstruct import deconstructible
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
@deconstructible
class NoControlCharactersValidator(... | 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": 81
},
{
"issue": "Function '__call__' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line"... | 2 |
python | #!../../../env/bin/python
"""
Script to scan through archive of mbox files and produce a spam report.
"""
# Standalone broilerplate -------------------------------------------------------------
from django_setup import do_setup
do_setup()
# -------------------------------------------------------------------------------... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 33
}
] | 1 |
python | # coding: utf-8
"""
TGS API
A production scale tool for BYOND server management # noqa: E501
OpenAPI spec version: 9.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from swagger_client.models.administration_rights impor... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_dict' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 46
}
] | 1 |
python | """
Module for radiometric normalization
Credits:
Copyright (c) 2018-2019 Johannes Schmid (GeoVille)
Copyright (c) 2017-2019 Matej Aleksandrov, Matic Lubej, Devis Peresutti (Sinergise)
This source code is licensed under the MIT license found in the LICENSE
file in the root directory of this source tree.
"""
import n... | 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": 80
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 186
},
{
"... | 6 |
python | import tensorflow as tf
class BaseTrain:
"""Standard base_train-class for easy multiple-inheritance.
It is responsible for defining the functions to be implemented with any child.
Attributes:
sess: Tensorflow session to use.
model: Model to be trained.
data: Data_loader object... | 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": 16
}
] | 1 |
python | from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt
plt.style.use('seaborn-whitegrid')
def derivatives(t, y, vaccine_rate, birth_rate=0.01):
"""Defines the system of differential equations that
describe the epidemiology model.
Args:
t: a positive float
y: a tuple of three... | Review this code and list any quality issues. | [
{
"issue": "Function 'integrate_ode' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 40
}
] | 1 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.FileItem import FileItem
from alipay.aop.api.constant.ParamConstants import *
class AlipayOpenServicemarketOrderCreateRequest(object):
def __init__(self, biz_model=None):
self._biz_model = biz_model
sel... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_params' has cyclomatic complexity 28 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 195
},
{
"issue": "Function 'get_params' is 69 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "cri... | 2 |
python | # Copyright 2001 by Katharine Lindner. All rights reserved.
# Copyright 2006 by PeterC. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Hold GEO data in a straightforward fo... | Review this code and list any quality issues. | [
{
"issue": "Function '__str__' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 39
},
{
"issue": "Function '__str__' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"... | 2 |
python | import itertools
import types
import numpy as np
import torch
import click
import gym
import time
import yaml
from robos2r.model import build_model
from .agent import Agent
from .script_agent import ScriptAgent, make_noised
from .utils import Rate
from PIL import Image
from pathlib import Path
from einops import rear... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 32
},
{
"issue": "Function 'main' is 61 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line":... | 3 |
python |
import os
import boto3
import typeguard
from botocore.exceptions import ClientError
from os import listdir
from os.path import isfile, join
from benchmark_runner.common.clouds.shared.s3.s3_operations_exceptions import S3FileNotUploaded, S3FileNotDownloaded, S3FileNotDeleted, S3KeyNotCreated, S3FileNotExist, S3Failed... | 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": 17
},
{
"issue": "Function 'upload_file' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 39
},
{
... | 7 |
python | import torch
import torch.optim as optm
import torch.nn.functional as F
import numpy as np
from torch.autograd import Variable
from torch.utils.data import Dataset, DataLoader
from data.graph import Graph
from collections import namedtuple
SavedAction = namedtuple('SavedAction', ['log_prob', 'value_current'])
# Mont... | 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": 16
},
{
"issue": "Function 'train_and_validate' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",... | 4 |
python | """
This module contains methods for opening jquery-confirm boxes.
These helper methods SHOULD NOT be called directly from tests.
"""
from seleniumbase.fixtures import constants
from seleniumbase.fixtures import js_utils
form_code = """'<form align="center" action="" class="jqc_form">' +
'<div class="form-group">... | Review this code and list any quality issues. | [
{
"issue": "Function 'jquery_confirm_button_dialog' has cyclomatic complexity 22 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 19
},
{
"issue": "Function 'jquery_confirm_button_dialog' is 90 lines long. Functions over 25 lines are harder to test a... | 6 |
python | '''
Description:
Author: Jiaqi Gu (jqgu@utexas.edu)
Date: 2021-09-27 23:48:01
LastEditors: Jiaqi Gu (jqgu@utexas.edu)
LastEditTime: 2022-02-26 02:22:52
'''
import torch
from core.models.layers.super_mesh import super_layer_name_dict
def test():
device=torch.device("cuda:0")
p, q, k = 2, 2, 4
x = torch.eye(... | Review this code and list any quality issues. | [
{
"issue": "Function 'test' is 44 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 11
}
] | 1 |
python | import textwrap
from IPython.core.magic import Magics, magics_class, line_magic
from IPython.core import magic_arguments
import attr
from .formatting import format_var_dims
from .model import Model
from .utils import variables_dict
setup_template = """
import xsimlab as xs
ds_in = xs.create_setup(
model={model... | Review this code and list any quality issues. | [
{
"issue": "Function 'format_var_comment' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 26
},
{
"issue": "Function 'format_input_vars' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller function... | 3 |
python | # -*- coding: utf-8 -*-
__author__ = 'dorota'
from sys import maxsize
class Contact:
def __init__(self, first_name=None, middle_name=None, last_name=None, nickname=None, title=None, company=None,
address=None, home_number=None, mobile_number=None, work_number=None, fax=None, first_email=None,
... | 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": 8
},
{
"issue": "Function '__init__' has 23 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 8
}
... | 2 |
python | # expected: fail
import audioop
import sys
import unittest
import struct
from test.test_support import run_unittest
formats = {
1: 'b',
2: 'h',
4: 'i',
}
def pack(width, data):
return struct.pack('=%d%s' % (len(data), formats[width]), *data)
packs = {
1: lambda *data: pack(1, data),
2: lambd... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_bias' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 135
}
] | 1 |
python | '''
Dummy driver that produces no output but gives all expected callbacks. Useful
for testing and as a model for real drivers.
Copyright (c) 2009, 2013 Peter Parente
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright n... | Review this code and list any quality issues. | [
{
"issue": "Function 'setProperty' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 171
}
] | 1 |
python | # coding: utf-8
"""
Trend Micro Deep Security API
Copyright 2018 - 2020 Trend Micro Incorporated.<br/>Get protected, stay secured, and keep informed with Trend Micro Deep Security's new RESTful API. Access system data and manage security configurations to automate your security workflows and integrate Deep Se... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 57
},
{
"issue": "Function '__init__' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical"... | 4 |
python | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Backbone modules.
"""
import torch
import torch.nn.functional as F
import torchvision
from torch import nn
from torchvision.models._utils import IntermediateLayerGetter
from typing import Dict, List
from util.misc import NestedTensor, is_main_p... | Review this code and list any quality issues. | [
{
"issue": "Function '_load_from_state_dict' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 33
},
{
"issue": "Function '__init__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "mi... | 4 |
python | # -*- coding: utf-8 -*-
# Copyright 2015, 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 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": 81
},
{
"issue": "Function '_check_namespaces' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
... | 5 |
python | from numpy.core.numeric import full
from numpy.lib.function_base import append
import prody as pr
import os
import numpy
import matplotlib as mpl
import pylab
from itertools import combinations, combinations_with_replacement
from docopt import docopt
import itertools
import pickle
import sys
from scipy.linalg.basic imp... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_atg' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 23
},
{
"issue": "Function 'get_atg' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"l... | 9 |
python | import sys
sys.path.insert(1, "../../")
import h2o
def offset_1897(ip, port):
h2o.init(ip, port)
print 'Checking binomial models for GLM with and without offset'
print 'Import prostate dataset into H2O and R...'
prostate_hex = h2o.import_frame(h2o.locate("smalldata/prostate/prostate.csv"))
print ... | Review this code and list any quality issues. | [
{
"issue": "Function 'offset_1897' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 5
}
] | 1 |
python | """Tests for settings."""
import sublime
import imp
from os import path
from EasyClangComplete.tests.gui_test_wrapper import GuiTestWrapper
from EasyClangComplete.plugin.settings import settings_manager
from EasyClangComplete.plugin.settings import settings_storage
from EasyClangComplete.plugin.utils import flag
im... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_parse_cmake_flags' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 51
},
{
"issue": "Function 'test_populate_flags' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "m... | 2 |
python | # ==============================================================================
# Copyright 2018-2020 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://ww... | Review this code and list any quality issues. | [
{
"issue": "Function 'update_config' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 177
}
] | 1 |
python | import numpy as np
import pickle
import argparse
import re
"""
Convert pre-trained Glove embeddings into npy file
Run using:
python3 generate_embeddings.py -d data/glove.6B.300d.txt --npy_output data/embeddings.npy --dict_output data/vocab.pckl --dict_whitelist data/polaritydata.vocab
"""
def parse_args():
parser... | 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": 22
},
{
"issue": "Function 'main' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 2 |
python | #!/usr/bin/env python3
# license removed for brevity
#策略 機械手臂 四點來回跑
import rospy
import os
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv import *
from ROS_Socket.msg import *
import math
import enum
import Hiwin_RT605_ROS as ArmTask
pos_feedback_times = 0
mode_feedback_times = 0
msg_feedback ... | 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": 63
},
{
"issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 106
},
{
"... | 9 |
python | from .pa_rb_env import (
PAEnv,
Node
)
import numpy as np
from pathlib import Path
log2 = np.log2
cues = {
0: Node(0.1, 0, 'cue'),
1: Node(-0.1, 0, 'cue'),
}
devices = {
0: {
't_device': Node(0, 0.5, 't_device'),
'r_devices': {
0: Node(0, 0.6, 'r_device')
}
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_get_indices' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 146
},
{
"issue": "Function 'test_get_rewards' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 4 |
python | import sys
import time
from cleversheep3.TTY_Utils import RichTerm, registerForWinch
class Status:
"""A fairly general purpose status line for a simple terminal.
"""
def __init__(self, startActive=True):
self.setTerm(RichTerm.RichTerminal(sys.stdout))
self.spinner = None
self.pre... | Review this code and list any quality issues. | [
{
"issue": "Function 'buildLine' has cyclomatic complexity 17 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 80
},
{
"issue": "Function 'buildLine' is 45 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critic... | 3 |
python | # -*- coding: utf-8 -*-
import unittest
import sys, os
sys.path.append('../../')
from etk.core import Core
import json
import codecs
class TestExtractionsFilterResults(unittest.TestCase):
def test_filter_results(self):
doc = {
"url":"http:www.testurl.com",
"doc_id": "19B0EAB211CD... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_filter_results' is 64 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 13
}
] | 1 |
python | import math
class Solution:
def isRectangleCover(self, rectangles: 'List[List[int]]') -> 'bool':
area = 0
x1 = y1 = math.inf
x2 = y2 = -math.inf
table = set()
for rec in rectangles:
x1 = min(x1, rec[0])
y1 = min(y1, rec[1])
x2 = max(x2, rec... | Review this code and list any quality issues. | [
{
"issue": "Function 'isRectangleCover' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 3
}
] | 1 |
python | # Copyright 2016 Hewlett Packard Enterprise Development LP
#
# 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 '_handle_port_binding' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 149
}
] | 1 |
python | # -*- coding: utf-8 -*-
# Copyright 1999-2018 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 46
},
{
"issue": "Function '__init__' is 43 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 7 |
python | #! /usr/bin/env python
# coding=utf-8
import os
from setuptools import setup, find_packages
from fnmatch import fnmatchcase
from distutils.util import convert_path
def read(*parts):
return open(os.path.join(os.path.dirname(__file__), *parts)).read()
# Provided as an attribute, so you can append to these instea... | Review this code and list any quality issues. | [
{
"issue": "Function 'find_package_data' has cyclomatic complexity 19 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 26
},
{
"issue": "Function 'find_package_data' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"se... | 3 |
python | # pylint: disable=no-value-for-parameter
import click
from utils.misc import delfile
from utils.configs import validate, parse_yaml_config
from utils.cert import prepare_ca, SSL_CERT_KEY_PATH, SSL_CERT_PATH, get_secret_key
from utils.db import prepare_db
from utils.jobservice import prepare_job_service
from utils.reg... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 30
}
] | 1 |
python | #! /usr/bin/env python
##############################################################################
## DendroPy Phylogenetic Computing Library.
##
## Copyright 2010-2015 Jeet Sukumaran and Mark T. Holder.
## All rights reserved.
##
## See "LICENSE.rst" for terms and conditions of usage.
##
## If you use this wo... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 34
}
] | 1 |
python | """Functional test."""
import os
import os.path
from jicbioimage.core.image import MicroscopyCollection
from jicbioimage.core.io import (
AutoName,
DataManager,
FileBackend,
_md5_hexdigest_from_file,
)
from plasmodesmata_analysis import plasmodesmata_analysis
def test_plasmodesmata_analysis():
o... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_plasmodesmata_analysis' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 16
}
] | 1 |
python | import datetime
from django.contrib.admin import ModelAdmin
from django.contrib.admin.templatetags.admin_list import date_hierarchy
from django.contrib.admin.templatetags.admin_modify import submit_row
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.test import R... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_choice_links' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 97
},
{
"issue": "Function 'test_choice_links' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severi... | 2 |
python | """
Chembl uploader
"""
# pylint: disable=E0401, E0611
import os
import glob
import pymongo
import biothings.hub.dataload.storage as storage
from biothings.hub.dataload.uploader import ParallelizedSourceUploader
from hub.dataload.uploader import BaseDrugUploader
from hub.datatransform.keylookup import MyChemKeyLookup
f... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_mapping' is 305 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 72
}
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.