language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | from metricsML.NormalizationType import NormalizationType
import numpy as np
import math
def normalization(normalization, train_data, test_data, validation_data=None):
if not isinstance(normalization, NormalizationType):
print("Unknown normalization specified, use " + str(NormalizationType.PERCENTAGE) + " ... | Review this code and list any quality issues. | [
{
"issue": "Function '__logarithmNormalization' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 37
}
] | 1 |
python | # RT Lib - Setting
from typing import (
TYPE_CHECKING, TypedDict, Optional, Union, Literal, Dict, Tuple, List,
overload, get_origin, get_args
)
from discord.ext import commands
import discord
from collections import defaultdict
from aiohttp import ClientSession
from functools import partial
from datetime imp... | 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": 37
},
{
"issue": "Function '__new__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 43
},
{
"is... | 12 |
python |
import time
from threading import Event, RLock
from mltk.utils import hexdump
from .device_interface import DeviceInterface, MAX_BUFFER_SIZE
WAIT_FOREVER = 4294967.0
class JLinkDataStream(object):
"""JLink data stream"""
def __init__(
self,
name:str,
mode:str,
ifc: Dev... | 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 'read' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 15... | 9 |
python | import struct
from hsdecomp import ptrutil
def read_arg_pattern(settings, address):
num_args = read_num_args(settings, address)
func_type = read_function_type(settings, address)
assert num_args >= len(func_type)
return func_type + 'v' * (num_args - len(func_type))
def read_num_args(settings, address)... | Review this code and list any quality issues. | [
{
"issue": "Function 'read_function_type' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 14
},
{
"issue": "Function 'read_function_type' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"seve... | 3 |
python | """Utilities functions for setting up test fixtures."""
import tempfile
from pathlib import Path
import shutil
import json
from uuid import uuid4
import pandas as pd
import numpy as np
from iblutil.io.parquet import uuid2np, np2str
import one.params
def set_up_env(use_temp_cache=True) -> tempfile.TemporaryDirectory... | Review this code and list any quality issues. | [
{
"issue": "Function 'setup_test_params' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 83
}
] | 1 |
python | '''
Serve up a fake REST server acting as device REST API
'''
import sys
import argparse
from pathlib import Path
import ssl
import logging
from aiohttp import web
import xmltodict
def get_filename_from_cmd(cmd_dict: dict) -> str:
"""Build filename from an xml command"""
keys = []
def recursive_items(c... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_filename_from_cmd.recursive_items' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 19
},
{
"issue": "Function 'run_server.panos_cmd' has cyclomatic complexity 8 (threshold: 5). Consider breaking it ... | 2 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
# Copyright (c) 2020 University of Dundee.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright not... | Review this code and list any quality issues. | [
{
"issue": "Function 'load_numpy_array' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 70
},
{
"issue": "Function 'analyze' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
... | 3 |
python | from corehq.apps.app_manager.dbaccessors import (
get_brief_apps_in_domain,
get_latest_released_app,
get_latest_released_app_versions_by_app_id,
)
from corehq.apps.linked_domain.models import DomainLink
from corehq.apps.linked_domain.remote_accessors import (
get_brief_apps,
get_latest_released_vers... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_linked_app' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 40
}
] | 1 |
python | import itertools
import pandas as pd
from typing import Dict, Set, Hashable
def upset_from_dict_of_sets(inputs: Dict[Hashable, Set[Hashable]]):
''' Given a dictionary of sets, produce input ready for `upsetplot` python package
We produce this input by computing set intersections of all relevant combinations
of... | Review this code and list any quality issues. | [
{
"issue": "Function 'upset_from_dict_of_sets' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 5
}
] | 1 |
python | """
CryptoAPIs
Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs 2.0 can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of thei... | 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": 116
},
{
"issue": "Function '_from_openapi_data' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"sev... | 6 |
python | # Copyright 2019-present MongoDB Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_fixture2' is 54 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 87
}
] | 1 |
python | import math
import chainer
import chainer.functions as F
import chainer.links as L
import numpy as np
from .sn_convolution_2d import SNConvolution2D, SNDeconvolution2D
from .sn_linear import SNLinear
def _upsample(x):
h, w = x.shape[2:]
return F.unpooling_2d(x, 2, outsize=(h * 2, w * 2))
def _downsample(x):
... | 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": 30
},
{
"issue": "Function 'residual' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"li... | 17 |
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: release-1.21
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... | 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 | """
Copyright (c) 2020 Autonomous Vision Group (AVG), Max Planck Institute for Intelligent Systems, Tuebingen, Germany
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includin... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_experiment' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 196
},
{
"issue": "Function 'run_experiment' is 114 lines long. Functions over 25 lines are harder to test and maintain.",
"severity"... | 2 |
python | """ Definition for RHEAS Datasets decorators.
.. module:: datasets.decorators
:synopsis: Definition of the Datasets decorators
.. moduleauthor:: Kostas Andreadis <kandread@jpl.nasa.gov>
"""
from functools import wraps
import tempfile
import shutil
import urllib
from datetime import datetime
from ftplib import FT... | Review this code and list any quality issues. | [
{
"issue": "Function 'opendap.wrapper' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 91
},
{
"issue": "Function 'opendap.wrapper' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity"... | 4 |
python | # pylint: disable=invalid-name
import glob
import os
import re
import time
import torch
import pytest
from allennlp.common.testing import AllenNlpTestCase
from allennlp.training.trainer import Trainer, sparse_clip_norm, is_sparse
from allennlp.data import Vocabulary
from allennlp.common.params import Params
from alle... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_trainer_saves_models_at_specified_interval' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 192
}
] | 1 |
python | # pylint: disable=redefined-outer-name
from mock import MagicMock
import pytest
import posixpath
import ftplib
from ftplib import FTP
from kiwi.store.artifact.artifact_repository_registry import get_artifact_repository
from kiwi.store.artifact.ftp_artifact_repo import FTPArtifactRepository
@pytest.fixture
def ftp_mo... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_log_artifact_multiple_calls' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 131
},
{
"issue": "Function 'test_download_artifacts' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
... | 2 |
python | import os
import librosa
import numpy as np
import soundfile as sf
import torch
from tqdm import tqdm
from utils import data, spectrogram, spectrogram_clean
from models.hifi_gan import Generator
from models.wavenet import WaveNet
from utils.hparams import hparams as hp
def inference(audio_clip):
original_file =... | Review this code and list any quality issues. | [
{
"issue": "Function 'inference' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 15
}
] | 1 |
python | import os
from typing import Dict
import numpy as np
from utils.log import logger
def write_results(filename, results_dict: Dict, data_type: str):
if not filename:
return
path = os.path.dirname(filename)
if not os.path.exists(path):
os.makedirs(path)
if data_type in ('mot', 'mcmot', ... | Review this code and list any quality issues. | [
{
"issue": "Function 'write_results' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 8
},
{
"issue": "Function 'read_mot_results' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
... | 3 |
python | """Tests for module bregman on OT with bregman projections """
# Author: Remi Flamary <remi.flamary@unice.fr>
# Kilian Fatras <kilian.fatras@irisa.fr>
#
# License: MIT License
import numpy as np
import ot
import pytest
def test_sinkhorn():
# test sinkhorn
n = 100
rng = np.random.RandomState(0)
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_empirical_sinkhorn' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 219
}
] | 1 |
python | # Copyright 2018 Tensorforce Team. 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 'add_variable' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 110
}
] | 1 |
python | # -*- coding: utf-8 -*-
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QCursor
from PyQt5.QtWidgets import QVBoxLayout, QToolBar, QSplitter
from src.constant.conn_dialog_constant import ADD_CONN_MENU, EDIT_CONN_MENU
from src.constant.main_constant import LOCATION_BUTTON, TAB_ID... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 61 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 27
}
] | 1 |
python | from numpy.testing import assert_equal
from spacy.language import Language
from spacy.training import Example
from spacy.util import fix_random_seed, registry
SPAN_KEY = "labeled_spans"
TRAIN_DATA = [
("Who is Shaka Khan?", {"spans": {SPAN_KEY: [(7, 17, "PERSON")]}}),
(
"I like London and Berlin.",
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_ngram_suggester' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 50
},
{
"issue": "Function 'test_ngram_suggester' is 78 lines long. Functions over 25 lines are harder to test and maintain.",
... | 2 |
python | #!/usr/bin/env python3
#
# wikipedia.py
"""
Sphinx extension to create links to Wikipedia articles.
.. versionadded:: 0.2.0
.. extensions:: sphinx_toolbox.wikipedia
Configuration
--------------
.. latex:vspace:: -5px
.. confval:: wikipedia_lang
:type: :class:`str`
:required: False
:default: ``'en'``
The Wiki... | Review this code and list any quality issues. | [
{
"issue": "Function 'make_wikipedia_link' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 111
}
] | 1 |
python | import os
import sys
import json
import jsonschema
from subprocess import Popen, PIPE
from threading import Thread
from traceback import format_exc
from cc_container_worker.application_container.telemetry import Telemetry
from cc_container_worker.commons.data import ac_download, ac_upload, tracing_upload
from cc_conta... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 24 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 23
},
{
"issue": "Function 'main' is 131 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 2 |
python | import logging
from django.contrib.auth.models import User
from django.db import models, transaction
from django.db.models import Q
from django.utils import timezone
from eve_api.models import Structure, EVEPlayerCharacter, ObjectType
from dataclasses import dataclass
from django.apps import apps
from django.core.cache... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_source_value' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 81
},
{
"issue": "Function 'link_transactions' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions."... | 3 |
python | # Copyright (c) 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | Review this code and list any quality issues. | [
{
"issue": "Function 'fake_task_log_get_all' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 88
},
{
"issue": "Function 'fake_task_log_get_all' has 6 parameters. Consider using a parameter object to reduce arity.",
"seve... | 2 |
python | # Copyright © 2021 Province of British Columbia
#
# 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 'ismemberofgroups.ismemberofgroups.decorated.wrapper' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 54
}
] | 1 |
python | #!/usr/bin/env python3
#
# LMS-AutoPlay
#
# Copyright (c) 2020 Craig Drummond <craig.p.drummond@gmail.com>
# MIT license.
#
import hashlib
import os
import re
import requests
import shutil
import sys
REPO_XML = "repo.xml"
PLUGIN_NAME = "VolumeCheck"
PLUGIN_GIT_NAME = "lms-volumecheck"
def info(s):
print("INFO:... | Review this code and list any quality issues. | [
{
"issue": "Function 'updateRepoXml' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 108
},
{
"issue": "Function 'updateRepoXml' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "... | 3 |
python | import json
import os
from base64 import b64decode
from datetime import timedelta
from threading import Semaphore
import github
from dotmap import DotMap
from github import GithubException
from conan_inquiry.transformers.base import BaseGithubTransformer
from conan_inquiry.util.general import render_readme
from conan... | Review this code and list any quality issues. | [
{
"issue": "Function 'transform' has cyclomatic complexity 23 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 23
},
{
"issue": "Function 'transform' is 160 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "criti... | 2 |
python | import higher
from leap import Leap
import numpy as np
import os
import torch
import torch.nn as nn
import gc
def train(model, source_corpus, char2idx, args, device):
model = model.to(device)
optimizer = torch.optim.Adam(model.parameters(), lr=args.lr_init)
lr_scheduler = torch.optim.lr_scheduler.ReduceLR... | Review this code and list any quality issues. | [
{
"issue": "Function 'train' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 10
},
{
"issue": "Function 'train' is 56 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line"... | 9 |
python | #
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 Raphael Michel and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as published by ... | Review this code and list any quality issues. | [
{
"issue": "Function 'create' has cyclomatic complexity 24 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 63
},
{
"issue": "Function 'create' is 75 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 3 |
python | #!/usr/bin/python
#-*-coding:utf-8 -*-
# author: mld
# email: miradel51@126.com
# date : 2017/9/28
import sys
import string
import re
def de_tokenizestr(original_str):
after_de_tok = ""
original_str = original_str.replace("[ ","[")
original_str = original_str.replace(" ]","]")
original_str =... | Review this code and list any quality issues. | [
{
"issue": "Function 'de_tokenizestr' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 13
}
] | 1 |
python | import numpy as np
import pandas as pd
import openturns as ot
from .conf_file_generation import GENERATION_CONF, post_process_generated_dataset
def sample_from_conf(
var_conf: dict, corr_conf: dict, n_sample: int, seed: int = None
) -> pd.DataFrame:
"""
Generate dataset with n_sample form configuration f... | Review this code and list any quality issues. | [
{
"issue": "Function 'sample_from_conf' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 8
},
{
"issue": "Function 'sample_from_conf' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity... | 2 |
python | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | Review this code and list any quality issues. | [
{
"issue": "Function 'libs' is 46 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 121
},
{
"issue": "Function 'configure_args' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
... | 4 |
python | import getopt, os, time, re, gzip, json, traceback
import sys, uuid
from config import DBConfig, Config
from part import PartitionedList
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import sessionmaker
... | Review this code and list any quality issues. | [
{
"issue": "Function 'process_bind_param' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 65
}
] | 1 |
python | #!/usr/bin/env python3
# Copyright (c) 2015-2018 The Luascoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test node responses to invalid blocks.
In this test we connect to one node over p2p, and test block r... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_test' is 69 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 27
}
] | 1 |
python | class ALU():
def __init__(self):
self.Rs = None
self.Rt = None
self.Rd = None
def alu(self, opcode):
if (opcode == 0):
self.Rd = self.Rs + self.Rt
return self.Rd
elif (opcode == 1):
self.Rd = self.Rs - self.Rt
return self.... | Review this code and list any quality issues. | [
{
"issue": "Function 'alu' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 7
}
] | 1 |
python | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection,PolyCollection
def showNetwork(network,savefig=None):
node_x_coords=[]
node_y_coords=[]
link_coords=[]
poi_coords=[]
for _,node in network.node_dict.items():
node_x_coords.append(node.x_coo... | Review this code and list any quality issues. | [
{
"issue": "Function 'showNetwork' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 5
},
{
"issue": "Function 'showNetwork' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor"... | 2 |
python | from typing import Union, Tuple
from torch_geometric.typing import OptTensor, OptPairTensor, Adj, Size
from torch import Tensor
from torch_sparse import SparseTensor, matmul
from torch_geometric.nn.dense.linear import Linear
from torch_geometric.nn.conv import MessagePassing
class GraphConv(MessagePassing):
r"""... | 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
},
{
"issue": "Function 'forward' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 62
}
] | 2 |
python | from functools import total_ordering
from django.db.migrations.state import ProjectState
from .exceptions import CircularDependencyError, NodeNotFoundError
@total_ordering
class Node:
"""
A single node in the migration graph. Contains direct links to adjacent
nodes in either direction.
"""
def _... | Review this code and list any quality issues. | [
{
"issue": "Function 'add_dependency' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 99
},
{
"issue": "Function 'remove_replaced_nodes' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": ... | 8 |
python | """Chartexchange view"""
__docformat__ = "numpy"
import os
from tabulate import tabulate
from gamestonk_terminal.helper_funcs import export_data
from gamestonk_terminal import feature_flags as gtff
from gamestonk_terminal.options import chartexchange_model
def display_raw(
export: str, ticker: str, date: str, ... | Review this code and list any quality issues. | [
{
"issue": "Function 'display_raw' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 13
}
] | 1 |
python | # coding: utf-8
# ----------------------------------------------------------------------------
# <copyright company="Aspose" file="ai_bcr_parse_request.py">
# Copyright (c) 2018-2020 Aspose Pty Ltd. All rights reserved.
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person ... | 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": 45
}
] | 1 |
python | from typing import Dict
from typing import List
import numpy
from fbsrankings.domain.model.affiliation import Subdivision
from fbsrankings.domain.model.game import Game
from fbsrankings.domain.model.game import GameStatus
from fbsrankings.domain.model.ranking import Ranking
from fbsrankings.domain.model.ranking impor... | Review this code and list any quality issues. | [
{
"issue": "Function 'calculate_for_season' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 33
},
{
"issue": "Function 'calculate_for_season' is 64 lines long. Functions over 25 lines are harder to test and maintain.",
... | 2 |
python | from django.conf.urls import url
from rest_framework.routers import SimpleRouter, Route
class DiscoveryAPIRouter(SimpleRouter):
routes = [
# List route.
Route(
url=r'^{prefix}{trailing_slash}$',
mapping={
'get': 'list'
},
name='... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_urls' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 62
},
{
"issue": "Function 'get_urls' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | from __future__ import absolute_import, division, print_function
from scitbx import matrix
from dials.algorithms.refinement.parameterisation.scan_varying_model_parameters import (
ScanVaryingParameterSet,
ScanVaryingModelParameterisation,
GaussianSmoother,
)
from dials.algorithms.refinement.parameterisation... | 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": 21
},
{
"issue": "Function 'compose' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 61
},
{
... | 4 |
python | # Created by Andrzej Lach @ 2021
# https://github.com/AndrzejLach89
from aqa.math import *
from varmain.primitiv import *
from varmain.custom import *
import math
@activate(Group="Support", Ports=1, TooltipShort="Support - insulated, anchor", TooltipLong="Support - insulated, anchor", LengthUnit="mm")
@group("MainD... | Review this code and list any quality issues. | [
{
"issue": "Function 'SUP_INS_ANCH' has cyclomatic complexity 20 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 28
},
{
"issue": "Function 'SUP_INS_ANCH' is 94 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "... | 3 |
python | # check if the list contains 1 or more nodes
def getLink(head):
temp = head
while temp is not None and temp.next is not None:
temp = temp.next
return temp
#initialize the pivot ,newHead and newLink to the partition function
def quickSortRec(head, link):
if head is None or head == link:
... | Review this code and list any quality issues. | [
{
"issue": "Function 'partition' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 28
}
] | 1 |
python | """Support for Hass.io."""
from datetime import timedelta
import logging
import os
import voluptuous as vol
from homeassistant.auth.const import GROUP_ID_ADMIN
from homeassistant.components.homeassistant import SERVICE_CHECK_CONFIG
import homeassistant.config as conf_util
from homeassistant.const import (
ATTR_NA... | Review this code and list any quality issues. | [
{
"issue": "Function 'async_setup' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 146
},
{
"issue": "Function 'async_setup' is 66 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "majo... | 2 |
python | # coding: utf-8
"""
Gate API v4
Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # noqa: E501
Contact: support@mail.gate.io
Gen... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 55
},
{
"issue": "Function '__init__' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical"... | 4 |
python | # coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 126
}
] | 1 |
python | import os
from PIL import Image
import numpy as np
def get_files(folder, name_filter=None, extension_filter=None):
"""Helper function that returns the list of files in a specified folder
with a specified extension.
Keyword arguments:
- folder (``string``): The path to a folder.
- name_filter (```... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_files' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 6
}
] | 1 |
python | import pytest
from dolib.client import AsyncClient, Client
from dolib.models import Domain
@pytest.mark.vcr
@pytest.mark.block_network()
def test_crud_domains(client: Client) -> None:
domain = Domain(name="test.dolib.io")
# create domain
created_domain = client.domains.create(domain=domain)
assert c... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_crud_domains' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 9
},
{
"issue": "Function 'test_async_crud_domains' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "min... | 2 |
python | import logging
from django.db import transaction
from wagtail.wagtailcore.models import Page, Site
from v1.models import BrowsePage, LandingPage, SublandingPage
from v1.tests.wagtail_pages.helpers import save_new_page
logger = logging.getLogger(__name__)
@transaction.atomic
def run():
default_site = Site.obj... | Review this code and list any quality issues. | [
{
"issue": "Function 'run' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 15
}
] | 1 |
python | """
Png to Ico
"""
import toga
from toga.style import Pack
from toga.style.pack import COLUMN, ROW
from PIL import Image
import random
import os
class Png2Ico(toga.App):
def startup(self):
self.msg = '请开始操作'
main_box = toga.Box(style=Pack(direction=COLUMN))
img_path_box = toga.Box(style=P... | Review this code and list any quality issues. | [
{
"issue": "Function 'startup' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 14
},
{
"issue": "Function 'png_to_ico' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
... | 3 |
python | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from copy import deepcopy
from compas.geometry import cross_vectors
from compas.geometry import length_vector
from compas.geometry import centroid_points
from compas.geometry import norm_vector
from compas_tn... | Review this code and list any quality issues. | [
{
"issue": "Function 'vertical_from_q_alglib' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 18
},
{
"issue": "Function 'vertical_from_q_alglib' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
... | 10 |
python | # coding: utf-8
import pprint
import re
import six
class VersionMediatypes:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value ... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_dict' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 91
}
] | 1 |
python | import torch
from torch.utils.data import DataLoader, Dataset
from tqdm import tqdm
class Simple_Trans(Dataset):
def __init__(self, data, transform=None):
# [reps, labels]
self.reps = data[0]
self.labels = data[1]
# print(self.reps.shape, self.labels.shape) # torch.Size([60... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 13 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 20
}
] | 1 |
python | from factory import vectorizer_factory
from sklearn.base import TransformerMixin
from sklearn.pipeline import make_pipeline
from lime.lime_text import LimeTextExplainer
class VectorTransformer(TransformerMixin):
def __init__(self, vectorizer_name):
self.vectorizer_name = vectorizer_name
def fit(self,... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_explanation_for_instance' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 22
}
] | 1 |
python | import os
import sys
import subprocess
from contextlib import contextmanager
import argparse
import glob
ENV_ROOT = 'test_ambertools'
AMBER_VERSION = 'amber17'
def is_conda_package(package_dir):
basename = os.path.basename(package_dir)
return not (basename.startswith('osx') or basename.startswith('linux'))
... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 122
},
{
"issue": "Function 'main' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line":... | 2 |
python | #!/usr/bin/python
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Run this script from the root of the repository to update all translations from
transifex.
It will do the following... | Review this code and list any quality issues. | [
{
"issue": "Function 'check_format_specifiers' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 78
},
{
"issue": "Function 'postprocess_translations' has cyclomatic complexity 18 (threshold: 5). Consider breaking it into smal... | 3 |
python | #!/usr/bin/env python
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 104
}
] | 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 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 61
}
] | 1 |
python | #!/usr/bin/env python3
import json
from app.lib.utils.request import request
from app.lib.utils.common import get_useragent
class CVE_2017_8046_BaseVerify:
def __init__(self, url):
self.info = {
'name': 'CVE-2017-8046漏洞',
'description': 'CVE-2017-8046漏洞可执行任意命令,执行的命令:/usr/bin/touch ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 8
}
] | 1 |
python | """
This script is used to generate simulated count data based on a Mantid
script.
"""
import os
import numpy
def VariableStatsData(N, A0, omega, phi, sigma, bg):
x = numpy.linspace(start=0.0, stop=32.0, num=2001)
y = (1+A0*numpy.cos(omega*x+phi)*numpy.exp(-(sigma*x)**2)) * \
numpy.exp(-x/2.197)+bg
... | Review this code and list any quality issues. | [
{
"issue": "Function 'VariableStatsData' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 11
}
] | 1 |
python | #-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------
# pylint: d... | Review this code and list any quality issues. | [
{
"issue": "Function 'receive_messages' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 100
}
] | 1 |
python | from precisely import all_of, assert_that, contains_exactly, equal_to, has_attrs, has_feature, is_instance
import graphlayer as g
from graphlayer import graphql
from graphql import GraphQLError
def test_execute():
Root = g.ObjectType("Root", fields=(
g.field("value", g.String),
))
root_resolver ... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_can_query_schema_with_other_data' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 86
}
] | 1 |
python | # coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 129
}
] | 1 |
python | import abc
import typing
import sqlalchemy.orm
import mlrun.api.db.session
import mlrun.api.schemas
import mlrun.utils.singleton
from mlrun.utils import logger
class Member(abc.ABC):
@abc.abstractmethod
def initialize(self):
pass
@abc.abstractmethod
def shutdown(self):
pass
def... | Review this code and list any quality issues. | [
{
"issue": "Function 'ensure_project' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 21
},
{
"issue": "Function 'ensure_project' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": ... | 6 |
python | # -*- coding: utf-8 -*-
import bisect
from cms.models import Title, Page, EmptyTitle
from cms.utils import get_language_list
from cms.utils.compat import DJANGO_1_5
from cms.utils.conf import get_cms_setting
from cms.utils.permissions import get_user_sites_queryset
from django.contrib.admin.views.main import ChangeList... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_query_set' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 62
},
{
"issue": "Function 'set_items' has cyclomatic complexity 22 (threshold: 5). Consider breaking it into smaller functions.",
"sev... | 3 |
python | from typing import Callable, List, Dict, Union
import atexit
from collections.abc import Sequence
from copy import deepcopy
import os
from PIL import Image
from fastapi import FastAPI, UploadFile, File, Request
from fastapi.templating import Jinja2Templates
from pydantic import BaseModel
from datetime import datetime
... | Review this code and list any quality issues. | [
{
"issue": "Function 'setup' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 39
}
] | 1 |
python | import json
from Function.Symbol_ReplaceController import *
from Function.Position_strController import *
from Function.initdate_ReplaceController import *
from Function.Date_ReplaceController import *
from JsonReplace import JsonReplace
def get_new_json(file_path):
# 打开json文件
file = open(file_path, encoding='... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_new_json' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 8
},
{
"issue": "Function 'get_new_json' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor... | 2 |
python | """
Documents Distributor - CallStreet Events
CallStreet Events contains all the Documents Distributor APIs that provide events data such as Events Audio and Near Real-Time Transcripts The Events Audio API provides access to all audio recordings to various company events covered by FactSet. The events includ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 47
},
{
"issue": "Function '__init__' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 13 |
python | import flask
import itertools
from . import tag_validation
from .entities import Entity, entities_blueprint
from ..api import AlmacenAPI, api
from datetime import datetime
from data_layer import Redshift as SQL
from typing import List, Dict, Optional
from subir import Tagger
time_format = '%Y-%m-%d %H:%M:%S'
tags_blu... | Review this code and list any quality issues. | [
{
"issue": "Function 'tag_entities_query' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 17
}
] | 1 |
python | #! /usr/bin/python
"""
boilerplate_sparkbot
This is a sample boilerplate application that provides the framework to quickly
build and deploy an interactive Spark Bot.
There are different strategies for building a Spark Bot. You can either create
a new dedicated Spark Account for the bot, or creat... | Review this code and list any quality issues. | [
{
"issue": "Function 'process_incoming_message' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 190
}
] | 1 |
python | # ///////////////////////////////////////////////////////////////
#
# BY: WANDERSON M.PIMENTA
# PROJECT MADE WITH: Qt Designer and PySide6
# V: 1.0.0
#
# This project can be used freely for all uses, as long as they maintain the
# respective credits only in the Python scripts, any information in the visual
# interface ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 43 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 35
},
{
"issue": "Function '__init__' has 12 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 35
... | 5 |
python | import os
import wx
import wx.aui
import time
import pcbnew
import textwrap
import threading
import subprocess
import configparser
import re
# Remove java offending characters
def search_n_strip(s):
s = re.sub('[Ωµ]', '', s)
return s
#
# FreeRouting round trip invocation:
# * export board.dsn file from pcbnew... | Review this code and list any quality issues. | [
{
"issue": "Function 'prepare' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 38
},
{
"issue": "Function 'prepare' is 44 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"l... | 4 |
python | import pybullet as p
from pyrosim.nndf import NNDF
from pyrosim.linksdf import LINK_SDF
from pyrosim.linkurdf import LINK_URDF
from pyrosim.model import MODEL
from pyrosim.sdf import SDF
from pyrosim.urdf import URDF
from pyrosim.joint import JOINT
SDF_FILETYPE = 0
URDF_FILETYPE = 1
NNDF_FILETYPE = 2
... | Review this code and list any quality issues. | [
{
"issue": "Function 'Send_Joint' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 139
},
{
"issue": "Function 'Set_Motor_For_Joint' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 158
... | 2 |
python | from synergine.lib.process.processmanager import KeepedAliveProcessManager
from synergine.core.cycle.PipePackage import PipePackage
from synergine.core.simulation.EventManager import EventManager
from synergine.core.Signals import Signals
from synergine.synergy.event.exception.ActionAborted import ActionAborted
class... | 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": 15
}
] | 1 |
python | import numpy as np
from numpy.testing import (assert_allclose, assert_equal,
assert_almost_equal, assert_array_equal,
assert_array_almost_equal)
from scipy.ndimage import convolve1d
from scipy.signal import savgol_coeffs, savgol_filter
from scipy.signal._savitzky_... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_sg_filter_interp_edges' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 251
},
{
"issue": "Function 'test_sg_filter_interp_edges_3d' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
... | 2 |
python | # This module contains abstractions for the input stream. You don't have to
# looks further, there are no pretty code.
#
# We define two classes here.
#
# Mark(source, line, column)
# It's just a record and its only use is producing nice error messages.
# Parser does not use it for any other purposes.
#
# Reader(so... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 26
},
{
"issue": "Function '__init__' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 59
},
{
... | 6 |
python | from rest_framework import viewsets, request
from rest_framework.response import Response
from rest_framework.decorators import action
from posthog.models import Event, Filter
from posthog.utils import request_to_date_query, dict_from_cursor_fetchall
from django.db.models import OuterRef
from django.db import connectio... | Review this code and list any quality issues. | [
{
"issue": "Function 'list' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 94
},
{
"issue": "Function 'list' is 69 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": ... | 2 |
python | # Copyright 2021 Christophe Bedard
#
# 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 wri... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_all' is 224 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 47
}
] | 1 |
python | import requests
from urllib.parse import urlencode
from urllib.request import urlopen
from urllib.error import HTTPError
import re
import json
from base64 import b64encode
def get_playlists(spotify_url):
with open('MY_SECRETS.json', 'r') as f:
spotify_key = json.load(f)['SPOTIFY_KEY']
pl... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_playlists' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 10
},
{
"issue": "Function 'get_playlists' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "mi... | 2 |
python | # -*- coding: utf-8 -*-
from collective.solr.interfaces import ISolrConnectionManager
from collective.solr.interfaces import IZCMLSolrConnectionConfig
from collective.solr.local import getLocal
from collective.solr.local import setLocal
from collective.solr.solr import SolrConnection
from collective.solr.utils import g... | Review this code and list any quality issues. | [
{
"issue": "Function 'setHost' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 42
},
{
"issue": "Function 'setTimeout' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line... | 2 |
python | """
Provides a cross-platform way to figure out the system uptime.
Should work on damned near any operating system you can realistically expect
to be asked to write Python code for.
If this module is invoked as a stand-alone script, it will print the current
uptime in a human-readable format, or display an error messa... | Review this code and list any quality issues. | [
{
"issue": "Function '_uptime_solaris' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 149
},
{
"issue": "Function '_uptime_solaris' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity"... | 3 |
python | import numpy as np
from . import dtypes, nputils, utils
from .duck_array_ops import _dask_or_eager_func, count, fillna, isnull, where_method
from .pycompat import dask_array_type
try:
import dask.array as dask_array
except ImportError:
dask_array = None
def _replace_nan(a, val):
"""
replace nan in a... | Review this code and list any quality issues. | [
{
"issue": "Function '_maybe_null_out' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 22
},
{
"issue": "Function '_nan_argminmax_object' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity":... | 9 |
python | import torch
#from imsitu_encoder_verbq import imsitu_encoder
from imsitu_encoder_roleqverbq_embdhz import imsitu_encoder
from imsitu_loader import imsitu_loader_roleq_updated
from imsitu_scorer_log import imsitu_scorer
import json
import model_verbq_working
import os
import utils
import time
import random
#from torchv... | Review this code and list any quality issues. | [
{
"issue": "Function 'train' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 16
},
{
"issue": "Function 'train' is 72 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 5 |
python | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2018, Simon Dodsley (simon@purestorage.com)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',... | 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": 161
},
{
"issue": "Function 'main' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line"... | 2 |
python | #!/usr/bin/python
"""
Robert Ramsay <robert.alan.ramsay@gmail.com>
Packing your Dropbox
When you're working with petabytes of data, you have to store files wherever they can fit. All of us here at Dropbox are always searching for more ways to efficiently pack data into smaller and more manageable chunks. The fun begins... | Review this code and list any quality issues. | [
{
"issue": "Function 'fit' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 52
},
{
"issue": "Function 'fit' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 52... | 8 |
python | # -*- coding: utf8 -*-
from ssh_config import ConfigParser
from exceptions import StormValueError
from operator import itemgetter
import getpass
__version__ = '0.5.2'
class Storm(object):
def __init__(self, ssh_config_file=None):
self.ssh_config = ConfigParser(ssh_config_file)
self.ssh_config... | Review this code and list any quality issues. | [
{
"issue": "Function 'add_entry' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 19
},
{
"issue": "Function 'edit_entry' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 30
},
{
... | 4 |
python | from __future__ import absolute_import
from __future__ import print_function
from functools import wraps
from django.core.cache import cache as djcache
from django.core.cache import caches
from django.conf import settings
from django.db.models import Q
from django.core.cache.backends.base import BaseCache
from typin... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_or_create_key_prefix' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 58
},
{
"issue": "Function 'generic_bulk_cached_fetch' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into sm... | 5 |
python | import os
import sys
from unittest import mock
import pytest
from praw.config import Config
from praw.exceptions import ClientException
class TestConfig:
@staticmethod
def _assert_config_read(environment, mock_config):
mock_instance = mock_config.return_value
Config.CONFIG = None # Force co... | Review this code and list any quality issues. | [
{
"issue": "Function '_assert_config_read' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 13
},
{
"issue": "Function '_assert_config_read' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"se... | 2 |
python | # Copyright 2016 - Nokia
#
# 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 'zabbix_client_login' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 48
},
{
"issue": "Function '_status_changed' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.... | 2 |
python | import numpy as np
from collections import deque
import pickle
import torch
from utils import collect_trajectories, random_sample
from PPO import PPO
import matplotlib.pyplot as plt
from parallelEnv import *
import gym
env = gym.make("CartPole-v0")
env.reset()
env.seed(2)
obs_dim = env.observation_space.shape[0]
n_ac... | Review this code and list any quality issues. | [
{
"issue": "Function 'train' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 19
},
{
"issue": "Function 'train' is 72 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line... | 2 |
python | import os
import re
import codecs
from utils import create_dico, create_mapping, zero_digits
from utils import iob2, iob_iobes
def load_sentences(path, lower, zeros):
"""
Load sentences. A line must contain at least a word and its tag.
Sentences are separated by empty lines.
"""
sentences = []
... | Review this code and list any quality issues. | [
{
"issue": "Function 'load_sentences' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 8
},
{
"issue": "Function 'update_tag_scheme' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
... | 5 |
python | import numpy as np
from vispy.scene.visuals import Compound, Line, Mesh, Text
from vispy.visuals.transforms import STTransform
from ...layers.shapes._shapes_utils import triangulate_ellipse
from ...utils.colormaps.standardize_color import transform_color
from ...utils.theme import get_theme
from ...utils.translations ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 71 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 135
},
{
"issue": "Function '_on_data_change' has cyclomatic complexity 19 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "cri... | 3 |
python | import os
import random
import numpy as np
import pandas as pd
import tensorflow as tf
from augment import Augment
AUTO = tf.data.experimental.AUTOTUNE
def set_dataset(task, data_path):
trainset = pd.read_csv(
os.path.join(
data_path, 'imagenet_trainset.csv'
)).value... | 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": 32
}
] | 1 |
python | import json
import os
from astropy.table import Table, Column
from ..config import exporters
from ..qt.widgets import ScatterWidget, HistogramWidget
from ..core import Subset
def save_page(page, page_number, label, subset):
""" Convert a tab of a glue session into a D3PO page
:param page: Tuple of data vie... | Review this code and list any quality issues. | [
{
"issue": "Function 'stage_subsets' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 100
},
{
"issue": "Function 'can_save_d3po' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
... | 2 |
python | # Copyright © 2019 Province of British Columbia
#
# 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 'update_from_jwt_token' has cyclomatic complexity 20 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 122
},
{
"issue": "Function 'update_from_jwt_token' is 34 lines long. Functions over 25 lines are harder to test and maintain."... | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.