language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | #!/usr/bin/env python3
import os
import sys
import random
import numpy as np
src = open("input.txt", "r").readlines()
example = """
be cfbegad cbdgef fgaecd cgeb fdcge agebfd fecdb fabcd edb | fdgacbe cefdb cefbgd gcbe
edbfga begcd cbg gc gcadebf fbgde acbgfd abcde gfcbed gfec | fcgedb cgb dgebacf gc
fgaebd cg bdaec... | Review this code and list any quality issues. | [
{
"issue": "Function 'collapse' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 65
}
] | 1 |
python | import datetime
from rest_framework import viewsets, status
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated
from core.permissions import DjangoModelPermissions
from core.visits.serializer import PopulatedVisitSerializer
from core.models import Visit, FrontDeskEvent,... | Review this code and list any quality issues. | [
{
"issue": "Function 'retrieve' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 25
}
] | 1 |
python | import unittest
from okapi.proto.okapi.security.v1 import CreateOberonKeyRequest, CreateOberonTokenRequest, CreateOberonProofRequest, \
VerifyOberonProofRequest, UnBlindOberonTokenRequest, BlindOberonTokenRequest
from okapi.wrapper import Oberon
class KeyTests(unittest.TestCase):
def test_oberon_demo(self):
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_demo_with_binding' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 20
}
] | 1 |
python |
import numpy, random
class Individual:
def __init__(self,genome, llimits =[], ulimits=[], type=[], LEN = 1,fitness_func = None):
if genome is None:
self.genome = numpy.zeros(LEN,dtype=float)
for gene in range(LEN):
if type[gene] == "integer":
... | 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": 5
},
{
"issue": "Function 'run' has 10 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 74
}
] | 2 |
python | # coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1.19.15
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
f... | 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": 49
},
{
"issue": "Function 'to_dict' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line":... | 2 |
python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import random
import numpy as np
import pandas as pd
import h5py
import matplotlib.pyplot as plt
from math import cos, sin, atan2, sqrt, pi, radians, degrees, ceil, isnan
from skimage import io, transform
BASE_DIR = os.path.dirname(os.path.abspath(__f... | Review this code and list any quality issues. | [
{
"issue": "Function 'n_rotate' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 38
}
] | 1 |
python | # AUTO GENERATED FILE - DO NOT EDIT
from dash.development.base_component import Component, _explicitize_args
class Code(Component):
"""A Code component.
Code is a wrapper for the <code> HTML5 element.
For detailed attribute info see:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/code
... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 79 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 107
},
{
"issue": "Function '__init__' has 21 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 107
... | 2 |
python | """ pickle can serialized python objects into a stream of bytes and
deserialize bytes back into objects.
Note:
by design, pickle is unsafe!
"""
import pickle
state_path = 'game_state.bin'
class GameState(object):
def __init__(self):
self.level = 0
self.lives = 4
def save_game(state):
... | 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": 95
}
] | 1 |
python | """Camera platform that receives images through HTTP POST."""
from __future__ import annotations
import asyncio
from collections import deque
from datetime import timedelta
import logging
import aiohttp
import async_timeout
import voluptuous as vol
from homeassistant.components import webhook
from homeassistant.comp... | 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": 98
}
] | 1 |
python | import os
import sys
import subprocess
import hydra
from omegaconf import DictConfig
from hydra import slurm_utils
@hydra.main(config_path='/h/nng/conf/robust/config.yaml')
def gen_neighborhood_labels(cfg: DictConfig):
base_path = '/h/nng/data'
model_data_path = os.path.join(base_path, cfg.data.task, cfg.eval... | Review this code and list any quality issues. | [
{
"issue": "Function 'gen_neighborhood_labels' is 52 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 10
}
] | 1 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: trainer.py
# Author: Qian Ge <geqian1001@gmail.com>
import os
import numpy as np
import tensorflow as tf
def display(global_step,
step,
scaler_sum_list,
name_list,
collection,
summary_val=None,
... | Review this code and list any quality issues. | [
{
"issue": "Function 'display' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 11
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 33
},
{
"is... | 5 |
python | import torch
import torch.nn as nn
import torch.nn.functional as F
from .sprin import GlobalInfoProp, SparseSO3Conv
import numpy as np
class ResLayer(torch.nn.Module):
def __init__(self, dim_in, dim_out, bn=False) -> None:
super().__init__()
assert(bn is False)
self.fc1 = torch.nn.Linear(d... | 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": 35
},
{
"issue": "Function 'forward' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 89
},
{
"is... | 3 |
python | import argparse
import json
import numpy as np
import os
import subprocess
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from params_conf import N_MODULES, MIN_NUM_MODULES, STIFF_TABLE
from utils import parse_robot_string
def convert_h_to_arch(h_file, morph_file, best_funct... | Review this code and list any quality issues. | [
{
"issue": "Function 'convert_h_to_arch' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 14
},
{
"issue": "Function 'convert_h_to_arch' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severi... | 3 |
python | """
pyexcel_xlsw
~~~~~~~~~~~~~~~~~~~
The lower level xls file format handler using xlwt
:copyright: (c) 2016-2021 by Onni Software Ltd
:license: New BSD License
"""
import datetime
import xlrd
from xlwt import XFStyle, Workbook
from pyexcel_io import constants
from pyexcel_io.plugin_api import IW... | Review this code and list any quality issues. | [
{
"issue": "Function 'write_row' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 37
},
{
"issue": "Function 'write_row' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 3 |
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.
import os
from typing import Any, List, Optional
import attr
from cv2 import log
import numpy as np
from gym import spaces
from habitat.config... | 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": 202
},
{
"issue": "Function 'get_observation' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 234
... | 3 |
python | # coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1.23.6
Generated by: https://openapi-generator.tech
"""
try:
from inspect import getfullargspec
except Im... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 56
},
{
"issue": "Function '__init__' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
... | 2 |
python | from flask import Flask, render_template, request, jsonify
from pyecharts import options as opts
from pyecharts.charts import Graph
import json
import redis
from flask_cors import *
r = redis.Redis(host="127.0.0.1", port=6379)
app = Flask(__name__)
CORS(app, supports_credentials=True)
@app.route("/dockermsg", method... | Review this code and list any quality issues. | [
{
"issue": "Function 'graph_base' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 39
}
] | 1 |
python | #!/usr/bin/python
from __future__ import print_function
import struct
import sys
import usb.core
import usb.util
from intelhex import IntelHex
scrambleCode = (0x29, 0x52, 0x8C, 0x70)
stats = [0xff, 0x02, 0x00, 0xf5, 0xe5, 0x75, 0x03, 0x04,
0x80, 0x05, 0xd2, 0x01, 0xe4, 0xef, 0x82, 0x83,
0x08, 0x24,... | Review this code and list any quality issues. | [
{
"issue": "Function 'dump' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 96
},
{
"issue": "Function 'dump' is 48 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 2 |
python | import textwrap
import aiohttp
from aiostripe import error
def new_default_http_client(*args, **kwargs):
return AsyncioClient(*args, **kwargs)
class HTTPClient(object):
def __init__(self, verify_ssl_certs=True):
self._verify_ssl_certs = verify_ssl_certs
def request(self, method, url, headers,... | Review this code and list any quality issues. | [
{
"issue": "Function 'request' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 16
},
{
"issue": "Function 'request' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 23
}
] | 2 |
python | # Zbiór przedziałów [(a[1], b[1]), ..., (a[n], b[n])], każdy przedział należy do [0, 1]. Opisać algorytm
# który sprawdzi czy jest możliwy taki wybór przedziałów, aby cały przedział [0, 1] zawierał się
# w wybranych odcinkach. Przedział ma składać się z jak najmniejszej ilości odcinków.
def minimum_intervals(T):
... | Review this code and list any quality issues. | [
{
"issue": "Function 'minimum_intervals' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 6
}
] | 1 |
python | # Copyright 2014 Mirantis, 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 'deploy_ha_one_controller_flat_master_node_fail' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 31
}
] | 1 |
python | '''
Copyright 2017-present, Airbnb Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... | Review this code and list any quality issues. | [
{
"issue": "Function 'validate_config' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 52
}
] | 1 |
python | import pickle
import argparse
import pandas as pd
import numpy as np
import math
from tqdm import tqdm
from sklearn import decomposition
CENTER_X = int(960 / 3 / 2)
CENTER_Y = int(540 / 3 / 2)
# CENTER_X = 0
# CENTER_Y = 0
def load_data(path, data_size=None):
with open(path, 'rb') as f:
data = pickle.l... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_fill_filter' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 37
},
{
"issue": "Function 'run_fill_filter' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity"... | 6 |
python | __copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
# do not change this line manually
# this is managed by git tag and updated on every release
__version__ = '0.6.8'
# do not change this line manually
# this is managed by proto/build-proto.sh and updated on every exe... | Review this code and list any quality issues. | [
{
"issue": "Function 'import_classes' has cyclomatic complexity 49 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 80
},
{
"issue": "Function 'import_classes' is 108 lines long. Functions over 25 lines are harder to test and maintain.",
"severit... | 4 |
python | import re
import json
from color_print import *
# read rules from json file
with open("rules.json", "r", encoding="utf-8") as json_data:
rules = json.load(json_data)
# create new rules by replacing 'is' to 'was', 'has been', ...
def augment(sentence):
"""change 'is' in the sentence to was, has been,... | Review this code and list any quality issues. | [
{
"issue": "Function 'suggest_remove' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 39
},
{
"issue": "Function 'suggest_replace' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
... | 2 |
python | #
# Run NN, multinomial logistic regression using simple gradient descent.
#
import config
import numpy as np
import tensorflow as tf
from tensorflow import (Variable, constant, global_variables_initializer,
truncated_normal, zeros)
from tf_training_helper import TrainingHelper
class TF_notMN... | 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": 14
},
{
"issue": "Function 'start_with' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 30
},... | 3 |
python | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/71_callback.tensorboard.ipynb (unless otherwise specified).
__all__ = ['TensorBoardCallback']
# Cell
from ..basics import *
# Cell
import tensorboard
from torch.utils.tensorboard import SummaryWriter
from .fp16 import ModelToHalf
# Cell
class TensorBoardCallback(Callb... | 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": 16
},
{
"issue": "Function 'tensorboard_log' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 52
}
] | 2 |
python | from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.action import ActionBase
try:
from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_validate import (
AnsibleArgSpecValidator,
)
except ImportError:
ANSIBLE_UTILS_IS_INST... | Review this code and list any quality issues. | [
{
"issue": "Function 'run' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 69
},
{
"issue": "Function 'run' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 69... | 2 |
python | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft and contributors. 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 ... | 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": 162
},
{
"issue": "Function '__init__' has 30 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 162
... | 2 |
python | import os
import yaml
import pandas as pd
import xml.etree.ElementTree as ET
from types import SimpleNamespace
from sklearn.model_selection import train_test_split
from utils.experiment_utils import create_linspace
from utils.preprocess import *
SOURCE_PATH = './source_data'
DATA_PATH = './data'
CONFIG_PATH = './c... | Review this code and list any quality issues. | [
{
"issue": "Function 'prepare_files' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 42
},
{
"issue": "Function 'prepare_files' is 83 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "m... | 3 |
python | from django import template
from django.contrib.admin.models import LogEntry
register = template.Library()
class AdminLogNode(template.Node):
def __init__(self, limit, varname, user):
self.limit, self.varname, self.user = limit, varname, user
def __repr__(self):
return "<GetAdminLog Node>"
... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_admin_log' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 24
}
] | 1 |
python | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 21 15:53:46 2018
@author: Eric S. Russell
Laboratory for Atmospheric Research
Dept. of Civil and Environmental Engineering
Washington State University
eric.s.russell@wsu.edu
Not all of these functions are used in the column rename script; these are potentially to be used... | Review this code and list any quality issues. | [
{
"issue": "Function 'Grade_cs' has cyclomatic complexity 30 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 36
},
{
"issue": "Function 'Grade_cs' is 108 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critica... | 7 |
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 use this ... | Review this code and list any quality issues. | [
{
"issue": "Function 'setup_hadoop' is 53 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 24
},
{
"issue": "Function 'setup_database' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "mi... | 2 |
python | import datetime
from django.conf import settings
from django.contrib.auth.decorators import user_passes_test
from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import loader, Context
from equipment.models import ItemType, Item, ItemEr... | Review this code and list any quality issues. | [
{
"issue": "Function 'check_out' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 89
},
{
"issue": "Function 'check_out' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 6 |
python | import networkx as nx
class FeatureExtractor:
"""
Extracting some hand-crafted x1_features for the x1_graphs
- Number of (effective nodes)
- Average
"""
def __init__(self, g: nx.Graph, node_attr_name='op_name', s='input', t='output'):
"""
g: a valid networkx graph
node... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 11
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line"... | 2 |
python | import os
import sys
import numpy as np
import pandas as pd
from torch.utils.data import Subset
from torch.utils.data.dataset import Dataset # For custom datasets
from torchvision import transforms
PROJECT_PATH = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..'))
sys.path.append(PROJECT_PATH)
... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 21
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 72
}
] | 2 |
python | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . 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": 57
},
{
"issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 113
},
{
"... | 6 |
python | """ support for skip/xfail functions and markers. """
from _pytest.config import hookimpl
from _pytest.mark.evaluate import MarkEvaluator
from _pytest.outcomes import fail
from _pytest.outcomes import skip
from _pytest.outcomes import xfail
def pytest_addoption(parser):
group = parser.getgroup("general")
grou... | Review this code and list any quality issues. | [
{
"issue": "Function 'pytest_configure' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 28
},
{
"issue": "Function 'pytest_runtest_makereport' has cyclomatic complexity 18 (threshold: 5). Consider breaking it into smaller functions.",
... | 3 |
python | import torch
import torch.nn as nn
import os
from common import base_data_path
from typing import List
import pandas as pd
CONTEXT_SIZE = 1 # 1 words to the left, 1 to the right
EMDEDDING_DIM = 3
word_to_ix = {}
ix_to_word = {}
def make_context_vector(context, word_to_ix):
idxs = [word_to_ix[w] for w in contex... | Review this code and list any quality issues. | [
{
"issue": "Function 'split_smiles_repr' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 32
}
] | 1 |
python | import logging
import typing
import web3
from util import constants
from web3tools import web3util, account
logger = logging.getLogger(__name__)
def randomWeb3Wallet():
private_key = account.randomPrivateKey()
return Web3Wallet(private_key=private_key)
class Web3Wallet:
"""Signs txs and msgs with an acc... | Review this code and list any quality issues. | [
{
"issue": "Function 'buildAndSendTx' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 97
},
{
"issue": "Function 'buildAndSendTx' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": ... | 2 |
python | """Joystick action space for controlling agent avatars."""
from . import abstract_action_space
from dm_env import specs
import numpy as np
class Joystick(abstract_action_space.AbstractActionSpace):
"""Joystick action space."""
def __init__(self, scaling_factor=1., action_layers='agent',
con... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 11
}
] | 1 |
python | import os
import pprint
import inspect
import tensorflow as tf
pp = pprint.PrettyPrinter().pprint
def class_vars(obj):
return (k:v for k, v in inspect.getmembers(obj))
if not k.startswith("__") and not callable()
class base_model(object):
def __init__(self, config):
self._saver = None
self.config... | Review this code and list any quality issues. | [
{
"issue": "Function 'class_vars.model_dir' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 51
}
] | 1 |
python | """
This file offers the methods to automatically retrieve the graph Lachnospiraceae bacterium NK4A144.
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: prote... | Review this code and list any quality issues. | [
{
"issue": "Function 'LachnospiraceaeBacteriumNk4a144' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 30
}
] | 1 |
python | # podd_utils.py
# Utility functions for Podd SCons build
import os
from SCons.Action import ActionFactory
from SCons.Script.SConscript import SConsEnvironment
SConsEnvironment.OSCommand = ActionFactory(os.system,
lambda command : 'os.system("%s")' % command)
import SCons.Util
def list_to_path(lst):
... | Review this code and list any quality issues. | [
{
"issue": "Function 'InstallWithRPATH' has cyclomatic complexity 17 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 24
},
{
"issue": "Function 'InstallWithRPATH' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"seve... | 7 |
python | import os
import math
import torch
import argparse
import numpy as np
from tqdm import tqdm
from medpy import metric
import torch.nn.functional as F
from Configs.config import config
from Model.Vnet import VNet as Vnet
from cc3d import connected_components
from Dataloader.dataset import LAHeartDataset
"""
# https://gi... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_all_case' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 34
},
{
"issue": "Function 'test_single_case' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "majo... | 4 |
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 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 18
},
{
"issue": "Function '__init__' is 63 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical... | 3 |
python | import spacy
from textblob import TextBlob
import pandas as pd
# Import functions from other files
from tweet_handlers import pullTweetsFromCSV, tweetPulls
### Declare functions to standardize, identify, and analyze input text
# Will ultimately take in a list of tweets and return:
# - Word counts
# - Split of positiv... | Review this code and list any quality issues. | [
{
"issue": "Function 'extractDescriptors' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 40
},
{
"issue": "Function 'extractTweetAttributes' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"... | 2 |
python | import endpoints
from google.appengine.ext import ndb
def get_by_urlsafe(urlsafe, model):
try:
key = ndb.Key(urlsafe=urlsafe)
except TypeError:
raise endpoints.BadRequestException('Invalid Key')
except Exception, e:
if e.__class__.__name__ == 'ProtocolBufferDecodeError':
... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_by_urlsafe' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 4
}
] | 1 |
python | import glob
import os
import warnings
from datetime import datetime
from copy import deepcopy
import numpy as np
import pyedflib
import scipy.io as sio
from config import cfg
from thirdparty.cerebus import NsxFile, NevFile
from thirdparty.nex import Reader as NexReader
from .utils import find_nearest_time
def _load... | Review this code and list any quality issues. | [
{
"issue": "Function '_load_usbamp' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 50
}
] | 1 |
python | import KratosMultiphysics
import KratosMultiphysics.RomApplication as romapp
import KratosMultiphysics.StructuralMechanicsApplication
from KratosMultiphysics.RomApplication.empirical_cubature_method import EmpiricalCubatureMethod
from KratosMultiphysics.RomApplication import python_solvers_wrapper_rom as solver_wrapper... | Review this code and list any quality issues. | [
{
"issue": "Function 'ModifyAfterSolverInitialize' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 38
}
] | 1 |
python | from collections import defaultdict
from itertools import product
MULTITASK_PENALTY = 1
AUTHOR_PENALTY = 2
RELATION_COST = .05
DEFAULT_FLEXIBILITY = .1
OVERREQ_PENALTY = 0.5
def workload_diff(target, proposed):
"""
Helper for pitches_cost
:param target: <role, load>
:param proposed: <role, load>
:... | 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": 41
},
{
"issue": "Function 'author_constraint' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
... | 5 |
python | import os
from datetime import datetime
import pytest
from .helpers import tasks
from .helpers import assertions
from .helpers.env import E2EEnv
DIR = os.path.dirname(__file__)
TAP_MARIADB_ID = 'mariadb_to_rs'
TAP_MARIADB_BUFFERED_STREAM_ID = 'mariadb_to_rs_buffered_stream'
TAP_POSTGRES_ID = 'postgres_to_rs'
TAP_S3_... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_replicate_pg_to_rs' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 104
}
] | 1 |
python | # -*- coding: utf-8 -*-
import json
import os
import sys
import time
from echopy import Echo
from project import RESOURCES_DIR, BLOCK_RELEASE_INTERVAL
if "BASE_URL" not in os.environ:
BASE_URL = json.load(open(os.path.join(RESOURCES_DIR, "urls.json")))["BASE_URL"]
else:
BASE_URL = os.environ["BASE_URL"]
cat... | Review this code and list any quality issues. | [
{
"issue": "Function 'process_filters' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 77
}
] | 1 |
python | # -*- coding: utf-8 -*-
"""
Romanization of Thai words based on machine-learnt engine ("thai2rom")
"""
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from pythainlp.corpus import download, get_corpus_path
device = torch.device("cuda:0" if torch.cuda.is_available()... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 18
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 104
},
{... | 8 |
python | """
VRChat API Documentation
The version of the OpenAPI document: 1.6.8
Contact: me@ruby.js.org
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from vrchatapi.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal,
... | Review this code and list any quality issues. | [
{
"issue": "Function '_from_openapi_data' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 164
},
{
"issue": "Function '_from_openapi_data' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"sev... | 6 |
python | # Copyright 1999-2020 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 'get' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 21
},
{
"issue": "Function 'get' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 2... | 2 |
python | """
Our modification of the OpenAI Gym Continuous Mountain Car by Olivier Sigaud:
https://github.com/openai/gym/blob/master/gym/envs/classic_control/continuous_mountain_car.py
which was (ultimately) based on Sutton's implementation:
http://incompleteideas.net/sutton/MountainCar/MountainCar1.cp
"""
from pilco.errors i... | Review this code and list any quality issues. | [
{
"issue": "Function 'render' is 48 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 91
}
] | 1 |
python | """
IRN API v1
Allows users to extract, create, update and configure IRN data. # noqa: E501
The version of the OpenAPI document: 1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from fds.sdk.IRNContacts.model_utils import ( # noqa: F401
ApiTy... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 107
},
{
"issue": "Function '_from_openapi_data' is 44 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"li... | 2 |
python | from __future__ import unicode_literals
import copy
from funcy import merge
from schema import Optional
from contextlib import contextmanager
from dvc.external_repo import external_repo
from dvc.utils.compat import str
from .local import DependencyLOCAL
class DependencyREPO(DependencyLOCAL):
PARAM_REPO = "rep... | 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": 27
}
] | 1 |
python | import numpy as np
from multiagent.core import World, Agent, Landmark
from multiagent.scenario import BaseScenario
class Scenario(BaseScenario):
def make_world(self, dim_c=3):
world = World()
# set any world properties first
world.dim_c = dim_c
num_landmarks = 3
# add agents... | Review this code and list any quality issues. | [
{
"issue": "Function 'observation' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 68
}
] | 1 |
python | # -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2022 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the t... | Review this code and list any quality issues. | [
{
"issue": "Function 'on_devValueChange' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 86
},
{
"issue": "Function 'on_devStatusChange' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line":... | 12 |
python | #!/usr/bin/env python
"""Manager of worker subprocesses.
This module invokes the worker subprocesses that perform the cloud
security monitoring tasks. Each worker subprocess wraps around a cloud,
store, event, or alert plugin and executes the plugin in a separate
subprocess.
"""
import logging.config
import multip... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 48 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 72
},
{
"issue": "Function 'join' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"lin... | 2 |
python | # Recorder that records agent states as dataframes and also stores a carla recording, in synchronous mode
#!/usr/bin/env python
# Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_metadata' is 53 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 46
},
{
"issue": "Function 'run' has cyclomatic complexity 23 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
... | 6 |
python | from django.conf import settings
from django.contrib.auth import get_user, views as auth_views
from django.contrib.auth.decorators import login_required
from django.core.files import File
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render, get_object_or_404
from django.urls i... | Review this code and list any quality issues. | [
{
"issue": "Function 'index' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 19
}
] | 1 |
python | # coding: utf-8
"""
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: beta
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
class ProcessLineag... | 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": 128
}
] | 1 |
python | # RT - Twitter
from typing import TYPE_CHECKING, Union, Dict, Tuple, List
from discord.ext import commands
import discord
from tweepy.asynchronous import AsyncStream
from tweepy import API, OAuthHandler
from tweepy.errors import NotFound
from tweepy.models import Status
from jishaku.functools import executor_functi... | Review this code and list any quality issues. | [
{
"issue": "Function 'on_status' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 150
},
{
"issue": "Function 'on_status' is 50 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 4 |
python | import sys, re, os, selenium, time, argparse
from time import sleep
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.by import By
from urllib.request import urlopen, urlretrieve
class YoutubeDownloader(object):
def __... | Review this code and list any quality issues. | [
{
"issue": "Function 'download' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 78
}
] | 1 |
python | import pytest
from os.path import join
import mackinac
@pytest.mark.fixtures('download_data')
class TestReconstruct:
def test_reconstruct_features(self, universal_folder, bacteria_folder, b_theta_features,
b_theta_summary, b_theta_id):
template = mackinac.create_template... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_reconstruct_features' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 9
},
{
"issue": "Function 'test_reconstruct_likelihoods' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity... | 3 |
python | from mirage.libs import io
class Loader:
'''
This class permits to dynamically load the modules.
'''
def __init__(self):
'''
This constructor generates the modules list.
'''
import mirage.modules as modules
self.modulesList = {}
for moduleName,module in modules.__modules__.items():
current = module#... | Review this code and list any quality issues. | [
{
"issue": "Function 'list' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 42
}
] | 1 |
python | import itertools
import os
import numpy as np
import pandas as pd
from utils.Recording import Recording
import utils.settings as settings
def load_opportunity_dataset(opportunity_dataset_path: str) -> "list[Recording]":
"""
Returns a list of Recordings from the opportunity dataset
"""
print("Will re... | Review this code and list any quality issues. | [
{
"issue": "Function 'load_opportunity_dataset' is 82 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 11
}
] | 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
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": 23
},
{
"issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line... | 4 |
python | from urllib.request import urlopen
import torch
from torch import nn
import numpy as np
from skimage.morphology import label
import os
from HD_BET.paths import folder_with_parameter_files
def get_params_fname(fold):
return os.path.join(folder_with_parameter_files, "%d.model" % fold)
def maybe_download_parameter... | Review this code and list any quality issues. | [
{
"issue": "Function '__call__' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 60
},
{
"issue": "Function 'subdirs' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity":... | 5 |
python | """ Azure Automation assets module to be used with Azure Automation during offline development """
#!/usr/bin/env python2
# ----------------------------------------------------------------------------------
#
# MIT License
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this softwar... | Review this code and list any quality issues. | [
{
"issue": "Function '_get_asset_value' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 48
},
{
"issue": "Function '_set_asset_value' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",... | 2 |
python | # -*- coding: utf-8 -*-
"""
Created on Sep 20, 2012
@author: moloch
Copyright 2012 Root the Box
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/licen... | 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": 42
},
{
"issue": "Function '_mysql' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line... | 3 |
python | """
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | Review this code and list any quality issues. | [
{
"issue": "Function 'RunOneflowBinaryOp.FlowJob' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 45
},
{
"issue": "Function 'RunOneflowBinaryOp' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "mino... | 4 |
python | """WOInfo Plugin for WordOps"""
from cement.core.controller import CementBaseController, expose
from cement.core import handler, hook
from wo.core.variables import WOVariables
from pynginxconfig import NginxConfig
from wo.core.aptget import WOAptGet
from wo.core.shellexec import WOShellExec
from wo.core.logging import... | Review this code and list any quality issues. | [
{
"issue": "Function 'info_php' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 67
},
{
"issue": "Function 'info_php' is 68 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 5 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.MaitainShopProduct import MaitainShopProduct
class AlipayEcoMycarMaintainServiceproductUpdateModel(object):
def __init__(self):
self._operation_type = N... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_alipay_dict' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 42
}
] | 1 |
python | from __future__ import annotations
from pathlib import _PosixFlavour, _WindowsFlavour
from typing import Optional, Callable, Awaitable, Dict, List, TYPE_CHECKING
from errno import EINVAL
import os
import sys
from aiopath.wrap import func_to_async_func as wrap_async
try:
from pathlib import _getfinalpathname
_a... | Review this code and list any quality issues. | [
{
"issue": "Function 'resolve._resolve' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 39
},
{
"issue": "Function 'async_resolve._resolve' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller func... | 4 |
python | import argparse
import json
import os
import pickle
import numpy as np
from pocovidnet.evaluate_genesis import GenesisEvaluator
from pocovidnet.evaluate_video import VideoEvaluator
from tensorflow.keras import backend as K
from pocovidnet.videoto3d import Videoto3D
def main():
parser = argparse.ArgumentParser(des... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 59 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 12
}
] | 1 |
python | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode:
if not head or not head.next:
return None
# make this st... | Review this code and list any quality issues. | [
{
"issue": "Function 'removeNthFromEnd' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 7
}
] | 1 |
python | import pytest
import allure
from _pytest.nodes import Item
from _pytest.runner import CallInfo
from selene.core.exceptions import TimeoutException
from selene.support.shared import browser
@pytest.fixture(scope='function', autouse=True)
def browser_management():
"""
Here, before yield,
goes all "setup" co... | Review this code and list any quality issues. | [
{
"issue": "Function 'pytest_runtest_makereport' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 76
}
] | 1 |
python | #!/usr/bin/python
# -*- coding: utf_8 -*-
"""Access and query Twitter's API with the simplistic twitter package (`pip install twitter`).
"""
from __future__ import print_function
from __future__ import unicode_literals
import csv
import os
import time
from twitter import OAuth
from twitter import Twitter
def setup... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse_twitter_response' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 43
},
{
"issue": "Function 'search_parse_write_tweets' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smal... | 4 |
python | # python3.7
"""Utility functions for latent codes manipulation."""
import numpy as np
from sklearn import svm
from .logger import setup_logger
__all__ = ['train_boundary', 'project_boundary', 'linear_interpolate']
def train_boundary(latent_codes,
scores,
chosen_num_or_ratio=0.... | Review this code and list any quality issues. | [
{
"issue": "Function 'train_boundary' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 12
},
{
"issue": "Function 'train_boundary' is 84 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": ... | 7 |
python | """API ROUTER"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
from flask import jsonify, Blueprint
from gfwanalysis.errors import WHRCBiomassError
from gfwanalysis.middleware import get_geo_by_hash, get_geo_by_use, get_geo_by_wdpa, \
... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_by_regional' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 90
}
] | 1 |
python | #%%
import numpy as np
import pandas as pd
import time
from sklearn.base import BaseEstimator, TransformerMixin
from collections import defaultdict
from sklearn.model_selection import KFold, StratifiedKFold
class Timer:
def __enter__(self):
self.start=time.time()
return self
def __exit__(... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 11 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 21
},
{
"issue": "Function '_update' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 99
},
... | 4 |
python | # Copyright (c) 2020 Institute for Quantum Computing, Baidu 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
#
# Un... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 31
},
{
"issue": "Function 'main' is 52 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": ... | 2 |
python | from .aaa_util import eval_results, get_summary, convert_df
class AnchorDetector:
def __init__(self, offline):
self.offline = offline
def initialize(self, seq_info):
self.seq_info = seq_info
self.previous_offline = None
def fixed_detect(self, frame_idx, duration):
feedbac... | Review this code and list any quality issues. | [
{
"issue": "Function 'stable_detect' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 24
},
{
"issue": "Function 'stable_detect' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "mi... | 3 |
python | #
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is d... | Review this code and list any quality issues. | [
{
"issue": "Function 'run' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 40
},
{
"issue": "Function 'run' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 4... | 3 |
python | """
GraphSense API
GraphSense API # noqa: E501
The version of the OpenAPI document: 0.5.1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from graphsense.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal,
M... | Review this code and list any quality issues. | [
{
"issue": "Function '_from_openapi_data' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 111
},
{
"issue": "Function '_from_openapi_data' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"sev... | 4 |
python | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Utilities for testing"""
import os
import sys
from numpy.testing import assert_allclose
import astropy.units as u
from astropy.coordinates import SkyCoord
from astropy.time import Time
__all__ = [
"requires_dependency",
"requires_data",
"mp... | Review this code and list any quality issues. | [
{
"issue": "Function 'assert_quantity_allclose' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 153
},
{
"issue": "Function '_unquantify_allclose_arguments' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"sever... | 2 |
python | # coding=utf-8
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules import conv
from torch.nn.modules.utils import _single
from ..functions.max_sv import max_singular_value
class SNConv1d(conv._ConvNd):
def __init__(self, in_channels, out_channels, kernel_size, stride=1, paddin... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 9 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 11
}
] | 1 |
python | # -*- coding: utf-8 -*- #
"""*********************************************************************************************"""
# FileName [ classifiers.py ]
# Synopsis [ 'Naive Bayes' and 'Decision Tree' training, testing, and tunning functions ]
# Author [ Ting-Wei Liu (Andi611) ]
# Copyright [... | 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": 39
},
{
"issue": "Function 'search_alpha' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"l... | 3 |
python | from .objects import Server, Zone, RRSet, Record, Comment, Cryptokey, Metadata, SearchResult, StatisticItem, \
MapStatisticItem, RingStatisticItem, SimpleStatisticItem, CacheFlushResult
from .exceptions import PDNSApiException, PDNSApiNotFound
import json
from functools import partial
import requests
import loggin... | 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 'request' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line":... | 5 |
python | """
The agent module contains three abstract classes that are subclassed in order to create algorithms.
The classes are:
* Player - for an algorithm that cannot learn and can only play
* Learner - for a learning algorithm controlling a single agent
* MultiLearner - for a learning algorithm of controlling a number of a... | Review this code and list any quality issues. | [
{
"issue": "Function 'receive_reward' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 79
}
] | 1 |
python | #!/usr/bin/python3
# -*- coding:utf-8 -*-
from ckuser import client,server
import os
def print_client_menu():
print("用户菜单:")
print("-"*25)
print("0"+"-"*10+"显示用户菜单"+"-"*10)
print("1"+"-"*10+"显示服务菜单"+"-"*10)
print("2"+"-"*10+"用户登录系统"+"-"*10)
print("3"+"-"*10+"用户修改信息"+"-"*10)
print("4"+"-"*10+"用户注册信息"+"-"*10)
pr... | Review this code and list any quality issues. | [
{
"issue": "Function 'server_oper' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 27
},
{
"issue": "Function 'server_oper' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor... | 4 |
python | import os
import re
import argparse
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.preprocessing.image import load_img, img_to_array
IMAGE_SHAPE = [(224, 224), (240, 240), (260, 260), (300, 300), (380, 380), (456, 456), (528, 528), (600, 600)]
def main(paths : list, mod... | 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": 12
},
{
"issue": "Function 'main' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 2 |
python | #######################################################################
# Copyright (C) #
# 2016-2018 Shangtong Zhang(zhangshangtong.cpp@gmail.com) #
# 2016 Kenta Shimada(hyperkentakun@gmail.com) #
# 2017 Nicky van Foreest(vanfore... | Review this code and list any quality issues. | [
{
"issue": "Function 'play' has cyclomatic complexity 21 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 60
},
{
"issue": "Function 'play' is 72 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"... | 3 |
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 '_validate_alias_command' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 51
}
] | 1 |
python | import os
from collections import defaultdict
import numpy as np
import torch
from termcolor import colored
from torch.utils.tensorboard import SummaryWriter
from common import utils
class Manager():
def __init__(self, model, optimizer, scheduler, params, dataloaders, logger):
# params status
se... | 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": 13
},
{
"issue": "Function 'summarize_metric_status' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "min... | 8 |
python | import chainer
import chainer.functions as F
import chainer.links as L
"""
Based on chainer official example
https://github.com/pfnet/chainer/tree/master/examples/ptb
Modified by shi3z March 28,2016
"""
class RNNLM(chainer.Chain):
"""Recurrent neural net languabe model for penn tree bank corpus.
This is... | 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": 18
}
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.