language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | import cv2
import sys
import os
import numpy as np
import time
# Initialize the parameters
confThreshold = 0.5 # Confidence threshold
nmsThreshold = 0.4 # Non-maximum suppression threshold
inpWidth = 416 # Width of network's input image
inpHeight = 416 # Height of network's input image
startin... | Review this code and list any quality issues. | [
{
"issue": "Function 'drawPred' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 53
},
{
"issue": "Function 'postprocess' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 69
}
] | 2 |
python | import collections
import functools
from typing import Dict, List, Tuple, Counter
from tool.runners.python import SubmissionPy
def parse(s: str) -> Tuple[List[str], Dict[Tuple[str, str], str]]:
lines = s.splitlines()
initial = list(lines[0].strip())
mapping = {}
for line in lines[2:]:
if strip... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_skasch' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 44
}
] | 1 |
python | import unittest
import importlib
from pbutils.streams import warn
# Try to import flask settings module:
settings = None
try:
pkg_root = __name__.split('.')[0]
settings_modname = '{}.settings'.format(pkg_root)
settings = importlib.import_module(settings_modname)
except ImportError as e:
warn('Unable t... | Review this code and list any quality issues. | [
{
"issue": "Function '_test_status' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 37
},
{
"issue": "Function '_test_post_status' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 58
... | 3 |
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.
#----------------------------------------------------------------------... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_mgmt_batch_account' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 107
},
{
"issue": "Function 'test_mgmt_batch_applications' is 71 lines long. Functions over 25 lines are harder to test and maintain.",
"se... | 5 |
python | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 17
},
{
"issue": "Function '__init__' is 63 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical... | 3 |
python | import os
import re
import pipelinewise.cli as cli
import pytest
VIRTUALENVS_DIR = './virtualenvs-dummy'
# pylint: disable=no-self-use,fixme
class TestUtils:
"""
Unit Tests for PipelineWise CLI utility functions
"""
def test_json_detectors(self):
"""Testing JSON detector functions"""
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_json_loader' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 30
},
{
"issue": "Function 'test_extract_log_attributes' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": ... | 4 |
python | import os, sys
import time
import warnings
import argparse
import configparser
import ast
import numpy as np
from math import log
from rdkit import Chem
from rdkit import rdBase
rdBase.DisableLog('rdApp.*')
from rdkit.Chem import Draw
from keras.models import load_model
sys.path.append('../src/')
from python import h... | Review this code and list any quality issues. | [
{
"issue": "Function 'sample' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 47
}
] | 1 |
python | import json
from jupyterlab.labapp import LabApp
from notebook.base.handlers import APIHandler
from notebook.utils import url_path_join
import tornado
from .api import group_info, submit_job, get_env, check_function_set
from .utils import get_group_volume_path
import os.path
from shutil import copyfile
from datetime i... | Review this code and list any quality issues. | [
{
"issue": "Function 'post' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 47
}
] | 1 |
python | # coding: utf-8
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class UpdateTaskStatusResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_dict' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 36
}
] | 1 |
python | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import os
import sys
import unittest
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
import torch.nn as nn
import torch.optim as optim
from opacus import PrivacyEngine
from opacus.distributed ... | Review this code and list any quality issues. | [
{
"issue": "Function 'demo_basic' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 78
},
{
"issue": "Function 'demo_basic' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 78
},
... | 7 |
python | import tensorflow as tf
import common
def inference(x, num_output, wd, dropout_rate, is_training, transfer_mode= False, model_type= 'A'):
# Create tables describing VGG configurations A, B, D, E
if model_type == 'A':
config = [64, 'M', 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M']
elif model_ty... | Review this code and list any quality issues. | [
{
"issue": "Function 'inference' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 4
},
{
"issue": "Function 'inference' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 3 |
python | #!/usr/bin/env python3
import argparse
import io
import sys
PY2 = sys.version_info[0] == 2
if PY2:
from itertools import izip_longest as zip_longest
else:
from itertools import zip_longest
def get_parser():
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 30
},
{
"issue": "Function 'main' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 2 |
python | from vlasisku.utils import compound2affixes
class Entry(object):
"""Container for jbovlaste entry data."""
#: The word (or compound) this entry describes.
word = None
#: The type of the word, such as ``'gismu'``.
type = None
#: A list of three-letter affix forms for the word.
affixes = ... | Review this code and list any quality issues. | [
{
"issue": "Function 'components' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 60
}
] | 1 |
python | import unittest
from gr_nlp_toolkit.labels.dp_labels import dp_labels
from gr_nlp_toolkit.labels.ner_labels import ner_labels
from gr_nlp_toolkit.labels.pos_labels import pos_labels, pos_properties
from gr_nlp_toolkit.pipeline.pipeline import Pipeline
class TestPipeline(unittest.TestCase):
def test_using_all_pro... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_using_all_processors' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 10
},
{
"issue": "Function 'test_annotations_are_same_with_multiple_configurations' is 28 lines long. Functions over 25 lines are harder to t... | 2 |
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 14 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 103
}
] | 1 |
python | '''
* File: settings.py
* Author: George Ungureanu <ugeorge@kth.se>
* Purpose: This file contains methods for collecting configuration options
and initialize the settings object which holds the parameters
throughout the program execution.
* License: BSD3
'''
'''
Copyright (... | 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": 62
},
{
"issue": "Function '__init__' is 59 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical... | 2 |
python | from __future__ import print_function
from functools import wraps
import logging
try:
import ujson as json
except ImportError:
import json
from flask import Flask as _Flask
from flask.globals import _request_ctx_stack
from werkzeug.wrappers import Response
from werkzeug.datastructures import Headers
from werk... | Review this code and list any quality issues. | [
{
"issue": "Function 'route' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 77
},
{
"issue": "Function 'api.api.decorator.inner' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor"... | 2 |
python | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import re
from scripts.data_cleaner import set_new_error
#from scripts.data_cleaner_v2 import calculateNumber
class PublicAccountCleanerMix:
# cleaning
def column_formatter_v3(self, reset=False, image_num=None):
from public... | Review this code and list any quality issues. | [
{
"issue": "Function 'column_formatter_v3' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 14
},
{
"issue": "Function 'column_formatter_v3' is 56 lines long. Functions over 25 lines are harder to test and maintain.",
... | 6 |
python | import numpy as np
import pandas as pd
""" Contains core classes and methods for initializing a Assembly System, the inputs are provided in assemblyconfig file in utilities"""
class AssemblySystem:
"""Assembly System Class
:param assembly_type: Type of assembly Single-Station/Multi-Station
:type assembly_system:... | 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": 36
},
{
"issue": "Function '__init__' has 12 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 92
}
] | 2 |
python | """
Copyright (c) 2018-2021 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 wri... | Review this code and list any quality issues. | [
{
"issue": "Function 'convert' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 45
},
{
"issue": "Function 'convert' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"... | 3 |
python | import os
import numpy as np
import torch
import torch.nn.functional as F
from lib.utils.bbox_transform import decode_bbox_target
from tools.kitti_object_eval_python.evaluate import evaluate as kitti_evaluate
from lib.config import cfg
import lib.utils.kitti_utils as kitti_utils
import lib.utils.iou3d.iou3d_utils as i... | Review this code and list any quality issues. | [
{
"issue": "Function 'save_kitti_format' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 18
},
{
"issue": "Function 'eval_one_epoch_joint' has cyclomatic complexity 24 (threshold: 5). Consider breaking it into smaller functions.",
"severity... | 3 |
python | from math import log10
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import Matern
import numpy as np
from .utils import create_rng
class BO:
"""
Bayesian Optimization framework
"""
def __init__(self, k, hidden_dim=(100, 10000),
s... | Review this code and list any quality issues. | [
{
"issue": "Function 'find_best_choices' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 160
}
] | 1 |
python | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Tests for the astropylibrarian.reducers.utils module.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from astropylibrarian.reducers.utils import iter_sphinx_sections
if TYPE_CHECKING:
from .conftest import HtmlTestData
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_iter_sphinx_sections' is 86 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 15
}
] | 1 |
python | """
Sphinx plugins for RapidSMS documentation.
"""
try:
import json
except ImportError:
try:
import simplejson as json
except ImportError:
try:
from django.utils import simplejson as json
except ImportError:
json = None
from sphinx import addnodes, roles
fro... | 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": 53
}
] | 1 |
python | #!/usr/bin/env python3
# pylint: disable=unused-import
import collections
import functools
import io
import itertools
import operator as op
import re
import timeit
import numpy as np
import aocd
YEAR = 2021
DAY = 11
def step(grid):
grid += 1
flash = np.zeros_like(grid, dtype=bool)
while np.any(grid[~fl... | 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": 37
}
] | 1 |
python | import asyncio
import json
import logging
from datetime import datetime
from typing import Any, Dict, Iterable, List, Optional, Set, Union
import httpx
import websockets
from websockets import exceptions
logger = logging.getLogger("yufuquantsdk")
class WebsocketAPIClient:
def __init__(self, uri: str, ws: websoc... | Review this code and list any quality issues. | [
{
"issue": "Function '_run' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 145
},
{
"issue": "Function '_run' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line"... | 4 |
python | # -*- coding: utf-8 -*-
import logging
import math
import os
import random
import shutil
import tensorflow as tf
from jack import readers
from jack.core.tensorflow import TFReader
from jack.eval import evaluate_reader, pretty_print_results
from jack.util.hooks import LossHook, ExamplesPerSecHook, ETAHook
logger = l... | Review this code and list any quality issues. | [
{
"issue": "Function 'train' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 19
},
{
"issue": "Function 'train_tensorflow.side_effect' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "m... | 9 |
python | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 9 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 107
},
{
"issue": "Function '_validate_linear_feature_columns' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"se... | 4 |
python | from typing import List, Dict, Any
import torch
import trtorch._C
from trtorch import _types
def _supported_input_size_type(input_size: Any) -> bool:
if isinstance(input_size, torch.Size):
return True
elif isinstance(input_size, tuple):
return True
elif isinstance(input_size, list):
... | Review this code and list any quality issues. | [
{
"issue": "Function '_parse_input_ranges' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 20
},
{
"issue": "Function '_parse_input_ranges' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"s... | 6 |
python | from tests.analyzer.utils import UnusedTestCase
from unimport.statement import Import, ImportFrom
class AsImportTestCase(UnusedTestCase):
def test_as_import_all_unused_all_cases(self):
self.assertSourceAfterScanningEqualToExpected(
"""\
from x import y as z
import x
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_as_import_all_unused_all_cases' is 89 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 6
},
{
"issue": "Function 'test_as_import_one_used_in_function_all_cases' is 84 lines long. Functions over 25 lines are harder to t... | 2 |
python | from __future__ import print_function
import os
import pickle
import time
from gym_puyopuyo import register
import gym
import numpy as np
import neat
import visualize
piece_shape = (3, 2)
DRAW_NETS = False
NUM_COLORS = 3.0 # 3 colors in the small env mode
# TODO: could probably read color number from observation da... | Review this code and list any quality issues. | [
{
"issue": "Function 'run' is 43 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 38
}
] | 1 |
python | from multiprocessing import Pool
import argparse
import glob
import os
import io
import time
import logging
import gluonnlp as nlp
import tokenizer as tokenization
parser = argparse.ArgumentParser(description='BERT tokenizer')
parser.add_argument('--input_files', type=str, default='wiki_*.doc',
hel... | Review this code and list any quality issues. | [
{
"issue": "Function 'f' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 37
}
] | 1 |
python | '''
Main functionality of ``image_slicer``.
'''
import os
import time
import optparse
from math import sqrt, ceil, floor
from PIL import Image
from helpers import get_basename
class Tile(object):
"""Represents a single tile."""
def __init__(self, image, number, position, coords, filename=None):
sel... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 17
},
{
"issue": "Function 'main' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 17... | 2 |
python | from itertools import zip_longest
DAY = 'day'
HOUR = 'hour'
NAME = 'name'
class Formatter:
def __init__(self, indent=5 * ' '):
self.indent = indent
def append(self, text, tag=None):
raise NotImplementedError('Must override append() in derived class')
def println(self, *args):
se... | Review this code and list any quality issues. | [
{
"issue": "Function 'show' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 28
}
] | 1 |
python | #
# (C) Copyright IBM Corp. 2020
#
# 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 writi... | Review this code and list any quality issues. | [
{
"issue": "Function 'generate_swift_token' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 60
},
{
"issue": "Function 'get_object' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
... | 5 |
python | """
RenderPipeline
Copyright (c) 2014-2016 tobspr <tobias.springer1@gmail.com>
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, including without limitation the rights
to use... | Review this code and list any quality issues. | [
{
"issue": "Function '_get_shader_handle' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 120
}
] | 1 |
python | # -*- coding: utf-8 -*-
'''
Apache Libcloud Load Balancer State
===================================
Manage load balancers using libcloud
:codeauthor: ``Anthony Shaw <anthonyshaw@apache.org>``
Apache Libcloud load balancer management for a full list
of supported clouds, see http://libcloud.readthedocs.io/en/lates... | Review this code and list any quality issues. | [
{
"issue": "Function 'balancer_present' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 76
},
{
"issue": "Function 'balancer_present' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "ma... | 4 |
python | """Patching utilities for working with fake objects.
See :ref:`using-fudge` for common scenarios.
"""
__all__ = ['patch_object', 'with_patched_object', 'PatchHandler',
'patched_context', 'patch']
import sys
import fudge
from fudge.util import wraps
class patch(object):
"""A test decorator that patc... | Review this code and list any quality issues. | [
{
"issue": "Function 'patch_object' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 190
}
] | 1 |
python | # Copyright (c) Aishwarya Kamath & Nicolas Carion. Licensed under the Apache License 2.0. All Rights Reserved
"""
COCO dataset which returns image_id for evaluation.
Mostly copy-paste from https://github.com/ashkamath/mdetr/blob/main/datasets/gqa.py
"""
import json
from pathlib import Path
import torch
import torchvi... | 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": 20
},
{
"issue": "Function '__getitem__' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
... | 5 |
python | import os
import base64
from simpleutil.utils import digestutils
from goperation.filemanager import LocalFile
from goperation.manager.rpc.agent.application.taskflow.middleware import EntityMiddleware
from goperation.manager.rpc.agent.application.taskflow.database import Database
from goperation.manager.rpc.agent.appl... | 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 'prepare' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line":... | 2 |
python | #!/usr/bin/env python3
# XML API, for dealing with XML strings
# -*- coding: utf-8 -*-
__all__ = ['parseargs', 'collect']
'<users>\n\t<user>\n\t\t<id>1</id>\n\t\t<name>Fred</name>\n\t\t<salary>500000</salary>\n\t</user>\n\t<user>\n\t\t<id>1</id>\n\t\t<name>ScienceCat</name>\n\t\t<salary>500000</salary>\n\t</user>\n\t... | Review this code and list any quality issues. | [
{
"issue": "Function 'parseargs' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 14
},
{
"issue": "Function 'collect' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity":... | 3 |
python | # -*- coding: utf-8 -*-
"""Amavis factories."""
from __future__ import unicode_literals
import datetime
import time
import factory
from . import models
from .utils import smart_bytes
SPAM_BODY = """X-Envelope-To: <{rcpt}>
X-Envelope-To-Blocked: <{rcpt}>
X-Quarantine-ID: <nq6ekd4wtXZg>
X-Spam-Flag: YES
X-Spam-Scor... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_quarantined_msg' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 139
}
] | 1 |
python | import os
from datetime import datetime
from flask import Flask, render_template, flash, safe_join, send_file
from flask_user import login_required, current_user
from werkzeug.utils import secure_filename
from pygate_grpc.client import PowerGateClient
from deplatformr.models.filecoin_models import Ffs, Files, Logs
from... | Review this code and list any quality issues. | [
{
"issue": "Function 'filecoin_download' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 22
},
{
"issue": "Function 'filecoin_download' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severi... | 2 |
python | from mythic_payloadtype_container.MythicCommandBase import *
import json
from mythic_payloadtype_container.MythicRPC import *
import base64
class InjectArguments(TaskArguments):
def __init__(self, command_line):
super().__init__(command_line)
self.args = {
"template": CommandParameter(... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_tasking' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 45
},
{
"issue": "Function 'create_tasking' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "... | 2 |
python | import numpy as np
from .base import Price
class GBM(Price):
"""Brownian motion."""
def __init__(self, T=1., sigma1=0.02, sigma2=0.01, s1=1., s2=1.,
drift1=0., drift2=0., n=100):
self.sigma1 = sigma1
self.sigma2 = sigma2
self.drift1 = drift1
self.drift2 = drift... | 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": 7
}
] | 1 |
python | # Copyright (c) 2016 by Matt Sewall.
# All rights reserved.
import math
import csv
import json
import os
import shutil
from sys import argv
from datetime import datetime
from django.utils.encoding import smart_str, smart_unicode
from operator import itemgetter
from elo_classes import *
from elo import *
# Elos dicti... | Review this code and list any quality issues. | [
{
"issue": "Function 'do_elo' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 27
},
{
"issue": "Function 'do_elo' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"lin... | 5 |
python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: DIYer22@github
@mail: ylxx@live.com
Created on Thu Jan 16 18:17:20 2020
"""
from boxx import *
from boxx import deg2rad, np, pi
import bpy
import random
def set_cam_pose(cam_radius=1, cam_deg=45, cam_x_deg=None, cam=None):
cam_rad = deg2rad(cam_deg)
... | Review this code and list any quality issues. | [
{
"issue": "Function 'remove_useless_data' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 63
}
] | 1 |
python | from libcrypto import hamming_distance
from libcrypto import split_blocks
from libcrypto import xor
from libcrypto import freq_score
from base64 import b64decode
from operator import itemgetter
def main():
file64 = ""
for line in open("../assets/inputS1C6.txt","r"):
file64 += line.rstrip()
file... | 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": 10
},
{
"issue": "Function 'main' is 44 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line":... | 2 |
python | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Review this code and list any quality issues. | [
{
"issue": "Function '_generate_image_and_label_batch' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 101
},
{
"issue": "Function 'distorted_inputs' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "... | 4 |
python | # A simple CLI runner for slurm that can be used when running Galaxy from a
# non-submit host and using a Slurm cluster.
from logging import getLogger
try:
from galaxy.model import Job
job_states = Job.states
except ImportError:
# Not in Galaxy, map Galaxy job states to Pulsar ones.
from pulsar.util im... | Review this code and list any quality issues. | [
{
"issue": "Function 'job_script_kwargs' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 32
}
] | 1 |
python | """DenseNet models for Keras.
# Reference paper
- [Densely Connected Convolutional Networks]
(https://arxiv.org/abs/1608.06993) (CVPR 2017 Best Paper Award)
# Reference implementation
- [Torch DenseNets]
(https://github.com/liuzhuang13/DenseNet/blob/master/models/densenet.lua)
- [TensorNets]
(https://github.com/t... | Review this code and list any quality issues. | [
{
"issue": "Function 'nn_base' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 124
},
{
"issue": "Function 'nn_base' is 46 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical"... | 4 |
python | # -*- coding: utf-8 -*-
"""
Author
------
Bo Zhang
Email
-----
bozhang@nao.cas.cn
Created on
----------
- Fri Jul 3 13:13:06 2015 read_spectrum
Modifications
-------------
- Fri Nov 20 10:16:59 2015 reformatting code
- Sun Feb 28 14:39:16 2016 migrated to bopy.spec.lamost
- Fri Jul 15 16:08:00 2016 mig... | Review this code and list any quality issues. | [
{
"issue": "Function 'lamost_filepath' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 36
},
{
"issue": "Function 'lamost_filepath' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "maj... | 4 |
python | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import asyncio
import pyppeteer
import time
import os
import random
from exe_js import js1, js3, js4, js5
# http://www.mamicode.com/info-detail-2302923.html
# https://segmentfault.com/a/1190000011627343
"""
{
proxy: "127.0.0.1:1234",
proxy-auth: "userx:passx",
prox... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 23
}
] | 1 |
python | import educative.course1.stacks_queues.stack as s
input_data = [23, 60, 12, 42, 4, 97, 2]
expected_output_data = [2, 4, 12, 23, 42, 60, 97]
# This solution uses a second stack
# 1. until input stack is not empty, we pop the top value and compare it
# with the top value of the second stack
# 2. if value > top of s... | Review this code and list any quality issues. | [
{
"issue": "Function 'sort_stack_1' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 17
}
] | 1 |
python | ###############################################################################
# Author: CallMeCCLemon
# Date: 2019
# Copyright: 2019 Thomas Littlejohn (@CallMeCCLemon) - Modified BSD License
###############################################################################
from enum import Enum
from Py... | Review this code and list any quality issues. | [
{
"issue": "Function 'connected' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 68
}
] | 1 |
python | import copy
import re
from collections import defaultdict
from typing import List, Dict
from .substitution_augmenter import SubstitutionAugmenter
from ..actions import Chemical
from ..utils import extract_chemicals
from paragraph2actions.misc import TextWithActions
class CompoundNameAugmenter(SubstitutionAugmenter):... | Review this code and list any quality issues. | [
{
"issue": "Function 'augment' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 25
}
] | 1 |
python | import numpy as np
from i3Deep import utils
from tqdm import tqdm
import os
# name = "KGU-53317EB91645"
# load_mask = "D:/Datasets/medical_data/ExportKGU/3D Slicer 2/" + name + "/mask.nii.gz"
# load_label_table = "D:/Datasets/medical_data/ExportKGU/3D Slicer 2/" + name + "/label_table.txt"
# save_mask = "D:/... | Review this code and list any quality issues. | [
{
"issue": "Function 'rename' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 14
},
{
"issue": "Function 'get_labels' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity"... | 2 |
python | import base64
import json
import requests
import urllib3
from contextlib import contextmanager
from packaging.version import Version
from requests.adapters import HTTPAdapter
from urllib3.util import Retry
from requests.exceptions import HTTPError
from mlflow import __version__
from mlflow.protos import databricks_pb2... | Review this code and list any quality issues. | [
{
"issue": "Function '_get_http_response_with_retries' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 36
},
{
"issue": "Function 'http_request' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"sev... | 8 |
python | """
sampling.py
We sample Metropolis-Hastings:
* Random walk proposals
* Langevin proposals
* Langevin proposals with preconditioning
* Hamiltonian MC
* Hamiltonian MC with preconditioning
NOTE:
The functionality of this module is restricted to log-densities,
i.e. densities of the form p(s... | Review this code and list any quality issues. | [
{
"issue": "Function 'metropolishastings_rw' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 24
},
{
"issue": "Function 'metropolishastings_lang' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
... | 10 |
python | # Copyright 2019 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_random_crop_and_resize_op_py' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 71
},
{
"issue": "Function 'test_random_crop_and_resize_comp' is 26 lines long. Functions over 25 lines are harder to test and mainta... | 2 |
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 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 62
},
{
"issue": "Function 'to_dict' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line"... | 2 |
python | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'test.ui'
#
# Created by: PyQt5 UI code generator 5.15.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, ... | Review this code and list any quality issues. | [
{
"issue": "Function 'setupUi' is 284 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 15
},
{
"issue": "Function 'retranslateUi' is 75 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 3... | 2 |
python | from functools import reduce
from itertools import chain
from operator import add
from typing import Iterable, Optional, TypeVar
from lhotse.audio import Recording, RecordingSet
from lhotse.cut import Cut, CutSet, MixedCut
from lhotse.features import FeatureSet, Features
from lhotse.supervision import SupervisionSegme... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_manifest' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 21
}
] | 1 |
python | import csv
import sys
from flee import flee
from flee import SimulationSettings
class InputGeography:
"""
Class which reads in Geographic information.
"""
def __init__(self):
self.locations = []
self.links = []
def ReadLocationsFromCSV(self, csv_name, columns=["name", "region", "... | Review this code and list any quality issues. | [
{
"issue": "Function 'ReadLinksFromCSV' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 43
},
{
"issue": "Function 'StoreInputGeographyInEcosystem' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
... | 3 |
python | import torch
from torch.nn import functional as F
from dassl.optim import build_optimizer, build_lr_scheduler
from dassl.utils import count_num_param
from dassl.engine import TRAINER_REGISTRY, TrainerX
from dassl.engine.trainer import SimpleNet
@TRAINER_REGISTRY.register()
class CrossGrad(TrainerX):
"""Cross-gra... | Review this code and list any quality issues. | [
{
"issue": "Function 'forward_backward' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 43
}
] | 1 |
python | import sys
import numpy as np
import pennylane as qml
import pytest
import qiskit
from pennylane_qiskit import AerDevice, BasicAerDevice
from conftest import state_backends
pldevices = [("qiskit.aer", qiskit.Aer), ("qiskit.basicaer", qiskit.BasicAer)]
class TestDeviceIntegration:
"""Test the devices work corr... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_one_qubit_circuit' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 48
},
{
"issue": "Function 'test_one_qubit_circuit' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
... | 5 |
python | # flake8: noqa
# DEV: Skip linting, we lint with Python 2, we'll get SyntaxErrors from `yield from`
# stdlib
import time
import asyncio
# 3p
import aiopg
from psycopg2 import extras
# project
from ddtrace.constants import ANALYTICS_SAMPLE_RATE_KEY
from ddtrace.contrib.aiopg.patch import patch, unpatch
from ddtrace im... | Review this code and list any quality issues. | [
{
"issue": "Function 'assert_conn_is_traced' is 64 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 50
},
{
"issue": "Function 'test_patch_unpatch' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "min... | 2 |
python | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 16
},
{
"issue": "Function '__init__' is 47 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical... | 3 |
python | # -*- coding: utf-8 -*-
import sys
import os
import re
sys.path.append('../') # noqa
from jinja2 import Template
from cli_bdd.core.steps import (
command,
environment,
file as file_steps,
)
BASE_PATH = os.path.dirname(os.path.normpath(__file__))
TEMPLATES_PATH = os.path.join(BASE_PATH, 'templates')
S... | Review this code and list any quality issues. | [
{
"issue": "Function '_prepare_docstring' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 27
}
] | 1 |
python | #!/usr/bin/env python3
# Copyright (c) 2016-2017 The Michaellaoliu Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test Hierarchical Deterministic wallet function."""
from test_framework.test_framework import Mi... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_test' is 70 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 21
}
] | 1 |
python | import click
import pandas as pd
# Due textacy problems
try:
from textacy.preprocess import preprocess_text
except Exception:
from textacy.preprocess import preprocess_text
def preprocess_f(text, fix_unicode=True, lowercase=True,
no_urls=True, no_emails=True,
no_phone_numbers... | Review this code and list any quality issues. | [
{
"issue": "Function 'preprocess_f' has 10 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 10
}
] | 1 |
python | #coding=utf-8
import sys
import getopt
from core.interface.action import server_action
from core.helper.usage import usage_helper
from prettytable import PrettyTable
from core.helper.parser import config_parser
import re
class action_list(server_action):
# 参数列表示例,可以在这边增加参数描述,最终代码将根据argname生成对对应的参数
_parameters ... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse_parameters' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 48
},
{
"issue": "Function 'parse_parameters' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity... | 4 |
python | # µPing (MicroPing) for MicroPython
# copyright (c) 2018 Shawwwn <shawwwn1@gmail.com>
# License: MIT
# Internet Checksum Algorithm
# Author: Olav Morken
# https://github.com/olavmrk/python-ping/blob/master/ping.py
# @data: bytes
# ping statistics, loop mode and KeyboardInterrupt handler, + esp8266 compatible
# copyri... | Review this code and list any quality issues. | [
{
"issue": "Function 'ping' has cyclomatic complexity 40 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 38
},
{
"issue": "Function 'ping' is 165 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 3 |
python | import json
import logging
import os
import re
import sys
import time
def setup_logger():
console = logging.StreamHandler(sys.stdout)
handlers = [console]
logging.basicConfig(handlers=handlers)
root = logging.getLogger()
root.setLevel(logging.INFO)
setup_logger()
log = logging.getLogger(__name_... | Review this code and list any quality issues. | [
{
"issue": "Function 'walk' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 45
},
{
"issue": "Function 'result' has 9 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 9... | 2 |
python | import re
import os
import glob
import json
import string
import logging
import subprocess as sp
import yaxil.commons as commons
logger = logging.getLogger(__name__)
# bids legal characters for sub, ses, and task
legal = re.compile('[^a-zA-Z0-9]')
def bids_from_config(yaxil_session, scans_metadata, config, out_base)... | Review this code and list any quality issues. | [
{
"issue": "Function 'bids_from_config' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 15
},
{
"issue": "Function 'proc_func' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "maj... | 9 |
python | import numpy as np
import scipy.sparse
import theano
from theano import gof, tensor
from theano.gof.op import Op
from theano.sparse.basic import (
Remove0,
SparseType,
_is_sparse,
as_sparse_variable,
remove0,
)
# Also for compatibility
from theano.tensor import discrete_dtypes, float_dtypes
# Pr... | Review this code and list any quality issues. | [
{
"issue": "Function 'perform' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 179
}
] | 1 |
python | """Support for Eliot tracing with Dask computations."""
from pyrsistent import PClass, field
from dask import compute, optimize
from dask.core import toposort, get_dependencies
from . import start_action, current_action, Action, Message
class _RunWithEliotContext(PClass):
"""
Run a callable within an Eliot ... | Review this code and list any quality issues. | [
{
"issue": "Function '_add_logging' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 79
},
{
"issue": "Function '_add_logging' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "mino... | 2 |
python | import os
import time
from slackclient import SlackClient
import requests
import json
# starterbot's ID as an environment variable
BOT_ID = "<YOUR_BOT_ID>"
# constants
AT_BOT = "<@" + BOT_ID + ">"
MAKE_TEA_COMMAND = "make tea"
STOP_BOILING_COMMAND = "stop boiling"
# instantiate Slack & Twilio clients
slack_client = ... | Review this code and list any quality issues. | [
{
"issue": "Function 'handle_command' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 21
},
{
"issue": "Function 'parse_slack_output' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",... | 2 |
python | try:
import vim
except ImportError:
raise ImportError(
'"vim" is not available. This module require to be loaded from Vim.'
)
#
# NOTE
# Vim use a global namespace for python/python3 so define a unique name
# function and write a code inside of the function to prevent conflicts.
#
def _vim_vit... | Review this code and list any quality issues. | [
{
"issue": "Function '_vim_vital_web_api_github_main.to_vim' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 49
},
{
"issue": "Function '_vim_vital_web_api_github_main._request_entries' has cyclomatic complexity 6 (threshold... | 8 |
python | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 126
},
{
"issue": "Function '_internal_init' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
... | 5 |
python | #! /usr/bin/env python3
### stdlib imports
import pathlib
### local imports
import utils
@utils.part1
def part1(puzzleInput: str):
# Parse the coordinate pairs from the puzzle input
coordList = [
[
tuple(int(coord) for coord in pair.split(","))
for pair in line.split(" -> ")
... | Review this code and list any quality issues. | [
{
"issue": "Function 'part1' has cyclomatic complexity 21 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 10
},
{
"issue": "Function 'part1' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 2 |
python | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 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": 42
}
] | 1 |
python | """Pyramid Scene Parsing Network"""
import os
import torch
from torch import nn
import torch.nn.functional as F
from model.seg_models.segbase import SegBaseModel
from model.module.basic import _FCNHead
__all__ = ['PSPNet', 'get_psp',
'get_psp_resnet101_voc',
'get_psp_resnet101_citys']
# head
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": 65
},
{
"issue": "Function 'get_psp' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 89
}
] | 2 |
python | from __future__ import print_function
from six.moves import urllib
from .browser import Browser
from .utils import LinkNotFoundError
from .form import Form
import sys
import re
import bs4
class _BrowserState:
def __init__(self, page=None, url=None, form=None, request=None):
self.page = page
self.... | 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": 13
},
{
"issue": "Function 'new_control' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 105
},
{
... | 7 |
python | ''' Ufunc-like functions operating on Analyze headers '''
import numpy as np
from volumeutils import array_from_file, array_to_file, \
HeaderDataError, HeaderTypeError, \
calculate_scale, can_cast
def read_unscaled_data(hdr, fileobj):
''' Read raw (unscaled) data from ``fileobj``
Parameters
----... | Review this code and list any quality issues. | [
{
"issue": "Function 'read_data' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 31
},
{
"issue": "Function 'write_data' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severit... | 3 |
python | import parsel, requests, asyncio, re
from typing import List
class InComment:
def __init__(self, optional_words: List[str]=[], remove_words: List[str]=[]) -> None:
self.might_sensitive_words = [
'user',
'password',
'import',
'login',
'.php',
... | Review this code and list any quality issues. | [
{
"issue": "Function '_check_sensitive_level' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 35
},
{
"issue": "Function 'return_might_sensitive_comments' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into... | 2 |
python | """Support gathering system information of hosts which are running glances."""
import logging
from homeassistant.const import CONF_NAME, STATE_UNAVAILABLE
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity
from ... | Review this code and list any quality issues. | [
{
"issue": "Function 'async_setup_entry' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 14
},
{
"issue": "Function 'async_setup_entry' is 44 lines long. Functions over 25 lines are harder to test and maintain.",
"severi... | 5 |
python | import csv
import datetime
import json
import os
import smtplib
import threading
from flask import request, make_response, Flask, render_template
import config
from codec.actions import get_status, send_survey, send_register, get_last, get_sip, get_people, get_loss, get_diag, send_dial
#############################... | Review this code and list any quality issues. | [
{
"issue": "Function 'dashboard' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 74
},
{
"issue": "Function 'surveygraph' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severi... | 6 |
python | import logging
import os
import tempfile
import threading
from contextlib import contextmanager
from typing import Dict
from funcy import retry, wrap_with
from dvc.exceptions import (
FileMissingError,
NoOutputInExternalRepoError,
NoRemoteInExternalRepoError,
NotDvcRepoError,
OutputNotFoundError,
... | Review this code and list any quality issues. | [
{
"issue": "Function 'external_repo' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 25
},
{
"issue": "Function 'external_repo' is 48 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "m... | 5 |
python | """Class client for atome protocol."""
import json
import logging
import requests
import simplejson
from fake_useragent import UserAgent
# export const
DAILY_PERIOD_TYPE = "day"
WEEKLY_PERIOD_TYPE = "week"
MONTHLY_PERIOD_TYPE = "month"
YEARLY_PERIOD_TYPE = "year"
# internal const
COOKIE_NAME = "PHPSESSID"
API_BASE_... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 39
},
{
"issue": "Function '_login' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 61
},
{
... | 4 |
python | """Test package."""
import shapely.geometry
import simpy
import openclsim.core as core
import openclsim.model as model
from .test_utils import assert_log
def test_test_resource_synchronization():
"""Test resource Synchronization."""
simulation_start = 0
my_env = simpy.Environment(initial_time=simulati... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_test_resource_synchronization' is 133 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 12
}
] | 1 |
python | # -*- coding: utf-8 -*-
# This file as well as the whole tsfresh package are licenced under the MIT licence (see the LICENCE.txt)
# Maximilian Christ (maximilianchrist.com), Blue Yonder Gmbh, 2016
"""
Contains a feature selection method that evaluates the importance of the different extracted features. To do so,
for ev... | Review this code and list any quality issues. | [
{
"issue": "Function 'check_fs_sig_bh' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 32
},
{
"issue": "Function 'check_fs_sig_bh' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line"... | 3 |
python | import importlib
import importlib.util
import json
import os
import signal
import subprocess
import sys
import time
import urllib.request
import pytest
import matplotlib as mpl
# Minimal smoke-testing of the backends for which the dependencies are
# PyPI-installable on CI. They are not available for all tested Pyt... | Review this code and list any quality issues. | [
{
"issue": "Function '_get_testable_interactive_backends' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 20
},
{
"issue": "Function '_get_testable_interactive_backends' is 33 lines long. Functions over 25 lines are harder ... | 3 |
python | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 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": 126
},
{
"issue": "Function 'allocate_quota' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 174
}
] | 2 |
python | # coding=utf-8
import os
import sys
import django
from django.core.urlresolvers import reverse
from django.db import DatabaseError
from django.db.models import Count
from django.http import HttpResponse, Http404
from django.shortcuts import redirect, get_object_or_404
from django.utils import six
from django.views.gen... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_object' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 73
}
] | 1 |
python | #!/usr/bin/env python2
"""
Copyright (c) 2016, Bliksem Labs B.V.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list... | Review this code and list any quality issues. | [
{
"issue": "Function 'draw_data' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 91
},
{
"issue": "Function 'draw_data' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 3 |
python | # coding: utf-8
"""
ThinVolumeReinitializeDescriptor.py
The Clear BSD License
Copyright (c) – 2016, NetApp, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following con... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_dict' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 98
}
] | 1 |
python | from abc import ABCMeta, abstractmethod
from multiprocessing import Process, Value
import numpy as np
from flare.common.log import GameLogEntry
from flare.common.communicator import AgentCommunicator
from flare.common.replay_buffer import NoReplacementQueue, ReplayBuffer, Experience
class AgentHelper(object):
"""... | Review this code and list any quality issues. | [
{
"issue": "Function 'unpack_exps' has cyclomatic complexity 20 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 25
},
{
"issue": "Function 'unpack_exps' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "cr... | 5 |
python | """Decoding module."""
import numpy as np
import warnings
from . import utils
from numba import njit, int64, types, float64
def decode(H, y, snr, maxiter=1000):
"""Decode a Gaussian noise corrupted n bits message using BP algorithm.
Decoding is performed in parallel if multiple codewords are passed in y.
... | Review this code and list any quality issues. | [
{
"issue": "Function 'decode' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 9
},
{
"issue": "Function 'decode' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line... | 8 |
python | import enum
from itertools import chain
from django.contrib.auth.models import AbstractUser, UserManager as DjangoUserManager
from django.contrib.postgres.fields import ArrayField
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.functional import cached_pr... | Review this code and list any quality issues. | [
{
"issue": "Function 'save' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 48
}
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.