language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | # qubit number=3
# total number=84
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collections import Counter
from... | Review this code and list any quality issues. | [
{
"issue": "Function 'build_oracle' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 33
},
{
"issue": "Function 'build_circuit' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "min... | 2 |
python | import hail as hl
from hail.typecheck import typecheck
@typecheck(mt=hl.MatrixTable, path=str, batch_size=int, bgzip=bool, header_json_in_file=bool, use_string_key_as_file_name=bool)
def export_entries_by_col(mt: hl.MatrixTable,
path: str,
batch_size: int = 256,
... | Review this code and list any quality issues. | [
{
"issue": "Function 'export_entries_by_col' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 6
}
] | 1 |
python | # adapted from https://github.com/nadavbh12/VQ-VAE
import numpy as np
import torch
from torch import nn
from torch.autograd import Function, Variable
import torch.nn.functional as F
from config import *
import pdb
class NearestEmbedFunc(Function):
"""
Input:
------
x - (batch_size, emb_dim, *)
... | 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": 114
},
{
"issue": "Function 'forward' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 132
}
] | 2 |
python | # Lint as: python3
# Copyright 2019, The TensorFlow Federated 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 ... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_train_dataset_preprocess_fn' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 85
},
{
"issue": "Function 'create_train_dataset_preprocess_fn' is 26 lines long. Functions over 25 lines are harder t... | 5 |
python | # -*- coding: utf-8 -*-
"""Canonical correlation analysis
author: Yichuan Liu
"""
import numpy as np
from numpy.linalg import svd
import scipy
import pandas as pd
from statsmodels.base.model import Model
from statsmodels.iolib import summary2
from .multivariate_ols import multivariate_stats
class CanCorr(Model):
... | 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": 48
},
{
"issue": "Function 'corr_test' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 95
}
] | 2 |
python | #
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | Review this code and list any quality issues. | [
{
"issue": "Function 'Execute' has cyclomatic complexity 19 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 94
},
{
"issue": "Function 'Execute' is 63 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",... | 2 |
python | # Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | 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": 40
},
{
"issue": "Function 'encrypt_metadata' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
... | 3 |
python | import os
import stat
import sys
from stai.util.config import load_config, traverse_dict
from stai.util.permissions import octal_mode_string, verify_file_permissions
from logging import Logger
from pathlib import Path
from typing import Dict, List, Optional, Set, Tuple
DEFAULT_PERMISSIONS_CERT_FILE: int = 0o644
DEFAUL... | Review this code and list any quality issues. | [
{
"issue": "Function 'fix_ssl' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 176
}
] | 1 |
python | # encoding: utf-8
"""
@author: liaoxingyu
@contact: liaoxingyu2@jd.com
"""
import math
import random
class RandomErasing(object):
""" Randomly selects a rectangle region in an image and erases its pixels.
'Random Erasing Data Augmentation' by Zhong et al.
See https://arxiv.org/pdf/1708.04896.pdf... | 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": 23
},
{
"issue": "Function '__call__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"li... | 2 |
python | # Copyright (c) Microsoft Corporation and contributors.
# Licensed under the MIT License.
import unittest
import numpy as np
from sklearn.mixture import GaussianMixture
from graspologic.plot.plot import (
_sort_inds,
gridplot,
heatmap,
pairplot,
pairplot_with_gmm,
)
from graspologic.simulations.s... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_common_inputs' is 56 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 51
},
{
"issue": "Function 'test_sort_inds' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | """A merge sort which accepts an array as input and recursively
splits an array in half and sorts and combines them.
"""
"""https://en.wikipedia.org/wiki/Merge_sort """
def merge(arr: list[int]) -> list[int]:
"""Return a sorted array.
>>> merge([10,9,8,7,6,5,4,3,2,1])
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
... | Review this code and list any quality issues. | [
{
"issue": "Function 'merge' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 8
},
{
"issue": "Function 'merge' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line":... | 2 |
python | from typing import List, Optional
from dagster_fivetran.resources import DEFAULT_POLL_INTERVAL
from dagster_fivetran.utils import generate_materializations
from dagster import AssetKey, AssetsDefinition, Out, Output
from dagster import _check as check
from dagster import multi_asset
from dagster.utils.backcompat impo... | Review this code and list any quality issues. | [
{
"issue": "Function 'build_fivetran_assets' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 13
}
] | 1 |
python | from __future__ import print_function
import os
import numpy as np
import random
import math
from skimage import io
import torch
import torch.utils.data as data
import torchfile
# from utils.utils import *
from utils.imutils import *
from utils.transforms import *
class W300(data.Dataset):
def __init__(self, ... | Review this code and list any quality issues. | [
{
"issue": "Function 'generateSampleFace' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 69
},
{
"issue": "Function 'generateSampleFace' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"seve... | 3 |
python | def retorno():
resp=input('Deseja executar o programa novamente?[s/n] ')
if(resp=='S' or resp=='s'):
verificar()
else:
print('Processo finalizado com sucesso!')
pass
def cabecalho(titulo):
print('-'*30)
print(f'{titulo:^30}')
print('-'*30)
pass
def mensagem_er... | Review this code and list any quality issues. | [
{
"issue": "Function 'verificar' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 32
},
{
"issue": "Function 'verificar' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | from flask import Flask, redirect, render_template, url_for
import numpy as np
app = Flask( __name__ )
@app.route( '/home' )
def index():
# retrieve the agent
agent = app.config['AGENT']
print( 'Episode: {}/{}'.format( agent.get_episode(), agent.get_episodes() ) )
print( 'Trial: {}/{}'.format( agent.... | Review this code and list any quality issues. | [
{
"issue": "Function 'index' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 7
}
] | 1 |
python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 24 07:52:25 2020
Generate, Plot, and write all data needed for ball drop example 1
@author: granthutchings
"""
#%% Imports
import numpy as np
#import pyDOE # Latin Hypercube
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
fro... | Review this code and list any quality issues. | [
{
"issue": "Function 'gen_data' is 57 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 44
},
{
"issue": "Function 'gen_data' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 44
},
{
... | 6 |
python | from coffea.lookup_tools.lookup_base import lookup_base
import numpy
from copy import deepcopy
class dense_lookup(lookup_base):
def __init__(self, values, dims, feval_dim=None):
super(dense_lookup, self).__init__()
self._dimension = 0
whattype = type(dims)
if whattype == numpy.nda... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 8
}
] | 1 |
python | # Copyright 1999-2018 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-2.0
#
# Unless required by applicable law or a... | Review this code and list any quality issues. | [
{
"issue": "Function 'testDispatch' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 49
}
] | 1 |
python | """TODO(wikitext): Add a description here."""
import os
import datasets
_CITATION = """\
@misc{merity2016pointer,
title={Pointer Sentinel Mixture Models},
author={Stephen Merity and Caiming Xiong and James Bradbury and Richard Socher},
year={2016},
eprint={1609.07843},
archivePrefix={... | Review this code and list any quality issues. | [
{
"issue": "Function '_split_generators' is 78 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 100
}
] | 1 |
python | # Copyright 2021 Hakan Kjellerstrand hakank@gmail.com
#
# 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 ... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 42
},
{
"issue": "Function 'main' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line":... | 2 |
python | import os
import torch
from torchvision.utils import make_grid
from tensorboardX import SummaryWriter
from dataloaders.utils import decode_seg_map_sequence
class TensorboardSummary(object):
def __init__(self, directory):
self.directory = directory
def create_summary(self):
writer = SummaryWrit... | Review this code and list any quality issues. | [
{
"issue": "Function 'visualize_image' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 15
}
] | 1 |
python | import logging
from logging.handlers import SMTPHandler, RotatingFileHandler
import os
from flask import Flask, request, current_app
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_login import LoginManager
from flask_mail import Mail
from flask_bootstrap import Bootstrap
from flask... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_app' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 28
},
{
"issue": "Function 'create_app' is 57 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",... | 2 |
python | import util
import math
from Compiler.types import Array, sint, sfloat, sfix, MemValue, cint, Matrix, _int
# import operator
# import math
# from Compiler.instructions import *
from Compiler.library import for_range, print_str, for_range, print_float_prec
import ml
pint = sint
pfloat = sfloat
pfix = sfix
pnum = pflo... | Review this code and list any quality issues. | [
{
"issue": "Function 'pConv2d' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 46
},
{
"issue": "Function 'pMaxPool' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 58
},
{
... | 3 |
python | import misc_tools
import random
def create_routing(env, first_step='op1'):
tasks = {
'op1': misc_tools.make_assembly_step(
env=env,
run_time=random.gauss(mu=12, sigma=0.5),
route_to='op2'),
'op2': {
'location': env['machine_3'],
'worker... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_routing' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 4
}
] | 1 |
python | # coding:utf-8
# modified from: https://github.com/haqishen/MFNet-pytorch
# By Yuxiang Sun, Aug. 2, 2019
# Email: sun.yuxiang@outlook.com
import os
import argparse
import time
import datetime
import numpy as np
import sys
import torch
from torch.autograd import Variable
from torch.utils.data import DataLoader
from ut... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 23
},
{
"issue": "Function 'main' is 67 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line":... | 2 |
python | """
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
import re # noq... | Review this code and list any quality issues. | [
{
"issue": "Function '_from_openapi_data' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 114
},
{
"issue": "Function '_from_openapi_data' is 43 lines long. Functions over 25 lines are harder to test and maintain.",
"sev... | 4 |
python | """Support for Xiaomi lights."""
import logging
from functools import partial
from homeassistant.const import * # noqa: F401
from homeassistant.components.light import (
DOMAIN as ENTITY_DOMAIN,
LightEntity,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR_TEMP,
SUPPORT_COLOR,
SUPPORT_EFFECT,
ATTR_BRIGHT... | Review this code and list any quality issues. | [
{
"issue": "Function 'async_setup_platform' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 62
},
{
"issue": "Function '__init__' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
... | 5 |
python | # coding: utf-8
"""
Browse API
<p>The Browse API has the following resources:</p> <ul> <li><b> item_summary: </b> Lets shoppers search for specific items by keyword, GTIN, category, charity, product, or item aspects and refine the results by using filters, such as aspects, compatibility, and fields values.<... | 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 'to_dict' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line":... | 2 |
python | import hashlib
import random
import lycanthropy.sql.interface
import lycanthropy.crypto
import jwt
def decodeToken(token,config):
rawData = jwt.decode(
token,
config['secret'],
algorithms=['HS256']
)
return rawData
def monitoringToken(user,config,remote,identity):
userData = ly... | Review this code and list any quality issues. | [
{
"issue": "Function 'getCampaignAccess' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 42
}
] | 1 |
python | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft and contributors. 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 ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 11 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 79
}
] | 1 |
python | # Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2021 Dan <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 59
},
{
"issue": "Function 'parse' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line... | 4 |
python | # copyright openpyxlzip 2014
import datetime
import pytest
from openpyxlzip.tests.helper import compare_xml
from openpyxlzip.xml.constants import DCTERMS_PREFIX, DCTERMS_NS, XSI_NS
from openpyxlzip.xml.functions import (
fromstring,
tostring,
register_namespace,
NS_REGEX,
)
@pytest.fixture()
def Sa... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_ctor' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 39
}
] | 1 |
python | """
PI power
5V on pin
GND on pin
The GPIO mode is set to BCM
H-Bridge Motor Driver Pin Configuration
in1 -> BCM 05 (board pin 29 or GPIO 5)
in2 -> BCM 06 (board pin 31 or GPIO 6)
enable -> BCM 13 (board pin 33 or GPIO 13, PWM)
PCA9685 (16-Channel Servo Driver) Pin Configuration
SDA -> BCM 2 (board pin ... | Review this code and list any quality issues. | [
{
"issue": "Function 'accelerate' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 80
},
{
"issue": "Function 'accelerate' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 6 |
python | # Copyright 2019 The ROBEL 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 wr... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 29
},
{
"issue": "Function '__init__' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 3 |
python |
import os
import click
from movie import Movie
from scan import Scan
from helper import Helper
@click.command()
@click.option('--endings',
default='mp4, mkv',
help='File-endings that are accepted as valid movie-files. ' +
'Default: [.mkv, .mp4]'
)
@click.option... | 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": 20
},
{
"issue": "Function 'main' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 2 |
python | import math
class Player:
def __init__(self):
pass
# self.most_common = lambda : self.numbers.index(max(self.numbers)) + 1
def initcards(self,num1,num2,num3,num4,num_all):
self.numbers = [num1,num2,num3,num4]
self.num_all = num_all
self.common = self.numbers.index(... | Review this code and list any quality issues. | [
{
"issue": "Function 'initcards' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 8
}
] | 1 |
python | r""""Contains definitions of the methods used by the _DataLoaderIter workers to
collate samples fetched from dataset into Tensor(s).
These **needs** to be in global scope since Py2 doesn't support serializing
static methods.
"""
import torch
import re
from torch._six import container_abcs, string_classes, int_classes... | Review this code and list any quality issues. | [
{
"issue": "Function 'default_collate' has cyclomatic complexity 23 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 31
},
{
"issue": "Function 'default_collate' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severi... | 2 |
python | '''
'''
import re
from billy.scrape.actions import Rule, BaseCategorizer
committees = [
u"Veterans' Affairs",
u'Agriculture and Agri-business Committee',
u'Agriculture',
u'Banking and Insurance',
u'Banking',
u'Children, Juveniles and Other Issues',
u'Constitutional Revision',
u'Counci... | Review this code and list any quality issues. | [
{
"issue": "Function 'post_categorize' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 129
}
] | 1 |
python | #!/usr/bin/env python3
import os
import time
import itertools
import contextlib
import fanout_utils
def fanout_hls(context):
context += {
"starttime": int(time.time()),
}
cleanup(context)
context += calculate_map_and_varmap(context)
generate_master_playlists(context)
fanout(context)
print("Cleaning up")... | Review this code and list any quality issues. | [
{
"issue": "Function 'generate_master_playlists' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 75
}
] | 1 |
python | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from .. import utilities, tables
class Route(pulumi.CustomResource):
... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 39
},
{
"issue": "Function '__init__' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical"... | 3 |
python | from __future__ import print_function
import os
import utils
import argparse
import point
import one_step_approximator
from IPython.core.debugger import Pdb
MAX = float('inf')
def print_output(output,output_file):
if output_file == '':
fh = None
else:
fh = open(output_file,'w')
#
pri... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 24
},
{
"issue": "Function 'main' is 50 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line":... | 2 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
class ContentPrizeInfoModel(object):
def __init__(self):
self._prize_id = None
self._prize_logo = None
self._prize_name = None
@property
def prize_id(self... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_alipay_dict' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 38
}
] | 1 |
python | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import os
import random
import numpy as np
import torch
from torch import nn
from typing import Dict
def to_device(data... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_device' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 16
},
{
"issue": "Function 'get_all_files' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"seve... | 2 |
python | import numpy as np
from .support import pdfMetalog, quantileMetalog
def pdf_quantile_builder(temp, y, term_limit, bounds, boundedness):
"""Builds the metalog pdf and quantile arrays based on the a coefficients found by fitting metalog distribution.
Args:
temp (:obj: `numpy.ndarray` of type float): Ar... | Review this code and list any quality issues. | [
{
"issue": "Function 'pdf_quantile_builder' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 5
},
{
"issue": "Function 'pdf_quantile_builder' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"s... | 3 |
python | # coding=utf-8
# Author: Rafael Menelau Oliveira e Cruz <rafaelmenelau@gmail.com>
#
# License: BSD 3 clause
import numpy as np
from deslib.dcs.base import BaseDCS
class APosteriori(BaseDCS):
"""A Posteriori Dynamic classifier selection.
The A Posteriori method uses the probability of correct classificatio... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 14 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 122
}
] | 1 |
python | from __future__ import absolute_import
from django import forms
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.utils.crypto import constant_time_compare
from django.utils.translation import ugettext_lazy as _
from sentry.models import AuditLogEntryEvent, Authenticator, Or... | Review this code and list any quality issues. | [
{
"issue": "Function 'handle' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 31
},
{
"issue": "Function 'handle' is 102 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"l... | 2 |
python | # Copyright 2020 Masao Someki
# MIT License (https://opensource.org/licenses/MIT)
import os
import glob
import h5py
import logging
import librosa
import numpy as np
from scipy.io import wavfile
from speech import Synthesizer
IRLEN = 1024
INTERVALS = 10
SEED = 1
LP_CUTOFF = 20
class Decoder(object):
def __init... | 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": 21
},
{
"issue": "Function 'decode' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"l... | 3 |
python | #!/usr/bin/env python3
# encoding: utf-8
from lxml import html
import requests
import os
import random
import time
from fake_agent import fakeagent
class Gbrarscrapy(object):
def __init__(self, url_li, proxy_single):
self.title_xpa = '//a[@onmouseover]/text()'
self.score_list_xpa = '//span[@style... | Review this code and list any quality issues. | [
{
"issue": "Function 'run' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 31
},
{
"issue": "Function 'run' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 31... | 3 |
python | import torch
import logging
from torchtext.data.utils import get_tokenizer
from torchtext.vocab import build_vocab_from_iterator
from torchtext.experimental.datasets.raw import language_modeling as raw
from torchtext.experimental.datasets.raw.common import check_default_set
from torchtext.experimental.datasets.raw.comm... | Review this code and list any quality issues. | [
{
"issue": "Function '_setup_datasets' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 62
},
{
"issue": "Function '_setup_datasets' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "majo... | 2 |
python | import logging
import asyncio
import argparse
import i2plib.sam
import i2plib.aiosam
import i2plib.utils
from i2plib.log import logger
BUFFER_SIZE = 65536
async def proxy_data(reader, writer):
"""Proxy data from reader to writer"""
try:
while True:
data = await reader.read(BUFFER_SIZE)
... | Review this code and list any quality issues. | [
{
"issue": "Function 'proxy_data' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 12
},
{
"issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"lin... | 2 |
python | import os
import sys
import time
import numpy as np
import pandas as pd
import argparse
import math
import config as cfg
def str2bool(v):
return v.lower() in ("yes", "true", "t", "1")
parser = argparse.ArgumentParser(
description='The Normarlized Error Mertric Calculation For FashionAI Keypoint Detection Scr... | Review this code and list any quality issues. | [
{
"issue": "Function 'run' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 25
},
{
"issue": "Function 'run' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 2... | 4 |
python | from __future__ import absolute_import
import os
import numpy as np
import gzip
import struct
from .preprocessing import one_hotify
def load(data_dir, valid_ratio=0.0, one_hot=True, shuffle=False, dtype='float32'):
train_set, valid_set, test_set = {}, {}, {}
# Get data from binary files
for img_set, file_name... | Review this code and list any quality issues. | [
{
"issue": "Function 'load' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 10
},
{
"issue": "Function 'load' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 10
}
] | 2 |
python | """
Fyle Platform SDK Class
"""
from .apis import v1beta
from .globals.config import config
from .internals.auth import Auth
class Platform(Auth):
"""The main class which creates a connection with
Fyle APIs using OAuth2 authentication (refresh token grant type).
Parameters:
client_id (str): ... | 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": 20
}
] | 1 |
python | ##
## Weirdo Tree Graph that powers jobChomper
## --
##
## Assertions:
## * DAG is made up of named edges
## * Each edge is a triple (A, B, NEEDSPREVIOUSTOPASS)
## A, B are the named nodes
## B will execute after A has evaluated
## NEEDSPREVIOUSTOPASS is True or False; if it is True then A _must_ eval... | Review this code and list any quality issues. | [
{
"issue": "Function 'findCycle' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 23
},
{
"issue": "Function 'buildRunDict' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"sever... | 4 |
python | """Handle August connection setup and authentication."""
import asyncio
import logging
import os
from aiohttp import ClientError, ClientResponseError
from august.api_async import ApiAsync
from august.authenticator_async import AuthenticationState, AuthenticatorAsync
from homeassistant.const import (
CONF_PASSWOR... | Review this code and list any quality issues. | [
{
"issue": "Function 'async_authenticate' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 89
}
] | 1 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
class AlipayUserCertDocIDCard(object):
def __init__(self):
self._encoded_img_emblem = None
self._encoded_img_identity = None
self._expire_date = None
self.... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_alipay_dict' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 54
},
{
"issue": "Function 'to_alipay_dict' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": ... | 3 |
python | from problems.problem import Problem
def generate_pythagorean_triples(ub: int) -> []:
# https://en.wikipedia.org/wiki/Pythagorean_triple
result = []
for a in range(1, ub):
aa = a * a
b = a + 1
c = b + 1
while c <= ub:
cc = aa + b * b
while c * c < cc:
c += 1
if c * c == ... | Review this code and list any quality issues. | [
{
"issue": "Function 'generate_pythagorean_triples' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 3
}
] | 1 |
python | import argparse
import os
import maskgen.scenario_model
from maskgen.tool_set import *
from maskgen import video_tools
import tempfile
from maskgen.scenario_model import ImageProjectModel
from maskgen.image_graph import extract_archive
from maskgen.graph_rules import processProjectProperties
from maskgen.batch import B... | Review this code and list any quality issues. | [
{
"issue": "Function 'select_region' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 32
},
{
"issue": "Function 'update_rotation' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
... | 7 |
python | # !/usr/bin/env python3
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""
Validate ORT kernel registrations.
"""
import argparse
import os
import sys
import typing
import op_registration_utils
from logger import get_logger
log = get_logger("op_registration_validator")
... | Review this code and list any quality issues. | [
{
"issue": "Function 'process_registration' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 37
},
{
"issue": "Function 'process_registration' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"... | 3 |
python | # coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from ... | 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": 39
}
] | 1 |
python | # coding=utf-8
from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm
from django.contrib.auth.tokens import default_token_generator
from django.contrib.auth.views import password_reset_confirm
from django.template.response import TemplateResponse
from django.utils.translation import ugettext as _
fr... | Review this code and list any quality issues. | [
{
"issue": "Function 'do_view' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 77
},
{
"issue": "Function 'get' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 86
},
{
"issue":... | 3 |
python | ## A recursive implementation of merge sort.
## Author: AJ
## test case 1 45 849 904 79 48942 7
class sorting:
def __init__(self):
self.arr = []
def get_data(self):
self.arr = list(map(int, input().split()))
return self.arr
def merge_sort(self, array):
if len(array) == 1:
... | Review this code and list any quality issues. | [
{
"issue": "Function 'merge_sort' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 13
},
{
"issue": "Function 'merge_sort' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | import os
from textx.metamodel import metamodel_from_file
from textx.model import children_of_type
from pynmodl.nmodl import NModlCompiler
mm = metamodel_from_file(
os.path.join(os.path.dirname(__file__), '../../grammar/nmodl.tx'))
mm.register_obj_processors({'VarRef': NModlCompiler().handle_varref})
def refs_in... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_scoping' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 15
},
{
"issue": "Function 'test_multiple_locals' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | from nanobox_libcloud import celery
from nanobox_libcloud import adapters
from time import sleep
import logging
@celery.task
def azure_destroy_arm(creds, name):
logger = logging.getLogger(__name__)
self = adapters.azure_arm.AzureARM()
driver = self._get_user_driver(**creds)
logger.info('Destroying se... | Review this code and list any quality issues. | [
{
"issue": "Function 'azure_destroy_arm' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 8
},
{
"issue": "Function 'azure_destroy_arm' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"sev... | 2 |
python | #!/usr/bin/env python
#pylint: skip-file
# This source code is licensed under the Apache license found in the
# LICENSE file in the root directory of this project.
class LicenseInfoDTO(object):
def __init__(self):
"""
Attributes:
swaggerTypes (dict): The key is attribute name and the v... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 107 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 10
}
] | 1 |
python | """
Modified from https://github.com/Oneflow-Inc/models/blob/main/Vision/style_transform/fast_neural_style/neural_style/transformer_net.py
"""
from typing import Any
import oneflow as flow
from ..registry import ModelCreator
from ..utils import load_state_dict_from_url
__all__ = ["FastNeuralStyle", "fast_neural_sty... | 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 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 65
}
] | 2 |
python | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def base():
index = pd.date_range('20181023', periods=9) # 生成9个行索引
column = ['a', 'b', 'c', 'd'] # 生成4个列索引
a = np.random.randn(9, 4) # 随便生成的9行4列的数据
df = pd.DataFrame(a, index=index, columns=column)
print(df)
print(pd.Dat... | Review this code and list any quality issues. | [
{
"issue": "Function 'merge_DataFrame' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 65
},
{
"issue": "Function 'merge' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 10... | 2 |
python | import numpy as np
import os
from easydict import EasyDict as edict
config = edict()
config.bn_mom = 0.9
config.workspace = 256
config.emb_size = 512
config.ckpt_embedding = True
config.net_se = 0
config.net_act = 'prelu'
config.net_unit = 3
config.net_input = 1
config.net_blocks = [1, 4, 6, 2]
config.net_output = 'E... | Review this code and list any quality issues. | [
{
"issue": "Function 'generate_config' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 202
}
] | 1 |
python | # coding: utf-8
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkcore.http.http_config import HttpConfig
"""
# 导入指定云服务的库 huaweicloudsdk{service}
"""
from huaweicloudsdkvpc.v2 import *
from huaweicloudsdkvpc.v2.region.vpc_region imp... | Review this code and list any quality issues. | [
{
"issue": "Function 'start' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 35
},
{
"issue": "Function 'start' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line"... | 4 |
python | #!/usr/bin/python
# -*- coding: utf-8 -*-
from PyQt5 import QtGui
from PyQt5 import QtCore
from PyQt5 import QtWidgets
from .guiconfig import collectView
class MenuBar(QtWidgets.QMenuBar):
viewID = "MenuBar"
@collectView
def __init__(self, parent):
super(MenuBar, self).__init__()
self.p... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 123 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 15
},
{
"issue": "Function 'creatAction' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 17... | 2 |
python | """BaseHTTPServer that implements the Python WSGI protocol (PEP 3333)
This is both an example of how WSGI can be implemented, and a basis for running
simple web applications on a local machine, such as might be done when testing
or debugging an application. It has not been reviewed for security issues,
however, and w... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_environ' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 75
},
{
"issue": "Function 'get_environ' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor"... | 3 |
python | # -*- coding: utf-8 -*-
# Copyright 2020-2021 CERN
#
# 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 a... | Review this code and list any quality issues. | [
{
"issue": "Function 'containerized_rses' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 121
},
{
"issue": "Function 'core_config_mock' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"sever... | 2 |
python | # -*- coding: utf-8 -*-
from ccxt.async.base.exchange import Exchange
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import NotSupported
class bitstamp1 (Exchange):
def describe(self):
return self.deep_extend(super(bitstamp1, self).describe(), {
'id': 'bitstamp1',
... | Review this code and list any quality issues. | [
{
"issue": "Function 'describe' is 63 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 10
},
{
"issue": "Function 'fetch_ticker' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 81... | 8 |
python | # coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 131
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line... | 2 |
python | import torch
from torch import nn
from torch import optim
from torch.nn import functional as F
from torch.utils.data import TensorDataset, DataLoader
from torch import optim
import numpy as np
from learner import Learner
from copy import deepcopy
def zero_nontrainable_grads(grads, trainable_lay... | Review this code and list any quality issues. | [
{
"issue": "Function 'inputsPGD' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 17
},
{
"issue": "Function 'inputsPGD' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"lin... | 8 |
python | # -*- coding: utf-8 -*-
# Copyright (c) 2019-2021 Ramon van der Winkel.
# All rights reserved.
# Licensed under BSD-3-Clause-Clear. See LICENSE file for details.
from django.test import TestCase
from django.utils import timezone
from NhbStructuur.models import NhbRegio, NhbVereniging
from .leeftijdsklassen import ... | Review this code and list any quality issues. | [
{
"issue": "Function 'setUp' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 19
},
{
"issue": "Function 'test_leeftijdsklassen' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"lin... | 2 |
python | '''
The probabilistic ensemble dynamics model
'''
# pylint: disable=C0103, R0902, R0913, W0201, E0401, E1120
import time
import itertools
import numpy as np
import tensorflow as tf
from tensorflow import keras
from collections import defaultdict
import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
class PEModel(ke... | 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": 53
},
{
"issue": "Function 'train' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line"... | 5 |
python | #!/usr/bin/env python3
from collections import deque
FILE='test.txt' # sol: 40
FILE='input.txt' # sol: 824
def print_board(board):
for row in board:
print(''.join([str(i) for i in row]))
def parse_input(file, repeat):
board = []
for i in range(repeat):
with open(file, 'r') as f:
... | Review this code and list any quality issues. | [
{
"issue": "Function 'compute_board' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 22
}
] | 1 |
python | ####################################################################################################
#
# ISTANBUL TECHNICAL UNIVERSITY
# BLU 537E - Data Analysis & Visualization
# Assignment 01
#
####################################################################################################
#
# ... | Review this code and list any quality issues. | [
{
"issue": "Function 'problem2' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 61
},
{
"issue": "Function 'problem2' is 43 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 5 |
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
# d... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_gbp_details' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 103
},
{
"issue": "Function 'get_gbp_details_list' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line"... | 10 |
python | """
You may define your own custom forms, based or inspired by the following ones.
Examples of customization:
recipients = CommaSeparatedUserField(label=("Recipients", "Recipient"),
min=2,
max=5,
user_filter=my_user_filter,
channel='my_channel',
)
can_overwrite_limits = Fals... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 45
},
{
"issue": "Function 'clean_recipients' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"s... | 4 |
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 'testTwoStepPipeline' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 112
},
{
"issue": "Function 'testTwoStepPipeline' is 63 lines long. Functions over 25 lines are harder to test and maintain.",
"... | 6 |
python | # Copyright 2019 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_streaming' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 196
},
{
"issue": "Function 'test_streaming' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity":... | 2 |
python | import tkinter as tk
from tkinter.ttk import *
import sqlite3
from tkinter import *
'''
import speech_recognition as sr # for speech recognition to play songs
import pyttsx3 as tts # python module for speech
engine = tts.init()
volume = engine.getProperty('volume')
engine.setProperty('volume',0.75)
voices = engine.g... | Review this code and list any quality issues. | [
{
"issue": "Function 'update' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 92
},
{
"issue": "Function 'edit' is 87 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 137
},
{... | 3 |
python | #!/usr/bin/python
#-*- coding: utf-8 -*-
# Video 25 FPS, Audio 16000HZ
import torch
import numpy
import time, pdb, argparse, subprocess, os, math, glob
import cv2
import python_speech_features
from scipy import signal
from scipy.io import wavfile
from SyncNetModel import *
from shutil import rmtree
# ==============... | Review this code and list any quality issues. | [
{
"issue": "Function 'evaluate' has cyclomatic complexity 21 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 53
},
{
"issue": "Function 'evaluate' is 93 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical... | 3 |
python | from __future__ import absolute_import, division, print_function
import os
import sys
import tensorflow.compat.v1 as tfv1
from attrdict import AttrDict
from xdg import BaseDirectory as xdg
from src.flags import FLAGS
from .gpu import get_available_gpus
from .logging import log_error
from .text import Alphabet, UTF8A... | Review this code and list any quality issues. | [
{
"issue": "Function 'initialize_globals' has cyclomatic complexity 18 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 29
},
{
"issue": "Function 'initialize_globals' is 69 lines long. Functions over 25 lines are harder to test and maintain.",
"... | 2 |
python | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | Review this code and list any quality issues. | [
{
"issue": "Function 'islice' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 134
}
] | 1 |
python | from django.core.management.base import BaseCommand, CommandError
from simple_history.models import HistoricalRecords
from members.models import User
from members.models import User
from django.contrib.auth.forms import PasswordResetForm
from django.conf import settings
from django.core.mail import EmailMessage
impor... | Review this code and list any quality issues. | [
{
"issue": "Function 'reset_password' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 19
},
{
"issue": "Function 'reset_password' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": ... | 5 |
python | #############################################################
# win10 64bit
# python 3.9.6
#
# author: toush1 (20373944 he tianran)
#############################################################
import os
import re
# software path
xilinxPath = "G:\\ISE\\ise\\14.7\\ISE_DS\\ISE\\"
marsPath = "G:\\mars\\Mars... | Review this code and list any quality issues. | [
{
"issue": "Function 'cmp' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 81
},
{
"issue": "Function 'cmp' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 81... | 2 |
python | #
# Copyright(c) 2019-2021 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
import pytest
from api.cas import casadm
from api.cas.cache_config import (
CacheMode,
CacheLineSize,
SeqCutOffPolicy,
CleaningPolicy,
CacheStatus,
)
from core.test_run import TestRun
from storage_devices.disk i... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_cache_insert_error' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 29
},
{
"issue": "Function 'test_cache_insert_error' is 36 lines long. Functions over 25 lines are harder to test and maintain.",... | 5 |
python | from typing import Any, Mapping, Sequence
from urllib.parse import unquote_plus
import bleach
from importo.fields.base import Field
from importo.utils.html import tidy_html
class HTMLField(Field):
allowed_tags = [
"a",
"abbr",
"acronym",
"b",
"bdi",
"blockquote",
... | 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": 50
}
] | 1 |
python | from functools import partial
import torch
import random
import numpy as np
from ...ops.roiaware_pool3d import roiaware_pool3d_utils
from ...utils import common_utils, box_utils
from . import augmentor_utils, database_sampler
class DataAugmentor(object):
def __init__(self, root_path, augmentor_configs, class_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": 11
},
{
"issue": "Function 'object_size_normalization' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"li... | 4 |
python | import os
from datetime import datetime
from .. import auth, types, utils
class DaemonApiMixin(object):
@utils.minimum_version('1.25')
def df(self):
"""
Get data usage information.
Returns:
(dict): A dictionary representing different resource categories
and th... | Review this code and list any quality issues. | [
{
"issue": "Function 'events' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 24
},
{
"issue": "Function 'login' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 97... | 3 |
python | from typing import Any, Dict, List, Optional, Tuple, Type, Union
import numpy as np
import torch as th
from torch.nn import functional as F
from stable_baselines3.common import logger
from stable_baselines3.common.off_policy_algorithm import OffPolicyAlgorithm
from stable_baselines3.common.type_aliases import GymEnv,... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 60 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 58
},
{
"issue": "Function '__init__' has 25 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 58
... | 4 |
python | from spinnman.messages.scp.abstract_messages.abstract_scp_request\
import AbstractSCPRequest
from spinnman.messages.scp.impl.scp_sdram_alloc_response import \
SCPSDRAMAllocResponse
from spinnman.messages.sdp.sdp_header import SDPHeader
from spinnman.messages.sdp.sdp_flag import SDPFlag
from spinnman.messages.sc... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 17
}
] | 1 |
python | """
FACTOR dataset loader
"""
import os
import logging
import time
import numpy as np
import deepchem
from deepchem.molnet.load_function.kaggle_features import merck_descriptors
logger = logging.getLogger(__name__)
TRAIN_URL = "https://deepchemdata.s3-us-west-1.amazonaws.com/datasets/FACTORS_training_disguised_combi... | Review this code and list any quality issues. | [
{
"issue": "Function 'gen_factors' is 58 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 49
},
{
"issue": "Function 'gen_factors' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 49
}... | 3 |
python | """Test concurrency properties of the implementation."""
from os.path import dirname
from os.path import join
import time
import asyncio
import pytest
import aiofiles.threadpool
@pytest.mark.asyncio
def test_slow_file(monkeypatch, unused_tcp_port):
"""Monkey patch open and file.read(), and assert the loop still w... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_slow_file' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 11
}
] | 1 |
python | from __future__ import annotations
from anytree import NodeMixin
from datetime import datetime, timezone
from dotenv import load_dotenv
from os import environ
from os.path import join, dirname
from typing import Tuple, List, Any, Dict, Optional
import re
import requests
from rich.box import Box
__all__ = [
"get_d... | 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": 213
},
{
"issue": "Function 'populate_tree.edges' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor"... | 2 |
python | #!/usr/bin/env python
""" """
# Script information for the file.
__author__ = "Hendrix Demers (hendrix.demers@mail.mcgill.ca)"
__version__ = ""
__date__ = ""
__copyright__ = "Copyright (c) 2009 Hendrix Demers"
__license__ = ""
# Standard library modules.
import logging
import os.path
# Third party modu... | Review this code and list any quality issues. | [
{
"issue": "Function '_analyzePositions' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 62
},
{
"issue": "Function '_analyzePositions' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severi... | 2 |
python | import os
import io
import numpy as np
from PIL import Image
import torch
from torchvision.transforms import ToTensor
class BAIR (object):
"""Data Handler that loads robot pushing data."""
def __init__(self, data_root, train=True, seq_len=20, image_size=64):
self.root_dir = data_root
if tra... | 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": 14
}
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.