language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | import asyncio
import re
import sys
import traceback
import toga
from toga import Key
from .keys import toga_to_winforms_key
from .libs import Threading, WinForms, shcore, user32, win_version
from .libs.proactor import WinformsProactorEventLoop
from .window import Window
class MainWindow(Window):
def winforms_F... | Review this code and list any quality issues. | [
{
"issue": "Function 'create' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 41
},
{
"issue": "Function 'create' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"lin... | 6 |
python | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2012-11-14 17:09:50
from __future__ import unicode_literals, division, absolute_import
import time
import logging
from collections import deque
try:
f... | Review this code and list any quality issues. | [
{
"issue": "Function '_trim_window' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 141
},
{
"issue": "Function '__getitem__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"se... | 3 |
python | import functools
import random
from math import cos, pi
import cv2
import kornia
import numpy as np
import torch
from kornia.augmentation import ColorJitter
from data.util import read_img
from PIL import Image
from io import BytesIO
# Get a rough visualization of the above distribution. (Y-axis is meaningless, just... | 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": 41
},
{
"issue": "Function 'corrupt_images' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"sev... | 6 |
python | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Review this code and list any quality issues. | [
{
"issue": "Function '_configure' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 53
}
] | 1 |
python | """
Platformer Game
"""
import arcade
# Constants
SCREEN_WIDTH = 1000
SCREEN_HEIGHT = 650
SCREEN_TITLE = "Platformer"
# Constants used to scale our sprites from their original size
CHARACTER_SCALING = 1
TILE_SCALING = 0.5
COIN_SCALING = 0.5
SPRITE_PIXEL_SIZE = 128
GRID_PIXEL_SIZE = SPRITE_PIXEL_SIZE * TILE_SCALING
#... | Review this code and list any quality issues. | [
{
"issue": "Function 'on_key_press' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 132
}
] | 1 |
python | #!/usr/bin/env python
import serial
import sys
import struct
import pprint
import argparse
import code
pp = pprint.PrettyPrinter()
class ConsoleUI:
def opStart(self, name):
sys.stdout.write(name.ljust(40))
def opProgress(self, progress, total=-1):
if (total >= 0):
prstr = "0x%04x... | 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": 126
},
{
"issue": "Function 'main' is 66 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line"... | 2 |
python | """Mypy style test cases for SQLAlchemy stubs and plugin."""
import os
import os.path
import sys
import pytest # type: ignore # no pytest in typeshed
from mypy.test.config import test_temp_dir
from mypy.test.data import DataDrivenTestCase, DataSuite
from mypy.test.helpers import assert_string_arrays_equal
from myp... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_case' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 33
},
{
"issue": "Function 'run_case' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | #!/usr/bin/env python
# Copyright (C) 2017 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 b... | Review this code and list any quality issues. | [
{
"issue": "Function '_main' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 85
},
{
"issue": "Function '_main' is 60 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line"... | 2 |
python | # coding: utf-8
"""
An API to insert and retrieve metadata on cloud artifacts.
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1alpha1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
... | 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": 47
},
{
"issue": "Function 'to_dict' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line":... | 2 |
python | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals, print_function
import re
import os
import tempfile
import six
from .. import environment
from ..console import log
from .. import util
WIN = (os.name == "nt")... | Review this code and list any quality issues. | [
{
"issue": "Function '_setup' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 118
},
{
"issue": "Function '_setup' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"li... | 3 |
python |
from .single_stage import SingleStageDetector
from ..registry import DETECTORS
from mmdet.core import bbox2result
import torch.nn as nn
import torch
from .. import builder
import numpy as np
import cv2
from mmdet.core import bbox2roi, bbox2result, build_assigner, build_sampler
@DETECTORS.register_module
class CSP(Sin... | 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": 15
},
{
"issue": "Function 'show_input_debug' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 15 |
python | # Copyright (C) 2013 eNovance SAS <licensing@enovance.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 applicabl... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_notification_report_interval' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 131
},
{
"issue": "Function 'test_notification_report_interval' is 30 lines long. Functions over 25 lines are harder to... | 2 |
python | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 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": 47
},
{
"issue": "Function '__init__' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | """Support for ICS Calendar."""
import copy
import logging
from datetime import datetime, timedelta
from urllib.error import ContentTooShortError, HTTPError, URLError
from urllib.request import (
HTTPPasswordMgrWithDefaultRealm,
HTTPBasicAuthHandler,
HTTPDigestAuthHandler,
build_opener,
install_open... | Review this code and list any quality issues. | [
{
"issue": "Function '_download_calendar' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 170
}
] | 1 |
python | import logging
import os
from pathlib import Path
from typing import Any, Callable, Optional
from torch.utils.data import Dataset
from torchvision import transforms
from PIL import Image
import cv2
import numpy as np
class URISC(Dataset):
def __init__(
self,
dir: str,
mode: str = 'trai... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 15
}
] | 1 |
python | import os
import subprocess
from unittest import mock
import pytest
from pre_commit.constants import VERSION as PRE_COMMIT_VERSION
import testing.git
from all_repos import autofix_lib
from all_repos import clone
from all_repos import git
from all_repos.config import load_config
@pytest.mark.parametrize(
('cli_r... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_autofix_makes_commits' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 267
}
] | 1 |
python | #
# Copyright 2018 Analytics Zoo 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... | Review this code and list any quality issues. | [
{
"issue": "Function '_build_train' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 42
},
{
"issue": "Function 'fit_eval' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 207
}
... | 2 |
python | from src.layers.LayerHelper import *
from settings import LayerSettings as layerSettings
import tensorflow as tf
import os
CUDA_VISIBLE_DEVICES=0
os.environ["CUDA_VISIBLE_DEVICES"] = "0" # set gpu number
def LSTM(name_, inputTensor_, numberOfOutputs_, isTraining_, dropoutProb_=None):
with tf.name_scope(name_):
cell... | Review this code and list any quality issues. | [
{
"issue": "Function 'LSTM' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 8
},
{
"issue": "Function 'LSTM' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 8
}
] | 2 |
python | #------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describe... | 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": 79
},
{
"issue": "Function 'parse' has cyclomatic complexity 23 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line... | 3 |
python | from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Convolution2D, MaxPooling2D
from keras.layers import Activation, Dropout, Flatten, Dense, Lambda, ELU
from keras.optimizers import Adam
from sklearn.model_selection import train_test_split
from keras.mo... | Review this code and list any quality issues. | [
{
"issue": "Function 'make_parallel' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 20
},
{
"issue": "Function 'train' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"lin... | 2 |
python | """
This module patches a few core functions to add compression capabilities,
since gevent-websocket does not appear to be maintained anymore.
"""
from socket import error
from zlib import (
decompressobj,
MAX_WBITS,
Z_FULL_FLUSH,
)
from geventwebsocket.exceptions import (
ProtocolError,
WebSocketE... | Review this code and list any quality issues. | [
{
"issue": "Function 'read_frame' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 82
},
{
"issue": "Function 'read_frame' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | import sys
class SortableArray():
def __init__(self, arr):
self.arr = arr
def partition(self, left, right):
# choose right most as pivot
pivot_index = right
# get pivot value for compares
pivot = self.arr[pivot_index]
right -= 1
print(f'left orig: {left} right orig: {right}')
while True:
# move... | Review this code and list any quality issues. | [
{
"issue": "Function 'partition' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 7
}
] | 1 |
python | #!/usr/bin/env python
"""
Example script to register two volumes with VoxelMorph models.
Please make sure to use trained models appropriately. Let's say we have a model trained to register
a scan (moving) to an atlas (fixed). To register a scan to the atlas and save the warp field, run:
register.py --moving mov... | Review this code and list any quality issues. | [
{
"issue": "Function 'interpolate' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 131
},
{
"issue": "Function 'save4image' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line... | 3 |
python | # This file is part of the pyMOR project (https://www.pymor.org).
# Copyright 2013-2021 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (https://opensource.org/licenses/BSD-2-Clause)
import numpy as np
from pymor.algorithms.image import estimate_image_hierarchical
from pymor.al... | 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": 62
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 143
},
{
"... | 5 |
python | import logging
import hmac
from hashlib import sha256
import os
import urllib
from datetime import datetime
log = logging.getLogger(__name__)
# This warning is stupid
# pylint: disable=logging-fstring-interpolation
def prepend_bucketname(name):
prefix = os.getenv('BUCKETNAME_PREFIX', "gsfc-ngap-{}-".format(os.g... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_presigned_url' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 24
},
{
"issue": "Function 'get_presigned_url' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"l... | 4 |
python | class optimType:
REACTION_KO = 1
REACTION_UO = 2
GENE_KO = 3
GENE_UO = 4
MEDIUM = 5
MEDIUM_LEVELS = 6
MEDIUM_REACTION_KO = 7
MEDIUM_REACTION_UO = 8
COMPOSITION = 9
PROTEIN_KO = 10
PROTEIN_UO = 11
types = {1:"Reaction Knockouts",2:"Reaction Under/Over expression", 3:"Gene... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_status_str' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 62
}
] | 1 |
python | import json
from datetime import datetime, timedelta
from bittrex.bittrex import Bittrex
def TradingAlorythm(command, market, amount, coinname, step, stoploss, key, secret):
TestTrading = Bittrex(key, secret)
period = timedelta(seconds=20)
next_tick = datetime.now() + period
seconds = 20
firstCycl... | Review this code and list any quality issues. | [
{
"issue": "Function 'TradingAlorythm' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 6
},
{
"issue": "Function 'TradingAlorythm' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity... | 3 |
python | from nltk.util import ngrams
from nltk.corpus import stopwords
from collections import Counter
from .common import get_pp_pipeline
def or_list(booleans):
return True in booleans
def get_ngrams(D):
'''
Returns all ngrams (aka a token containing a dollar sign ($)) from a set of topics or documents
:par... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_dataset_ngrams' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 56
},
{
"issue": "Function 'insert_ngrams_flat' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line"... | 3 |
python | import collections
import copy
import logging
import time
from abc import abstractmethod
from ...scheduler import HyperbandScheduler, RLScheduler, FIFOScheduler
from ...scheduler.seq_scheduler import LocalSequentialScheduler
from ...utils import in_ipynb, try_import_mxnet
from ...utils.utils import setup_compute
__al... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_fit' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 52
},
{
"issue": "Function 'run_fit' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"l... | 9 |
python | """Rule generation utilities."""
load("@org_tensorflow//tensorflow:tensorflow.bzl", "if_not_windows", "tf_binary_additional_srcs", "tf_cc_binary", "tf_copts")
load("//tensorflow_decision_forests/tensorflow:utils.bzl", "rpath_linkopts_to_tensorflow")
def py_wrap_yggdrasil_learners(
name = None,
learner... | Review this code and list any quality issues. | [
{
"issue": "Function 'py_wrap_yggdrasil_learners' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 6
}
] | 1 |
python | """
Input: tsv file in the form
Input Video filename | topic | subtopic | title greek | title english | start time | end time | delete segments
input.mp4 | 1 | 1 | έξοδος | output | 00:10:05 | 00:30:10 | 00:11:15-00:12:30,00:20:35-00:22:10
"""
import os
import subprocess
import sys... | Review this code and list any quality issues. | [
{
"issue": "Function 'manage_timestamps' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 55
}
] | 1 |
python | #!/usr/bin/env python
from threading import Timer,Thread
import RPIO
from RPIO import PWM
import paramiko
import json
import sys
from time import time, sleep
from relaxxapi.relaxxapi import relaxx
r = None
sftp_base_path = "/home/shack/music"
button = 4
loud1 = 21
loud2 = 22
state = 0
def init_state():
state =... | Review this code and list any quality issues. | [
{
"issue": "Function 'btn_trans' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 67
}
] | 1 |
python | import numpy as np
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QComboBox, QDoubleSpinBox, QLabel
from ...layers.utils._color_manager_constants import ColorMode
from ...utils.translations import trans
from ..utils import qt_signals_blocked
from ..widgets.qt_color_swatch import QColorSwatchEdit
from .qt_layer_... | 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": "major",
"line": 45
}
] | 1 |
python | from dash import dcc, html
from dash.dependencies import Input, Output
from app import app
from layouts import index, record, watch, replay, about
# from examples.run import callback_example
from callbacks.record import *
from callbacks.watch import *
from callbacks.replay import *
layout = html.Article([
dcc.Loc... | Review this code and list any quality issues. | [
{
"issue": "Function 'display_page' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 19
}
] | 1 |
python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Analyze CSV file into scores.
Created on Sat Feb 12 22:15:29 2022 // @hk_nien
"""
from pathlib import Path
import os
import re
import sys
import pandas as pd
import numpy as np
PCODES = dict([
# Regio Noord
(1011, 'Amsterdam'),
(1625, 'Hoorn|Zwaag'),
... | Review this code and list any quality issues. | [
{
"issue": "Function '_summary_to_scores' has cyclomatic complexity 17 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 75
},
{
"issue": "Function '_summary_to_scores' is 55 lines long. Functions over 25 lines are harder to test and maintain.",
"... | 5 |
python | # -*- coding: utf-8 -*-
"""Loan Qualifier Application.
This is a command line application to match applicants with qualifying loans.
Example:
$ python app.py
"""
from re import T
import sys
import fire
import questionary
from pathlib import Path
import csv
from qualifier.utils.fileio import (
load_csv,
... | Review this code and list any quality issues. | [
{
"issue": "Function 'find_qualifying_loans' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 68
}
] | 1 |
python | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 06 11:19:04 2012
Program to open a dialog box and get a file, check the file name and send it
along with the serienummer
@author: a001109
Updated: 191010 MHan, Updated for Svea profiles and new CTD.
"""
def checkCtdFileName(ctd=None, confile='.XMLCON'):
import Tkin... | Review this code and list any quality issues. | [
{
"issue": "Function 'checkCtdFileName' has cyclomatic complexity 35 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 12
},
{
"issue": "Function 'checkCtdFileName' is 104 lines long. Functions over 25 lines are harder to test and maintain.",
"sev... | 2 |
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 'create_network' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 123
},
{
"issue": "Function 'create_network' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity... | 9 |
python | from fineract.objects.fineract_object import DataFineractObject
from fineract.objects.types import Type
class Group(DataFineractObject):
"""
This class represents a Group.
"""
def __repr__(self):
return self.get__repr__({'group_id': self.id})
def _init_attributes(self):
self.id = ... | Review this code and list any quality issues. | [
{
"issue": "Function 'create' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 61
}
] | 1 |
python | #!/Users/erol/Code/2.7/bin/python
#Change this before running
import sys, getopt, glob, csv
from math import sqrt
from Bio import Struct
from Bio.Struct.Geometry import center_of_mass
from Bio.PDB import *
import numpy as np
def string_to_float(val):
try:
return float(val)
except ValueError as e:
raise
... | Review this code and list any quality issues. | [
{
"issue": "Function 'compute_atom_contact' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 25
},
{
"issue": "Function 'compute_atom_contact' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
... | 10 |
python | """
Small helpers for code that is not shown in the notebooks
"""
from sklearn import neighbors, datasets, linear_model
import pylab as pl
import numpy as np
from matplotlib.colors import ListedColormap
# Create color maps for 3-class classification problem, as with iris
cmap_light = ListedColormap(['#FFAAAA', '#AAFF... | Review this code and list any quality issues. | [
{
"issue": "Function 'plot_polynomial_regression' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 41
}
] | 1 |
python |
s3gis_tests = load_module("tests.unit_tests.modules.s3.s3gis")
s3gis = s3gis_tests.s3gis
def test_KMLLayer():
current.session.s3.debug = True
current.request.utcnow = datetime.datetime.now()
s3gis_tests.layer_test(
db,
db.gis_layer_kml,
dict(
name = "Test KML",
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_KMLLayer' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 5
},
{
"issue": "Function 'test_KMLCaching_not_possible' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "mi... | 2 |
python | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
def pad_to_shape(this, shp):
"""
Not a very safe function.
"""
return F.pad(this, (0, shp[3] - this.shape[3], 0, shp[2] - this.shape[2]))
class First(nn.Module):
def __init__(self... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 15
},
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 38
},
{
"i... | 5 |
python | # Copyright 2019-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... | Review this code and list any quality issues. | [
{
"issue": "Function 'fixture_build_base_image' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 127
},
{
"issue": "Function 'skip_by_device_type' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"s... | 4 |
python | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn.metrics import roc_curve, auc
__author__ = "Aurélien Massiot"
__credits__ = "https://github.com/octo-technology/bdacore"
__license__ = "Apache 2.0"
def plot_confusion_matrix(confusion_matrix, classes_list, normalize=True, figsize=(1... | Review this code and list any quality issues. | [
{
"issue": "Function 'plot_confusion_matrix' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 12
},
{
"issue": "Function 'plot_confusion_matrix' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor"... | 2 |
python | #!/usr/bin/env python
# encoding: utf-8
import os
import sqlite3 as lite
import sys
import json
import time
import urllib.request
import tweepy
from TwitterMiner_Keys import *
from tweepy import OAuthHandler
from TwitterMiner_settings import *
import hashlib
#from Twitter_validate import validate_image
def dump_hash... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_all_tweets' has cyclomatic complexity 23 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 54
},
{
"issue": "Function 'get_all_tweets' is 187 lines long. Functions over 25 lines are harder to test and maintain.",
"severit... | 2 |
python | from itertools import product
import math
from collections import OrderedDict
from pathlib import Path
import logging
import pandas as pd
import numpy as np
import geopandas as gpd
import shapely.geometry as sg
import googlemaps
# Configure logging
logger = logging.getLogger()
handler = logging.StreamHandler()
forma... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_df' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 42
},
{
"issue": "Function 'to_df' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line"... | 9 |
python | import unittest
import gevent
from gevent import sleep
from gevent.queue import Queue
import mock
from locust import events
from locust.core import Locust, TaskSet, task
from locust.exception import LocustError
from locust.main import parse_options
from locust.rpc import Message
from locust.runners import LocalLocust... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_master_current_response_times' is 44 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 120
},
{
"issue": "Function 'test_exception_is_catched' is 26 lines long. Functions over 25 lines are harder to test and maintain.",... | 2 |
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 '_python_properties_internal' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 38
}
] | 1 |
python | # Copyright 2019 Nokia
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwar... | Review this code and list any quality issues. | [
{
"issue": "Function 'build_input' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 33
}
] | 1 |
python | # coding: utf-8
"""
Mailchimp Marketing API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 3.0.74
Contact: apihelp@mailchimp.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_dict' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 129
}
] | 1 |
python | import pygame
"""
levels.py
Houses all possible levels for the game to choose from.
Selection occurs by invoking the selected level
and by having a return tuple of (pad_sprite, trophies, car[x,y]).
Must still be rendered into the main game.
"""
class PadSprite(pygame.sprite.Sprite):
def __in... | Review this code and list any quality issues. | [
{
"issue": "Function 'level1' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 37
},
{
"issue": "Function 'level2' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 79
},
... | 4 |
python | # -*- coding: utf-8 -*-
import scrapy
import re
from rkpass.items import dzswMorningItem
# 电子商务设计师上午题
class DzswmorningspiderSpider(scrapy.Spider):
name = 'dzswMorningSpider'
allowed_domains = ['www.rkpass.cn']
start_urls = []
paperId_list = ['612', '541', '477', '453', '281', '280', '279', '278', '277... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 20
},
{
"issue": "Function 'parse' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line"... | 2 |
python | #!/usr/bin/env python3
from pyxdc.exceptions import (
ProviderError, BalanceError, APIError, AddressError, InvalidURLError,
ClientError, NotFoundError, UnitError
)
import pytest
def test_exceptions():
with pytest.raises(ProviderError, match="error"):
raise ProviderError("error")
with pytest... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_exceptions' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 11
}
] | 1 |
python | import numpy as np
import scipy.sparse as sp
import torch
def encode_onehot(labels):
classes = set(labels)
classes_dict = {c: np.identity(len(classes))[i, :] for i, c in
enumerate(classes)}
labels_onehot = np.array(list(map(classes_dict.get, labels)),
dtype... | Review this code and list any quality issues. | [
{
"issue": "Function 'load_data' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 15
}
] | 1 |
python | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch
import torch.nn as nn... | Review this code and list any quality issues. | [
{
"issue": "Function 'forward' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 37
},
{
"issue": "Function '__init__' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 65
},
{
... | 4 |
python | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_json_equal' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 58
},
{
"issue": "Function 'test_json_equal_fail_on_length' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity"... | 3 |
python | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2021 Infoblox, Inc.
# Authors: Amit Mishra (@amishra2-infoblox), Vedant Sethia (@vedantsethia)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
try:
... | Review this code and list any quality issues. | [
{
"issue": "Function 'dhcp_options' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 154
}
] | 1 |
python | """Autocorrelation plot of data."""
from ..data import convert_to_dataset
from ..labels import BaseLabeller
from ..sel_utils import xarray_var_iter
from ..rcparams import rcParams
from ..utils import _var_names
from .plot_utils import default_grid, filter_plotters_list, get_plotting_function
def plot_autocorr(
da... | Review this code and list any quality issues. | [
{
"issue": "Function 'plot_autocorr' is 47 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 10
},
{
"issue": "Function 'plot_autocorr' has 14 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"li... | 2 |
python | import dis
import re
import sys
import textwrap
import unittest
from test.support import cpython_only
from test.bytecode_helper import BytecodeTestCase
class TestTranforms(BytecodeTestCase):
def test_unot(self):
# UNARY_NOT POP_JUMP_IF_FALSE --> POP_JUMP_IF_TRUE'
def unot(x):
if not... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_folding_of_binops_on_constants' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 157
},
{
"issue": "Function 'test_elim_jump_after_return1.f' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into ... | 2 |
python | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.distributions as td
class Flow(nn.Module):
"""
Building both normalizing flows and neural flows.
Example:
>>> import stribor as st
>>> torch.manual_seed(123)
>>> dim = 2
>>> flow = st.Flow(st.UnitN... | Review this code and list any quality issues. | [
{
"issue": "Function 'forward' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 28
},
{
"issue": "Function 'inverse' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 55
},
{
"iss... | 3 |
python | import os, sys, urllib.request
from tkinter import *
from tkinter.messagebox import *
__version__ = 3
__filename__ = "ImageRenaming"
__basename__ = os.path.basename(sys.argv[0])
__savepath__ = os.path.join(os.environ['APPDATA'], "QuentiumPrograms")
__iconpath__ = __savepath__ + "/{}.ico".format(__filename__)
try:urll... | Review this code and list any quality issues. | [
{
"issue": "Function 'start_rename' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 40
},
{
"issue": "Function 'start_rename' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "maj... | 2 |
python | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 9 10:51:35 2019
@author: levy.he
"""
import ctypes
from . import vxlapy
def stringify(cobj, indent=2):
s = "%s\n" % type(cobj)
if issubclass(type(cobj), ctypes.Union):
cobj = getattr(cobj, cobj._fields_[0][0])
if issubclass(type(cobj), ctypes.Struct... | Review this code and list any quality issues. | [
{
"issue": "Function 'getChannelMask' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 79
},
{
"issue": "Function 'openPort' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"seve... | 3 |
python | # coding: utf-8
import pprint
import re
import six
class TemplateCddl:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is js... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_dict' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 113
}
] | 1 |
python | import torch
import numpy as np;
from torch.autograd import Variable
def normal_std(x):
return x.std() * np.sqrt((len(x) - 1.)/(len(x)))
class Data_utility(object):
# train and valid is the ratio of training set and validation set. test = 1 - train - valid
def __init__(self, dSet, train, valid, cuda, hor... | 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": 11
},
{
"issue": "Function 'get_batches' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 73
}
] | 2 |
python | import torch
from ptstat.core import RandomVariable, _to_v
class Categorical(RandomVariable):
"""
Categorical over 0,...,N-1 with arbitrary probabilities, 1-dimensional rv, long type.
"""
def __init__(self, p=None, p_min=1E-6, size=None, cuda=False):
super(Categorical, self).__init__()
... | 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": 9
}
] | 1 |
python | import unittest
from localstack.utils.aws import aws_stack
class SSMTest(unittest.TestCase):
def test_describe_parameters(self):
ssm_client = aws_stack.connect_to_service("ssm")
response = ssm_client.describe_parameters()
self.assertIn("Parameters", response)
self.assertIsInstanc... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_get_parameters_and_secrets' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 73
}
] | 1 |
python | import json
import os
import sys
from . import uploader
from . import processing
from . import exif_read
def verify_mapillary_tag(filepath):
filepath_keep_original = processing.processed_images_rootpath(filepath)
if os.path.isfile(filepath_keep_original):
filepath = filepath_keep_original
"""
... | Review this code and list any quality issues. | [
{
"issue": "Function 'upload' has cyclomatic complexity 23 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 20
},
{
"issue": "Function 'upload' is 114 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 3 |
python | #!/usr/local/bin/python
'''
pyAero_geometry
Holds the Python Aerodynamic Analysis Classes (base and inherited).
Copyright (c) 2008 by Dr. Ruben E. Perez
All rights reserved. Not to be used for commercial purposes.
Revision: 1.1 $Date: 21/05/2008 21:00$
Developers:
-----------
- Dr. Ruben E. Perez (RP)
History
--... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 15 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 59
}
] | 1 |
python | # !/usr/local/python/bin/python
# -*- coding: utf-8 -*-
# (C) Wu Dong, 2021
# All rights reserved
# @Author: 'Wu Dong <wudong@eastwu.cn>'
# @Time: '6/29/21 10:49 AM'
# sys
import typing as t
from threading import Lock
from threading import get_ident
# 3p
import sqlalchemy
from sqlalchemy import (
orm,
schema,
)... | 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": 38
},
{
"issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 161
}
] | 2 |
python | # Package: values
# Date: 11th April 2010
# Author: James Mills, prologic at shortcircuit dot net dot au
"""Values
This defines the Value object used by components and events.
"""
from types import ListType
from itertools import imap
from events import Event
class ValueChanged(Event):
"""Value Changed E... | Review this code and list any quality issues. | [
{
"issue": "Function 'setValue.notify' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 115
}
] | 1 |
python | """ Dataframe functions """
import logging
import os
from tempfile import mkstemp
import pandas as pd
from box import Box
# pylint: disable=too-many-arguments
logger = logging.getLogger(__name__) # pylint: disable=C0103
def pd_export(
dataframe: pd.DataFrame,
export_type: str,
df_name: str,
temp_n... | Review this code and list any quality issues. | [
{
"issue": "Function 'pd_export' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 14
},
{
"issue": "Function 'pd_export' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critica... | 3 |
python | # Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from pathlib import Path
from typing import Any, Dict
import torchvision.transforms as pth_transforms
from classy_vision.dataset.transforms im... | Review this code and list any quality issues. | [
{
"issue": "Function '__call__' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 131
}
] | 1 |
python | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 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": 45
},
{
"issue": "Function '__init__' is 71 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical"... | 4 |
python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Letter-color Consistency test
O.Colizoli 2020
Each letter of the alphabet in random order x 2
Color wheel opens at a randomized color on each trial (but does not turn)
Python 2..7
"""
# data saved in ~/LogFiles/sub-XXX
# Import necessary modules
import random
import n... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 32
}
] | 1 |
python | '''
File: detect_forest_change.py
Author: Min Feng
Version: 0.1
Create: 2018-04-20 15:42:37
Description: detect forest changes from foest probility layers and tree cover layers
'''
import logging
def _load_tcc(f_tcc, msk):
from gio import geo_raster_ex as gx
from gio import config
import nump... | Review this code and list any quality issues. | [
{
"issue": "Function '_task' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 31
},
{
"issue": "Function '_task' is 72 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line... | 2 |
python | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 23
},
{
"issue": "Function '__init__' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
... | 2 |
python | # -*- coding: utf-8 -*-
# Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
def delete_disconnected_nodes(gd):
# delete all nodes with no inputs a... | Review this code and list any quality issues. | [
{
"issue": "Function 'delete_disconnected_nodes' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 10
}
] | 1 |
python | import torch
from torch import nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward
from transformers.modeling_bert import (
BERT_INPUTS_DOCSTRING,
BERT_START_DOCSTRING,
BertEmbeddings,
BertLayer,
BertPoole... | Review this code and list any quality issues. | [
{
"issue": "Function 'forward' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 47
},
{
"issue": "Function 'forward' is 45 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"... | 9 |
python | # *** WARNING: this file was generated by the Kulado Kubernetes codegen tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import kulado
import kulado.runtime
import warnings
from ... import tables, version
class ClusterRoleBindingList(kulado.CustomResource):
"""
Clus... | 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": 15
},
{
"issue": "Function '__init__' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 3 |
python | import logging
from .base import ApplicationWrapper
from ..configuration.utils import coerce_config
from ..support.converters import asbool
log = logging.getLogger(__name__)
class IdentityApplicationWrapper(ApplicationWrapper):
"""Provides user identity when authentication is enabled.
The repoze.who provide... | Review this code and list any quality issues. | [
{
"issue": "Function '__call__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 43
}
] | 1 |
python | #!/usr/bin/env python3
# This file is Copyright (c) 2018-2019 Rohit Singh <rohit@rohitksingh.in>
# This file is Copyright (c) 2019 Florent Kermarrec <florent@enjoy-digital.fr>
# License: BSD
import sys
from migen import *
from litex.build.generic_platform import *
from litex.soc.integration.soc_core import *
from l... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 66 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 56
}
] | 1 |
python | """
tulflow.harvest
~~~~~~~~~~~~~~~
This module contains objects to harvest data from one given location to another.
"""
import hashlib
import io
import logging
import pandas
import sickle
from lxml import etree
from sickle import Sickle
from sickle.models import xml_to_dict
from sickle.oaiexceptions import NoRecordsMa... | Review this code and list any quality issues. | [
{
"issue": "Function 'oai_to_s3' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 23
},
{
"issue": "Function 'oai_to_s3' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 7 |
python | # Copyright 2013 Cloudbase Solutions Srl
# 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 r... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_cached_image.fetch_image_if_not_existing' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 97
}
] | 1 |
python | """
_WorkQueueTestCase_
Unit tests for the WMBS File class.
"""
from __future__ import print_function
import time
import unittest
from WMCore.Agent.HeartbeatAPI import HeartbeatAPI
from WMQuality.TestInit import TestInit
class HeartbeatTest(unittest.TestCase):
def setUp(self):
"""
_setUp_
... | Review this code and list any quality issues. | [
{
"issue": "Function 'testAddComponent' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 40
},
{
"issue": "Function 'testAddComponent' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severit... | 4 |
python | from core.plugins.openstack import (
OpenstackChecksBase,
)
FEATURES = {'neutron': {'main': [
'availability_zone'],
'openvswitch-agent': [
'l2_population',
'firewall_driver'],
'l3-age... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_service_features' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 41
}
] | 1 |
python | import io
import os
import re
import struct
from xml.etree import ElementTree
_UNIT_KM = -3
_UNIT_100M = -2
_UNIT_10M = -1
_UNIT_1M = 0
_UNIT_10CM = 1
_UNIT_CM = 2
_UNIT_MM = 3
_UNIT_0_1MM = 4
_UNIT_0_01MM = 5
_UNIT_UM = 6
_UNIT_INCH = 6
_TIFF_TYPE_SIZES = {
1: 1,
2: 1,
3: 2,
4: 4,
5: 8,
6: 1,
7: 1,
8... | Review this code and list any quality issues. | [
{
"issue": "Function '_convertToDPI' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 35
},
{
"issue": "Function '_convertToPx' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"... | 6 |
python | # Copyright 2017 The TensorFlow Authors and modified by Emilien Garreau. 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.... | Review this code and list any quality issues. | [
{
"issue": "Function 'batch_sample_balanced_positive_negative' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 108
}
] | 1 |
python | # Copyright 2011 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 req... | 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": 50
},
{
"issue": "Function 'execute' has cyclomatic complexity 20 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"li... | 5 |
python | """
Calls the Turbomole executable.
"""
import os
import re
from decimal import Decimal
from pathlib import Path
from typing import Any, Dict, Optional, Tuple
from qcelemental.models import AtomicResult, Provenance, BasisSet
from qcelemental.util import safe_version, which
from ...exceptions import InputError
from ..... | Review this code and list any quality issues. | [
{
"issue": "Function 'sub_control' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 75
},
{
"issue": "Function 'build_input' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
... | 4 |
python | """Implementations of metrics for 3D semantic segmentation."""
import tensorflow as tf
def average_volume_difference():
raise NotImplementedError()
def dice(y_true, y_pred, axis=(1, 2, 3, 4)):
"""Calculate Dice similarity between labels and predictions.
Dice similarity is in [0, 1], where 1 is perfect... | Review this code and list any quality issues. | [
{
"issue": "Function 'dice' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 10
},
{
"issue": "Function 'generalized_dice' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 46
},
{
... | 5 |
python | import numpy as np
from sklearn import metrics
import math
from keras.preprocessing import sequence
from keras.preprocessing.text import Tokenizer
from typing import *
# fastai utility
def listify(o):
if o is None: return []
if isinstance(o, list): return o
if isinstance(o, str): return [o]
if isinstan... | 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
}
] | 1 |
python | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# 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_logger' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 24
}
] | 1 |
python | #!/usr/bin/env python3
from parse_topology_for_hydrogens import parse_top_for_h
def gen_h_ndx(orig_ndx, topology, out_name='h_prot.ndx'):
ndx_ind = list()
with open(orig_ndx, 'r') as f:
line = f.readline()
while '[ Protein ]' not in line:
line = f.readline()
line = f.readl... | Review this code and list any quality issues. | [
{
"issue": "Function 'gen_h_ndx' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 5
}
] | 1 |
python | import json
import platform
import requests
import six
import sys
from .version import __version__
class SlackRequest(object):
def __init__(
self,
proxies=None
):
# HTTP configs
self.custom_user_agent = None
self.proxies = proxies
# Construct the user-... | Review this code and list any quality issues. | [
{
"issue": "Function 'do' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 48
},
{
"issue": "Function 'do' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 48
},
... | 3 |
python | #
# Copyright (c) 2020 Project CHIP Authors
# Copyright (c) 2020 Google LLC.
# 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.apa... | 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": 97
},
{
"issue": "Function '__init__' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line"... | 5 |
python | import gym
import keras as k
from keras.models import Sequential
from keras.layers import Conv2D, Activation, MaxPooling2D, Flatten, Dense, Dropout
from keras.optimizers import Adam
import numpy as np
from datetime import datetime
from matplotlib import pyplot as PLT
import time
import csv
import os
# You can adjust t... | Review this code and list any quality issues. | [
{
"issue": "Function 'playGame' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 93
},
{
"issue": "Function 'applyPolicyVectorToNN' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"... | 2 |
python | import os
import tensorflow as tf
import numpy as np
import pandas as pd
from sklearn.utils import check_random_state
from skbio.stats.composition import clr_inv as softmax
from biom import Table
from patsy import dmatrix
def random_multinomial_model(num_samples, num_features,
reps=1,
... | Review this code and list any quality issues. | [
{
"issue": "Function 'random_multinomial_model' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 11
},
{
"issue": "Function 'random_multinomial_model' is 30 lines long. Functions over 25 lines are harder to test and mainta... | 5 |
python | import sys
import math
import os
import torch
import torchvision
import numpy as np
from pkg_resources import resource_stream
def interpolate1d(x, values, tangents):
'''
Returns:
Returns the interpolated or extrapolated values for each query point,
depending on whether or not the query lies w... | Review this code and list any quality issues. | [
{
"issue": "Function 'interpolate1d' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 11
}
] | 1 |
python | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Review this code and list any quality issues. | [
{
"issue": "Function '_get_default_config_int8' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 33
},
{
"issue": "Function '_is_int8_hw_support' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"... | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.