language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | import ast
import inspect
import json
import logging
import os
import sys
import tempfile
from functools import wraps
from collections import deque
from execution_trace.constants import RECORD_FN_NAME, RETVAL_NAME, MANGLED_FN_NAME
from execution_trace.utils import strip_indent
# Init logging.
logging.basicConfig()
lo... | Review this code and list any quality issues. | [
{
"issue": "Function 'record._record' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 48
},
{
"issue": "Function '_fill_body_with_record' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"sev... | 3 |
python | from __future__ import absolute_import
import datetime
import os
from socket import error as SocketError, timeout as SocketTimeout
import socket
import sys
import warnings
from .exceptions import (
NewConnectionError,
ConnectTimeoutError,
SubjectAltNameWarning,
SystemTimeWarning,
)
from .packages impo... | 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": 172
},
{
"issue": "Function 'set_cert' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
... | 5 |
python | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import shutil
import subprocess
from pre_wigs_validation.enums import ValidationEnforcement, ValidationResult
from pre_wigs_validation.instance import ValidationInstance
from pre_wigs_validation.dataclasses impo... | Review this code and list any quality issues. | [
{
"issue": "Function 'validate' is 53 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 19
}
] | 1 |
python | from numpy.random import RandomState
from typing import Any, Optional, List
from numpy import arange
from copy import deepcopy
from pydeeprecsys.rl.neural_networks.dueling import DuelingDDQN
from pydeeprecsys.rl.experience_replay.priority_replay_buffer import (
PrioritizedExperienceReplayBuffer,
)
from pydeeprecsys... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 45 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 24
},
{
"issue": "Function '__init__' has 15 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 24
... | 3 |
python |
import os
import hashlib
from constants import TEX_DIR
from constants import TEX_TEXT_TO_REPLACE
from constants import TEX_USE_CTEX
from constants import TEX_FIX_SVG
def tex_hash(expression, template_tex_file_body):
id_str = str(expression + template_tex_file_body)
hasher = hashlib.sha256()
hasher.updat... | Review this code and list any quality issues. | [
{
"issue": "Function 'tex_to_dvi' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 48
},
{
"issue": "Function 'tex_to_dvi' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 3 |
python | ##############################################################################
# Copyright (c) 2015 Orange
# guyrodrigue.koffi@orange.com / koffirodrigue@gmail.com
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompani... | 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": 40
}
] | 1 |
python | """Random walk routines
"""
from .._ffi.function import _init_api
from .. import backend as F
from ..base import DGLError
from .. import ndarray as nd
from .. import utils
__all__ = [
'random_walk',
'pack_traces']
def random_walk(g, nodes, *, metapath=None, length=None, prob=None, restart_prob=None):
"""... | Review this code and list any quality issues. | [
{
"issue": "Function 'random_walk' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 14
},
{
"issue": "Function 'random_walk' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major... | 3 |
python | import vdomr as vd
import spikeforest as sf
from cairio import client as ca
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
class AccuracyPlot(vd.components.Pyplot):
def __init__(self, snrs, accuracies):
vd.components.Pyplot.__init__(self)
self._snrs = snrs
self... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 54
},
{
"issue": "Function '_get_accuracy_table_data' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 5 |
python | import time
from collections import deque
from datetime import datetime
import backtrader as bt
from backtrader.feed import DataBase
from backtrader.utils.py3 import with_metaclass
from .cryptostore import CryptoStore
class MetaCryptoFeed(DataBase.__class__):
def __init__(cls, name, bases, dct):
'''Clas... | Review this code and list any quality issues. | [
{
"issue": "Function '_load' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 79
},
{
"issue": "Function '_load' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line... | 6 |
python | '''
This file defines the testing module. This needs the following:
1. The system under test
2. The specification or the function which we are trying to minimize
3. Domains of the uncertainities
'''
from .optimizers import *
from .func_tree import *
from .utils import *
from sklearn.decomposition import KernelPCA
imp... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 19 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 17
},
{
"issue": "Function '__init__' is 69 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical... | 7 |
python | # coding: utf-8
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
from __future__ import print_function
import xml.dom.mi... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 43
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 43
},
{
... | 5 |
python | """Utilities for setting up a project's settings.
The default way to use this is to import and call :func:`init_settings`
in a project's settings module:
# project/top_level_package/settings.py
from arcutils.settings import init_settings
init_settings()
This adds a few default settings for bootstrapping ... | Review this code and list any quality issues. | [
{
"issue": "Function 'init_settings' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 52
},
{
"issue": "Function 'init_settings' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "m... | 4 |
python | # Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... | Review this code and list any quality issues. | [
{
"issue": "Function 'GETorHEAD' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 39
}
] | 1 |
python | #
# Copyright (c) 2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | Review this code and list any quality issues. | [
{
"issue": "Function 'learn_from_batch' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 102
},
{
"issue": "Function 'learn_from_batch' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severit... | 2 |
python | import pytest
@pytest.mark.usefixtures("smart_setup")
class TestObjectValue:
def test_get_sheet_object_value(self, smart_setup):
smart = smart_setup['smart']
sheet = smart.Sheets.get_sheet(smart_setup['sheet'].id, include='objectValue')
assert isinstance(sheet.rows[0].cells[0].object_valu... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_predecessors' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 13
},
{
"issue": "Function 'test_predecessors' is 91 lines long. Functions over 25 lines are harder to test and maintain.",
"sever... | 2 |
python | import bagel
import numpy as np
from sklearn.metrics import precision_recall_curve
from typing import Sequence, Tuple, Dict, Optional
def _adjust_scores(labels: np.ndarray,
scores: np.ndarray,
delay: Optional[int] = None,
inplace: bool = False) -> np.ndarray:
... | Review this code and list any quality issues. | [
{
"issue": "Function '_adjust_scores' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 8
},
{
"issue": "Function 'get_test_results' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor... | 2 |
python | """
This is a library for defining and using particle filters.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, yt Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with... | 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": 33
}
] | 1 |
python | """payu.cli
========
Command line interface tools
:copyright: Copyright 2011 Marshall Ward, see AUTHORS for details.
:license: Apache License, Version 2.0, see LICENSE for details
"""
import argparse
from distutils import sysconfig
import importlib
import os
import pkgutil
import shlex
import subprocess
... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 28
},
{
"issue": "Function 'set_env_vars' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity"... | 6 |
python | # coding: utf-8
__author__ = 'cleardusk'
import os.path as osp
import time
import numpy as np
import cv2
import torch
from torchvision.transforms import Compose
import torch.backends.cudnn as cudnn
import _3DDFA_V2.models as models
from _3DDFA_V2.bfm import BFMModel
from _3DDFA_V2.utils.io import _load
from _3DDFA_V... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 30
},
{
"issue": "Function '__call__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
... | 3 |
python | import sys
def sol():
input = sys.stdin.readline
N = int(input())
node = [[] for i in range(N)]
for i in range(N):
vector = list(map(int, input().split(" ")))
for j in range(N):
if vector[j] == 1:
node[i].append(j)
for i in range(N):
visited = ["... | Review this code and list any quality issues. | [
{
"issue": "Function 'sol' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 4
},
{
"issue": "Function 'bfs' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
... | 2 |
python | import DBinterface as DB
import random
import datetime as dt
def print_ranking(my_ranking,ranking_size,top_or_bottom):
Tweet=""
if top_or_bottom == True:
Tweet += ("The first " + ranking_size + " cities with more CO2 emissions due to traffic are: \r\n ")
else:
Tweet += ("The first " ... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_city' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 44
}
] | 1 |
python | import logging
from typing import Any, Dict, List, Union
import bleach
import cssutils
import markdown
from django.conf import settings
from django.core.mail import EmailMultiAlternatives, get_connection
from django.template.loader import get_template
from django.utils.translation import ugettext as _
from i18nfield.s... | Review this code and list any quality issues. | [
{
"issue": "Function 'mail' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 34
},
{
"issue": "Function 'mail' is 65 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"... | 4 |
python | # 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 agreed to in... | Review this code and list any quality issues. | [
{
"issue": "Function 'can_be_trunked_or_untrunked' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 113
},
{
"issue": "Function '_prepare_subports' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller... | 5 |
python | import os
import re
import subprocess
import logging
"""
Uses command line pdfinfo utility (from poppler pakage) for various
small operations (e.g. get pdf page count).
"""
logger = logging.getLogger(__name__)
def get_pagecount(filepath):
"""
Returns the number of pages in a PDF document as integer.
fi... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_pagecount' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 14
},
{
"issue": "Function 'get_pagecount' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "m... | 2 |
python | """
Collection of functions to assist PyDoof modules.
"""
from collections import Iterable
from datetime import date
from enum import Enum
def parse_query_params(params):
"""
Parses a query-parameters dictionary into their proper parameters schema.
Each key value of the dictionary represents a parameter ... | Review this code and list any quality issues. | [
{
"issue": "Function '_parse_param' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 31
}
] | 1 |
python | # coding: utf-8
"""
ESPER API REFERENCE
OpenAPI spec version: 1.0.0
Contact: developer@esper.io
---------------------------------------------------------
Copyright 2019 Shoonya Enterprises Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the Li... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 62
},
{
"issue": "Function 'to_dict' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line":... | 2 |
python | import os
import cv2
import imutils
import numpy as np
from imutils import contours
from imutils import perspective
from scipy.spatial import distance as dist
def detect_shape(filepath, min_width=15, debug=False):
image = cv2.imread(filepath, 0)
resized = imutils.resize(image, width=300)
ratio = image.sh... | Review this code and list any quality issues. | [
{
"issue": "Function 'detect_shape' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 10
},
{
"issue": "Function 'detect_shape' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "mino... | 4 |
python | import tensorflow as tf
#from tensorflow.python.ops.rnn_cell import *
#from tensorflow.python.ops.rnn_cell_impl import _Linear
from tensorflow.contrib.rnn.python.ops.core_rnn_cell import *
#from tensorflow import keras
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import init_ops
from tensorflo... | Review this code and list any quality issues. | [
{
"issue": "Function 'din_attention' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 12
},
{
"issue": "Function 'din_attention' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": ... | 12 |
python | #!/usr/bin/env python3
import argparse
import boutvecma
import easyvvuq as uq
import chaospy
import os
import numpy as np
import time
import matplotlib.pyplot as plt
CAMPAIGN_NAME = "Conduction."
def refine_sampling_plan(campaign, analysis, number_of_refinements):
"""
Refine the sampling plan.
Paramet... | Review this code and list any quality issues. | [
{
"issue": "Function 'first_time_setup' is 55 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 84
},
{
"issue": "Function 'refine_once' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"li... | 2 |
python | import os
from collections import OrderedDict
import matplotlib.pyplot as plt
import pandas
_ramachandran_densities = pandas.read_csv(
'data/rama500-general.data',
skiprows=6,
delimiter=' ',
names=['phi', 'psi', 'value']
)
"""
DSSP output:
H = α-helix
B = residue in isolated β-bridge
E =... | Review this code and list any quality issues. | [
{
"issue": "Function 'ramachandran' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 68
},
{
"issue": "Function 'ramachandran' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "mino... | 3 |
python |
# Execution time : 0.003847 seconds
# Solution Explanation
# A simple brute-froce approach is enough
import time
width = 40
from functools import reduce
def solution():
v = list()
v.append([0]*23)
v.append([0]*23)
v.append([0]*23)
for line in open('input_p011.in','r'):
v.append(list(map... | Review this code and list any quality issues. | [
{
"issue": "Function 'solution' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 12
}
] | 1 |
python | import requests
import zipfile
import io
import json
import os
import traceback
GITLAB_TOKEN=""
token_header = {'PRIVATE-TOKEN': GITLAB_TOKEN}
GROUP = 'zoe-apps'
ZAPP_STORE_PATH = '/mnt/cephfs/zoe-apps/'
def get_projects(group):
prj_list = []
r = requests.get("http://gitlab.eurecom.fr/api/v4/groups/{}/projec... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 35
},
{
"issue": "Function 'main' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 2 |
python | import os
import cv2
import time
import argparse
import numpy as np
from mtcnn import detect_face
import tensorflow as tf
from PIL import Image, ImageDraw
## MTCNN face localizer
def mtcnn_localize_faces(image, pnet, rnet, onet, minsize=20, threshold=[0.7, 0.8, 0.85], factor=0.75):
"""
Localize faces & its lan... | Review this code and list any quality issues. | [
{
"issue": "Function 'mtcnn_localize_faces' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 11
},
{
"issue": "Function 'mtcnn_localize_faces' has 7 parameters. Consider using a parameter object to reduce arity.",
"severi... | 4 |
python | """Encoder
Description:
This module encodes Planning Problem to Propositional Formulas in CNF
(Conjunctive Normal Form)
License:
Copyright 2021 Debby Nirwan
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may... | Review this code and list any quality issues. | [
{
"issue": "Function '_encode' has cyclomatic complexity 23 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 94
},
{
"issue": "Function '_encode' is 83 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",... | 2 |
python | #!/usr/bin/env python
"""
This is the unittest for gridcellarea module.
python -m unittest -v tests/test_gridcellarea.py
python -m pytest --cov=pyjams --cov-report term-missing -v tests/test_gridcellarea.py
"""
import unittest
def _flatten(itr):
import numpy as np
fitr = np.array(itr).flatten()
if len(f... | Review this code and list any quality issues. | [
{
"issue": "Function '_flatten' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 12
},
{
"issue": "Function 'test_gridcellarea' is 54 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "maj... | 2 |
python | # This file is to get a rough estimation of how much you need to pay or how many months you need to pay for a loan
import pandas as pd
import numpy as np
from IPython.display import display
def group(number):
"""show money in laks and crores (indian way of presenting money)"""
s = '%d' % number
groups = [... | Review this code and list any quality issues. | [
{
"issue": "Function 'num_months_emi_diminishing' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 43
}
] | 1 |
python | """ Script to fetch supplemental informations about all the samples that are linked with the geo series of interest"""
import numpy as n
import pandas as pd
import pickle
import os
import sys
import re
from urllib.request import urlopen
from urllib.error import HTTPError, URLError
import time
try:
from urllib.error... | Review this code and list any quality issues. | [
{
"issue": "Function '__parse_lines' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 144
},
{
"issue": "Function '__parse_lines' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "... | 3 |
python | from collections import namedtuple
Item = namedtuple('Item', ['item', 'at'])
ObsItem = namedtuple('ObsItem', ['at'])
Link = namedtuple('Link', ['from_x', 'from_y', 'to_x', 'to_y'])
class Observable(object):
def __init__(self, start, is_child=False):
self.label = None
self.start = start
se... | Review this code and list any quality issues. | [
{
"issue": "Function '_compute_higher_order_links.nearest_links' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 61
},
{
"issue": "Function '_compute_higher_order_links' has cyclomatic complexity 7 (threshold: 5). Consider b... | 3 |
python | # RUN WITH /usr/bin/python3 minet.py (python 3.6)
import sys
import numpy as np
from sklearn.metrics import roc_curve, auc
import pandas as pd
def compute_aggregated_matrix(matrixfiles_num, matrixfiles, savematrixfile, saveresultfile, coeffs=[1, 1, 1, 1]):
# matrixfiles_num = int(sys.argv[1])
# matrixfiles =... | Review this code and list any quality issues. | [
{
"issue": "Function 'compute_aggregated_matrix' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 9
},
{
"issue": "Function 'compute_aggregated_matrix' has 5 parameters. Consider using a parameter object to reduce arity.",
... | 2 |
python | import logging
import json
from typing import List, Type, Union
from keras.models import Model
from keras.layers.merge import Concatenate
from keras.layers import (
Dense, LSTM, Bidirectional, Embedding, Input, Dropout,
TimeDistributed
)
import delft.sequenceLabelling.wrapper
from delft.utilities.layers impor... | 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": 24
},
{
"issue": "Function '__init__' is 81 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 57
},
... | 3 |
python | import dateparser
from gazette.items import Gazette
from gazette.spiders.base import BaseGazetteSpider
class MgContagemSpider(BaseGazetteSpider):
TERRITORY_ID = "3118601"
name = "mg_contagem"
allowed_domains = ["contagem.mg.gov.br"]
start_urls = ["http://www.contagem.mg.gov.br/?se=doc"]
def parse... | 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": 12
},
{
"issue": "Function 'parse' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line"... | 2 |
python | """Source code for distributed attentional actor architecture (DA3) model.
Author: Yoshinari Motokawa <yoshinari.moto@fuji.waseda.jp>
"""
from typing import List
import torch
from core.utils.logging import initialize_logging
from omegaconf import DictConfig
from torch import nn
from ..hard_shrink_attention import Ha... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 19
}
] | 1 |
python | import logging
import shelve
from ftplib import FTP
import requests
import requests_cache
from io import BytesIO
_cache_file_path = None
def set_cache_http(cache_file_path):
requests_cache.install_cache(cache_file_path)
def open_url(url):
return requests.get(url).text
def set_cache_ftp(cache_file_path):... | Review this code and list any quality issues. | [
{
"issue": "Function 'download_ftp' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 35
}
] | 1 |
python | """Defines basic light string data and functions."""
import os
import sys
import atexit
import inspect
import time
import logging
from typing import Any, Optional, Sequence, Union, overload
from nptyping import NDArray
import numpy as np
from LightBerries.LightBerryExceptions import LightStringException
from LightBerri... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 21
},
{
"issue": "Function '__init__' is 64 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical... | 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
# distributed un... | Review this code and list any quality issues. | [
{
"issue": "Function 'from_array' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 67
}
] | 1 |
python | # Copyright 2020 The PEGASUS Authors..
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | Review this code and list any quality issues. | [
{
"issue": "Function 'transformer_params' is 70 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 28
}
] | 1 |
python | """
This test module will only run on a POSIX system. Windows support *may* be added at some point in the future.
"""
# Global imports
import json, operator, os, signal, sys
from argparse import ArgumentParser
from datetime import datetime
from pathlib import Path
from time import sleep
from time import time
# local ... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 19
},
{
"issue": "Function 'main' is 51 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": ... | 2 |
python | """
Generates a cluster using a plummer model with a salpeter Initial Mass Function.
Compares the generated IMF against the expected line.
"""
import numpy
from matplotlib import pyplot
from amuse.units import units
from amuse.units import nbody_system
from amuse.ic.plummer import new_plummer_model
from amuse.ic.salp... | Review this code and list any quality issues. | [
{
"issue": "Function 'plot_particles_and_mass_distribution' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 26
}
] | 1 |
python | import numpy as np
from torch import Tensor, FloatTensor
from kospeech.data.audio.core import load_audio
from kospeech.data.audio.augment import NoiseInjector, SpecAugment
from kospeech.data.audio.feature import MelSpectrogram, MFCC, Spectrogram, FilterBank
class AudioParser(object):
"""
Provides inteface of ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 19
},
{
"issue": "Function '__init__' has 21 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 57
},
{
... | 3 |
python | # -*- coding: utf-8 -*-
import unittest
from tennis import TennisGame1
test_cases = [
(0, 0, "Love-All", '0-0', 'player1', 'player2'),
(1, 1, "Fifteen-All", '0-0', 'player1', 'player2'),
(2, 2, "Thirty-All", '0-0', 'player1', 'player2'),
(3, 3, "Deuce", '0-0', 'player1', 'player2'),
(4, 4, "Deuce... | Review this code and list any quality issues. | [
{
"issue": "Function 'play_game' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 56
}
] | 1 |
python | from argparse import ArgumentParser
from api import State, util, engine
import random, csv, os
from rich import print
def run_tournament(options):
'''
NOTES FOR THE CSV FILENAME
the first bot is the tracked one, the other is the opponent
for example in T_Dataset_ml-rdeep.csv
ml is the tracked playe... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_tournament' has cyclomatic complexity 27 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 6
},
{
"issue": "Function 'run_tournament' is 67 lines long. Functions over 25 lines are harder to test and maintain.",
"severity"... | 2 |
python | #! /usr/bin/python3
# Author: Maximilian Muth <mail@maxi-muth.de>
# https://github.com/mammuth/bing-wallpaper
# Version: 1.0
# License: GPL-2.0
# Description: Downloads the Bing picture of the Day and sets it as wallpaper (Linux / Windows).
import datetime
from urllib.request import urlopen, urlretrieve
from xml.dom i... | Review this code and list any quality issues. | [
{
"issue": "Function 'download_wallpaper' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 56
},
{
"issue": "Function 'download_wallpaper' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"seve... | 2 |
python | #
# This file contains the Python code from Program 16.10 of
# "Data Structures and Algorithms
# with Object-Oriented Design Patterns in Python"
# by Bruno R. Preiss.
#
# Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved.
#
# http://www.brpreiss.com/books/opus7/programs/pgm16_10.txt
#
class Graph(Conta... | Review this code and list any quality issues. | [
{
"issue": "Function 'breadthFirstTraversal' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 13
}
] | 1 |
python | from collections import defaultdict
import json
import mmap
import operator
import os
import socket
from struct import Struct
MMDB_META_DATA_START = '\xAB\xCD\xEFMaxMind.com'
MMDB_META_DATA_BLOCK_MAX_SIZE = 131072
MMDB_DATA_SECTION_SEPARATOR = 16
unpack_int = Struct('>I').unpack
unpack_long = Struct('>Q').unpack
unpa... | Review this code and list any quality issues. | [
{
"issue": "Function 'lookup' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 119
},
{
"issue": "Function 'find_start_node' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"seve... | 3 |
python | # -*- coding: UTF-8 -*-
#! /usr/bin/python
# To change this template, choose Tools | Templates
# and open the template in the editor.
__author__="ARA"
__all__ = ['norm']
__date__ ="$Feb 14, 2012 11:40:06 AM$"
from . import common_obj as _com
from . import constants as _cst
import numpy as _np
from .pigasusObject imp... | 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": "major",
"line": 17
},
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 17
},
{
... | 6 |
python | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class OctConv(nn.Module):
def __init__(self, ch_in, ch_out, kernel_size, stride=1, alphas=(0.5, 0.5)):
super(OctConv, self).__init__()
self.alpha_in, self.alpha_out = alphas
assert 0 <= self.alpha_in <= 1... | 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": 8
},
{
"issue": "Function 'forward' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line":... | 3 |
python | #!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import re
import unittest
from tvcm import parse_html_deps
from tvcm import module as module_module
from tvcm import html_generati... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_parse_script_src' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 31
}
] | 1 |
python | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
target = '1kB'
radeg = np.pi/180
def cart_to_pol(x,y):
r = np.sqrt(x**2 + y**2)
phi = np.arctan2(y,x)
return r, phi
def pol_to_cart(r,phi):
x = r*np.cos(... | Review this code and list any quality issues. | [
{
"issue": "Function 'r_pol' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 58
}
] | 1 |
python | import os
import re
import sys
import time
from subprocess import PIPE, run
from types import ModuleType
from typing import Union
import docker
import requests
import storm.__main__ as storm
from lazycluster import Runtime, RuntimeGroup, RuntimeManager, RuntimeTask
from .config import RUNTIME_DOCKER_IMAGE, RUNTIME_N... | Review this code and list any quality issues. | [
{
"issue": "Function '_setup_ssh_connection_to_runtime' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 138
},
{
"issue": "Function '_wait_until_started' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functi... | 2 |
python | # -*- coding: utf-8 -*-
# Copyright (c) 2019 by University of Kassel, Tu Dortmund, RWTH Aachen University and Fraunhofer
# Institute for Energy Economics and Energy System Technology (IEE) Kassel and individual
# contributors (see AUTHORS file for details). All rights reserved.
import numpy as np
from pandas import S... | Review this code and list any quality issues. | [
{
"issue": "Function 'convert_voltlvl_to_int' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 14
},
{
"issue": "Function 'convert_voltlvl_names' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller f... | 6 |
python | """Example systems created in Python
"""
import numpy as np
from pysim.cythonsystem import Sys
class VanDerPol(Sys):
"""Simple example of a class representing a VanDerPol oscillator.
"""
def __init__(self):
self.add_state_scalar("x", "dx")
self.add_state_scalar("y", "dy")
self.add_... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 63
}
] | 1 |
python | from enum import Enum
from typing import Any
from importlib import import_module
class ValidationError(Exception):
"""
Error class for validation failed
"""
def __init__(self, payload: dict):
"""
:param message: error message
"""
self.payload = payload
def generate... | Review this code and list any quality issues. | [
{
"issue": "Function '_import_parser' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 65
},
{
"issue": "Function 'get' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity"... | 2 |
python | from engine.utils import RF_sq64, sq64_to_sq120, print_board
def react_chess_board_to_IZII_board(board):
if board is None:
exit()
izii_board = ["x"] * 120
pieces = board.split(',')
for i in range(len(izii_board)):
if i >= 20 and i < 100:
if i % 10 != 0 and i % 10 != 9:
... | Review this code and list any quality issues. | [
{
"issue": "Function 'react_chess_board_to_IZII_board' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 4
}
] | 1 |
python | import numpy as np
import pandas as pd
import pytest
import ibis
import ibis.expr.datatypes as dt
from ibis.backends.pandas.udf import udf
def make_t():
return ibis.table(
[
('_timestamp', 'int32'),
('dim1', 'int32'),
('dim2', 'int32'),
('valid_seconds', 'i... | Review this code and list any quality issues. | [
{
"issue": "Function 'make_base' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 34
},
{
"issue": "Function 'make_large_expr' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line"... | 4 |
python | from time import sleep
from urllib.request import urlopen, Request
from bs4 import BeautifulSoup
from celery.schedules import crontab
from celery.task import periodic_task
from crypto.models import Cryptocurrency
# @shared_task
@periodic_task(
run_every=(crontab(minute="*/15")),
name="create_cryptocurrency"... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_cryptocurrency' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 17
},
{
"issue": "Function 'update_cryptocurrency' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "... | 2 |
python | import re
import pickle
import tempfile
import pytest
from _pytest.config import Config
from _pytest._io.terminalwriter import TerminalWriter
from _pytest.reports import TestReport
from pytest_fold.tui_pytermtk import main as tuitk
from pytest_fold.tui_textual1 import main as tuitxt1
from pytest_fold.tui_textual2 impo... | Review this code and list any quality issues. | [
{
"issue": "Function 'pytest_configure.tee_write' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 90
},
{
"issue": "Function 'pytest_configure.tee_write' is 46 lines long. Functions over 25 lines are harder to test and main... | 3 |
python | import argparse
import os
import sys
import time
import numpy as np
from ConfigSpace.configuration_space import ConfigurationSpace
from ConfigSpace.hyperparameters import UniformFloatHyperparameter, \
UniformIntegerHyperparameter, CategoricalHyperparameter, \
UnParametrizedHyperparameter, Constant
from sklearn... | 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": 31
},
{
"issue": "Function 'fit' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 48
}
] | 2 |
python | # -*- coding: utf-8 -*-
# Copyright 2013-2017 Ent. Services Development Corporation LP
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyrigh... | 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": 105
},
{
"issue": "Function '__init__' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 3 |
python | """
UnitTests of the python interface to the neuron class.
Items declared in neuron/__init__.py
$Id$
"""
import unittest
import neuron
from neuron import h
class NeuronTestCase(unittest.TestCase):
"""Tests of neuron"""
def testHClass(self):
"""Test subclass of hoc class."""
from ._subclass... | Review this code and list any quality issues. | [
{
"issue": "Function 'testABI' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 55
},
{
"issue": "Function 'testIterators' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severi... | 5 |
python | #!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test BIP66 (DER SIG).
Test that the DERSIG soft-fork activates at (regtest) height 1251.
"""
from tes... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_test' is 66 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 57
}
] | 1 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
import math
import numpy as np
FIELD_SCORE_NUM_OFFSET=6
class Waypoints:
def __init__(self, path, side):
self.points = []
self.number = 0
self.Waypoints_Lap = 0
self.next_target_idx = -1
self.all_field_score = np.on... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_next_waypoint' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 35
}
] | 1 |
python | # coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | Review this code and list any quality issues. | [
{
"issue": "Function '__call__' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 81
},
{
"issue": "Function '__call__' is 58 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical"... | 3 |
python | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 19 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 36
},
{
"issue": "Function '__init__' is 51 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical... | 10 |
python | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the isValid function below.
def isValid(s):
ss = list(set(s))
fs = []
for c in ss:
fs.append(s.count(c))
if (len(list(set(fs))))==1:
return 'YES'
elif len(list(set(fs)))==2:
mx= max(fs)... | Review this code and list any quality issues. | [
{
"issue": "Function 'isValid' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 10
}
] | 1 |
python | """Test Axis user management.
pytest --cov-report term-missing --cov=axis.pwdgrp_cgi tests/test_pwdgrp_cgi.py
"""
import pytest
from unittest.mock import Mock
from axis.pwdgrp_cgi import SGRP_ADMIN, User, Users
def test_users():
"""Verify that you can list users."""
mock_request = Mock()
users = Users(... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_modify' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 68
}
] | 1 |
python | """Custom COVID19 Compartmental model
"""
from ..model import CompartmentalModel
class COVID19(CompartmentalModel):
def __init__(self,
N,
beta,
incubation_rate = 1/3.7,
recovery_rate_asymptomatic = 1/4.7,
recovery_rate_mild = 1/4.7,
... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 68 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 8
},
{
"issue": "Function '__init__' has 17 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 8
}
... | 2 |
python | from lib.utils import top_k
from TraditionalRecommenderSystems.MatrixFactorization.Models import BaseMF
import numpy as np
import pandas as pd
import torch
from torch import nn
import torch.utils.data as data
from tqdm import tqdm
class MatrixFactorization(object):
def __init__(self, user_item_pairs, user_list, i... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 10 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 12
}
] | 1 |
python | import numpy as np
import copy
def softmax(x):
probs = np.exp(x - np.max(x))
probs /= np.sum(probs)
return probs
class TreeNode(object):
"""A node in the MCTS tree. Each node keeps track of its own value Q, prior probability P, and
its visit-count-adjusted prior score u.
"""
def __init_... | Review this code and list any quality issues. | [
{
"issue": "Function '_playout' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 92
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line"... | 2 |
python | import torch
import torch.nn as nn
import torch.nn.functional as F
from proj.archs.cluster.vgg import VGGNet
from proj.archs.segmentation.net10a import SegmentationNet10aTrunk, \
SegmentationNet10a
from proj.utils.segmentation.baselines.general import get_patches
__all__ = ["SegmentationNet10aDoersch"]
class Do... | Review this code and list any quality issues. | [
{
"issue": "Function 'forward' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 32
},
{
"issue": "Function 'forward' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": ... | 2 |
python | # Copyright (c) 2009-2010 Mitch Garnaat http://garnaat.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modi... | 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": 99
},
{
"issue": "Function 'endElement' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"lin... | 3 |
python | from toposort import toposort
import contextlib
import numpy as np
import tensorflow as tf
import tensorflow.contrib.graph_editor as ge
import time
import sys
sys.setrecursionlimit(10000)
# refers back to current module if we decide to split helpers out
util = sys.modules[__name__]
# getting rid of "WARNING:tensorflow... | Review this code and list any quality issues. | [
{
"issue": "Function 'gradients' has cyclomatic complexity 84 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 32
},
{
"issue": "Function 'gradients' is 163 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "criti... | 5 |
python | """
Script taken from: https://github.com/orlp/pygrafix
Appropriate Licence applies!
"""
import argparse
import os
import pathlib
import re
def generate_pxd(glew_header_loc, dest="."):
with open(glew_header_loc) as fin:
data = fin.read()
# cython doesn't support const
data = re.sub(r"\bconst\b",... | Review this code and list any quality issues. | [
{
"issue": "Function 'generate_pxd.mod_func' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 202
},
{
"issue": "Function 'generate_pxd' has cyclomatic complexity 19 (threshold: 5). Consider breaking it into smaller functions.",
"sever... | 3 |
python | import logging
from collections import namedtuple
from typing import (Any, Callable, Dict, # pylint: disable=unused-import
Generator, Iterable, List, Optional, Text, Union, cast)
import schema_salad.validate as validate
from schema_salad.sourceline import SourceLine, bullets, strip_dup_lineno
impo... | Review this code and list any quality issues. | [
{
"issue": "Function 'check_types' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 23
},
{
"issue": "Function 'can_assign_src_to_sink' has cyclomatic complexity 27 (threshold: 5). Consider breaking it into smaller functions.... | 7 |
python | import tensorflow as tf
from contextlib import contextmanager
from PIL import Image
from keras import backend as K
from keras.utils.data_utils import OrderedEnqueuer
def heteroscedastic_loss(attention=False,
block_attention_gradient=False,
mode='l2'):
''' Heteroscedastic loss.'''
def h... | Review this code and list any quality issues. | [
{
"issue": "Function 'heteroscedastic_loss.het_loss' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 14
}
] | 1 |
python | """File utility functions for Sphinx."""
import os
import posixpath
from typing import TYPE_CHECKING, Callable, Dict
from docutils.utils import relative_path
from sphinx.util.osutil import copyfile, ensuredir
from sphinx.util.typing import PathMatcher
if TYPE_CHECKING:
from sphinx.util.template import BaseRende... | Review this code and list any quality issues. | [
{
"issue": "Function 'copy_asset_file' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 16
},
{
"issue": "Function 'copy_asset' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"... | 4 |
python | #!/bin/env python3
def puzzle2():
entries = set()
allowed1 = {"byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"}
valid = 0
# Read in all the rules
with open('input.txt', 'r') as input:
l = 0
for line in input:
l += 1
if line == "\n":
# print(entr... | Review this code and list any quality issues. | [
{
"issue": "Function 'puzzle2' has cyclomatic complexity 34 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 2
},
{
"issue": "Function 'puzzle2' is 77 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 2 |
python | from collections import OrderedDict
import pytest
from company.constants import RegistrationNumberChoices
from company.models import Country
from company.serialisers import CompanySerialiser
from .factories import CompanyFactory, IndustryCodeFactory, PrimaryIndustryCodeFactory, RegistrationNumberFactory
@pytest.mar... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_company_serialiser' is 127 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 12
}
] | 1 |
python | import pandas as pd
import numpy as np
from collections import defaultdict
import RemovingDataSolns as s
# Question 1
def prop_sals_test(prop_sals):
'''
INPUT prop_sals - a float as the percent of missing values in the salary column
Prints statement related to the correctness of the solution of ... | Review this code and list any quality issues. | [
{
"issue": "Function 'question7_check' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 83
}
] | 1 |
python | from kivy.app import App
from kivy.factory import Factory
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from kivy.clock import Clock
from kivy.uix.label import Label
from electrum_commercium_gui.kivy.i18n import _
from datetime import datetime
from electrum_commercium.util import InvalidPass... | Review this code and list any quality issues. | [
{
"issue": "Function 'update' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 107
}
] | 1 |
python | # Copyright 2019 The Pigweed 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | Review this code and list any quality issues. | [
{
"issue": "Function '_default_cc_and_c_kwargs' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 75
}
] | 1 |
python | """
ARIA -- Ambiguous Restraints for Iterative Assignment
A software for automated NOE assignment
Version 2.3
Copyright (C) Benjamin Bardiaux, Michael Habeck, Therese Malliavin,
Wolfgang Rieping, and Michael Nilges
All rights reserved.
NO W... | Review this code and list any quality issues. | [
{
"issue": "Function 'calculatePeaksize' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 141
},
{
"issue": "Function 'calculatePeaksize' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"sever... | 2 |
python | import numpy as np
import torch
import torch.nn.functional as F
import torch.nn as nn
from sklearn.utils import class_weight
from utils.lovasz_losses import lovasz_softmax
import pdb
def make_one_hot(labels, classes):
one_hot = torch.FloatTensor(labels.size()[0], classes, labels.size()[2], labels.size()[3]).zero_... | 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": 54
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 69
}
] | 2 |
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 requ... | Review this code and list any quality issues. | [
{
"issue": "Function 'update' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 83
}
] | 1 |
python | import time
import telebot
from Responses import TELE_HI_GREET, TELE_CLASS_CODE
import BacaPdf as pdf
import csvHandler as csvH
with open('API_KEY.txt') as API_KEY:
bot = telebot.TeleBot(API_KEY.read()[:-1])
#Message type check
#ClassCode, TimeInterval, Status, Feedback
messageBool = [False, False,... | Review this code and list any quality issues. | [
{
"issue": "Function 'schedulesCom' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 78
}
] | 1 |
python | from django.shortcuts import render
from django.http import JsonResponse
from django.http import HttpResponse, HttpResponseNotFound
from django.contrib.auth.decorators import login_required
from floweditor.models import B1if
from easywebdavbiffy import *
import xmltodict
import StringIO
from zipfile import ZipFile
from... | Review this code and list any quality issues. | [
{
"issue": "Function 'downloadScenarioZip' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 119
}
] | 1 |
python | import re
from anchore_engine.apis.authorization import (
ActionBoundPermission,
Permission,
RequestingAccountValue,
get_authorizer,
)
from anchore_engine.apis.context import ApiRequestContextProxy
from anchore_engine.apis.exceptions import BadRequest
from anchore_engine.clients.services import interna... | Review this code and list any quality issues. | [
{
"issue": "Function 'delete_analysis_archive_rule' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 99
},
{
"issue": "Function 'get_analysis_archive_rule' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into... | 2 |
python | import logging
import mist.api.users.models
import mist.api.auth.models
import mist.api.tag.models
log = logging.getLogger(__name__)
class AuthContext(object):
def __init__(self, user, token):
assert isinstance(user, mist.api.users.models.User)
self.user = user
assert isinstance(token... | Review this code and list any quality issues. | [
{
"issue": "Function '_raise' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 32
}
] | 1 |
python | import json
import base64
from tests import TestBase
class TestAuth(TestBase):
def setUp(self):
super(TestAuth, self).setUp()
self.data_user = {
'username': 'nicolas',
'password': 'password',
}
def test_auth(self):
self.app.post(
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_auth' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 17
}
] | 1 |
python | from django.contrib import auth
from django.conf import settings
from django.utils.deprecation import MiddlewareMixin
class FakeLoginMiddleware(MiddlewareMixin):
"""
Login using ?fakeuser=USERNAME as long as settings.DEBUG is true.
This is for DEVELOPMENT ONLY.
"""
def process_request(self, requ... | Review this code and list any quality issues. | [
{
"issue": "Function 'process_request' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 13
}
] | 1 |
python | # Copyright 2018, 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 by applicable law o... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_replaces_lambda_to_called_graph_on_tuple_of_selections_from_arg_with_tf_of_same_type' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 158
},
{
"issue": "Function 'test_replaces_lambda_to_called_graph_on_tuple_of... | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.