language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 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": 69
},
{
"issue": "Function 'linear_search_wer' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 97
},
... | 4 |
python | '''Some helper functions for PyTorch, including:
- get_mean_and_std: calculate the mean and std value of dataset.
- msr_init: net parameter initialization.
- progress_bar: progress bar mimic xlua.progress.
'''
import os
import sys
import time
import math
import torch
import torch.nn as nn
impor... | Review this code and list any quality issues. | [
{
"issue": "Function 'init_params' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 32
},
{
"issue": "Function 'progress_bar' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"sev... | 5 |
python | from typing import NamedTuple
def CsvExampleGen(
output_examples_uri: 'ExamplesUri',
input_base: str,
input_config: {'JsonObject': {'data_type': 'proto:tfx.components.example_gen.Input'}},
output_config: {'JsonObject': {'data_type': 'proto:tfx.components.example_gen.Output'}},
range_config: {'JsonO... | Review this code and list any quality issues. | [
{
"issue": "Function 'CsvExampleGen' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 3
}
] | 1 |
python | import pandas as pd
import numpy as np
import yfinance as yf
from sklearn.linear_model import LinearRegression
import statsmodels
import statsmodels.api as sm
import statsmodels.tsa.stattools as ts
import datetime
import scipy.stats
import math
import openpyxl as pyxl
from scipy import signal
from scipy import stats... | Review this code and list any quality issues. | [
{
"issue": "Function 'GaussianRandomStockPrice' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 27
}
] | 1 |
python | # qubit number=3
# total number=60
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collections import Counter
from... | Review this code and list any quality issues. | [
{
"issue": "Function 'build_oracle' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 33
},
{
"issue": "Function 'build_circuit' is 60 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "maj... | 2 |
python | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Review this code and list any quality issues. | [
{
"issue": "Function 'predict_bbox_ir' is 62 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 26
},
{
"issue": "Function 'predict_bbox_ir' has 9 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
... | 6 |
python | """
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_autoanalyze' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 52
}
] | 1 |
python | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 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": 51
}
] | 1 |
python | # coding: utf-8
"""
Mailchimp Marketing API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 3.0.74
Contact: apihelp@mailchimp.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 51
},
{
"issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line"... | 3 |
python | import torch.nn as nn
import torch.nn.functional as F
class noise_Conv2d(nn.Conv2d):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, dilation=1,
groups=1, bias=True, noise_std=0.1):
super(noise_Conv2d, self).__init__(in_channels, out_chann... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 10 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 7
}
] | 1 |
python | from source.element.cr_beam_element import CRBeamElement
import numpy as np
np.set_printoptions(suppress=False, precision=4, linewidth=100)
def test_crbeam_element_update_incremental():
material_params = {'rho': 7850, 'e': 2069000000.0, 'nu': 0.29, 'zeta': 0.05, 'lx_i': 1.2, 'is_nonlinear': True}
element_pa... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_crbeam_element_update_incremental' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 8
},
{
"issue": "Function 'test_crbeam_element_update_incremental' is 107 lines long. Functions over 25 lines are ... | 2 |
python | import os
import sys
import pytest
from pytest import fixture
if sys.version_info < (3, 6):
raise pytest.skip("plantuml_markdown plugin requires Python >= 3.6", allow_module_level=True)
from tests import V8_PLUGIN_PATH
from tests.conftest import CompileResult
from v8.plantuml_markdown.plantuml_markdown import Pl... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_prefix' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 57
}
] | 1 |
python |
import argparse
import re
import logging
import requests
from typing import Iterator
from typing import List
LOGGER_NAME="advent"
def init_logging(is_verbose: bool):
"""
Creates standard logging for the logger_name passed in
"""
logger = logging.getLogger(LOGGER_NAME)
logger.setLevel(logging.... | Review this code and list any quality issues. | [
{
"issue": "Function 'add_line' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 117
},
{
"issue": "Function 'add_line' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 5 |
python | # coding: utf-8
"""
Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end --
OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_code_inject____end__rn_n_r_with_http_info' is 46 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 68
}
] | 1 |
python | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The Machinecoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""rawtranscation RPCs QA test.
# Tests the following RPCs:
# - createrawtransaction
# - signra... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_test' is 96 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 42
}
] | 1 |
python | # Logging module.
import os
from os import path
import datetime
from michiru import config
from michiru.modules import hook
## Module information.
__name__ = 'logger'
__author__ = 'Shiz'
__license__ = 'WTFPL'
__desc__ = 'Log activities.'
config.item('logger.path', path.join('{local}', 'logs', '{server}', '{channel... | Review this code and list any quality issues. | [
{
"issue": "Function 'part' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 46
},
{
"issue": "Function 'kick' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 54
},
{
"issue": "... | 5 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from django.contrib import admin
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from .models import Container, ContainerImage, Mirror
from .models import ContainerBox, ContainerBoxConta... | Review this code and list any quality issues. | [
{
"issue": "Function 'save_model' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 77
}
] | 1 |
python | import torch
import torch.nn as nn
import spconv
from functools import partial
from .spconv_backbone import post_act_block
from ...utils import common_utils
class SparseBasicBlock(spconv.SparseModule):
expansion = 1
def __init__(self, inplanes, planes, stride=1, downsample=None, indice_key=None, norm_fn=None... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 12
},
{
"issue": "Function '__init__' is 54 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 53
},
{
... | 5 |
python | # ---------------------------------------------------------------------------
# Copyright 2017-2018 OMRON 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.apac... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 118
},
{
"issue": "Function 'main' is 108 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 2 |
python | """
AdamP
Copyright (c) 2020-present NAVER Corp.
MIT license
"""
import torch
import torch.nn as nn
from torch.optim.optimizer import Optimizer, required
import math
class SGDP(Optimizer):
def __init__(self, params, lr=required, momentum=0, dampening=0,
weight_decay=0, nesterov=False, eps=1e-8, d... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 10 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 13
},
{
"issue": "Function '_cosine_similarity' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 25
... | 5 |
python | load(
"@rules_mono//dotnet/private:providers.bzl",
"DotnetLibrary",
)
def _make_runner_arglist(dotnet, source, output):
args = dotnet.actions.args()
args.add("/useSourcePath")
if type(source) == "Target":
args.add_all(source.files)
else:
args.add(source)
args.add(output)
... | Review this code and list any quality issues. | [
{
"issue": "Function 'emit_resx_net' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 20
},
{
"issue": "Function 'emit_resx_net' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 20... | 2 |
python | # -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_validate_alpha_vector' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 154
},
{
"issue": "Function 'test_validate' is 62 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "ma... | 3 |
python | import numpy as np
from util import util
from config.draco3_lb_config import PnCConfig, WBCConfig
from pnc.wbc.ihwbc.ihwbc import IHWBC
from pnc.wbc.ihwbc.joint_integrator import JointIntegrator
class Draco3LBController(object):
def __init__(self, tci_container, robot):
self._tci_container = tci_containe... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 10
},
{
"issue": "Function 'get_command' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 57
... | 2 |
python | #!/usr/local/bin/python
# encoding: utf-8
"""
*Convert the HTML export of kindle notebooks (from kindle apps) to markdown*
:Author:
David Young
:Date Created:
October 17, 2016
"""
################# GLOBAL IMPORTS ####################
import sys
import os
import re
import collections
os.environ['TERM'] = 'vt10... | Review this code and list any quality issues. | [
{
"issue": "Function 'convert' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 82
},
{
"issue": "Function 'convert' is 84 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"... | 3 |
python | from collections import defaultdict
from threading import local
import pymantic.primitives
class BaseParser(object):
"""Common base class for all parsers
Provides shared utilities for creating RDF objects, handling IRIs, and
tracking parser state.
"""
def __init__(self, environment=None):
... | Review this code and list any quality issues. | [
{
"issue": "Function 'make_quad' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 40
}
] | 1 |
python | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Iterable
import hydra
import numpy as np
import omegaconf
import torch
import mbrl.algorithms.mbpo as ... | Review this code and list any quality issues. | [
{
"issue": "Function 'flatten_config' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 22
},
{
"issue": "Function 'run' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity"... | 2 |
python | """
Copyright (c) 2022 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 writin... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_can_load_handler_state' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 229
}
] | 1 |
python | #!/usr/bin/python3
"""
Beautiful command line parsing
@author chairs
"""
import inspect, sys
from collections import namedtuple
from collections import defaultdict
from subprocess import DEVNULL
class Cookie (object):
"""
Main decorator object
@param name of application
"""
def __init__ (self, app_name, notes=... | Review this code and list any quality issues. | [
{
"issue": "Function '__parse' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 24
},
{
"issue": "Function '__construct_optional' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
... | 3 |
python | # Copyright (c) 2016 Universidade Federal Fluminense (UFF)
# Copyright (c) 2016 Polytechnic Institute of New York University.
# This file is part of noWorkflow.
# Please, consult the license terms in the LICENSE file.
"""Diff Object"""
from __future__ import (absolute_import, print_function,
div... | Review this code and list any quality issues. | [
{
"issue": "Function 'diff_set' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 121
}
] | 1 |
python | # coding: utf-8
#
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
# except in compliance with the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "lice... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 61
},
{
"issue": "Function 'to_dict' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line"... | 2 |
python | # TunaBot Ext - Help
from discord.ext import commands
import discord
from aiofiles import open as async_open
from ujson import load, loads
from data import is_admin
JSON_PATH = "data/help.json"
class Help(commands.Cog):
def __init__(self, bot):
self.bot, self.tuna = bot, bot.data
with open(JS... | Review this code and list any quality issues. | [
{
"issue": "Function 'help' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 29
}
] | 1 |
python | """
Takes a [Notion.so](https://notion.so) export .zip and enhances it
"""
import tempfile
import sys
import os
import time
import re
import argparse
import zipfile
import urllib.parse
from datetime import datetime
from pathlib import Path
import backoff
import requests
from emoji_extractor.extract import Extractor as... | Review this code and list any quality issues. | [
{
"issue": "Function 'noteNameRewrite' has cyclomatic complexity 19 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 21
},
{
"issue": "Function 'noteNameRewrite' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severi... | 8 |
python | # https://github.com/RomanMichaelPaolucci/AI_Stock_Trading/blob/master/IBM.csv
import abc
import threading
import time
import pandas as pd
import numpy as np
from keras.layers import Dense
from keras.models import Sequential, model_from_json
from sklearn.model_selection import train_test_split
from sklearn.metrics impo... | 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": 25
}
] | 1 |
python | # -*- coding: utf-8 -*-
import binascii
from copy import copy
from .codec import size_for_addr
from .codec import string_to_bytes
from .codec import bytes_to_string
from .codec import protocol_with_name
from .protocols import protocol_with_code
from .protocols import read_varint_code
class ProtocolNotFoundException(... | Review this code and list any quality issues. | [
{
"issue": "Function 'value_for_protocol' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 116
}
] | 1 |
python | # -*- encoding: utf-8 -*-
import abc
import numpy as np
import scipy.sparse
from autosklearn.pipeline.implementations.OneHotEncoder import OneHotEncoder
from autosklearn.util import predict_RAM_usage
def perform_one_hot_encoding(sparse, categorical, data):
predicted_RAM_usage = float(
predict_RAM_usage(d... | Review this code and list any quality issues. | [
{
"issue": "Function 'perform_one_hot_encoding' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 10
},
{
"issue": "Function 'perform1HotEncoding' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller ... | 2 |
python | #!/usr/bin/env python
"""
Import experiments into the database
* Configuration parameters:
- The ones required by intogen.data.entity.EntityManagerFactory
"""
from wok.task import Task
from wok.element import DataElementList
from intogen.data.entity import types
from intogen.data.entity.server import EntityServer
... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 22 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 23
},
{
"issue": "Function 'main' is 123 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 2 |
python | import os
import sys
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(base_path)
from torch import optim
from metallic.data.benchmarks import get_benchmarks
from metallic.data.dataloader import MetaDataLoader
from metallic.models import OmniglotCNN
from metallic.metalearners... | Review this code and list any quality issues. | [
{
"issue": "Function 'set_trainer' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 38
}
] | 1 |
python | # Copyright 2021 The Bazel 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 la... | Review this code and list any quality issues. | [
{
"issue": "Function '_test_compute_data_path' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 47
}
] | 1 |
python | from __future__ import print_function, absolute_import
import unittest
from conda.version import ver_eval, VersionSpec, VersionOrder, normalized_version
class TestVersionSpec(unittest.TestCase):
def test_version_order(self):
versions = [
(VersionOrder("0.4"), [[0], [0], [4]]),
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_version_order' is 79 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 8
}
] | 1 |
python | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Bundle class with support for npm dependencies."""
from __future__ import absolut... | Review this code and list any quality issues. | [
{
"issue": "Function 'extract_deps' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 54
},
{
"issue": "Function 'make_semver' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"sev... | 2 |
python | #!/usr/bin/env python
# Run the various build scripts
import sys
import os
from parse import parse_machines
from machines import machines
from assemblies import assemblies
from vitamins import vitamins
from printed import printed
from guides import guides
from publish import publish
def build(do_publish=0):
prin... | Review this code and list any quality issues. | [
{
"issue": "Function 'build' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 15
},
{
"issue": "Function 'build' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line... | 2 |
python | """
A module to show off a timed animation using coroutines
Making timed animations is messy, because we have to add a lot of
class attributes for all of the loop variables. A cleaner way is
to do this with coroutines. Each animation is its own coroutine.
The advantage of the coroutine is that yield allows you to p... | Review this code and list any quality issues. | [
{
"issue": "Function 'update' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 59
}
] | 1 |
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 9 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 28
},
{
"issue": "Function '__init__' has 9 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 128
}
] | 2 |
python | #from lib2to3.pytree import convert
import socket
import sys
import _thread
import json
import os
import time
import zmq
IP_ADDRESS = '127.0.0.1'
TOPIC = None
fila_msgs = []
conf = []
# Envia os dados
def enviar():
ctx = zmq.Context()
sock = ctx.socket(zmq.PUB)
sock.connect(f"tcp://{IP_ADDRESS}:5500")
... | Review this code and list any quality issues. | [
{
"issue": "Function 'enviar' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 16
},
{
"issue": "Function 'enviar' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"lin... | 4 |
python | # Authors:
# Trevor Perrin
# Martin von Loewis - python 3 port
# Yngve Pettersen (ported by Paul Sokolovsky) - TLS 1.2
#
# See the LICENSE file for legal information regarding use of this file.
"""cryptomath module
This module has basic math/crypto code."""
from __future__ import print_function
import os
impor... | Review this code and list any quality issues. | [
{
"issue": "Function 'getRandomNumber' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 170
},
{
"issue": "Function 'makeSieve' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"s... | 5 |
python | # Copyright 2012 Enrico Franchi
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#... | Review this code and list any quality issues. | [
{
"issue": "Function '_process_parameters' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 37
}
] | 1 |
python | """Script to download and cache all data."""
import os
from typing import List
import openml
from automl import openml_utils
BENCHMARK_TASKS = {"adult": 7592, "nomao": 9977, "phoneme": 9952}
FOLD_COL = "fold"
def download_openml_tasks(task_ids: List[int]):
"""Downloads the given task_ids from OpenML and dumps... | Review this code and list any quality issues. | [
{
"issue": "Function 'download_openml_tasks' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 14
}
] | 1 |
python | """
Errors not dependent on any specific Scrolls types.
Typically, you won't need to instantiate any of these yourself. The base exception
for _all_ Scrolls errors is `ScrollError`. Any error that occurs while validating
script syntax or interpreting scripts will inherit from `PositionalError`.
"""
import fun... | Review this code and list any quality issues. | [
{
"issue": "Function 'format_positional_error' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 26
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 104... | 3 |
python | #!/usr/bin/env python
# $Id: kalign_urllib2.py 2809 2015-03-13 16:10:25Z uludag $
# ======================================================================
#
# Copyright 2009-2018 EMBL - European Bioinformatics Institute
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file exce... | Review this code and list any quality issues. | [
{
"issue": "Function 'serviceRun' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 197
},
{
"issue": "Function 'printGetResultTypes' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity":... | 2 |
python | from gql import gql
from specklepy.api.resource import ResourceBase
from specklepy.api.models import Branch
from specklepy.logging import metrics
NAME = "branch"
METHODS = ["create"]
class Resource(ResourceBase):
"""API Access class for branches"""
def __init__(self, account, basepath, client) -> None:
... | Review this code and list any quality issues. | [
{
"issue": "Function 'get' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 55
},
{
"issue": "Function 'list' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 103
},
{
... | 3 |
python | # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Tests pertaining to line/branch test coverage for the Firecracker code base.
# TODO
- Put the coverage in `s3://spec.firecracker` and update it automatically.
target should be put in `s3://spec.firecra... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_coverage' is 51 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 77
}
] | 1 |
python | # coding=utf-8
import tensorflow as tf
import numpy as np
import os
from algorithm import config
from base.env.market import Market
from checkpoints import CHECKPOINTS_DIR
from base.algorithm.model import BaseRLTFModel
from helper.args_parser import model_launcher_parser
from helper.data_logger import generate_algor... | 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": 18
},
{
"issue": "Function 'run' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 69
... | 3 |
python | import subprocess
class NotificationError(Exception):
pass
class BaseNotification:
def set_typed_variable(self, value, specified_type):
if isinstance(value, specified_type):
return value
else:
raise NotificationError(
'can only set '
f'... | 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": 168
}
] | 1 |
python | # Copyright 2013-present Barefoot Networks, 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 agre... | 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": "critical",
"line": 64
},
{
"issue": "Function '__init__' has 11 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 64
... | 4 |
python | #!/usr/bin/python
# Copyright 2013 Google 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 vers... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 38 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 154
},
{
"issue": "Function 'main' is 125 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 2 |
python | import pystache
from functools import partial
from flask_login import current_user
from redash.authentication.org_resolving import current_org
from numbers import Number
from redash import models
from redash.utils import mustache_render, json_loads
from redash.permissions import require_access, view_only
from funcy imp... | Review this code and list any quality issues. | [
{
"issue": "Function '_valid' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 98
}
] | 1 |
python | # qubit number=4
# total number=40
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2
import numpy as np
import networkx as nx
def bitwise_... | Review this code and list any quality issues. | [
{
"issue": "Function 'build_oracle' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 29
},
{
"issue": "Function 'make_circuit' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "mino... | 2 |
python | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.14.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 49
},
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line"... | 3 |
python |
from collections import OrderedDict
recording_params_dict = OrderedDict([('apply_filter', True), ('freq_min',300.0), ('freq_max',6000.0)])
#Defining GUI Params
keys = list(recording_params_dict.keys())
types = [type(recording_params_dict[key]) for key in keys]
values = [recording_params_dict[key] for key in keys]
rec... | Review this code and list any quality issues. | [
{
"issue": "Function 'update_param_dicts' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 72
},
{
"issue": "Function 'update_param_dicts' is 45 lines long. Functions over 25 lines are harder to test and maintain.",
"sev... | 3 |
python | from Magics.macro import *
import os
def plot_area(epsg, llx, lly, urx, ury):
img = os.path.basename(__file__).split('.')[0]
title = "Projection {} : [{:.2f}, {:.2f}, {:.2f}, {:.2f}]".format(epsg, llx, lly, urx, ury)
#Setting output
png = output(
output_formats = ['png'],
output_name ... | Review this code and list any quality issues. | [
{
"issue": "Function 'plot_area' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 4
}
] | 1 |
python | from __future__ import absolute_import
from __future__ import unicode_literals
from corehq.apps.data_interfaces.models import AutomaticUpdateRule
from corehq.apps.sms import tasks as sms_tasks
from corehq.form_processor.exceptions import CaseNotFound
from corehq.form_processor.interfaces.dbaccessors import CaseAccessor... | Review this code and list any quality issues. | [
{
"issue": "Function '_sync_case_for_messaging' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 50
}
] | 1 |
python | #!/usr/bin/env python
#Created by Spencer Hance and Trevor Gale on January 18th 2015
#Northeastern University Computer Architecture Research Group
#Licensed under MIT License
import sys
import matplotlib.pyplot as plt
import numpy as np
from pylab import cm
import re
import random
from scipy.misc import comb
import a... | Review this code and list any quality issues. | [
{
"issue": "Function 'parseBBV' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 18
}
] | 1 |
python | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from ray.rllib.agents.trainer import Trainer, with_common_config
from ray.rllib.utils.annotations import override
# yapf: disable
# __sphinx_doc_begin__
class RandomAgent(Trainer):
"""P... | Review this code and list any quality issues. | [
{
"issue": "Function '_train' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 66
},
{
"issue": "Function '_train' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"lin... | 2 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
class AnswerModel(object):
def __init__(self):
self._extra = None
self._item_id = None
self._option_id = None
@property
def extra(self):
return se... | 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": 38
}
] | 1 |
python | import torch
import torch.nn as nn
class RadarStackedHourglass(nn.Module):
def __init__(self, n_class, stacked_num=1):
super(RadarStackedHourglass, self).__init__()
self.stacked_num = stacked_num
self.conv1a = nn.Conv3d(
in_channels=2,
out_channels=32,
k... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 54 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 6
},
{
"issue": "Function '__init__' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 85
},... | 5 |
python | #!/usr/bin/python3
import sys
import fcntl
import logging
import time
import io
import datetime
import decimal
import statistics
from astm_bidirectional_common import my_sql , file_mgmt, print_to_log
#For mysql password
sys.path.append('/var/gmcs_config')
import astm_var
####Settings section start#####
logfile_name='/... | Review this code and list any quality issues. | [
{
"issue": "Function 'check_if_new_result_arrived' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 36
}
] | 1 |
python | #-------------------------------------------------------------------------------------------
# project.py
#
# Author : Felix Gonda
# Date : July 10, 2015
# School : Harvard University
#
# Project : Master Thesis
# An Interactive Deep Learning Toolkit for
# Automatic Segmentation of Images
#
# S... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 46
},
{
"issue": "Function '__init__' has 16 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 46
... | 6 |
python | #!/usr/bin/env python
###############################################################
# < next few lines under version control, D O N O T E D I T >
# $Date$
# $Revision$
# $Author$
# $Id$
###############################################################
###############################################################
... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 33
}
] | 1 |
python | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import astropy.units as u
from astropy.time import Time, TimeDelta
from pint.residuals import resids
import pint.toa as toa
from pint import models
__all__ = ['make_ideal',
'createfourierdesignmatrix_red',
'add_rednoise',
'add_d... | Review this code and list any quality issues. | [
{
"issue": "Function 'createfourierdesignmatrix_red' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 27
},
{
"issue": "Function 'createfourierdesignmatrix_red' is 28 lines long. Functions over 25 lines are harder to test... | 12 |
python | import typing
from pg_sql import SqlId, SqlNumber, SqlObject, SqlString, sql_list
from .format import format
from .join_common import JoinTarget, Key, Structure
from .join_key import KeyConsumer, TargetRefresh
from .sql import SqlTableExpr
from .sql_query import sync_query, upsert_query
from .string import indent
d... | Review this code and list any quality issues. | [
{
"issue": "Function 'sql' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 95
}
] | 1 |
python | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from compas.geometry import Frame
from compas.geometry import Transformation
from compas.robots.model.robot import RobotModel
class ToolModel(RobotModel):
"""Represents a tool to be attached to the robot'... | 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": 37
}
] | 1 |
python | from __future__ import absolute_import
import ast
import re
import operator as op
import pyparsing
from ..exceptions import CloudflareSolveError
from . import JavaScriptInterpreter
# ------------------------------------------------------------------------------- #
_OP_MAP = {
ast.Add: op.add,
ast.Sub: op.su... | Review this code and list any quality issues. | [
{
"issue": "Function 'dfs' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 60
},
{
"issue": "Function 'eval.challengeSolve' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"sev... | 3 |
python | from sqlalchemy.orm import Session
from datetime import datetime
from fastapi import HTTPException
from fastapi import status
from fastapi.encoders import jsonable_encoder
from literature.schemas import CrossReferenceSchema
from literature.schemas import CrossReferenceSchemaUpdate
from literature.models import Cross... | Review this code and list any quality issues. | [
{
"issue": "Function 'show' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 61
},
{
"issue": "Function 'show' is 43 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line":... | 2 |
python | # Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
#
# This work is made available under the Nvidia Source Code License-NC.
# To view a copy of this license, visit
# https://nvlabs.github.io/stylegan2/license.html
#
# Modified my Varun A. Kelkar - vak2@illinois.edu
import argparse
import copy
import os
imp... | Review this code and list any quality issues. | [
{
"issue": "Function 'run' has cyclomatic complexity 22 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 47
},
{
"issue": "Function 'run' is 93 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"li... | 4 |
python | #
# VAZ Projects
#
#
# Author: Marcelo Tellier Sartori Vaz <marcelotsvaz@gmail.com>
from functools import partial
import re
from django.template import loader
def linkAttributes( self, tokens, index, options, env ):
'''
Add target and rel attributes to links.
'''
tokens[index].attrSet( 'rel', 'noopener'... | Review this code and list any quality issues. | [
{
"issue": "Function 'linkAttributes' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 16
},
{
"issue": "Function 'imageGallery' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
... | 3 |
python | # -*-coding: utf-8 -*-
"""
@Project: create_tfrecord
@File : create_tfrecord.py
@Author : panjq
@E-mail : pan_jinquan@163.com
@Date : 2018-07-27 17:19:54
@desc : 将图片数据保存为单个tfrecord文件
"""
##########################################################################
import tensorflow as tf
im... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_batch_images' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 161
},
{
"issue": "Function 'read_records' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line":... | 3 |
python | # This Python file uses the following encoding: utf-8
"""autogenerated by genpy from geographic_msgs/RouteSegment.msg. Do not edit."""
import codecs
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import geographic_msgs.msg
import uuid_msgs.msg
class RouteSegment(genpy.M... | 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": 51
},
{
"issue": "Function 'serialize' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity... | 9 |
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.
"""isort:skip_file"""
import argparse
import importlib
import os
from fairseq.dataclass import FairseqDataclass
from fairseq.dataclass.utils ... | Review this code and list any quality issues. | [
{
"issue": "Function 'register_task.register_task_cls' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 70
},
{
"issue": "Function 'register_task.register_task_cls' is 27 lines long. Functions over 25 lines are harder to test... | 3 |
python | import os
import fire
import gym
import numpy as np
from scipy.special import softmax
from noboard.csv import SummaryWriter
from copy import deepcopy
from scipy.stats import entropy
from collections import OrderedDict
from infomercial.distance import kl
from infomercial.memory import DiscreteDistribution
from infom... | Review this code and list any quality issues. | [
{
"issue": "Function 'run' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 53
},
{
"issue": "Function 'run' is 82 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"lin... | 3 |
python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
% Diffusion coeff and Schmidt number for gases in fresh/sea water
%=========================================================================
% Modified by D. Nicholson from MATLAB gas_diffusion Version 2.0 16 July 2013
% Author: Roberta C. Hamme (University of... | Review this code and list any quality issues. | [
{
"issue": "Function 'schmidt_W14' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 136
}
] | 1 |
python | #!/usr/bin/env python3
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | Review this code and list any quality issues. | [
{
"issue": "Function 'simple_rnn' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 85
}
] | 1 |
python | import numpy as np
from copy import copy
from rlcard.games.leducholdem.dealer import LeducholdemDealer as Dealer
from rlcard.games.leducholdem.player import LeducholdemPlayer as Player
from rlcard.games.leducholdem.judger import LeducholdemJudger as Judger
from rlcard.games.leducholdem.round import LeducholdemRound as... | Review this code and list any quality issues. | [
{
"issue": "Function 'step' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 90
}
] | 1 |
python | #! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, 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
#
# Unles... | Review this code and list any quality issues. | [
{
"issue": "Function 'add_feature_data' has cyclomatic complexity 17 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 53
},
{
"issue": "Function 'add_feature_data' is 98 lines long. Functions over 25 lines are harder to test and maintain.",
"seve... | 5 |
python | #!/usr/bin/env python
from __future__ import print_function
import os
import sys
import argparse
import subprocess
from bddown_core import Pan
from util import convert_none, parse_url, add_http, logger
from config import global_config
def download_command(filename, savedir, link, cookies, limit=None, output_dir=Non... | Review this code and list any quality issues. | [
{
"issue": "Function 'download_command' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 14
},
{
"issue": "Function 'select_download' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "min... | 5 |
python | # coding: utf-8
# pylint: disable=invalid-name, no-member
"""ctypes library of mxnet and helper functions."""
from __future__ import absolute_import
import sys
import ctypes
import atexit
import warnings
import inspect
import numpy as np
from . import libinfo
warnings.filterwarnings('default', category=DeprecationWarn... | Review this code and list any quality issues. | [
{
"issue": "Function 'build_param_doc' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 224
},
{
"issue": "Function 'add_fileline_to_docstring' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller fun... | 2 |
python | import datetime
import logging
import math
import cv2
RED = (0, 0, 255)
GREEN = (0, 255, 0)
BLUE = (255, 0, 0)
YELLOW = (0, 255, 255)
logger = logging.getLogger(__name__)
def get_moment(contour):
moment1 = cv2.moments(contour)
area = int(moment1["m00"])
x = int(moment1["m10"] / area)
y = int(moment... | Review this code and list any quality issues. | [
{
"issue": "Function 'contour_slope_degrees' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 58
}
] | 1 |
python | #!/usr/bin/env python3
#
# Copyright (c) 2019 Roberto Riggio
#
# 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 applicabl... | Review this code and list any quality issues. | [
{
"issue": "Function 'do_list_projects' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 129
}
] | 1 |
python | import json
import lzma
from glob import glob
from pprint import pprint
import click
import smart_open
from tqdm import tqdm
@click.command()
@click.option("--path", help="Path. Wilcard '*' enabled")
@click.option("--tar", default=False, help="True for .xz files")
@click.option(
"--flavor",
default="sm",
... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 20
},
{
"issue": "Function 'main' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line":... | 2 |
python | import json
import logging
import matplotlib.pyplot as plt
import os
import tensorflow as tf
from sklearn.utils import shuffle
import model
import train
logger = logging.getLogger('utils')
logger.setLevel(logging.INFO)
def get_data_path():
'''Returns the path to the image and annotation data.
Downloads the ... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_data_path' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 15
}
] | 1 |
python | from contextlib import contextmanager, suppress
from dataclasses import replace
from functools import lru_cache
from types import new_class
from typing import (
Any,
ClassVar,
Collection,
Generic,
Iterable,
Optional,
Sequence,
Tuple,
Type,
TypeVar,
Union,
)
from apischema.co... | Review this code and list any quality issues. | [
{
"issue": "Function '_visit_conversion' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 101
},
{
"issue": "Function 'visit_conversion' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": ... | 6 |
python | import numpy as np
import scipy.interpolate as interpolate
import matplotlib.pyplot as plt
import clusterbuster.mathut as math
"""
Start with e.g. InterpolateRadio2D(psiFile = '../Analysis_MUSIC2/Hoeft_radio/mach_psi_tablefine(10,3).txt', inter=(10,6))
"""
# from http://stackoverflow.... | Review this code and list any quality issues. | [
{
"issue": "Function 'my_interp' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 12
},
{
"issue": "Function 'InterpolateRadio2D' has cyclomatic complexity 20 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critic... | 4 |
python | import os
import random
import requests
import json
import time
# 分类新闻参数
news_classify = [
[0, '民生', 'news_story'],
[1, '文化', 'news_culture'],
[2, '娱乐', 'news_entertainment'],
[3, '体育', 'news_sports'],
[4, '财经', 'news_finance'],
[5, '房产', 'news_house'],
[6, '汽车', 'news_car'],
[7, '教育', ... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_data' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 32
},
{
"issue": "Function 'get_routine' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
... | 2 |
python | import json, subprocess
from ... pyaz_utils import get_cli_name, get_params
def list(name, repository=None, resource_group=None, suffix=None, username=None, password=None):
params = get_params(locals())
command = "az acr helm list " + params
print(command)
output = subprocess.run(command, shell=Tru... | Review this code and list any quality issues. | [
{
"issue": "Function 'list' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 5
},
{
"issue": "Function 'show' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 19
},
{
"issue": "F... | 4 |
python | ##
# Copyright 2018, Ammar Ali Khan
# Licensed under MIT.
# Since: v1.0.0
##
import time
import cv2
import numpy as np
from src.common.package.config import application
from src.opencv.package.config import application as _application
from src.common.package.http import server as _server
from src.common.package.http.h... | Review this code and list any quality issues. | [
{
"issue": "Function 'stream' is 49 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 33
}
] | 1 |
python | # Copyright 2021 Red Hat, 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 writin... | Review this code and list any quality issues. | [
{
"issue": "Function '_migrate_stub' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 52
},
{
"issue": "Function 'test_queued_live_migration_abort' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "min... | 2 |
python | #! /usr/bin/env python3
import click
import serial
from enum import Enum, auto
from intelhex import IntelHex,IntelHexError
import constants
@click.command()
@click.argument(
'file',
required=True,
type=click.Path(dir_okay=False, writable=True)
)
@click.option(
'--append', '-a',
help='append data to... | 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": 30
},
{
"issue": "Function 'main' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line":... | 2 |
python | import os
import io
import itertools
import gzip
import tarfile
import zipfile
import contextlib
import functools
from tqdm import tqdm
from pytools import memoize_method
import pandas as pd
import ir_datasets
import onir
from onir import util, datasets, indices
from onir.interfaces import trec, plaintext
def sanitiz... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 18 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 42
},
{
"issue": "Function '__init__' is 51 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical... | 2 |
python | from __future__ import division
from bisect import bisect
from collections import namedtuple
from math import sqrt, hypot
# a planner computes a motion profile for a list of (x, y) points
class Planner(object):
def __init__(self, acceleration, max_velocity, corner_factor):
self.acceleration = acceleratio... | 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": 48
},
{
"issue": "Function 'triangle' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 134
},
{
"... | 7 |
python | """
OONI Probe Services API - URL prioritization
"""
from typing import List
import random
import time
from flask import Blueprint, current_app, request
from flask.json import jsonify
prio_bp = Blueprint("prio", "probe_services_prio")
# TODO add unit tests
test_items = {}
last_update_time = 0
def update_url_pri... | Review this code and list any quality issues. | [
{
"issue": "Function 'generate_test_list' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 72
},
{
"issue": "Function 'generate_test_list' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"seve... | 2 |
python | #!/usr/bin/env python3
# Test remapping of topic name for incoming message
from mosq_test_helper import *
def write_config(filename, port1, port2, port3):
with open(filename, 'w') as f:
f.write("per_listener_settings true\n")
f.write("port %d\n" % (port2))
f.write("listener %d 127.0.0.1\n... | Review this code and list any quality issues. | [
{
"issue": "Function 'test' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 46
},
{
"issue": "Function 'test' is 50 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.