language
stringclasses
1 value
code
stringlengths
407
33.3k
instruction
stringclasses
1 value
flaws
listlengths
1
17
flaw_count
int64
1
17
python
import datasets.import_datasets as im import pandas as pd #Takes a very long time to run, probably not worth running when the output datasets = ["BMS1", "BMS2", "toydata" "uci_retail", "mushroom", "Belgian_retail", "chess", "conn...
Review this code and list any quality issues.
[ { "issue": "Function 'main' is 31 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 22 } ]
1
python
import sys; sys.path.append('..') from API.tools import EarlyStopping from API.exp_basic import Exp_Basic import numpy as np import torch import torch.nn as nn from torch import optim from ex_ablation.model import ConvUnet from API.dataloader import load_data import json import os import time import logging from tqd...
Review this code and list any quality issues.
[ { "issue": "Function 'vali' is 30 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 98 }, { "issue": "Function 'vali' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 98 }, { "iss...
4
python
from nose.exc import SkipTest import os import sys import unittest try: maketrans = str.maketrans except AttributeError: from string import maketrans import rdflib """ SWAP N3 parser test suite """ rdf = rdflib.Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#") rdfs = rdflib.Namespace("http://www.w3.or...
Review this code and list any quality issues.
[ { "issue": "Function 'test_cases' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 101 }, { "issue": "Function 'test_cases' is 34 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor",...
2
python
# coding: utf-8 import re import six from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization class ComputeFlavorGroupsInfo: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): Th...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 40 }, { "issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line"...
3
python
# File : transformer.py # Author : Zhengkun Tian # Email : zhengkun.tian@outlook.com import logging import torch import torch.nn as nn from otrans.module.pos import MixedPositionalEncoding, RelPositionalEncoding from otrans.module.ffn import PositionwiseFeedForward from otrans.module.attention import MultiHeadedSel...
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": 17 }, { "issue": "Function 'forward' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "li...
5
python
import torch import torch.distributions as td import torch.nn as nn import torch.nn.functional as tf from rlpyt.utils.collections import namedarraytuple from rlpyt.utils.buffer import buffer_method from dreamer.utils.module import FreezeParameters RSSMState = namedarraytuple('RSSMState', ['mean', 'std', 'stoch', 'det...
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": 52 }, { "issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 57 }, { "is...
5
python
"""Tests for C-implemented GenericAlias.""" import unittest import pickle import copy from collections import ( defaultdict, deque, OrderedDict, Counter, UserDict, UserList ) from collections.abc import * from concurrent.futures import Future from concurrent.futures.thread import _WorkItem from contextlib import A...
Review this code and list any quality issues.
[ { "issue": "Function 'test_parameters' is 38 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 174 }, { "issue": "Function 'test_abc_callable' is 39 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", ...
2
python
from os import listdir from os.path import isfile, join from re import compile from typing import Dict from PyQt5.QtCore import QRegularExpression from PyQt5.QtGui import QRegularExpressionValidator from PyQt5.QtWidgets import QDialog, QMessageBox from dbus import DBusException from snapper.SnapperConnection import S...
Review this code and list any quality issues.
[ { "issue": "Function '__get_filesystems' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 76 } ]
1
python
import os import pathlib import shutil import typing import alembic.command import alembic.config from mlrun import mlconf class AlembicUtil(object): def __init__(self, alembic_config_path: pathlib.Path): self._alembic_config_path = str(alembic_config_path) self._alembic_config = alembic.config....
Review this code and list any quality issues.
[ { "issue": "Function 'init_alembic' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 18 } ]
1
python
"""Module for parsing montly school collections data.""" from typing import ClassVar import pandas as pd import pdfplumber from ...utils.misc import rename_tax_rows from ...utils.pdf import extract_words, words_to_table from .core import COLLECTION_TYPES, MonthlyCollectionsReport, get_column_names class SchoolTaxCo...
Review this code and list any quality issues.
[ { "issue": "Function 'transform' is 44 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 79 } ]
1
python
class Solution: def removeInterval(self, intervals: List[List[int]], toBeRemoved: List[int]) -> List[List[int]]: res = [] x, y = toBeRemoved for interval in intervals: l, h = interval if l <= x <= h <= y: res.append([l, x]) elif x ...
Review this code and list any quality issues.
[ { "issue": "Function 'removeInterval' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 2 } ]
1
python
import json import boto3 from datetime import datetime import ast class S3DAO: USERS_DISHES_S3_KEY = 'users-dishes' PAGE_CONTENT_S3_KEY = 'page-content' BRINE_DATA_BUCKET_NAME = 'brine-data' def __init__(self): self.s3_client = None self.users_dishes_last_modified = None self.p...
Review this code and list any quality issues.
[ { "issue": "Function 'parseFunctions' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 112 }, { "issue": "Function 'parseFunctions' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": ...
3
python
# -*- coding: utf-8 -*- import dgl import networkx as nx import numpy as np import torch from dataset.codesearchnet import MAX_SUB_TOKEN_LEN def build_graph(tree_dict, dictionary, tree_leaf_subtoken=1, DGLGraph_PAD_WORD=-1) -> dgl.DGLGraph: # 叶子节点存的是拆开后的subtoken ,当然,如果token拆不开,那就还是一个token # 用来训练的.pt数据里叶子节点...
Review this code and list any quality issues.
[ { "issue": "Function 'build_graph._build' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 21 }, { "issue": "Function 'build_graph._build' is 31 lines long. Functions over 25 lines are harder to test and maintain.", "sev...
5
python
from pytest import fixture from novel_tools.common import NovelData, Type from novel_tools.processors.transformers.pattern_transformer import PatternTransformer @fixture def pattern_transformer(): return PatternTransformer({ 'units': [ { 'filter': { 'type': ...
Review this code and list any quality issues.
[ { "issue": "Function 'pattern_transformer' is 31 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 7 } ]
1
python
import json import logging import pathlib import shutil import tempfile from typing import List import marshmallow_dataclass from defusedxml.ElementTree import parse from osgeo import gdal from osgeo import ogr from osgeo import osr from .util_numba import _accumulate_dicts logger = logging.getLogger(__name__) @ma...
Review this code and list any quality issues.
[ { "issue": "Function 'combine_all_bands_into_vrt' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 87 }, { "issue": "Function 'combine_all_bands_into_vrt' is 76 lines long. Functions over 25 lines are harder to test and main...
4
python
# -*- coding: utf8 -*- import json from console.models import Resource, resource_repo from console.exceptions import NotFound, AlreadyExist, PermissionDenied from console.factory import logger class ResourceService: resource_repo = resource_repo def __init__(self, rid: str = None, task_intra_id: str = None...
Review this code and list any quality issues.
[ { "issue": "Function 'create_resource' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 19 }, { "issue": "Function 'update_resource' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "mino...
2
python
######################################################################## import sys import numpy import vtk from vtk_py import * ######################################################################## def transform_mesh_w_4x4mat(infilename, outfilename, matrix): ugrid = vtk.vtkUnstructuredGrid() if(infilename[l...
Review this code and list any quality issues.
[ { "issue": "Function 'transform_mesh_w_4x4mat' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 10 } ]
1
python
#!/usr/bin/env python3 """ Create a new Table of Contents file (toc.xhtml) for The Big Book of Key. """ import re from argparse import ArgumentParser from datetime import datetime from pathlib import Path from typing import Dict, List from lxml.html import parse, fromstring, tostring, HtmlElement from copy import deep...
Review this code and list any quality issues.
[ { "issue": "Function 'merge_in_sorted' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 61 }, { "issue": "Function 'run' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity...
3
python
# -*- coding: utf-8 -*- # A Survey on Negative Transfer # https://github.com/chamwen/NT-Benchmark import numpy as np import argparse import os import torch as tr import torch.nn as nn import torch.optim as optim from utils import network, loss, utils from utils.network import calc_coeff from utils.dataloader import rea...
Review this code and list any quality issues.
[ { "issue": "Function 'data_load' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 18 }, { "issue": "Function 'train_target' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", ...
3
python
#!/bin/python3 ''' This file is to plot a graph with the following setting. 1. We first select an image x_0 2. We then add some pertubation to the image to get x_1 (its type shall configurable in the future, but we set it to be random or loaded from file currently) 3. Next, we plot f(x) for all x on the segment...
Review this code and list any quality issues.
[ { "issue": "Function 'parse_config' is 66 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 36 }, { "issue": "Function 'main' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", ...
3
python
# -*-coding:utf-8-*- import os from flask import request, render_template, g from flask_babel import gettext from flask_wtf.csrf import CSRFError from werkzeug.utils import redirect from apps.configs.sys_config import DEFAULT_ADMIN_LOGIN_PAGE from apps.core.auth.rest_token_auth import OsrTokenError, SecretTokenError, ...
Review this code and list any quality issues.
[ { "issue": "Function 'internal_server_error' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 108 }, { "issue": "Function 'internal_server_error' is 38 lines long. Functions over 25 lines are harder to test and maintain.", ...
2
python
# -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Peng Zhou # -------------------------------------------------------- from __future__ import absolute_import from __future__ import division from ...
Review this code and list any quality issues.
[ { "issue": "Function 'roidb_gt' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 132 }, { "issue": "Function 'roidb_gt' is 36 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", ...
6
python
# Copyright (c) OpenMMLab. All rights reserved. # This scripts is copied from # https://github.com/activitynet/ActivityNet/blob/master/Crawler/Kinetics/download.py # noqa: E501 # The code is licensed under the MIT licence. import argparse import os import ssl import subprocess import mmcv from joblib import Parallel,...
Review this code and list any quality issues.
[ { "issue": "Function 'download_clip' is 30 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 18 } ]
1
python
#!env python3 from flask import Flask, request, redirect from hashlib import sha256 import hmac import base64 import time import urllib # allow for relative importing if run directly if __name__ == "__main__": from config import secrets, reports, listen_port else: from .config import secrets, reports, listen_p...
Review this code and list any quality issues.
[ { "issue": "Function 'sign_report_url' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 19 }, { "issue": "Function 'sign_report_url' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity":...
2
python
#!/usr/bin/env python # Contributors: # Christopher P. Barnes <senrabc@gmail.com> # Andrei Sura: github.com/indera # Mohan Das Katragadda <mohan.das142@gmail.com> # Philip Chase <philipbchase@gmail.com> # Ruchi Vivek Desai <ruchivdesai@gmail.com> # Taeber Rapczak <taeber@ufl.edu> # Nicholas Rejack <nrejack@ufl.edu> # ...
Review this code and list any quality issues.
[ { "issue": "Function 'main' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 23 }, { "issue": "Function 'main' is 92 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": ...
2
python
# Source: https://github.com/tracy-talent/curriculum/blob/ecaf850cb7932f23b5d7c0323e80a9f9a408bef6/Machine%20Learning/Dimension%20Reduction/src/ISOMAP.py from numpy import * from hw4.libs.metrics import _1NN from queue import PriorityQueue from os import path import time def loadData(filename): content = open(fi...
Review this code and list any quality issues.
[ { "issue": "Function 'mds' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 55 }, { "issue": "Function 'isomap' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor...
2
python
#!/usr/bin/env python import zmq import numpy as np import numpy.matlib import importlib from collections import defaultdict from fastcluster import linkage_vector import selfdrive.messaging as messaging from selfdrive.services import service_list from selfdrive.controls.lib.latcontrol_helpers import calc_lookahead_off...
Review this code and list any quality issues.
[ { "issue": "Function 'radard_thread' has cyclomatic complexity 41 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 46 }, { "issue": "Function 'radard_thread' is 167 lines long. Functions over 25 lines are harder to test and maintain.", "severity"...
2
python
#!/usr/bin/env python """MIT - CSAIL - Gifford Lab - seqgra seqgra complete pipeline: 1. generate data based on data definition (once), see run_simulator.py 2. train model on data (once), see run_learner.py 3. evaluate model performance with SIS, see run_sis.py @author: Konstantin Krismer """ import argparse import...
Review this code and list any quality issues.
[ { "issue": "Function 'run_seqgra_summary' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 41 }, { "issue": "Function 'create_parser' is 70 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line...
2
python
"""Functions that work on collections of shapes """ from __future__ import division, print_function import numpy as np from .convex import convex_area, convex_centroid __all__ = ['recenter_polygon', 'centroid_for_shapes', 'centroid_for_uncomputed_shapes', 'recenter_system', 'rescale_and_recenter...
Review this code and list any quality issues.
[ { "issue": "Function 'recenter_system' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 72 }, { "issue": "Function 'rescale_and_recenter_system' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller fu...
4
python
# # The Python Imaging Library # $Id$ # # WMF stub codec # # history: # 1996-12-14 fl Created # 2004-02-22 fl Turned into a stub driver # 2004-02-23 fl Added EMF support # # Copyright (c) Secret Labs AB 1997-2004. All rights reserved. # Copyright (c) Fredrik Lundh 1996. # # See the README file for information on...
Review this code and list any quality issues.
[ { "issue": "Function '_open' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 84 }, { "issue": "Function '_open' is 34 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line"...
2
python
#coding: UTF-8 import serial import sys import time import binascii import json import math from collections import deque import paho.mqtt.client as mqtt # 設定系変数(デフォルト値で初期化) MQTT_BROKER_IP = "localhost" MQTT_BROKER_PORT = 1883 SERIAL_PORT = "COM3" MESSAGE_LEN = 240 NO_MESSAGE_TIME_OUT = 5.0 NO_MESSAGE_MAX_COUNT = 30...
Review this code and list any quality issues.
[ { "issue": "Function 'on_message' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 53 }, { "issue": "Function 'on_message' is 44 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", ...
4
python
import logging import re from collections import Counter from textblob import TextBlob from textblob.exceptions import MissingCorpusError from . import Bigrams, english_bigrams class SummaryEvaluator(object): """Evaluate summaries of a book to find a usable summary. A usable summary will have good coverag...
Review this code and list any quality issues.
[ { "issue": "Function 'add' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 82 }, { "issue": "Function 'score' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.", "severity": "criti...
3
python
import random def guess_random_number(tries, start, stop): number = random.randint(start, stop) while tries != 0: print('Number of tries left: ', tries) guess = int(input("Guess a number between 1 and 10: ")) tries -= 1 if guess < number: print('Guess high...
Review this code and list any quality issues.
[ { "issue": "Function 'guess_random_number' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 3 } ]
1
python
import threading import ipaddress import socket import time from typing import Optional, Union import requests requests.packages.urllib3.disable_warnings() # type: ignore from concurrent.futures import ThreadPoolExecutor import colorama colorama.init(autoreset=True) import os import bs4 import argparse folder = os.pa...
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": 24 }, { "issue": "Function 'main' is 36 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": ...
6
python
# -*- coding: utf-8 -*- """Tornado request argument parsing module. Example: :: import tornado.web from marshmallow import fields from webargs.tornadoparser import use_args class HelloHandler(tornado.web.RequestHandler): @use_args({'name': fields.Str(missing='World')}) def get(self, ...
Review this code and list any quality issues.
[ { "issue": "Function '__getitem__' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 46 }, { "issue": "Function 'handle_error' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", ...
3
python
# Copyright The PyTorch Lightning team. # # 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 i...
Review this code and list any quality issues.
[ { "issue": "Function 'test_post_local_sgd_model_averaging' is 33 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 167 }, { "issue": "Function 'test_post_local_sgd_model_averaging_value_error' is 27 lines long. Functions over 25 lines are harder ...
2
python
""" Implementation from: https://raw.githubusercontent.com/Zenglinxiao/OpenNMT-py/bert/onmt/encoders/bert.py @Author: Zenglinxiao """ import torch.nn as nn from onmt.encoders.transformer import TransformerEncoderLayer from onmt.utils.misc import sequence_mask class BertEncoder(nn.Module): """BERT Encoder: A Tran...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 9 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 24 } ]
1
python
#!/usr/bin/env python # _*_ coding:UTF-8 _*_ """ __author__ = 'shede333' """ import plistlib import shutil from pathlib import Path from mobileprovision import util from mobileprovision import MobileProvisionModel RESOURCE_PATH = Path(__file__).resolve().parent.joinpath("resource") SRC_MP_PATH = RESOURCE_PATH.joinpa...
Review this code and list any quality issues.
[ { "issue": "Function 'test_mp_property' is 43 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 64 } ]
1
python
import distutils.ccompiler import os import os.path import platform import shutil import sys import subprocess from typing import Optional, List import setuptools import setuptools.msvc from setuptools import Extension from cupy_builder._context import Context import cupy_builder.install_build as build def _nvcc_ge...
Review this code and list any quality issues.
[ { "issue": "Function '_nvcc_gencode_options' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 18 }, { "issue": "Function '_nvcc_gencode_options' is 63 lines long. Functions over 25 lines are harder to test and maintain.",...
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 14 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 16 }, { "issue": "Function '__init__' is 53 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical...
3
python
""" Translates DMU table in NCGMP09-style geodatabase into a fully formatted Microsoft Word .docx file. Assumes formatting and style names in USGS Pubs template MapManuscript_v1-0_04-11.dotx Arguments Input geodatabase Output workspace Output filename (if it doesn't end in .docx, .docx will be appended) ...
Review this code and list any quality issues.
[ { "issue": "Function 'notNullText' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 48 } ]
1
python
# coding=utf-8 # Copyright 2020 The TensorFlow GAN 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 applicabl...
Review this code and list any quality issues.
[ { "issue": "Function 'test_compute_progress' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 64 }, { "issue": "Function 'test_generator_grad_norm_progress' is 51 lines long. Functions over 25 lines are harder to test and maintain.", "...
3
python
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.14.4 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from pprint import pformat from six import iteritems import re...
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": 57 }, { "issue": "Function '__init__' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical"...
4
python
import serial import time from datetime import datetime import sys import os import yaml import csv import re from validate_commands import CommandValidator def build_cmd_string(command, values=None, format="%0.3f"): txt = command if values is not None: #print("%s \t %s"%(command, values)) i...
Review this code and list any quality issues.
[ { "issue": "Function 'build_cmd_string' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 14 }, { "issue": "Function 'split_command' has cyclomatic complexity 19 (threshold: 5). Consider breaking it into smaller functions.", ...
7
python
import logging import time import pytest from helpers.cluster import ClickHouseCluster logging.getLogger().setLevel(logging.INFO) logging.getLogger().addHandler(logging.StreamHandler()) @pytest.fixture(scope="module") def cluster(): try: cluster = ClickHouseCluster(__file__) cluster.add_instance...
Review this code and list any quality issues.
[ { "issue": "Function 'test_s3_zero_copy_replication' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 51 }, { "issue": "Function 'test_s3_zero_copy_on_hybrid_storage' is 30 lines long. Functions over 25 lines are harder to test and maintai...
2
python
import os import time from cereal import car from common.kalman.simple_kalman import KF1D from common.realtime import DT_CTRL from selfdrive.car import gen_empty_fingerprint from selfdrive.config import Conversions as CV from selfdrive.controls.lib.events import Events from selfdrive.controls.lib.vehicle_model import V...
Review this code and list any quality issues.
[ { "issue": "Function 'create_common_events' has cyclomatic complexity 25 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 88 }, { "issue": "Function 'create_common_events' is 37 lines long. Functions over 25 lines are harder to test and maintain.", ...
3
python
import operator def main(): print ('Compute algorithm rank') f = open('../data/join_results/sj.12_30.log.csv') output_f = open('../data/join_results/sj.12_30.log.ranked.csv', 'w') header = f.readline() header = header.strip() header += ',1st time,2nd time,3rd time,4th time, 1st #splits,2nd #sp...
Review this code and list any quality issues.
[ { "issue": "Function 'main' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 3 }, { "issue": "Function 'main' is 35 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": ...
2
python
from email import generator from os import listdir from os.path import isfile, join import numpy as np import random import string from pymongo import MongoClient from models.user import User from models.channel import * from models.workspace import Workspace from models.settings import * # Setup Mongo client class M...
Review this code and list any quality issues.
[ { "issue": "Function 'random_data_test' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 99 } ]
1
python
"""Environment wrapper class for logging episodes. This can be used to record data from a subject playing the task. See ../../moog_demos/restore_logged_data.py for an example of how to read log files. Note: This logger records everything about the environment, which can be a lot of data (depending on the task). If yo...
Review this code and list any quality issues.
[ { "issue": "Function '_serialize' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 39 }, { "issue": "Function '_log_description' is 50 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "m...
2
python
# -*- coding: utf-8 -*- ''' Management of the Salt beacons ============================== .. versionadded:: 2015.8.0 .. code-block:: yaml ps: beacon.present: - save: True - enable: False - services: salt-master: running apache2: stopped sh: beacon....
Review this code and list any quality issues.
[ { "issue": "Function 'present' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 44 }, { "issue": "Function 'present' is 51 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "...
4
python
# -*- coding: utf-8 -*- # """ Unit tests for data related operations. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import os import sys import copy import shutil import tempfile import ssl import tensorflow as ...
Review this code and list any quality issues.
[ { "issue": "Function 'setUp' is 79 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 29 }, { "issue": "Function '_run_and_test' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", ...
3
python
# vim: expandtab:ts=4:sw=4 from __future__ import absolute_import import numpy as np from . import kalman_filter from . import linear_assignment from . import iou_matching from .track import Track class Tracker: """ This is the multi-target tracker. Parameters ---------- metric : nn_matching.Near...
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": 40 }, { "issue": "Function 'update' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line":...
3
python
from __future__ import unicode_literals from wtforms.form import Form from wtforms.validators import ValidationError from .fields import CSRFTokenField class SecureForm(Form): """ Form that enables CSRF processing via subclassing hooks. """ csrf_token = CSRFTokenField() def __init__(self, form...
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": 16 } ]
1
python
import csv import json import os import shutil from collections import defaultdict import numpy as np import torch import torchvision from termcolor import colored from torch.utils.tensorboard import SummaryWriter COMMON_TRAIN_FORMAT = [('episode', 'E', 'int'), ('step', 'S', 'int'), ('episode_...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 110 }, { "issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 110 }, ...
9
python
# MIT LICENSE # # Copyright 1997 - 2020 by IXIA Keysight # # 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, modify,...
Review this code and list any quality issues.
[ { "issue": "Function 'find' has 8 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 110 } ]
1
python
""" Custom demographic model for our example. """ import numpy import dadi def prior_onegrow_mig((nu1F, nu2B, nu2F, m, Tp, T), (n1,n2), pts): """ Model with growth, split, bottleneck in pop2, exp recovery, migration nu1F: The ancestral population size after growth. (Its initial size is defined t...
Review this code and list any quality issues.
[ { "issue": "Function 'prior_onegrow_mig' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 7 }, { "issue": "Function 'prior_onegrow_mig_mscore' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "l...
3
python
""" pygame-menu https://github.com/ppizarror/pygame-menu TEST WIDGET SELECTION. Test widget selection effects. License: ------------------------------------------------------------------------------- The MIT License (MIT) Copyright 2017-2021 Pablo Pizarro R. @ppizarror Permission is hereby granted, free of charge, t...
Review this code and list any quality issues.
[ { "issue": "Function 'test_highlight' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 96 } ]
1
python
# Copyright 2008-2018 pydicom authors. See LICENSE file for details. """Benchmarks for the numpy_handler module. Requires asv and numpy. """ from platform import python_implementation from tempfile import TemporaryFile import numpy as np from pydicom import dcmread from pydicom.data import get_testdata_file from py...
Review this code and list any quality issues.
[ { "issue": "Function '_create_temporary_dataset' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 50 } ]
1
python
# pylint: disable=redefined-builtin # pylint: disable=too-many-arguments """Test related method and functionality of Context.""" import pytest import responses from decanter.core import Context from decanter.core.core_api import TrainInput from decanter.core.extra import CoreStatus from decanter.core.jobs import DataU...
Review this code and list any quality issues.
[ { "issue": "Function 'test_data_fail' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 33 }, { "issue": "Function 'test_data_stop' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": ...
3
python
################################################################################ # The Neural Network (NN) based Speech Synthesis System # https://svn.ecdf.ed.ac.uk/repo/inf/dnn_tts/ # # Centre for Speech Technology Research # University of Edinburgh, UK # ...
Review this code and list any quality issues.
[ { "issue": "Function 'sort_and_validate' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 99 }, { "issue": "Function 'generate_plot' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", ...
4
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 'get_hit_rate_and_ndcg' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 55 }, { "issue": "Function 'test_hit_rate_and_ndcg' is 123 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "majo...
2
python
""" Test utilities for testing :Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu> :Date: 2019-10-31 :Copyright: 2019, Karr Lab :License: MIT """ from scipy.constants import Avogadro import os import shutil import tempfile import unittest from de_sim.simulation_config import SimulationConfig from wc_sim.multialgorit...
Review this code and list any quality issues.
[ { "issue": "Function 'test_check_simul_results' is 101 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 37 } ]
1
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 5/15/20 4:49 PM # @File : grover.py # qubit number=4 # total number=37 import cirq import cirq.google as cg from typing import Optional import sys from math import log2 import numpy as np #thatsNoCode from cirq.contrib.svg import SVGCircuit # Symbols for...
Review this code and list any quality issues.
[ { "issue": "Function 'make_circuit' is 33 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 20 } ]
1
python
# -*- coding: utf-8 -*- """Region office topology. Office has tro floors _________terminate_switch_____________________ | | | switch-1-floor switch-2-floor | | | hosts switchF2 hosts ...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' is 41 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 27 }, { "issue": "Function 'runMinimalTopo' is 32 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": ...
2
python
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import argparse import glob import multiprocessing as mp import os import time import cv2 import tqdm import numpy as np from detectron2.config import get_cfg from detectron2.data.detection_utils import read_image from detectron2.utils.logger impor...
Review this code and list any quality issues.
[ { "issue": "Function 'get_parser' is 39 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 36 } ]
1
python
import os.path import tkinter as tk import tkinter.filedialog as fd import tkinter.messagebox as mb def main(): text_editor = TextEditor() text_editor.mainloop() class TextEditor(tk.Tk): def __init__(self): super(TextEditor, self).__init__() self.title('Ugly Text Editor') self....
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": 14 } ]
1
python
import pydantic import pytest from jina.peapods.runtimes.gateway.http.models import ( PROTO_TO_PYDANTIC_MODELS, JinaRequestModel, ) from jina.types.document import Document from tests import random_docs def test_schema_invocation(): for v in vars(PROTO_TO_PYDANTIC_MODELS).values(): v.schema() ...
Review this code and list any quality issues.
[ { "issue": "Function 'test_all_fields_in_document_proto' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 50 }, { "issue": "Function 'test_jina_document_to_pydantic_document_sparse' is 40 lines long. Functions over 25 lines are harder to t...
2
python
#*#*#*./examples/evaluate.py """Official evaluation script for SQuAD version 2.0. In addition to basic functionality, we also compute additional statistics and plot precision-recall curves if an additional na_prob.json file is provided. This file is expected to map question ID's to the model's predicted probability th...
Review this code and list any quality issues.
[ { "issue": "Function 'get_raw_scores' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 82 }, { "issue": "Function 'make_precision_recall_eval' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller fun...
12
python
"""Data manager for the timers.""" from datetime import datetime, timedelta from typing import Optional, List import pymongo from bson import ObjectId from models import TimerModel, TimerListResult, OID_KEY from mongodb.factory.results import WriteOutcome from extutils.checker import arg_type_ensure from extutils.loc...
Review this code and list any quality issues.
[ { "issue": "Function 'add_new_timer' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 32 } ]
1
python
#!/usr/bin/python import datetime import sys import textwrap import common from xml.dom import pulldom PARSER = """\ /** * Copyright 2009 Joe LaPenna */ package com.joelapenna.foursquare.parsers; import com.joelapenna.foursquare.Foursquare; import com.joelapenna.foursquare.error.FoursquareError; import com.joel...
Review this code and list any quality issues.
[ { "issue": "Function 'GenerateClass' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 88 } ]
1
python
# ---------------------------------------------------------------------------- # Copyright (c) 2016-2020, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
Review this code and list any quality issues.
[ { "issue": "Function '_get_biom_filter_function' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 15 }, { "issue": "Function '_filter_table' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.", "severit...
7
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. #----------------------------------------------------------------------...
Review this code and list any quality issues.
[ { "issue": "Function 'create_virtual_network' is 104 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 38 }, { "issue": "Function 'create_virtual_network' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "maj...
3
python
import urllib.parse import bs4 from retrying import retry def test_if_dcos_ui_is_up(cluster): r = cluster.get('/') assert r.status_code == 200 assert len(r.text) > 100 assert 'DC/OS' in r.text # Not sure if it's really needed, seems a bit of an overkill: soup = bs4.BeautifulSoup(r.text, "ht...
Review this code and list any quality issues.
[ { "issue": "Function 'test_if_zookeeper_cluster_is_up' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 58 } ]
1
python
# wordUse - count words in file and print top ten import sys def usage(): """explain usage and exit""" sys.exit("""wordUse - count words in file and print top ten usage: wordUse files""") class wordCount: """Count number of uses of word.""" def __init__(self, word): self.word = word self...
Review this code and list any quality issues.
[ { "issue": "Function 'wordUse' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 19 } ]
1
python
"""Test initialization of the url factory classes""" import unittest from vizier.api.routes.base import UrlFactory from vizier.api.routes.base import PROPERTIES_BASEURL, PROPERTIES_APIDOCURL from vizier.api.routes.task import TaskUrlFactory class TestUrlFactoryInit(unittest.TestCase): def test_init_url_factory...
Review this code and list any quality issues.
[ { "issue": "Function 'test_init_url_factory' is 32 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 12 } ]
1
python
import string import random import time import pytest import os import subprocess from os import path # Provide a list of VMs you want to reuse. VMs should have already microk8s installed. # the test will attempt a refresh to the channel requested for testing # reuse_vms = ['vm-ldzcjb', 'vm-nfpgea', 'vm-pkgbtw'] reus...
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": 23 }, { "issue": "Function '__init__' is 56 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", ...
6
python
import socket from http import HTTPStatus from urllib.request import Request, urlopen, ProxyHandler, build_opener from urllib.parse import urlencode, unquote_plus, quote, quote_plus from urllib.error import HTTPError, URLError class ClientBase: def __init__(self, nacos_host: str, api_level: str = 'v1'): s...
Review this code and list any quality issues.
[ { "issue": "Function 'handle' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 14 } ]
1
python
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2021-05-20 16:25 from typing import Union, List, Callable from elit.common.dataset import TransformableDataset from elit.utils.io_util import read_cells STS_B_TRAIN = 'http://ixa2.si.ehu.es/stswiki/images/4/48/Stsbenchmark.tar.gz#sts-train.csv' STS_B_DEV = 'http://ixa2....
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 9 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 15 } ]
1
python
import os import csv from scrapy.spider import BaseSpider from scrapy.selector import HtmlXPathSelector from scrapy.http import Request, FormRequest from product_spiders.fuzzywuzzy import process from product_spiders.items import Product, ProductLoaderWithNameStrip as ProductLoader HERE = os.path.abspath(os.path.dirn...
Review this code and list any quality issues.
[ { "issue": "Function 'parse_subproducts' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 29 }, { "issue": "Function 'parse_subproducts' is 43 lines long. Functions over 25 lines are harder to test and maintain.", "severi...
2
python
from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.management.base import BaseCommand from django.contrib.sites.models import Site from allauth.socialaccount.models import SocialApp from tamusers.providers.tampere.provider import TampereProvider class Command(Bas...
Review this code and list any quality issues.
[ { "issue": "Function 'handle' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 12 }, { "issue": "Function 'handle' is 34 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "li...
2
python
# -*- coding: utf-8 -*- # Copyright 2017, Additive Regularization of Topic Models. from __future__ import print_function import os import uuid import string import itertools import tempfile import shutil import pytest from six.moves import range, zip import artm.wrapper import artm.wrapper.messages_pb2 as messages...
Review this code and list any quality issues.
[ { "issue": "Function 'test_func' is 125 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 32 } ]
1
python
# while j < n and i < m: # if i == -1 or t[j] == p[i]: # j, i = j+1, i+1 # else: # i = pnext[i] def matching_KMP(t, p, pnext): j, i = 0, 0 n, m = len(t), len(p) while j < n and i < m: if i == -1 or t[j] == p[i]: j, i = j+1, i+1 else: i = pn...
Review this code and list any quality issues.
[ { "issue": "Function 'matching_KMP' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 10 } ]
1
python
def postprocess_decoded_seq(answers): """ Corrects for some extra spaces that are created by the decode method of the tokenizer like in numerical strings example: 1, 000, 000 --> 1,000,000 Args: answers: list[str] Returns: new_answers: list[str] """ new_answers = [] for answer in answers: parts = an...
Review this code and list any quality issues.
[ { "issue": "Function 'postprocess_decoded_seq' has cyclomatic complexity 18 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 1 }, { "issue": "Function 'postprocess_decoded_seq' is 45 lines long. Functions over 25 lines are harder to test and maintain...
2
python
# -*- coding: utf-8 -*- __author__ = 'CongRong <tr3jer@gmail.com>' import difflib from .utils.compat import bytes_decode, xrange hashbits = 128 difflib_threshold = 0.95 simhash_threshold = 0.95 def simhash(tokens): v = [0] * hashbits for t in [string_hash(x) for x in tokens]: for i in xrange(hashbits): bi...
Review this code and list any quality issues.
[ { "issue": "Function 'simhash' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 15 }, { "issue": "Function 'similar' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "...
2
python
# coding=utf-8 # Copyright 2018 The Tensor2Tensor 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...
Review this code and list any quality issues.
[ { "issue": "Function 'testEarlyStoppingHook' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 99 }, { "issue": "Function 'testPlateauOpHook' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "se...
3
python
import logging from typing import Dict, List from overrides import overrides from allennlp.common.file_utils import cached_path from allennlp.data.dataset_readers.dataset_reader import DatasetReader from allennlp.data.instance import Instance from allennlp.data.fields import Field, TextField, ListField, IndexField fr...
Review this code and list any quality issues.
[ { "issue": "Function 'text_to_instance' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 74 }, { "issue": "Function 'text_to_instance' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity...
3
python
""" This module implements the TextResponse class which adds encoding handling and discovering (through HTTP headers) to base Response class. See documentation in docs/topics/request-response.rst """ import re import codecs from scrapy.xlib.BeautifulSoup import UnicodeDammit from scrapy.http.response import Response ...
Review this code and list any quality issues.
[ { "issue": "Function '_get_encoding' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 62 } ]
1
python
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import annotations from typing import TYPE_CHECKING if TYPE_CHECKING: from qlib.backtest.exchange import Exchange from qlib.backtest.position import BasePosition from typing import List, Tuple, Union from ..model.base imp...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 25 }, { "issue": "Function 'reset' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 81 }, { "issu...
5
python
#!/usr/bin/env python3 """This is an example to train a task with TRPO algorithm. Here it runs CubeCrash-v0 environment with 100 iterations. """ import click import gym from metarl import wrap_experiment from metarl.envs import MetaRLEnv, normalize from metarl.experiment import LocalTFRunner from metarl.experiment.de...
Review this code and list any quality issues.
[ { "issue": "Function 'trpo_cubecrash' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 21 } ]
1
python
""" mpld3 Utilities =============== Utility routines for the mpld3 package """ import os import re import shutil import warnings from functools import wraps from . import urls # Make sure that DeprecationWarning gets printed warnings.simplefilter("always", DeprecationWarning) def html_id_ok(objid, html5=False): ...
Review this code and list any quality issues.
[ { "issue": "Function 'write_ipynb_local_js' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 57 }, { "issue": "Function 'write_ipynb_local_js' is 45 lines long. Functions over 25 lines are harder to test and maintain.", ...
2
python
import torch import torch.nn as nn import torch.nn.functional as F from operations import FactorizedReduce, StdConv, MixedOp class Cell(nn.Module): """ Cell for search Each edge is mixed and continuous relaxed. """ def __init__(self, num_nodes, c_prev_prev, c_prev, c_cur, reduction_prev, reduction_cu...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 12 }, { "issue": "Function '__init__' has 8 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", ...
5
python
import os import skylink from skylink import testing import numpy as np from astropy.table import Table import FoFCatalogMatching import pytest # noqa # TODO: test the matching with more than two catalogs # TODO: test N-way matching with `linking_lengths` as a dictionary # TODO: test if we catch illegal footprints th...
Review this code and list any quality issues.
[ { "issue": "Function 'make_mockup.tnormal' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 22 } ]
1
python
import argparse def get_parser(): parser = argparse.ArgumentParser() parser.add_argument( '--model_dir', default='./text_training', help='Output directory for model and training stats.') parser.add_argument( '--data_dir', default='./text_data', help='Directory to download the...
Review this code and list any quality issues.
[ { "issue": "Function 'get_parser' is 46 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 2 } ]
1
python
# win32.py - utility functions that use win32 API # # Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. """Utility functions that use win32 API. Mark Hammond's win32all ...
Review this code and list any quality issues.
[ { "issue": "Function 'lookup_reg' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 95 }, { "issue": "Function 'system_rcpath_win32' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", ...
3
python
from flask import render_template, g, request, url_for, jsonify, redirect from flask_login import current_user, login_required import flask_menu as menu from sqlalchemy import desc, asc from app import app, lm from app.user.models import User, UserJoin from app.contest.models import Contest from app.submission.models ...
Review this code and list any quality issues.
[ { "issue": "Function 'more_activities' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 81 }, { "issue": "Function 'more_activities' is 44 lines long. Functions over 25 lines are harder to test and maintain.", "severity":...
2
python
# -*- coding: utf-8 -*- ''' Exodus Add-on Copyright (C) 2016 Exodus This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your opti...
Review this code and list any quality issues.
[ { "issue": "Function 'movie' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 38 }, { "issue": "Function 'sources' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "m...
3
python
#! /usr/bin/env python import os import subprocess import svgwrite import math import shutil ######################################################################################################################## def ensure_requisite_folders(path): folder = os.path.split(path)[0] if len(folder) and not os.pat...
Review this code and list any quality issues.
[ { "issue": "Function '_kot' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 29 } ]
1
python
"""Implement the SequentialGeometricProgram class""" from time import time from collections import OrderedDict import numpy as np from ..exceptions import InvalidGPConstraint, Infeasible, UnnecessarySGP from ..keydict import KeyDict from ..nomials import Variable from .gp import GeometricProgram from ..nomials import P...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 51 }, { "issue": "Function '__init__' is 50 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", ...
10
python
# Copyright (c) 2012 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 ...
Review this code and list any quality issues.
[ { "issue": "Function '_view_hypervisor' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 40 }, { "issue": "Function '_view_hypervisor' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity...
3
python
# -*- coding: utf-8 -* from __future__ import print_function from googleapiclient.discovery import build from httplib2 import Http from oauth2client import file, client, tools import json import os from flask import Flask from flask import jsonify from flask_cors import CORS app = Flask(__name__) #A tester cors = ...
Review this code and list any quality issues.
[ { "issue": "Function 'getSheetInfo' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 36 }, { "issue": "Function 'getSheetInfo' is 48 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "mino...
2