language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | # coding: utf-8
"""
Definition of the job dashboard interface.
"""
__all__ = ["BaseJobDashboard", "NoJobDashboard", "cache_by_status"]
import time
import functools
from contextlib import contextmanager
from abc import ABCMeta, abstractmethod
import six
def cache_by_status(func):
"""
Decorator for :py:me... | Review this code and list any quality issues. | [
{
"issue": "Function 'cache_by_status.wrapper' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 26
},
{
"issue": "Function 'publish' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 160
... | 2 |
python | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/022_data.mixed.ipynb (unless otherwise specified).
__all__ = ['MixedDataLoader', 'MixedDataLoaders', 'get_mixed_dls']
# Cell
from ..imports import *
# Cell
# This implementation of a mixed dataloader is based on a great implementation created by Zach Mueller in this fa... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 19
},
{
"issue": "Function '__init__' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 5 |
python | from resources import relu, learnFunc, dot
class HiddenBlock:
def __init__(self, weights, bias):
self.weights = weights
self.bias = bias
def feedForward(self, hidden_inputs):
output = [
relu(
dot(hidden_inputs, weights) + self.bias
)
for... | Review this code and list any quality issues. | [
{
"issue": "Function 'train' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 16
}
] | 1 |
python | # pep8: disable=E501
from __future__ import print_function
import collections
import os
import pandas
import shutil
import unittest
import pandas as pd
import sklearn.datasets as datasets
import tensorflow as tf
from mlflow import tensorflow, pyfunc
from mlflow import tracking
from mlflow.utils.file_utils import Te... | Review this code and list any quality issues. | [
{
"issue": "Function 'helper' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 22
},
{
"issue": "Function 'test_log_saved_model' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
... | 4 |
python | #!/usr/bin/env python3
# Copyright (c) 2018 The Refnet Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the behavior of RPC importprivkey on set and unset labels of
addresses.
It tests different cases in whi... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_test' is 93 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 25
}
] | 1 |
python | import tensorflow as tf
from networks.network import Network
#define
n_classes = 21
_feat_stride = [16,]
anchor_scales = [8, 16, 32]
class VGGnet_train(Network):
def __init__(self, trainable=True):
self.inputs = []
self.data = tf.placeholder(tf.float32, shape=[None, None, None, 3])
#self... | Review this code and list any quality issues. | [
{
"issue": "Function 'setup' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 28
}
] | 1 |
python | """
KMP pattern matching algorithm.
Finds matching patterns in text in linear time.
Text: A longer string of length n. (n > m)
Pattern: Substring to be searched for of length m.
Works by precompiling the pattern string to create a LPS string array.
LPS: Longest Proper Prefix. Longest prefix string that is also a suffix... | Review this code and list any quality issues. | [
{
"issue": "Function 'kmp' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 36
}
] | 1 |
python | """
mcpython - a minecraft clone written in python licenced under the MIT-licence
(https://github.com/mcpython4-coding/core)
Contributors: uuk, xkcdjerry (inactive)
Based on the game of fogleman (https://github.com/fogleman/Minecraft), licenced under the MIT-licence
Original game "minecraft" by Mojang Studios (www.m... | Review this code and list any quality issues. | [
{
"issue": "Function 'on_mouse_press' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 70
},
{
"issue": "Function 'on_mouse_release' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 81
... | 3 |
python | """distutils.command.config
Implements the Distutils 'config' command, a (mostly) empty command class
that exists mainly to be sub-classed by specific module distributions and
applications. The idea is that while every "config" command is different,
at least they're all named the same, and users always see "config" i... | Review this code and list any quality issues. | [
{
"issue": "Function 'finalize_options' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 60
},
{
"issue": "Function '_preprocess' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",... | 12 |
python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------
# Date: 2021/01/06
# Author: Shaun
# 檔案功能描述:
# 自動抓取機台狀態,更新資料庫,配合bash腳本,寫入系統排程crontab -e
# -------------------------------------------------------------------
import socket
# import pymysql
... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_from_brother' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 20
},
{
"issue": "Function 'get_from_brother' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity... | 2 |
python | from collections.abc import Mapping
from datetime import datetime
import logging
from typing import Optional
from stackdriver_log_formatter.serializer import DefaultFunc, dumps
class StackdriverLogFormatter(logging.Formatter):
"""Log formatter suitable for Stackdriver Logging.
This formatter print log as a ... | Review this code and list any quality issues. | [
{
"issue": "Function 'format' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 69
},
{
"issue": "Function 'format' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"li... | 2 |
python | import operator
class SegmentTree(object):
def __init__(self, capacity, operation, neutral_element):
"""Build a Segment Tree data structure.
https://en.wikipedia.org/wiki/Segment_tree
Can be used as regular array, but with two
important differences:
a) setting item's va... | Review this code and list any quality issues. | [
{
"issue": "Function '_reduce_helper' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 32
}
] | 1 |
python | # coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class BucketTestCase(Integratio... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_read_full_response' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 169
}
] | 1 |
python | from typing import Dict, Any
from telegram import Update, ParseMode
from telegram.ext import CallbackContext
from config.constants import (
USER_DATA_V1_SETTINGS_CAMPUS,
USER_DATA_V1_SETTINGS_ONLINE,
USER_DATA_V1_INTRA_LOGIN,
USER_DATA_V1_INTRA_CAMPUS,
USER_DATA_V1_SETTINGS_ACTIVE,
USER_DATA_V... | Review this code and list any quality issues. | [
{
"issue": "Function 'info_other' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 36
}
] | 1 |
python | import logging
import os
import re
import sys
from typing import Any, Dict
import PySimpleGUI as sg # type: ignore
from PySimpleGUI.PySimpleGUI import Column # type: ignore
from .utils.encryption import encrypt_password, generate_key
logger = logging.getLogger(__name__)
def login_gui() -> Dict[str, Any]:
sg.... | Review this code and list any quality issues. | [
{
"issue": "Function 'login_gui.main' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 25
},
{
"issue": "Function 'login_gui.main' is 49 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "... | 2 |
python | # coding: utf-8
"""
Influx API Service
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: 0.1.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class Vari... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_dict' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 125
}
] | 1 |
python | # -*- coding: utf-8 -*-
import os, json
if os.name == 'nt':
SLASH = '\\'
else:
SLASH = '/'
def makeOutputFolder(folder_name,counter):
try:
if counter is not None:
write_folder_name = folder_name + ' (' + str(counter) + ')'
else:
write_folder_name = folder_name
write_folder = os.mkdir(write_folder_name... | Review this code and list any quality issues. | [
{
"issue": "Function 'addCardsToTurtle' has cyclomatic complexity 49 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 41
},
{
"issue": "Function 'addCardsToTurtle' is 132 lines long. Functions over 25 lines are harder to test and maintain.",
"sev... | 2 |
python | import pgzrun
import gameinput
import gamemaps
from random import randint
from datetime import datetime
WIDTH = 600
HEIGHT = 660
player = Actor("pacman_o") # Load in the player Actor image
player.score = 0
player.lives = 3
level = 0
SPEED = 3
def draw(): # Pygame Zero draw function
global pacDots, player
scre... | Review this code and list any quality issues. | [
{
"issue": "Function 'draw' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 15
},
{
"issue": "Function 'draw' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line":... | 9 |
python | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
from timeit import time
import warnings
import cv2
import numpy as np
from PIL import Image
from yolo import YOLO
from deep_sort import preprocessing
from deep_sort import nn_matching
from deep_sort.detect... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 24 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 25
},
{
"issue": "Function 'main' is 89 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"... | 2 |
python | # -*- coding: utf-8 -*-
"""
Ebay Trading API
"""
import xmltodict
import requests
from . import app_settings as settings
class TradingAPIWarning(Exception):
pass
class TradingAPIFailure(Exception):
pass
class TradingAPIInvalidResponse(Exception):
pass
class TradingAPI(object):
_last_response = ... | Review this code and list any quality issues. | [
{
"issue": "Function 'execute' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 77
},
{
"issue": "Function 'execute' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": ... | 2 |
python | from scirpy.util import (
_is_na,
_is_false,
_is_true,
_normalize_counts,
_is_symmetric,
_reduce_nonzero,
_translate_dna_to_protein,
)
from scirpy.util.graph import layout_components
from itertools import combinations
import igraph as ig
import numpy as np
import pandas as pd
import numpy.te... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_is_false' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 89
},
{
"issue": "Function 'test_is_true' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line... | 2 |
python | import os
import sys
import time
import hashlib
import zlib
import random
import string
import subprocess as sb
import redis
import json
from collections import Counter
digestsize = 20
class RedisDataStore:
def __init__(self, loc, db=0):
self.conn = redis.StrictRedis(loc, db=db)
def post_experiment(... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_jobhash' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 134
},
{
"issue": "Function 'job_status' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"seve... | 4 |
python | import random
from sklearn.datasets import fetch_mldata
from util import open_file_in_directory
MNIST_DIR = './tmp/mnist'
MNIST_TRAIN_DIR = './mnist/train'
MNIST_TEST_DIR = './mnist/test'
MNIST_SAMPLE_DIR = './mnist/sample'
TEST_CASES = 60000
def mnist_img_to_file(mnist_img, file):
for x in range(28):
... | Review this code and list any quality issues. | [
{
"issue": "Function 'generate_samples' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 21
}
] | 1 |
python | import ast
import importlib
import logging
import os
import sys
from typing import Dict, Any # noqa: F401
from flask import Flask, Blueprint
from flask_restful import Api
from metadata_service.api.column import ColumnDescriptionAPI
from metadata_service.api.healthcheck import healthcheck
from metadata_service.api.po... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_app' is 53 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 26
}
] | 1 |
python | #!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy 2008-2018 (ita)
"""
MacOSX related tools
"""
import os, shutil, platform
from waflib import Task, Utils
from waflib.TaskGen import taskgen_method, feature, after_method, before_method
app_info = '''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "f... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_task_macapp' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 68
},
{
"issue": "Function 'create_task_macplist' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functi... | 2 |
python | #!/usr/bin/env python
# Copyright 2020 Informatics Matters 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 applicab... | Review this code and list any quality issues. | [
{
"issue": "Function 'execute' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 27
},
{
"issue": "Function 'execute' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"l... | 2 |
python | # Copyright 2021-present citharus
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use utils.py except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_file' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 25
}
] | 1 |
python | """
Pipeline for text processing implementation
"""
from pathlib import Path
import re
import pymorphy2
from pymystem3 import Mystem
from constants import ASSETS_PATH
from core_utils.article import Article, ArtifactType
class EmptyDirectoryError(Exception):
"""
No data to process
"""
class Inconsiste... | Review this code and list any quality issues. | [
{
"issue": "Function '_process' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 124
},
{
"issue": "Function 'validate_dataset' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"... | 3 |
python | # 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 required by applicable law or a... | 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": 47
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 75
}
] | 2 |
python | from .base import Controller
from .base import Action
import numpy as np
import pandas as pd
import pkg_resources
import logging
from collections import namedtuple
logger = logging.getLogger(__name__)
CONTROL_QUEST = '/source/dir/simglucose/params/Quest.csv'
PATIENT_PARA_FILE = '/source/dir/simglucose/params/vpatient_... | Review this code and list any quality issues. | [
{
"issue": "Function 'policy' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 21
},
{
"issue": "Function '_bb_policy' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 34
},
{
"i... | 7 |
python | # Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | Review this code and list any quality issues. | [
{
"issue": "Function 'build_api_url' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 124
},
{
"issue": "Function 'build_api_url' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",... | 6 |
python | from __future__ import division
from thorpy.elements.element import Element
from thorpy.miscgui.constants import STATE_NORMAL
class OneLineText(Element):
def __init__(self, text="", elements=None, normal_params=None):
Element.__init__(self, text, elements, normal_params)
def finish(self):
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": 19
},
{
"issue": "Function 'set_font_effects' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 76
}
] | 2 |
python | '''data_load module is for loading individual genedocs from various data sources.'''
from __future__ import print_function
import sys
import copy
import types
import time
import datetime
import importlib
from biothings.utils.mongo import get_src_conn, get_src_dump, get_data_folder
from biothings.utils.common import get... | Review this code and list any quality issues. | [
{
"issue": "Function 'doc_iterator' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 89
},
{
"issue": "Function 'load' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity"... | 4 |
python | """Rendering Related Tasks"""
from celery import shared_task
import newrelic.agent
from rendering.render_email import compose_email
from mailer.mailserver import deliver
@shared_task
def sample_email(to_address, user_id, email_id, election_id, district_ids):
"""Sample an email to an end user"""
result = comp... | Review this code and list any quality issues. | [
{
"issue": "Function 'sample_email' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 10
}
] | 1 |
python | #
#
# Copyright (C) 2014 Google 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 ... | Review this code and list any quality issues. | [
{
"issue": "Function '_VerifyCertificateStrong' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 61
},
{
"issue": "Function 'GenerateRootSshKeys' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor... | 2 |
python | #
# Copyright (c) 2021 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | Review this code and list any quality issues. | [
{
"issue": "Function '_get_nitro_response' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 194
},
{
"issue": "Function 'add' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"sev... | 3 |
python | # Copyright 2019 The TensorFlow Hub 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 app... | 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": 77
},
{
"issue": "Function 'main' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line":... | 2 |
python | """
Name: Tkinter Exercise - a simple calculator
Description: iOS calculator simulator
Date: 2/21/2018
Author: Haowei Wu
"""
import tkinter
class Calculator:
# Params
app_title = "A simple calculator"
disp_font = ("Helvetica", 25, "bold")
btn_font = ("Helvetica", 20, "bo... | Review this code and list any quality issues. | [
{
"issue": "Function 'set_buttons' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 43
},
{
"issue": "Function 'calculation' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor"... | 4 |
python | from collections import defaultdict
import logging
import random
from faker import Faker
import requests
logger = logging.getLogger(__file__)
def test_create_user():
fake = Faker()
user_info = {
'username': fake.first_name() + str(random.randint(1, 1000)),
'common_name': fake.name(),
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_get_user' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 61
},
{
"issue": "Function 'test_update_user' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"... | 3 |
python | from abc import ABC, abstractmethod
import logging
import os
from typing import Optional, Union, Iterable, Dict
import h5py
import numpy as np
import torch
from PIL import Image
from tqdm import tqdm
from brainio.stimuli import StimulusSet
from model_tools.activations import ActivationsModel
from model_tools.activati... | 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": 72
},
{
"issue": "Function '__init__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"li... | 8 |
python | #!/usr/bin/env python
"""
Configure folder for sCMOS testing.
Hazen 09/17
"""
import numpy
import os
import storm_analysis
import storm_analysis.sa_library.parameters as parameters
import storm_analysis.simulator.emitters_on_grid as emittersOnGrid
import storm_analysis.simulator.emitters_uniform_random as emittersUn... | Review this code and list any quality issues. | [
{
"issue": "Function 'testingParameters' is 44 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 19
},
{
"issue": "Function 'configure' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"lin... | 2 |
python | from pkg_resources import resource_filename
from .base import set_base_parser
from .helper import add_arg_group
from ..helper import get_random_identity
def set_hw_parser(parser=None):
if not parser:
parser = set_base_parser()
gp = add_arg_group(parser, title='General')
gp.add_argument('--workdi... | Review this code and list any quality issues. | [
{
"issue": "Function 'set_hw_parser' is 53 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 8
}
] | 1 |
python | import os, sys
import math
import hydra
import torch
import timm
from hydra.utils import instantiate
from timm.loss import LabelSmoothingCrossEntropy, SoftTargetCrossEntropy
from timm.utils import NativeScaler
import models
from data import create_dataloader
from utils import MetricLogger, SmoothedValue
from utils im... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 18
},
{
"issue": "Function 'main' is 89 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line":... | 2 |
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,... | Review this code and list any quality issues. | [
{
"issue": "Function 'preprocessing_images' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 77
}
] | 1 |
python | # Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# Convert data to textflint format and run transform functions in textflint
import glob
import json
import os
from textflint import Engine
CO... | Review this code and list any quality issues. | [
{
"issue": "Function 'reformat_data_to_textflint' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 43
},
{
"issue": "Function 'reformat_data_to_textflint' is 27 lines long. Functions over 25 lines are harder to test and maint... | 2 |
python | #################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"). ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 29
}
] | 1 |
python | import regex
import argparse
import requests
import time
import os
import threading
import random
execPath = os.getcwd()
currentPath = os.path.dirname(__file__)
os.chdir(currentPath)
FUZZ_PLACE_HOLDER = '??????'
TIMEOUT_DELAY = 5
LOCK = threading.Lock()
parser = argparse.ArgumentParser()
parser.add_argument("--file"... | Review this code and list any quality issues. | [
{
"issue": "Function 'fuzz_SSRF' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 145
},
{
"issue": "Function 'fuzz_SSRF' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 3 |
python | import MySQLdb
from biliClass.biliAid import Aid
import time
def dblink(): # 连接数据库
# demo
return MySQLdb.connect(
host='localhost',
user='root',
passwd='password',
db='nav',
charset='utf8'
)
def dbsql(conn, sql): # 执行sql
cursor = conn.cursor()
cursor... | Review this code and list any quality issues. | [
{
"issue": "Function 'autoUpdata' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 59
},
{
"issue": "Function 'autoUpdata' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | import io
import resource
from pathlib import Path
import numpy as np
import PIL
import pytest
from keras_preprocessing.image import utils
def test_validate_filename(tmpdir):
valid_extensions = ('png', 'jpg')
filename = tmpdir.ensure('test.png')
assert utils.validate_filename(str(filename), valid_extens... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_load_img' is 170 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 25
},
{
"issue": "Function 'test_array_to_img_and_img_to_array' is 71 lines long. Functions over 25 lines are harder to test and maintain.",
"severi... | 2 |
python | from __future__ import absolute_import
import json
from .model import OpenShiftPythonException
class Result(object):
def __init__(self, high_level_operation, tracking_limit=None):
self.high_level_operation = high_level_operation
self.__actions = []
# if tracking_limit is less than 0 that... | Review this code and list any quality issues. | [
{
"issue": "Function 'as_dict' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 61
},
{
"issue": "Function 'as_json' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 73
}
] | 2 |
python | #!/usr/bin/env ccp4-python
"""Module to run sheetbend on a model"""
__author__ = "Adam Simpkin"
__date__ = "05 Aug 2018"
__version__ = "1.0"
import os
from simbad.util import mtz_util
from simbad.mr.refmac_refine import Refmac
from pyjob import cexec
class SheetBend(object):
"""Class to run sheetbend"""
d... | 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": 18
},
{
"issue": "Function 'sheetbend' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 125
}
] | 2 |
python | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables
from ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 18
},
{
"issue": "Function '__init__' is 57 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical... | 3 |
python | #!/usr/bin/env python
# coding: utf-8
"""Download and parse Tanakh from <http://mechon-mamre.org/>.
The text is based on the [Aleppo Codex][1].
[1]: https://en.wikipedia.org/wiki/Aleppo_Codex
Each book is in a separate HTML file (e.g., `c01.htm`) and contains navigation
and textual data.
The relevant structure is:
... | Review this code and list any quality issues. | [
{
"issue": "Function 'count_words' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 95
},
{
"issue": "Function 'count_words' is 52 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major... | 2 |
python | # 作为新框架测试用
import pygame
import os
import json
import platform
import ctypes
from sysconf import *
pygame.init()
# 如果是Windows系统,在游戏中禁用显示缩放
# 注:通常高分屏用户在使用Windows系统时,都会把缩放调到100%以上,否则会瞎眼。
# 例如1920*1080屏幕,Windows推荐的缩放率就是125%。
# 这样会导致游戏窗口被严重放大,造成一部分游戏画面处在任务栏下方。
# 然而,在Linux系统下并没有这问题,所以这里只判定是否为Windows。
if platform.system()... | Review this code and list any quality issues. | [
{
"issue": "Function 'init' is 88 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 42
}
] | 1 |
python | import datetime
import os
from http import HTTPStatus
from operator import attrgetter
from pathlib import Path
from django.conf import settings
from django.contrib.sites.models import Site
from django.template import Context, Template
from django.test import TestCase
from django.urls import reverse, set_urlconf
from ... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_pygments_template_tag' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 174
}
] | 1 |
python | # qubit number=4
# total number=31
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += X(3) # number=1
prog... | Review this code and list any quality issues. | [
{
"issue": "Function 'make_circuit' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 11
}
] | 1 |
python | # Copyright 2013, Nachi Ueno, NTT I3, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | Review this code and list any quality issues. | [
{
"issue": "Function 'vpnservice_set' is 61 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 68
}
] | 1 |
python | """
create errno-specific classes for IO or os calls.
"""
import sys, os, errno
class Error(EnvironmentError):
def __repr__(self):
return "%s.%s %r: %s " %(self.__class__.__module__,
self.__class__.__name__,
self.__class__.__doc__,
... | Review this code and list any quality issues. | [
{
"issue": "Function 'checked_call' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 59
}
] | 1 |
python | import re
import sys
import csv
import json
import pickle
import collections
from pathlib import Path
from tf.fabric import Fabric
from book_formats import get_book_maps, etcbc2sbl, etcbc2abbr
from verb_form import get_verbform, get_cl_verbform
from modify_domain import permissive_q
from synvar_carc import in_dep_calc ... | Review this code and list any quality issues. | [
{
"issue": "Function 'main_row' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 63
},
{
"issue": "Function 'main_row' is 83 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 4 |
python | import pygame
import random
import math
import enemies.enemy
class ZigZagEnemy(enemies.enemy.Enemy):
def __init__(self, game):
super().__init__(game)
self.timer = self.game.getRepeateTimer()
self.timer.duration = 3000
self.timer.action = self.changeAngle
def changeAngle(self):
... | Review this code and list any quality issues. | [
{
"issue": "Function 'update' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 19
}
] | 1 |
python | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 09 09:59:13 2017
@author: as624
"""
import csv
import os
import matplotlib.pyplot as plt
import numpy as np
def output_detection_figures(
image, wells, bacteria, timeindex, output_dir):
"""
Produces and saves figures showing the output from the detection
... | Review this code and list any quality issues. | [
{
"issue": "Function 'output_detection_figures' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 12
},
{
"issue": "Function 'output_tracking_figures' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
... | 4 |
python | # coding: utf-8
#
# This code is part of cmpy.
#
# Copyright (c) 2022, Dylan Jones
"""This module contains methods for modeling disorder."""
import numpy as np
from typing import Union, Sequence
def create_subst_array(
size: int, values: Sequence[float], conc: Union[float, Sequence[float]]
) -> np.ndarray:
... | Review this code and list any quality issues. | [
{
"issue": "Function 'disorder_generator' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 97
}
] | 1 |
python | """
This file offers the methods to automatically retrieve the graph Sphingomonas hankookensis.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--prot... | Review this code and list any quality issues. | [
{
"issue": "Function 'SphingomonasHankookensis' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 30
}
] | 1 |
python | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_parsing_9x9' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 56
}
] | 1 |
python | import dataclasses
from typing import Any, Callable, List, Optional, Type
from wagtail.core.blocks.field_block import CharBlock, FieldBlock, RichTextBlock
from wagtail.core.blocks.stream_block import StreamBlock
from wagtail.core.fields import StreamField
from wagtail.images.blocks import ImageChooserBlock
import str... | Review this code and list any quality issues. | [
{
"issue": "Function '_get_type_for_field_block' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 58
}
] | 1 |
python | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
__a... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 24
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line"... | 2 |
python | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import webbrowser
import sublime
import sublime_plugin
from . import MDETextCommand
from . import plugin_name
from . import settings
from python_utils.misc_utils import get_system_tempdir
from python_utils.mistune_utils import md
from python_utils.sublime_text_util... | Review this code and list any quality issues. | [
{
"issue": "Function 'on_close' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 86
}
] | 1 |
python |
import json
import time
import os
import pandas as pd
import requests
from bs4 import BeautifulSoup
from tqdm import tqdm
def process_9gag(args):
fetched_memes = []
errors = 0
# for i in tqdm(range(args.))
pass
def process_me_dot_me(args):
pass
def templates_imgflip(args):
args.source_url =... | Review this code and list any quality issues. | [
{
"issue": "Function 'templates_imgflip' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 20
},
{
"issue": "Function 'templates_imgflip' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severi... | 4 |
python | from __future__ import absolute_import, print_function, division
import copy
import scipy.sparse
from theano.compile import shared_constructor, SharedVariable
from theano.sparse.basic import SparseType, _sparse_py_operators
class SparseTensorSharedVariable(_sparse_py_operators, SharedVariable):
dtype = property(l... | Review this code and list any quality issues. | [
{
"issue": "Function 'sparse_constructor' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 14
}
] | 1 |
python | """
Examples:
visualizer.py
visualizer.py --map=gen/hz.txt --lm="py:lm_ai.Oscillating(frequency=5)" ghc:fickle.ghc ghc:miner.ghc
Controls:
ESC, q - quit
b - one step back
arrows - control interactive lm
any key - one step of non-interactive lm
"""
import random
import curses
import logging
import ... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 19 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 34
},
{
"issue": "Function 'main' is 104 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 2 |
python | # -*- coding: utf-8 -*-
'''
The caller module is used as a front-end to manage direct calls to the salt
minion modules.
'''
# Import python libs
from __future__ import print_function
import os
import sys
import logging
import datetime
import traceback
# Import salt libs
import salt.exitcodes
import salt.loader
import... | Review this code and list any quality issues. | [
{
"issue": "Function 'call' has cyclomatic complexity 20 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 91
},
{
"issue": "Function 'call' is 88 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"... | 3 |
python | #!/usr/bin/env python
import rospy
from gazebo_msgs.srv import SpawnModel, SpawnModelRequest, SpawnModelResponse
# from gazebo_msgs.srv import ApplyBodyWrench, GetModelProperties, GetWorldProperties, SetModelState
from copy import deepcopy
from tf.transformations import quaternion_from_euler
sdf_cube = """<?xml versi... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_cube_request' has 11 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 335
}
] | 1 |
python | """
Parsed Config File Produces Expected Behaviors - configurations
"""
import inspect
import os
import deeplenstronomy.deeplenstronomy as dl
doc = """
\tRunning tests from test_expected_behaviors_configurations.py
\tThe tests included in this module demonstrate that the properties of each
\tconfiguration wer... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_planes_and_objects' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 112
},
{
"issue": "Function 'test_planes_and_objects' is 28 lines long. Functions over 25 lines are harder to test and maintain.... | 2 |
python | # -*- coding: utf-8 -*-
import pytest
from plexapi.exceptions import BadRequest, NotFound
from . import conftest as utils
def test_myplex_accounts(account, plex):
assert account, "Must specify username, password & resource to run this test."
print("MyPlexAccount:")
print("username: %s" % account.username... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_myplex_createExistingUser' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 204
}
] | 1 |
python | import os
from aiohttp import web
from app.utility.logger import Logger
class FileSvc:
def __init__(self, payload_dirs, exfil_dir):
self.payload_dirs = payload_dirs
self.log = Logger('file_svc')
self.exfil_dir = exfil_dir
async def download(self, request):
name = request.he... | Review this code and list any quality issues. | [
{
"issue": "Function 'upload' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 31
}
] | 1 |
python | # -*- coding: utf-8 -*-
# Copyright 2018 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 ... | 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": 34
},
{
"issue": "Function 'run' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 34... | 4 |
python | from typing import Callable
from datetime import datetime, timezone
from time import mktime
from ..common.const import (
MILESTONES_USING_TIMESTAMP_ONLY,
TIMESTAMP_B,
TIMESTAMP_E,
ATCH_TIMESTAMP_B,
ATCH_TIMESTAMP_E
)
from ..common import tryte_to_int
import logging
__all__ = [
'TimeFilter',
]
... | Review this code and list any quality issues. | [
{
"issue": "Function 'make_filter' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 282
},
{
"issue": "Function 'make_dmp_filter' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
... | 2 |
python | # coding: utf-8
import pprint
import re
import six
class KeystoneAssociateGroupWithProjectPermissionRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_dict' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 117
}
] | 1 |
python | # Copyright 2018 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 'jacobian' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 28
},
{
"issue": "Function 'batch_jacobian' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 2 |
python | """
Empatica E4 is a wearable device that offers real-time physiological data
acquisition such as blood volume pulse, electrodermal activity (EDA), heart
rate, interbeat intervals, 3-axis acceleration and skin temperature.
"""
import os
import random
import numpy as np
import pandas as pd
class EmpaticaReader:
... | Review this code and list any quality issues. | [
{
"issue": "Function 'write' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 92
},
{
"issue": "Function 'timeshift' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": ... | 5 |
python | import pandas as pd
from typing import Tuple
from .data_processing import UNKNOWN_ID_REGEX
from .utils import calcDeltas
__all__ = [
"filterKnownOrbits",
"filterOrbits"
]
def filterKnownOrbits(
orbits: pd.DataFrame,
orbit_observations: pd.DataFrame,
associations: pd.DataFrame,
... | Review this code and list any quality issues. | [
{
"issue": "Function 'filterKnownOrbits' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 12
},
{
"issue": "Function 'filterOrbits' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"... | 3 |
python | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 70
},
{
"issue": "Function 'execute' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 85
}
] | 2 |
python | # See LICENSE for licensing information.
#
# Copyright (c) 2021 Regents of the University of California and The Board
# of Regents for the Oklahoma Agricultural and Mechanical College
# (acting for and on behalf of Oklahoma State University)
# All rights reserved.
#
from policy import replacement_policy as rp
from glob... | Review this code and list any quality issues. | [
{
"issue": "Function 'reset' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 25
},
{
"issue": "Function 'write_word' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line":... | 2 |
python | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_prediction_module' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 75
}
] | 1 |
python | import numpy
import chainer
from chainer.backends import cuda
from chainer import function_node
from chainer.functions.pooling import pooling_2d
from chainer.utils import conv
class AveragePooling2D(pooling_2d.Pooling2D):
"""Average pooling over a set of 2d planes."""
# TODO(beam2d): Support cover_all mode.... | Review this code and list any quality issues. | [
{
"issue": "Function 'forward_gpu' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 24
},
{
"issue": "Function 'forward_gpu' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 2 |
python | from __future__ import division
from tkinter import *
import tkMessageBox
from PIL import Image, ImageTk
import os
import glob
import random
w0 = 1 #图片原始宽度
h0 = 1 #图片原始高度
# colors for the bboxes
COLORS = ['red','blue','yellow','pink','cyan','green','black']
#image size
SIZE = 256,256
#指定缩放后的图像大小
DEST_SIZE = 500,50... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 73 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 23
},
{
"issue": "Function 'loadDir.loadImage' is 50 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line... | 6 |
python | # SPDX-FileCopyrightText: 2020 Melissa LeBlanc-Williams, written for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
"""
`adafruit_pyportal.network`
================================================================================
CircuitPython driver for Adafruit PyPortal.
* Author(s): Limor Fried, Kevin J... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 74
},
{
"issue": "Function '__init__' has 13 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 74
... | 5 |
python | import logging
import pandas as pd
from ast import literal_eval
from .constants import NUMBERING_RESULTS
from sadie.numbering.scheme_numbering import scheme_numbering
logger = logging.getLogger("NUMBERING")
class NumberingResults(pd.DataFrame):
def __init__(self, *args, scheme="", region_definition="", allowed_... | 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": 12
},
{
"issue": "Function '_get_region' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 45
},
... | 3 |
python | # coding: utf-8
import pprint
import re
import six
class UpdateApplicationEndpointRequestBody:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_dict' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 93
}
] | 1 |
python | """Semantic analysis of TypedDict definitions."""
from mypy.backports import OrderedDict
from typing import Optional, List, Set, Tuple
from typing_extensions import Final
from mypy.types import Type, AnyType, TypeOfAny, TypedDictType, TPDICT_NAMES
from mypy.nodes import (
CallExpr, TypedDictExpr, Expression, Name... | Review this code and list any quality issues. | [
{
"issue": "Function 'analyze_typeddict_classdef' has cyclomatic complexity 18 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 35
},
{
"issue": "Function 'analyze_typeddict_classdef' is 55 lines long. Functions over 25 lines are harder to test and m... | 9 |
python | from bs4 import BeautifulSoup
import requests
import os
class App:
def __init__(self):
self.userlist = []
self.headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"}
self.page = 1
... | Review this code and list any quality issues. | [
{
"issue": "Function 'Scarping' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 33
}
] | 1 |
python | """
Diagnostic:
Diagnostic to produce images of the profile over time from a cube.
These plost show cube value (ie temperature) on the x-axis, and depth/height
on the y axis. The colour scale is the annual mean of the cube data.
Note that this diagnostic assumes that the preprocessors do the bulk of the
hard work, an... | Review this code and list any quality issues. | [
{
"issue": "Function 'determine_profiles_str' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 50
},
{
"issue": "Function 'make_profiles_plots' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
... | 2 |
python | import nltk
from langdetect import detect
import csv
class Tokenize:
""" Text tokenizer """
def __init__(self):
""" Default constructor """
self.language = "en"
self.workDirectory = "/run/media/jf/Datos/Tourist Text Mining/datasets/colombia_en/"
self.tagFilename = "t... | Review this code and list any quality issues. | [
{
"issue": "Function 'tokenizing' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 47
},
{
"issue": "Function 'tagFrequencies' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"se... | 5 |
python | import click
from cmsis_svd.parser import SVDParser
MCU_OPTIONS = [
'STM32F0xx',
]
MCU2VENDOR_FILE = {
'STM32F0xx': ('STMicro', 'STM32F0xx.svd'),
}
ALL = 'show_all'
def show_register(register):
fields = []
for field in register.fields:
upper_index = field.bit_offset + field.bit_width - 1
... | 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": 40
}
] | 1 |
python | from mycv.utils.general import disable_multithreads
disable_multithreads()
import os
from pathlib import Path
import argparse
from tqdm import tqdm
import math
import torch
import torch.cuda.amp as amp
from torch.optim.lr_scheduler import LambdaLR
from torch.nn.parallel import DistributedDataParallel as DDP
import wand... | Review this code and list any quality issues. | [
{
"issue": "Function 'train' has cyclomatic complexity 50 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 28
},
{
"issue": "Function 'train' is 259 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 2 |
python | # Copyright 2019-2020 ETH Zurich and the DaCe authors. All rights reserved.
import copy
from io import StringIO
import os
import sys
import traceback
from dace.sdfg import SDFG
from dace.transformation.optimizer import Optimizer
class TransformationTester(Optimizer):
""" An SDFG optimizer that consecutively appl... | 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 '_optimize_recursive' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "min... | 3 |
python | import pygame
from snake.resources.constants import BLOCK_SIZE, WIDTH, HEIGHT
from snake.resources.directions import Direction
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
self.f = 0
self.g = 0
self.h = 0
self.neighbors = []
self.origin = Non... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_direction' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 23
}
] | 1 |
python | # author: Carlina Kim, Karanpal Singh, Sukriti Trehan, Victor Cuspinera
# date: 2020-06-21
'''This script will read the saved theme/subtheme model(s), padded validation sets and y validation sets for model evaluation,
and will save the evaluation results in the specified directory.
There are 2 parameters Input Path ... | Review this code and list any quality issues. | [
{
"issue": "Function 'eval_metrics' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 48
},
{
"issue": "Function 'eval_metrics' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 48
... | 3 |
python | import collections
import io
from typing import BinaryIO, Tuple, Union
import warnings
import numpy
import skimage.io
import skimage.measure
import skimage.morphology
import skimage.segmentation
import skimage.transform
from .base import BaseSegmentationHelper
class ScikitSegmentationHelper(BaseSegmentationHelper):... | Review this code and list any quality issues. | [
{
"issue": "Function '_floodFill' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 97
},
{
"issue": "Function '_floodFill' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 97
},
... | 3 |
python | import math
import torch
import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import (build_conv_layer, build_norm_layer, constant_init,
kaiming_init)
from mmcv.runner import load_checkpoint
from torch.nn.modules.batchnorm import _BatchNorm
from mmdet.utils import get_root_log... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 20
},
{
"issue": "Function '__init__' is 76 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical"... | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.