language
stringclasses
1 value
code
stringlengths
407
33.3k
instruction
stringclasses
1 value
flaws
listlengths
1
17
flaw_count
int64
1
17
python
import chainer from chainer.backends import cuda from chainer.functions.activation import sigmoid from chainer.functions.activation import tanh from chainer.functions.array import reshape from chainer.functions.array import split_axis from chainer import link from chainer.links.connection import linear from chainer imp...
Review this code and list any quality issues.
[ { "issue": "Function '_to_device' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 67 }, { "issue": "Function 'forward' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", ...
2
python
# coding: utf-8 """ Xenia Python Client Library Python Client Library to interact with the Xenia API. # noqa: E501 The version of the OpenAPI document: v2.1 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six from xenia_python_client_library.configur...
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": 76 } ]
1
python
import inspect import typing import torch from typing import Optional, Iterable, List, Dict from collections import defaultdict _IS_MONKEYTYPE_INSTALLED = True try: import monkeytype # type: ignore[import] from monkeytype import trace as monkeytype_trace from monkeytype.db.base import CallTraceThunk, Call...
Review this code and list any quality issues.
[ { "issue": "Function 'consolidate_types' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 62 } ]
1
python
# Copyright (C) 2019 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Base TestCase for proposal api.""" import ddt from ggrc.models import all_models from integration.ggrc import TestCase, generator from integration.ggrc.models import factories from integration.ggrc.api...
Review this code and list any quality issues.
[ { "issue": "Function 'test_create_review' is 38 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 64 }, { "issue": "Function 'test_last_reviewed' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor"...
3
python
""" BT510 commands (serial or BLE). This is a subset of the jtester commands used for verification. """ import time import json import random import string import logging from jsonrpcclient.requests import Request class jtester: def __init__(self, fname="config.json"): """ JSON tester that is independen...
Review this code and list any quality issues.
[ { "issue": "Function 'ExpectValue' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 79 }, { "issue": "Function 'ExpectValues' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", "se...
4
python
import datetime import tensorflow as tf import random import wandb from tensorflow_examples.models.pix2pix import pix2pix from augmentation.dataflows.utils import create_paired_direct_dataflow, \ create_paired_parallel_dataflow_via_numpy from augmentation.methods.cyclegan.models import mnist_unet_generator, mnist...
Review this code and list any quality issues.
[ { "issue": "Function 'gradient_penalty' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 18 }, { "issue": "Function 'build_models' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 172 ...
4
python
import sys from django.core.management.commands.migrate import Command as MigrateCommand from django.db import transaction from tuiuiu.tuiuiutenant.utils import get_public_schema_name def run_migrations(args, options, executor_codename, schema_name, allow_atomic=True): from django.core.management import color ...
Review this code and list any quality issues.
[ { "issue": "Function 'run_migrations' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 9 } ]
1
python
''' Developed by Abhijith Boppe - linkedin.com/in/abhijith-boppe/ ''' import socket import ssl import time data_maxLength = 65535 fields_maxLength =1024 sock = '' device_id = '' device_key = '' time_stamps = [] def connectionSet(host, port, id_, key, Encrypt=1, cert_path=None): global sock, device_id, device_key...
Review this code and list any quality issues.
[ { "issue": "Function 'connectionSet' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 16 }, { "issue": "Function 'chkTime' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "l...
4
python
# File: rigidbody.py import abc import torch from mechamodlearn import nn, utils from mechamodlearn.models import CholeskyMMNet, PotentialNet, GeneralizedForceNet class AbstractRigidBody: @property @abc.abstractmethod def thetamask(self): """Returns theta mask for configuration q. These...
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": 136 } ]
1
python
""" Validation utilities. | Copyright 2017-2022, Voxel51, Inc. | `voxel51.com <https://voxel51.com/>`_ | """ import eta.core.utils as etau import fiftyone.core.media as fom import fiftyone.core.utils as fou foc = fou.lazy_import("fiftyone.core.collections") fov = fou.lazy_import("fiftyone.core.video") def validate...
Review this code and list any quality issues.
[ { "issue": "Function 'validate_collection_label_fields' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 118 }, { "issue": "Function 'validate_collection_label_fields' is 28 lines long. Functions over 25 lines are harder to t...
7
python
import re class Key(object): "Key used in keycards and locks" pass class KeyCard(object): "Keycard used to open a lock" def __init__(self, first_key, second_key): """ Constructs a KeyCard with the given keys Args: first_key: in the keycard to be created ...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 127 } ]
1
python
import numpy as np def map_reg_to_text(reg_code): reg_dict = ("rip", "rsp", "rax", "rbx", "rcx", "rdx", "cs", "ss", "eflags", "rbp", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", "rsi", "rdi", "orig_rax", "fs_base", "gs_base", "ds", "es", "fs", "gs") return reg_dict[reg_code] class ucXception_fi_p...
Review this code and list any quality issues.
[ { "issue": "Function 'parse' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 13 } ]
1
python
import datetime import json import os import sys import time import torch import torch.nn as nn from torch.autograd import Variable from torch.utils.data import DataLoader from utils.flags import FLAGS sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from model.vqa_model import ModelParams...
Review this code and list any quality issues.
[ { "issue": "Function '_load_model' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 28 } ]
1
python
# This program uses a pie chart to display the percentages of the overall grade represented by a project's, # quizzes, the midterm exam, and the final exam, 20 percent of the grade and its value is displayed in red, # quizzes are 10 percent and are displayed in blue, the midterm exam is 30 percent and is displayed ...
Review this code and list any quality issues.
[ { "issue": "Function 'drawAPie' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 31 } ]
1
python
import uuid from typing import Optional, Union from datetime import datetime, timedelta from fastapi import Request, HTTPException, status, Depends from fastapi.security import OAuth2 from fastapi.openapi.models import OAuthFlows as OAuthFlowsModel from fastapi.security.utils import get_authorization_scheme_param from...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 16 } ]
1
python
""" dataset.py """ from six import ( iteritems, with_metaclass, ) from zipline.modelling.term import Term class Column(object): """ An abstract column of data, not yet associated with a dataset. """ def __init__(self, dtype): self.dtype = dtype def bind(self, dataset, name): ...
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": 43 }, { "issue": "Function 'static_identity' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 49 } ]
2
python
#!/usr/bin/env python import rospy from dbw_mkz_msgs.msg import ThrottleCmd, SteeringCmd, BrakeCmd from geometry_msgs.msg import TwistStamped from std_msgs.msg import Bool from twist_controller import Controller ''' You can build this node only after you have built (or partially built) the `waypoint_updater` node. Y...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' is 38 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 34 }, { "issue": "Function 'loop' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "lin...
2
python
import yaml from models.fasttext import FastText from models.attention_rnn import AttentionRNN from models.rcnn import RCNN from models.textcnn import TextCNN from models.textrnn import TextRNN from models.transformer import Transformer from utils.logger import get_logger def instantiate_model(model_name, vocab_size...
Review this code and list any quality issues.
[ { "issue": "Function 'instantiate_model' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 12 } ]
1
python
import datetime import logging from abc import ABCMeta, abstractmethod from decimal import Decimal from celery.result import EagerResult, allow_join_result from celery.backends.base import DisabledBackend logger = logging.getLogger(__name__) PROGRESS_STATE = 'PROGRESS' class AbstractProgressRecorder(object): _...
Review this code and list any quality issues.
[ { "issue": "Function 'get_info' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 62 }, { "issue": "Function 'get_info' is 54 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", ...
3
python
""" Very minimal unittests for parts of the readline module. """ from contextlib import ExitStack from errno import EIO import locale import os import selectors import subprocess import sys import tempfile import unittest from test.support import import_module, unlink, temp_dir, TESTFN, verbose from test.support.script...
Review this code and list any quality issues.
[ { "issue": "Function 'test_write_read_append' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 72 }, { "issue": "Function 'test_history_size' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "min...
4
python
# Copyright 2019 Canonical 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 in writin...
Review this code and list any quality issues.
[ { "issue": "Function '_arun_action_on_units' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 24 }, { "issue": "Function 'setUp' is 46 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 28...
4
python
import os import errno import traceback from six.moves import tkinter_messagebox as messagebox from six import print_ class BrocoliError(Exception): def __init__(self, exception): self.exception = exception def __str__(self): return type(self.exception).__name__ + ': ' + str(self.exception) ...
Review this code and list any quality issues.
[ { "issue": "Function 'handle_catalog_exceptions.method_wrapper' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 43 } ]
1
python
import gym import pybullet_envs from PIL import Image import argparse import numpy as np import torch import copy import os from sklearn.preprocessing import normalize as Normalize from models import TD3, TD3_adv2 def parse_arguments(): parser = argparse.ArgumentParser("TESTING") parser.add_argument('-p', "-...
Review this code and list any quality issues.
[ { "issue": "Function 'test' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 51 }, { "issue": "Function 'test' is 56 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": ...
2
python
"""Load dependencies needed to compile p4c as a 3rd-party consumer.""" load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def p4c_deps(): """Loads dependencies need to compile p4c.""" # Third party projects can define the...
Review this code and list any quality issues.
[ { "issue": "Function 'p4c_deps' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 6 }, { "issue": "Function 'p4c_deps' is 56 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "...
2
python
from __future__ import print_function import numpy as np import matplotlib.pyplot as plt class TwoLayerNet(object): """ A two-layer fully-connected neural network. The net has an input dimension of N, a hidden layer dimension of H, and performs classification over C classes. We train the network with a softma...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 21 }, { "issue": "Function 'loss' is 30 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 43 }, { ...
4
python
from sys import maxsize class Group: def __init__(self, name=None, header=None, footer=None, id=None): self.name = name self.header = header self.footer = footer self.id = id def __repr__(self): return "%s:%s:%s:%s" % (self.id, self.name, self.header,self.footer) ...
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": 5 } ]
1
python
import copy from gym import Wrapper from pythogic.base.Symbol import Symbol from pythogic.base.Alphabet import Alphabet from pythogic.base.Formula import AtomicFormula, PathExpressionEventually, PathExpressionSequence, And, Not, \ LogicalTrue, PathExpressionStar from pythogic.base.utils import _to_pythomata_dfa fro...
Review this code and list any quality issues.
[ { "issue": "Function 'step' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 30 } ]
1
python
import src.tnet as tnet import matplotlib.pyplot as plt import matplotlib as mpl import pandas as pd import math plt.style.use(['science','ieee', 'high-vis']) def txt2list(fname): return [line for line in open(fname)] def read_result(fname): df = pd.read_csv(fname) results = df.T.values.tolist() return resu...
Review this code and list any quality issues.
[ { "issue": "Function 'plot_flowPenRate' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 62 }, { "issue": "Function 'plot_flowPenRate' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severity...
2
python
import sys import json import datetime from terminalplot import plot from balsam.launcher.dag import BalsamJob now = '_'.join(str(datetime.datetime.now(datetime.timezone.utc)).split(" ")) def max_list(l): rl = [l[0]] mx = l[0] for i in range(1, len(l)): mx = max(mx, l[i]) rl.append(mx) ...
Review this code and list any quality issues.
[ { "issue": "Function 'process_data' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 20 } ]
1
python
# -*- coding: utf-8 -*- """ flask_login.utils ----------------- General utilities. """ import hmac from hashlib import sha512 from functools import wraps from werkzeug.local import LocalProxy from werkzeug.security import safe_str_cmp from werkzeug.urls import url_decode, url_encode from flask import ( ...
Review this code and list any quality issues.
[ { "issue": "Function 'login_user' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 141 }, { "issue": "Function 'login_user' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "...
2
python
import time from collections import deque import gym import numpy as np import tensorflow as tf from stable_baselines import logger from stable_baselines.common import explained_variance, tf_util, ActorCriticRLModel, SetVerbosity, TensorboardWriter from stable_baselines.common.policies import ActorCriticPolicy, Recur...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' is 39 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical", "line": 43 }, { "issue": "Function '__init__' has 17 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 43 ...
12
python
import os import pandas as pd import requests from datetime import datetime from furl import furl SQUASH_API_URL = os.environ.get('SQUASH_API_URL', 'http://localhost:8000/dashboard/api/') def get_endpoint_urls(): """ Lookup API endpoint URLs """ r = requests.get(SQUAS...
Review this code and list any quality issues.
[ { "issue": "Function 'get_url_args' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 167 }, { "issue": "Function 'get_meas_by_dataset_and_metric' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller ...
3
python
from tkinter import * import tkinter as tk import studenttracking_main import studenttracking_fnct def load_gui(self): self.lbl_subform = tk.Label(self.master,text='Submission Form') self.lbl_subform.grid(row=0,column=1,padx=(27,0),pady=(10,0),sticky=N+W) self.lbl_fname = tk.Label(self.master...
Review this code and list any quality issues.
[ { "issue": "Function 'load_gui' is 37 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 9 } ]
1
python
import util import json import numpy as np import random import tensorflow as tf class DeepDog: """ The DeepDog class loads the training and test set images from disk into RAM, and provides functions to get the test set and mini batches of the training set. """ def __init__(self, imageWidth, ...
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 'loadTrainingSet' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", ...
4
python
import os from functools import partial import PIL import lmdb import numpy as np from ding.envs import SyncSubprocessEnvManager from ding.utils.default_helper import deep_merge_dicts from easydict import EasyDict from tqdm import tqdm from haco.DIDrive_core.data import CarlaBenchmarkCollector, BenchmarkDatasetSaver ...
Review this code and list any quality issues.
[ { "issue": "Function 'wrapped_env' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 89 }, { "issue": "Function 'post_process' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", ...
4
python
'''Wheels support.''' from distutils.util import get_platform import email import itertools import os import re import zipfile from pkg_resources import Distribution, PathMetadata, parse_version from pkg_resources.extern.six import PY3 from setuptools import Distribution as SetuptoolsDistribution from setuptools impo...
Review this code and list any quality issues.
[ { "issue": "Function 'install_as_egg' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 51 }, { "issue": "Function 'install_as_egg' is 61 lines long. Functions over 25 lines are harder to test and maintain.", "severity": ...
2
python
#!/usr/bin/env python import boto3 import sys import argparse import ast import urllib2 from subprocess import call import time from datetime import datetime import shlex def sqs_get_msg(qname): sqs = boto3.resource('sqs') queue = sqs.get_queue_by_name(QueueName=qname) client = boto3.client('sqs') me...
Review this code and list any quality issues.
[ { "issue": "Function 'main' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 46 }, { "issue": "Function 'main' is 44 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": ...
2
python
import torch.nn as nn import torch import numpy as np def compute_flops(module, inp, out): if isinstance(module, nn.Conv2d): return compute_Conv2d_flops(module, inp, out) elif isinstance(module, nn.BatchNorm2d): return compute_BatchNorm2d_flops(module, inp, out) elif isinstance(module, (nn...
Review this code and list any quality issues.
[ { "issue": "Function 'compute_flops' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 6 } ]
1
python
# module solution.py # # Copyright (c) 2018 Rafael Reis # """ solution module - Implements Solution, a class that describes a solution for the problem. """ __version__ = "1.0" import copy import sys from random import shuffle import numpy as np def random(pctsp, start_size): s = Solution(pctsp) length = le...
Review this code and list any quality issues.
[ { "issue": "Function 'random' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 18 } ]
1
python
import numpy as np from ._CFunctions import _CWithinTimeRange from ._CTConv import _CTConv def WithinTimeRange(Timet,Time0,Time1,BoolOut=False): ''' Performs a simple check on a test time (Timet) to see if it exists between Time0 and time1. Inputs ====== Timet : tuple | float Test time - either a single flo...
Review this code and list any quality issues.
[ { "issue": "Function 'WithinTimeRange' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 5 }, { "issue": "Function 'WithinTimeRange' is 39 lines long. Functions over 25 lines are harder to test and maintain.", "severity": ...
2
python
import numpy as np import scipy.special as sp from termcolor import colored import sys if sys.platform == 'linux': sys.path.append(r'../lib') else: sys.path.append(r'../build/x64/Release') import NumCpp #################################################################################### NUM_DECIMALS_ROUND = 1...
Review this code and list any quality issues.
[ { "issue": "Function 'doTest' is 72 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 17 } ]
1
python
# BPlusTree with Python https://github.com/Nero5023/bplustree/tree/main/bplus_tree import pandas as pd import bisect import math def flatten(l): return [y for x in l for y in x] class Leaf: def __init__(self, previous_leaf, next_leaf, parent, b_factor): self.previous = previous_leaf self.nex...
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": 12 }, { "issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 117 }, { "...
3
python
# Copyright (C) 2010 Google Inc. All rights reserved. # Copyright (C) 2009 Daniel Bates (dbates@intudata.com). All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source co...
Review this code and list any quality issues.
[ { "issue": "Function 'main' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 259 } ]
1
python
# coding: utf-8 """ Flat API The Flat API allows you to easily extend the abilities of the [Flat Platform](https://flat.io), with a wide range of use cases including the following: * Creating and importing new music scores using MusicXML, MIDI, Guitar Pro (GP3, GP4, GP5, GPX, GP), PowerTab, TuxGuitar and Mus...
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": 53 } ]
1
python
""" This python script demonstrates the creation of all parametric reactors available in the paramak tool """ import paramak def main(): all_reactors = [] my_reactor = paramak.BallReactor( inner_bore_radial_thickness=50, inboard_tf_leg_radial_thickness=50, center_column_shield_radia...
Review this code and list any quality issues.
[ { "issue": "Function 'main' is 162 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 9 } ]
1
python
from pathlib import Path from sepal_ui import sepalwidgets as sw from component import parameter as cp from component.message import cm class FolderSelect(sw.FileInput): def __init__(self): super().__init__([''], label=cm.widget.folder.label, folder=cp.down_dir) def _on_file_s...
Review this code and list any quality issues.
[ { "issue": "Function 'is_valid_ts' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 30 } ]
1
python
# Copyright (C) 2019-2021 Ruhr West University of Applied Sciences, Bottrop, Germany # AND Elektronische Fahrwerksysteme GmbH, Gaimersheim Germany # # This Source Code Form is subject to the terms of the Apache License 2.0 # If a copy of the APL2 was not distributed with this # file, You can obtain one at https://www.a...
Review this code and list any quality issues.
[ { "issue": "Function 'prior' is 37 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 190 } ]
1
python
#!/usr/bin/env python import argparse import math import matplotlib.pyplot as plt def file_count(shape, chunkXY, chunkZ=1, chunkT=1, chunkC=1): t, c, z, y, x = shape return ( math.ceil(x / chunkXY) * math.ceil(y / chunkXY) * math.ceil(z / chunkZ) * math.ceil(t / chunkT) ...
Review this code and list any quality issues.
[ { "issue": "Function 'file_count' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 8 }, { "issue": "Function 'plot' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 1...
3
python
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved. # This is licensed software from AccelByte Inc, for limitations # and restrictions contact your company contract manager. # # Code generated. DO NOT EDIT! # template file: justice_py_sdk_codegen/__main__.py # justice-iam-service (5.10.1) # pylint: disable=dup...
Review this code and list any quality issues.
[ { "issue": "Function 'to_dict' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 84 }, { "issue": "Function 'create' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": ...
3
python
# -*- coding: utf-8 -*- """Analysis plugin related functions and classes for testing.""" from __future__ import unicode_literals from plaso.analysis import mediator as analysis_mediator from plaso.containers import artifacts from plaso.containers import sessions from plaso.engine import knowledge_base from plaso.pars...
Review this code and list any quality issues.
[ { "issue": "Function '_ParseAndAnalyzeFile' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 61 } ]
1
python
# Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> from datetime import datetime from logging import getLogger import collections from sqlalchemy.sql.expression import tuple_ from ggrc import db from ggrc import models from ggrc.automapper.rules import rul...
Review this code and list any quality issues.
[ { "issue": "Function 'related' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 50 }, { "issue": "Function 'related' is 34 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "...
9
python
# encoding: utf-8 from typing import Optional, Union class Indent: class IdentStart: def __init__(self, text): self.text = text class IdentEnd: def __init__(self, text): self.text = text class IdentEndLater: def __init__(self, text): self.text ...
Review this code and list any quality issues.
[ { "issue": "Function '__add__' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 48 }, { "issue": "Function '__add__' is 31 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "l...
4
python
import json import os from http import HTTPStatus from typing import Any import requests class HTTPClient: __instance = None def __new__(cls): """ This method creates the only instance of the class(singleton pattern) :param cls: The class :return: The method retur...
Review this code and list any quality issues.
[ { "issue": "Function 'get' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 30 } ]
1
python
# -*- coding: utf-8 -*- from openprocurement.auctions.core.utils import ( json_view, context_unpack, opresource ) from openprocurement.auctions.core.validation import ( validate_file_update, validate_file_upload, validate_patch_document_data ) from openprocurement.auctions.core.views.mixins impo...
Review this code and list any quality issues.
[ { "issue": "Function 'get' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 56 } ]
1
python
from typing import List from core.exceptions.data_exceptions import (DataIndexNotFoundException, DataIllegalEventTypeException, DataIllegalActivityTypeException) from core.exceptions.input_exceptions import (InputFormatException,...
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": 30 }, { "issue": "Function 'parse_activity_type' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major"...
13
python
import pandas as pd import json, hashlib, os, codecs, base64 from igf_data.igfdb.baseadaptor import BaseAdaptor from igf_data.igfdb.igfTables import User class UserAdaptor(BaseAdaptor): ''' An adaptor class for table User ''' def _email_check(self, email): ''' An internal function to check if email_id ...
Review this code and list any quality issues.
[ { "issue": "Function '_encrypt_password' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 20 }, { "issue": "Function '_encrypt_password' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severi...
6
python
import os import argparse """ Splits a single file of MEDLINE formatted abstracts into M files of N abstracts. """ def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("infile", type=str, help="MEDLINE file to split") parser.add_argument("outdir", type=str, ...
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": 24 }, { "issue": "Function 'main' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": ...
2
python
# executes the module loader in blender import os import subprocess from shutil import copyfile from Utility.OS_Extension import get_first_valid_path from Utility.Config import Config from Utility.Logging_Extension import logger # ====== Warning when starting blender ====== # "connect failed: No such file or director...
Review this code and list any quality issues.
[ { "issue": "Function 'execute_blender_script' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 31 }, { "issue": "Function 'execute_blender_script' is 36 lines long. Functions over 25 lines are harder to test and maintain.", ...
2
python
# Copyright 2014 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, s...
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": 53 }, { "issue": "Function '_do_request' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 153 }, { ...
3
python
#!/usr/bin/env python # Copyright 2015 Criteo. All rights reserved. # # The contents of this file are 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....
Review this code and list any quality issues.
[ { "issue": "Function 'clean_file' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 72 }, { "issue": "Function 'netcompare' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.", "sever...
3
python
from molsysmt import puw from molsysmt.basic import convert, select, get from molsysmt._private_tools._digestion import digest_engine, digest_target import numpy as np def get_sasa (molecular_system, target='atom', selection='all', frame_indices='all', syntaxis='MolSysMT', engine='MDTraj'): engine = dig...
Review this code and list any quality issues.
[ { "issue": "Function 'get_sasa' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 6 } ]
1
python
# Graph (vertices and edges) manipulation class. # Vertex and Edge definition customized for our need. # Dijkstra stolen at https://www.bogotobogo.com/python/python_graph_data_structures.php # import logging import math import json from functools import reduce from .geo import Point, Line, Polygon, distance, nearestPoi...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 15 }, { "issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 60 }, { "i...
10
python
import argparse import time from pathlib import Path import cv2 import torch import torch.backends.cudnn as cudnn from numpy import random from models.experimental import attempt_load from utils.datasets import LoadStreams, LoadImages from utils.general import check_img_size, check_requirements, non_max_su...
Review this code and list any quality issues.
[ { "issue": "Function 'detect' has cyclomatic complexity 34 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 20 }, { "issue": "Function 'detect' is 89 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical", ...
3
python
# # 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, software # ...
Review this code and list any quality issues.
[ { "issue": "Function 'validate' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 155 } ]
1
python
# -*- coding: utf-8 -*- # cython: language_level=3 # BSD 3-Clause License # # Copyright (c) 2020-2021, Faster Speeding # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of sour...
Review this code and list any quality issues.
[ { "issue": "Function 'publish' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 186 } ]
1
python
# Copyright 2015: Hewlett-Packard Development Company, L.P. # 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-...
Review this code and list any quality issues.
[ { "issue": "Function 'run' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 82 } ]
1
python
from typing import Any, Type, Union, List import torch import torch.nn as nn from torch import Tensor from torch.quantization import fuse_modules from torchvision.models.resnet import Bottleneck, BasicBlock, ResNet, model_urls from ..._internally_replaced_utils import load_state_dict_from_url from .utils import _repl...
Review this code and list any quality issues.
[ { "issue": "Function '_resnet' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 111 } ]
1
python
from __future__ import division def get_x_distribution_series(x_values, probabilites): distr_series = {} for i, x in enumerate(x_values): prob_sum = 0 for prob in probabilites[i]: prob_sum += prob distr_series[x] = prob_sum return distr_series def get_x_distribution_f...
Review this code and list any quality issues.
[ { "issue": "Function 'two_dim_value_generator' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 46 }, { "issue": "Function 'two_dim_value_generator' has 5 parameters. Consider using a parameter object to reduce arity.", "...
3
python
"""Snake Game Python Tutorial youtube video: https://www.youtube.com/watch?v=CD4qAhfFuLo current time: 33:00 """ import sys import math import random import pygame from pygame.locals import * import tkinter as tk from tkinter import messagebox WHITE = (255,255,255) BLACK = (0,0,0) RED = (255,0,0) GREEN = (0,255,0) BLU...
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 } ]
1
python
#!/usr/bin/env python import logging import sys import traceback import katcp import readline import codecs import re from optparse import OptionParser from cmd2 import Cmd from katcp import DeviceClient logging.basicConfig(level=logging.INFO, stream=sys.stderr, format="%(asctim...
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": 83 }, { "issue": "Function 'complete_katcp' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 122 } ]
2
python
# Copyright (C) 2019-2020, Therapixel SA. # All rights reserved. # This file is subject to the terms and conditions described in the # LICENSE file distributed in this package. """Test the C-Find message are correctly sent and can provide useful results. """ import os from datetime import datetime, timedelta from path...
Review this code and list any quality issues.
[ { "issue": "Function 'test_find_single_date' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 38 }, { "issue": "Function 'test_find_multiple_dates' is 30 lines long. Functions over 25 lines are harder to test and maintain.", "severity"...
2
python
import yaml import os import shutil import re import toml from typing import List, Set, Tuple, Pattern, Match from urllib.parse import urlparse from pathlib import Path CHECKOUT_DIR = "checkouts" GIT_CLONE_CMD = "git clone {{}} ./{}/{{}}/{{}}".format(CHECKOUT_DIR) RE_EXTRACT_TITLE: Pattern[str] = re.compile("([#\s]*)(...
Review this code and list any quality issues.
[ { "issue": "Function '_get_file_content' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 60 }, { "issue": "Function '_pull_files' is 31 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "...
7
python
# Copyright (c) 2021 NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Review this code and list any quality issues.
[ { "issue": "Function 'main' is 33 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 45 } ]
1
python
# Copyright 2022 Paul Rogers # # 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 'url_for' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 27 }, { "issue": "Function 'url_for' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 85 } ]
2
python
from __future__ import absolute_import import posixpath from rest_framework import serializers from rest_framework.exceptions import PermissionDenied from rest_framework.response import Response from sentry.api.base import DocSection from sentry.api.bases.organization import OrganizationReleasesBaseEndpoint from sent...
Review this code and list any quality issues.
[ { "issue": "Function 'get' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 39 }, { "issue": "Function 'get' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 39 }, ...
4
python
def cast_kwargs(kwargs): kwargs_copy = kwargs.copy() for arg, value in kwargs_copy.items(): if isinstance(value, dict): kwargs_copy[arg] = cast_kwargs(value) else: kwargs_copy[arg] = cast_string(kwargs_copy[arg]) return kwargs_copy def cast_string(s): if s == "T...
Review this code and list any quality issues.
[ { "issue": "Function 'cast_string' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 11 } ]
1
python
""" This file is part of web2py Web Framework (Copyrighted, 2007-2009). Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu>. License: GPL v2 """ import datetime from storage import Storage from html import * import contrib.simplejson as simplejson import contrib.rss2 as rss2 def xml_rec(value, key): if isins...
Review this code and list any quality issues.
[ { "issue": "Function 'xml_rec' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 13 } ]
1
python
import tensorflow as tf from baselines.ppo2 import ppo2 from baselines.common.models import build_impala_cnn from baselines.common.mpi_util import setup_mpi_gpus from procgen import ProcgenEnv from baselines.common.vec_env import ( VecExtractDictObs, VecMonitor, VecFrameStack, VecNormalize ) from baseli...
Review this code and list any quality issues.
[ { "issue": "Function 'eval_fn' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 20 }, { "issue": "Function 'eval_fn' is 116 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical",...
3
python
""" This is the Orchestra Project Python API. TODO(marcua): Move this file to its own pip/github project. """ import json import logging from datetime import datetime from time import mktime from wsgiref.handlers import format_date_time import requests from django.conf import settings from httpsig.requests_auth impo...
Review this code and list any quality issues.
[ { "issue": "Function '_make_api_request' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 30 }, { "issue": "Function 'create_orchestra_project' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "...
2
python
# -*- coding: utf-8 -*- """ Created on Thu Jun 3 17:03:45 2021 @author: shangfr """ import joblib import operator from functools import reduce from whoosh.index import open_dir from whoosh.qparser import QueryParser import pkg_resources INDEX_DIR = pkg_resources.resource_filename('cnsyn', 'query') ix = open_dir(INDE...
Review this code and list any quality issues.
[ { "issue": "Function 'search' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 25 } ]
1
python
# -*- coding:utf-8 -*- import re import os import time import json import sys import subprocess import requests import hashlib from bs4 import BeautifulSoup """ info: author:CriseLYJ github:https://github.com/CriseLYJ/ update_time:2019-3-6 """ class Lagou_login(object): def __init__(self): self.session ...
Review this code and list any quality issues.
[ { "issue": "Function 'login' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 89 } ]
1
python
#! /usr/bin/python3 # Define the class DVD class DVD: def __init__(self, title, studio, director, released): self.__title = title self.__studio = studio self.__director = director self.__released = released def get_title(self): return self.__title def get_studio(se...
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": 5 } ]
1
python
#!/usr/bin/env python # # Electrum - lightweight STRAKS client # Copyright (C) 2013 ecdsa@github # # 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 lim...
Review this code and list any quality issues.
[ { "issue": "Function 'seed_options' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 55 }, { "issue": "Function '__init__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severi...
6
python
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.FileItem import FileItem from alipay.aop.api.constant.ParamConstants import * class AnttechBlockchainQueryconditionQueryRequest(object): def __init__(self, biz_model=None): self._biz_model = biz_model self._version =...
Review this code and list any quality issues.
[ { "issue": "Function 'get_params' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 105 } ]
1
python
from utils import stringifySong from datetime import datetime import logging logger = logging.getLogger(__name__) class Migrater(object): """Migrater""" def __init__(self, migrateFrom, migrateTo, mock=False): # Store clients self.source = migrateFrom self.target = migrateTo s...
Review this code and list any quality issues.
[ { "issue": "Function 'migratePlaylists.migratePlaylist' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 24 }, { "issue": "Function 'migratePlaylists' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smal...
3
python
# This file is licensed under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception """Repository rules to configure the terminfo used by LLVM. Most users should pick one of the explicit rules to configure th...
Review this code and list any quality issues.
[ { "issue": "Function '_llvm_terminfo_system_impl' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 89 }, { "issue": "Function '_llvm_terminfo_system_impl' is 36 lines long. Functions over 25 lines are harder to test and main...
2
python
# SIKULI INTERFACE FOR TAGUI FRAMEWORK ~ TEBEL.ORG # # timeout in seconds for finding a web element setAutoWaitTimeout(10) # delay in seconds between scanning for inputs scan_period = 0.5 # counter to track current tagui sikuli step tagui_count = '0' # prevent premature exit on unhandled exception setThrowException...
Review this code and list any quality issues.
[ { "issue": "Function 'get_intent' has cyclomatic complexity 20 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 151 }, { "issue": "Function 'parse_intent' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", ...
3
python
# Copyright 2017 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 'get_variables_available_in_checkpoint' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 101 }, { "issue": "Function 'get_variables_available_in_checkpoint' is 37 lines long. Functions over 25 lines are ...
2
python
""" This is a little GUI to launch the playlist importer. It launches the import script in a command prompt window. """ import os import urllib2 import subprocess import sys # This requires wxPython 3.0.2.0. # For compatibility with virtualenv you can use the wheels from # https://www.lfd.uci.edu/~gohlke/pythonlibs...
Review this code and list any quality issues.
[ { "issue": "Function 'button_import_click' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 121 } ]
1
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 'test_dynamic_rnn_decoder_time_major' is 76 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 33 } ]
1
python
import os import subprocess from huntsman.pocs.utils import DummyLogger from huntsman.pocs.utils.config import query_config_server, load_device_config def mount(mountpoint, remote, server_alive_interval=20, logger=None, server_alive_count_max=3, strict_host_key_checking=False): ''' Mount remote on l...
Review this code and list any quality issues.
[ { "issue": "Function 'mount' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 7 }, { "issue": "Function 'mount_images_dir' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 73 } ]
2
python
import json import logging import os import time import yaml from .socketio import socketio from .models import db, NFCTagModel from flask import current_app from musicfig import colors from sqlalchemy import func logger = logging.getLogger(__name__) # all uses of current_app in here are for config; try just passin...
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": 43 }, { "issue": "Function 'create_nfc_tag' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 173 }, {...
3
python
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Support for formatting a data pack file used for platform agnostic resource files. """ from __future__ import print_function 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": 44 }, { "issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 68 }, { "i...
9
python
#!/usr/bin/env python """ dos2unix Batch Utility Script ============================= First, use this for most things: find . -name *.txt | xargs dos2unix Second, this is a little smarter (might be faster), and I can control the globbing a little better. TODO ---- - implement some accounting (scanned, detect...
Review this code and list any quality issues.
[ { "issue": "Function 'd2u' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 31 }, { "issue": "Function 'd2u' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 3...
3
python
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2020, John McNamara, jmcnamara@cpan.org # from ..excel_comparison_test import ExcelComparisonTest from ...workbook import Workbook class TestCompareXLSXFiles(ExcelComparisonTest): """...
Review this code and list any quality issues.
[ { "issue": "Function 'test_create_file' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 22 } ]
1
python
from lusidtools.lpt import lpt from lusidtools.lpt import lse from lusidtools.lpt import stdargs from lusidtools.lpt import txn_config_yaml as tcy TOOLNAME = "txn_cfg" TOOLTIP = "Get/Set the transaction configuration" def parse(extend=None, args=None): return ( stdargs.Parser( "Get/Set transa...
Review this code and list any quality issues.
[ { "issue": "Function 'process_args' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 73 }, { "issue": "Function 'process_args' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "mino...
2
python
import pandas as pd from pathlib import Path from time import perf_counter from utils import get_document_store, get_retriever, index_to_doc_store, load_config from haystack.preprocessor.utils import eval_data_from_json from haystack.document_store.faiss import FAISSDocumentStore from haystack import Document import p...
Review this code and list any quality issues.
[ { "issue": "Function 'benchmark_indexing' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 41 }, { "issue": "Function 'benchmark_indexing' is 67 lines long. Functions over 25 lines are harder to test and maintain.", "s...
9
python
# -*- coding: utf-8 -*- """ Convert README file from Markdown to text """ from markdown import markdown import html2text # from `aaronsw` :( MARKER = 'MARKER()()MARKER' def fix_quotes(mdcontent): count = 0 quote_state = False quote_char = '`' quote_string = '' new_string = '' quotes = [] ...
Review this code and list any quality issues.
[ { "issue": "Function 'fix_quotes' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 13 }, { "issue": "Function 'fix_quotes' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", ...
2
python
def split_caps(key): """ splits a string using capital letters as separator eg split_caps('ExampleString') returns ['Example', 'String'] """ b = False lst = [] x = 0 for i, ch in enumerate(key): if i > 0 and ch.isupper(): temp = key[x:i] if b and not temp...
Review this code and list any quality issues.
[ { "issue": "Function 'split_caps' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 1 } ]
1
python
# coding=utf-8 # Copyright 2022 The Google Research 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 applicab...
Review this code and list any quality issues.
[ { "issue": "Function 'demosaic' is 31 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 38 } ]
1