language
stringclasses
1 value
code
stringlengths
407
33.3k
instruction
stringclasses
1 value
flaws
listlengths
1
17
flaw_count
int64
1
17
python
from HDPython.ast.ast_classes.ast_base import v_ast_base, add_class import HDPython.hdl_converter as hdl from HDPython.ast.ast_hdl_error import HDPython_error from HDPython.base import HDPython_base class v_re_assigne_rhsift(v_ast_base): def __init__(self,lhs, rhs,context=None, astParser=None): self.lhs ...
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": 7 } ]
1
python
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from ... import _utilities, _tables from...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 17 }, { "issue": "Function '__init__' is 85 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical...
3
python
# given a string check if its palindromePermutation def solution(s): s = s.replace(' ','') if len(s) == 0 or len (s) == 1: return True if len(s) == 2: return s[0] == s[1] hashTable = [0] * 128 for i in xrange(0,len(s)): tmp = ord(s[i]) if hashTable[tmp] ...
Review this code and list any quality issues.
[ { "issue": "Function 'solution' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 3 } ]
1
python
import logging from django.conf import settings from django.contrib.auth.models import User from django.core.mail import send_mail from c3nav.celery import app logger = logging.getLogger('c3nav') @app.task(bind=True, max_retries=3) def send_changeset_proposed_notification(self, pk, author, title, description): ...
Review this code and list any quality issues.
[ { "issue": "Function 'send_changeset_proposed_notification' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 13 } ]
1
python
import json import os import sys try: from urllib.parse import urlparse, urlencode from urllib.request import urlopen, Request, build_opener, HTTPHandler from urllib.error import HTTPError except ImportError: from urlparse import urlparse from urllib import urlencode from urllib2 import urlopen...
Review this code and list any quality issues.
[ { "issue": "Function 'create_sample_workflow' is 31 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 75 }, { "issue": "Function 'run' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "ma...
3
python
# Copyright 2019-2020 The Lux Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
Review this code and list any quality issues.
[ { "issue": "Function 'test_float_categorical' is 31 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 194 }, { "issue": "Function 'test_id_music_data' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "m...
3
python
# INCOMPLETE / UNSUCCESSFUL # find median of two sorted arrays import ipdb class Solution(object): def findMedianSortedArrays(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: float """ n1 = len(nums1) n2 = len(nums2) # s...
Review this code and list any quality issues.
[ { "issue": "Function 'findMedianSortedArrays' has cyclomatic complexity 17 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 7 }, { "issue": "Function 'findMedianSortedArrays' is 56 lines long. Functions over 25 lines are harder to test and maintain."...
6
python
#!/usr/bin/env python import sys from typing import Sequence, Set import argparse import numpy import pandas _zero_svs_are_outliers = True _outlier_std_threshold = 5.0 _column_order = ["CHROM", "SVTYPE", "Mean", "Median", "STD", "Outlier_Sample", "Outlier_Number", "Outlier_Cate"] def read_statfile...
Review this code and list any quality issues.
[ { "issue": "Function 'pick_outliers_by_group' is 41 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 35 }, { "issue": "Function 'pick_outliers_by_group' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "majo...
2
python
from bs4 import BeautifulSoup import requests import test import gspread from oauth2client.service_account import ServiceAccountCredentials import datetime def update_inRange(): print("Today's Date : ",datetime.date.today()) today = datetime.date.today() - datetime.timedelta(1) yesterday_month = today.st...
Review this code and list any quality issues.
[ { "issue": "Function 'update_inRange' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 9 }, { "issue": "Function 'update_inRange' is 60 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "m...
2
python
# coding: utf-8 """ Cloudbreak API Cloudbreak is a powerful left surf that breaks over a coral reef, a mile off southwest the island of Tavarua, Fiji. Cloudbreak is a cloud agnostic Hadoop as a Service API. Abstracts the provisioning and ease management and monitoring of on-demand clusters. SequenceIQ's Cloud...
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
import json import uuid from enum import Enum import web3 from eth_account.messages import defunct_hash_message from web3 import Web3 from common.logger import get_logger logger = get_logger(__name__) class ContractType(Enum): REGISTRY = "REGISTRY" MPE = "MPE" RFAI = "RFAI" class BlockChainUtil(objec...
Review this code and list any quality issues.
[ { "issue": "Function 'create_transaction_object' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 74 } ]
1
python
# coding: utf-8 from __future__ import absolute_import import six from postfinancecheckout.api_client import ApiClient class BankAccountServiceApi: def __init__(self, configuration): self.api_client = ApiClient(configuration=configuration) def count(self, space_id, **kwargs): """Count ...
Review this code and list any quality issues.
[ { "issue": "Function 'count_with_http_info' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 39 }, { "issue": "Function 'count_with_http_info' is 49 lines long. Functions over 25 lines are harder to test and maintain.", "...
6
python
# Copyright 2016-2018 Dirk Thomas # Licensed under the Apache License, Version 2.0 import logging from pathlib import Path import sys from flake8 import LOG from flake8.api.legacy import get_style_guide # avoid debug and info messages from flake8 internals LOG.setLevel(logging.WARN) def test_flake8(): style_g...
Review this code and list any quality issues.
[ { "issue": "Function 'test_flake8' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 16 } ]
1
python
#!/usr/bin/env python from __future__ import unicode_literals import configargparse import sys from config.config import statusCode,benchmark_types, language_supported, file_location import config.bleu_results as bleu_results import tools.sp_enc_dec as sp import ancillary_functions_anuvaad.ancillary_functions as ancill...
Review this code and list any quality issues.
[ { "issue": "Function 'start' is 30 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 41 }, { "issue": "Function 'start' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 41 } ]
2
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 1999-2021 Alibaba Group Holding Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 27 } ]
1
python
# Copyright 2021 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 '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 25 }, { "issue": "Function '__init__' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line"...
3
python
'make cuda-convnet batches from images in the input dir; start numbering batches from 7' import os import sys import numpy as np import cPickle as pickle from natsort import natsorted from PIL import Image from PIL import ImageOps def process( image ): image = np.array( image ) # 32 x 32 x 3 image = np.ro...
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 35 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": ...
2
python
from __future__ import division from __future__ import print_function import tensorflow as tf import numpy as np from itertools import count import sys from networks import policy_nn from utils import * from env import Env from BFS.KB import KB from BFS.BFS import BFS import time relation = sys.argv[1] # episodes = ...
Review this code and list any quality issues.
[ { "issue": "Function 'train' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 45 }, { "issue": "Function 'train' is 35 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line"...
4
python
from importlib import import_module import re from copy import deepcopy from ..utils.data_info import MixinInfo from .column import Column from .table import Table, QTable, has_info_class from ..units.quantity import QuantityInfo __construct_mixin_classes = ('astropy.time.core.Time', 'as...
Review this code and list any quality issues.
[ { "issue": "Function '_represent_mixin_as_column' has cyclomatic complexity 18 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 35 }, { "issue": "Function '_represent_mixin_as_column' is 40 lines long. Functions over 25 lines are harder to test and m...
6
python
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and re...
Review this code and list any quality issues.
[ { "issue": "Function 'setup_snapshot_image_grid' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 27 }, { "issue": "Function 'setup_snapshot_image_grid' is 29 lines long. Functions over 25 lines are harder to test and mainta...
5
python
from collections import defaultdict from copy import copy from math import ceil, floor def parse_item(item): [num, name] = item.strip().split(' ') return {} def filter_zeroes(d): ret = defaultdict(lambda: 0) for k, v in d.items(): if v != 0: ret[k] = v return ret output_to_for...
Review this code and list any quality issues.
[ { "issue": "Function 'expand' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 55 }, { "issue": "Function 'part2' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "min...
2
python
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -----------------------------------------------------------------...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 35 } ]
1
python
""" Vanilla DenseNet implementation Paper: https://arxiv.org/abs/1608.06993 Implementation taken from: https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py """ import re from collections import OrderedDict from functools import partial from typing import Any, List, Optional, Tuple import torch im...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 18 }, { "issue": "Function 'forward' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line":...
6
python
# -*- coding: utf-8 -*- """module for android forensics.""" import os import io import subprocess import sqlite3 from datetime import datetime from modules import logger from modules import manager from modules import interface class AndForensicsConnector(interface.ModuleConnector): NAME = 'andforensics_connecto...
Review this code and list any quality issues.
[ { "issue": "Function 'Connect' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 24 }, { "issue": "Function 'Connect' is 72 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical",...
4
python
""" linter and formatter of notebooks """ # Copyright (c) 2020 ipyradiant contributors. # Distributed under the terms of the Modified BSD License. import json import shutil import subprocess import sys from hashlib import sha256 from pathlib import Path import black import isort import nbformat from . import projec...
Review this code and list any quality issues.
[ { "issue": "Function 'nblint_one' has cyclomatic complexity 18 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 30 }, { "issue": "Function 'nblint_one' is 50 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "crit...
2
python
# coding: utf-8 # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' is 33 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 16 } ]
1
python
import datetime import re class PublicationUtils: @staticmethod def get_month(bibtex_entry): month = bibtex_entry.get("month") m = None try: m = int(month) except Exception: pass try: m = datetime.datetime.strptime(month, "%b").month ...
Review this code and list any quality issues.
[ { "issue": "Function 'get_forum' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 26 } ]
1
python
import json import tempfile import time from collections import defaultdict from os import path, remove import numpy as np import torch import torch.distributed as dist from PIL import Image from pycocotools.coco import COCO as _COCO from pycocotools.cocoeval import COCOeval from pycocotools.mask import encode as mask...
Review this code and list any quality issues.
[ { "issue": "Function 'process_prediction' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 20 }, { "issue": "Function 'process_prediction' is 35 lines long. Functions over 25 lines are harder to test and maintain.", "seve...
5
python
# # Copyright (c) 2021 Citrix Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
Review this code and list any quality issues.
[ { "issue": "Function '_get_nitro_response' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 257 } ]
1
python
import datetime import math import requests_cache from bs4 import BeautifulSoup from rest_framework import status from rest_framework.decorators import api_view from rest_framework.response import Response from api.modules.holidays.constants import HOLIDAYS_PAGE_URL, HINDI_DAY_STRING_MAP, HINDI_MONTH_STRING_MAP from ...
Review this code and list any quality issues.
[ { "issue": "Function 'get_upcoming_holidays' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 18 }, { "issue": "Function 'get_upcoming_holidays' is 35 lines long. Functions over 25 lines are harder to test and maintain.", ...
2
python
# Copyright (c) Microsoft Corporation. All rights reserved.S # Licensed under the MIT License. See License.txt in the project root for # license information. import os import sys import logging # noqa: F401 import json import time from concurrent.futures import ThreadPoolExecutor from paho_client import PahoClient ""...
Review this code and list any quality issues.
[ { "issue": "Function 'listen' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 32 }, { "issue": "Function 'listen' is 46 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "lin...
2
python
import sys class PrintUtils: progress = 0 total_progress = 0 @classmethod def print_progress_bar(cls, iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█', print_end = "\r"): """ Call in a loop to create terminal progress bar @params: i...
Review this code and list any quality issues.
[ { "issue": "Function 'print_progress_bar' has 9 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 8 } ]
1
python
""" HttpCtrl library provides HTTP/HTTPS client and server API to Robot Framework to make REST API testing easy. Authors: Andrei Novikov Date: 2018-2021 Copyright: The 3-Clause BSD License """ from http.server import SimpleHTTPRequestHandler from robot.api import logger from HttpCtrl.internal_messages...
Review this code and list any quality issues.
[ { "issue": "Function '__send_response' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 95 } ]
1
python
# Author: Kelvin Lai <kelvin@firststreet.org> # Copyright: This module is owned by First Street Foundation # Standard Imports import logging # Internal Imports from firststreet.api import csv_format from firststreet.api.api import Api from firststreet.errors import InvalidArgument from firststreet.models.historic imp...
Review this code and list any quality issues.
[ { "issue": "Function 'get_event' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 22 }, { "issue": "Function 'get_events_by_location' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "ma...
4
python
import time from collections import Counter, defaultdict import warnings; warnings.filterwarnings('ignore') import glob import re import ast import numpy as np import pandas as pd import matplotlib.pyplot as plt from algorithms import ShapeletTransformer from extractors.extractor import MultiGeneticExtractor from dat...
Review this code and list any quality issues.
[ { "issue": "Function 'fit_rf' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 35 }, { "issue": "Function 'fit_lr' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 51 }, { "issue...
4
python
class SolutionTLE: def shortestDistance(self, grid: List[List[int]]) -> int: buildings = [] rows, cols = len(grid), len(grid[0]) for row in range(rows): for col in range(cols): if grid[row][col] == 1: buildings.append((row, col)) def...
Review this code and list any quality issues.
[ { "issue": "Function 'shortestDistance.bfs' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 12 }, { "issue": "Function 'shortestDistance' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functio...
4
python
#!/usr/bin/env python # Copyright (c) YugaByte, 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 ag...
Review this code and list any quality issues.
[ { "issue": "Function 'verify_sha256sum' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 88 }, { "issue": "Function 'move_file' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "s...
7
python
import glob, struct, random, csv from tensorflow.core.example import example_pb2 # <s> and </s> are used in the data files to segment the abstracts into sentences. They don't receive vocab ids. SENTENCE_START = '<s>' SENTENCE_END = '</s>' PAD_TOKEN = '[PAD]' # This has a vocab id, which is used to pad the encoder in...
Review this code and list any quality issues.
[ { "issue": "Function 'example_generator' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 17 } ]
1
python
import speech_recognition as sr import pyttsx3 import pywhatkit import datetime import wikipedia import pyjokes import webbrowser import os #import pyaudio listenner = sr.Recognizer() engine = pyttsx3.init() voices = engine.getProperty("voices") engine.setProperty('voice', voices[1].id) def talk(text):...
Review this code and list any quality issues.
[ { "issue": "Function 'run_alexa' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 40 }, { "issue": "Function 'run_alexa' is 52 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", ...
2
python
# coding: utf-8 """ Lightly API Lightly.ai enables you to do self-supervised learning in an easy and intuitive way. The lightly.ai OpenAPI spec defines how one can interact with our REST API to unleash the full potential of lightly.ai # noqa: E501 OpenAPI spec version: 1.0.0 Contact: support@lightly...
Review this code and list any quality issues.
[ { "issue": "Function 'to_dict' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 103 } ]
1
python
#!/usr/bin/env python3 """ Project title: CollembolAI Authors: Stephan Weißbach, Stanislav Sys, Clément Schneider Original repository: https://github.com/stasys-hub/Collembola_AI.git Module title: output_inference_images .py Purpose: draws bounding boxes from annotation on pictures....
Review this code and list any quality issues.
[ { "issue": "Function 'draw_coco_bbox' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 19 }, { "issue": "Function 'draw_coco_bbox' is 52 lines long. Functions over 25 lines are harder to test and maintain.", "severity...
3
python
import pytest from salesman.orders.models import Order from salesman.orders.signals import status_changed _signal_called = False def on_status_changed(sender, order, new_status, old_status, **kwargs): global _signal_called _signal_called = True @pytest.mark.django_db def test_order_changed_signal(rf): ...
Review this code and list any quality issues.
[ { "issue": "Function 'on_status_changed' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 9 } ]
1
python
import os import numpy as np from models import ALOCC_Model from utils import pp, visualize, to_json, show_all_variables import tensorflow as tf flags = tf.app.flags flags.DEFINE_integer("epoch", 40, "Epoch to train [25]") flags.DEFINE_float("learning_rate", 0.002, "Learning rate of for adam [0.0002]") flags.DEFINE_fl...
Review this code and list any quality issues.
[ { "issue": "Function 'check_some_assertions' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 29 }, { "issue": "Function 'main' is 50 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "min...
2
python
# coding=utf-8 """ @Time: 2020/11/14 2:15 下午 @Author: Aopolin @File: MolweniConfig.py @Contact: aopolin.ii@gmail.com @Description: """ class Config(object): def __init__(self): self.SQUAD_DIR = "../../Dataset/squad2.0" self.MOLWENI_DIR = "../../Dataset/Molweni" ...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' is 50 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 12 } ]
1
python
import dash import dash_core_components as dcc import dash_html_components as html import pandas as pd import plotly.express as px external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] app = dash.Dash(__name__, external_stylesheets=external_stylesheets) df = pd.read_csv('https://plotly.github.io/data...
Review this code and list any quality issues.
[ { "issue": "Function 'update_graph' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 106 } ]
1
python
import datetime from moto.core import BaseBackend from moto.core.utils import iso_8601_datetime class Token(object): def __init__(self, duration, name=None, policy=None): now = datetime.datetime.now() self.expiration = now + datetime.timedelta(seconds=duration) self.name = name 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": 19 } ]
1
python
import asyncio import inspect import json import logging from asyncio import Queue, CancelledError from sanic import Blueprint, response from sanic.request import Request from sanic.response import HTTPResponse, ResponseStream from typing import Text, Dict, Any, Optional, Callable, Awaitable, NoReturn, Union import ra...
Review this code and list any quality issues.
[ { "issue": "Function 'on_message_wrapper' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 34 }, { "issue": "Function 'stream_response' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 6...
3
python
#!/usr/bin/env python # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # Michael A.G. Aivazis # California Institute of Technology # (C) 1998-2003 All Rights Reserved # # <LicenseText> # # ~~~~~~~~~~~~~~~~...
Review this code and list any quality issues.
[ { "issue": "Function 'pickleThermoSection' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 65 }, { "issue": "Function 'pickleThermoSection' is 67 lines long. Functions over 25 lines are harder to test and maintain.", "se...
5
python
import os import os.path import json import pathlib from types import prepare_class from ulauncher.api.client.Extension import Extension from ulauncher.api.client.EventListener import EventListener from ulauncher.api.shared.event import ( KeywordQueryEvent, ItemEnterEvent, PreferencesEvent, PreferencesUpdateEvent, ...
Review this code and list any quality issues.
[ { "issue": "Function 'get_ext_result_items' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 80 }, { "issue": "Function 'get_ext_result_items' is 26 lines long. Functions over 25 lines are harder to test and maintain.", ...
2
python
# JoyStick # # Copyright (c) 2021 Hajime Saito # # Released under the MIT license. # see https://opensource.org/licenses/MIT import pygame from pygame.locals import * import Repeater JOY_MAX_TRIGGER = 16 JOY_NOINPUT = 0 JOY_UP = 0x1 << JOY_MAX_TRIGGER JOY_RIGHT = 0x2 << JOY_MAX_TRIGGER JOY_DOWN = 0x4 <<...
Review this code and list any quality issues.
[ { "issue": "Function 'update' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 71 }, { "issue": "Function 'update' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "m...
2
python
import inspect import json import logging import threading from datetime import datetime, timezone from time import time import pytz import requests from notion.block import TextBlock from notion.client import NotionClient from notion.collection import NotionDate from tqdm import tqdm from tzlocal import get_localzone...
Review this code and list any quality issues.
[ { "issue": "Function 'set_config' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 71 }, { "issue": "Function '_update_row' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "...
4
python
import os import csv from django.core.management.base import BaseCommand from django.db import transaction from api.models import Action, Country, DisasterType, SituationReportType from api.logger import logger class Command(BaseCommand): help = 'Import translated strings from a CSV. Either use the --table and --...
Review this code and list any quality issues.
[ { "issue": "Function 'handle' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 32 }, { "issue": "Function 'handle' is 50 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "li...
2
python
from Simulation.calculation_status import CalculationStatus from Simulation.sign_function import SignFunction from Simulation.mcad import Mcad from Simulation.market_snapshot import MarketSnapshot from Simulation.stock_snapshot_helper import StockSnapshotHelper from Simulation.visualization_data import VisualizationDat...
Review this code and list any quality issues.
[ { "issue": "Function 'notify' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 33 }, { "issue": "Function 'notify' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "lin...
2
python
import scipy.signal as signal import torch import torch.nn as nn import numpy as np import models import gym import wandb def create_feedforward(sizes, activation=nn.ReLU): layers = [] for i in range(len(sizes) - 1): layers.append(nn.Linear(sizes[i], sizes[i+1])) if i < len(sizes) - 2: ...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 27 }, { "issue": "Function 'store' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 39 }, { "issu...
4
python
import re from textwrap import dedent from unittest import mock from unittest.mock import PropertyMock import pytest from get_pr_info import extract_target_section, get_pr_number_from_commit_message, get_pr_summary from github import BadCredentialsException, UnknownObjectException class TestGetPrNumberFromCommitMess...
Review this code and list any quality issues.
[ { "issue": "Function 'test_nomal' is 43 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 132 }, { "issue": "Function 'test_another_section_at_the_end' is 48 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "...
2
python
# Copyright (c) 2018 PaddlePaddle 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 app...
Review this code and list any quality issues.
[ { "issue": "Function 'uniform_random' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 81 } ]
1
python
import logging from blspy import PrivateKey from mint.cmds.init_funcs import check_keys from mint.util.keychain import Keychain from pathlib import Path from typing import Any, Dict, List, Optional, cast # Commands that are handled by the KeychainServer keychain_commands = [ "add_private_key", "check_keys", ...
Review this code and list any quality issues.
[ { "issue": "Function 'get_keychain_for_request' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 37 }, { "issue": "Function 'handle_command' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functi...
3
python
# Copyright 2020-present Kensho Technologies, LLC. """Implementing client-side grpc interceptors""" import functools import json import backoff import grpc import prometheus_client CLIENTSIDE_METRICS_HISTO = prometheus_client.Histogram( "clientside_grpc_endpoint", "Response time histogram for grpc endpoints ...
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": 205 }, { "issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 295 }, { ...
3
python
######### # Copyright (c) 2015 GigaSpaces Technologies Ltd. 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 'get_json_and_verify_params' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 49 }, { "issue": "Function 'validate_inputs' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller fun...
3
python
import lldb from lldbsuite.test.lldbtest import * from lldbsuite.test.decorators import * from gdbclientutils import * class TestGDBRemoteLoad(GDBRemoteTestBase): def setUp(self): super(TestGDBRemoteLoad, self).setUp() self._initial_platform = lldb.DBG.GetSelectedPlatform() def tearDown(self...
Review this code and list any quality issues.
[ { "issue": "Function 'test_flash_load.qXferRead' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 46 } ]
1
python
# -*- coding: utf-8 -*- import os import pickle from autobahn.twisted.util import sleep from mdstudio.deferred.chainable import chainable from mdstudio.component.session import ComponentSession from mdstudio.runner import main from mdstudio_workflow import Workflow class LIEPredictionWorkflow(ComponentSession): ...
Review this code and list any quality issues.
[ { "issue": "Function 'on_run' is 62 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 43 } ]
1
python
# # Copyright (c) Microsoft Corporation. All Rights Reserved. # """ Use DOT to layout a graph for cytoscape.js TODO: add support for middle points in edges """ from __future__ import division from collections import deque, defaultdict import platform if True or platform.system() == 'Windows': from ivy_graphviz ...
Review this code and list any quality issues.
[ { "issue": "Function 'cubic_bezier_point' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 27 }, { "issue": "Function 'approximate_cubic_bezier' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", ...
4
python
# -*- coding: utf-8 -*- # DISCLAIMER # This code file is forked and adapted from https://github.com/tezignlab/RippleNet-TF2/blob/master/tools/load_data.py, which is under an MIT license. """ Utilities for data loading for RippleNet. """ # import libraries import os import numpy as np from collections import defaultd...
Review this code and list any quality issues.
[ { "issue": "Function 'load_rating' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 70 }, { "issue": "Function 'load_rating' is 41 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major...
4
python
from typing import Optional from functools import partial import torch from torch.nn.modules.loss import _Loss from ._functional import focal_loss_with_logits from .constants import BINARY_MODE, MULTICLASS_MODE, MULTILABEL_MODE __all__ = ["FocalLoss"] class FocalLoss(_Loss): def __init__( self, ...
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": 14 }, { "issue": "Function 'forward' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "lin...
2
python
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
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 44 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line"...
2
python
''' @author: Xu Yan @file: ModelNet.py @time: 2021/3/19 15:51 ''' import os import numpy as np import warnings import pickle from tqdm import tqdm from torch.utils.data import Dataset warnings.filterwarnings('ignore') def pc_normalize(pc): centroid = np.mean(pc, axis=0) pc = pc - centroid m = np.max(np....
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 50 }, { "issue": "Function '__init__' is 51 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical...
3
python
""""A system check for testing integration of various libraries with mozetl. This sub-module will print out relevant version info. It will also read data from `main_summary` and print basic statistics to verify that the system is correctly set-up. """ import sys import click import logging from datetime import datet...
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": "major", "line": 35 }, { "issue": "Function 'main' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 35 } ]
2
python
import datetime # from sqlalchemy import Column, Integer, String import hashlib from server.extensions import Base, argon2, bcrypt class User(Base): __table__ = Base.metadata.tables["users"] __table_args__ = {"autoload": True} # Attribute names to help out with functions # id = Column(Integer, prim...
Review this code and list any quality issues.
[ { "issue": "Function 'check_password' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 45 } ]
1
python
import asyncio import json import random import subprocess import discord import discord.ext import requests from discord.ext import commands import os from botlibrary.utils import get_variable from botlibrary import constants # Wichs Codierung # ä=ü # ö=ö # assign constant variables constants.assignVariables() V...
Review this code and list any quality issues.
[ { "issue": "Function 'tokenchecker' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 28 }, { "issue": "Function 'tokenchecker' is 56 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "majo...
2
python
# Model architecture analyzer import os import logging import logging.handlers as handlers import json import numpy as np import tensorflow as tf physical_devices = tf.config.list_physical_devices('GPU') tf.config.experimental.set_memory_growth(physical_devices[0], enable=True) tf.keras.backend.set_floatx('float32') fr...
Review this code and list any quality issues.
[ { "issue": "Function 'analize' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 41 } ]
1
python
''' Define functions for the detuning of an atomic system ''' from LASED.state import * from LASED.constants import * def delta(e, g): """Detunings between substates. Parameters: e (State): State object g (State): State object Returns: float: Difference in angular freque...
Review this code and list any quality issues.
[ { "issue": "Function 'dopplerDelta' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 30 } ]
1
python
from symbol.builder import FasterRcnn as Detector from symbol.builder import add_anchor_to_arg from models.efficientnet.builder import EfficientNetB5FPN as Backbone from models.FPN.builder import FPNNeck as Neck from models.FPN.builder import FPNRpnHead as RpnHead from models.FPN.builder import FPNRoiAlign as RoiExtrac...
Review this code and list any quality issues.
[ { "issue": "Function 'get_config' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 11 }, { "issue": "Function 'get_config' is 229 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major"...
2
python
import copy import json from django_admin_json_editor import JSONEditorWidget from django.utils.safestring import mark_safe from django.template.loader import render_to_string class JSONEditorWidget(JSONEditorWidget): template_name = 'lanthanum/_json_editor_widget.html' def render(self, name, value, attrs=N...
Review this code and list any quality issues.
[ { "issue": "Function 'render' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 12 } ]
1
python
# Copyright 2019 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Review this code and list any quality issues.
[ { "issue": "Function '_generate_code' has cyclomatic complexity 25 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 66 }, { "issue": "Function '_generate_code' is 122 lines long. Functions over 25 lines are harder to test and maintain.", "severit...
3
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # @brief This module has unit tests for the classes of EasyIPC. # @author Luis C. Garcia-Peraza Herrera (luiscarlos.gph@gmail.com). # @date 25 June 2020. import unittest import os import sys import numpy as np # My imports import easyipc class TestEasyIPC(unittest.Tes...
Review this code and list any quality issues.
[ { "issue": "Function 'test_pipe' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 17 } ]
1
python
#!/usr/bin/env python ###################################################################### ## File: create_public_pileup_plots.py ###################################################################### # NOTE: Typical way to create the pileup ROOT file from the cached txt # files (maintained by Mike Hildreth): # pil...
Review this code and list any quality issues.
[ { "issue": "Function 'TweakPlot' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 61 }, { "issue": "Function 'TweakPlot' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", ...
2
python
#!/usr/bin/env python # -*- coding: utf-8 -*- ################################################################### # Author: Mu yanru # Date : 2019.3 # Email : muyanru345@163.com ################################################################### from dayu_widgets3.collapse import MCollapse from dayu_widgets3.label im...
Review this code and list any quality issues.
[ { "issue": "Function '_init_ui' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 18 } ]
1
python
# coding: utf-8 # - run the command: # > pyccel-quickstart poisson # this will compile pyccel extensions and install them in $PWD/poisson/usr # - export the following variables # > export INCLUDE_DIR=$PWD/poisson/usr/include/poisson # > export LIB_DIR=$PWD/poisson/usr/lib # Usage: # > pyccel poisson_v2....
Review this code and list any quality issues.
[ { "issue": "Function 'cgl' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 235 }, { "issue": "Function 'cgl' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 235 }, { "iss...
4
python
import asyncio import logging from typing import Any # noqa: F401 from typing import Awaitable, Dict, List, Optional, Tuple from libp2p.exceptions import ParseError from libp2p.io.exceptions import IncompleteReadError from libp2p.network.connection.exceptions import RawConnError from libp2p.peer.id import ID from lib...
Review this code and list any quality issues.
[ { "issue": "Function '_handle_incoming_message' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 223 } ]
1
python
# Copyright 2020 The Magenta Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
Review this code and list any quality issues.
[ { "issue": "Function 'main' is 87 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 74 } ]
1
python
# Copyright 2019 The Forte Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
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": 58 }, { "issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 125 }, { "...
6
python
# Based on scikit-learn/sklearn/utils/estimator_checks.py import itertools from functools import partial def get_entry_params(entry): user_parameters = entry.describe()["user_parameters"] if not user_parameters: return [] keys = [p["name"] for p in user_parameters] try: values = [p["a...
Review this code and list any quality issues.
[ { "issue": "Function 'get_entry_params' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 6 }, { "issue": "Function '_set_check_ids' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", ...
3
python
# -*- coding: utf-8 -*- ''' Specto Add-on Copyright (C) 2015 lambda This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any l...
Review this code and list any quality issues.
[ { "issue": "Function 'get_movie' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 46 }, { "issue": "Function 'get_show' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "lin...
8
python
import json import getpass import shortuuid # type: ignore from datetime import datetime from functools import lru_cache from collections import defaultdict from typing import Any, Dict, Generator, Generic, List, Optional, Set, Tuple, Union from followthemoney.types import registry from nomenklatura.entity import CE ...
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": 78 }, { "issue": "Function 'get_judgement' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "...
5
python
''' OAuth2.0 client credentials flow plugin for HTTPie. ''' import sys from httpie.plugins import AuthPlugin from httpie.cli.definition import parser as httpie_args_parser from urllib.request import Request, urlopen from urllib.parse import urlencode from urllib.error import HTTPError import json from base64 import b6...
Review this code and list any quality issues.
[ { "issue": "Function '__get_token' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 38 }, { "issue": "Function '__get_token' is 37 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor"...
2
python
import os import sys import json import yaml import mkdocs import logging from mkdocs.plugins import BasePlugin from mkdocs.utils import warning_filter from jinja2 import Template from pathlib import Path from itertools import chain log = logging.getLogger(__name__) log.addFilter(warning_filter) CONFIG_KEYS = ["site...
Review this code and list any quality issues.
[ { "issue": "Function 'on_pre_build' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 45 }, { "issue": "Function 'on_pre_build' is 32 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "min...
2
python
def concat_multiples(num, multiples): return int("".join([str(num*multiple) for multiple in range(1,multiples+1)])) def is_pandigital(num): return sorted([int(digit) for digit in str(num)]) == list(range(1,10)) def solve_p038(): # retrieve only 9 digit concatinations of multiples where n = (1,2,..n) ...
Review this code and list any quality issues.
[ { "issue": "Function 'solve_p038' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 8 } ]
1
python
import models import json import re import constants.userConstants as UserConstants from enums import UserEnums from databaseService.bookDatabaseService import BookDatabaseService def validate_and_convert_new_user_request_object(aa: dict, bb: models.User): for field in UserConstants.USER_MANDATORY_FIELDS: ...
Review this code and list any quality issues.
[ { "issue": "Function 'convert_update_request_for_persistence' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 16 } ]
1
python
# Dependencies from splinter import Browser from bs4 import BeautifulSoup from webdriver_manager.chrome import ChromeDriverManager import time import pandas as pd from pprint import pprint from urllib.parse import urlsplit import pymongo # Initialize PyMongo to work with MongoDBs conn = 'mongodb://localhost:27017' c...
Review this code and list any quality issues.
[ { "issue": "Function 'scrape_info' is 56 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 26 } ]
1
python
""" flask_flatpages_pandoc ~~~~~~~~~~~~~~~~~~~~~~ Flask-FlatPages-Pandoc is an HTML renderer for Flask-FlatPages that uses pandoc as backend. :copyright: (c) 2014 Fabian Hirschmann <fabian@hirschmann.email> :license: MIT, see LICENSE.txt for more details. With some changes by @apas: - Invoke pandoc via pypandoc i...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 36 }, { "issue": "Function 'renderer' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 73 } ]
2
python
import os import time from multiprocessing.dummy import Pool import pytest from helpers.cluster import ClickHouseCluster from helpers.test_tools import assert_eq_with_retry cluster = ClickHouseCluster(__file__) node1 = cluster.add_instance("node1", main_configs=["configs/wide_parts_only.xml"]) @pytest.fixture(scop...
Review this code and list any quality issues.
[ { "issue": "Function 'test_update_mutation' is 30 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 46 }, { "issue": "Function 'test_delete_and_drop_mutation' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions...
3
python
import sys import utils import torch from datasets import VisualDialogDataset import torchvision.transforms as transforms def build_dataset(mode, args, shared_dictionary=None, with_options=True): normalize = transforms.Normalize(mean=[0.4711, 0.4475, 0.4080], std=[0.1223, 0.1221, 0.1450]) #visdial transf...
Review this code and list any quality issues.
[ { "issue": "Function 'get_flat_human_features' is 31 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 50 } ]
1
python
import os import json import string import inspect import sublime from .miscellaneous_utils import command_kind_type kind_mapping = { "window": command_kind_type("window"), "text": command_kind_type("text"), "application": command_kind_type("application"), "find": command_kind_type("find") } def co...
Review this code and list any quality issues.
[ { "issue": "Function 'core_commands_doc_panel' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 18 } ]
1
python
import torch from torch.autograd import Variable from torchvision import models import cv2 import sys import numpy as np import os import math import torch.nn.functional as F idx_to_class = {0 : 'aeroplane', 1 : 'bicycle', 2 : 'bird', 3 : 'boat', 4 : 'bottle', 5 : 'bus', 6 : 'car', 7 : 'cat', 8 : 'chai...
Review this code and list any quality issues.
[ { "issue": "Function 'save_mask' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 91 }, { "issue": "Function 'save_mask' is 37 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critic...
10
python
import pygame from pygame.sprite import Sprite class Ship(Sprite): """Parent ship class for Blast.""" def __init__(self, blast_settings, screen): """Init ship and starting position.""" super(Ship, self).__init__() self.screen = screen self.blast_settings = blast_setting...
Review this code and list any quality issues.
[ { "issue": "Function 'update' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 27 } ]
1
python
import json from Qt import QtGui from Qt import QtWidgets def set_palette_from_dict(dct): """Set palette to current QApplication based on given dictionary""" groups = ["Disabled", "Active", "Inactive", "Normal"] roles = [ "AlternateBase", "Background", "Base", "Button", ...
Review this code and list any quality issues.
[ { "issue": "Function 'set_palette_from_dict' is 39 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 7 } ]
1
python
# # 2020 ExpertSystem # '''Script for generating predictions for the coinform250 dataset using the acred predictor See https://github.com/co-inform/Datasets See also scripts/fetch-data.sh, which should download the input json file and place it in the `data/evaluation/` folder. ''' import argparse import time import ...
Review this code and list any quality issues.
[ { "issue": "Function 'acred_as_coinfo_label' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 29 } ]
1
python
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from ... import _utilities, _tables from...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 23 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 23 }, { "issue": "Function '__init__' is 34 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical...
3
python
# Copyright (C) 2020 THL A29 Limited, a Tencent company. # All rights reserved. # Licensed under the BSD 3-Clause License (the "License"); you may # not use this file except in compliance with the License. You may # obtain a copy of the License at # https://opensource.org/licenses/BSD-3-Clause # Unless required by appl...
Review this code and list any quality issues.
[ { "issue": "Function 'check_torch_and_turbo' is 39 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 44 }, { "issue": "Function 'check_torch_and_turbo' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor"...
3
python
""" Copyright (c) 2018-2020 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 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 47 } ]
1