language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | from ravager.services.google.helpers import uploader
from ravager.database.helpers.structs import OpsDataStruct
from ravager.database.tasks import Tasks
from ravager.celery_tasks.tasks import app
from ravager.services.aria.download import Download
from telegram.ext import CallbackQueryHandler
import logging
logger = l... | Review this code and list any quality issues. | [
{
"issue": "Function 'callback_handler' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 16
},
{
"issue": "Function 'abort_task' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"... | 3 |
python | # coding: utf-8
import pprint
import re
import six
class BatchTagActionRequestBody:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and th... | 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": 91
}
] | 1 |
python | from abc import ABC, abstractmethod
from typing import Any, Callable, List, Optional, SupportsAbs, Tuple, TypeVar
import libvirt
from assisted_test_infra.test_infra import BaseEntityConfig
from assisted_test_infra.test_infra.controllers.node_controllers.disk import Disk
from assisted_test_infra.test_infra.controllers... | Review this code and list any quality issues. | [
{
"issue": "Function 'attach_test_disk' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 85
}
] | 1 |
python | # coding: utf-8
# -----------------------------------------------------------------------------------
# <copyright company="Aspose" file="bookmark_data.py">
# Copyright (c) 2020 Aspose.Words for Cloud
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of thi... | 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": 111
},
{
"issue": "Function 'to_json' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": ... | 2 |
python | # -*- coding: utf-8 -*-
# Copyright 2020 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... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_channel' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 54
},
{
"issue": "Function '__init__' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
... | 4 |
python | import csv
import difflib
import shutil
from collections import defaultdict
from statistics import mean
from pytablewriter import MarkdownTableWriter
from tqdm import tqdm
from utils.config import CORRECT_PATCHES, INPUT, REPAIR_OUTPUT, REPAIR_RESULT
class Result:
def __init__(self, buggy_file_line_dir, comparis... | 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": 14
},
{
"issue": "Function 'main' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 8... | 3 |
python | """Arrow plots for mechanism."""
import os
from src.plot_utils import ps_defaults
from src.constants import FIGURE_PATH
from typing import Optional
import matplotlib.pyplot as plt
def plot_arrow_plot(save_path: Optional[str] = None, show_plots: bool = False) -> None:
"""
Plot the arrow plot to show that I hav... | Review this code and list any quality issues. | [
{
"issue": "Function 'plot_arrow_plot' is 74 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 9
},
{
"issue": "Function 'plot_arrow_plot_6' is 93 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 2 |
python | # -*- coding: UTF8
'''
Created on 13.07.2015
@author: mEDI
'''
from elite.system import system as elitesystem
#from elite.rares import rares as eliterares
# from elite.route import route as eliteroute
class route(object):
'''
classdocs
'''
#__slots__ = ["bla"]
#bla =1
maxHops = None
... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 41
},
{
"issue": "Function 'addPossibleSystems' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 61
},
... | 12 |
python | #simple example of how a plugin should look like
#this plugin simply makes the bot responde with a simple string to every message received.
import time
import threading
import simplejson
import urllib2
def set_interval(func, sec):
def func_wrapper():
set_interval(func, sec)
func()
t = threadin... | Review this code and list any quality issues. | [
{
"issue": "Function 'check_stream' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 35
}
] | 1 |
python | # coding: utf-8
"""
Deals
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v3
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from hubspot... | 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": 53
},
{
"issue": "Function 'to_dict' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"lin... | 2 |
python | import cv2
import numpy as np
from Sim3DR import RenderPipeline
from .pose_operations import plot_3d_landmark
def _to_ctype(arr):
if not arr.flags.c_contiguous:
return arr.copy(order="C")
return arr
def get_colors(img, ver):
h, w, _ = img.shape
ver[0, :] = np.minimum(np.maximum(ver[0, :], 0... | Review this code and list any quality issues. | [
{
"issue": "Function 'render' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 73
},
{
"issue": "Function 'save_to_obj' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line... | 3 |
python | import ROOT, sys, uuid
from PlotStyle import *
from SharedData import *
# plot histograms ----------------------------------------------------------------------------------
def Plot(data, mcs, drawP, tag):
canvas = ROOT.TCanvas(str(uuid.uuid4()), '', 440, 100, GetW(), GetH())
SetCanvas(canvas)
if 'x' in dr... | Review this code and list any quality issues. | [
{
"issue": "Function 'Plot' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 6
},
{
"issue": "Function 'Plot' is 81 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 6... | 2 |
python | from data_collection.management.commands import BaseShpStationsShpDistrictsImporter
class Command(BaseShpStationsShpDistrictsImporter):
council_id = 'E07000098'
srid = 27700
districts_srid = 27700
districts_name = 'PollingDistricts'
stations_name = 'PollingStations.shp'
elections = [
'l... | Review this code and list any quality issues. | [
{
"issue": "Function 'format_address' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 21
}
] | 1 |
python | """Helper functions for dealing with repeated fields.
It comes up in a few places that we need to flatten or unflatten repeated
columns when using them in conjunction with other repeated or scalar fields.
These functions allow us to flatten into non-repeated columns to apply various
operations and then unflatten back ... | Review this code and list any quality issues. | [
{
"issue": "Function 'flatten_column_values' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 60
},
{
"issue": "Function 'columns_have_allowed_repetition_counts' has cyclomatic complexity 7 (threshold: 5). Consider breaking i... | 2 |
python | import pandas as pd
import numpy as np
from sklearn import linear_model
import logging
def linear_regression(
data=None, dependent=None, predictors=None, regressions='available',
noise=False, inplace=False):
"""Performs simple or multiple linear regression imputation on the data.
First, the re... | Review this code and list any quality issues. | [
{
"issue": "Function 'linear_regression' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 7
},
{
"issue": "Function 'linear_regression' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severi... | 7 |
python | import inspect
import logging
import asyncio
from urllib import error
from functools import partial
from .const import DOMAIN, JLR_DATA
from .util import convert_temp_value
_LOGGER = logging.getLogger(__name__)
class JLRService:
def __init__(self, hass, config_entry, vin):
self.hass = hass
self.... | Review this code and list any quality issues. | [
{
"issue": "Function 'validate_service_call' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 24
},
{
"issue": "Function 'async_call_service' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"s... | 6 |
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 (t... | Review this code and list any quality issues. | [
{
"issue": "Function '_get_activities_data' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 104
},
{
"issue": "Function '_get_activities_data' is 44 lines long. Functions over 25 lines are harder to test and maintain.",
... | 5 |
python | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# -*- coding: utf-8 -*-
"""
# @Time : 2019/5/27
# @Author : Jiaqi&Zecheng
# @File : sem_utils.py
# @Software: PyCharm
"""
import os
import json
import re as regex
import spacy
from nltk.stem import WordNetLemmatizer
wordnet_lemmatizer =... | Review this code and list any quality issues. | [
{
"issue": "Function 'is_partial_match' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 31
},
{
"issue": "Function 'random_choice' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
... | 5 |
python | """Simple HTTP Server.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
__version__ = "0.6"
__all__ = ["SimpleHTTPRequestHandler"]
import os
import posixpath
import BaseHTTPServer
import urllib
import cgi
import shutil
import mimetypes... | Review this code and list any quality issues. | [
{
"issue": "Function 'send_head' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 54
},
{
"issue": "Function 'send_head' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 3 |
python | import torch
import kornia
from kornia.augmentation.base import TensorWithTransformMat, _AugmentationBase
from kornia.augmentation.utils import _transform_input3d, _validate_input_dtype
class AugmentationBase3D(_AugmentationBase):
r"""AugmentationBase3D base class for customized augmentation implementations.
... | Review this code and list any quality issues. | [
{
"issue": "Function '__check_batching__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 24
}
] | 1 |
python | #!/usr/bin/env python
'''module containing various functions for working with trees and nodes'''
from node_parser import NodeParser
import unittest
def depth(node):
'''compute the depth of the given tree'''
if node is None:
return 0
elif node.is_leaf():
return 1
else:
return 1... | Review this code and list any quality issues. | [
{
"issue": "Function 'depth_first_iterator' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 18
}
] | 1 |
python | # -*- coding: utf-8 -*-
# Copyright 2020 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... | 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": 46
},
{
"issue": "Function '__init__' is 71 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical"... | 4 |
python | # coding: utf-8
import wx
from enum import IntEnum
from bookworm import speech
from bookworm.gui.settings import SettingsPanel
from bookworm.structured_text import TextRange
from bookworm.logger import logger
from .annotator import Bookmarker, NoteTaker, Quoter
from .annotation_dialogs import (
BookmarksViewer,
... | Review this code and list any quality issues. | [
{
"issue": "Function 'addControls' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 24
},
{
"issue": "Function '__init__' is 59 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 81
... | 4 |
python | # coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 3
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from isi_sdk_8_0.models.group_mem... | 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": 138
}
] | 1 |
python | """Provides a scanner that will group files together under a common prefix"""
import copy
from .abstract_scanner import AbstractScanner
class SlurpScanner(AbstractScanner):
"""SlurpScanner groups files together by a common prefix.
This works by looking at the first slash (or if there is no slash, the first ... | Review this code and list any quality issues. | [
{
"issue": "Function 'discover' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 17
},
{
"issue": "Function '_add_acquisition' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 53
}
] | 2 |
python | #!/usr/bin/env python3
# Copyright (c) 2014-2021 The Beans Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the di... | Review this code and list any quality issues. | [
{
"issue": "Function 'name_to_bip155' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 45
},
{
"issue": "Function 'name_to_bip155' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity... | 2 |
python | # -*- coding: utf-8 -*-
"""
@author: Sushant
"""
import numpy as np
import scipy
######################################## Least Square Linear Regression ####################################
def LinearRegression(data,labels):
numdata = int( np.size(data,0) )
b1 = np.hstack(( data,np.ones((numdat... | Review this code and list any quality issues. | [
{
"issue": "Function 'KernelRidgeRegression' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 54
},
{
"issue": "Function 'KernelRidgesRegression_predict' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "min... | 2 |
python | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------------------... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 46 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 155
}
] | 1 |
python | #! /usr/bin/env python3
import matplotlib
matplotlib.use('agg')
import argparse
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import logging
default_title = "Metagene profile Bayes' factors"
default_xlabel = "Offset, relative to translation \ninitiation site"
default_ylabel = "Bayes' factor"... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 19
}
] | 1 |
python | import numpy as np
from .utils import _checkTime
from .vectors import calcNae
from .vectors import calcDelta
from .vectors import calcXae
from .vectors import calcXa
from .vectors import calcNhat
from .vectors import calcR1
from .vectors import calcR2
from .projections import cartesianToGnomonic
from .coordinates impo... | Review this code and list any quality issues. | [
{
"issue": "Function 'prepare' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 36
},
{
"issue": "Function 'applyToObservations' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
... | 4 |
python | #!/usr/bin/env python
#
# Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | Review this code and list any quality issues. | [
{
"issue": "Function 'setUp' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 33
}
] | 1 |
python | """ Functions related to writing to and retrieving from cache files
"""
import os
import numpy as np
from log_yatsm import logger
_image_ID_str = 'image_IDs'
def get_line_cache_name(dataset_config, n_images, row, nbands):
""" Returns cache filename for specified config and line number
Args:
datase... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_cache' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 57
},
{
"issue": "Function 'update_cache_file' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
... | 4 |
python | #!/usr/bin/env python
# coding=utf-8
#
# Python Script
#
# Copyleft © Manoel Vilela
#
#
WIDTH,HEIGHT = 2,3
from random import shuffle, randrange
def make_maze(w=WIDTH, h=HEIGHT):
vis = [[0] * w + [1] for _ in range(h)] + [[1] * (w + 1)]
nowalls = []
def walk(x, y):
vis[x][y] = 1
d =... | Review this code and list any quality issues. | [
{
"issue": "Function 'draw_maze' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 36
}
] | 1 |
python | #!/usr/bin/env python
#
# (c) 2016 -- onwards Georgios Gousios <gousiosg@gmail.com>, Rik Nijessen <riknijessen@gmail.com>
#
from __future__ import print_function
import pickle
import random
import urllib
import numpy as np
import argparse
from config import *
from code_tokenizer import CodeTokenizer
from my_tokeniz... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_dataset' is 67 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 109
},
{
"issue": "Function 'create_dataset' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line":... | 2 |
python | #!/usr/bin/env python3
# Copyright (c) 2017-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test various fingerprinting protections.
If a stale block more than a month old or its header are requ... | Review this code and list any quality issues. | [
{
"issue": "Function 'build_chain' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 34
},
{
"issue": "Function 'run_test' is 43 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 76
}
] | 2 |
python | #!/usr/bin/env python
import os
import argparse
from pymatflow.structure.neb import interpolate
from pymatflow.cmd.structflow import read_structure
from pymatflow.cmd.structflow import write_structure
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--images", type=s... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 12
}
] | 1 |
python | from collections import namedtuple
from itertools import groupby
from pathlib import Path
from typing import List, Optional
from urllib.parse import unquote, urlparse
from loguru import logger
from flexget import plugin
from flexget.components.ftp.sftp_client import SftpClient, SftpError
from flexget.config_schema im... | Review this code and list any quality issues. | [
{
"issue": "Function 'on_task_download' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 180
},
{
"issue": "Function 'handle_entry' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
... | 2 |
python | #!/usr/bin/python
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#|R|a|s|p|b|e|r|r|y|P|i|.|c|o|m|.|t|w|
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# Copyright (c) 2016, raspberrypi.com.tw
# All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# paino_buzzer.py... | Review this code and list any quality issues. | [
{
"issue": "Function 'mycallback' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 61
}
] | 1 |
python | from functools import reduce
from sklearn.preprocessing import MinMaxScaler, MaxAbsScaler, StandardScaler
from optimus.engines.base.columns import BaseColumns
from optimus.helpers.columns import parse_columns, name_col
from optimus.helpers.constants import Actions
from optimus.helpers.raiseit import RaiseIt
class D... | Review this code and list any quality issues. | [
{
"issue": "Function 'replace_regex' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 65
},
{
"issue": "Function 'apply_by_dtypes' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 97
}... | 4 |
python | import functools
from flask import Flask, request, make_response, jsonify
from flask_restful import Resource, Api, abort
from project.server.models import User
def login_required(method):
@functools.wraps(method)
def wrapper(self):
auth_header = request.headers.get('Authorization')
if auth_head... | Review this code and list any quality issues. | [
{
"issue": "Function 'login_required.wrapper' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 8
},
{
"issue": "Function 'admin_required.wrapper' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller f... | 2 |
python | #!/usr/bin/env python
import numpy as np
from randomPlayer import RandomPlayer
import game
import play
# Run MCTS with MC to estimate the rest of the game.
# http://mcts.ai/about/index.html
# http://ccg.doc.gold.ac.uk/wp-content/uploads/2016/10/browne_tciaig12_1.pdf
class UCT:
def __init__(self, c):
sel... | 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": 47
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 146
},
{
"... | 3 |
python | # -*- coding: utf-8 -*-
"""
tests.controllers.test_api_controller
"""
import jsonpickle
from .controller_test_base import *
from moesifapi.models import *
from datetime import *
class ApiControllerTests(ControllerTestBase):
@classmethod
def setUpClass(cls):
super(ApiControllerTests, cls).setUp... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_add_event' is 57 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 22
}
] | 1 |
python | # coding=utf-8
# Copyright 2020 The TensorFlow Datasets 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 appl... | Review this code and list any quality issues. | [
{
"issue": "Function 'as_numpy' has cyclomatic complexity 17 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 44
},
{
"issue": "Function 'as_numpy' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical... | 2 |
python | # -*- coding: utf-8 -*-
"""
Datary python sdk Datasets test file
"""
import mock
from datary.test.test_datary import DataryTestCase
from datary.test.mock_requests import MockRequestResponse
class DataryDatasetsTestCase(DataryTestCase):
"""
DataryDatasets Test case
"""
@mock.patch('datary.requests.re... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_get_original' is 52 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 52
},
{
"issue": "Function 'test_get_dataset_uuid' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "mino... | 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 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 25
},
{
"issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line... | 2 |
python | class Solution:
def getSkyline(self, buildings: 'List[List[int]]') -> 'List[List[int]]':
"""
Divide-and-conquer algorithm to solve skyline problem,
which is similar with the merge sort algorithm.
"""
n = len(buildings)
# The base cases
if n == 0:
r... | Review this code and list any quality issues. | [
{
"issue": "Function 'merge_skylines.append_skyline' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 40
}
] | 1 |
python | #
# OtterTune - parser.py
#
# Copyright (c) 2017-18, Carnegie Mellon University Database Group
#
'''
Created on Dec 12, 2017
@author: dvanaken
'''
from website.models import DBMSCatalog
from website.types import DBMSType
from .myrocks import MyRocks56Parser
from .mysql import MySql57Parser
from .postgres import Pos... | Review this code and list any quality issues. | [
{
"issue": "Function '__utils' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 27
}
] | 1 |
python | from typing import Union
import torch
import torch.nn as nn
import torch.utils.data
from torch.optim.lr_scheduler import _LRScheduler, ReduceLROnPlateau
from torch.optim.optimizer import Optimizer
from mighty.loss import LossPenalty
from mighty.models import AutoencoderLinear
from mighty.monitor.monitor import Monito... | 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": 52
}
] | 1 |
python | import copy
import inspect
from typing import Any, List, Dict, Optional, Union # noqa
from chalice.app import Chalice, RouteEntry, Authorizer, CORSConfig # noqa
from chalice.app import ChaliceAuthorizer
from chalice.deploy.planner import StringFormat
from chalice.deploy.models import RestAPI # noqa
from chalice.ut... | Review this code and list any quality issues. | [
{
"issue": "Function '_add_route_paths' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 54
},
{
"issue": "Function '_generate_route_method' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functi... | 3 |
python | from nltk.corpus.reader.api import SyntaxCorpusReader
from nltk.corpus.reader import xmldocs
from nltk import tree
from nltk.util import LazyMap, LazyConcatenation
from nltk.corpus.reader.util import concat
def parsed(element):
"""Converts a 'sentence' XML element (xml.etree.ElementTree.Element) to
an NLTK tr... | Review this code and list any quality issues. | [
{
"issue": "Function 'parsed' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 8
}
] | 1 |
python | from collections import defaultdict
from billy.scrape.legislators import Legislator, LegislatorScraper
import lxml.html
class KYLegislatorScraper(LegislatorScraper):
jurisdiction = 'ky'
latest_only = True
def scrape(self, chamber, year):
if chamber == 'upper':
leg_list_url = 'http:... | Review this code and list any quality issues. | [
{
"issue": "Function 'scrape_office_info' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 25
},
{
"issue": "Function 'scrape_office_info' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"seve... | 4 |
python | import logging
import os
from ebooklib import epub
logger = logging.getLogger('EPUB_BINDER')
def make_intro_page(crawler):
html = '<div style="padding-top: 25%; text-align: center;">'
html += '<h1>%s</h1>' % (crawler.novel_title or 'N/A')
html += '<h3>%s</h3>' % (crawler.novel_author or 'N/A').replace('... | Review this code and list any quality issues. | [
{
"issue": "Function 'bind_epub_book' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 36
}
] | 1 |
python | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""This module contains additional behavior that can be attached to any given
package.
"""
import collections
import os
i... | 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": 55
},
{
"issue": "Function '__init__' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 3 |
python | import torch
from torch import nn
import torch.nn.functional as F
import sys
from .backbones.resnet import ResNet
sys.path.append('.')
EPSILON = 1e-12
def weights_init_kaiming(m):
classname = m.__class__.__name__
if classname.find('Linear') != -1:
nn.init.kaiming_normal_(m.weight, a=0, mode='fan_ou... | Review this code and list any quality issues. | [
{
"issue": "Function 'weights_init_kaiming' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 13
},
{
"issue": "Function 'forward' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
... | 7 |
python | import argparse
import json
import os
import sys
import requests
from tqdm import tqdm
def parse_arguments():
parser = argparse.ArgumentParser()
parser.add_argument("--download_dir", type=str, default="/root/downloads/")
parser.add_argument("--bert", action="store_true", help="download a bert model (defa... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 24
},
{
"issue": "Function 'main' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line":... | 2 |
python | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_create_session' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 128
}
] | 1 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import MySQLdb
_connectedDb = None
_dbCursor = None
def ConnectToDb(self, userID, userPassword):
if self._connectedDb is not None:
DisconnectDb(self)
self._connectedDb = MySQLdb.connect(host="localhost", user = userID, passwd=userPassword)
self._dbCursor = self._co... | Review this code and list any quality issues. | [
{
"issue": "Function 'InsertIntoDb' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 21
},
{
"issue": "Function 'UpdateDb' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 35
},
{
... | 5 |
python | #!/usr/bin/env python3
# Copyright (c) 2004-present Facebook All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from pyinventory.api.equipment_type import add_equipment_type
from pyinventory.api.service import add_service
from pyinventory.api.serv... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_service_type_edited' is 44 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 68
}
] | 1 |
python | from io import BytesIO
from PIL import Image
from django.conf import settings
from django.db import models
from pilkit.processors import ProcessorPipeline
from pilkit.utils import save_image
from sortedm2m.fields import SortedManyToManyField
from .forms import PhotoFieldWidget
__all__ = ('PhotoField', 'ManyPhotosFie... | 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": 17
},
{
"issue": "Function 'process_file' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"l... | 5 |
python | import os
from flask import (
Flask, flash, render_template, redirect, request, session, url_for)
from flask_pymongo import PyMongo
from bson.objectid import ObjectId
from werkzeug.security import generate_password_hash, check_password_hash
if os.path.exists("env.py"):
import env
app = Flask(__name__)
app.c... | Review this code and list any quality issues. | [
{
"issue": "Function 'edit_recipe' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 158
}
] | 1 |
python | # Time: O(m * n * sqrt(m * n))
# Space: O(m * n)
# the problem is the same as google codejam 2008 round 3 problem C
# https://github.com/kamyu104/GoogleCodeJam-2008/blob/master/Round%203/no_cheating.py
import collections
from functools import partial
# Time: O(E * sqrt(V))
# Space: O(V)
# Source code from http:/... | Review this code and list any quality issues. | [
{
"issue": "Function 'bipartiteMatch.recurse' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 74
},
{
"issue": "Function 'bipartiteMatch' has cyclomatic complexity 19 (threshold: 5). Consider breaking it into smaller functio... | 7 |
python | import gym
from gym import spaces
from gym.envs.registration import EnvSpec
import numpy as np
from mpe.multi_discrete import MultiDiscrete
import copy
# environment for all agents in the multiagent world
# currently code assumes that no agents will be created/destroyed at runtime!
class MultiAgentEnv(gym.Env):
me... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 15
},
{
"issue": "Function '__init__' is 53 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical... | 9 |
python | # -*- coding: utf-8 -*-
"""
Created on Wed May 08 16:11:28 2013
@author: kshmirko
"""
import re
from ios.readMeteoBlock import readMeteoFile, readMeteoCtx
import StringIO
from datetime import datetime, timedelta
class ParserException(Exception):
def __init__(self, text):
super(ParserException, self).__in... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse_observation' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 42
}
] | 1 |
python | #! /usr/bin/env python3
import argparse
import logging
from xlsx2csv import Xlsx2csv
from io import StringIO
import csv
import os
import subprocess
import utils.ht_source
def parse_header_row(hr):
mapping = {}
for i, col in enumerate(hr):
mapping[col.lower()] = i
return mapping
def handle_r... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 40
},
{
"issue": "Function 'main' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 2 |
python | # -*- coding: utf-8 -*-
"""
An Eve Online Cargo Scanner
"""
import time
import json
from flask import (
g, flash, request, render_template, url_for, redirect, session,
send_from_directory, abort)
from sqlalchemy import desc
import evepaste
from helpers import login_required
from estimate import get_market... | Review this code and list any quality issues. | [
{
"issue": "Function 'estimate_cost' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 21
},
{
"issue": "Function 'display_result' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "m... | 2 |
python | #!/usr/bin/env python3
# Copyright (c) 2017-2019 The bitphantom Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Tests NODE_NETWORK_LIMITED.
Tests that a node configured with -prune=550 signals NODE_NETWORK_LIMIT... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_test' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 55
}
] | 1 |
python | """
Copyright (c) 2019 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | Review this code and list any quality issues. | [
{
"issue": "Function '_prepare_coco_structures' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 111
},
{
"issue": "Function '_prepare_coco_structures' is 37 lines long. Functions over 25 lines are harder to test and maintai... | 4 |
python | from typing import Union, Dict, Optional, List
import torch
from torch import Tensor, nn
import torch.nn.functional as F
from torch_geometric.typing import NodeType, EdgeType, Metadata, Adj
from torch_geometric.nn.dense import Linear
from torch_geometric.utils import softmax
from torch_geometric.nn.conv impo... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 59
},
{
"issue": "Function '__init__' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 59
}... | 4 |
python | #!/usr/bin/python
#
# Copyright 2019 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_container_command_args.sanitize_str' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 30
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
... | 2 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright 2020, Yutong Xie, UIUC.
Using recursion to validate BST
'''
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.rig... | Review this code and list any quality issues. | [
{
"issue": "Function 'isValidBST.helper' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 21
}
] | 1 |
python | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1.12.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import r... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_api_group_with_http_info' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 57
}
] | 1 |
python | ''' A rendering of the 2014 monthly calendar.
This example demonstrates the usage of plotting several
plots together using ``gridplot``.
A hover tooltip displays the US holidays on the significant dates.
.. bokeh-example-metadata::
:sampledata: us_holidays
:apis: bokeh.layouts.gridplot, bokeh.models.tools.Ho... | Review this code and list any quality issues. | [
{
"issue": "Function 'make_calendar' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 27
},
{
"issue": "Function 'make_calendar' is 50 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "m... | 2 |
python | #!/usr/bin/env python3
# ===============================================================================
# NAME: XmlPortsParser.py
#
# DESCRIPTION: This class parses the XML port types files.
#
# USAGE:
#
# AUTHOR: reder
# EMAIL: reder@jpl.nasa.gov
# DATE CREATED : Feb. 4, 2013
#
# Copyright 2007, California Institu... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 33 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 48
},
{
"issue": "Function '__init__' is 126 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critica... | 3 |
python | from __future__ import absolute_import
import os
import shutil
import subprocess
import logging
import pytest
import dockerdb.mongo
CONTAINER_CACHE = {}
LOG = logging.getLogger(__name__)
def insert_data(client, data):
for db in data:
for collection in data[db]:
entries = data[db][collectio... | Review this code and list any quality issues. | [
{
"issue": "Function 'mongo_fixture' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 51
}
] | 1 |
python | import numpy as np
import os
import shutil
import glob as glob
def get_slurm_script(script_name,command,outdir,idir,mail,log,part,nodes,threads,time,job_name):
if os.path.isdir(outdir+'/run') == False:
os.mkdir(outdir+'/run')
file_name = outdir + '/run/' + script_name
f = open(file_name,'w')
... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_slurm_script' is 44 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 6
},
{
"issue": "Function 'get_slurm_script' has 11 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
... | 2 |
python | # -*- coding: utf-8 -*-
# @Time: 2020/2/5,005 22:02
# @Last Update: 2020/2/5,005 22:02
# @Author: 徐缘
# @FileName: 2.practices_on_nlp.py
# @Software: PyCharm
from __future__ import absolute_import, division, print_function, unicode_literals # 导入一些熟悉的陌生人
# 绝对引入,精确除法,print,unicode类型字符串。都是为了适配python2,不加也罢
import nu... | Review this code and list any quality issues. | [
{
"issue": "Function 'preprocess_text' is 70 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 75
}
] | 1 |
python | # Copyright 2015, 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:
#
# * 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 '_behaviors' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 89
},
{
"issue": "Function '_servicer' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severi... | 3 |
python |
import redis
from keys import key_list as default_key_list
class Relationship(object):
def __init__(self, redis_connection=None, key_list=None, actor=None):
if key_list:
self.key_list = default_key_list.copy()
self.key_list.update(key_list)
else:
self.key_l... | Review this code and list any quality issues. | [
{
"issue": "Function '_action_call' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 35
}
] | 1 |
python | from collections import namedtuple
import os
from selfdrive.boardd.boardd import can_list_to_can_capnp
from selfdrive.controls.lib.drive_helpers import rate_limit
from common.numpy_fast import clip
from . import teslacan
from .values import AH
from common.fingerprints import TESLA as CAR
from selfdrive.can.packer impor... | Review this code and list any quality issues. | [
{
"issue": "Function 'actuator_hystereses' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 12
},
{
"issue": "Function 'actuator_hystereses' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity... | 5 |
python | import numpy as _np
from .moments import immoment3D as _immoment3D
def getSphere(side):
"""Create a 3D volume of sideXsideXside, where voxels representing a
sphere are ones and background is zeros.
Keyword arguments:
side -- the number of voxels the 3D volume should have on each side.
Returns:
... | Review this code and list any quality issues. | [
{
"issue": "Function 'rotate3D' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 23
}
] | 1 |
python | """Tests for submission functionality-- primarily if a submission
form is validated properly and passed to the backend.
"""
import pytest
import pathlib, json
from src.model import Activity, Submission
# Load in sample submissions and their expected status codes if they were submitted:
with open(pathlib.Path(__file__... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_submissions' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 16
}
] | 1 |
python | # ===========================================================================
# dictionary.py -----------------------------------------------------------
# ===========================================================================
# function ----------------------------------------------------------------
# -----... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_dict_elements' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 24
}
] | 1 |
python | import os
from typing import Tuple
import numpy as np
from numpy.random import MT19937, RandomState, SeedSequence
import torch
from gym import utils
from gym.envs.mujoco import mujoco_env
class Reacher3DEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self, task_id=None, hide_goal=False):
self.vie... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_EE_pos' is 99 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 64
},
{
"issue": "Function 'forward_postprocess_fn' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"lin... | 2 |
python | # [Built-in modules]
import os
import re
import sys
import shutil
import time, datetime
import math as myMath
import glob
# [3rd party modules]
import cv2
import numpy as np
import xml.etree.ElementTree as ET
import sympy as sp
from sympy.utilities.lambdify import lambdify, implemented_function
from... | 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": 36
},
{
"issue": "Function 'my_print' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line... | 2 |
python | """
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... | Review this code and list any quality issues. | [
{
"issue": "Function 'openapi_types' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 95
},
{
"issue": "Function '__init__' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",... | 3 |
python | #!/usr/bin/env python
"""Provide docking motivation layer node."""
import rospy
import json
import math
from enum import Enum
from threading import Lock
import tf
from tf.transformations import euler_from_quaternion
from std_msgs.msg import Bool
from std_msgs.msg import Empty
from geometry_msgs.msg import PoseStamped... | Review this code and list any quality issues. | [
{
"issue": "Function 'intention_callback' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 59
},
{
"issue": "Function 'run' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"seve... | 4 |
python | """ A3C in Code - Centralized/ Gobal Network Parameter Server/ Controller
Based On:
A3C Code as in the book Deep Reinforcement Learning, Chapter 12.
Runtime: Python 3.6.5
Dependencies: numpy, matplotlib, tensorflow (/ tensorflow-gpu), gym
DocStrings: GoogleStyle
Author : Mohit Sewak (p20150023@goa-bits-pilani.a... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 115
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line... | 4 |
python | from __future__ import division
import argparse
import os
import os.path as osp
import time
import mmcv
import torch
from mmcv import Config
from mmcv.runner import init_dist
from mmdet import __version__
from mmdet.apis import set_random_seed, train_detector
from mmdet.datasets import build_dataset
from mmdet.models... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse_args' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 20
},
{
"issue": "Function 'main' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"l... | 3 |
python | __all__ = ["Block", "BlockTemplateHeader", "BlockTemplateBody", "BlockTemplate"]
from .transaction import Transaction
class Block:
"""
Block returned by the server.
:param number: Height of the block.
:type number: int
:param hash: Hex-encoded 32-byte hash of the block.
:type hash: str
:... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 43 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 42
},
{
"issue": "Function '__init__' has 16 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 42
... | 5 |
python | r"""
Kazhdan-Lusztig Polynomials
AUTHORS:
- Daniel Bump (2008): initial version
- Alan J.X. Guo (2014-03-18): ``R_tilde()`` method.
"""
#*****************************************************************************
# Copyright (C) 2008 Daniel Bump <bump at match.stanford.edu>
#
# This program is free softwar... | Review this code and list any quality issues. | [
{
"issue": "Function 'R' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 99
},
{
"issue": "Function 'R_tilde' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor... | 3 |
python | import logging
import contextlib
import threading
from typing import (
TYPE_CHECKING,
Generator,
)
import pytest
import conftest
from rnode_testing.common import TestingContext
from rnode_testing.rnode import (
docker_network_with_started_bootstrap,
started_peer,
)
from rnode_testing.wait import (
... | 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": 31
},
{
"issue": "Function 'test_multiple_deploys_at_once' is 45 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | """
@author: Nathanael Jöhrmann
"""
import json
import textwrap
class Conjugations:
def __init__(self):
self.person = {}
self.negative = ["", ""]
self.passive = ["", ""]
self.passive_negative = ["", ""]
@property
def summary(self) -> str:
result = ""
sep ... | Review this code and list any quality issues. | [
{
"issue": "Function 'summary' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 87
}
] | 1 |
python | import os
import shutil
import os
from glob import glob
import pandas as pd
import random
from collections import defaultdict
from PIL import Image
from torch.utils.data import Dataset, DataLoader
def get_all_images(dir):
types = ["jpeg", "jpg", "png"]
files = []
for t in types:
path = os.path.join(dir, "**... | Review this code and list any quality issues. | [
{
"issue": "Function 'casia' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 22
},
{
"issue": "Function 'casia' is 44 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line"... | 2 |
python | # encoding: utf-8
from datetime import datetime, timedelta
from django.conf import settings
from django.core.management.base import BaseCommand
from django.utils.timezone import now
from dateutil.tz import tzlocal
from core.utils import slugify
class Setup(object):
def setup(self, test=False):
self.te... | Review this code and list any quality issues. | [
{
"issue": "Function 'setup_tickets' is 59 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 40
}
] | 1 |
python | import dnf
import dnf.cli
from glob import glob
import logging
import threading
import tempfile
import subprocess
import shutil
import os
logger = logging.getLogger('dnf')
class ErrorThread(threading.Thread):
_my_exception = None
def run(self, *args):
try:
self._run(*self._args)
... | Review this code and list any quality issues. | [
{
"issue": "Function '_run' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 92
},
{
"issue": "Function '_run' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 3 |
python | # coding=utf-8
# Copyright 2020 The TF-Agents 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | Review this code and list any quality issues. | [
{
"issue": "Function 'train_eval' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 150
}
] | 1 |
python | from yaw_controller import YawController
from pid import PID
from lowpass import LowPassFilter
import rospy
GAS_DENSITY = 2.858
ONE_MPH = 0.44704
class Controller(object):
def __init__(self, vehicle_mass, wheel_radius, decel_limit):
self.yaw_controller = None
self.throttle_controller = None
... | Review this code and list any quality issues. | [
{
"issue": "Function 'init_yaw' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 22
},
{
"issue": "Function 'init_throttle' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 31
},
{
... | 3 |
python | #! /usr/bin/python2
# coding=utf-8
class pyJCal:
def __init__(self):
pass
def div(self, a, b):
return a / b
def gregorian_to_jalali(self, g_y, g_m, g_d):
"""
this function returns result of converting ye gregorian date to jalali
"""
g_days_in_month = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31... | Review this code and list any quality issues. | [
{
"issue": "Function 'gregorian_to_jalali' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 11
},
{
"issue": "Function 'gregorian_to_jalali' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"se... | 5 |
python | # Copyright 2017 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 applicab... | Review this code and list any quality issues. | [
{
"issue": "Function 'train' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 52
},
{
"issue": "Function 'train' is 91 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line... | 2 |
python | #!/usr/bin/env python
import argparse
import os
import parallel_deploy
import service_config
import subprocess
import sys
import urlparse
import deploy_utils
from log import Log
ALL_JOBS = ["kafka", "kafkascribe"]
def _get_kafka_service_config(args):
args.kafka_config = deploy_utils.get_service_config(args)
def... | Review this code and list any quality issues. | [
{
"issue": "Function 'generate_run_scripts_params' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 40
},
{
"issue": "Function 'generate_start_script' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor"... | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.