language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | from .utils import *
from .funcs import *
def test_unit():
storage = Storage()
@op(storage)
def f(x:int) -> int:
return x + 1
@superop(storage)
def f_twice(x:int) -> int:
return f(f(x))
with run(storage, autocommit=True):
f_twice(42)
cg = storage.cal... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_unit' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 4
}
] | 1 |
python | """Utilities for ImageNet data preprocessing & prediction decoding.
"""
import json
import keras.utils.data_utils as data_utils
CLASS_INDEX = None
CLASS_INDEX_PATH = ('https://storage.googleapis.com/download.tensorflow.org/'
'data/imagenet_class_index.json')
def decode_predictions(preds, top=5):
... | Review this code and list any quality issues. | [
{
"issue": "Function 'decode_predictions' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 11
}
] | 1 |
python | import subprocess
from consolemenu.items import ExternalItem
class CommandItem(ExternalItem):
"""
A menu item to execute a console command
"""
def __init__(self, text, command, arguments=None, menu=None, should_exit=False):
"""
:ivar str command: The console command to be executed
... | 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": 11
}
] | 1 |
python | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** 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 _utilitie... | 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": 17
},
{
"issue": "Function '__init__' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical"... | 4 |
python | #!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'isValid' function below.
#
# The function is expected to return a STRING.
# The function accepts STRING s as parameter.
#
def isValid(s):
# Write your code here
# Write your code here
freq = {i : s.count(i) for i in... | Review this code and list any quality issues. | [
{
"issue": "Function 'isValid' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 16
}
] | 1 |
python | from django.shortcuts import render,redirect
from django.contrib import messages
from django.template import Context
from .models import Court, CourtManager, SelectedCourt
from apps.users.models import User
from datetime import datetime
from decimal import Decimal
from django.contrib.auth.decorators import login_requir... | Review this code and list any quality issues. | [
{
"issue": "Function 'schedule' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 40
},
{
"issue": "Function 'schedule' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | #
# * This file is distributed under the terms in the attached LICENSE file.
# * If you do not find this file, copies can be found by writing to:
# * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300,
# * Berkeley, CA, 94704. Attention: Intel License Inquiry.
# * Or
# * UC Berkeley EECS Computer Science Divis... | Review this code and list any quality issues. | [
{
"issue": "Function 'script_output' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 65
},
{
"issue": "Function 'kill_pid' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"... | 2 |
python | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from typin... | 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": 56
},
{
"issue": "Function '_process' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line... | 5 |
python | from flask import render_template, redirect, request, url_for, flash
from flask_login import login_user, logout_user, login_required, current_user
from . import auth
from .. import db
from ..models import User
from .forms import LoginForm, RegistrationForm, ChangePasswordForm, ResetPassword, ResetPasswordRequest, \
... | Review this code and list any quality issues. | [
{
"issue": "Function 'before_request' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 12
},
{
"issue": "Function 'login' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severit... | 2 |
python | # Copyright (C) 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Review this code and list any quality issues. | [
{
"issue": "Function 'add_route_to_schedule' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 47
},
{
"issue": "Function 'process_options' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functio... | 2 |
python | import frappe
from frappe.utils import flt
def merge_bundled_items(self, method):
bundles = {}
item_meta = frappe.get_meta(self.doctype + " Item")
count = 0
copy_fields = ['qty', 'stock_qty']
sum_fields = ['total_weight', 'amount', 'net_amount']
rate_fields = [('rate', 'amount'), ('net_rate', 'net_amount'), ('w... | Review this code and list any quality issues. | [
{
"issue": "Function 'merge_bundled_items' has cyclomatic complexity 26 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 4
},
{
"issue": "Function 'merge_bundled_items' is 50 lines long. Functions over 25 lines are harder to test and maintain.",
... | 2 |
python | from __future__ import absolute_import
import six
import string
from django.utils.encoding import force_text
from sentry.interfaces.base import Interface
from sentry.utils.json import prune_empty_keys
from sentry.utils.safe import get_path, trim
__all__ = ("Contexts",)
context_types = {}
class _IndexFormatter(st... | Review this code and list any quality issues. | [
{
"issue": "Function 'iter_tags' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 70
}
] | 1 |
python | #
# @lc app=leetcode id=79 lang=python3
#
# [79] Word Search
#
# @lc code=start
class Solution:
def exist(self, board, word):
start = [None, None]
h = len(board)
l = len(board[0])
walked = [[0] * l for _ in range(h)]
for i in range(h):
for j in range(l):
... | Review this code and list any quality issues. | [
{
"issue": "Function 'exist' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 9
},
{
"issue": "Function 'helper' has cyclomatic complexity 18 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "cri... | 4 |
python | """
-----------------------------------------------------------------------------
AUTHOR: Soumitra Samanta (soumitramath39@gmail.com)
-----------------------------------------------------------------------------
"""
import subprocess
import os
import numpy as np
from datetime import datetime
import pandas as pd
from ... | Review this code and list any quality issues. | [
{
"issue": "Function 'smiles2fraggenie_csv' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 44
},
{
"issue": "Function 'smiles2fraggenie_csv' has 12 parameters. Consider using a parameter object to reduce arity.",
"severity": "crit... | 5 |
python | #!/usr/bin/python3
import argparse
from os.path import isfile
from pathlib import Path
from re import compile, findall, split as re_split, sub, search, match
from utils import error
def parse_buffer(encode_detail_buffer, shellcode, numberbefore=0, numberafter=0):
"""
parse le buffer et renvoie un tuple comm... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse_buffer' has cyclomatic complexity 24 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 11
},
{
"issue": "Function 'parse_buffer' is 63 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "... | 2 |
python | # -*- coding: utf-8 -*-
import iso8601
def to_days(date):
timedelta = iso8601.parse_date(date) - iso8601.parse_date("1970-1-1")
return timedelta.days
class Series(object):
__slots__ = ('series_id', 'title', 'release_date', 'series_info')
def __init__(self, series_id, title, release_date, series_inf... | 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": 13
},
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 23
},
{
"i... | 5 |
python | """
I want to know, whether the imitation process leads to equal return rates in both sectors.
Parameters that this could depend on are
1) the rate of exploration (random changes in opinion and rewiring),
2) also, the rate of rewiring could have an effect.
This should only work in the equilibrium condition where the ... | Review this code and list any quality issues. | [
{
"issue": "Function 'RUN_FUNC' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 31
},
{
"issue": "Function 'RUN_FUNC' is 58 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 5 |
python | # coding: utf-8
#
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
# except in compliance with the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "lice... | 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": 62
},
{
"issue": "Function 'to_dict' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line"... | 2 |
python | import torch
from algorithms.single_model_algorithm import SingleModelAlgorithm
from models.initializer import initialize_model
class GroupDRO(SingleModelAlgorithm):
"""
Group distributionally robust optimization.
Original paper:
@inproceedings{sagawa2019distributionally,
title={Distribu... | 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": 17
}
] | 1 |
python | import numpy
from matplotlib import pyplot
import gdal
from skimage import io,exposure
from skimage.segmentation import slic,mark_boundaries
import os
from PIL import Image
import shelve
import sys
sys.path.append('..')
from Config import config
def seg(path,n_segments=500, compactness=20):
i=io.imread(path)[:,... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 70
},
{
"issue": "Function 'on_key_press' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",... | 6 |
python | #!/usr/bin/env python3
import rospy
import cv2
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
import numpy as np
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(5, 5))
kernel1= cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(3, 3))
aratio = 1.0
def nothing(x):
pass
# ********************... | Review this code and list any quality issues. | [
{
"issue": "Function 'callback' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 38
},
{
"issue": "Function 'callback' is 55 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 2 |
python | import os
import re
import secrets
import string
import pulumi
from pulumi import ResourceOptions
from pulumi_kubernetes.apps.v1 import Deployment
from pulumi_kubernetes.core.v1 import Service
from azure.keyvault import KeyVaultClient, KeyVaultAuthentication, KeyVaultId
from azure.common.credentials import ServicePri... | Review this code and list any quality issues. | [
{
"issue": "Function '_gen_service' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 120
},
{
"issue": "Function '_gen_deployment' is 50 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line... | 4 |
python | import tensorflow.compat.v1 as tf
#from tensorflow.contrib import slim
import tf_slim as slim
from avod.core.avod_fc_layers import avod_fc_layer_utils
def build(fc_layers_config,
input_rois, input_weights,
num_final_classes, box_rep,
is_training,
end_points_collection):
"... | Review this code and list any quality issues. | [
{
"issue": "Function 'build' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 8
},
{
"issue": "Function 'build_output_layers' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
... | 6 |
python | #!/usr/bin/env python3
# coding: utf-8
# Copyright 2016 Abram Hindle, https://github.com/tywtyw2002, and https://github.com/treedust
#
# 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
#
# ... | Review this code and list any quality issues. | [
{
"issue": "Function 'GET' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 71
},
{
"issue": "Function 'POST' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 1... | 3 |
python | from scipy import signal
from scipy import misc
from scipy import stats as st
import numpy as np
W = 128
L = 128
Body_Width = 3
Border = Body_Width+1
Points = 10
Noise_Max = 10
Body_Separation = 15
Body_Scale = 30
OvScale = 3
def gkern(kernlen=21, nsig=3):
''' 2D Gaussian Kernel. '''
x = np.linspace(-nsig, n... | Review this code and list any quality issues. | [
{
"issue": "Function 'genStarCoords' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 27
}
] | 1 |
python | #
# Copyright (c) 2020 Cord Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 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": "major",
"line": 79
},
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 79
},
{
... | 3 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
# Copyright 2012 Google, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | Review this code and list any quality issues. | [
{
"issue": "Function 'queue_events' has cyclomatic complexity 31 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 128
},
{
"issue": "Function 'queue_events' is 54 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": ... | 2 |
python | # (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import pytest
from datadog_checks.base import OpenMetricsBaseCheckV2
from datadog_checks.base.constants import ServiceCheck
from datadog_checks.dev.testing import requires_py3
from .utils import get_chec... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_service_check_dynamic_tags' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 39
}
] | 1 |
python | """
byceps.services.shop.order.actions.ticket
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2014-2022 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from typing import Any, Sequence
from uuid import UUID
from .....typing import UserID
from ....ticketing.dbmodels.ticket impor... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_tickets' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 29
}
] | 1 |
python | # apis_v1/documentation_source/sitewide_daily_metrics_sync_out_doc.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
def sitewide_daily_metrics_sync_out_doc_template_values(url_root):
"""
Show documentation about sitewideDailyMetricsSyncOut
"""
required_query_parameter_list = [
... | Review this code and list any quality issues. | [
{
"issue": "Function 'sitewide_daily_metrics_sync_out_doc_template_values' is 91 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 6
}
] | 1 |
python | '''
Created on Jul 17, 2013
@author: Yubin Bai
'''
import time
from multiprocessing.pool import Pool
parallelSolve = False
INF = 1 << 31
def solve(par):
M, pairs = par
pairs.sort()
pairs1 = []
for p in pairs:
if p[0] >= M or p[1] <= 0:
continue
pairs1.append(tuple(p))
i... | Review this code and list any quality issues. | [
{
"issue": "Function 'solve' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 11
}
] | 1 |
python |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publ... | 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": 30
}
] | 1 |
python | from typing import Tuple
from codegen.ast import *
from codegen.sugar import *
from codegen.forms import *
from codegen.precision import *
import scripts.old_arm
import scripts.max_bn_knl
from cursors import *
import architecture
import numpy
def decompose_pattern(k, n, pattern:Matrix[bool], bk:int, bn:int) -> Tup... | Review this code and list any quality issues. | [
{
"issue": "Function 'decompose_pattern' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 16
},
{
"issue": "Function 'decompose_pattern' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"se... | 9 |
python | import siliconcompiler
############################################################################
# DOCS
############################################################################
def make_docs():
'''
Demonstration target for compiling ASICs with FreePDK45 and the open-source
asicflow.
'''
ch... | Review this code and list any quality issues. | [
{
"issue": "Function 'setup' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 22
}
] | 1 |
python | #!/usr/bin/env python
# coding=UTF-8
import requests
import json
import datetime
from config.configuration import flower_path, flower_port, flower_server_external, verify_certificate, \
flower_server_internal
def get_task_info(task_id):
flower_request_url = 'http://%s:%s%sapi/tasks' % (flower_server_interna... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_task_info' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 12
},
{
"issue": "Function 'get_task_info' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "mi... | 2 |
python | from __future__ import absolute_import
from __future__ import with_statement
import sys
import logging
from tempfile import mktemp
from celery import log
from celery.log import (setup_logger, setup_task_logger,
get_default_logger, get_task_logger,
redirect_stdouts_to_lo... | Review this code and list any quality issues. | [
{
"issue": "Function 'assertDidLogTrue' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 45
},
{
"issue": "Function 'assertDidLogFalse' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 4... | 2 |
python | # -*- coding:utf-8 -*-
# @author :adolf
import os
from data.data_utils import order_points_clockwise
from data.data_aug import *
from data.make_labels import *
class CurrentOcrData(object):
def __init__(self, root, pre_processes=None, transforms=None, filter_keys=None, ignore_tags=None, is_training=True):
... | 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": 11
},
{
"issue": "Function '__getitem__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"li... | 2 |
python | # -*- coding: utf-8 -*-
import fnmatch
import os
from os.path import join as _j
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django_extensions.management.utils import signalcommand
class Command(BaseCommand):
help = "Removes all python bytecode compiled... | Review this code and list any quality issues. | [
{
"issue": "Function 'handle' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 29
}
] | 1 |
python | # -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2021 Dinesh Pinto
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, ... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_trait_type_median_price' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 141
},
{
"issue": "Function 'get_nft_holdings' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller ... | 4 |
python | # -*- coding: utf-8 -*-
import config as cfg
import pyodbc
"""
Fill in closest Police Stations within 10 miles
If there is no closest PS, then ClosestPSDistance = MeanPSDistance = 10.5 miles
Latitude/Longitude distance coefficients:
--Miles 3958.75
--Kilometers 6367.45
--Feet 20890584
--Meters 6367450
"""
def calc... | Review this code and list any quality issues. | [
{
"issue": "Function 'calculate_distance' is 62 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 15
}
] | 1 |
python | """
Convert a large audio wav file (album length, i.e. > 30 minutes typically)
into a series of videos consisting of the audio synchronized with images of the
spectrogram.
"""
import os
import sys
import multiprocessing as mp
import subprocess
import tqdm
import numpy as np
import librosa.core
import librosa.display
i... | 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": 58
}
] | 1 |
python | '''
only for RRP Hopper
Shihao Feng
2021.10.28
'''
import numpy as np
import pybullet as p
from leg_kinematics import LegKinematicsRRP
import pinocchio as pin
class JointPDController(object):
def __init__ (self):
self.kp = np.array([70, 70, 1500])
self.kd = np.array([2, 2, 10])
def solve(self... | Review this code and list any quality issues. | [
{
"issue": "Function 'solve' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 17
},
{
"issue": "Function 'solve' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 5... | 4 |
python | """A collection of classes and methods to deal with collections of
rates that together make up a network."""
# Common Imports
from __future__ import print_function
import functools
import math
from operator import mul
import os
from collections import OrderedDict
from ipywidgets import interact
import matplotlib as... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 24 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 87
},
{
"issue": "Function '__init__' is 62 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical... | 6 |
python | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import torch
import numpy as np
import matplotlib.pyplot as plt
# from MMDBalancing import MMDBalancing as MMDB
# from OptimalTransportBalancing import OptimalTransportBalancing as OTB
# from NeuralAdversarialBalancing import NeuralAdversarialBalancing as NAB
#get_ipyth... | Review this code and list any quality issues. | [
{
"issue": "Function 'static_simulation.get_split_ind' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 83
},
{
"issue": "Function 'static_simulation.get_DRE' has 5 parameters. Consider using a parameter object to reduce arit... | 3 |
python | import matplotlib.pyplot as plt
import seaborn as sns
class PlotTree():
def __init__(self,tree_class):
self._tree_class=tree_class
self._decision_node = dict(boxstyle="sawtooth", fc="0.8")
self._leaf_node = dict(boxstyle="round4", fc="0.8")
self._arrow_args = dict(arrows... | Review this code and list any quality issues. | [
{
"issue": "Function '__plot_node' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 33
},
{
"issue": "Function '__plot_tree' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
... | 4 |
python | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2020
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 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": 76
},
{
"issue": "Function 'flush' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": ... | 2 |
python | from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import logging
from lineuzinho import Lineuzinho
def main():
logging.getLogger(__name__)
logging.basicConfig(format='%(asctime)s [%(levelname)s]: %(message)s', level=logging.INFO)
lineuzinho = Lineuzinho()
updater = Updater(lin... | 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": 6
}
] | 1 |
python | """
LoRaWAN Specification v1.0.2
Test Case Group: Functionality
Test Name: FUN_02
"""
#################################################################################
# MIT License
#
# Copyright (c) 2018, Pablo D. Modernell, Universitat Oberta de Catalunya (UOC),
# Universidad de la Republica Oriental del Uruguay (Ude... | 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": 43
},
{
"issue": "Function 'step_handler' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 58
},
{
... | 3 |
python | import os, shutil, subprocess
import ase.build
import pypospack.io.vasp as vasp
import pypospack.crystal as crystal
import pypospack.io.slurm as slurm
class VaspCalculateBulkProperties(object):
def __init__(self,sim_dir,obj_structure):
self.sim_dir = sim_dir
self.sim_task_list = ['min0','conv_encu... | Review this code and list any quality issues. | [
{
"issue": "Function 'run' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 35
},
{
"issue": "Function 'create_simulation' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | """
Skeleton data structures
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, yt Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#------------------... | 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": 26
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 88
}
] | 2 |
python | from datetime import datetime
from jose import jwt
from jose.utils import base64url_decode
from jose.exceptions import JWTError
from vds_vault_oauth.utilities import OAuthContainer
# Token that stores the necessary tokens and provides the ability to decode & log them.
class Token():
def __init__(self, toke... | Review this code and list any quality issues. | [
{
"issue": "Function 'verifyTokenClaims' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 30
}
] | 1 |
python | import os
import numpy as np
import pytest
from ci_framework import FlopyTestSetup, base_test_dir
import flopy
base_dir = base_test_dir(__file__, rel_path="temp", verbose=True)
ex_pth = os.path.join("..", "examples", "data", "mf2005_test")
testmodels = [
os.path.join(ex_pth, f) for f in os.listdir(ex_pth) if f.... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_bcs_check' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 36
},
{
"issue": "Function 'test_properties_check' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"sever... | 3 |
python | # Copyright 2017 Google Inc.
#
# 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 following disclaimer.
#
#... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_call_from_allele_counter' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 54
}
] | 1 |
python | from os import environ
import os
import time
from urllib.parse import urlparse
import aiohttp
from pyshorteners import Shortener
from bs4 import BeautifulSoup
import requests
import re
from pyrogram import Client, filters
API_ID = environ.get('API_ID')
API_HASH = environ.get('API_HASH')
BOT_TOKEN = environ.get('BOT_TO... | Review this code and list any quality issues. | [
{
"issue": "Function 'pdisk_up' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 73
},
{
"issue": "Function 'multi_pdisk_up' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"sev... | 2 |
python | from ConfigParser import SafeConfigParser
import errno
import logging
import os
import urllib2
class Config(object):
# S3 settings
AWS_ACCESS_KEY_CONFIG = ('aws', 'access_key', 'AWS_ACCESS_KEY')
AWS_SECRET_KEY_CONFIG = ('aws', 'secret_key', 'AWS_SECRET_KEY')
AWS_TEST_RESULT_BUCKET_CONFIG = ('aws', 'test_result... | 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": 35
},
{
"issue": "Function '__init__' is 48 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | # Copyright (C) 2010 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 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 '__call__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 39
},
{
"issue": "Function 'assert_no_error.handle_style_error' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
... | 3 |
python | """Copyright 2021 Google LLC.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... | Review this code and list any quality issues. | [
{
"issue": "Function 'createArgsParser' is 110 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 33
},
{
"issue": "Function 'validateArgs' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": ... | 4 |
python | from django.test import TestCase
from core.govdelivery import MockGovDelivery
from data_research.forms import ConferenceRegistrationForm
from data_research.models import ConferenceRegistration
class ConferenceRegistrationFormTests(TestCase):
capacity = 100
govdelivery_code = 'TEST-CODE'
govdelivery_quest... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_form_save_commit_true_subscribes_and_sets_question' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 102
}
] | 1 |
python | """
Created on Fri Oct 29 18:54:18 2021
@author: Krishna Nuthalapati
"""
import numpy as np
def iou(boxA, boxB):
# determine the (x, y)-coordinates of the intersection rectangle
xA = max(boxA[0], boxB[0])
yA = max(boxA[1], boxB[1])
xB = min(boxA[2], boxB[2])
yB = min(boxA[3], boxB[3])
# compute the area of int... | Review this code and list any quality issues. | [
{
"issue": "Function 'nms' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 28
}
] | 1 |
python | import itertools
import dgl
import torch
from rdkit import Chem
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import minimum_spanning_tree
from fgh_gnn.utils import FGROUP_MOLS, get_ring_fragments, ogb_graph_to_mol
class FGroupHetGraphBuilder:
def __init__(self, vocab):
self.vocab = voc... | Review this code and list any quality issues. | [
{
"issue": "Function 'build_fgroup_heterograph' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 23
},
{
"issue": "Function '_make_clusters' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"se... | 5 |
python | # -*- coding: utf-8 -*-
# Markdown parsers.
#
#
# Author: Moogen Tian <http://blog.galeo.me>
#
# Legal:
#
# This file is published under BSD License.
#
# And the code structure references:
#
# * pagewise (by ainm <ainm at gmx.com>, with personal public license)
#
# * mynt (by Andrew Fricke, the autho... | Review this code and list any quality issues. | [
{
"issue": "Function 'xlate_exts_flags' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 118
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
... | 3 |
python | import os
import sys
root_path = os.path.abspath("../")
if root_path not in sys.path:
sys.path.append(root_path)
import tensorflow as tf
class Optimizer:
def __init__(self, lr=1e-3):
self._lr = lr
self._opt = None
@property
def name(self):
return str(self)
def minimize(s... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 60
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 66
},
{
"i... | 3 |
python | from datetime import datetime
import os
import pickle
import argparse
import numpy as np
import torch
import torch.nn.functional as F
from mcmc_unlearner import sgmcmcUnlearner
import utils
import models
class myUnlearner(sgmcmcUnlearner):
def _apply_sample(self, z):
x, y = z
if not self.cpu: x, ... | Review this code and list any quality issues. | [
{
"issue": "Function 'forget_eval_one_time' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 84
},
{
"issue": "Function 'save_checkpoint' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line":... | 4 |
python | """
Python 2 and 3 code to generate 4 and 5 digit NACA profiles
The NACA airfoils are airfoil shapes for aircraft wings developed
by the National Advisory Committee for Aeronautics (NACA).
The shape of the NACA airfoils is described using a series of
digits following the word "NACA". The parameters in the numerical
co... | Review this code and list any quality issues. | [
{
"issue": "Function 'interpolate' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 49
},
{
"issue": "Function 'interpolate' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor"... | 6 |
python | import fire
import snowflake.connector
import configparser
import secrets
import pathlib
class Bufu():
def connect(self):
cp = configparser.ConfigParser()
path = pathlib.Path('~/.snowsql/config')
cp.read(path.expanduser())
conn = snowflake.connector.connect(
user = cp['c... | Review this code and list any quality issues. | [
{
"issue": "Function 'show' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 26
}
] | 1 |
python | from typing import Dict, List, Optional, Tuple, Union
from typing_extensions import TypedDict
import numpy as np
import torch
from torch import Tensor
from tqdm import tqdm
from transformers import PreTrainedTokenizer
from neuro_comma.augmentation import AUGMENTATIONS
from neuro_comma.pretrained import TOKEN_IDX
cl... | 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": 15
},
{
"issue": "Function 'parse_tokens' has cyclomatic complexity 20 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",... | 6 |
python | # -*- coding: utf-8 -*-
# Copyright (C) 2005-2006 Joe Wreschnig
# 2013 Christoph Reiter
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or... | Review this code and list any quality issues. | [
{
"issue": "Function 'is_valid_key' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 26
},
{
"issue": "Function 'load' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity"... | 7 |
python | from grouper.fe.forms import ServiceAccountCreateForm
from grouper.fe.settings import settings
from grouper.fe.util import GrouperHandler
from grouper.models.group import Group
from grouper.service_account import (
BadMachineSet,
can_create_service_account,
create_service_account,
DuplicateServiceAccoun... | Review this code and list any quality issues. | [
{
"issue": "Function 'post' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 25
},
{
"issue": "Function 'post' is 50 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line":... | 2 |
python | # Copyright 2018-2021 Streamlit Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | Review this code and list any quality issues. | [
{
"issue": "Function '_key.is_simple' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 132
},
{
"issue": "Function '_key' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severi... | 5 |
python | """
python test.py --model pointMLP --msg 20220209053148-404
"""
import argparse
import os
import datetime
import torch
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
from torch.utils.data import DataLoader
import models as mo... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 55
},
{
"issue": "Function 'validate' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 96
}
] | 2 |
python | import numpy as np
#import skimage.draw as skdraw
def add_bbox(img,bbox,color=[0,0,0],fill=False,alpha=1):
x1,y1,x2,y2 = bbox
# Clockwise starting from top left
r = [y1,y1,y2,y2]
c = [x1,x2,x2,x1]
if fill:
coords = skdraw.polygon(r,c,shape=img.shape[0:2])
skdraw.set_color... | Review this code and list any quality issues. | [
{
"issue": "Function 'add_bbox' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 5
},
{
"issue": "Function 'vis_bbox' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 85
},
{
"is... | 8 |
python | from neo4j import GraphDatabase
import json
import os
def create_beers(tx):
""" Load from the results of cloudburst site scraper """
with open('data/beers.json', 'r') as f:
beer_hops = json.load(f)
beers = beer_hops['beers']
query = """
UNWIND $beers as beer
MERGE (b:Bee... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_hops' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 29
}
] | 1 |
python | import os
import argparse
import warnings
import numpy as np
from scipy.io import wavfile
from hmmlearn import hmm
from python_speech_features import mfcc
# Function to parse input arguments
def build_arg_parser():
parser = argparse.ArgumentParser(description='Trains the HMM classifier')
parser.add_argument("-... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 19
}
] | 1 |
python | #!/usr/bin/python
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This progra... | Review this code and list any quality issues. | [
{
"issue": "Function 'test' is 50 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 22
}
] | 1 |
python | # The Computer Language Benchmarks Game
# http://benchmarksgame.alioth.debian.org/
#
# originally by Kevin Carson
# modified by Tupteq, Fredrik Johansson, and Daniel Nanz
# modified by Maciej Fijalkowski
# 2to3
import pyjion
import timeit
import gc
def combinations(l):
result = []
for x in range(len(l) - 1):
... | Review this code and list any quality issues. | [
{
"issue": "Function 'offset_momentum' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 102
}
] | 1 |
python | import logging
from django.conf import settings as django_settings
from django.contrib.auth import authenticate, get_user_model, login, logout
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.utils.decorators import method_decorator
from django.views.decorators.cache import never_cache
f... | Review this code and list any quality issues. | [
{
"issue": "Function 'post' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 41
},
{
"issue": "Function 'get' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 9... | 4 |
python | import sys
import unittest
from test import support
pwd = support.import_module('pwd')
class PwdTest(unittest.TestCase):
@unittest.skipUnless(hasattr(pwd, 'getpwall'), 'pwd module does not expose getpwall()')
def test_values(self):
entries = pwd.getpwall()
for e in entries:
self.ass... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_values_extended' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 36
},
{
"issue": "Function 'test_errors' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
... | 3 |
python | # Copyright (c) 2010-2013, 2016 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the fun... | Review this code and list any quality issues. | [
{
"issue": "Function 'build_test_system' has cyclomatic complexity 35 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 86
},
{
"issue": "Function 'build_test_system' is 99 lines long. Functions over 25 lines are harder to test and maintain.",
"se... | 4 |
python | #!/usr/bin/env python3
import xmlrpc.client
import os, sys, shutil, json, subprocess, time, yara, hashlib, datetime, requests, magic, redis, socket, pefile
from pathlib import Path
from pymongo import MongoClient
from rq import get_current_job, Queue
from read_avclass_report import run_avclass
from redis import Redis
... | Review this code and list any quality issues. | [
{
"issue": "Function 'analyze' has cyclomatic complexity 27 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 65
},
{
"issue": "Function 'analyze' is 134 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical"... | 2 |
python | #!/usr/bin/env python
"""Module to deal with halos, to be used with HaloMaker.
This module is heavily inspired by the set of IDL routines originally
found in the Ramses Analysis ToolSuite (RATS).
TODO: Some more documentation
"""
import numpy as np
import pandas as pd
import yt
from yt.utilities.logger import ytLo... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 23
},
{
"issue": "Function '_read_halos' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
... | 3 |
python | from PIL import Image
from django.conf import settings
from . import forms, recognition
from . import utils
from . import models
from django.shortcuts import render, redirect
from django.contrib import admin
from django.core.mail import send_mail
from django.http import JsonResponse
from django.views.decorators.csrf im... | Review this code and list any quality issues. | [
{
"issue": "Function 'authenticate_device.view_wrapper' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 58
},
{
"issue": "Function 'log' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions... | 3 |
python | class Solution:
def invalidTransactions(self, transactions):
helper = []
helper_back = []
for transaction in transactions:
tmp_transaction = transaction.split(",")
helper.append(tmp_transaction)
for record in helper:
if int(record[2]) > 1000:
... | Review this code and list any quality issues. | [
{
"issue": "Function 'invalidTransactions' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 2
}
] | 1 |
python | # Copyright 2022 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_network_creation' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 42
},
{
"issue": "Function 'test_network_creation' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
... | 4 |
python | #!/usr/bin/python3
# ------------------------------------------------------------------------------
"""@package ble_lights.py
Sets the attached light values and notifies when they change.
"""
# ------------------------------------------------------------------------------
# Kris Dunning ippie52@gmail.... | Review this code and list any quality issues. | [
{
"issue": "Function 'onWriteRequest' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 70
}
] | 1 |
python | # Copyright 2018-present Kensho Technologies, LLC.
import six
from ..blocks import Filter, GlobalOperationsStart
from ..ir_lowering_common import (extract_optional_location_root_info,
extract_simple_optional_location_info,
lower_context_field_existenc... | Review this code and list any quality issues. | [
{
"issue": "Function 'lower_ir' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 31
},
{
"issue": "Function 'lower_ir' is 51 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 2 |
python | #!/usr/bin/python
import numpy as np
from scipy import signal
class RandomMapGenerator():
def __init__(self,size=(5,6)):
self.initialize_thresh = 0.5
self.size = size
def initialize(self):
self.map = np.random.random(self.size)
super_thresh_indices = self.map >= self.initial... | Review this code and list any quality issues. | [
{
"issue": "Function 'apply_rules' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 20
}
] | 1 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of Karesansui Core.
#
# Copyright (C) 2009-2012 HDE, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restric... | Review this code and list any quality issues. | [
{
"issue": "Function 'write_conf' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 129
}
] | 1 |
python | # ---------------------------------------------------------------------
# Interface Classification Rules models
# ---------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ------------------------------------------------------------------... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_confdb_query' has cyclomatic complexity 30 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 57
},
{
"issue": "Function 'get_confdb_query' is 55 lines long. Functions over 25 lines are harder to test and maintain.",
"seve... | 3 |
python | import copy
import math
import numpy as np
from tqdm import tqdm
from utils.model_util import triad_to_matrix, nonzero_user_mean, nonzero_item_mean
# 相似度计算库
from scipy.stats import pearsonr
from sklearn.metrics.pairwise import cosine_similarity
class IPCCModel(object):
def __init__(self) -> None:
super()... | Review this code and list any quality issues. | [
{
"issue": "Function '_get_similarity_matrix' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 21
},
{
"issue": "Function '_get_similarity_matrix' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
... | 5 |
python | from date_class import Date
def test_init_repr(day, month, year):
obj = Date(day, month, year)
print(obj)
def test_get_day(d, m, y):
obj = Date(d, m, y)
print(obj.get_day())
def test_set_day(d, m, y, day):
obj = Date(d, m, y)
obj.set_day(day)
print(obj)
def test_get_month(d, m, y):
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_add_d_m_y' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 60
}
] | 1 |
python | #! /usr/bin/env python
# This file is part of the dvbobjects library.
#
# Copyright 2000-2001, GMD, Sankt Augustin
# -- German National Research Center for Information Technology
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... | 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": 61
},
{
"issue": "Function 'generate' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 107
}
] | 2 |
python | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Review this code and list any quality issues. | [
{
"issue": "Function 'qnn_subtract_driver' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 23
},
{
"issue": "Function 'qnn_subtract_driver' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
... | 3 |
python | """
test_analyze.py
Testing analyze.py
"""
import os
from collections import defaultdict
import numpy as np
import seekr2.modules.common_analyze as common_analyze
import seekr2.modules.mmvt_analyze as mmvt_analyze
import seekr2.analyze as analyze
import seekr2.modules.common_base as base
import seekr2.modules.mmvt_... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_read_output_file' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 24
},
{
"issue": "Function 'test_read_output_file' is 45 lines long. Functions over 25 lines are harder to test and maintain.",
... | 4 |
python | import os
from . import pre, csr
import imageio
from tqdm import tqdm
import numpy as np
from skimage import morphology
import pandas as pd
from .image_stats import image_summary
from skimage.feature import shape_index
from concurrent.futures import ThreadPoolExecutor, as_completed
import multiprocessing as mp
CPU_CO... | Review this code and list any quality issues. | [
{
"issue": "Function '_get_scale' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 16
},
{
"issue": "Function 'process_single_image' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "crit... | 4 |
python | #!/usr/bin/env python3
# Copyright (c) 2018-2019 The BitPal Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the scantxoutset rpc call."""
from test_framework.test_framework import BitPalTestFramework
from te... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_test' is 83 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 24
}
] | 1 |
python | import numpy as np
import astropy.nddata
from astropy.io import fits
from astropy.io.fits import CompImageHDU, HDUList, Header, ImageHDU, PrimaryHDU
from astropy.wcs import WCS
from astropy.wcs.wcsapi import BaseHighLevelWCS
__all__ = ['parse_input_data', 'parse_input_shape', 'parse_input_weights',
'parse_... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse_input_data' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 13
},
{
"issue": "Function 'parse_input_shape' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions... | 6 |
python | """Support for Sure PetCare Flaps/Pets sensors."""
from __future__ import annotations
from typing import Any, cast
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_VOLTAGE,
DEVICE_CLASS_BATTERY,
MASS_GRAMS,... | Review this code and list any quality issues. | [
{
"issue": "Function 'async_setup_entry' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 44
},
{
"issue": "Function 'async_setup_entry' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"severi... | 7 |
python | # Телеграм-бот v.002 - бот создаёт меню, присылает собачку, и анекдот
import telebot # pyTelegramBotAPI 4.3.1
from telebot import types
import requests
import bs4
import json
bot = telebot.TeleBot('5193117811:AAH0hWHVx0kH08sub52IFj2SAdJi1eugY-k') # Создаем экземпляр бота
# ---------------------------------------... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_text_messages' has cyclomatic complexity 24 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 32
},
{
"issue": "Function 'get_text_messages' is 108 lines long. Functions over 25 lines are harder to test and maintain.",
"s... | 2 |
python | # Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2021 Dan <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free... | Review this code and list any quality issues. | [
{
"issue": "Function 'iter_chat_members' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 41
},
{
"issue": "Function 'iter_chat_members' is 47 lines long. Functions over 25 lines are harder to test and maintain.",
"sever... | 3 |
python | # -*- coding: utf-8 -*-
import os
import numpy as np
import cv2
import imgproc
from PIL import Image, ImageDraw
# borrowed from https://github.com/lengstrom/fast-style-transfer/blob/master/src/utils.py
def get_files(img_dir):
imgs, masks, xmls = list_files(img_dir)
return imgs, masks, xmls
def list_files(in... | Review this code and list any quality issues. | [
{
"issue": "Function 'list_files' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 15
},
{
"issue": "Function 'saveResult' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"seve... | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.